From 410a87c426c9eecd097cb87a05f537a9c000a1f2 Mon Sep 17 00:00:00 2001 From: zhaojun1998 Date: Wed, 24 Feb 2021 18:39:47 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20debug=20=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BC=98=E5=8C=96,=20=E5=A2=9E=E5=8A=A0=E5=88=B0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E5=8F=82=E6=95=B0=E6=8E=A5=E5=8F=A3=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../im/zhaojun/zfile/controller/admin/DebugController.java | 2 ++ .../im/zhaojun/zfile/controller/home/FileController.java | 5 ++++- .../im/zhaojun/zfile/model/dto/SystemFrontConfigDTO.java | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) 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