撤销修改

This commit is contained in:
tangxinyue 2026-07-24 16:43:58 +08:00
parent e2ada92510
commit d4a88c79d7
7 changed files with 66 additions and 96 deletions

View File

@ -148,3 +148,41 @@
[2026-07-24 16:00:28,636] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:00:28,753] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=687eeb5a709fe2ec7af8cf0e43588b6d&signature=41e9223fbe52216889f8597190bfcf17&timestamp=1784880028
[2026-07-24 16:00:28,754] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=e2c74882b519e4afbc46648242cdc524&signature=cdd7b9762921b5e8133552f841286224&timestamp=1784880028
[2026-07-24 16:14:55,889] [INFO] [unknow:0] GET 200 /gongzidan
[2026-07-24 16:14:55,927] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
[2026-07-24 16:14:56,121] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:14:56,200] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=4d024e9d224606b23175921343ac2adc&signature=291c7e7b13c5a1632def47a4bc93108f&timestamp=1784880896
[2026-07-24 16:14:56,202] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=18bef3b4556cebb6ca3c416b0fe7b007&signature=e4957786065607efef17b8ee370dbc0d&timestamp=1784880896
[2026-07-24 16:14:59,376] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] POST 200 /api/weixin/qrcode?nonce=8bcb728f3e26b6cb4e645a6389746fb2&signature=11e6b0a5393136842aa145b901d56f72&timestamp=1784880899
[2026-07-24 16:15:04,387] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] POST 200 /api/user/code?nonce=a28773c46366900306c91f8bccdd63a2&signature=34ba29f5c366de600b855578bbdcc8cc&timestamp=1784880904
[2026-07-24 16:15:30,082] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] POST 200 /api/user/login?nonce=73283f40e37c37d01635b58dbcca8cc8&signature=ef10f4edd357802edc72235c90229c4f&timestamp=1784880930
[2026-07-24 16:15:30,303] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=57bec3e292aab64a6857757e676d7e88&signature=4dcad94000a09ca9fa13fdfa4613f51a&timestamp=1784880930
[2026-07-24 16:15:30,464] [INFO] [unknow:0] GET 200 /gongzidan
[2026-07-24 16:15:30,509] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
[2026-07-24 16:15:30,753] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:15:30,855] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=c3b9f7f57240baddf1271e62ad2ad698&signature=900b523098055518ee3a2170dbb771c6&timestamp=1784880930
[2026-07-24 16:15:30,857] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=6a19798328d69efa183ecfbe57242c89&signature=88d738a97e82cca92f8d75e85d5cc7ee&timestamp=1784880930
[2026-07-24 16:15:37,814] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=cf9d84b355d1cbc2e483768adae9b4e5&signature=5b5081b70a993b0f9b785baac0e9a568&timestamp=1784880937
[2026-07-24 16:15:37,816] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:15:37,951] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/order?nonce=b872d144aa341a74f5255d2e360b45eb&signature=f12913917c9f54eed28604d6b6383cf0&status=2&timestamp=1784880937
[2026-07-24 16:36:27,625] [INFO] [unknow:0] GET 200 /profile
[2026-07-24 16:36:27,677] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
[2026-07-24 16:36:27,899] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:39:32,927] [INFO] [unknow:0] GET 200 /profile
[2026-07-24 16:39:32,958] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
[2026-07-24 16:39:33,119] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:39:33,235] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=996138f776ed739d382016dd9121138f&signature=596f2838507509f9a1d65b80e89e9014&timestamp=1784882373
[2026-07-24 16:39:33,236] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=01498636cf2d7317cf3dd7a86dee6bd5&signature=e8ad28f8472f3e6f8cb11599e42fd756&timestamp=1784882373
[2026-07-24 16:39:35,135] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:39:38,460] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:39:40,206] [INFO] [unknow:0] GET 200 /profile
[2026-07-24 16:39:40,245] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
[2026-07-24 16:39:40,439] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:39:40,537] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=a210517cffd18aae10251908bbc67a04&signature=e280863cf93c90dba491cbfbc9676c38&timestamp=1784882380
[2026-07-24 16:39:40,540] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=b29ce1641c70424d6791255cfcad0d17&signature=9d08f695faa78b7e9a34c72204f9a4bb&timestamp=1784882380
[2026-07-24 16:39:40,668] [INFO] [unknow:0] GET 200 /profile
[2026-07-24 16:39:40,703] [INFO] [unknow:0] GET 200 /.well-known/appspecific/com.chrome.devtools.json
[2026-07-24 16:39:40,860] [INFO] [unknow:0] GET 200 /favicon.ico
[2026-07-24 16:39:40,975] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user?nonce=4bd7d64137781d559df72ea38171d9a8&signature=0f49a895ca87bb476555b7b321a0f0d1&timestamp=1784882380
[2026-07-24 16:39:40,976] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/user/config?nonce=c8fef1211519d80bfd5bb0018c4aa7c6&signature=370cfd624d78ea2b7c121ad572c4ae26&timestamp=1784882380
[2026-07-24 16:39:44,513] [INFO] [D:\AAA-Code\flaunt-web\service\core\router\index.cjs:28] GET 200 /api/order?nonce=e40d8de94b3a4d5b83353f4dcf225981&signature=f421768a835b1d84771415f7fe6ea98f&status=2&timestamp=1784882384

