Add VitePress site with local login and deployment docs

Enable static site build on port 12100 with Express session auth, auto sidebar, and DEPLOY.md for Ubuntu/NPS setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-05 16:12:35 +08:00
parent 2a1dc95253
commit 68d816b3f3
102 changed files with 4419 additions and 7 deletions
+49
View File
@@ -0,0 +1,49 @@
import fs from 'node:fs'
import path from 'node:path'
const assetPattern = /\.(png|jpe?g|gif|webp|svg|bmp)(\?.*)?$/i
function toPublicUrl(source) {
if (source.startsWith('../images/')) {
return `/images/${source.slice('../images/'.length)}`
}
if (source.startsWith('../assets/')) {
return `/assets/${source.slice('../assets/'.length)}`
}
if (source.startsWith('images/')) {
return `/images/${source.slice('images/'.length)}`
}
if (source.startsWith('assets/')) {
return `/assets/${source.slice('assets/'.length)}`
}
return `/${source.replace(/^\.\//, '')}`
}
export function missingAssetsPlugin() {
return {
name: 'vitepress-missing-assets',
enforce: 'pre',
resolveId(source, importer) {
if (!importer?.endsWith('.md') || !assetPattern.test(source)) {
return null
}
if (/^https?:\/\//.test(source)) {
return null
}
const resolved = path.resolve(path.dirname(importer), source)
if (fs.existsSync(resolved)) {
return null
}
return `\0missing-asset:${toPublicUrl(source)}`
},
load(id) {
if (!id.startsWith('\0missing-asset:')) {
return null
}
const url = id.slice('\0missing-asset:'.length)
return `export default ${JSON.stringify(url)}`
},
}
}