Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ declare module 'vue' {
CacheSizeLimit: typeof import('./src/components/Setting/components/CacheSizeLimit.vue')['default']
ChangeRate: typeof import('./src/components/Modal/ChangeRate.vue')['default']
CloudMatch: typeof import('./src/components/Modal/CloudMatch.vue')['default']
CloudUpload: typeof import('./src/components/Modal/CloudUpload.vue')['default']
CommentList: typeof import('./src/components/List/CommentList.vue')['default']
ContextMenuManager: typeof import('./src/components/Modal/Setting/ContextMenuManager.vue')['default']
CopyLyrics: typeof import('./src/components/Modal/CopyLyrics.vue')['default']
Expand Down Expand Up @@ -136,6 +137,8 @@ declare module 'vue' {
NText: typeof import('naive-ui')['NText']
NThing: typeof import('naive-ui')['NThing']
NTree: typeof import('naive-ui')['NTree']
NUpload: typeof import('naive-ui')['NUpload']
NUploadDragger: typeof import('naive-ui')['NUploadDragger']
PersonalFM: typeof import('./src/components/Player/PlayerComponents/PersonalFM.vue')['default']
PlayerBackground: typeof import('./src/components/Player/PlayerMeta/PlayerBackground.vue')['default']
PlayerComment: typeof import('./src/components/Player/PlayerComponents/PlayerComment.vue')['default']
Expand Down
8 changes: 7 additions & 1 deletion electron/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ import fastify from "fastify";

const initAppServer = async () => {
try {
const uploadFileSizeLimit = 100 * 1024 * 1024; // 100MB
const server = fastify({
routerOptions: {
// 忽略尾随斜杠
ignoreTrailingSlash: true,
},
bodyLimit: uploadFileSizeLimit,
});
// 注册插件
server.register(fastifyCookie);
server.register(fastifyMultipart);
server.register(fastifyMultipart, {
limits: {
fileSize: uploadFileSizeLimit
},
});
// 生产环境启用静态文件
if (!isDev) {
serverLog.info("📂 Serving static files from /renderer");
Expand Down
20 changes: 18 additions & 2 deletions electron/server/netease/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,27 @@ export const initNcmAPI = async (fastify: FastifyInstance) => {
serverLog.log("🌐 Request NcmAPI:", requestPath);

try {
const result = await neteaseApi({
const params: Record<string, unknown> = {
...(req.query as Record<string, unknown>),
...(req.body as Record<string, unknown>),
cookie: req.cookies,
});
};

// 处理 multipart/form-data 文件上传
if (req.isMultipart()) {
const data = await req.file();
if (data) {
const buffer = await data.toBuffer();
params.songFile = {
name: data.filename,
data: buffer,
mimetype: data.mimetype,
size: buffer.byteLength,
};
}
}

const result = await neteaseApi(params);
return reply.send(result.body);
} catch (error: unknown) {
serverLog.error("❌ NcmAPI Error:", error);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@electron-toolkit/utils": "^4.0.0",
"@imsyy/color-utils": "^1.0.2",
"@material/material-color-utilities": "^0.4.0",
"@neteasecloudmusicapienhanced/api": "^4.30.1",
"@neteasecloudmusicapienhanced/api": "^4.31.0",
"@pixi/app": "^7.4.3",
"@pixi/core": "^7.4.3",
"@pixi/display": "^7.4.3",
Expand Down
Loading