fix: Fix the issue where the demo configuration takes effect (#9468)

This commit is contained in:
ssongliu 2025-07-09 10:10:49 +08:00 committed by GitHub
parent 383bdd5f15
commit 355e656caa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,7 @@
base:
install_dir: /opt
mode: dev
is_demo: false
remote_url:
app_repo: https://apps-assets.fit2cloud.com

View file

@ -50,7 +50,6 @@ func Init() {
}
global.CONF = serverConfig
global.CONF.Base.IsDemo = v.GetBool("system.is_demo")
initBaseInfo()
global.Viper = v

View file

@ -276,6 +276,12 @@ func (b *BaseApi) WsSsh(c *gin.Context) {
}
defer wsConn.Close()
if global.CONF.Base.IsDemo {
if wshandleError(wsConn, errors.New(" demo server, prohibit this operation!")) {
return
}
}
id, err := strconv.Atoi(c.Query("id"))
if wshandleError(wsConn, errors.WithMessage(err, "invalid param id in request")) {
return