View File

@ -72,9 +72,7 @@ function getMimeType(filePath) {
woff: 'font/woff',
woff2: 'font/woff2',
ttf: 'font/ttf',
otf: 'font/otf',
dat: 'application/octet-stream',
wasm: 'application/wasm'
otf: 'font/otf'
}
if (ext && defaultMimes[ext]) {
return defaultMimes[ext]
@ -88,51 +86,14 @@ function getMimeType(filePath) {
const matchFile = async (request, response) => {
return new Promise((resolve) => {
const cleanPath = decodeURIComponent(request.url.split('?')[0])
let targetPath = dist + cleanPath
if (!fs.existsSync(targetPath)) {
const mappedPath = dist + cleanPath.replace(/^\/(src\/public|public|src)/, '')
if (fs.existsSync(mappedPath)) {
targetPath = mappedPath
} else if (cleanPath.startsWith('/assets/')) {
// 如果请求的是带 hash 的旧文件,尝试摘除 -[hash] 请求固定文件
const filename = cleanPath.split('/').pop()
const parts = filename.split('.')
const ext = parts.pop()
const nameParts = parts.join('.').split('-')
if (nameParts.length > 1) {
nameParts.pop() // 移除最后的 hash
const baseName = nameParts.join('-')
const fallbackPath = dist + '/assets/' + baseName + '.' + ext
if (fs.existsSync(fallbackPath)) {
targetPath = fallbackPath
} else {
response.writeHead(404, { 'Content-Type': 'text/plain' })
response.end('Asset Not Found')
resolve(true)
return
}
} else {
response.writeHead(404, { 'Content-Type': 'text/plain' })
response.end('Asset Not Found')
resolve(true)
return
}
}
}
fs.readFile(targetPath, (err, file) => {
fs.readFile(dist + cleanPath, (err, file) => {
if (!err) {
const mimetype = getMimeType(cleanPath)
const responseHeaders = {
'Content-Type': mimetype,
'Access-Control-Allow-Origin': '*'
const responseHdeaders = { 'Content-Type': mimetype }
if (cleanPath.endsWith("-sw.js")) {
responseHdeaders["Service-Worker-Allowed"] = '/'
}
if (cleanPath.endsWith(".js") || cleanPath.endsWith(".css") || cleanPath.endsWith("-sw.js") || cleanPath.includes("dat-module-map.json")) {
responseHeaders["Service-Worker-Allowed"] = '/'
responseHeaders["Cache-Control"] = 'no-cache, no-store, must-revalidate'
responseHeaders["Pragma"] = 'no-cache'
responseHeaders["Expires"] = '0'
}
response.writeHead(httpOk, responseHeaders)
response.writeHead(httpOk, responseHdeaders)
response.end(file)
// logger.info(`${request.method} ${httpOk} ${request.url}`)
resolve(true)
@ -147,13 +108,7 @@ const endIndex = async (request, response) => {
console.log(dist + '/index.html')
fs.readFile(dist + '/index.html', (err, html) => {
if (!err) {
response.writeHead(httpOk, {
'Content-type': 'text/html;charset=utf-8',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Pragma': 'no-cache',
'Expires': '0',
'Access-Control-Allow-Origin': '*'
})
response.writeHead(httpOk, { 'Content-type': 'text/html;charset=utf-8' })
response.end(html)
logger.info(`${request.method} ${httpOk} ${request.url}`)
}
@ -190,6 +145,25 @@ const httpService = async (request, response) => {
logger.info(`${request.method} ${httpBadRequest} ${request.url}`)
}
}
module.exports = {
httpService,
matchType,
matchRouter,
matchFile,
endIndex,
matchProxy,
}
} catch (e) {
response.writeHead(httpBadRequest, { 'Content-Type': 'application/json' })
response.end(
JSON.stringify({
code: -1,
message: String(e)
})
)
logger.info(`${request.method} ${httpBadRequest} ${request.url}`)
}
}
module.exports = {
httpService,
matchType,

View File

@ -23,7 +23,7 @@ http.interceptors.response.use(
userStore.reset()
// _noRedirect 标记:静默验证时不跳转(避免注册/登录页被重定向)
if (!err.config?._noRedirect) {
router.push({ path: '/', query: { showLogin: 1 } })
router.push('/login')
}
return Promise.reject(err)
}

View File

@ -200,10 +200,6 @@ async function handleCommand(cmd) {
}
router.push('/works')
} else if (cmd === 'profile') {
if (!isLoggedIn.value) {
loginDialogRef.value?.open()
return
}
router.push('/profile')
} else if (cmd === 'vip') {
showPayment?.()

View File

@ -1,12 +1,3 @@
// 自动清理可能残留的旧版 ServiceWorker 缓存,保障最新代码 Chunk 正常加载
if (typeof window !== 'undefined' && 'serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(registrations => {
for (const registration of registrations) {
registration.unregister()
}
}).catch(() => {})
}
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

View File

@ -38,6 +38,7 @@ router.beforeEach(async (to, from, next) => {
// 不需要认证的页面,直接放行
if (!to.meta.requiresAuth) return next()
// 需要认证的页面:如果没有 token 或者 token 已失效,跳回首页并唤起登录框
if (!token || !userStore.tokenValid) {
return next({ path: '/', query: { showLogin: 1 } })
}
@ -45,29 +46,4 @@ router.beforeEach(async (to, from, next) => {
next()
})
router.onError((error) => {
const pattern = /Failed to fetch dynamically imported module|Importing a module script failed/i
if (pattern.test(error?.message || '')) {
const isReloaded = sessionStorage.getItem('chunk_reload_flag')
if (!isReloaded) {
sessionStorage.setItem('chunk_reload_flag', 'true')
const forceReload = () => {
const url = new URL(window.location.href)
url.searchParams.set('t', Date.now())
window.location.href = url.href
}
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(registrations => {
for (const registration of registrations) {
registration.unregister()
}
forceReload()
}).catch(() => { forceReload() })
} else {
forceReload()
}
}
}
})
export default router

View File

@ -41,11 +41,6 @@ export default defineConfig({
build: {
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name].[ext]'
},
onwarn(warning, warn) {
if (warning.code === 'UNRESOLVED_IMPORT' || warning.code === 'UNUSED_EXTERNAL_IMPORT') return;
warn(warning);