From 7a80760419a33f556196c6dd3b0fe07d8eee53b0 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Thu, 7 Jul 2022 19:58:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E8=AE=BE=E7=BD=AE=E4=B8=AD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A6=81=E6=AD=A2=E6=90=9C=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E6=93=8E=E3=80=81=E7=A6=81=E6=AD=A2=E7=88=AC=E8=99=AB=E3=80=81?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E8=AE=BF=E9=97=AE=E7=9A=84=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E7=AD=89=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/setup/sql_upgrade.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/internal/setup/sql_upgrade.go b/internal/setup/sql_upgrade.go index 87ad3ff7..b9050f56 100644 --- a/internal/setup/sql_upgrade.go +++ b/internal/setup/sql_upgrade.go @@ -762,5 +762,33 @@ func upgradeV0_4_9(db *dbs.DB) error { } } + // 升级管理配置 + { + one, err := db.FindOne("SELECT value FROM edgeSysSettings WHERE code=?", systemconfigs.SettingCodeAdminSecurityConfig) + if err != nil { + return err + } + if one != nil { + var valueJSON = one.GetBytes("value") + if len(valueJSON) > 0 { + var config = &systemconfigs.SecurityConfig{} + err = json.Unmarshal(valueJSON, config) + if err == nil { + config.DenySearchEngines = true + config.DenySpiders = true + configJSON, err := json.Marshal(config) + if err != nil { + return errors.New("encode SecurityConfig failed: " + err.Error()) + } else { + _, err := db.Exec("UPDATE edgeSysSettings SET value=? WHERE code=?", configJSON, systemconfigs.SettingCodeAdminSecurityConfig) + if err != nil { + return err + } + } + } + } + } + } + return nil }