From 3f2847960fe4cbb2d04633941401f135311f1a9b Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:52:37 +0800 Subject: [PATCH] Fix: webui.config.DeployConfig caught setattr from father class --- deploy/Windows/config.py | 16 ++++++++-------- deploy/Windows/git.py | 3 +-- module/config/utils.py | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/deploy/Windows/config.py b/deploy/Windows/config.py index 6939d9cc8..adf91ee67 100644 --- a/deploy/Windows/config.py +++ b/deploy/Windows/config.py @@ -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 diff --git a/deploy/Windows/git.py b/deploy/Windows/git.py index d0a73c215..2843c877e 100644 --- a/deploy/Windows/git.py +++ b/deploy/Windows/git.py @@ -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) diff --git a/module/config/utils.py b/module/config/utils.py index b8e653a0b..8159fcb06 100644 --- a/module/config/utils.py +++ b/module/config/utils.py @@ -189,7 +189,7 @@ def alas_instance(): # out.extend(mod_instance()) if not len(out): - out = ['alas'] + out = ['src'] return out