diff --git a/.forgejo/workflows/deploy-dev.yml b/.forgejo/workflows/deploy-dev.yml index 27252b2..c340cbf 100644 --- a/.forgejo/workflows/deploy-dev.yml +++ b/.forgejo/workflows/deploy-dev.yml @@ -5,9 +5,6 @@ on: paths-ignore: - flake.nix -env: - NIX_CONFIG: experimental-features = nix-command flakes - jobs: build-web: runs-on: nixos diff --git a/.forgejo/workflows/deploy-prod.yml b/.forgejo/workflows/deploy-prod.yml index 0bb5887..dd7a5f9 100644 --- a/.forgejo/workflows/deploy-prod.yml +++ b/.forgejo/workflows/deploy-prod.yml @@ -6,9 +6,6 @@ on: paths-ignore: - flake.nix -env: - NIX_CONFIG: experimental-features = nix-command flakes - jobs: build-web: runs-on: nixos diff --git a/apps/pwa/src/runtime.tsx b/apps/pwa/src/runtime.tsx index 5d78973..a1947eb 100644 --- a/apps/pwa/src/runtime.tsx +++ b/apps/pwa/src/runtime.tsx @@ -22,9 +22,10 @@ export function subscribeTuFileLaunch(listener: (file: File) => void) { }; } -function isStandalone() { +function isInstalledPwa() { return ( window.matchMedia("(display-mode: standalone)").matches || + window.matchMedia("(display-mode: window-controls-overlay)").matches || (navigator as Navigator & { standalone?: boolean }).standalone === true ); } @@ -60,10 +61,9 @@ async function enablePush() { await setDatabaseEntry("keys", "push-subscription", subscription.toJSON()); } -export default function PwaRuntime() { +function InstalledPwaRuntime() { useEffect(() => { if ( - isTauri() || !("serviceWorker" in navigator) || !["http:", "https:"].includes(window.location.protocol) ) { @@ -94,7 +94,15 @@ export default function PwaRuntime() { if (worker.state !== "installed") return; if (!navigator.serviceWorker.controller) { toast.success("Tensamin is ready for offline startup"); + return; } + toast("A Tensamin update is ready", { + duration: Infinity, + action: { + label: "Update", + onClick: () => worker.postMessage({ type: "SKIP_WAITING" }), + }, + }); }); }; if (registration.installing) watchWorker(registration.installing); @@ -134,7 +142,6 @@ export default function PwaRuntime() { useEffect(() => { if ( - !isStandalone() || !("Notification" in window) || Notification.permission !== "default" || localStorage.getItem("pwa-push-hint") @@ -163,7 +170,6 @@ export default function PwaRuntime() { useEffect(() => { if ( - isStandalone() && "Notification" in window && Notification.permission === "granted" && import.meta.env.VITE_WEB_PUSH_PUBLIC_KEY @@ -176,3 +182,8 @@ export default function PwaRuntime() { return null; } + +export default function PwaRuntime() { + if (isTauri() || !isInstalledPwa()) return null; + return ; +} diff --git a/apps/pwa/src/vite.ts b/apps/pwa/src/vite.ts index 908a3d2..962dce1 100644 --- a/apps/pwa/src/vite.ts +++ b/apps/pwa/src/vite.ts @@ -128,6 +128,7 @@ export function tensaminPwa(): Plugin[] { filename: "serviceWorker.ts", injectRegister: null, registerType: "prompt", + buildBase: "/", manifestFilename: "manifest.json", includeAssets: ["favicon.ico", "icons/*.png"], manifest: { diff --git a/apps/tauri/src-tauri/Cargo.lock b/apps/tauri/src-tauri/Cargo.lock index e387136..1c30d1f 100644 --- a/apps/tauri/src-tauri/Cargo.lock +++ b/apps/tauri/src-tauri/Cargo.lock @@ -2745,7 +2745,7 @@ dependencies = [ [[package]] name = "mtp" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "mtp-client", "mtp-codec", @@ -2760,7 +2760,7 @@ dependencies = [ [[package]] name = "mtp-client" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "mtp-codec", "mtp-common", @@ -2773,7 +2773,7 @@ dependencies = [ [[package]] name = "mtp-codec" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "base64 0.23.1", "byteorder", @@ -2787,7 +2787,7 @@ dependencies = [ [[package]] name = "mtp-common" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "quinn", "thiserror 2.0.19", @@ -2797,7 +2797,7 @@ dependencies = [ [[package]] name = "mtp-crypto" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "base64 0.22.1", "chacha20poly1305", @@ -2819,7 +2819,7 @@ dependencies = [ [[package]] name = "mtp-host" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "mtp-codec", "mtp-common", @@ -2835,7 +2835,7 @@ dependencies = [ [[package]] name = "mtp-transport" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "async-trait", "mtp-codec", @@ -2855,7 +2855,7 @@ dependencies = [ [[package]] name = "mtp-type-map" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "serde", "serde_yaml", @@ -2864,7 +2864,7 @@ dependencies = [ [[package]] name = "mtp-webserver" version = "0.3.0" -source = "git+https://git.methanium.net/Methanium/mtp.git?rev=c30315af944bda05ecdb9c4e9cc350cb99cf7b2e#c30315af944bda05ecdb9c4e9cc350cb99cf7b2e" +source = "git+https://git.methanium.net/Methanium/mtp.git?rev=7ef6ec9e8817121ce8d7938b810f13dd979555f1#7ef6ec9e8817121ce8d7938b810f13dd979555f1" dependencies = [ "async-trait", "bytes", diff --git a/apps/tauri/src-tauri/Cargo.toml b/apps/tauri/src-tauri/Cargo.toml index 615b894..ea65a95 100644 --- a/apps/tauri/src-tauri/Cargo.toml +++ b/apps/tauri/src-tauri/Cargo.toml @@ -24,7 +24,7 @@ serde_json = "1" base64 = "0.22" reqwest = { version = "0.13", default-features = false, features = ["json", "rustls"] } tokio = { version = "1", features = ["rt-multi-thread", "sync", "time"] } -mtp = { git = "https://git.methanium.net/Methanium/mtp.git", rev = "c30315af944bda05ecdb9c4e9cc350cb99cf7b2e", features = ["client", "crypto"] } +mtp = { git = "https://git.methanium.net/Methanium/mtp.git", rev = "7ef6ec9e8817121ce8d7938b810f13dd979555f1", features = ["client", "crypto"] } webpki-root-certs = "1" tauri-plugin-deep-link = "2" tauri-plugin-notification = "2" diff --git a/flake.nix b/flake.nix index 6a29551..e02a001 100644 --- a/flake.nix +++ b/flake.nix @@ -17,7 +17,7 @@ systems = [ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs systems; version = "0.0.11"; - x86_64DebHash = "sha256-p/6boNv9uWTHsPTVa3EhGzr41EwRzCY/fJWlj854DVA="; + x86_64DebHash = "sha256-iMEgdjY8Ghlx6K/YzKC5JAZbeHNJDIFHm8MKmM4efaI="; forgejoBaseUrl = "https://git.methanium.net/tensamin/client/releases/download/${version}"; in { @@ -63,7 +63,6 @@ pipewire systemd wayland - webkitgtk_4_1 libX11 libXScrnSaver libXcomposite @@ -185,7 +184,6 @@ pipewire systemd wayland - webkitgtk_4_1 libX11 libXScrnSaver libXcomposite