Skip to content

version-check: switch lastversion endpoint from SourceForge to GitHub Releases API - #522

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:pr-version-check-github-api
May 3, 2026
Merged

version-check: switch lastversion endpoint from SourceForge to GitHub Releases API#522
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:pr-version-check-github-api

Conversation

@got3nks

@got3nks got3nks commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

The version-check probe in amule.cpp:636 has been hitting http://amule.sourceforge.net/lastversion since forever — a plain-text MAJOR.MINOR.UPDATE file that hasn't been maintained since the project moved to GitHub years ago. Even if SF still serves the file, the version it reports has been stuck for the multi-year gap since 2.3.3 (Feb 2021).

This PR repoints the request at the GitHub Releases API:

https://api.github.com/repos/amule-project/amule/releases/latest

which returns JSON describing the most recent non-prerelease, non-draft Release.

Why /releases/latest

Pairs naturally with the release.yml + draft-Release flow that landed in #520. Once a stable tag is published on GitHub, every aMule installation with version-check enabled picks up the new version on next startup automatically — no maintainer step beyond un-drafting the Release.

The endpoint excludes pre-releases by design:

  • Users on stable 2.3.3 won't be told to upgrade when we tag 3.0.0-beta or 3.0.0-rc1 (those tags would carry the GitHub prerelease: true flag).
  • They will be prompted once 3.0.0 stable is published as a non-prerelease Release.

The endpoint also excludes drafts, so the version check doesn't flip the moment release.yml creates the draft Release at tag-push time — un-drafting is the canonical "this release is now publicly available" signal.

Parser changes in CheckNewVersion()

