mirror of
https://github.com/koichixD/uptime-kuma.git
synced 2026-09-04 17:23:21 +00:00
fix: Remove vite-plugin-pwa, avoid this plugin caches files unexpectedly (#6907)
Also fixed webpush wrong msg Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
@@ -44,6 +44,12 @@ app.component("FontAwesomeIcon", FontAwesomeIcon);
|
||||
|
||||
app.mount("#app");
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("/sw.js", { scope: "/" }).catch((error) => {
|
||||
console.error("Service worker registration failed:", error);
|
||||
});
|
||||
}
|
||||
|
||||
// Expose the vue instance for development
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
console.log("Dev Only: window.app is the vue instance");
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// Needed per Vite PWA docs
|
||||
import { precacheAndRoute } from "workbox-precaching";
|
||||
declare let self: ServiceWorkerGlobalScope;
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
|
||||
// Receive push notifications
|
||||
self.addEventListener("push", function (event) {
|
||||
if (self.Notification?.permission !== "granted") {
|
||||
console.error("Notifications aren't supported or permission not granted!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.data) {
|
||||
let message = event.data.json();
|
||||
try {
|
||||
self.registration.showNotification(message.title, {
|
||||
body: message.body,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to show notification:", error);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user