aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dist/index.html1
-rw-r--r--src-tauri/src/main.rs15
-rw-r--r--src-ui/src/main.ts6
3 files changed, 22 insertions, 0 deletions
diff --git a/dist/index.html b/dist/index.html
index 235e02a1..f57b9e2f 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -9,5 +9,6 @@
<panic-button>Panic Button</panic-button>
<backend-ping class="server"></backend-ping>
<install-location-holder>EMPTY</install-location-holder>
+ <version-number-holder>UNKNOWN</version-number-holder>
</body>
</html>
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 9f1229f7..cbf10065 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -50,6 +50,21 @@ fn main() {
}
});
+ let app_handle = app.app_handle();
+ tauri::async_runtime::spawn(async move {
+ // Sending current version inside a timed loop is a bad idea as it shouldn't change at runtime
+ // The reason this is currently done like this is cause I haven't figure out yet how to just send it once / read it in front-end
+ let version = env!("CARGO_PKG_VERSION");
+ loop {
+ sleep(Duration::from_millis(1000)).await;
+ println!("sending install location");
+ println!("{}", version);
+ app_handle
+ .emit_all("current-version-ping", version)
+ .unwrap();
+ }
+ });
+
Ok(())
})
.manage(Counter(Default::default()))
diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts
index 3c44ce55..fcd68cb4 100644
--- a/src-ui/src/main.ts
+++ b/src-ui/src/main.ts
@@ -11,6 +11,7 @@ document.addEventListener("DOMContentLoaded", async function () {
let pingEl = $("backend-ping")! as HTMLElement;
let panicButtonEl = $("panic-button") as HTMLElement;
let installLocationHolderEl = $("install-location-holder") as HTMLElement;
+ let versionNumberHolderEl = $("version-number-holder") as HTMLElement;
// listen backend-ping event (from Tauri Rust App)
listen("install-location-result", function (evt: TauriEvent<string>) {
@@ -19,6 +20,11 @@ document.addEventListener("DOMContentLoaded", async function () {
installLocationHolderEl.textContent = evt.payload;
})
+ // listen for version number ping
+ listen("current-version-ping", function (evt: TauriEvent<string>) {
+ versionNumberHolderEl.textContent = evt.payload;
+ })
+
// listen backend-ping event (from Tauri Rust App)
listen("backend-ping", function (evt: TauriEvent<any>) {
pingEl.classList.add("on");