From 33cb12cd4534f019ed895fca79d4f246a1f525a4 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 9 May 2025 10:38:21 -0500 Subject: [PATCH 1/3] yaziPlugins/update: allow updating different default branches Some plugins will not use the `main` default branch and the script would bomb out on that. Support fetching the default branch. --- pkgs/by-name/ya/yazi/plugins/update.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ya/yazi/plugins/update.py b/pkgs/by-name/ya/yazi/plugins/update.py index 510d2e867a0a..4ad6135906c7 100755 --- a/pkgs/by-name/ya/yazi/plugins/update.py +++ b/pkgs/by-name/ya/yazi/plugins/update.py @@ -49,10 +49,25 @@ def get_github_headers() -> Dict[str, str]: return headers +def get_default_branch(owner: str, repo: str, headers: Dict[str, str]) -> str: + """Get the default branch name for a GitHub repository""" + api_url = f"https://api.github.com/repos/{owner}/{repo}" + + try: + response = requests.get(api_url, headers=headers) + response.raise_for_status() + repo_data = response.json() + return repo_data["default_branch"] + except requests.RequestException as e: + print(f"Error fetching repository data: {e}") + print("Falling back to 'main' as default branch") + return "main" + def fetch_plugin_content(owner: str, repo: str, plugin_pname: str, headers: Dict[str, str]) -> str: """Fetch the plugin's main.lua content from GitHub""" + default_branch = get_default_branch(owner, repo, headers) plugin_path = f"{plugin_pname}/" if owner == "yazi-rs" else "" - main_lua_url = f"https://raw.githubusercontent.com/{owner}/{repo}/main/{plugin_path}main.lua" + main_lua_url = f"https://raw.githubusercontent.com/{owner}/{repo}/{default_branch}/{plugin_path}main.lua" try: response = requests.get(main_lua_url, headers=headers) @@ -81,12 +96,14 @@ def check_version_compatibility(plugin_content: str, plugin_name: str, yazi_vers def get_latest_commit(owner: str, repo: str, plugin_pname: str, headers: Dict[str, str]) -> Tuple[str, str]: """Get the latest commit hash and date for the plugin""" + default_branch = get_default_branch(owner, repo, headers) + if owner == "yazi-rs": # For official plugins, get commit info for the specific plugin file api_url = f"https://api.github.com/repos/{owner}/{repo}/commits?path={plugin_pname}/main.lua&per_page=1" else: - # For third-party plugins, get latest commit on main branch - api_url = f"https://api.github.com/repos/{owner}/{repo}/commits/main" + # For third-party plugins, get latest commit on default branch + api_url = f"https://api.github.com/repos/{owner}/{repo}/commits/{default_branch}" try: response = requests.get(api_url, headers=headers) From be1b2e06eb5a2777d485eadd3c5114ae08cb65b9 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 9 May 2025 10:47:47 -0500 Subject: [PATCH 2/3] yaziPlugins.bypass: 0-unstable-2025-04-09 -> 25.3.2-unstable-2025-04-22 --- pkgs/by-name/ya/yazi/plugins/bypass/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ya/yazi/plugins/bypass/default.nix b/pkgs/by-name/ya/yazi/plugins/bypass/default.nix index 244ca57fcaed..9574e9ff9bd9 100644 --- a/pkgs/by-name/ya/yazi/plugins/bypass/default.nix +++ b/pkgs/by-name/ya/yazi/plugins/bypass/default.nix @@ -5,13 +5,13 @@ }: mkYaziPlugin { pname = "bypass.yazi"; - version = "0-unstable-2025-04-09"; + version = "25.3.2-unstable-2025-04-22"; src = fetchFromGitHub { owner = "Rolv-Apneseth"; repo = "bypass.yazi"; - rev = "2ab6d84e8165985dd4d63ef0098e3a30feb3a41a"; - hash = "sha256-6LiBUvHmN8q/ao1+QhCg75ypuf1i6MyRQiU16Lb8pEs="; + rev = "17e86529b2aa8ea7c08e117debf7c55044f9edb4"; + hash = "sha256-Q5g23sCGx9Ecm350ZiGKA1OaRieECWtF1xe22WzTtdY="; }; meta = { From 3a9db26426bceda4769b77d722ca129370d0bb01 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 9 May 2025 10:49:07 -0500 Subject: [PATCH 3/3] yaziPlugins.mediainfo: 25.2.7-unstable-2025-04-05 -> 25.2.7-unstable-2025-04-17 --- pkgs/by-name/ya/yazi/plugins/mediainfo/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ya/yazi/plugins/mediainfo/default.nix b/pkgs/by-name/ya/yazi/plugins/mediainfo/default.nix index 7cd544dfc927..452a40de6bd5 100644 --- a/pkgs/by-name/ya/yazi/plugins/mediainfo/default.nix +++ b/pkgs/by-name/ya/yazi/plugins/mediainfo/default.nix @@ -5,13 +5,13 @@ }: mkYaziPlugin { pname = "mediainfo.yazi"; - version = "25.2.7-unstable-2025-04-05"; + version = "25.2.7-unstable-2025-04-17"; src = fetchFromGitHub { owner = "boydaihungst"; repo = "mediainfo.yazi"; - rev = "436cb5f04d6e5e86ddc0386527254d87b7751ec8"; - hash = "sha256-oFp8mJ62FsJX46mKQ7/o6qXPC9qx3+oSfqS0cKUZETI="; + rev = "9629b1e85c3757c834ec83fb7d931982c55f4c3f"; + hash = "sha256-EDEIiZJy/RfXVaLNsKDeklH4qY2h+js2m0y6VSAjPkk="; }; meta = {