Skip to content

Commit

Permalink
Merge pull request #722 from Night-stars-1/main-beta
Browse files Browse the repository at this point in the history
chore: 添加API代理
  • Loading branch information
Night-stars-1 authored Oct 4, 2023
2 parents 6b1f64d + ced171c commit b63af80
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Honkai_Star_Rail.py
Original file line number Diff line number Diff line change
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

0 comments on commit b63af80

Please sign in to comment.