-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
3,005 additions
and
499 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// <reference types="vite-plugin-pwa/client" /> | ||
|
||
declare module 'virtual:pwa-register' { | ||
export interface RegisterSWOptions { | ||
immediate?: boolean | ||
onNeedRefresh?: () => void | ||
onOfflineReady?: () => void | ||
onRegistered?: (registration: ServiceWorkerRegistration | undefined) => void | ||
onRegisterError?: (error: Error) => void | ||
} | ||
|
||
export function registerSW(options?: RegisterSWOptions): (reloadPage?: boolean) => Promise<void> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,60 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
import { VitePWA } from 'vite-plugin-pwa' | ||
|
||
// https://vite.dev/config/ | ||
export default defineConfig({ | ||
base: "", | ||
plugins: [ | ||
react() | ||
react(), | ||
VitePWA({ | ||
injectRegister: null, | ||
selfDestroying: true, | ||
includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'], | ||
manifest: { | ||
name: 'dashbrr', | ||
short_name: 'dashbrr', | ||
description: 'A dashboard for monitoring autobrr and related services', | ||
theme_color: '#18181B', | ||
background_color: '#18181B', | ||
display: 'standalone', | ||
icons: [ | ||
{ | ||
src: 'pwa-192x192.png', | ||
sizes: '192x192', | ||
type: 'image/png' | ||
}, | ||
{ | ||
src: 'pwa-512x512.png', | ||
sizes: '512x512', | ||
type: 'image/png', | ||
purpose: 'any maskable' | ||
} | ||
], | ||
start_url: '/', | ||
scope: '/' | ||
}, | ||
workbox: { | ||
globPatterns: ['**/*.{js,css,html,ico,png,svg}'], | ||
sourcemap: true, | ||
navigateFallbackDenylist: [/^\/api/] | ||
} | ||
}) | ||
], | ||
build: { | ||
outDir: 'dist', | ||
assetsDir: 'assets', | ||
manifest: true, | ||
sourcemap: true | ||
}, | ||
base: './', | ||
logLevel: 'info', | ||
server: { | ||
port: 3000, | ||
hmr: { | ||
overlay: true | ||
}, | ||
proxy: { | ||
'/api': { | ||
target: 'http://localhost:8080', | ||
changeOrigin: true, | ||
secure: false, | ||
ws: true, | ||
configure: (proxy) => { | ||
// Handle proxy errors | ||
proxy.on('error', (err, _req, res) => { | ||
console.error('proxy error', err); | ||
// Prevent connection hanging | ||
if (!res.headersSent) { | ||
res.writeHead(500, { | ||
'Content-Type': 'text/plain', | ||
}); | ||
} | ||
res.end('Proxy error: ' + err.message); | ||
}); | ||
|
||
// Handle WebSocket specific errors | ||
proxy.on('proxyReqWs', (_proxyReq, _req, socket) => { | ||
socket.on('error', (err) => { | ||
console.error('WebSocket proxy error:', err); | ||
socket.end(); | ||
}); | ||
}); | ||
|
||
// Cleanup on WebSocket close | ||
proxy.on('close', () => { | ||
console.log('Proxy connection closed'); | ||
}); | ||
|
||
// Debug logging for development | ||
if (process.env.NODE_ENV === 'development') { | ||
proxy.on('proxyReq', (_proxyReq, req) => { | ||
console.debug(`[DEV] Proxying ${req.method} ${req.url}`); | ||
}); | ||
|
||
proxy.on('proxyRes', (proxyRes, req) => { | ||
console.debug(`[DEV] Received ${proxyRes.statusCode} for ${req.url}`); | ||
}); | ||
} | ||
}, | ||
secure: false | ||
} | ||
}, | ||
hmr: { | ||
// Properly handle HMR connections | ||
protocol: 'ws', | ||
host: 'localhost', | ||
port: 3000, | ||
clientPort: 3000, | ||
timeout: 5000, | ||
overlay: true, | ||
}, | ||
}, | ||
} | ||
} | ||
}) |