|
|
@@ -35,24 +35,30 @@ public class NginxController {
|
|
|
|
|
|
@Operation(summary = "", description = "N")
|
|
|
@GetMapping(value = "/tree", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public String getFileTree(@RequestParam(value = "machineId") String machineId) {
|
|
|
- List<FileTree> list = fileTreeService.getFileTree(baseDir);
|
|
|
- return WebResult.success(list);
|
|
|
+ public String getFileTree(@RequestParam(value = "machineId") String machineId,
|
|
|
+ @RequestParam(value = "path") String path) {
|
|
|
+ //List<FileTree> list = fileTreeService.getFileTree(path);
|
|
|
+ List<FileTree> list = fileTreeService.getFileTree1(path);
|
|
|
+ if (list != null) {
|
|
|
+ return WebResult.success(list);
|
|
|
+ } else {
|
|
|
+ return WebResult.failWithMsg(String.format("path %s not exist", path));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "", description = "N")
|
|
|
@GetMapping(value = "/conf", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public String getNginxConf(@RequestParam(value = "machineId") String machineId,
|
|
|
@RequestParam(value = "path") String path) {
|
|
|
- if (path.startsWith(baseDir)) {
|
|
|
- String content = nginxService.getNginxConf(machineId, path);
|
|
|
- if (content.isBlank()) {
|
|
|
- return WebResult.failWithMsg("not text file");
|
|
|
- } else {
|
|
|
- return WebResult.success(content);
|
|
|
- }
|
|
|
+ String content = nginxService.getNginxConf(machineId, path);
|
|
|
+ if (content == null) {
|
|
|
+ return WebResult.failWithMsg("file not exist");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.isBlank()) {
|
|
|
+ return WebResult.failWithMsg("not text file");
|
|
|
} else {
|
|
|
- return WebResult.failWithMsg("path invalid");
|
|
|
+ return WebResult.success(content);
|
|
|
}
|
|
|
}
|
|
|
|