Skip to content

Commit 2bc4fca

Browse files
committed
🐞 fix: 修复 ttml 返回 404
1 parent 9242859 commit 2bc4fca

6 files changed

Lines changed: 35 additions & 20 deletions

File tree

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ jobs:
5151
}
5252
# 构建 Electron App (x64)
5353
- name: Build Electron App for Windows x64
54-
run: pnpm run build:win
54+
# 仅 x64
55+
run: pnpm run build:win -- --arch=x64
5556
env:
5657
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5758
# 清理不必要的构建产物(保留 .exe 和 .blockmap 文件)

components.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ declare module 'vue' {
106106
NSlider: typeof import('naive-ui')['NSlider']
107107
NSpin: typeof import('naive-ui')['NSpin']
108108
NSwitch: typeof import('naive-ui')['NSwitch']
109-
NTab: typeof import('naive-ui')['NTab']
110109
NTabPane: typeof import('naive-ui')['NTabPane']
111110
NTabs: typeof import('naive-ui')['NTabs']
112111
NTag: typeof import('naive-ui')['NTag']

electron/server/netease/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,28 @@ export const initNcmAPI = async (fastify: FastifyInstance) => {
6060
}
6161
});
6262

63+
// 获取 TTML 歌词
64+
fastify.get(
65+
"/netease/lyric/ttml",
66+
async (req: FastifyRequest<{ Querystring: { id: string } }>, reply: FastifyReply) => {
67+
const { id } = req.query;
68+
if (!id) {
69+
return reply.status(400).send({ error: "id is required" });
70+
}
71+
const url = `https://amll-ttml-db.stevexmh.net/ncm/${id}`;
72+
try {
73+
const response = await fetch(url);
74+
if (response.status !== 200) {
75+
return reply.send(null);
76+
}
77+
const data = await response.text();
78+
return reply.send(data);
79+
} catch (error) {
80+
serverLog.error("❌ TTML Lyric Fetch Error:", error);
81+
return reply.status(500).send(null);
82+
}
83+
},
84+
);
85+
6386
serverLog.info("🌐 Register NcmAPI successfully");
6487
};

src/api/song.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,13 @@ export const songLyric = (id: number) => {
6565
});
6666
};
6767

68-
// 获取格式TTML的歌词
69-
export const songLyricTTML = async (id: number) => {
70-
const url = `https://amll-ttml-db.stevexmh.net/ncm/${id}`;
71-
try {
72-
const response = await fetch(url);
73-
if (response === null || response.status !== 200) {
74-
return null;
75-
}
76-
const data = await response.text();
77-
return data;
78-
} catch {
79-
return null;
80-
}
68+
/**
69+
* 获取歌曲 TTML 歌词
70+
* @param id 音乐 id
71+
* @returns TTML 格式歌词
72+
*/
73+
export const songLyricTTML = (id: number) => {
74+
return request({ url: "/lyric/ttml", params: { id } });
8175
};
8276

8377
/**

src/utils/player.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class Player {
230230
console.log("🚫 Session expired after cleanup, aborting");
231231
return;
232232
}
233-
// 创建播放器(禁用内置 autoplay,统一走手动 play)
233+
// 创建播放器
234234
this.player = new Howl({
235235
src,
236236
format: allowPlayFormat,
@@ -241,11 +241,11 @@ class Player {
241241
volume: statusStore.playVolume,
242242
rate: statusStore.playRate,
243243
});
244-
// 播放器事件(绑定当前会话)
244+
// 播放器事件
245245
this.playerEvent({ seek });
246246
// 播放设备
247247
if (!settingStore.showSpectrums) this.toggleOutputDevice();
248-
// 自动播放(仅一次性触发)
248+
// 自动播放
249249
if (autoPlay) await this.play();
250250
// 获取歌曲附加信息 - 非电台和本地
251251
if (type !== "radio" && !path) {
@@ -1455,7 +1455,6 @@ class Player {
14551455
clearInterval(this.autoCloseInterval);
14561456
this.autoCloseInterval = undefined;
14571457
}
1458-
console.log("🧹 All timers cleaned up");
14591458
}
14601459

14611460
/**

src/views/DesktopLyrics/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<div ref="desktopLyricsRef" class="desktop-lyrics">
44
{{ lyricData.playName }}
55
{{ lyricConfig }}
6-
456456
76
<div class="header" align="center" justify="space-between">
87
<n-flex :wrap="false" align="center" justify="flex-start" size="small">
98
<div class="menu-btn" title="返回应用">

0 commit comments

Comments
 (0)