mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 12:27:33 +08:00
Del: Remove Shanghai reverse proxy
feat: redirect util allow update the same key
This commit is contained in:
parent
35cfd9e1c0
commit
2f3055b8ac
@ -208,8 +208,7 @@
|
||||
"value": "default",
|
||||
"option": [
|
||||
"default",
|
||||
"cn_gz_reverse_proxy",
|
||||
"cn_sh_reverse_proxy"
|
||||
"cn_gz_reverse_proxy"
|
||||
]
|
||||
},
|
||||
"ResearchRecord": {
|
||||
|
@ -66,7 +66,7 @@ DropRecord:
|
||||
AzurStatsID: null
|
||||
API:
|
||||
value: default
|
||||
option: [ default, cn_gz_reverse_proxy, cn_sh_reverse_proxy ]
|
||||
option: [ default, cn_gz_reverse_proxy]
|
||||
ResearchRecord:
|
||||
value: do_not
|
||||
option: [ do_not, save, upload, save_and_upload ]
|
||||
|
@ -47,7 +47,7 @@ class GeneratedConfig:
|
||||
# Group `DropRecord`
|
||||
DropRecord_SaveFolder = './screenshots'
|
||||
DropRecord_AzurStatsID = None
|
||||
DropRecord_API = 'default' # default, cn_gz_reverse_proxy, cn_sh_reverse_proxy
|
||||
DropRecord_API = 'default' # default, cn_gz_reverse_proxy
|
||||
DropRecord_ResearchRecord = 'do_not' # do_not, save, upload, save_and_upload
|
||||
DropRecord_CommissionRecord = 'do_not' # do_not, save, upload, save_and_upload
|
||||
DropRecord_CombatRecord = 'do_not' # do_not, save
|
||||
|
@ -506,6 +506,7 @@ class ConfigUpdater:
|
||||
(('GemsFarming.GemsFarming.VanguardChange', 'GemsFarming.GemsFarming.VanguardEquipChange'),
|
||||
'GemsFarming.GemsFarming.ChangeVanguard',
|
||||
change_ship_redirect),
|
||||
('Alas.DropRecord.API', 'Alas.DropRecord.API', api_redirect2)
|
||||
]
|
||||
redirection += [
|
||||
(
|
||||
@ -598,7 +599,7 @@ class ConfigUpdater:
|
||||
value = []
|
||||
error = False
|
||||
for attribute in source:
|
||||
tmp = deep_get(old, keys=attribute, default=None)
|
||||
tmp = deep_get(old, keys=attribute)
|
||||
if tmp is None:
|
||||
error = True
|
||||
continue
|
||||
@ -606,7 +607,7 @@ class ConfigUpdater:
|
||||
if error:
|
||||
continue
|
||||
else:
|
||||
value = deep_get(old, keys=source, default=None)
|
||||
value = deep_get(old, keys=source)
|
||||
if value is None:
|
||||
continue
|
||||
|
||||
@ -614,10 +615,11 @@ class ConfigUpdater:
|
||||
value = update_func(value)
|
||||
|
||||
if isinstance(target, tuple):
|
||||
for i in range(0, len(target)):
|
||||
if deep_get(old, keys=target[i], default=None) is None:
|
||||
deep_set(new, keys=target[i], value=value[i])
|
||||
elif deep_get(old, keys=target, default=None) is None:
|
||||
for k, v in zip(target, value):
|
||||
# Allow update same key
|
||||
if (deep_get(old, keys=k) is None) or (source == target):
|
||||
deep_set(new, keys=k, value=v)
|
||||
elif (deep_get(old, keys=target) is None) or (source == target):
|
||||
deep_set(new, keys=target, value=value)
|
||||
|
||||
return new
|
||||
@ -634,7 +636,11 @@ class ConfigUpdater:
|
||||
dict:
|
||||
"""
|
||||
old = read_file(filepath_config(config_name))
|
||||
return self.config_update(old, is_template=is_template)
|
||||
new = self.config_update(old, is_template=is_template)
|
||||
# The updated config did not write into file, although it doesn't matters.
|
||||
# Commented for performance issue
|
||||
# self.write_file(config_name, new)
|
||||
return new
|
||||
|
||||
@staticmethod
|
||||
def write_file(config_name, data, mod_name='alas'):
|
||||
|
@ -499,8 +499,7 @@
|
||||
"name": "Upload API",
|
||||
"help": "If CN users cannot connect to AzurStat, recommend to use \"reverse proxy\"",
|
||||
"default": "Default (Cloudflare)",
|
||||
"cn_gz_reverse_proxy": "Reverse proxy (Guangzhou, South China)",
|
||||
"cn_sh_reverse_proxy": "Reverse proxy (Shanghai, East China)"
|
||||
"cn_gz_reverse_proxy": "Reverse proxy (Guangzhou, South China)"
|
||||
},
|
||||
"ResearchRecord": {
|
||||
"name": "Research Record",
|
||||
|
@ -499,8 +499,7 @@
|
||||
"name": "DropRecord.API.name",
|
||||
"help": "DropRecord.API.help",
|
||||
"default": "default",
|
||||
"cn_gz_reverse_proxy": "cn_gz_reverse_proxy",
|
||||
"cn_sh_reverse_proxy": "cn_sh_reverse_proxy"
|
||||
"cn_gz_reverse_proxy": "cn_gz_reverse_proxy"
|
||||
},
|
||||
"ResearchRecord": {
|
||||
"name": "DropRecord.ResearchRecord.name",
|
||||
|
@ -499,8 +499,7 @@
|
||||
"name": "上传线路",
|
||||
"help": "如果国内用户无法连接到 AzurStat,可以使用\"国内反向代理\"",
|
||||
"default": "默认 (Cloudflare)",
|
||||
"cn_gz_reverse_proxy": "国内反向代理 (广州)",
|
||||
"cn_sh_reverse_proxy": "国内反向代理 (上海)"
|
||||
"cn_gz_reverse_proxy": "国内反向代理 (广州)"
|
||||
},
|
||||
"ResearchRecord": {
|
||||
"name": "科研截图",
|
||||
|
@ -499,8 +499,7 @@
|
||||
"name": "上傳線路",
|
||||
"help": "如果大陸用戶無法連接到AzurStat,可以使用\"國內反向代理\"",
|
||||
"default": "默認 (Cloudflare)",
|
||||
"cn_gz_reverse_proxy": "國內反向代理 (廣州)",
|
||||
"cn_sh_reverse_proxy": "國內反向代理 (上海)"
|
||||
"cn_gz_reverse_proxy": "國內反向代理 (廣州)"
|
||||
},
|
||||
"ResearchRecord": {
|
||||
"name": "科研截圖",
|
||||
|
@ -92,3 +92,12 @@ def change_ship_redirect(value):
|
||||
return 'ship_equip'
|
||||
else:
|
||||
return 'ship'
|
||||
|
||||
def api_redirect2(value):
|
||||
"""
|
||||
remove shanghai proxy, use guangzhou
|
||||
"""
|
||||
if value == 'cn_sh_reverse_proxy':
|
||||
return 'cn_gz_reverse_proxy'
|
||||
else:
|
||||
return value
|
Loading…
Reference in New Issue
Block a user