Skip to content

Commit

Permalink
Merge pull request #723 from Starry-Wind/main-beta
Browse files Browse the repository at this point in the history
Main beta
  • Loading branch information
Night-stars-1 authored Oct 4, 2023
2 parents d2c465e + b63af80 commit bbaa915
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
24 changes: 22 additions & 2 deletions Honkai_Star_Rail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [],
Expand All @@ -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': [],
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions utils/update_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit bbaa915

Please sign in to comment.