1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-04-08 09:16:22 +08:00

Del: Remove Shanghai reverse proxy

feat: redirect util allow update the same key
This commit is contained in:
18870
2023-03-10 20:28:10 +08:00
parent 35cfd9e1c0
commit 2f3055b8ac
9 changed files with 29 additions and 19 deletions

View File

@@ -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'):