Refactor update checks to directly query API and restore Alpha channel#46
Open
aryanchoudharypro wants to merge 3 commits intonvda-es:masterfrom
Open
Refactor update checks to directly query API and restore Alpha channel#46aryanchoudharypro wants to merge 3 commits intonvda-es:masterfrom
aryanchoudharypro wants to merge 3 commits intonvda-es:masterfrom
Conversation
- Added `snapshot:alpha` to available update channels. - Replaced the version string manipulation workaround with direct API requests to `api.nvaccess.org/nvdaUpdateCheck`. - Refactored `checkForUpdateReplacement` and `getAvailableUpdates` to parse native `UpdateInfo` responses. - Improved GUI thread safety by utilizing `wx.CallAfter` for choice updates. - Modernized thread daemonization (`.daemon = True`). - Enhanced error handling and fallback property checking for update data. - Streamlined `GlobalPlugin` initialization and termination logic.
There was a problem hiding this comment.
Pull request overview
Refactors the add-on’s update-checking logic to query the NV Access update API directly (instead of mutating NVDA’s version string) and restores support for the “Alpha (snapshots)” channel.
Changes:
- Re-adds the
snapshot:alphachannel option to the channel list and settings UI. - Replaces the prior updateCheck/version-string workaround with direct
urllibcalls toapi.nvaccess.org. - Adjusts UI/thread interactions (e.g.,
wx.CallAfter) and update-info parsing for cross-version compatibility.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+204
to
+215
| elif updateVersionInfo == 1: | ||
| # TRANSLATORS: Message displayed when there are no updates available on the selected channel. | ||
| channelInfoText = _("Already updated") | ||
| elif self.thGetAvailableUpdates.is_alive(): | ||
| # TRANSLATORS: Message displayed when retrieval of update information has not yet been completed. | ||
| channelInfo = _("searching update info") | ||
| else: | ||
| channelInfo = "" | ||
| if channels[self.channels.Selection] is None: | ||
| # TRANSLATORS: When disable updates has been selected, the current version information is displayed. | ||
| channelInfo = _("Current version: {version} build {version_build}").format( | ||
| version=buildVersion.version, | ||
| version_build=buildVersion.version_build, | ||
| ) | ||
| self.channelInfo.Value = channelInfo | ||
| channelInfoText = _("searching update info") | ||
| elif channels[self.channels.Selection] is None: | ||
| # TRANSLATORS: When disable updates has been selected, the current version information is displayed. | ||
| channelInfoText = _("Current version: {version} build {version_build}").format( | ||
| version=buildVersion.version, | ||
| version_build=buildVersion.version_build, | ||
| ) |
There was a problem hiding this comment.
When the "Disable updates" option is selected, this code can still show "searching update info" while the background thread is running, because the disabled-option message is only set after the is_alive() branch. Consider prioritizing the disabled-option display regardless of background retrieval state so the UI reflects the user’s selection immediately.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
what's changed?
This pull request brings back support for the "Alpha (snapshots)" channel and completely refactors how the add-on checks for updates. Instead of temporarily overriding the core NVDA version string to trick the standard update checker (which historically caused issues with portable copies), the add-on now directly queries the NV Access API.
Why is this necessary?
The previous workaround for fetching update info was brittle and relied on catching specific RuntimeError exceptions from the core updateCheck module. By making direct, localized HTTP requests to api.nvaccess.org using the requested versionType, the codebase is significantly cleaner, safer, and less prone to breaking NVDA's native update mechanics.
Key Changes: