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 }} 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: diff --git "a/plugins/Search Unicode \342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" "b/plugins/Search Unicode \342\200\223 Identify-B9EE77F84A9141C3850BB329D45B8D9A.json" index adac3f14e..85a58bace 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.4/SearchUnicode.Emoji.zip", + "UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.4/SearchUnicode.Identify.zip", "LatestReleaseDate": "2025-02-06T03:49:37Z", "DateAdded": "2025-01-19T01:42:28Z" } \ No newline at end of file diff --git "a/plugins/Search Unicode \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" "b/plugins/Search Unicode \342\200\223 Search-10DB6EB0939443BCA556ACCF93AA98BF.json" index eb217c75e..912c4b721 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.4/SearchUnicode.Emoji.zip", + "UrlDownload": "https://github.com/blueset/flow-search-unicode/releases/download/v1.0.4/SearchUnicode.Search.zip", "LatestReleaseDate": "2025-02-06T03:49:37Z", "DateAdded": "2025-01-19T01:42:28Z" } \ No newline at end of file