Simplify upstream version check mechanism
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 10s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 8s
All checks were successful
PostgreSQL Compatibility Matrix / PG14 smoke (push) Successful in 10s
PostgreSQL Compatibility Matrix / PG15 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG16 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG17 smoke (push) Successful in 8s
PostgreSQL Compatibility Matrix / PG18 smoke (push) Successful in 8s
Updated the "Check for Updates" functionality to rely solely on the latest published release in the upstream repository. Removed redundant code for fetching tags and commits, enhancing maintainability and reducing complexity.
This commit is contained in:
@@ -236,7 +236,7 @@ Recommended values for `VITE_API_URL`:
|
||||
|
||||
- Sidebar entry for runtime and system details
|
||||
- Displays current version, latest known version, uptime, host, and platform
|
||||
- "Check for Updates" against the official upstream repository (`git.nesterovic.cc/nessi/NexaPG`)
|
||||
- "Check for Updates" against the latest published release in the official upstream repository (`git.nesterovic.cc/nessi/NexaPG`)
|
||||
- Version/update source are read-only in UI (maintainer-controlled in code/release flow)
|
||||
|
||||
## Target Owner Notifications
|
||||
|
||||
@@ -65,8 +65,6 @@ def _get_json(url: str):
|
||||
|
||||
def _fetch_latest_from_upstream_sync() -> tuple[str, str]:
|
||||
latest_release_url = f"{UPSTREAM_REPO_API}/releases/latest"
|
||||
tags_url = f"{UPSTREAM_REPO_API}/tags?page=1&limit=1"
|
||||
commits_url = f"{UPSTREAM_REPO_API}/commits?sha=main&page=1&limit=1"
|
||||
|
||||
try:
|
||||
release = _get_json(latest_release_url)
|
||||
@@ -74,27 +72,9 @@ def _fetch_latest_from_upstream_sync() -> tuple[str, str]:
|
||||
tag = (release.get("tag_name") or release.get("name") or "").strip()
|
||||
if tag:
|
||||
return tag[:64], "release"
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
tags = _get_json(tags_url)
|
||||
if isinstance(tags, list) and tags:
|
||||
first = tags[0] if isinstance(tags[0], dict) else {}
|
||||
tag = (first.get("name") or "").strip()
|
||||
if tag:
|
||||
return tag[:64], "tag"
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
commits = _get_json(commits_url)
|
||||
if isinstance(commits, list) and commits:
|
||||
first = commits[0] if isinstance(commits[0], dict) else {}
|
||||
sha = (first.get("sha") or "").strip()
|
||||
if sha:
|
||||
short = sha[:7]
|
||||
return f"commit-{short}", "commit"
|
||||
raise ValueError("Could not fetch release/tag/commit from upstream repository")
|
||||
except Exception as exc:
|
||||
raise ValueError(f"Could not fetch latest release from upstream repository: {exc}") from exc
|
||||
raise ValueError("No published release found in upstream repository")
|
||||
|
||||
|
||||
async def fetch_latest_from_upstream() -> tuple[str | None, str | None, str | None]:
|
||||
|
||||
Reference in New Issue
Block a user