mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-22 11:58:07 +08:00
Fix: spare domain of git-over-cdn
This commit is contained in:
@@ -71,7 +71,10 @@ class GitManager(DeployConfig):
|
|||||||
@property
|
@property
|
||||||
def goc_client(self):
|
def goc_client(self):
|
||||||
client = GitOverCdnClient(
|
client = GitOverCdnClient(
|
||||||
url='https://vip.123pan.cn/1818706573/pack/LmeSzinc_AzurLaneAutoScript_master',
|
url=[
|
||||||
|
'https://vip.123pan.cn/1818706573/pack/LmeSzinc_AzurLaneAutoScript_master',
|
||||||
|
'https://1818706573.v.123yx.com/1818706573/pack/LmeSzinc_AzurLaneAutoScript_master',
|
||||||
|
],
|
||||||
folder=self.root_filepath,
|
folder=self.root_filepath,
|
||||||
source='origin',
|
source='origin',
|
||||||
branch='master',
|
branch='master',
|
||||||
@@ -102,4 +105,4 @@ class GitManager(DeployConfig):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
self = GitManager()
|
self = GitManager()
|
||||||
self.goc_client.get_status()
|
self.goc_client.get_status()
|
||||||
|
|||||||
@@ -52,10 +52,14 @@ class GitOverCdnClient:
|
|||||||
def __init__(self, url, folder, source='origin', branch='master', git='git'):
|
def __init__(self, url, folder, source='origin', branch='master', git='git'):
|
||||||
"""
|
"""
|
||||||
Args:
|
Args:
|
||||||
url: http://127.0.0.1:22251/pack/LmeSzinc_AzurLaneAutoScript_master/
|
url (str | list[str]): http://127.0.0.1:22251/pack/LmeSzinc_AzurLaneAutoScript_master/
|
||||||
folder: D:/AzurLaneAutoScript
|
folder: D:/AzurLaneAutoScript
|
||||||
"""
|
"""
|
||||||
self.url = url.strip('/')
|
if isinstance(url, str):
|
||||||
|
self.urls = [url.strip('/')]
|
||||||
|
else:
|
||||||
|
self.urls = [u.strip('/') for u in url]
|
||||||
|
self.url = self.urls[0]
|
||||||
self.folder = folder.replace('\\', '/')
|
self.folder = folder.replace('\\', '/')
|
||||||
self.source = source
|
self.source = source
|
||||||
self.branch = branch
|
self.branch = branch
|
||||||
@@ -100,29 +104,31 @@ class GitOverCdnClient:
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def latest_commit(self) -> str:
|
def latest_commit(self) -> str:
|
||||||
try:
|
for url_base in self.urls:
|
||||||
|
self.url = url_base
|
||||||
url = self.urlpath('/latest.json')
|
url = self.urlpath('/latest.json')
|
||||||
self.logger.info(f'Fetch url: {url}')
|
self.logger.info(f'Fetch url: {url}')
|
||||||
resp = self.session.get(url, timeout=3)
|
|
||||||
except Exception as e:
|
|
||||||
self.logger.error(f'Failed to get remote commit: {e}')
|
|
||||||
return ''
|
|
||||||
|
|
||||||
if resp.status_code == 200:
|
|
||||||
try:
|
try:
|
||||||
info = json.loads(resp.text)
|
resp = self.session.get(url, timeout=3)
|
||||||
commit = info['commit']
|
except Exception as e:
|
||||||
self.logger.attr('LatestCommit', commit)
|
self.logger.error(f'Failed to get remote commit: {e}')
|
||||||
return commit
|
continue
|
||||||
except json.JSONDecodeError:
|
|
||||||
self.logger.error(f'Failed to get remote commit, response is not a json: {resp.text}')
|
if resp.status_code == 200:
|
||||||
return ''
|
try:
|
||||||
except KeyError:
|
info = json.loads(resp.text)
|
||||||
self.logger.error(f'Failed to get remote commit, key "commit" is not found: {resp.text}')
|
commit = info['commit']
|
||||||
return ''
|
self.logger.attr('LatestCommit', commit)
|
||||||
else:
|
return commit
|
||||||
self.logger.error(f'Failed to get remote commit, status={resp.status_code}, text={resp.text}')
|
except json.JSONDecodeError:
|
||||||
return ''
|
self.logger.error(f'Failed to get remote commit, response is not a json: {resp.text}')
|
||||||
|
except KeyError:
|
||||||
|
self.logger.error(f'Failed to get remote commit, key "commit" is not found: {resp.text}')
|
||||||
|
else:
|
||||||
|
self.logger.error(f'Failed to get remote commit, status={resp.status_code}, text={resp.text}')
|
||||||
|
|
||||||
|
self.url = self.urls[0]
|
||||||
|
return ''
|
||||||
|
|
||||||
def download_pack(self):
|
def download_pack(self):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user