The downloaded file was previously a one-line text response and is now JSON. Changes:

  • Concatenate all lines of the downloaded file before regex-matching (the JSON body is pretty-printed across many lines).
  • Extract tag_name via wxRegEx rather than dragging in a full JSON parser dep — one well-known field is straightforward to extract robustly.
  • Strip optional v prefix (aMule's tags are bare semver, but be tolerant of future maintainer choices).
  • Strip pre-release / build-metadata suffixes (-beta, -rc1, +build42) before the integer comparison. The /releases/latest endpoint already filters pre-releases, but keep the suffix-strip as defensive parsing.
  • Treat tags with fewer than three components (e.g. 3.1 instead of 3.1.0) as missing-field-= 0 rather than erroring out.
  • Clean up the temp file in early-error paths too (the original only removed it on the success path).

Transport

HTTPS works without transport changes — wxWebRequest support landed in #462, which is what CHTTPDownloadThread now sits on top of. Just changing the URL is enough; the existing If-Modified-Since / etag conditional-fetch behaviour carries over (GitHub's API supports both).

Pref gating

The existing s_NewVersionCheck pref still controls whether the request fires at all, so users who never opted in are unaffected.

Test plan

  • Builds clean (amuled target on macOS local, against the new code).

  • Parser exercised against the actual wxRegEx implementation via a standalone C++ test mirroring CheckNewVersion()'s logic. Verified inputs:

    Happy path:

    1. Real cli/cli /releases/latest payload → tag_name: "v2.92.0" → stripped to 2.92.0
    2. Real amule-project/amule /releases/latest payload → tag_name: "2.3.3" (existing published Release) → parsed as 2.3.3
    3. Bare "3.0.0" (aMule's tag style): parses to 3.0.0
    4. v-prefix with extra whitespace: "tag_name" : "v3.0.0"3.0.0
    5. Pre-release tags "3.0.0-beta", "3.0.0-rc1", "v3.0.0-beta", "2.4.0-rc.2", "3.0.0-beta.5", "v2.4.0-alpha" all strip to MAJOR.MINOR.UPDATE
    6. Build metadata: "2.4.0+build42"2.4.0
    7. Two-component tag: "3.1" → parsed as 3.1.0 (missing UPDATE treated as 0) ✓

    Failure paths (all log _("Corrupted version check file") and return cleanly without crashing):

    • Malformed JSON: regex still extracts the well-known tag_name field if present (defensible — we're not doing strict JSON validation, just locating one field). ✓
    • 404 response shape (no tag_name field): regex misses → "Corrupted" → return. ✓
    • Empty tag_name: regex [^"]+ requires non-empty → no match → "Corrupted". ✓
    • Non-numeric token ("hello", "3.foo.bar"): tokenizer fails → "Corrupted" + cleanup. ✓
    • Degenerate inputs that strip to empty ("v", "-foo", "v-rc1", "+build42"): caught by an explicit versionLine.IsEmpty() guard added between the strip step and the tokenizer. Without that guard, these would silently report "up to date" against unparseable input — fixed in this commit. ✓
  • End-to-end is already viable today: amule-project has a published 2.3.3 Release on the GitHub side, so users running this code will see "Your copy of aMule is up to date" if they're on 2.3.3, or the "outdated" prompt if they're older. Once 3.0.0 stable is published as a non-prerelease, every 2.3.3 user gets the upgrade prompt automatically. Pre-release tags (3.0.0-beta, 3.0.0-rc1) are filtered out by /releases/latest as designed.

Sized

One file (src/amule.cpp), +59 / −10 lines, single commit.

… Releases API

`amule.cpp:636` was hitting `http://amule.sourceforge.net/lastversion`,
a plain-text `MAJOR.MINOR.UPDATE` file unmaintained since the project
moved to GitHub years ago.  Repoint the request at
`https://api.github.com/repos/amule-project/amule/releases/latest`,
which returns JSON describing the most recent non-prerelease,
non-draft Release.

Pairs with the release.yml flow added in amule-project#520: once a stable tag is
published on GitHub, every aMule installation with version-check
enabled picks it up automatically on next startup, with no
maintainer step beyond un-drafting the Release.  `/releases/latest`
excludes pre-releases by design, so users on 2.3.3 stable won't be
prompted to upgrade when we tag `3.0.0-beta` / `3.0.0-rc1` —
only when 3.0.0 stable is published.

Parser changes in `CheckNewVersion()`:

 - Concatenate all lines of the downloaded file before regex-matching
   (the JSON body is pretty-printed across many lines).
 - Extract `tag_name` via `wxRegEx` — simpler than dragging in a
   full JSON parser for one well-known field.
 - Strip optional `v` prefix and any pre-release / build-metadata
   suffix (`-beta`, `-rc1`, `+build42`) before the integer
   comparison.
 - Treat tags with fewer than three components (e.g. `3.1`) as
   missing-field-= 0 rather than erroring out.
 - Clean up the temp file in early-error paths too (the original
   only removed it on the success path).

HTTPS works without transport changes — wxWebRequest support landed
in amule-project#462.  The `s_NewVersionCheck` pref still controls whether the
request fires at all.
@got3nks
got3nks force-pushed the pr-version-check-github-api branch from d2fbbe9 to e9b5d23 Compare May 3, 2026 14:17
@mrjimenez
mrjimenez merged commit e3f87f7 into amule-project:master May 3, 2026
12 checks passed
@got3nks
got3nks deleted the pr-version-check-github-api branch May 3, 2026 15:11
mrjimenez pushed a commit that referenced this pull request May 5, 2026
Following the org-migration discussion on PR #521, point all source /
docs / packaging URLs at the new `amule-org` GitHub org that
@mrjimenez bootstrapped on 2026-05-04.

Two motivating reasons (per the thread):

1. The new active maintainer team needs proper write/admin access
   that the existing amule-project upper-level admins have been
   unreachable to grant.

2. The version-check probe added in #522 hardcodes its target URL
   into every shipped binary.  If that URL stays at amule-project
   while future releases land on amule-org, the cohort of users on
   3.0.0 will be permanently stranded querying a dead-end endpoint
   and never learn about 3.0.1+ via the in-app prompt.  Flipping
   the URL pre-3.0.0-tag is the only way to keep them informed
   without dual-publishing maintenance burden.

Seven references updated in lockstep:

- `src/amule.cpp` — version-check probe URL.
- `packaging/linux/flatpak/org.amule.aMule.yaml.in` — Flatpak
  manifest's git source URL (load-bearing — `flatpak-builder`
  clones from this URL at build time).
- `org.amule.aMule.metainfo.xml` — AppStream bug-tracker URL,
  surfaces in Flathub / GNOME Software / KDE Discover.
- `README.md` — logo image URL on raw.githubusercontent.com plus
  the Issues and Pull Requests link references.
- `docs/INSTALL.md` — upstream-issue-tracker doc reference.
- `docs/README.md` — GitHub Issues doc reference.

Left as-is:

- `src/HTTPDownload.cpp:252` — code comment referencing issue
  `#455` for historical context.  The issue
  itself stays at amule-project regardless of where future
  development happens; the comment is a citation, not a forward
  reference.
- The `amule-project.de` / `amule-project.net` mentions in
  `docs/CHANGELOG.md` 2003-era entries — those are old DNS
  domain references unrelated to the GitHub org.

Note: this commit assumes `amule-org/amule` will exist as a real
repo by the time this PR merges.  The org was created 2026-05-04
with zero repos; the Flatpak build URL change in particular will
fail the Packaging workflow until the repo is bootstrapped.
got3nks added a commit to got3nks/amule that referenced this pull request Jul 18, 2026
…eaped (amule-project#522)

A "View Files" browse that failed (peer denied, connect failed, or dropped mid-list) left amuleGUI stuck at (N...) instead of (Failed): the daemon read the browse lifecycle from the transient browsing client, which is reaped before amuleGUI's next SEARCH_PROGRESS poll, so EC_TAG_SEARCH_BROWSE_STATUS was omitted. Persist the browse status by search id alongside the bar (pruned in RemoveResults, bounded by the same EC search ring) and report progress from that persisted state, so the terminal status survives the client teardown. Daemon-side only. Follow-up to amule-project#520.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants