mirror of
https://github.com/MustardChef/WSABuilds.git
synced 2024-11-30 07:04:14 +01:00
Get Magisk link: Fallback to Jsdelivr
Some regions can't connect to Github smoothly. Fallback to Jsdelivr.
This commit is contained in:
parent
2d831522cf
commit
29c373b9fd
@ -32,8 +32,13 @@ print(f"Generating Magisk download link: release type={magisk_ver}", flush=True)
|
|||||||
if not magisk_ver:
|
if not magisk_ver:
|
||||||
magisk_ver = "stable"
|
magisk_ver = "stable"
|
||||||
if magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or magisk_ver == "debug":
|
if magisk_ver == "stable" or magisk_ver == "beta" or magisk_ver == "canary" or magisk_ver == "debug":
|
||||||
|
try:
|
||||||
magisk_link = json.loads(requests.get(
|
magisk_link = json.loads(requests.get(
|
||||||
f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link']
|
f"https://github.com/topjohnwu/magisk-files/raw/master/{magisk_ver}.json").content)['magisk']['link']
|
||||||
|
except Exception:
|
||||||
|
print("Failed to fetch from GitHub API, fallbacking to jsdelivr...")
|
||||||
|
magisk_link = json.loads(requests.get(
|
||||||
|
f"https://fastly.jsdelivr.net/gh/topjohnwu/magisk-files@master/{magisk_ver}.json").content)['magisk']['link']
|
||||||
print(f"download link: {magisk_link}", flush=True)
|
print(f"download link: {magisk_link}", flush=True)
|
||||||
|
|
||||||
with open(download_dir/tempScript, 'a') as f:
|
with open(download_dir/tempScript, 'a') as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user