feat: 格式化代码

This commit is contained in:
alger
2025-09-14 00:19:41 +08:00
parent 74b9d73241
commit d8734f8302
39 changed files with 208 additions and 169 deletions
+4 -2
View File
@@ -45,7 +45,8 @@ export default {
phoneLoginFailed: 'Phone login failed, please check if phone number and password are correct', phoneLoginFailed: 'Phone login failed, please check if phone number and password are correct',
autoGetCookieSuccess: 'Auto get Cookie successful', autoGetCookieSuccess: 'Auto get Cookie successful',
autoGetCookieFailed: 'Auto get Cookie failed', autoGetCookieFailed: 'Auto get Cookie failed',
autoGetCookieTip: 'Will open NetEase Cloud Music login page, please complete login and close the window', autoGetCookieTip:
'Will open NetEase Cloud Music login page, please complete login and close the window',
qrCheckFailed: 'Failed to check QR code status, please refresh and try again', qrCheckFailed: 'Failed to check QR code status, please refresh and try again',
qrLoading: 'Loading QR code...', qrLoading: 'Loading QR code...',
qrExpired: 'QR code has expired, please click to refresh', qrExpired: 'QR code has expired, please click to refresh',
@@ -58,5 +59,6 @@ export default {
qrGenerating: 'Generating QR code...' qrGenerating: 'Generating QR code...'
}, },
qrTitle: 'NetEase Cloud Music QR Code Login', qrTitle: 'NetEase Cloud Music QR Code Login',
uidWarning: 'Note: UID login is only for viewing user public information and cannot access features that require login permissions.' uidWarning:
'Note: UID login is only for viewing user public information and cannot access features that require login permissions.'
}; };
+4 -3
View File
@@ -82,7 +82,8 @@ export default {
showStatusBarContent: showStatusBarContent:
'You can display the music control function in your mac status bar (effective after a restart)', 'You can display the music control function in your mac status bar (effective after a restart)',
fallbackParser: 'Fallback Parser (GD Music)', fallbackParser: 'Fallback Parser (GD Music)',
fallbackParserDesc: 'When "GD Music" is checked and regular sources fail, this service will be used.', fallbackParserDesc:
'When "GD Music" is checked and regular sources fail, this service will be used.',
parserGD: 'GD Music (Built-in)', parserGD: 'GD Music (Built-in)',
parserCustom: 'Custom API', parserCustom: 'Custom API',
@@ -103,8 +104,8 @@ export default {
notImported: 'No custom source imported yet.', notImported: 'No custom source imported yet.',
importSuccess: 'Successfully imported source: {name}', importSuccess: 'Successfully imported source: {name}',
importFailed: 'Import failed: {message}', importFailed: 'Import failed: {message}',
enableHint: 'Import a JSON config file to enable', enableHint: 'Import a JSON config file to enable'
}, }
}, },
application: { application: {
closeAction: 'Close Action', closeAction: 'Close Action',
+6 -3
View File
@@ -38,10 +38,12 @@ export default {
nowUpdate: '今すぐ更新', nowUpdate: '今すぐ更新',
downloadFailed: 'ダウンロードに失敗しました。再試行するか手動でダウンロードしてください', downloadFailed: 'ダウンロードに失敗しました。再試行するか手動でダウンロードしてください',
startFailed: 'ダウンロードの開始に失敗しました。再試行するか手動でダウンロードしてください', startFailed: 'ダウンロードの開始に失敗しました。再試行するか手動でダウンロードしてください',
noDownloadUrl: '現在のシステムに適したインストールパッケージが見つかりません。手動でダウンロードしてください', noDownloadUrl:
'現在のシステムに適したインストールパッケージが見つかりません。手動でダウンロードしてください',
installConfirmTitle: '更新をインストール', installConfirmTitle: '更新をインストール',
installConfirmContent: 'アプリを閉じて更新をインストールしますか?', installConfirmContent: 'アプリを閉じて更新をインストールしますか?',
manualInstallTip: 'アプリを閉じた後にインストーラーが正常に起動しない場合は、ダウンロードフォルダでファイルを見つけて手動で開いてください。', manualInstallTip:
'アプリを閉じた後にインストーラーが正常に起動しない場合は、ダウンロードフォルダでファイルを見つけて手動で開いてください。',
yesInstall: '今すぐインストール', yesInstall: '今すぐインストール',
noThanks: '後でインストール', noThanks: '後でインストール',
fileLocation: 'ファイルの場所', fileLocation: 'ファイルの場所',
@@ -172,7 +174,8 @@ export default {
noTasks: 'インポートタスクがありません', noTasks: 'インポートタスクがありません',
clearTasks: 'タスクをクリア', clearTasks: 'タスクをクリア',
clearTasksConfirmTitle: 'クリア確認', clearTasksConfirmTitle: 'クリア確認',
clearTasksConfirmContent: 'すべてのインポートタスク記録をクリアしますか?この操作は元に戻せません。', clearTasksConfirmContent:
'すべてのインポートタスク記録をクリアしますか?この操作は元に戻せません。',
confirm: '確認', confirm: '確認',
cancel: 'キャンセル', cancel: 'キャンセル',
clearTasksSuccess: 'タスクリストをクリアしました', clearTasksSuccess: 'タスクリストをクリアしました',
+2 -1
View File
@@ -1,5 +1,6 @@
export default { export default {
description: 'あなたの寄付は開発・保守作業をサポートするために使用され、サーバー保守、ドメイン更新などが含まれます。', description:
'あなたの寄付は開発・保守作業をサポートするために使用され、サーバー保守、ドメイン更新などが含まれます。',
message: 'メッセージを残す際は、メールアドレスやGitHubユーザー名を記載してください。', message: 'メッセージを残す際は、メールアドレスやGitHubユーザー名を記載してください。',
refresh: 'リストを更新', refresh: 'リストを更新',
toDonateList: 'コーヒーをおごる', toDonateList: 'コーヒーをおごる',
+2 -1
View File
@@ -36,7 +36,8 @@ export default {
}, },
clear: { clear: {
title: 'ダウンロード記録をクリア', title: 'ダウンロード記録をクリア',
message: 'すべてのダウンロード記録をクリアしますか?この操作はダウンロード済みの音楽ファイルを削除しませんが、すべての記録をクリアします。', message:
'すべてのダウンロード記録をクリアしますか?この操作はダウンロード済みの音楽ファイルを削除しませんが、すべての記録をクリアします。',
confirm: 'クリア確認', confirm: 'クリア確認',
cancel: 'キャンセル', cancel: 'キャンセル',
success: 'ダウンロード記録をクリアしました' success: 'ダウンロード記録をクリアしました'
+4 -2
View File
@@ -41,8 +41,10 @@ export default {
uidLoginFailed: 'UIDログインに失敗しました。ユーザーIDが正しいか確認してください', uidLoginFailed: 'UIDログインに失敗しました。ユーザーIDが正しいか確認してください',
autoGetCookieSuccess: 'Cookie自動取得成功', autoGetCookieSuccess: 'Cookie自動取得成功',
autoGetCookieFailed: 'Cookie自動取得失敗', autoGetCookieFailed: 'Cookie自動取得失敗',
autoGetCookieTip: 'NetEase Cloud Musicのログインページを開きます。ログイン完了後、ウィンドウを閉じてください' autoGetCookieTip:
'NetEase Cloud Musicのログインページを開きます。ログイン完了後、ウィンドウを閉じてください'
}, },
qrTitle: 'NetEase Cloud Music QRコードログイン', qrTitle: 'NetEase Cloud Music QRコードログイン',
uidWarning: '注意:UIDログインはユーザーの公開情報を表示するためのみ使用でき、ログイン権限が必要な機能にはアクセスできません。' uidWarning:
'注意:UIDログインはユーザーの公開情報を表示するためのみ使用でき、ログイン権限が必要な機能にはアクセスできません。'
}; };
+2 -1
View File
@@ -120,6 +120,7 @@ export default {
cleared: 'プレイリストをクリアしました', cleared: 'プレイリストをクリアしました',
empty: 'プレイリストが空です', empty: 'プレイリストが空です',
clearConfirmTitle: 'プレイリストをクリア', clearConfirmTitle: 'プレイリストをクリア',
clearConfirmContent: 'これによりプレイリスト内のすべての楽曲がクリアされ、現在の再生が停止されます。続行しますか?' clearConfirmContent:
'これによりプレイリスト内のすべての楽曲がクリアされ、現在の再生が停止されます。続行しますか?'
} }
}; };
+12 -7
View File
@@ -78,9 +78,11 @@ export default {
autoPlay: '自動再生', autoPlay: '自動再生',
autoPlayDesc: 'アプリを再起動した際に自動的に再生を継続するかどうか', autoPlayDesc: 'アプリを再起動した際に自動的に再生を継続するかどうか',
showStatusBar: 'ステータスバーコントロール機能を表示するかどうか', showStatusBar: 'ステータスバーコントロール機能を表示するかどうか',
showStatusBarContent: 'Macのステータスバーに音楽コントロール機能を表示できます(再起動後に有効)', showStatusBarContent:
'Macのステータスバーに音楽コントロール機能を表示できます(再起動後に有効)',
fallbackParser: '代替解析サービス (GD音楽台)', fallbackParser: '代替解析サービス (GD音楽台)',
fallbackParserDesc: '「GD音楽台」にチェックが入っていて、通常の音源で再生できない場合、このサービスが使用されます。', fallbackParserDesc:
'「GD音楽台」にチェックが入っていて、通常の音源で再生できない場合、このサービスが使用されます。',
parserGD: 'GD 音楽台 (内蔵)', parserGD: 'GD 音楽台 (内蔵)',
parserCustom: 'カスタム API', parserCustom: 'カスタム API',
sourceLabels: { sourceLabels: {
@@ -93,13 +95,14 @@ export default {
}, },
customApi: { customApi: {
sectionTitle: 'カスタム API 設定', sectionTitle: 'カスタム API 設定',
enableHint: 'カスタム API を有効にするには、まずカスタム API をインポートする必要があります。', enableHint:
'カスタム API を有効にするには、まずカスタム API をインポートする必要があります。',
importConfig: 'JSON設定をインポート', importConfig: 'JSON設定をインポート',
currentSource: '現在の音源', currentSource: '現在の音源',
notImported: 'カスタム音源はまだインポートされていません。', notImported: 'カスタム音源はまだインポートされていません。',
importSuccess: '音源のインポートに成功しました: {name}', importSuccess: '音源のインポートに成功しました: {name}',
importFailed: 'インポートに失敗しました: {message}', importFailed: 'インポートに失敗しました: {message}'
}, }
}, },
application: { application: {
closeAction: '閉じる動作', closeAction: '閉じる動作',
@@ -114,7 +117,8 @@ export default {
download: 'ダウンロード管理', download: 'ダウンロード管理',
downloadDesc: 'ダウンロードリストボタンを常に表示するかどうか', downloadDesc: 'ダウンロードリストボタンを常に表示するかどうか',
unlimitedDownload: '無制限ダウンロード', unlimitedDownload: '無制限ダウンロード',
unlimitedDownloadDesc: '有効にすると音楽を無制限でダウンロードします(ダウンロード失敗の可能性があります)。デフォルトは300曲制限', unlimitedDownloadDesc:
'有効にすると音楽を無制限でダウンロードします(ダウンロード失敗の可能性があります)。デフォルトは300曲制限',
downloadPath: 'ダウンロードディレクトリ', downloadPath: 'ダウンロードディレクトリ',
downloadPathDesc: '音楽ファイルのダウンロード場所を選択', downloadPathDesc: '音楽ファイルのダウンロード場所を選択',
remoteControl: 'リモートコントロール', remoteControl: 'リモートコントロール',
@@ -130,7 +134,8 @@ export default {
proxyPort: 'プロキシポート', proxyPort: 'プロキシポート',
proxyPortPlaceholder: 'プロキシポートを入力してください', proxyPortPlaceholder: 'プロキシポートを入力してください',
realIP: 'realIP設定', realIP: 'realIP設定',
realIPDesc: '制限により、このプロジェクトは海外での使用が制限されます。realIPパラメータを使用して国内IPを渡すことで解決できます', realIPDesc:
'制限により、このプロジェクトは海外での使用が制限されます。realIPパラメータを使用して国内IPを渡すことで解決できます',
messages: { messages: {
proxySuccess: 'プロキシ設定を保存しました。アプリ再起動後に有効になります', proxySuccess: 'プロキシ設定を保存しました。アプリ再起動後に有効になります',
proxyError: '入力が正しいかどうか確認してください', proxyError: '入力が正しいかどうか確認してください',
+4 -2
View File
@@ -41,7 +41,8 @@ export default {
noDownloadUrl: '현재 시스템에 적합한 설치 패키지를 찾을 수 없습니다. 수동으로 다운로드해주세요', noDownloadUrl: '현재 시스템에 적합한 설치 패키지를 찾을 수 없습니다. 수동으로 다운로드해주세요',
installConfirmTitle: '업데이트 설치', installConfirmTitle: '업데이트 설치',
installConfirmContent: '앱을 닫고 업데이트를 설치하시겠습니까?', installConfirmContent: '앱을 닫고 업데이트를 설치하시겠습니까?',
manualInstallTip: '앱을 닫은 후 설치 프로그램이 정상적으로 나타나지 않으면 다운로드 폴더에서 파일을 찾아 수동으로 열어주세요.', manualInstallTip:
'앱을 닫은 후 설치 프로그램이 정상적으로 나타나지 않으면 다운로드 폴더에서 파일을 찾아 수동으로 열어주세요.',
yesInstall: '지금 설치', yesInstall: '지금 설치',
noThanks: '나중에 설치', noThanks: '나중에 설치',
fileLocation: '파일 위치', fileLocation: '파일 위치',
@@ -172,7 +173,8 @@ export default {
noTasks: '가져오기 작업이 없습니다', noTasks: '가져오기 작업이 없습니다',
clearTasks: '작업 지우기', clearTasks: '작업 지우기',
clearTasksConfirmTitle: '지우기 확인', clearTasksConfirmTitle: '지우기 확인',
clearTasksConfirmContent: '모든 가져오기 작업 기록을 지우시겠습니까? 이 작업은 되돌릴 수 없습니다.', clearTasksConfirmContent:
'모든 가져오기 작업 기록을 지우시겠습니까? 이 작업은 되돌릴 수 없습니다.',
confirm: '확인', confirm: '확인',
cancel: '취소', cancel: '취소',
clearTasksSuccess: '작업 목록이 지워졌습니다', clearTasksSuccess: '작업 목록이 지워졌습니다',
+2 -1
View File
@@ -1,5 +1,6 @@
export default { export default {
description: '귀하의 기부는 서버 유지보수, 도메인 갱신 등을 포함한 개발 및 유지보수 작업을 지원하는 데 사용됩니다.', description:
'귀하의 기부는 서버 유지보수, 도메인 갱신 등을 포함한 개발 및 유지보수 작업을 지원하는 데 사용됩니다.',
message: '메시지를 남길 때 이메일이나 GitHub 이름을 남겨주세요.', message: '메시지를 남길 때 이메일이나 GitHub 이름을 남겨주세요.',
refresh: '목록 새로고침', refresh: '목록 새로고침',
toDonateList: '커피 한 잔 사주세요', toDonateList: '커피 한 잔 사주세요',
+2 -1
View File
@@ -36,7 +36,8 @@ export default {
}, },
clear: { clear: {
title: '다운로드 기록 지우기', title: '다운로드 기록 지우기',
message: '모든 다운로드 기록을 지우시겠습니까? 이 작업은 다운로드된 음악 파일을 삭제하지 않지만 모든 기록을 지웁니다.', message:
'모든 다운로드 기록을 지우시겠습니까? 이 작업은 다운로드된 음악 파일을 삭제하지 않지만 모든 기록을 지웁니다.',
confirm: '지우기 확인', confirm: '지우기 확인',
cancel: '취소', cancel: '취소',
success: '다운로드 기록이 지워졌습니다' success: '다운로드 기록이 지워졌습니다'
+4 -2
View File
@@ -41,8 +41,10 @@ export default {
uidLoginFailed: 'UID 로그인에 실패했습니다. 사용자 ID가 올바른지 확인하세요', uidLoginFailed: 'UID 로그인에 실패했습니다. 사용자 ID가 올바른지 확인하세요',
autoGetCookieSuccess: 'Cookie 자동 가져오기 성공', autoGetCookieSuccess: 'Cookie 자동 가져오기 성공',
autoGetCookieFailed: 'Cookie 자동 가져오기 실패', autoGetCookieFailed: 'Cookie 자동 가져오기 실패',
autoGetCookieTip: '넷이즈 클라우드 뮤직 로그인 페이지를 열겠습니다. 로그인 완료 후 창을 닫아주세요' autoGetCookieTip:
'넷이즈 클라우드 뮤직 로그인 페이지를 열겠습니다. 로그인 완료 후 창을 닫아주세요'
}, },
qrTitle: '넷이즈 클라우드 뮤직 QR코드 로그인', qrTitle: '넷이즈 클라우드 뮤직 QR코드 로그인',
uidWarning: '주의: UID 로그인은 사용자 공개 정보를 확인하는 데만 사용할 수 있으며, 로그인 권한이 필요한 기능에 액세스할 수 없습니다.' uidWarning:
'주의: UID 로그인은 사용자 공개 정보를 확인하는 데만 사용할 수 있으며, 로그인 권한이 필요한 기능에 액세스할 수 없습니다.'
}; };
+8 -5
View File
@@ -80,7 +80,8 @@ export default {
showStatusBar: '상태바 제어 기능 표시 여부', showStatusBar: '상태바 제어 기능 표시 여부',
showStatusBarContent: 'Mac 상태바에 음악 제어 기능을 표시할 수 있습니다 (재시작 후 적용)', showStatusBarContent: 'Mac 상태바에 음악 제어 기능을 표시할 수 있습니다 (재시작 후 적용)',
fallbackParser: '대체 분석 서비스 (GD Music)', fallbackParser: '대체 분석 서비스 (GD Music)',
fallbackParserDesc: '"GD Music"을 선택하고 일반 음원을 사용할 수 없을 때 이 서비스를 사용합니다.', fallbackParserDesc:
'"GD Music"을 선택하고 일반 음원을 사용할 수 없을 때 이 서비스를 사용합니다.',
parserGD: 'GD Music (내장)', parserGD: 'GD Music (내장)',
parserCustom: '사용자 지정 API', parserCustom: '사용자 지정 API',
@@ -101,8 +102,8 @@ export default {
notImported: '아직 사용자 지정 음원을 가져오지 않았습니다.', notImported: '아직 사용자 지정 음원을 가져오지 않았습니다.',
importSuccess: '음원 가져오기 성공: {name}', importSuccess: '음원 가져오기 성공: {name}',
importFailed: '가져오기 실패: {message}', importFailed: '가져오기 실패: {message}',
enableHint: '사용하려면 먼저 JSON 구성 파일을 가져오세요', enableHint: '사용하려면 먼저 JSON 구성 파일을 가져오세요'
}, }
}, },
application: { application: {
closeAction: '닫기 동작', closeAction: '닫기 동작',
@@ -117,7 +118,8 @@ export default {
download: '다운로드 관리', download: '다운로드 관리',
downloadDesc: '다운로드 목록 버튼을 항상 표시할지 여부', downloadDesc: '다운로드 목록 버튼을 항상 표시할지 여부',
unlimitedDownload: '무제한 다운로드', unlimitedDownload: '무제한 다운로드',
unlimitedDownloadDesc: '활성화하면 음악을 무제한으로 다운로드합니다 (다운로드 실패가 발생할 수 있음), 기본 제한 300곡', unlimitedDownloadDesc:
'활성화하면 음악을 무제한으로 다운로드합니다 (다운로드 실패가 발생할 수 있음), 기본 제한 300곡',
downloadPath: '다운로드 디렉토리', downloadPath: '다운로드 디렉토리',
downloadPathDesc: '음악 파일의 다운로드 위치 선택', downloadPathDesc: '음악 파일의 다운로드 위치 선택',
remoteControl: '원격 제어', remoteControl: '원격 제어',
@@ -133,7 +135,8 @@ export default {
proxyPort: '프록시 포트', proxyPort: '프록시 포트',
proxyPortPlaceholder: '프록시 포트를 입력하세요', proxyPortPlaceholder: '프록시 포트를 입력하세요',
realIP: 'realIP 설정', realIP: 'realIP 설정',
realIPDesc: '제한으로 인해 이 프로젝트는 해외에서 사용할 때 제한을 받을 수 있으며, realIP 매개변수를 사용하여 국내 IP를 전달하여 해결할 수 있습니다', realIPDesc:
'제한으로 인해 이 프로젝트는 해외에서 사용할 때 제한을 받을 수 있으며, realIP 매개변수를 사용하여 국내 IP를 전달하여 해결할 수 있습니다',
messages: { messages: {
proxySuccess: '프록시 설정이 저장되었습니다. 앱을 재시작한 후 적용됩니다', proxySuccess: '프록시 설정이 저장되었습니다. 앱을 재시작한 후 적용됩니다',
proxyError: '입력이 올바른지 확인하세요', proxyError: '입력이 올바른지 확인하세요',
+4 -3
View File
@@ -81,7 +81,8 @@ export default {
showStatusBarContent: '可以在您的mac状态栏显示音乐控制功能(重启后生效)', showStatusBarContent: '可以在您的mac状态栏显示音乐控制功能(重启后生效)',
fallbackParser: 'GD音乐台(music.gdstudio.xyz)设置', fallbackParser: 'GD音乐台(music.gdstudio.xyz)设置',
fallbackParserDesc: 'GD音乐台将自动尝试多个音乐平台进行解析,无需额外配置。优先级高于其他解析方式,但是请求可能较慢。感谢(music.gdstudio.xyz\n', fallbackParserDesc:
'GD音乐台将自动尝试多个音乐平台进行解析,无需额外配置。优先级高于其他解析方式,但是请求可能较慢。感谢(music.gdstudio.xyz\n',
parserGD: 'GD 音乐台 (内置)', parserGD: 'GD 音乐台 (内置)',
parserCustom: '自定义 API', parserCustom: '自定义 API',
@@ -103,8 +104,8 @@ export default {
notImported: '尚未导入自定义音源。', notImported: '尚未导入自定义音源。',
importSuccess: '成功导入音源: {name}', importSuccess: '成功导入音源: {name}',
importFailed: '导入失败: {message}', importFailed: '导入失败: {message}',
enableHint: '请先导入 JSON 配置文件才能启用', enableHint: '请先导入 JSON 配置文件才能启用'
}, }
}, },
application: { application: {
closeAction: '关闭行为', closeAction: '关闭行为',
+2 -2
View File
@@ -101,8 +101,8 @@ export default {
notImported: '尚未匯入自訂音源。', notImported: '尚未匯入自訂音源。',
importSuccess: '成功匯入音源:{name}', importSuccess: '成功匯入音源:{name}',
importFailed: '匯入失敗:{message}', importFailed: '匯入失敗:{message}',
enableHint: '請先匯入 JSON 設定檔才能啟用', enableHint: '請先匯入 JSON 設定檔才能啟用'
}, }
}, },
application: { application: {
closeAction: '關閉行為', closeAction: '關閉行為',
+2 -2
View File
@@ -2,6 +2,7 @@ import axios from 'axios';
import { app, dialog, ipcMain, Notification, protocol, shell } from 'electron'; import { app, dialog, ipcMain, Notification, protocol, shell } from 'electron';
import Store from 'electron-store'; import Store from 'electron-store';
import { fileTypeFromFile } from 'file-type'; import { fileTypeFromFile } from 'file-type';
import { FlacTagMap, writeFlacTags } from 'flac-tagger';
import * as fs from 'fs'; import * as fs from 'fs';
import * as http from 'http'; import * as http from 'http';
import * as https from 'https'; import * as https from 'https';
@@ -9,8 +10,8 @@ import * as mm from 'music-metadata';
import * as NodeID3 from 'node-id3'; import * as NodeID3 from 'node-id3';
import * as os from 'os'; import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import { FlacTagMap, writeFlacTags } from 'flac-tagger';
import sharp from 'sharp'; import sharp from 'sharp';
import { getStore } from './config'; import { getStore } from './config';
const MAX_CONCURRENT_DOWNLOADS = 3; const MAX_CONCURRENT_DOWNLOADS = 3;
@@ -633,7 +634,6 @@ async function downloadMusic(
const compressedSizeMB = (coverImageBuffer.length / (1024 * 1024)).toFixed(2); const compressedSizeMB = (coverImageBuffer.length / (1024 * 1024)).toFixed(2);
console.log(`封面图压缩完成,新大小: ${compressedSizeMB} MB`); console.log(`封面图压缩完成,新大小: ${compressedSizeMB} MB`);
} catch (compressionError) { } catch (compressionError) {
console.error('封面图压缩失败,将使用原图:', compressionError); console.error('封面图压缩失败,将使用原图:', compressionError);
coverImageBuffer = originalCoverBuffer; // 如果压缩失败,则回退使用原始图片 coverImageBuffer = originalCoverBuffer; // 如果压缩失败,则回退使用原始图片
+1 -1
View File
@@ -57,7 +57,7 @@ const api = {
return Promise.reject(new Error(`未授权的 IPC 通道: ${channel}`)); return Promise.reject(new Error(`未授权的 IPC 通道: ${channel}`));
}, },
// 搜索建议 // 搜索建议
getSearchSuggestions: (keyword: string) => ipcRenderer.invoke('get-search-suggestions', keyword), getSearchSuggestions: (keyword: string) => ipcRenderer.invoke('get-search-suggestions', keyword)
}; };
// 创建带类型的ipcRenderer对象,暴露给渲染进程 // 创建带类型的ipcRenderer对象,暴露给渲染进程
+5 -5
View File
@@ -7,7 +7,7 @@ import type { SongResult } from '@/types/music';
import { getImgUrl } from '@/utils'; import { getImgUrl } from '@/utils';
import { getImageBackground } from '@/utils/linearColor'; import { getImageBackground } from '@/utils/linearColor';
import { dislikeRecommendedSong } from "../api/music"; import { dislikeRecommendedSong } from '../api/music';
import { useArtist } from './useArtist'; import { useArtist } from './useArtist';
import { useDownload } from './useDownload'; import { useDownload } from './useDownload';
@@ -89,7 +89,7 @@ export function useSongItem(props: { item: SongResult; canRemove?: boolean }) {
// 判断当前歌曲是否为每日推荐歌曲 // 判断当前歌曲是否为每日推荐歌曲
const isDailyRecommendSong = computed(() => { const isDailyRecommendSong = computed(() => {
return recommendStore.dailyRecommendSongs.some(song => song.id === props.item.id); return recommendStore.dailyRecommendSongs.some((song) => song.id === props.item.id);
}); });
// 切换不喜欢状态 // 切换不喜欢状态
@@ -112,7 +112,7 @@ export function useSongItem(props: { item: SongResult; canRemove?: boolean }) {
const numericId = typeof props.item.id === 'string' ? parseInt(props.item.id) : props.item.id; const numericId = typeof props.item.id === 'string' ? parseInt(props.item.id) : props.item.id;
const response = await dislikeRecommendedSong(numericId); const response = await dislikeRecommendedSong(numericId);
if (response.data.data) { if (response.data.data) {
console.log(response) console.log(response);
const newSongData = response.data.data; const newSongData = response.data.data;
const newSong: SongResult = { const newSong: SongResult = {
...newSongData, ...newSongData,
@@ -126,10 +126,10 @@ export function useSongItem(props: { item: SongResult; canRemove?: boolean }) {
id: newSongData.id, id: newSongData.id,
name: newSongData.name, name: newSongData.name,
artists: newSongData.ar || newSongData.artists, artists: newSongData.ar || newSongData.artists,
album: newSongData.al || newSongData.album, album: newSongData.al || newSongData.album
}, },
source: 'netease', source: 'netease',
count: 0, count: 0
}; };
recommendStore.replaceSongInDailyRecommend(props.item.id, newSong); recommendStore.replaceSongInDailyRecommend(props.item.id, newSong);
} else { } else {
+6 -6
View File
@@ -38,18 +38,18 @@
<script> <script>
var _hmt = _hmt || []; var _hmt = _hmt || [];
(function () { (function () {
var hm = document.createElement("script"); var hm = document.createElement('script');
hm.src = "https://hm.baidu.com/hm.js?75a7ee3d3875dfdd2fe9d134883ddcbd"; hm.src = 'https://hm.baidu.com/hm.js?75a7ee3d3875dfdd2fe9d134883ddcbd';
var s = document.getElementsByTagName("script")[0]; var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s); s.parentNode.insertBefore(hm, s);
})(); })();
</script> </script>
<script> <script>
var _hmt = _hmt || []; var _hmt = _hmt || [];
(function () { (function () {
var hm = document.createElement("script"); var hm = document.createElement('script');
hm.src = "https://hm.baidu.com/hm.js?27b3850e627d266b20b38cce19af18f7"; hm.src = 'https://hm.baidu.com/hm.js?27b3850e627d266b20b38cce19af18f7';
var s = document.getElementsByTagName("script")[0]; var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(hm, s); s.parentNode.insertBefore(hm, s);
})(); })();
</script> </script>
+6 -2
View File
@@ -9,7 +9,11 @@
</div> </div>
<div class="app-menu-list"> <div class="app-menu-list">
<div v-for="(item, index) in menus" :key="item.path" class="app-menu-item"> <div v-for="(item, index) in menus" :key="item.path" class="app-menu-item">
<n-tooltip :delay="200" :disabled="settingsStore.setData.isMenuExpanded || isMobile" placement="bottom"> <n-tooltip
:delay="200"
:disabled="settingsStore.setData.isMenuExpanded || isMobile"
placement="bottom"
>
<template #trigger> <template #trigger>
<router-link class="app-menu-item-link" :to="item.path"> <router-link class="app-menu-item-link" :to="item.path">
<i <i
@@ -39,8 +43,8 @@ import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import icon from '@/assets/icon.png'; import icon from '@/assets/icon.png';
import { isMobile } from '@/utils';
import { useSettingsStore } from '@/store'; import { useSettingsStore } from '@/store';
import { isMobile } from '@/utils';
const props = defineProps({ const props = defineProps({
size: { size: {
+19 -10
View File
@@ -108,7 +108,6 @@ export const getSongUrl = async (
return songData.playMusicUrl || ''; return songData.playMusicUrl || '';
} }
// ==================== 自定义API最优先 ==================== // ==================== 自定义API最优先 ====================
// 检查用户是否在全局设置中启用了 'custom' 音源 // 检查用户是否在全局设置中启用了 'custom' 音源
const globalSources = settingsStore.setData.enabledMusicSources || []; const globalSources = settingsStore.setData.enabledMusicSources || [];
@@ -133,9 +132,18 @@ export const getSongUrl = async (
try { try {
// 直接从 api 目录导入 parseFromCustomApi 函数 // 直接从 api 目录导入 parseFromCustomApi 函数
const { parseFromCustomApi } = await import('@/api/parseFromCustomApi'); const { parseFromCustomApi } = await import('@/api/parseFromCustomApi');
const customResult = await parseFromCustomApi(numericId, cloneDeep(songData), settingsStore.setData.musicQuality || 'higher'); const customResult = await parseFromCustomApi(
numericId,
cloneDeep(songData),
settingsStore.setData.musicQuality || 'higher'
);
if (customResult && customResult.data && customResult.data.data && customResult.data.data.url) { if (
customResult &&
customResult.data &&
customResult.data.data &&
customResult.data.data.url
) {
console.log('自定义API解析成功!'); console.log('自定义API解析成功!');
if (isDownloaded) return customResult.data.data as any; if (isDownloaded) return customResult.data.data as any;
return customResult.data.data.url; return customResult.data.data.url;
@@ -190,7 +198,6 @@ export const getSongUrl = async (
const res = await getParsingMusicUrl(numericId, cloneDeep(songData)); const res = await getParsingMusicUrl(numericId, cloneDeep(songData));
if (isDownloaded) return res?.data?.data as any; if (isDownloaded) return res?.data?.data as any;
return res?.data?.data?.url || null; return res?.data?.data?.url || null;
} catch (error) { } catch (error) {
console.error('官方API请求失败,进入内置备用解析流程:', error); console.error('官方API请求失败,进入内置备用解析流程:', error);
const res = await getParsingMusicUrl(numericId, cloneDeep(songData)); const res = await getParsingMusicUrl(numericId, cloneDeep(songData));
@@ -471,7 +478,7 @@ export const usePlayerStore = defineStore('player', () => {
// 如果指定了当前歌曲,先把它放在第一位 // 如果指定了当前歌曲,先把它放在第一位
if (currentSong && currentSong.id) { if (currentSong && currentSong.id) {
const currentSongIndex = remainingSongs.findIndex(song => song.id === currentSong.id); const currentSongIndex = remainingSongs.findIndex((song) => song.id === currentSong.id);
if (currentSongIndex !== -1) { if (currentSongIndex !== -1) {
// 把当前歌曲放在第一位 // 把当前歌曲放在第一位
result.push(remainingSongs.splice(currentSongIndex, 1)[0]); result.push(remainingSongs.splice(currentSongIndex, 1)[0]);
@@ -518,7 +525,7 @@ export const usePlayerStore = defineStore('player', () => {
if (originalPlayList.value.length === 0) return; if (originalPlayList.value.length === 0) return;
const currentSong = playMusic.value; const currentSong = playMusic.value;
const originalIndex = originalPlayList.value.findIndex(song => song.id === currentSong.id); const originalIndex = originalPlayList.value.findIndex((song) => song.id === currentSong.id);
playList.value = [...originalPlayList.value]; playList.value = [...originalPlayList.value];
playListIndex.value = Math.max(0, originalIndex); playListIndex.value = Math.max(0, originalIndex);
@@ -557,9 +564,11 @@ export const usePlayerStore = defineStore('player', () => {
fetchSongs(playList.value, nextIndex, endIndex); fetchSongs(playList.value, nextIndex, endIndex);
// 如果是循环模式且接近列表末尾,也预加载列表开头的歌曲 // 如果是循环模式且接近列表末尾,也预加载列表开头的歌曲
if ((playMode.value === 1 || playMode.value === 2) && if (
(playMode.value === 1 || playMode.value === 2) &&
nextIndex + 1 >= playList.value.length && nextIndex + 1 >= playList.value.length &&
playList.value.length > 2) { playList.value.length > 2
) {
// 预加载列表开头的第一首 // 预加载列表开头的第一首
setTimeout(() => { setTimeout(() => {
fetchSongs(playList.value, 0, 1); fetchSongs(playList.value, 0, 1);
@@ -888,8 +897,8 @@ export const usePlayerStore = defineStore('player', () => {
// 计算新的播放索引 // 计算新的播放索引
if (currentSong && currentSong.id) { if (currentSong && currentSong.id) {
const currentSongIndex = shuffledList.findIndex(song => song.id === currentSong.id); const currentSongIndex = shuffledList.findIndex((song) => song.id === currentSong.id);
playListIndex.value = currentSongIndex !== -1 ? 0 : (keepIndex ? playListIndex.value : 0); playListIndex.value = currentSongIndex !== -1 ? 0 : keepIndex ? playListIndex.value : 0;
} else { } else {
playListIndex.value = keepIndex ? playListIndex.value : 0; playListIndex.value = keepIndex ? playListIndex.value : 0;
} }
+1 -1
View File
@@ -220,6 +220,6 @@ export const useSettingsStore = defineStore('settings', () => {
initializeSettings, initializeSettings,
initializeTheme, initializeTheme,
initializeSystemFonts, initializeSystemFonts,
setCustomApiPlugin, setCustomApiPlugin
}; };
}); });