feat: Add PWA support and CORS configuration

- Configure VitePWA with manifest, icons and service worker
- Add PwaInstallBanner component for install prompt in header
- Enable CORS for z590.interno.com access
- Use dynamic hostname for terminal WebSocket connection
- Add generate-icons script with sharp for PWA icons
- Fix theme-color to match header background
This commit is contained in:
2026-02-13 18:00:54 -06:00
parent 4450d1e034
commit 3c57f95b90
17 changed files with 1438 additions and 282 deletions

View File

@@ -0,0 +1,43 @@
import sharp from 'sharp'
import { readFileSync, mkdirSync } from 'fs'
import { dirname, join } from 'path'
import { fileURLToPath } from 'url'
const __dirname = dirname(fileURLToPath(import.meta.url))
const iconsDir = join(__dirname, '../public/icons')
// Read SVG
const svgBuffer = readFileSync(join(iconsDir, 'icon.svg'))
// Generate icons
const sizes = [
{ name: 'icon-192.png', size: 192 },
{ name: 'icon-512.png', size: 512 },
{ name: 'icon-maskable-512.png', size: 512 }
]
async function generate() {
for (const { name, size } of sizes) {
await sharp(svgBuffer)
.resize(size, size)
.png()
.toFile(join(iconsDir, name))
console.log(`Generated ${name}`)
}
// Also generate apple-touch-icon
await sharp(svgBuffer)
.resize(180, 180)
.png()
.toFile(join(iconsDir, 'apple-touch-icon.png'))
console.log('Generated apple-touch-icon.png')
// Favicon
await sharp(svgBuffer)
.resize(32, 32)
.png()
.toFile(join(__dirname, '../public/favicon.png'))
console.log('Generated favicon.png')
}
generate().catch(console.error)