forked from potsda.mn/mobilizon
Merge branch 'mobilizon-webmanifest' into 'main'
reintroduce webmanifest for PWA compatability See merge request framasoft/mobilizon!1424
This commit is contained in:
commit
027013eba3
|
@ -178,7 +178,9 @@ onMounted(() => {
|
||||||
cancelText: t("Ignore"),
|
cancelText: t("Ignore"),
|
||||||
message: t("A new version is available."),
|
message: t("A new version is available."),
|
||||||
onAction: async () => {
|
onAction: async () => {
|
||||||
const registration = event.detail as ServiceWorkerRegistration;
|
const registration = (
|
||||||
|
event as unknown as { detail: ServiceWorkerRegistration }
|
||||||
|
).detail;
|
||||||
try {
|
try {
|
||||||
await refreshApp(registration);
|
await refreshApp(registration);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"types": ["webpack-env", "jest", "vite/client"],
|
"types": ["webpack-env", "jest", "vite/client", "vite-plugin-pwa/vue"],
|
||||||
"typeRoots": ["./@types", "./node_modules/@types"],
|
"typeRoots": ["./@types", "./node_modules/@types"],
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["src/*"]
|
"@/*": ["src/*"]
|
||||||
|
|
|
@ -19,7 +19,7 @@ export default defineConfig(({ command }) => {
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
// registerType: "autoUpdate",
|
registerType: "autoUpdate",
|
||||||
strategies: "injectManifest",
|
strategies: "injectManifest",
|
||||||
srcDir: "src",
|
srcDir: "src",
|
||||||
filename: "service-worker.ts",
|
filename: "service-worker.ts",
|
||||||
|
@ -27,6 +27,36 @@ export default defineConfig(({ command }) => {
|
||||||
// devOptions: {
|
// devOptions: {
|
||||||
// enabled: true,
|
// 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(),
|
visualizer(),
|
||||||
],
|
],
|
||||||
|
|
|
@ -19,7 +19,7 @@ defmodule Mobilizon.Web do
|
||||||
|
|
||||||
def static_paths,
|
def static_paths,
|
||||||
do:
|
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
|
def controller do
|
||||||
quote do
|
quote do
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png" sizes="152x152" />
|
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png" sizes="152x152" />
|
||||||
<link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color={theme_color()} />
|
<link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color={theme_color()} />
|
||||||
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
<meta name="theme-color" content={theme_color()} />
|
<meta name="theme-color" content={theme_color()} />
|
||||||
<script>
|
<script>
|
||||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||||
|
|
Loading…
Reference in a new issue