diff --git a/bun.lockb b/bun.lockb index 7cdb033..0154feb 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a99df75..77fed21 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "recharts": "^2.13.3", "sonner": "^1.7.0", "tailwind-merge": "^2.5.5", - "tailwindcss-animate": "^1.0.7" + "tailwindcss-animate": "^1.0.7", + "vite-plugin-pwa": "^0.21.1" }, "devDependencies": { "@eslint/js": "^9.16.0", diff --git a/public/pwa-192x192.png b/public/pwa-192x192.png new file mode 100644 index 0000000..0e09ce1 Binary files /dev/null and b/public/pwa-192x192.png differ diff --git a/public/pwa-512x512.png b/public/pwa-512x512.png new file mode 100644 index 0000000..27e0244 Binary files /dev/null and b/public/pwa-512x512.png differ diff --git a/src/pages/Server.tsx b/src/pages/Server.tsx index 55fe1ac..88342de 100644 --- a/src/pages/Server.tsx +++ b/src/pages/Server.tsx @@ -57,10 +57,10 @@ export default function Servers() { if (!connected) { return (
-

+

{t("info.websocketConnecting")} -

+
); } diff --git a/vite.config.ts b/vite.config.ts index 67d9050..e248aaf 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,10 +1,41 @@ import path from "path"; import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; +import { VitePWA } from "vite-plugin-pwa"; // https://vite.dev/config/ export default defineConfig({ - plugins: [react()], + plugins: [ + react(), + VitePWA({ + registerType: "autoUpdate", + includeAssets: ["favicon.ico", "apple-touch-icon.png", "masked-icon.svg"], + manifest: { + name: "哪吒面板", + short_name: "哪吒", + description: "哪吒监控面板", + theme_color: "#ffffff", + icons: [ + { + src: "pwa-192x192.png", + sizes: "192x192", + type: "image/png" + }, + { + src: "pwa-512x512.png", + sizes: "512x512", + type: "image/png" + }, + { + src: "pwa-512x512.png", + sizes: "512x512", + type: "image/png", + purpose: "any maskable" + } + ] + } + }) + ], resolve: { alias: { "@": path.resolve(__dirname, "./src"),