From 5996da6d311a56c98175985f48aac40fe104cdbe Mon Sep 17 00:00:00 2001 From: cibere <71997063+cibere@users.noreply.github.com> Date: Wed, 5 Feb 2025 08:07:28 -0800 Subject: [PATCH 1/4] fix bug with the first release asset always being fetched --- ci/src/updater.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/ci/src/updater.py b/ci/src/updater.py index fc54e40f8..77895bedd 100644 --- a/ci/src/updater.py +++ b/ci/src/updater.py @@ -1,8 +1,8 @@ # -*-coding: utf-8 -*- import asyncio import aiohttp +import re from typing import List -from unicodedata import name from os import getenv from sys import argv import traceback @@ -12,6 +12,11 @@ from _utils import * from discord import update_hook +github_download_url_regex = re.compile( + r"https://github\.com/(?P[a-zA-Z0-9-]+)/(?P[a-zA-Z0-9\.\-\_]*)/releases/download/(?P[a-zA-Z\.0-9]+)/(?P.*)\.zip" +) + + async def batch_github_plugin_info( info: P, tags: ETagsType, github_token=None, webhook_url: str | None = None ) -> P: @@ -44,11 +49,31 @@ async def batch_github_plugin_info( if info.get(release_date, "") != latest_rel.get("published_at"): info[release_date] = latest_rel.get("published_at") + if assets: - info[url_download] = assets[0]["browser_download_url"] + browser_download_url = None + + if len(assets) > 1: + match = github_download_url_regex.match(info[url_download]) + if not match: + raise ValueError( + f"Download URL did not mach regex: {info[url_download]!r}" + ) + filename = f"{match['filename']}.zip" + for asset in assets: + if asset["browser_download_url"].endswith(filename): + browser_download_url = asset["browser_download_url"] + + info[url_download] = ( + browser_download_url or assets[0]["browser_download_url"] + ) + if webhook_url: await send_notification( - info, clean(latest_rel["tag_name"], "v"), latest_rel, webhook_url + info, + clean(latest_rel["tag_name"], "v"), + latest_rel, + webhook_url, ) info[version] = clean(latest_rel["tag_name"], "v") @@ -77,7 +102,6 @@ def remove_unused_etags(plugin_infos: PluginsType, etags: ETagsType) -> ETagsTyp plugin_ids = [info.get("ID") for info in plugin_infos] for id, tag in etags.items(): - if id not in plugin_ids: print( f"Plugin with ID {id} has been removed. The associated ETag will be also removed now." @@ -94,7 +118,7 @@ async def send_notification( ) -> None: if not webhook_url: return - + if version_tuple(info[version]) != version_tuple(latest_ver): tqdm.write(f"Update detected: {info[plugin_name]} {latest_ver}") try: @@ -102,6 +126,7 @@ async def send_notification( except Exception as e: tqdm.write(str(e)) + async def main(): webhook_url = None if len(argv) > 1: From beb44fa45c29418e34b26993f24f74516be5720e Mon Sep 17 00:00:00 2001 From: cibere <71997063+cibere@users.noreply.github.com> Date: Wed, 5 Feb 2025 08:07:44 -0800 Subject: [PATCH 2/4] update Search Unicode - Identify plugin download url --- ...\342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/plugins/Search Unicode \342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" "b/plugins/Search Unicode \342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" index 821e52222..560723255 100644 --- "a/plugins/Search Unicode \342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" +++ "b/plugins/Search Unicode \342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" @@ -8,7 +8,7 @@ "Website": "https://github.com/blueset/flow-search-unicode", "IcoPath": "https://cdn.jsdelivr.net/gh/blueset/flow-search-unicode@master/Flow.Launcher.Plugin.SearchUnicode.Identify/icon.png?raw=true", "UrlSourceCode": "https://github.com/blueset/flow-search-unicode", - "UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.3/SearchUnicode.Emoji.zip", + "UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.3/SearchUnicode.Identify.zip", "LatestReleaseDate": "2025-02-02T03:47:01Z", "DateAdded": "2025-01-19T01:42:28Z" } \ No newline at end of file From 6e03c4f8892a75d8650aa468bbd4229956dd6395 Mon Sep 17 00:00:00 2001 From: cibere <71997063+cibere@users.noreply.github.com> Date: Wed, 5 Feb 2025 08:07:52 -0800 Subject: [PATCH 3/4] update Search Unicode - Search plugin download url --- ...e \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/plugins/Search Unicode \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" "b/plugins/Search Unicode \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" index 8c80eb1fc..631ee0650 100644 --- "a/plugins/Search Unicode \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" +++ "b/plugins/Search Unicode \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" @@ -8,7 +8,7 @@ "Website": "https://github.com/blueset/flow-search-unicode", "IcoPath": "https://cdn.jsdelivr.net/gh/blueset/flow-search-unicode@master/Flow.Launcher.Plugin.SearchUnicode.Search/icon.png?raw=true", "UrlSourceCode": "https://github.com/blueset/flow-search-unicode", - "UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.3/SearchUnicode.Emoji.zip", + "UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.3/SearchUnicode.Search.zip", "LatestReleaseDate": "2025-02-02T03:47:01Z", "DateAdded": "2025-01-19T01:42:28Z" } \ No newline at end of file From 6753c6dc8a3e89cce435197144308f351c8a5d28 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 6 Feb 2025 12:39:37 +1100 Subject: [PATCH 4/4] add don't fail if empty plugins.json --- .github/workflows/links.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 95aeb7469..6d8a35d66 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -30,4 +30,5 @@ jobs: with: args: --verbose --no-progress plugins.json fail: true + failIfEmpty: false token: ${{ secrets.LINKCHECKER }}