From 300e44843f6197a4944c082ac0b8f947060e4cce Mon Sep 17 00:00:00 2001 From: Night-stars-1 Date: Tue, 3 Oct 2023 18:57:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E6=9B=B4=E6=94=B9=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Honkai_Star_Rail.py | 4 ++-- utils/update_file.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Honkai_Star_Rail.py b/Honkai_Star_Rail.py index 9ba811c1..870947da 100644 --- a/Honkai_Star_Rail.py +++ b/Honkai_Star_Rail.py @@ -63,7 +63,7 @@ def __init__(self) -> None: 'skip_verify': False, 'type': "map", 'version': "map", - 'url_zip': f"https://raw.githubusercontent.com/{sra_config_obj.github_source}/StarRailAssistant/map/map.zip", + 'url_zip': f"https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/map/map.zip", 'unzip_path': "map", 'keep_folder': [], 'keep_file': [], @@ -75,7 +75,7 @@ def __init__(self) -> None: 'skip_verify': False, 'type': "picture", 'version': "map", - 'url_zip': f"https://raw.githubusercontent.com/{sra_config_obj.github_source}/StarRailAssistant/map/picture.zip", + 'url_zip': f"https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/map/picture.zip", 'unzip_path': "picture", 'keep_folder': [], 'keep_file': [], diff --git a/utils/update_file.py b/utils/update_file.py index 1eb67739..519f5f67 100644 --- a/utils/update_file.py +++ b/utils/update_file.py @@ -219,7 +219,7 @@ async def is_latest(self, type: str, version: str, is_log: bool = True): return await self.is_sra_latest(type, version, is_log) for index, __ in enumerate(range(3)): try: - url_version = f"{raw_proxy}https://raw.githubusercontent.com/Night-stars-1/Auto_Star_Rail_MAP/main/version.json" if "http" in raw_proxy or raw_proxy == "" else f"https://raw.githubusercontent.com/{self.github_source}/StarRailAssistant/{version}/version.json".replace("raw.githubusercontent.com", raw_proxy) + url_version = f"{raw_proxy}https://raw.githubusercontent.com/Night-stars-1/Auto_Star_Rail_MAP/main/version.json" if "http" in raw_proxy or raw_proxy == "" else f"https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/{version}/version.json".replace("raw.githubusercontent.com", raw_proxy) remote_version = await get(url_version, timeout=2) remote_version = remote_version.json()["version"] break @@ -278,9 +278,9 @@ async def update_file(self, raw_proxy = sra_config_obj.rawgithub_proxy url_zip = url_proxy+url_zip if "http" in url_proxy or url_proxy == "" else url_zip.replace("github.com", url_proxy) if type == "star": - url_list = f"{raw_proxy}https://raw.githubusercontent.com/{self.github_source}/StarRailAssistant/main/{type}_list.json" if "http" in raw_proxy or raw_proxy == "" else f"https://raw.githubusercontent.com/{self.github_source}/StarRailAssistant/main/{type}_list.json".replace("raw.githubusercontent.com", raw_proxy) + url_list = f"{raw_proxy}https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/main/{type}_list.json" if "http" in raw_proxy or raw_proxy == "" else f"https://raw.githubusercontent.com/Starry-Wind/StarRailAssistant/main/{type}_list.json".replace("raw.githubusercontent.com", raw_proxy) else: - url_list = f"{raw_proxy}https://raw.githubusercontent.com/Night-stars-1/Auto_Star_Rail_MAP/main/{type}_list.json" if "http" in raw_proxy or raw_proxy == "" else f"https://raw.githubusercontent.com/{self.github_source}/StarRailAssistant_MAP/main/{type}_list.json".replace("raw.githubusercontent.com", raw_proxy) + url_list = f"{raw_proxy}https://raw.githubusercontent.com/Night-stars-1/Auto_Star_Rail_MAP/main/{type}_list.json" if "http" in raw_proxy or raw_proxy == "" else f"https://raw.githubusercontent.com/Night-stars-1/StarRailAssistant_MAP/main/{type}_list.json".replace("raw.githubusercontent.com", raw_proxy) #tmp_zip = os.path.join(tmp_dir, f"{type}.zip") tmp_zip = Path() / tmp_dir / f"{type}.zip" if not os.path.exists(tmp_dir): From ced171cf42f35624bec7d90a9fb5eff418c00f3b Mon Sep 17 00:00:00 2001 From: Night-stars-1 Date: Tue, 3 Oct 2023 19:09:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0API=E4=BB=A3?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Honkai_Star_Rail.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Honkai_Star_Rail.py b/Honkai_Star_Rail.py index 870947da..67a0efe6 100644 --- a/Honkai_Star_Rail.py +++ b/Honkai_Star_Rail.py @@ -224,6 +224,26 @@ def set_config(self, start = True): url_ms = [i.replace(" "," "*(len(max(url_ms, key=len))-len(i))) if len(i) < len(max(url_ms, key=len)) else i for i in url_ms] option = options[url_ms.index(questionary.select(title, url_ms).ask())] sra_config_obj.rawgithub_proxy = option + title = _("请选择API代理地址:(不使用代理选空白选项)") + options = ['https://github.srap.link/', ''] + url_ms = [] + pbar = tqdm.tqdm(total=len(options), desc=_('测速中'), unit_scale=True, unit_divisor=1024, colour="green") + for index,url in enumerate(options): + if url == "": + url = "https://api.github.com" + elif "https://" not in url: + url = f"https://"+url + try: + response = asyncio.run(get(url)) + ms = response.elapsed.total_seconds() + except: + ms = 999 + finally: + pbar.update(1) + url_ms.append(options[index]+f" {ms}ms") + url_ms = [i.replace(" "," "*(len(max(url_ms, key=len))-len(i))) if len(i) < len(max(url_ms, key=len)) else i for i in url_ms] + option = options[url_ms.index(questionary.select(title, url_ms).ask())] + sra_config_obj.apigithub_proxy = option title = _("请选择你的仓库来源:") options = ["Starry-Wind", "Night-stars-1"] option = questionary.select(title, options).ask()