script editor added

This commit is contained in:
Michael Wain 2024-07-06 20:01:20 +03:00
parent be659a79e0
commit 7ce5eba522
3 changed files with 20 additions and 8 deletions

View File

@ -34,14 +34,6 @@ public class FileServerController {
"attachment; filename=\"" + file.getFilename() + "\"").body(file);
}
@GetMapping("/static/javascript/ace/{filename:.+}")
@ResponseBody
public ResponseEntity<Resource> serveFileAce(@PathVariable String filename) {
Resource file = storageService.loadAsResource("static/javascript/ace/" + filename);
return ResponseEntity.ok().contentType(new MediaType("text", "javascript")).header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getFilename() + "\"").body(file);
}
@ExceptionHandler(StorageFileNotFoundException.class)
public ResponseEntity<?> handleStorageFileNotFound(StorageFileNotFoundException exc) {
return ResponseEntity.notFound().build();

View File

@ -168,6 +168,12 @@ public class PanelController {
return "panel";
}
@GetMapping("/script-editor")
public String scriptEditorAdmin(Model model, @RequestHeader("User-Agent") String uagent, @RequestHeader("Accept") String accepth) {
model.addAttribute("is_mobile", new UAgentInfo(uagent, accepth).detectSmartphone());
return "script-editor";
}
@Getter
@Setter
@NoArgsConstructor

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity6">
<head>
<th:block th:insert="~{fragments/header}"></th:block>
<link rel="stylesheet" href="/static/css/util.css">
<link rel="stylesheet" href="/static/css/panel.css">
</head>
<body>
<!-- th:if="${is_mobile}" -->
<script src="/static/javascript/base32.js" type="text/javascript"></script>
<script src="https://www.unpkg.com/ace-builds@latest/src-noconflict/ace.js"></script>
<div th:replace="~{fragments/footer :: div}"></div>
</body>
</html>