Some checks are pending
Security Checks / security (push) Waiting to run
统一 frontend、backend、test、test-log 和 out 目录,更新构建、部署及测试入口;纳入配置管理兼容与首次安全引导修复;排除本机配置、密钥和测试产物。
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
import { createApp } from 'vue'
|
|
import { createPinia } from 'pinia'
|
|
import App from './App.vue'
|
|
import {router} from './router'
|
|
import {useGlobalStatusStore} from './stores/useGlobalStatusStore'
|
|
|
|
import ElementPlus from 'element-plus'
|
|
import 'element-plus/dist/index.css'
|
|
import './assets/main.css'
|
|
|
|
const isReservedResetPath = (pathname) => {
|
|
let decoded = pathname.trim()
|
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
try {
|
|
const next = decodeURIComponent(decoded)
|
|
if (next === decoded) break
|
|
decoded = next
|
|
} catch {
|
|
break
|
|
}
|
|
}
|
|
const normalized = decoded.replace(/\/+$/, '').toLowerCase()
|
|
return normalized === '/reset' || normalized.startsWith('/reset/')
|
|
}
|
|
|
|
// Hash History 会把 /reset#/ 解析成普通首页,启动前先切断这个回退路径。
|
|
if (isReservedResetPath(window.location.pathname)) {
|
|
window.history.replaceState({}, document.title, '/')
|
|
window.location.hash = '#/reset-blocked'
|
|
}
|
|
|
|
const app = createApp(App)
|
|
const pinia = createPinia()
|
|
const globalStatus = useGlobalStatusStore(pinia)
|
|
|
|
app.use(pinia)
|
|
|
|
router.onError((error) => {
|
|
console.error('Router navigation failed', error)
|
|
globalStatus.setStartupError('页面加载失败,请刷新后重试')
|
|
})
|
|
|
|
app.use(router)
|
|
app.use(ElementPlus)
|
|
app.mount('#app')
|