mirror of
https://github.com/zfile-dev/zfile.git
synced 2025-04-19 05:34:52 +00:00
✨ 新增 debug 模式, 可访问数据库控制台和重置密码
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package im.zhaojun.zfile.controller.admin;
|
||||
|
||||
|
||||
import im.zhaojun.zfile.model.support.ResultBean;
|
||||
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 javax.annotation.Resource;
|
||||
|
||||
@Controller
|
||||
public class DebugController {
|
||||
|
||||
@Value("${zfile.debug}")
|
||||
private Boolean debug;
|
||||
|
||||
@Resource
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@GetMapping("/debug/resetPwd")
|
||||
public ResultBean resetPwd() {
|
||||
if (debug) {
|
||||
systemConfigService.updateUsernameAndPwd("admin", "123456");
|
||||
return ResultBean.success();
|
||||
} else {
|
||||
return ResultBean.error("未开启 DEBUG 模式,不允许进行此操作。");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,6 +86,11 @@
|
||||
"name": "zfile.tmp.path",
|
||||
"type": "java.lang.String",
|
||||
"description": "临时文件路径."
|
||||
},
|
||||
{
|
||||
"name": "zfile.debug",
|
||||
"type": "java.lang.Boolean",
|
||||
"description": "是否开启 debug 模式."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,3 +1,34 @@
|
||||
zfile:
|
||||
debug: false
|
||||
log:
|
||||
path: ${user.home}/.zfile/logs
|
||||
db:
|
||||
path: ${user.home}/.zfile/db/zfile
|
||||
tmp:
|
||||
path: ${user.home}/.zfile/tmp
|
||||
cache:
|
||||
auto-refresh:
|
||||
interval: 1
|
||||
timeout: 1800
|
||||
constant:
|
||||
readme: readme.md
|
||||
password: password.txt
|
||||
preview:
|
||||
audio:
|
||||
maxFileSizeMb: 5
|
||||
text:
|
||||
maxFileSizeKb: 512
|
||||
onedrive:
|
||||
clientId: 09939809-c617-43c8-a220-a93c1513c5d4
|
||||
clientSecret: _l:zI-_yrW75lV8M61K@z.I2K@B/On6Q
|
||||
redirectUri: https://zfile.jun6.net/onedrive/callback
|
||||
scope: offline_access User.Read Files.ReadWrite.All
|
||||
onedrive-china:
|
||||
clientId: 4a72d927-1907-488d-9eb2-1b465c53c1c5
|
||||
clientSecret: Y9CEA=82da5n-y_]KAWAgLH3?R9xf7Uw
|
||||
redirectUri: https://zfile.jun6.net/onedrive/china-callback
|
||||
scope: offline_access User.Read Files.ReadWrite.All
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
servlet:
|
||||
@@ -13,7 +44,7 @@ spring:
|
||||
settings:
|
||||
web-allow-others: true
|
||||
path: /h2-console
|
||||
enabled: false
|
||||
enabled: ${zfile.debug}
|
||||
datasource:
|
||||
# 初始化数据导入
|
||||
data: classpath*:db/data.sql
|
||||
@@ -47,34 +78,4 @@ spring:
|
||||
chain:
|
||||
gzipped: true
|
||||
profiles:
|
||||
active: prod
|
||||
|
||||
zfile:
|
||||
log:
|
||||
path: ${user.home}/.zfile/logs
|
||||
db:
|
||||
path: ${user.home}/.zfile/db/zfile
|
||||
tmp:
|
||||
path: ${user.home}/.zfile/tmp
|
||||
cache:
|
||||
auto-refresh:
|
||||
interval: 1
|
||||
timeout: 1800
|
||||
constant:
|
||||
readme: readme.md
|
||||
password: password.txt
|
||||
preview:
|
||||
audio:
|
||||
maxFileSizeMb: 5
|
||||
text:
|
||||
maxFileSizeKb: 512
|
||||
onedrive:
|
||||
clientId: 09939809-c617-43c8-a220-a93c1513c5d4
|
||||
clientSecret: _l:zI-_yrW75lV8M61K@z.I2K@B/On6Q
|
||||
redirectUri: https://zfile.jun6.net/onedrive/callback
|
||||
scope: offline_access User.Read Files.ReadWrite.All
|
||||
onedrive-china:
|
||||
clientId: 4a72d927-1907-488d-9eb2-1b465c53c1c5
|
||||
clientSecret: Y9CEA=82da5n-y_]KAWAgLH3?R9xf7Uw
|
||||
redirectUri: https://zfile.jun6.net/onedrive/china-callback
|
||||
scope: offline_access User.Read Files.ReadWrite.All
|
||||
active: prod
|
||||
Reference in New Issue
Block a user