maybe order matters?
This commit is contained in:
parent
c8e91ba949
commit
f60d5f2114
@ -26,6 +26,15 @@ public class IndexController {
|
|||||||
this.pasteService = pasteService;
|
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 = "/")
|
@GetMapping(value = "/")
|
||||||
public String home() {
|
public String home() {
|
||||||
return "index";
|
return "index";
|
||||||
@ -55,13 +64,4 @@ public class IndexController {
|
|||||||
return "redirect:/";
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ const upload = async () => {
|
|||||||
throw new Error(data.message);
|
throw new Error(data.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.location.href = "/" + data.id;
|
window.location.href = "/" + data.key;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error:", error);
|
console.error("Error:", error);
|
||||||
toast(`${error.message || "An error occurred while uploading the paste."}`);
|
toast(`${error.message || "An error occurred while uploading the paste."}`);
|
||||||
|
Reference in New Issue
Block a user