Repository navigation
Check the latest GitHub release for plugin updates - #238
Merged
Merged
Conversation
The RELEASE channel now asks the GitHub API for the latest published release (drafts and prereleases are skipped) instead of release.json on uskyblock.ovh, and reads its tag without the leading "v". STAGING still reads staging.json. Non-2xx responses, including GitHub's rate limit, and unparseable bodies give no version, so they log the usual single INFO line instead of a stack trace. URL_RELEASE stays in both API modules for compatibility and is marked deprecated.
When an update check gets no version (non-2xx, rate limit, bad body, network error), the console now says so and points to https://uskyblock.github.io/ for a manual check. The line is logged on the first failure only and again after a check has succeeded in between, so a lasting outage doesn't repeat it every 4 hours. RELEASE and STAGING share this path. /usb version shows the same hint after a failed check, next to the existing update notice. SkyUpdateChecker is now a singleton: the command used to get its own instance that never ran a check, so it could show neither the update notice nor the hint.
When the update check can't reach GitHub or the staging feed at all (no network, DNS failure, connect or read timeout, TLS error), it logged a SEVERE "Exception while trying to fetch latest plugin version." with a stack trace on every 4-hourly check. Such I/O failures are now silent; the manual-check hint covers them, once per failure streak. Unexpected exceptions still log SEVERE with a stack trace, but only on the first failed check in a row, and still only while the plugin is enabled. The HTTP request moved into its own method so tests can make it fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The release update check now asks GitHub instead of uskyblock.ovh, the first step away from our own server.
SkyUpdateCheckerreadstag_namefromhttps://api.github.com/repos/uskyblock/uSkyBlock/releases/latest. That endpoint skips drafts and prereleases, so a release made a draft or prerelease on GitHub stops being offered. The leadingvis stripped; versions compare as before.Failed to check for new uSkyBlock versions. Please check for updates manually at https://uskyblock.github.io/. It repeats only after a check has succeeded in between./usb versionshows the same hint. Only a truly unexpected exception still logs a stack trace, once. The check runs async every 4 hours, so a server sends 6 requests a day; GitHub's unauthenticated limit is 60 an hour per IP./usb version: it had an update checker of its own that never ran a check, so its update notice never showed.SkyUpdateCheckeris a singleton now.staging.json.URL_RELEASEstays in both API modules for compatibility and is@Deprecated(since = "3.8.0"). The GitHub URI is private to Core.release.json, so they still see new versions.Tests: 19 in
SkyUpdateCheckerTestand 3 in a newPluginInfoTest, all without network: tag parsing, failure handling and the hint's once-per-streak logging, version comparison, and which source each branch asks. Checked once by hand against the live API, which returned 3.7.1.