diff --git a/js/src/App.vue b/js/src/App.vue
index 108981bb3..0ab573784 100644
--- a/js/src/App.vue
+++ b/js/src/App.vue
@@ -178,7 +178,9 @@ onMounted(() => {
cancelText: t("Ignore"),
message: t("A new version is available."),
onAction: async () => {
- const registration = event.detail as ServiceWorkerRegistration;
+ const registration = (
+ event as unknown as { detail: ServiceWorkerRegistration }
+ ).detail;
try {
await refreshApp(registration);
window.location.reload();
diff --git a/js/tsconfig.json b/js/tsconfig.json
index a8f27a55f..a8bb8cbea 100644
--- a/js/tsconfig.json
+++ b/js/tsconfig.json
@@ -14,7 +14,7 @@
"isolatedModules": true,
"sourceMap": true,
"baseUrl": ".",
- "types": ["webpack-env", "jest", "vite/client"],
+ "types": ["webpack-env", "jest", "vite/client", "vite-plugin-pwa/vue"],
"typeRoots": ["./@types", "./node_modules/@types"],
"paths": {
"@/*": ["src/*"]
diff --git a/js/vite.config.js b/js/vite.config.js
index 184f0ac91..7250205a9 100644
--- a/js/vite.config.js
+++ b/js/vite.config.js
@@ -19,7 +19,7 @@ export default defineConfig(({ command }) => {
plugins: [
vue(),
VitePWA({
- // registerType: "autoUpdate",
+ registerType: "autoUpdate",
strategies: "injectManifest",
srcDir: "src",
filename: "service-worker.ts",
@@ -27,6 +27,36 @@ export default defineConfig(({ command }) => {
// devOptions: {
// enabled: true,
// },
+ manifest: {
+ name: "Mobilizon",
+ short_name: "Mobilizon",
+ orientation: "portrait-primary",
+ theme_color: "#ffd599",
+ icons: [
+ {
+ src: "./img/icons/android-chrome-192x192.png",
+ sizes: "192x192",
+ type: "image/png",
+ },
+ {
+ src: "./img/icons/android-chrome-512x512.png",
+ sizes: "512x512",
+ type: "image/png",
+ },
+ {
+ src: "./img/icons/android-chrome-maskable-192x192.png",
+ sizes: "192x192",
+ type: "image/png",
+ purpose: "maskable",
+ },
+ {
+ src: "./img/icons/android-chrome-maskable-512x512.png",
+ sizes: "512x512",
+ type: "image/png",
+ purpose: "maskable",
+ },
+ ],
+ },
}),
visualizer(),
],
diff --git a/lib/web/mobilizon_web.ex b/lib/web/mobilizon_web.ex
index 2c955e952..a1f97a6e3 100644
--- a/lib/web/mobilizon_web.ex
+++ b/lib/web/mobilizon_web.ex
@@ -19,7 +19,7 @@ defmodule Mobilizon.Web do
def static_paths,
do:
- ~w(index.html manifest.json service-worker.js css fonts img js favicon.ico robots.txt assets)
+ ~w(index.html manifest.json manifest.webmanifest service-worker.js css fonts img js favicon.ico robots.txt assets)
def controller do
quote do
diff --git a/lib/web/templates/page/index.html.heex b/lib/web/templates/page/index.html.heex
index 7047727cb..f3764f3ec 100644
--- a/lib/web/templates/page/index.html.heex
+++ b/lib/web/templates/page/index.html.heex
@@ -6,6 +6,7 @@
+