nvda
05eb87a0 - Add the ability to specify NVDA update check URL from within NVDA (#17151)

Commit
1 year ago
Add the ability to specify NVDA update check URL from within NVDA (#17151) Related to #17099 Summary of the issue: The NVDA update check URL is currently hard-coded in NVDA. This presents problems for users who are unable to use the default URL for any reason. This particularly affects users in the People's Republic of China, many of whom are unable to access the update check server at an acceptable speed. A community add-on exists to work around this, but a means of specifying a mirror directly within NVDA is considered a better approach. Description of user facing changes Added controls similar to the speech synthesizer or braille display controls to NVDA's general settings page that allow the user to change the update server in use. Added slightly more helpful wording to update check errors that encourages users to check the mirror URL if there are issues accessing the update check server and a custom URL is in use. Description of development approach - Added a new string config item, `update.serverURL`, which defaults to the empty string. - Added a private getter method to `updateCheck.py` which returns the configured URL if set, or the default otherwise. Made the `CHECK_URL` constant private since it is no-longer needed. Updated references to the constant to use the new getter, and to use f-strings rather than strf style substitutions. - Changed `updateCheck.UpdateChecker._error` to return more helpful messages. - Added a new class, `SetURLDialog`, to `gui.settingsDialogs`. This dialog allows for the input and testing of URLs, and saving them back to config. The dialog is flexible, with a view to using it for the mirror URL support in the Add-on Store added in #17099 . - Modelled the new controls in the General page of NVDA's settings on the speech synth and braille display controls. - A difference is that I have chosen to populate the update mirror text box in the `onPanelActivated` method rather than in `makeSettings` to avoid code duplication between the first population and when populating after the mirror URL is changed. Testing strategy: Spoofed the NVDA version to 2024.1 stable by altering `buildVersion.py` and `versionInfo.py`. Tested checking for updates with: - No mirror set - No mirror set, but nvaccess.org redirected to localhost via the hosts file - Mirror set to the NVDA-CN mirror, and nvaccess.org redirected to localhost via the hosts file - Mirror set to example.com - No mirror set and networking disabled - Mirror set to a random string and networking disabled Tested many scenarios in the new dialog to ensure it behaves as expected, including: - Saving the same URL as in config (does nothing) - Clearing the URL field (disables the test button) - Typing in the URL field (enables the test button) - Saving the empty string without testing it (does not prompt for test) - Testing the URL when connected to the internet and the URL points to the NV Access NVDA update server (succeeds) - Testing the URL when it points to an invalid URL (fails) - Testing the URL when it points to a valid URL with no DNS records (fails) - Testing a valid URL that points to a working but non-NVDA update server (fails) - Testing a valid URL when offline (fails) - Attempting to save an untested URL (warns but allows saving) - Attempting to save a URL that failed the test (warns but allows saving) - Attempting to save a URL that passed (succeeds) Known issues with pull request: The read-only URL text control line wraps, causing NVDA to sometimes only read part of the URL, and potentially causing odd visual layout. The "Test..." button only performs a connection check. Connecting to a URL that returns invalid NVDA update data will still pass.
Author
Parents
Loading