Files
knock/src-tauri/src/lib.rs
T
JoshiCodes be65eae732 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
2026-11-27 21:56:04 +01:00

96 lines
3.1 KiB
Rust

mod commands;
mod db;
mod oauth;
mod state;
mod watch;
mod ws;
use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
if let Some(w) = app.get_webview_window("main") {
let _ = w.unminimize();
let _ = w.set_focus();
}
}))
.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)?);
app.manage(oauth::OauthState::default());
app.manage(ws::WsState::default());
Ok(())
})
.invoke_handler(tauri::generate_handler![
commands::collection_open,
commands::collection_create,
commands::collection_get,
commands::collection_close,
commands::recent_collections,
commands::recent_forget,
commands::request_get,
commands::request_save,
commands::request_create,
commands::folder_create,
commands::node_rename,
commands::node_duplicate,
commands::node_delete,
commands::node_move,
commands::folder_get,
commands::folder_save,
commands::manifest_get,
commands::manifest_save,
commands::env_get,
commands::env_save,
commands::env_delete,
commands::env_secrets,
commands::secret_set,
commands::vars_list,
commands::runtime_list,
commands::runtime_set,
commands::globals_get,
commands::globals_save,
commands::request_send,
commands::request_cancel,
commands::request_preview,
commands::response_body,
commands::response_save,
commands::cookies_list,
commands::cookie_delete,
commands::history_list,
commands::history_get,
commands::history_delete,
commands::setting_get,
commands::setting_set,
commands::path_params,
commands::app_version,
commands::write_text_file,
commands::update_check,
commands::runner_run,
commands::import_curl,
commands::import_detect,
commands::import_source,
commands::import_text,
commands::import_environment,
commands::export_postman,
commands::code_snippet,
oauth::oauth_status,
oauth::oauth_run,
oauth::oauth_callback,
oauth::oauth_deep_link,
oauth::oauth_cancel,
ws::ws_connect,
ws::ws_send,
ws::ws_ping,
ws::ws_close,
])
.run(tauri::generate_context!())
.expect("error while running knock");
}