Hide download options offline, remove Refactor - #106
Merged
Conversation
Rebuild and Refactor both download an image from GitHub via the board itself (flash-from-url's wget) - without internet that can't work, so show only the local-file paths (upload, magic upload, install an already-present local image) instead. Added has-internet, a quick wget --spider check (5s timeout) against github.com specifically rather than a generic reachability target - that's the actual dependency for both the image downloads and the release list the UI fetches, and a generic check could pass while GitHub itself is unreachable. The client checks this once on load (optimistically defaults to showing everything so the options aren't shown then immediately hidden while the check is in flight) and filters the method dropdown accordingly, switching the current selection to Upload if it was on a now-hidden option. Live-tested on real hardware via the actual /api/has_internet call: normal connectivity reports true, and genuine AP-mode isolation (no WAN uplink at all, not just a blocked host) reports false correctly. Closes #74
Refactor is no longer offered - remove it from the method dropdown, data, and all id==1 branches rather than leaving them as dead code. Also fixes two real bugs found while live-testing on AP mode: - getGithubImages() only ran once in created(), so if it ran before internet was available it never retried - rebuildImages stayed permanently empty even after connecting via the WiFi setup window. checkInternet() now retriggers it once connectivity is confirmed. - Removing the Refactor entry shifted availableMethods, so the hardcoded availableMethods[2] lookups (meant for File upload) went out of bounds and crashed the app with no internet. Switched to id-based lookups so this can't happen again from array reordering.
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.
Summary
has-internetscript +/api/has_internetendpoint checking GitHub reachability specifically, and hides the GitHub-download methods (Rebuild) in the UI when there's no internet - closes Enable only file upload when there is no internet connection #74checkInternet()runs on page load and when the WiFi setup window closesid==1branches) since it's no longer offeredgetGithubImages()only ran once increated()and never retried, sorebuildImagesstayed empty forever if the page loaded before internet was available - now retriggered fromcheckInternet()once connectivity is confirmedavailableMethods, so hardcodedavailableMethods[2]lookups went out of bounds and crashed the app with no internet - switched to id-based lookupsTest plan
make build-vuesucceeds with no errors🤖 Generated with Claude Code