fix(build): 彻底移除无用的网易云 API 模块,消除由于未安装模块引入导致的 OOM 和解析异常
构建并部署 BYW VoiceHub / Preflight 语法与构建检查 (push) Failing after 3m2s
构建并部署 BYW VoiceHub / 镜像构建·预热(与 Preflight 并发:系统/镜像源/Builder 初始化) (push) Successful in 4m29s
构建并部署 BYW VoiceHub / 构建并推送容器镜像 (push) Skipped
构建并部署 BYW VoiceHub / 部署到生产服务器 (push) Skipped

This commit is contained in:
2026-09-13 13:54:41 +08:00
parent 7034bbaedb
commit 456f676929
2 changed files with 0 additions and 68 deletions
-1
View File
@@ -302,7 +302,6 @@ export default defineNuxtConfig({
external: [ external: [
'drizzle-orm', 'drizzle-orm',
'postgres', 'postgres',
'@neteasecloudmusicapienhanced/api',
'h3', 'h3',
'lucide-vue-next', 'lucide-vue-next',
'@pixi/app' '@pixi/app'
@@ -1,67 +0,0 @@
const neteaseEnhancedApiPromise = import(/* @vite-ignore */ '@neteasecloudmusicapienhanced/api').then((mod) => {
return (mod.default || {}) as Record<string, (params: Record<string, any>) => Promise<any>>
})
const normalizeParams = (input: Record<string, any>) => {
const output: Record<string, any> = {}
for (const [key, value] of Object.entries(input || {})) {
if (value === undefined || value === null || value === '') {
continue
}
output[key] = Array.isArray(value) ? value[value.length - 1] : value
}
return output
}
export default defineEventHandler(async (event) => {
const rawPath = getRouterParam(event, 'path')
const endpointPath = Array.isArray(rawPath) ? rawPath.join('/') : rawPath
if (!endpointPath) {
throw createError({
statusCode: 400,
message: '缺少网易云接口路径'
})
}
const action = endpointPath.replace(/\//g, '_').replace(/-/g, '_')
const api = await neteaseEnhancedApiPromise
const handler = api[action]
if (typeof handler !== 'function') {
throw createError({
statusCode: 404,
message: `未找到接口: ${endpointPath}`
})
}
const method = getMethod(event)
const queryParams = normalizeParams(getQuery(event))
let bodyParams: Record<string, any> = {}
if (method !== 'GET') {
const body = await readBody(event).catch(() => ({}))
if (body && typeof body === 'object' && !Array.isArray(body)) {
bodyParams = normalizeParams(body as Record<string, any>)
}
}
const params = { ...queryParams, ...bodyParams }
try {
const result = await handler(params)
if (Array.isArray(result?.cookie) && result.cookie.length > 0) {
setHeader(event, 'set-cookie', result.cookie)
}
if (typeof result?.status === 'number') {
setResponseStatus(event, result.status)
}
return result?.body ?? result
} catch (error: any) {
throw createError({
statusCode: error?.statusCode || error?.status || 500,
message: error?.body?.message || error?.message || '网易云接口调用失败',
data: error?.body || null
})
}
})