Fix: webui.config.DeployConfig caught setattr from father class

This commit is contained in:
LmeSzinc 2023-09-10 14:52:37 +08:00
parent b160c8dc4d
commit 3f2847960f
3 changed files with 10 additions and 11 deletions

View File

@ -80,12 +80,11 @@ class DeployConfig(ConfigModel):
self.config_template = {}
self.read()
self.GitOverCdn = self.Repository in ['cn']
if self.Repository in [
'cn',
'global',
]:
self.Repository = 'https://github.com/LmeSzinc/StarRailCopilot'
# 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()
@ -121,11 +120,13 @@ class DeployConfig(ConfigModel):
Returns:
str: Absolute filepath.
"""
if os.path.isabs(path):
return path
return (
os.path.abspath(os.path.join(self.root_filepath, path))
.replace(r"\\", "/")
.replace("\\", "/")
.replace('"', '"')
)
@cached_property
@ -134,7 +135,6 @@ class DeployConfig(ConfigModel):
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))
.replace(r"\\", "/")
.replace("\\", "/")
.replace('"', '"')
)
@cached_property

View File

@ -129,10 +129,9 @@ class GitManager(DeployConfig):
Progress.GitShowVersion()
def git_over_cdn(self):
folder = os.path.abspath(os.path.join(__file__, '../../../'))
client = GitOverCdnClient(
url='https://vip.123pan.cn/1815343254/pack/LmeSzinc_StarRailCopilot_master',
folder=folder,
folder=self.root_filepath,
)
client.logger = logger
_ = client.update(keep_changes=self.KeepLocalChanges)

View File

@ -189,7 +189,7 @@ def alas_instance():
# out.extend(mod_instance())
if not len(out):
out = ['alas']
out = ['src']
return out