diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 54da021..b99ad2a 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -353,6 +353,9 @@ interface SiteConfig { OIDCClientId?: string; OIDCClientSecret?: string; OIDCButtonText?: string; + TuneHubEnabled?: boolean; + TuneHubBaseUrl?: string; + TuneHubApiKey?: string; } // 视频源数据类型 @@ -6790,6 +6793,9 @@ const SiteConfigComponent = ({ OIDCClientId: '', OIDCClientSecret: '', OIDCButtonText: '', + TuneHubEnabled: false, + TuneHubBaseUrl: 'https://tunehub.sayqz.com/api', + TuneHubApiKey: '', }); // 豆瓣数据源相关状态 @@ -7666,6 +7672,93 @@ const SiteConfigComponent = ({ + {/* TuneHub 音乐配置 */} +
+

+ TuneHub 音乐配置 +

+ + {/* 开启 TuneHub */} +
+
+ + +
+

+ 开启后将在首页显示音乐视听入口,支持网易云、QQ音乐、酷我音乐 +

+
+ + {/* TuneHub Base URL */} +
+ + + setSiteSettings((prev) => ({ + ...prev, + TuneHubBaseUrl: e.target.value, + })) + } + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-green-500 focus:border-transparent' + /> +

+ TuneHub API 的基础地址,默认为 https://tunehub.sayqz.com/api。也可以通过环境变量 TUNEHUB_BASE_URL 配置 +

+
+ + {/* TuneHub API Key */} +
+ + + setSiteSettings((prev) => ({ + ...prev, + TuneHubApiKey: e.target.value, + })) + } + className='w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:ring-2 focus:ring-green-500 focus:border-transparent' + /> +

+ 用于解析歌曲播放链接的 API Key(消耗积分)。搜索、榜单、歌单等功能不需要 Key。也可以通过环境变量 TUNEHUB_API_KEY 配置 +

+
+
+ {/* 操作按钮 */}
+
+ + + +
+ 音乐 +
+
+ + + +
+ +
+ {currentView === 'songs' && ( + + )} +
+
+ + + +
+ setSearchKeyword(e.target.value)} + onKeyDown={handleSearchKeyDown} + className="w-full h-full bg-black/30 border border-white/10 rounded-lg pl-9 pr-4 text-sm text-white focus:outline-none focus:border-green-500 focus:ring-2 focus:ring-green-500/50 font-mono placeholder-zinc-500" + placeholder="搜索歌曲或艺术家..." + /> +
+
+ + + + {/* Main Content */} +
+
+ {loading && ( +
加载中...
+ )} + + {/* Playlists View */} + {currentView === 'playlists' && !loading && ( +
+
+

排行榜

+ + {getSourceLabel()} + +
+
+ {playlists.map((playlist) => ( +
loadPlaylist(playlist.id, playlist.name)} + className="cursor-pointer group" + > +
+ {playlist.pic && ( + {playlist.name} + )} +
+ + + +
+
+

{playlist.name}

+ {playlist.updateFrequency && ( +

{playlist.updateFrequency}

+ )} +
+ ))} +
+
+ )} + + {/* Songs View */} + {currentView === 'songs' && !loading && ( +
+
+

+ {currentPlaylistTitle} +

+ + {songs.length} 首歌曲 + +
+
+ {songs.map((song, index) => ( +
playSong(song, index)} + className={`grid grid-cols-[40px_1fr_auto] md:grid-cols-[50px_2fr_1fr_auto] gap-2 px-3 py-3 rounded-lg cursor-pointer transition-all ${ + currentSongIndex === index + ? 'bg-white/12 border-l-2 border-green-500' + : 'hover:bg-white/5' + }`} + > +
{index + 1}
+
+
{song.name}
+
{song.artist}
+
+
{song.artist}
+
{getSourceLabel()}
+
+ ))} +
+
+ )} +
+
+ + {/* Player */} + {showPlayer && currentSong && ( +
+
+ {/* Progress Bar */} +
+
+ +
+ +
+ {/* Song Info */} +
+
setShowLyrics(true)} + > + {currentSong.pic ? ( + {currentSong.name} { + // 图片加载失败时显示默认图标 + e.currentTarget.style.display = 'none'; + }} + /> + ) : ( + + + + )} +
+
+
{currentSong.name}
+
{currentSong.artist}
+
+
+ + {/* Controls */} +
+ + + +
+ + {/* Right Controls */} +
+
+ +
+ + + +
+
+
+
+ )} + + {/* Audio Element */} +