update script: find first .crx file in github releases

This commit is contained in:
Max Headroom 2022-11-15 17:05:47 +01:00
parent 3201cd4593
commit 1936244f0a

View file

@ -18,7 +18,10 @@ for ext in exts:
if ext["updateMethod"] == "github": if ext["updateMethod"] == "github":
with urlopen(ext["updateUrl"]) as r: with urlopen(ext["updateUrl"]) as r:
latest = json.load(r)[0] latest = json.load(r)[0]
ext["url"] = latest["assets"][0]["browser_download_url"] for asset in latest["assets"]:
if asset["browser_download_url"].endswith(".crx"):
ext["url"] = asset["browser_download_url"]
break
with urlopen(ext["url"]) as blob: with urlopen(ext["url"]) as blob:
sha256 = hashlib.new("SHA256") sha256 = hashlib.new("SHA256")
if blob.status == 200: if blob.status == 200: