Files
mudfish-decky/py_modules/mudfish_decky/selfupdate.py
T
ysj7705andClaude Opus 5.5 d9015d43b9
ysj7705/mudfish-decky/pipeline/head This commit looks good
feat: copy the latest plugin release URL from the panel; release 0.1.2
Advanced shows the installed plugin version and the latest Gitea release.
'최신 플러그인 주소 복사' puts the release zip URL on the clipboard for
Decky's Install Plugin from URL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:59:38 +09:00

30 lines
1.0 KiB
Python

"""Where to get this plugin's newest build: the latest Gitea release's zip (for Decky's Install from URL)."""
import json
import logging
import urllib.request
from typing import Optional
from .client import ssl_context
LATEST_RELEASE_API = "https://git.sejong.dev/api/v1/repos/ysj7705/mudfish-decky/releases/latest"
log = logging.getLogger("mudfish_decky")
def _fetch(url: str) -> str:
with urllib.request.urlopen(url, timeout=10, context=ssl_context()) as resp:
return resp.read().decode()
def latest_plugin_release(fetch=_fetch) -> Optional[dict]:
"""{'version': '0.1.2', 'url': <zip download URL>} or None when offline or no zip is attached."""
try:
release = json.loads(fetch(LATEST_RELEASE_API))
except Exception as e:
log.warning("plugin release lookup failed: %s", e)
return None
zips = [a for a in release.get("assets", []) if a.get("name", "").endswith(".zip")]
if not zips:
return None
return {"version": release.get("tag_name", "").lstrip("v"), "url": zips[0]["browser_download_url"]}