This commit is contained in:
2026-06-11 10:43:30 -04:00
parent 336e6a264c
commit 4f92942ccb
9 changed files with 175 additions and 24 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ version = 4
[[package]]
name = "WVUMedicine_HelpAlert_WebClient"
version = "0.1.0"
version = "1.0.0"
dependencies = [
"serde",
"serde_json",
+3 -3
View File
@@ -1,8 +1,8 @@
[package]
name = "WVUMedicine_HelpAlert_WebClient"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
version = "1.0.0"
description = "Help Alert Web Client"
authors = ["James Brotosky <james.brotosky@wvumedicine.org"]
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+13 -3
View File
@@ -2,10 +2,20 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"windows": [
"main"
],
"remote": {
"urls": [
"https://helpalert.wvumedicine.org/*"
]
},
"permissions": [
"core:default",
"opener:default",
"opener:allow-open-url"
"core:window:allow-set-focus",
"core:window:allow-show",
"core:window:allow-set-always-on-top",
"core:window:allow-unminimize",
"allow-alert-detected"
]
}
@@ -0,0 +1,4 @@
[[permission]]
identifier = "allow-alert-detected"
description = "Allow the alert_detected command"
commands.allow = ["alert_detected"]
+17
View File
@@ -66,6 +66,7 @@ pub fn run() {
Ok(())
})
.invoke_handler(tauri::generate_handler![alert_detected])
.on_window_event(|window: &tauri::Window, event: &WindowEvent| {
if let WindowEvent::CloseRequested { api, .. } = event {
api.prevent_close();
@@ -75,3 +76,19 @@ pub fn run() {
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
#[tauri::command]
fn alert_detected(app: tauri::AppHandle, name: String) {
if let Some(window) = app.get_webview_window("main") {
let _ = window.unminimize();
let _ = window.show();
let _ = window.set_focus();
let _ = window.set_always_on_top(true);
let win = window.clone();
std::thread::spawn(move || {
std::thread::sleep(std::time::Duration::from_secs(5));
let _ = win.set_always_on_top(false);
});
}
println!("[DuressGuard] Alert: {}", name);
}
+11 -4
View File
@@ -1,13 +1,13 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "WVUMedicine Help Alert Web Client",
"version": "0.1.0",
"version": "1.0.0",
"identifier": "org.wvumedicine.duress",
"build": {
"frontendDist": "../src"
},
"app": {
"withGlobalTauri": false,
"withGlobalTauri": true,
"windows": [],
"security": {
"csp": null
@@ -15,7 +15,14 @@
},
"bundle": {
"active": true,
"targets": "all",
"targets": [
"nsis"
],
"windows": {
"webviewInstallMode": {
"type": "offlineInstaller"
}
},
"icon": [
"icons/32x32.png",
"icons/128x128.png",
@@ -24,4 +31,4 @@
"icons/icon.ico"
]
}
}
}