Opt-in update notices

- Asked once after the first start; switch and Check now in Settings
- At most one request a day to GitHub's latest-release endpoint,
  nothing else is sent; knock never updates itself
- A new version shows a notice with download link and release notes,
  plus one desktop notification per version; versions can be skipped
This commit is contained in:
2026-11-27 21:56:04 +01:00
parent 677b5adaf9
commit be65eae732
13 changed files with 391 additions and 2 deletions
+6
View File
@@ -794,3 +794,9 @@ pub async fn code_snippet(app: AppHandle, args: ScopeArgs, lang: knock_core::exp
};
Ok(knock_core::export::snippet(&p, lang))
}
/// Latest release on GitHub. Only called when the user opted in.
#[tauri::command]
pub async fn update_check() -> Res<knock_core::update::Release> {
knock_core::update::latest(env!("CARGO_PKG_VERSION")).await.map_err(errx)
}
+2
View File
@@ -19,6 +19,7 @@ pub fn run() {
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_notification::init())
.setup(|app| {
let dir = app.path().app_data_dir()?;
app.manage(state::AppState::new(dir)?);
@@ -70,6 +71,7 @@ pub fn run() {
commands::path_params,
commands::app_version,
commands::write_text_file,
commands::update_check,
commands::runner_run,
commands::import_curl,
commands::import_detect,