Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65b86de9cd | |||
|
094cb910aa |
|||
|
cf17365c8f |
|||
|
aa34bd962b |
|||
|
1d1b304bcf |
|||
|
|
0fbedf6733 | ||
|
96b81d30b1 |
|||
|
|
d0918ff384 | ||
| 0ac20f09e4 | |||
| 73db7e6b2b | |||
|
|
ac1bdf5ac2 |
5 changed files with 18 additions and 14 deletions
|
|
@ -5,9 +5,6 @@ on:
|
|||
paths-ignore:
|
||||
- flake.nix
|
||||
|
||||
env:
|
||||
NIX_CONFIG: experimental-features = nix-command flakes
|
||||
|
||||
jobs:
|
||||
build-web:
|
||||
runs-on: nixos
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ on:
|
|||
paths-ignore:
|
||||
- flake.nix
|
||||
|
||||
env:
|
||||
NIX_CONFIG: experimental-features = nix-command flakes
|
||||
|
||||
jobs:
|
||||
build-web:
|
||||
runs-on: nixos
|
||||
|
|
|
|||
|
|
@ -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 <InstalledPwaRuntime />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue