mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 19:37:35 +08:00
🐞 fix: 修复 ttml 返回 404
This commit is contained in:
@@ -51,7 +51,8 @@ jobs:
|
||||
}
|
||||
# 构建 Electron App (x64)
|
||||
- name: Build Electron App for Windows x64
|
||||
run: pnpm run build:win
|
||||
# 仅 x64
|
||||
run: pnpm run build:win -- --arch=x64
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# 清理不必要的构建产物(保留 .exe 和 .blockmap 文件)
|
||||
1
components.d.ts
vendored
1
components.d.ts
vendored
@@ -106,7 +106,6 @@ declare module 'vue' {
|
||||
NSlider: typeof import('naive-ui')['NSlider']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
NTab: typeof import('naive-ui')['NTab']
|
||||
NTabPane: typeof import('naive-ui')['NTabPane']
|
||||
NTabs: typeof import('naive-ui')['NTabs']
|
||||
NTag: typeof import('naive-ui')['NTag']
|
||||
|
||||
@@ -60,5 +60,28 @@ export const initNcmAPI = async (fastify: FastifyInstance) => {
|
||||
}
|
||||
});
|
||||
|
||||
// 获取 TTML 歌词
|
||||
fastify.get(
|
||||
"/netease/lyric/ttml",
|
||||
async (req: FastifyRequest<{ Querystring: { id: string } }>, reply: FastifyReply) => {
|
||||
const { id } = req.query;
|
||||
if (!id) {
|
||||
return reply.status(400).send({ error: "id is required" });
|
||||
}
|
||||
const url = `https://amll-ttml-db.stevexmh.net/ncm/${id}`;
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (response.status !== 200) {
|
||||
return reply.send(null);
|
||||
}
|
||||
const data = await response.text();
|
||||
return reply.send(data);
|
||||
} catch (error) {
|
||||
serverLog.error("❌ TTML Lyric Fetch Error:", error);
|
||||
return reply.status(500).send(null);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
serverLog.info("🌐 Register NcmAPI successfully");
|
||||
};
|
||||
|
||||
@@ -65,19 +65,13 @@ export const songLyric = (id: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
// 获取格式TTML的歌词
|
||||
export const songLyricTTML = async (id: number) => {
|
||||
const url = `https://amll-ttml-db.stevexmh.net/ncm/${id}`;
|
||||
try {
|
||||
const response = await fetch(url);
|
||||
if (response === null || response.status !== 200) {
|
||||
return null;
|
||||
}
|
||||
const data = await response.text();
|
||||
return data;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 获取歌曲 TTML 歌词
|
||||
* @param id 音乐 id
|
||||
* @returns TTML 格式歌词
|
||||
*/
|
||||
export const songLyricTTML = (id: number) => {
|
||||
return request({ url: "/lyric/ttml", params: { id } });
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -230,7 +230,7 @@ class Player {
|
||||
console.log("🚫 Session expired after cleanup, aborting");
|
||||
return;
|
||||
}
|
||||
// 创建播放器(禁用内置 autoplay,统一走手动 play)
|
||||
// 创建播放器
|
||||
this.player = new Howl({
|
||||
src,
|
||||
format: allowPlayFormat,
|
||||
@@ -241,11 +241,11 @@ class Player {
|
||||
volume: statusStore.playVolume,
|
||||
rate: statusStore.playRate,
|
||||
});
|
||||
// 播放器事件(绑定当前会话)
|
||||
// 播放器事件
|
||||
this.playerEvent({ seek });
|
||||
// 播放设备
|
||||
if (!settingStore.showSpectrums) this.toggleOutputDevice();
|
||||
// 自动播放(仅一次性触发)
|
||||
// 自动播放
|
||||
if (autoPlay) await this.play();
|
||||
// 获取歌曲附加信息 - 非电台和本地
|
||||
if (type !== "radio" && !path) {
|
||||
@@ -1455,7 +1455,6 @@ class Player {
|
||||
clearInterval(this.autoCloseInterval);
|
||||
this.autoCloseInterval = undefined;
|
||||
}
|
||||
console.log("🧹 All timers cleaned up");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<div ref="desktopLyricsRef" class="desktop-lyrics">
|
||||
{{ lyricData.playName }}
|
||||
{{ lyricConfig }}
|
||||
456456
|
||||
<div class="header" align="center" justify="space-between">
|
||||
<n-flex :wrap="false" align="center" justify="flex-start" size="small">
|
||||
<div class="menu-btn" title="返回应用">
|
||||
|
||||
Reference in New Issue
Block a user