reintroduce webmanifest for PWA compatability

This commit is contained in:
778a69cd 2023-08-10 21:50:45 +02:00 committed by Thomas Citharel
parent 45a1a3a2dd
commit 2e08aa2573
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
3 changed files with 32 additions and 1 deletions

View File

@ -23,10 +23,40 @@ export default defineConfig(({ command }) => {
strategies: "injectManifest", strategies: "injectManifest",
srcDir: "src", srcDir: "src",
filename: "service-worker.ts", filename: "service-worker.ts",
theme_color: "#ffd599",
// injectRegister: "auto", // injectRegister: "auto",
// devOptions: { // devOptions: {
// enabled: true, // enabled: true,
// }, // },
manifest: {
name: "Mobilizon",
short_name: "Mobilizon",
orientation: "portrait-primary",
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(),
], ],

View File

@ -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

View File

@ -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)) {