fix 旧版数据导致写入app.env发生的错误

This commit is contained in:
叮叮当
2024-03-01 16:16:13 +08:00
parent 33ac34cca2
commit a046560ddb
2 changed files with 5 additions and 9 deletions

View File

@@ -290,7 +290,7 @@
"ConfigCenter": {
"name": "配置中心",
"description": "快速调整部分系统设定。",
"version": "2.1",
"version": "2.2",
"icon": "setting.png",
"author": "jxxghp",
"level": 1

View File

@@ -17,7 +17,7 @@ class ConfigCenter(_PluginBase):
# 插件图标
plugin_icon = "setting.png"
# 插件版本
plugin_version = "2.1"
plugin_version = "2.2"
# 插件作者
plugin_author = "jxxghp"
# 作者主页
@@ -85,18 +85,14 @@ class ConfigCenter(_PluginBase):
# 自定义配置,以换行分隔
config_params = self.__parse_params(conf.get("params"))
conf.update(config_params)
# 去掉无效参数
try:
conf.pop("enabled")
conf.pop("writeenv")
conf.pop("params")
except KeyError:
pass
# 读写app.env
env_path = settings.CONFIG_PATH / "app.env"
for key, value in conf.items():
if not key:
continue
# 如果参数不在支持列表中, 则跳过
if key not in self.settings_attributes and key not in config_params:
continue
if value is None or str(value) == "None":
value = ''
else: