diff --git a/src/main/java/im/zhaojun/zfile/controller/admin/DebugController.java b/src/main/java/im/zhaojun/zfile/controller/admin/DebugController.java index 9bf854a..6379860 100644 --- a/src/main/java/im/zhaojun/zfile/controller/admin/DebugController.java +++ b/src/main/java/im/zhaojun/zfile/controller/admin/DebugController.java @@ -6,6 +6,7 @@ import im.zhaojun.zfile.service.SystemConfigService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; @@ -18,6 +19,7 @@ public class DebugController { @Resource private SystemConfigService systemConfigService; + @ResponseBody @GetMapping("/debug/resetPwd") public ResultBean resetPwd() { if (debug) { diff --git a/src/main/java/im/zhaojun/zfile/controller/home/FileController.java b/src/main/java/im/zhaojun/zfile/controller/home/FileController.java index 1032674..d5d8a0d 100644 --- a/src/main/java/im/zhaojun/zfile/controller/home/FileController.java +++ b/src/main/java/im/zhaojun/zfile/controller/home/FileController.java @@ -41,6 +41,9 @@ import java.util.Objects; @RestController public class FileController { + @Value("${zfile.debug}") + private Boolean debug; + @Resource private SystemConfigService systemConfigService; @@ -115,7 +118,7 @@ public class FileController { @GetMapping("/config/{driveId}") public ResultBean getConfig(@PathVariable(name = "driveId") Integer driveId, String path) { SystemFrontConfigDTO systemConfig = systemConfigService.getSystemFrontConfig(driveId); - + systemConfig.setDebugMode(debug); AbstractBaseFileService fileService = driveContext.get(driveId); DriveConfig driveConfig = driveConfigService.findById(driveId); String fullPath = StringUtils.removeDuplicateSeparator(path + ZFileConstant.PATH_SEPARATOR + ZFileConstant.README_FILE_NAME); diff --git a/src/main/java/im/zhaojun/zfile/model/dto/SystemFrontConfigDTO.java b/src/main/java/im/zhaojun/zfile/model/dto/SystemFrontConfigDTO.java index bf71b3d..f29dcb6 100644 --- a/src/main/java/im/zhaojun/zfile/model/dto/SystemFrontConfigDTO.java +++ b/src/main/java/im/zhaojun/zfile/model/dto/SystemFrontConfigDTO.java @@ -41,4 +41,6 @@ public class SystemFrontConfigDTO { private String readme; + private Boolean debugMode; + } \ No newline at end of file