feat: add demo site config
This commit is contained in:
@@ -37,6 +37,12 @@ func NewSettingsController(userService *services.UserService, loginLogService *s
|
||||
|
||||
// ChangePassword 修改密码
|
||||
func (sc *SettingsController) ChangePassword(c *gin.Context) {
|
||||
// 演示模式下禁止修改密码
|
||||
if constant.DemoMode {
|
||||
utils.BadRequest(c, "演示模式下不能修改密码")
|
||||
return
|
||||
}
|
||||
|
||||
var req struct {
|
||||
OldPassword string `json:"old_password" binding:"required"`
|
||||
NewPassword string `json:"new_password" binding:"required,min=6"`
|
||||
@@ -83,6 +89,7 @@ func (sc *SettingsController) GetPublicSiteSettings(c *gin.Context) {
|
||||
constant.KeyTitle: settings[constant.KeyTitle],
|
||||
constant.KeySubtitle: settings[constant.KeySubtitle],
|
||||
constant.KeyIcon: settings[constant.KeyIcon],
|
||||
"demo_mode": constant.DemoMode,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,12 @@ func (tc *TerminalController) HandleWebSocket(c *gin.Context) {
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
// 演示模式下禁用终端
|
||||
if constant.DemoMode {
|
||||
conn.WriteMessage(websocket.TextMessage, []byte("\r\n\033[1;33m[演示模式] 终端功能已禁用\033[0m\r\n"))
|
||||
return
|
||||
}
|
||||
|
||||
// Windows 使用 pipe 模式,Unix 使用 PTY 模式
|
||||
if runtime.GOOS == "windows" {
|
||||
tc.handlePipeMode(conn)
|
||||
|
||||
Reference in New Issue
Block a user