Skip to content

Commit 618c345

Browse files
committed
🔧 chore: 更新音乐源设置,移除 YouTube,添加 Kuwo,确保平台一致性
1 parent 44f9709 commit 618c345

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

src/main/set.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
"alwaysShowDownloadButton": false,
2424
"unlimitedDownload": false,
2525
"enableMusicUnblock": true,
26-
"enabledMusicSources": ["migu", "kugou", "pyncmd", "bilibili", "youtube"]
26+
"enabledMusicSources": ["migu", "kugou", "pyncmd", "bilibili", "kuwo"]
2727
}

src/main/unblockMusic.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import match from '@unblockneteasemusic/server';
22

3-
type Platform = 'qq' | 'migu' | 'kugou' | 'pyncmd' | 'joox' | 'kuwo' | 'bilibili' | 'youtube';
3+
type Platform = 'qq' | 'migu' | 'kugou' | 'pyncmd' | 'joox' | 'kuwo' | 'bilibili';
44

55
interface SongData {
66
name: string;
@@ -30,7 +30,7 @@ interface UnblockResult {
3030
}
3131

3232
// 所有可用平台
33-
export const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'kuwo', 'bilibili', 'youtube'];
33+
export const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'kuwo', 'bilibili'];
3434

3535
/**
3636
* 音乐解析函数
@@ -46,12 +46,16 @@ const unblockMusic = async (
4646
retryCount = 1,
4747
enabledPlatforms?: Platform[]
4848
): Promise<UnblockResult> => {
49-
const platforms = enabledPlatforms || ALL_PLATFORMS;
49+
// 过滤 enabledPlatforms,确保只包含 ALL_PLATFORMS 中存在的平台
50+
const filteredPlatforms = enabledPlatforms
51+
? enabledPlatforms.filter(platform => ALL_PLATFORMS.includes(platform))
52+
: ALL_PLATFORMS;
53+
5054
songData.album = songData.album || songData.al;
5155
songData.artists = songData.artists || songData.ar;
5256
const retry = async (attempt: number): Promise<UnblockResult> => {
5357
try {
54-
const data = await match(parseInt(String(id), 10), platforms,songData);
58+
const data = await match(parseInt(String(id), 10), filteredPlatforms, songData);
5559
const result: UnblockResult = {
5660
data: {
5761
data,

src/renderer/components/settings/MusicSourceSettings.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const props = defineProps({
5656
},
5757
sources: {
5858
type: Array as () => Platform[],
59-
default: () => ['migu', 'kugou', 'pyncmd', 'bilibili', 'youtube']
59+
default: () => ['migu', 'kugou', 'pyncmd', 'bilibili', 'kuwo']
6060
}
6161
});
6262
@@ -72,7 +72,6 @@ const musicSourceOptions = ref([
7272
{ label: 'pyncmd', value: 'pyncmd' },
7373
{ label: '酷我音乐', value: 'kuwo' },
7474
{ label: 'Bilibili音乐', value: 'bilibili' },
75-
{ label: 'YouTube', value: 'youtube' },
7675
{ label: 'GD音乐台', value: 'gdmusic' }
7776
]);
7877
@@ -103,7 +102,7 @@ watch(
103102
104103
const handleConfirm = () => {
105104
// 确保至少选择一个音源
106-
const defaultPlatforms = ['migu', 'kugou', 'pyncmd', 'bilibili', 'youtube'];
105+
const defaultPlatforms = ['migu', 'kugou', 'pyncmd', 'bilibili', 'kuwo'];
107106
const valuesToEmit = selectedSources.value.length > 0
108107
? [...new Set(selectedSources.value)]
109108
: defaultPlatforms;

src/renderer/types/music.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// 音乐平台类型
2-
export type Platform = 'qq' | 'migu' | 'kugou' | 'pyncmd' | 'joox' | 'kuwo' | 'bilibili' | 'youtube' | 'gdmusic';
2+
export type Platform = 'qq' | 'migu' | 'kugou' | 'pyncmd' | 'joox' | 'kuwo' | 'bilibili' | 'gdmusic';
33

44
// 默认平台列表
5-
export const DEFAULT_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'bilibili', 'youtube'];
5+
export const DEFAULT_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'bilibili', 'kuwo'];

src/renderer/views/set/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ import { type Platform } from '@/types/music';
486486
import config from '../../../../package.json';
487487
488488
// 所有平台默认值
489-
const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'bilibili', 'youtube'];
489+
const ALL_PLATFORMS: Platform[] = ['migu', 'kugou', 'pyncmd', 'bilibili', 'kuwo'];
490490
491491
const settingsStore = useSettingsStore();
492492
const userStore = useUserStore();

0 commit comments

Comments
 (0)