generated from Dicken/dickendock
Commit 7: PWA (Manifest, Service Worker, Icons, Offline-Grundfunktion)
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="theme-color" content="#0a0a0a" />
|
||||
<meta name="description" content="Schneller, minimalistischer Homelab-Launcher" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<title>LaunchPad</title>
|
||||
</head>
|
||||
<body class="bg-white dark:bg-black">
|
||||
@@ -11,3 +14,4 @@
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -19,6 +19,19 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Service Worker und Manifest dürfen nicht langfristig gecacht werden,
|
||||
# sonst bekommen installierte PWA-Nutzer nie ein Update mit.
|
||||
location = /sw.js {
|
||||
add_header Cache-Control "no-cache";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location = /manifest.webmanifest {
|
||||
add_header Cache-Control "no-cache";
|
||||
default_type application/manifest+json;
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location ~* \.(?:css|js|svg|png|jpg|jpeg|gif|ico|woff2?)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, max-age=604800, immutable";
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"postcss": "^8.4.41",
|
||||
"tailwindcss": "^3.4.10",
|
||||
"typescript": "^5.5.4",
|
||||
"vite": "^5.4.1"
|
||||
"vite": "^5.4.1",
|
||||
"vite-plugin-pwa": "^0.20.5"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
apps/frontend/public/apple-touch-icon.png
Normal file
BIN
apps/frontend/public/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
5
apps/frontend/public/favicon.svg
Normal file
5
apps/frontend/public/favicon.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg width="512" height="512" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="512" height="512" rx="112" fill="#0a0a0a"/>
|
||||
<path d="M 200 140 L 200 372 L 372 256 Z" fill="#ffffff"/>
|
||||
<circle cx="150" cy="256" r="26" fill="#ffffff"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 267 B |
BIN
apps/frontend/public/icons/icon-192.png
Normal file
BIN
apps/frontend/public/icons/icon-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
apps/frontend/public/icons/icon-512.png
Normal file
BIN
apps/frontend/public/icons/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
apps/frontend/public/icons/icon-maskable-192.png
Normal file
BIN
apps/frontend/public/icons/icon-maskable-192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
apps/frontend/public/icons/icon-maskable-512.png
Normal file
BIN
apps/frontend/public/icons/icon-maskable-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
@@ -1,8 +1,59 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
plugins: [
|
||||
react(),
|
||||
VitePWA({
|
||||
registerType: "autoUpdate",
|
||||
includeAssets: ["favicon.svg", "apple-touch-icon.png"],
|
||||
manifest: {
|
||||
name: "LaunchPad",
|
||||
short_name: "LaunchPad",
|
||||
description: "Schneller, minimalistischer Homelab-Launcher",
|
||||
lang: "de",
|
||||
theme_color: "#0a0a0a",
|
||||
background_color: "#0a0a0a",
|
||||
display: "standalone",
|
||||
start_url: "/",
|
||||
icons: [
|
||||
{ src: "/icons/icon-192.png", sizes: "192x192", type: "image/png" },
|
||||
{ src: "/icons/icon-512.png", sizes: "512x512", type: "image/png" },
|
||||
{
|
||||
src: "/icons/icon-maskable-192.png",
|
||||
sizes: "192x192",
|
||||
type: "image/png",
|
||||
purpose: "maskable",
|
||||
},
|
||||
{
|
||||
src: "/icons/icon-maskable-512.png",
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
purpose: "maskable",
|
||||
},
|
||||
],
|
||||
},
|
||||
workbox: {
|
||||
// Zeigt beim Offline-Öffnen weiterhin die (gecachte) App-Shell an.
|
||||
navigateFallback: "/index.html",
|
||||
runtimeCaching: [
|
||||
{
|
||||
// Zuletzt geladene Geräte/Dienste/Kategorien bleiben offline verfügbar
|
||||
// (NetworkFirst: frische Daten, wenn erreichbar, sonst letzter Cache-Stand).
|
||||
urlPattern: ({ url }: { url: URL }) => url.pathname.startsWith("/api/"),
|
||||
handler: "NetworkFirst",
|
||||
options: {
|
||||
cacheName: "launchpad-api-cache",
|
||||
networkTimeoutSeconds: 3,
|
||||
cacheableResponse: { statuses: [0, 200] },
|
||||
expiration: { maxEntries: 100, maxAgeSeconds: 60 * 60 * 24 },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
host: true,
|
||||
port: 5173,
|
||||
|
||||
Reference in New Issue
Block a user