Fix PWA icons and mobile reading overflow

Generate PNG icons from favicon.svg at build time so manifest icons resolve, replace legacy font tags with div wrappers, and tighten mobile layout so long text wraps instead of clipping.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-05 18:10:38 +08:00
parent a8907d6cc0
commit ecd4f25700
7 changed files with 90 additions and 16 deletions
+18
View File
@@ -162,6 +162,15 @@ app.get('/api/me', authGuard, (req, res) => {
app.use(authGuard)
function sendDistFile(res, relativePath, contentType) {
const filePath = path.join(distPath, relativePath)
if (!fs.existsSync(filePath)) {
return res.status(404).end('Not Found')
}
if (contentType) res.type(contentType)
return res.sendFile(filePath)
}
if (!fs.existsSync(distPath)) {
console.error(
'未找到构建产物 .vitepress/dist,请先运行: npm run build',
@@ -169,10 +178,19 @@ if (!fs.existsSync(distPath)) {
process.exit(1)
}
app.get('/site.webmanifest', (req, res) => {
sendDistFile(res, 'site.webmanifest', 'application/manifest+json')
})
app.use(
express.static(distPath, {
index: false,
fallthrough: true,
setHeaders(res, filePath) {
if (filePath.endsWith('.webmanifest')) {
res.setHeader('Content-Type', 'application/manifest+json')
}
},
}),
)