sysmodules: add switch-frame-tap
Uses /releases/latest so only stable releases are installed (the repo publishes untested betas as pre-releases). The version updater now honors /releases/latest URLs so the section header matches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e712925272
commit
45293572f3
2 files changed
+22
-4
No files matched your search
@@ -34,9 +34,15 @@ def extract_repo_from_gitea_url(url: str) -> Optional[Tuple[str, str, str]]:
|
|||||||
return (match.group(1), match.group(2), match.group(3))
|
return (match.group(1), match.group(2), match.group(3))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_latest_tag_github(owner: str, repo: str) -> Optional[str]:
|
def get_latest_tag_github(owner: str, repo: str, stable_only: bool = False) -> Optional[str]:
|
||||||
"""Fetch the latest release tag from GitHub API."""
|
"""Fetch the latest release tag from GitHub API.
|
||||||
url = f"{GITHUB_API}/{owner}/{repo}/releases?per_page=1"
|
With stable_only=True, uses /releases/latest (skips pre-releases), matching
|
||||||
|
INI entries that download from that endpoint.
|
||||||
|
"""
|
||||||
|
if stable_only:
|
||||||
|
url = f"{GITHUB_API}/{owner}/{repo}/releases/latest"
|
||||||
|
else:
|
||||||
|
url = f"{GITHUB_API}/{owner}/{repo}/releases?per_page=1"
|
||||||
try:
|
try:
|
||||||
req = urllib.request.Request(url)
|
req = urllib.request.Request(url)
|
||||||
req.add_header('User-Agent', 'Release-Tag-Fetcher/1.0')
|
req.add_header('User-Agent', 'Release-Tag-Fetcher/1.0')
|
||||||
@@ -44,6 +50,8 @@ def get_latest_tag_github(owner: str, repo: str) -> Optional[str]:
|
|||||||
req.add_header('Authorization', f'token {GITHUB_TOKEN}')
|
req.add_header('Authorization', f'token {GITHUB_TOKEN}')
|
||||||
with urllib.request.urlopen(req, timeout=10) as response:
|
with urllib.request.urlopen(req, timeout=10) as response:
|
||||||
releases = json.loads(response.read().decode('utf-8'))
|
releases = json.loads(response.read().decode('utf-8'))
|
||||||
|
if isinstance(releases, dict):
|
||||||
|
releases = [releases]
|
||||||
if releases and len(releases) > 0:
|
if releases and len(releases) > 0:
|
||||||
return releases[0].get('tag_name', releases[0].get('name', ''))
|
return releases[0].get('tag_name', releases[0].get('name', ''))
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
@@ -80,7 +88,8 @@ def get_latest_tag(entry: Dict[str, Any]) -> Optional[str]:
|
|||||||
"""Fetch the latest release tag from GitHub or Gitea depending on entry source."""
|
"""Fetch the latest release tag from GitHub or Gitea depending on entry source."""
|
||||||
if entry.get('source') == 'gitea':
|
if entry.get('source') == 'gitea':
|
||||||
return get_latest_tag_gitea(entry['api_base'], entry['owner'], entry['repo'])
|
return get_latest_tag_gitea(entry['api_base'], entry['owner'], entry['repo'])
|
||||||
return get_latest_tag_github(entry['owner'], entry['repo'])
|
stable_only = '/releases/latest' in entry.get('url', '')
|
||||||
|
return get_latest_tag_github(entry['owner'], entry['repo'], stable_only)
|
||||||
|
|
||||||
def parse_ini_file(file_path: Path, strip_version_suffix: bool = True) -> List[Dict[str, Any]]:
|
def parse_ini_file(file_path: Path, strip_version_suffix: bool = True) -> List[Dict[str, Any]]:
|
||||||
"""Parse .ini file and extract entries with GitHub or Gitea API URLs.
|
"""Parse .ini file and extract entries with GitHub or Gitea API URLs.
|
||||||
|
|||||||
@@ -54,6 +54,15 @@ unzip /config/ultrahand/downloads/saltynx.zip /
|
|||||||
delete /config/ultrahand/downloads/saltynx-api.json
|
delete /config/ultrahand/downloads/saltynx-api.json
|
||||||
delete /config/ultrahand/downloads/saltynx.zip
|
delete /config/ultrahand/downloads/saltynx.zip
|
||||||
|
|
||||||
|
[Switch-Frame-Tap - 0.7.23]
|
||||||
|
try:
|
||||||
|
download https://api.github.com/repos/TomasUribe/switch-frame-tap/releases/latest /config/ultrahand/downloads/switch-frame-tap-api.json
|
||||||
|
json_file /config/ultrahand/downloads/switch-frame-tap-api.json
|
||||||
|
download {json_file(assets,6,browser_download_url)} /config/ultrahand/downloads/switch-frame-tap.zip
|
||||||
|
unzip /config/ultrahand/downloads/switch-frame-tap.zip /
|
||||||
|
delete /config/ultrahand/downloads/switch-frame-tap-api.json
|
||||||
|
delete /config/ultrahand/downloads/switch-frame-tap.zip
|
||||||
|
|
||||||
[sys-botbase - 2.5]
|
[sys-botbase - 2.5]
|
||||||
try:
|
try:
|
||||||
download https://api.github.com/repos/olliz0r/sys-botbase/releases?per_page=1 /config/ultrahand/downloads/sys-botbase-api.json
|
download https://api.github.com/repos/olliz0r/sys-botbase/releases?per_page=1 /config/ultrahand/downloads/sys-botbase-api.json
|
||||||
|
|||||||
Reference in new issue
Block a user