Software update notification (#1002)#1054
Conversation
|
will give this a proper review this weekend, in the meantime can you add a screenshot of the update notification to the PR description? if you have a way to disable copilot here it'd be really apprechiated since it's really annoyign, we are currently unable to. |
|
|
||
| const UPDATE_CHECK_INTERVAL: Duration = Duration::from_secs(6 * 60 * 60); | ||
| const GITHUB_LATEST_RELEASE_URL: &str = | ||
| "https://api.github.com/repos/EFForg/rayhunter/releases/latest"; |
There was a problem hiding this comment.
If we put out a prerelease v1.0.0-beta, it seems to me this code will see that release, parse it as 1.0.0 (which is not out yet), and prompt the user to update.
So that this doesn't happen I propose the following instead:
- We don't hit github api, but rather
https://efforg.github.io/rayhunter/updates.json - We patch the version number in that file in
.github/workflows/release.yml(in the same codepath where we bump version numbers inCargo.tomletc) - Any bugs related to pre-releases or otherwise (it's not a concept we currently have anyway), we're able to hotfix within the static site build, rather than in rayhunter-daemon
Another nice property of this is that the static site is not subject to rate limits.
One downside of this approach is that the SNI efforg.github.io is exposed to the network, which might be a privacy issue.
@cooperq thoughts?
| let http_client = match reqwest::Client::builder().build() { | ||
| Ok(client) => client, | ||
| Err(err) => { | ||
| error!("failed to create update check client: {err}"); | ||
| return; | ||
| } | ||
| }; |
There was a problem hiding this comment.
this is legit. we had the same issue in a bunch of different places (ntfy, webdav), might be worth extracting common helpers
| On the **Orbic**, **Moxee**, **UZ801**, **TMOHS1**, and **Wingtech**, Rayhunter can connect the device to an existing WiFi network while keeping the hotspot running. This gives the device internet access for [notifications](https://docs.ntfy.sh/) and lets you reach the web UI from any device on that network. | ||
|
|
||
| When the device is online, Rayhunter also checks GitHub for new releases and shows an update notice in the web UI. If you enable the *Software Updates* notification type, it can send the same notice through ntfy as well. You can disable this feature by turning off the *Automatically check for software updates* setting in the web UI. | ||
|
|
||
| - **Enable WiFi** turns WiFi client mode on or off. Disabling it does not erase saved credentials. |
I think we probably want to refactor our use of reqwest a bit to set user-agent and default timeouts everywhere (ntfy, updates, webdav). i.e. single factory function for |
|
I'm going to be quite busy for the next week, so I won't have time to refactor. Let's get this PR merged, and that can be added as an issue. |
ok, if you want to go that route then let's stick with fetching the github api. but let's dumb it down a bit: remove the pre-release parsing code entirely (like i mentioned in the code-level review, we can't treat prereleases as stable), if the latest version is a pre-release we just fail to parse and don't show an update notification. |
|
ty! |
ref #1002
Pull Request Checklist
cargo fmt.You must check one of:
I used LLMs to assist with the frontend.
Couple of questions before merging:
User-Agentbe? Right now, it israyhunter-update-checker. The GitHub API requires aUser-AgentheaderTested on Kajeet and Moxee devices.
Frontend changes
get_current_versionto display this, inconsistent version in "System Information" is expected)