maybe order matters?
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m4s
Publish Docker Image / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m14s

This commit is contained in:
Lee 2024-06-04 19:22:56 +01:00
parent c8e91ba949
commit f60d5f2114
2 changed files with 10 additions and 10 deletions

View File

@ -26,6 +26,15 @@ public class IndexController {
this.pasteService = pasteService;
}
/**
* This is to allow for Hastebin compatibility.
*/
@PostMapping(value = "/documents")
public ResponseEntity<?> uploadPaste(@RequestBody String content, @RequestHeader(HttpHeaders.CONTENT_TYPE) String contentType) {
String id = pasteService.createPaste(content, contentType);
return ResponseEntity.ok(Map.of("key", id));
}
@GetMapping(value = "/")
public String home() {
return "index";
@ -55,13 +64,4 @@ public class IndexController {
return "redirect:/";
}
}
/**
* This is to allow for Hastebin compatibility.
*/
@PostMapping(value = "/documents")
public ResponseEntity<?> uploadPaste(@RequestBody String content, @RequestHeader(HttpHeaders.CONTENT_TYPE) String contentType) {
String id = pasteService.createPaste(content, contentType);
return ResponseEntity.ok(Map.of("key", id));
}
}

View File

@ -32,7 +32,7 @@ const upload = async () => {
throw new Error(data.message);
}
window.location.href = "/" + data.id;
window.location.href = "/" + data.key;
} catch (error) {
console.error("Error:", error);
toast(`${error.message || "An error occurred while uploading the paste."}`);