feat: Implement push notifications in Budget Manager PWA

- Added functionality for subscribing to push notifications in Settings.vue.
- Integrated service worker registration and notification permission requests.
- Enhanced Vite configuration for PWA with manifest and caching strategies.
- Created a script for generating PDF reports.
- Added project report markdown file detailing the PWA implementation and features.
This commit is contained in:
2025-05-23 23:54:46 +02:00
parent 26e3b76b11
commit 8681aa88af
37 changed files with 7034 additions and 85 deletions
+66 -2
View File
@@ -14,7 +14,72 @@ export default defineConfig({
vue(),
vueDevTools(),
tailwindcss(),
VitePWA({ registerType: "autoUpdate", devOptions: { enabled: true } }),
VitePWA({
registerType: "autoUpdate",
devOptions: { enabled: true },
manifest: {
name: "Budget Manager",
short_name: "BudgetMgr",
description: "Track and manage your finances",
theme_color: "#ffffff",
icons: [
{
src: "/icons/icon-192px.jpg",
sizes: "192x192",
type: "image/png"
},
{
src: "/icons/icon-512px.jpg",
sizes: "512x512",
type: "image/png"
}
]
},
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg,jpg}"],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days
},
cacheableResponse: {
statuses: [0, 200]
}
}
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "gstatic-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365 // <== 365 days
},
cacheableResponse: {
statuses: [0, 200]
},
}
},
{
urlPattern: /\/api\/(?!.*auth).*/i, // All API routes except auth
handler: "NetworkFirst",
options: {
cacheName: "api-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 60 * 60 // 1 hour
}
}
}
]
}
}),
],
resolve: {
alias: {
@@ -26,7 +91,6 @@ export default defineConfig({
"/api": {
target: "http://localhost:3000", // Replace with your API server URL
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
},
},
port: 3001, // Replace with your desired port