Fix: [ALAS] Deploy config wasn't redirected after Updater.delay()

This commit is contained in:
LmeSzinc 2024-04-22 23:32:53 +08:00
parent a8e2dab328
commit eb7086e809
2 changed files with 14 additions and 6 deletions

View File

@ -80,12 +80,6 @@ class DeployConfig(ConfigModel):
self.config_template = {}
self.read()
# Bypass webui.config.DeployConfig.__setattr__()
# Don't write these into deploy.yaml
super().__setattr__('GitOverCdn', self.Repository in ['cn'])
if self.Repository in ['global', 'cn']:
super().__setattr__('Repository', 'https://github.com/LmeSzinc/StarRailCopilot')
self.write()
self.show_config()
@ -109,9 +103,21 @@ class DeployConfig(ConfigModel):
if hasattr(self, key):
super().__setattr__(key, value)
self.config_redirect()
def write(self):
poor_yaml_write(self.config, self.file)
def config_redirect(self):
"""
Redirect deploy config, must be called after each `read()`
"""
# Bypass webui.config.DeployConfig.__setattr__()
# Don't write these into deploy.yaml
super().__setattr__('GitOverCdn', self.Repository in ['cn'])
if self.Repository in ['global', 'cn']:
super().__setattr__('Repository', 'https://github.com/LmeSzinc/StarRailCopilot')
def filepath(self, path):
"""
Args:

View File

@ -37,6 +37,8 @@ class DeployConfig(_DeployConfig):
if hasattr(self, key):
super().__setattr__(key, value)
self.config_redirect()
def write(self):
"""
Write `self.config` into deploy config.