From dfcae064969883c1e614dd298e883b1788a5a850 Mon Sep 17 00:00:00 2001 From: memorydream <34763046+memorydream@users.noreply.github.com> Date: Sat, 25 Sep 2021 15:23:12 +0800 Subject: [PATCH 1/8] fix: empty Album artist page can't open (#839) --- src/views/artist.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/artist.vue b/src/views/artist.vue index 3e14740..0f0721d 100644 --- a/src/views/artist.vue +++ b/src/views/artist.vue @@ -42,7 +42,7 @@ -
+
{{ $t('artist.latestRelease') }}
From 8b089e6cf4d5612df358f78cbeac6bf73d1b8471 Mon Sep 17 00:00:00 2001 From: BakerBunker <17872844+BakerBunker@users.noreply.github.com> Date: Sat, 25 Sep 2021 02:27:45 -0500 Subject: [PATCH 2/8] feat: support separate album by disc (#861) Co-authored-by: BakerBunker --- src/views/album.vue | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/views/album.vue b/src/views/album.vue index 514f0d2..cebd8df 100644 --- a/src/views/album.vue +++ b/src/views/album.vue @@ -71,12 +71,25 @@
- +
+
+

Disc {{ cd }}

+ +
+
+
+ +
@@ -137,6 +150,7 @@ import locale from '@/locale'; import { splitSoundtrackAlbumTitle, splitAlbumTitle } from '@/utils/common'; import NProgress from 'nprogress'; import { isAccountLoggedIn } from '@/utils/auth'; +import { groupBy } from 'lodash'; import ExplicitSymbol from '@/components/ExplicitSymbol.vue'; import ButtonTwoTone from '@/components/ButtonTwoTone.vue'; @@ -204,6 +218,9 @@ export default { return [...realAlbums, ...restItems].slice(0, 5); } }, + tracksByDisc() { + return groupBy(this.tracks, 'cd'); + }, }, created() { this.loadData(this.$route.params.id); From 17ef0e927cc610064c004872e43e6a6e87fb985a Mon Sep 17 00:00:00 2001 From: memorydream <34763046+memorydream@users.noreply.github.com> Date: Sat, 25 Sep 2021 15:41:25 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20more=20operations=20for=20close=20|?= =?UTF-8?q?=20=E4=B8=BA=E5=85=B3=E9=97=ADapp=E6=93=8D=E4=BD=9C=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=9B=B4=E5=A4=9A=E9=80=89=E9=A1=B9=20(#918)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: more operations for close * remove minimizeToTray form initLocalStorage Co-authored-by: qier222 Co-authored-by: qier222 --- src/background.js | 7 ++-- src/electron/ipcMain.js | 63 ++++++++++++++++++++++------------- src/locale/lang/en.js | 8 ++++- src/locale/lang/tr.js | 8 ++++- src/locale/lang/zh-CN.js | 8 ++++- src/locale/lang/zh-TW.js | 7 ++++ src/store/initLocalStorage.js | 2 +- src/views/settings.vue | 31 +++++++++-------- 8 files changed, 91 insertions(+), 43 deletions(-) diff --git a/src/background.js b/src/background.js index 2bdaee7..e1fcfdd 100644 --- a/src/background.js +++ b/src/background.js @@ -201,14 +201,15 @@ class Background { this.window.on('close', e => { log('windows close event'); - if (this.willQuitApp) { + let closeOpt = this.store.get('settings.closeAppOption'); + if (this.willQuitApp && (closeOpt === 'exit' || closeOpt === 'ask')) { /* the user tried to quit the app */ this.window = null; app.quit(); } else { /* the user only tried to close the window */ e.preventDefault(); - this.window.hide(); + this.window.minimize(); } }); @@ -223,7 +224,7 @@ class Background { this.window.on('minimize', () => { if ( ['win32', 'linux'].includes(process.platform) && - this.store.get('settings.minimizeToTray') + this.store.get('settings.closeAppOption') === 'minimizeToTray' ) { this.window.hide(); } diff --git a/src/electron/ipcMain.js b/src/electron/ipcMain.js index 678b661..e641f67 100644 --- a/src/electron/ipcMain.js +++ b/src/electron/ipcMain.js @@ -39,30 +39,21 @@ export function initIpcMain(win, store) { ipcMain.on('close', e => { if (process.platform == 'darwin') { win.hide(); + exitAsk(e); + return; + } + + let closeOpt = store.get('settings.closeAppOption'); + if (closeOpt === 'exit') { + win = null; + //app.quit(); + app.exit(); //exit()直接关闭客户端,不会执行quit(); + } else if (closeOpt === 'minimize' || closeOpt === 'minimizeToTray') { + e.preventDefault(); //阻止默认行为 + win.minimize(); //调用 最小化实例方法 + } else { + exitAsk(e); } - e.preventDefault(); //阻止默认行为 - dialog - .showMessageBox({ - type: 'info', - title: 'Information', - cancelId: 2, - defaultId: 0, - message: '确定要关闭吗?', - buttons: ['最小化', '直接退出'], - }) - .then(result => { - if (result.response == 0) { - e.preventDefault(); //阻止默认行为 - win.minimize(); //调用 最小化实例方法 - } else if (result.response == 1) { - win = null; - //app.quit(); - app.exit(); //exit()直接关闭客户端,不会执行quit(); - } - }) - .catch(err => { - log(err); - }); }); ipcMain.on('minimize', () => { @@ -156,4 +147,30 @@ export function initIpcMain(win, store) { globalShortcut.unregisterAll(); registerGlobalShortcut(win, store); }); + + const exitAsk = e => { + e.preventDefault(); //阻止默认行为 + dialog + .showMessageBox({ + type: 'info', + title: 'Information', + cancelId: 2, + defaultId: 0, + message: '确定要关闭吗?', + buttons: ['最小化', '直接退出'], + }) + .then(result => { + if (result.response == 0) { + e.preventDefault(); //阻止默认行为 + win.minimize(); //调用 最小化实例方法 + } else if (result.response == 1) { + win = null; + //app.quit(); + app.exit(); //exit()直接关闭客户端,不会执行quit(); + } + }) + .catch(err => { + log(err); + }); + }; } diff --git a/src/locale/lang/en.js b/src/locale/lang/en.js index bd79b17..f7e55d2 100644 --- a/src/locale/lang/en.js +++ b/src/locale/lang/en.js @@ -151,7 +151,6 @@ export default { clearSongsCache: 'Clear Songs Cache', cacheCount: 'Cached {song} songs ({size})', showLyricsTranslation: 'Show lyrics translation', - minimizeToTray: 'Minimize to tray', showPlaylistsByAppleMusic: 'Show playlists by Apple Music', enableDiscordRichPresence: 'Enable Discord Rich Presence', enableGlobalShortcut: 'Enable Global Shortcut', @@ -162,6 +161,13 @@ export default { on: 'On', dynamic: 'Dynamic (High GPU usage)', }, + closeAppOption: { + text: 'Close App...', + ask: 'Ask', + exit: 'Exit', + minimize: 'Minimize', + minimizeToTray: 'Minimize to tray', + }, }, contextMenu: { play: 'Play', diff --git a/src/locale/lang/tr.js b/src/locale/lang/tr.js index 21179c2..a774b11 100644 --- a/src/locale/lang/tr.js +++ b/src/locale/lang/tr.js @@ -147,7 +147,6 @@ export default { clearSongsCache: 'Müzik çerezlerini temizle', cacheCount: 'Çerezlenen {song} Müzikler ({size})', showLyricsTranslation: 'Müzik sözlerinin çevirilerini göster', - minimizeToTray: 'Küçült', showPlaylistsByAppleMusic: "Apple Music'in Çalma Listelerini Göster", enableDiscordRichPresence: 'Discord gösterimini aktifleştir', showLibraryDefault: 'Kitaplık Varsayılanını göster', @@ -157,6 +156,13 @@ export default { on: 'açık', dynamic: 'dinamik(Yüksek GPU kullanımı)', }, + closeAppOption: { + text: 'Close App...', + ask: 'Ask', + exit: 'Exit', + minimize: 'Minimize', + minimizeToTray: 'Küçült', + }, }, contextMenu: { play: 'Oynat', diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js index 56cbc05..2dfaaac 100644 --- a/src/locale/lang/zh-CN.js +++ b/src/locale/lang/zh-CN.js @@ -152,7 +152,6 @@ export default { clearSongsCache: '清除歌曲缓存', cacheCount: '已缓存 {song} 首 ({size})', showLyricsTranslation: '显示歌词翻译', - minimizeToTray: '最小化到托盘', showPlaylistsByAppleMusic: '首页显示来自 Apple Music 的歌单', enableDiscordRichPresence: '启用 Discord Rich Presence', enableGlobalShortcut: '启用全局快捷键', @@ -163,6 +162,13 @@ export default { on: '打开', dynamic: '动态(GPU 占用较高)', }, + closeAppOption: { + text: '关闭主面板时...', + ask: '询问', + exit: '退出', + minimize: '最小化', + minimizeToTray: '最小化到托盘', + }, }, contextMenu: { play: '播放', diff --git a/src/locale/lang/zh-TW.js b/src/locale/lang/zh-TW.js index 92e4859..f506bf7 100644 --- a/src/locale/lang/zh-TW.js +++ b/src/locale/lang/zh-TW.js @@ -159,6 +159,13 @@ export default { on: '開啟', dynamic: '動態(GPU 占用較高)', }, + closeAppOption: { + text: '關閉主面板時...', + ask: '詢問', + exit: '退出', + minimize: '最小化', + minimizeToTray: '最小化到系統列', + }, }, contextMenu: { play: '播放', diff --git a/src/store/initLocalStorage.js b/src/store/initLocalStorage.js index b0a9cdc..b2a1dcf 100644 --- a/src/store/initLocalStorage.js +++ b/src/store/initLocalStorage.js @@ -22,7 +22,7 @@ let localStorage = { nyancatStyle: false, showLyricsTranslation: true, lyricsBackground: true, - minimizeToTray: false, + closeAppOption: 'ask', enableDiscordRichPresence: false, enableGlobalShortcut: true, showLibraryDefault: false, diff --git a/src/views/settings.vue b/src/views/settings.vue index bd76c56..04b6819 100644 --- a/src/views/settings.vue +++ b/src/views/settings.vue @@ -285,18 +285,23 @@

其他

-
{{ $t('settings.minimizeToTray') }}
+
{{ $t('settings.closeAppOption.text') }}
-
- - -
+
@@ -723,13 +728,13 @@ export default { }); }, }, - minimizeToTray: { + closeAppOption: { get() { - return this.settings.minimizeToTray; + return this.settings.closeAppOption; }, set(value) { this.$store.commit('updateSettings', { - key: 'minimizeToTray', + key: 'closeAppOption', value, }); }, From bb87b7f20d387703a4fe83675d0698687baaabb2 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 16:20:53 +0800 Subject: [PATCH 4/8] fix: bugs --- package.json | 2 +- src/api/lastfm.js | 7 ++++--- src/background.js | 31 ++++++++++++++++------------ src/components/Cover.vue | 1 + src/components/FMCard.vue | 1 + src/store/actions.js | 38 +++++++++++++++++++---------------- src/store/initLocalStorage.js | 6 +++--- src/utils/db.js | 1 + yarn.lock | 8 ++++---- 9 files changed, 54 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 5d071d0..2acb247 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "express-fileupload": "^1.2.0", "express-http-proxy": "^1.6.2", "extract-zip": "^2.0.1", - "howler": "^2.2.1", + "howler": "^2.2.3", "js-cookie": "^2.2.1", "lodash": "^4.17.20", "node-vibrant": "^3.1.6", diff --git a/src/api/lastfm.js b/src/api/lastfm.js index d41fe1b..41ad9c5 100644 --- a/src/api/lastfm.js +++ b/src/api/lastfm.js @@ -22,9 +22,10 @@ const sign = params => { }; export function auth() { - window.open( - `https://www.last.fm/api/auth/?api_key=${apiKey}&cb=${baseUrl}/#/lastfm/callback` - ); + const url = process.env.IS_ELECTRON + ? `https://www.last.fm/api/auth/?api_key=${apiKey}&cb=${baseUrl}/#/lastfm/callback` + : `https://www.last.fm/api/auth/?api_key=${apiKey}&cb=${baseUrl}/lastfm/callback`; + window.open(url); } export function authGetSession(token) { diff --git a/src/background.js b/src/background.js index e1fcfdd..c71d137 100644 --- a/src/background.js +++ b/src/background.js @@ -26,6 +26,11 @@ const log = text => { console.log(`${clc.blueBright('[background.js]')} ${text}`); }; +const isWindows = process.platform === 'win32'; +const isMac = process.platform === 'darwin'; +const isLinux = process.platform === 'linux'; +const isDevelopment = process.env.NODE_ENV === 'development'; + class Background { constructor() { this.window = null; @@ -38,7 +43,7 @@ class Background { }); this.neteaseMusicAPI = null; this.expressApp = null; - this.willQuitApp = process.platform === 'darwin' ? false : true; + this.willQuitApp = isMac ? false : true; this.init(); } @@ -73,7 +78,7 @@ class Background { } // Exit cleanly on request from parent process in development mode. - if (process.platform === 'win32') { + if (isWindows) { process.on('message', data => { if (data === 'graceful-exit') { app.quit(); @@ -119,7 +124,7 @@ class Background { minWidth: 1080, minHeight: 720, titleBarStyle: 'hiddenInset', - frame: process.platform !== 'win32', + frame: !isWindows, title: 'YesPlayMusic', show: false, webPreferences: { @@ -165,7 +170,7 @@ class Background { } checkForUpdates() { - if (process.env.NODE_ENV === 'development') return; + if (isDevelopment) return; log('checkForUpdates'); autoUpdater.checkForUpdatesAndNotify(); @@ -195,17 +200,20 @@ class Background { handleWindowEvents() { this.window.once('ready-to-show', () => { - log('windows ready-to-show event'); + log('window ready-to-show event'); this.window.show(); }); this.window.on('close', e => { - log('windows close event'); + log('window close event'); let closeOpt = this.store.get('settings.closeAppOption'); if (this.willQuitApp && (closeOpt === 'exit' || closeOpt === 'ask')) { /* the user tried to quit the app */ this.window = null; app.quit(); + } else if (!this.willQuitApp && isMac) { + e.preventDefault(); + this.window.hide(); } else { /* the user only tried to close the window */ e.preventDefault(); @@ -223,7 +231,7 @@ class Background { this.window.on('minimize', () => { if ( - ['win32', 'linux'].includes(process.platform) && + !isMac && this.store.get('settings.closeAppOption') === 'minimizeToTray' ) { this.window.hide(); @@ -263,7 +271,7 @@ class Background { log('app ready event'); // for development - if (process.env.NODE_ENV === 'development') { + if (isDevelopment) { this.initDevtools(); } @@ -292,10 +300,7 @@ class Background { createMenu(this.window, this.store); // create tray - if ( - ['win32', 'linux'].includes(process.platform) || - process.env.NODE_ENV === 'development' - ) { + if (isWindows || isLinux || isDevelopment) { this.tray = createTray(this.window); } @@ -323,7 +328,7 @@ class Background { }); app.on('window-all-closed', () => { - if (process.platform !== 'darwin') { + if (!isMac) { app.quit(); } }); diff --git a/src/components/Cover.vue b/src/components/Cover.vue index 4d79bc0..654d217 100644 --- a/src/components/Cover.vue +++ b/src/components/Cover.vue @@ -101,6 +101,7 @@ img { width: 100%; user-select: none; aspect-ratio: 1 / 1; + border: 1px solid rgba(0, 0, 0, 0.04); } .cover-hover { diff --git a/src/components/FMCard.vue b/src/components/FMCard.vue index 377bbe7..bb2c866 100644 --- a/src/components/FMCard.vue +++ b/src/components/FMCard.vue @@ -86,6 +86,7 @@ export default { this.getColor(); }, getColor() { + if (!this.player.personalFMTrack?.album?.picUrl) return; const cover = `${this.player.personalFMTrack.album.picUrl.replace( 'http://', 'https://' diff --git a/src/store/actions.js b/src/store/actions.js index 3053226..d29eb88 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -38,22 +38,26 @@ export default { } let like = true; if (state.liked.songs.includes(id)) like = false; - likeATrack({ id, like }).then(() => { - if (like === false) { - commit('updateLikedXXX', { - name: 'songs', - data: state.liked.songs.filter(d => d !== id), - }); - } else { - let newLikeSongs = state.liked.songs; - newLikeSongs.push(id); - commit('updateLikedXXX', { - name: 'songs', - data: newLikeSongs, - }); - } - dispatch('fetchLikedSongsWithDetails'); - }); + likeATrack({ id, like }) + .then(() => { + if (like === false) { + commit('updateLikedXXX', { + name: 'songs', + data: state.liked.songs.filter(d => d !== id), + }); + } else { + let newLikeSongs = state.liked.songs; + newLikeSongs.push(id); + commit('updateLikedXXX', { + name: 'songs', + data: newLikeSongs, + }); + } + dispatch('fetchLikedSongsWithDetails'); + }) + .catch(() => { + dispatch('showToast', '操作失败,专辑下架或版权锁定'); + }); }, fetchLikedSongs: ({ state, commit }) => { if (!isLooseLoggedIn()) return; @@ -140,7 +144,7 @@ export default { }, fetchLikedMVs: ({ commit }) => { if (!isAccountLoggedIn()) return; - return likedMVs({ limit: 2000 }).then(result => { + return likedMVs({ limit: 1000 }).then(result => { if (result.data) { commit('updateLikedXXX', { name: 'mvs', diff --git a/src/store/initLocalStorage.js b/src/store/initLocalStorage.js index b2a1dcf..59b50cd 100644 --- a/src/store/initLocalStorage.js +++ b/src/store/initLocalStorage.js @@ -17,14 +17,14 @@ let localStorage = { outputDevice: 'default', showPlaylistsByAppleMusic: true, enableUnblockNeteaseMusic: true, - automaticallyCacheSongs: false, - cacheLimit: false, + automaticallyCacheSongs: true, + cacheLimit: 8192, nyancatStyle: false, showLyricsTranslation: true, lyricsBackground: true, closeAppOption: 'ask', enableDiscordRichPresence: false, - enableGlobalShortcut: true, + enableGlobalShortcut: false, showLibraryDefault: false, enabledPlaylistCategories, proxyConfig: { diff --git a/src/utils/db.js b/src/utils/db.js index 411bbcb..6dfabeb 100644 --- a/src/utils/db.js +++ b/src/utils/db.js @@ -51,6 +51,7 @@ async function deleteExcessCache() { } export function cacheTrackSource(trackInfo, url, bitRate, from = 'netease') { + if (!process.env.IS_ELECTRON) return; const name = trackInfo.name; const artist = (trackInfo.ar && trackInfo.ar[0]?.name) || diff --git a/yarn.lock b/yarn.lock index 1156d07..257e6c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6355,10 +6355,10 @@ hosted-git-info@^4.0.1: dependencies: lru-cache "^6.0.0" -howler@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/howler/-/howler-2.2.1.tgz#a521a9b495841e8bb9aa12e651bebba0affc179e" - integrity sha512-0iIXvuBO/81CcrQ/HSSweYmbT50fT2mIc9XMFb+kxIfk2pW/iKzDbX1n3fZmDXMEIpYvyyfrB+gXwPYSDqUxIQ== +howler@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/howler/-/howler-2.2.3.tgz#a2eff9b08b586798e7a2ee17a602a90df28715da" + integrity sha512-QM0FFkw0LRX1PR8pNzJVAY25JhIWvbKMBFM4gqk+QdV+kPXOhleWGCB6AiAF/goGjIHK2e/nIElplvjQwhr0jg== hpack.js@^2.1.6: version "2.1.6" From 14f47f8cfc80e1de3ba4857c9aec3861346d3e59 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 19:10:37 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=E5=85=A8=E5=B1=80=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background.js | 2 +- src/electron/ipcMain.js | 2 ++ src/store/initLocalStorage.js | 2 +- src/views/settings.vue | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/background.js b/src/background.js index c71d137..b3c90cb 100644 --- a/src/background.js +++ b/src/background.js @@ -311,7 +311,7 @@ class Background { this.window.setTouchBar(createTouchBar(this.window)); // register global shortcuts - if (this.store.get('settings.enableGlobalShortcut')) { + if (this.store.get('settings.enableGlobalShortcut') !== false) { registerGlobalShortcut(this.window, this.store); } }); diff --git a/src/electron/ipcMain.js b/src/electron/ipcMain.js index e641f67..2a89a95 100644 --- a/src/electron/ipcMain.js +++ b/src/electron/ipcMain.js @@ -71,6 +71,7 @@ export function initIpcMain(win, store) { if (options.enableGlobalShortcut) { registerGlobalShortcut(win, store); } else { + log('unregister global shortcut'); globalShortcut.unregisterAll(); } }); @@ -120,6 +121,7 @@ export function initIpcMain(win, store) { }); ipcMain.on('switchGlobalShortcutStatusTemporary', (e, status) => { + log('switchGlobalShortcutStatusTemporary'); if (status === 'disable') { globalShortcut.unregisterAll(); } else { diff --git a/src/store/initLocalStorage.js b/src/store/initLocalStorage.js index 59b50cd..7e642a2 100644 --- a/src/store/initLocalStorage.js +++ b/src/store/initLocalStorage.js @@ -24,7 +24,7 @@ let localStorage = { lyricsBackground: true, closeAppOption: 'ask', enableDiscordRichPresence: false, - enableGlobalShortcut: false, + enableGlobalShortcut: true, showLibraryDefault: false, enabledPlaylistCategories, proxyConfig: { diff --git a/src/views/settings.vue b/src/views/settings.vue index 04b6819..eaf6a0b 100644 --- a/src/views/settings.vue +++ b/src/views/settings.vue @@ -978,6 +978,7 @@ export default { this.recordedShortcut = []; }, exitRecordShortcut() { + if (this.shortcutInput.recording === false) return; this.shortcutInput = { id: '', type: '', recording: false }; this.recordedShortcut = []; ipcRenderer.send('switchGlobalShortcutStatusTemporary', 'enable'); From dd65c67568d55ae08322abe93d9795d736d2faa8 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 19:12:34 +0800 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0build.yaml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a30ca4e..1c2d2fd 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,6 +1,12 @@ name: Build / Release -on: [push, pull_request] +on: + push: + branches: + - 'master' + pull_request: + branches: + - '!deploy' jobs: release: @@ -8,7 +14,7 @@ jobs: strategy: matrix: - os: [macos-latest, windows-latest, ubuntu-16.04] + os: [macos-latest, windows-latest, ubuntu-18.04] steps: - name: Check out Git repository From aa418cd0d7c91019100eaba3b99caa830d6c517b Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 23:53:50 +0800 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20=E4=BA=91=E7=9B=98=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netease_api/module/artist_fans.js | 15 ++++++++++++ netease_api/module/cloud_match.js | 20 ++++++++++++++++ netease_api/module/digitalAlbum_detail.js | 18 +++++++++++++++ netease_api/module/digitalAlbum_sales.js | 18 +++++++++++++++ netease_api/module/homepage_block_page.js | 2 +- netease_api/module/homepage_dragon_ball.js | 3 --- netease_api/module/listen_together_status.js | 15 ++++++++++++ netease_api/module/login_cellphone.js | 8 ++++--- netease_api/module/mlog_music_rcmd.js | 23 +++++++++++++++++++ netease_api/module/mlog_to_video.js | 18 +++++++++++++++ netease_api/module/mlog_url.js | 15 ++++++++++++ netease_api/module/musician_cloudbean.js | 11 +++++++++ .../module/musician_cloudbean_obtain.js | 19 +++++++++++++++ netease_api/module/musician_data_overview.js | 16 +++++++++++++ netease_api/module/musician_play_trend.js | 19 +++++++++++++++ netease_api/module/musician_sign.js | 16 +++++++++++++ netease_api/module/musician_tasks.js | 16 +++++++++++++ netease_api/module/personalized_newsong.js | 3 ++- netease_api/module/playlist_privacy.js | 20 ++++++++++++++++ netease_api/module/related_playlist.js | 3 ++- netease_api/module/simi_artist.js | 3 --- netease_api/module/song_detail.js | 2 +- netease_api/module/song_purchased.js | 19 +++++++++++++++ netease_api/module/song_url.js | 4 ---- netease_api/module/user_comment_history.js | 22 ++++++++++++++++++ netease_api/module/vip_growthpoint.js | 16 +++++++++++++ netease_api/module/vip_growthpoint_details.js | 19 +++++++++++++++ netease_api/module/vip_growthpoint_get.js | 18 +++++++++++++++ netease_api/module/vip_info.js | 15 ++++++++++++ netease_api/module/vip_tasks.js | 16 +++++++++++++ netease_api/module/yunbei_rcmd_song.js | 21 +++++++++++++++++ .../module/yunbei_rcmd_song_history.js | 21 +++++++++++++++++ netease_api/plugins/songUpload.js | 7 ++++-- src/api/user.js | 3 +++ 34 files changed, 445 insertions(+), 19 deletions(-) create mode 100644 netease_api/module/artist_fans.js create mode 100644 netease_api/module/cloud_match.js create mode 100644 netease_api/module/digitalAlbum_detail.js create mode 100644 netease_api/module/digitalAlbum_sales.js create mode 100644 netease_api/module/listen_together_status.js create mode 100644 netease_api/module/mlog_music_rcmd.js create mode 100644 netease_api/module/mlog_to_video.js create mode 100644 netease_api/module/mlog_url.js create mode 100644 netease_api/module/musician_cloudbean.js create mode 100644 netease_api/module/musician_cloudbean_obtain.js create mode 100644 netease_api/module/musician_data_overview.js create mode 100644 netease_api/module/musician_play_trend.js create mode 100644 netease_api/module/musician_sign.js create mode 100644 netease_api/module/musician_tasks.js create mode 100644 netease_api/module/playlist_privacy.js create mode 100644 netease_api/module/song_purchased.js create mode 100644 netease_api/module/user_comment_history.js create mode 100644 netease_api/module/vip_growthpoint.js create mode 100644 netease_api/module/vip_growthpoint_details.js create mode 100644 netease_api/module/vip_growthpoint_get.js create mode 100644 netease_api/module/vip_info.js create mode 100644 netease_api/module/vip_tasks.js create mode 100644 netease_api/module/yunbei_rcmd_song.js create mode 100644 netease_api/module/yunbei_rcmd_song_history.js diff --git a/netease_api/module/artist_fans.js b/netease_api/module/artist_fans.js new file mode 100644 index 0000000..700eac0 --- /dev/null +++ b/netease_api/module/artist_fans.js @@ -0,0 +1,15 @@ +// 歌手粉丝 + +module.exports = (query, request) => { + const data = { + id: query.id, + limit: query.limit || 20, + offset: query.offset || 0, + } + return request('POST', `https://music.163.com/weapi/artist/fans/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/netease_api/module/cloud_match.js b/netease_api/module/cloud_match.js new file mode 100644 index 0000000..d28d88b --- /dev/null +++ b/netease_api/module/cloud_match.js @@ -0,0 +1,20 @@ +module.exports = (query, request) => { + query.cookie.os = 'ios' + query.cookie.appver = '8.1.20' + const data = { + userId: query.uid, + songId: query.sid, + adjustSongId: query.asid, + } + return request( + 'POST', + `https://music.163.com/api/cloud/user/song/match`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/digitalAlbum_detail.js b/netease_api/module/digitalAlbum_detail.js new file mode 100644 index 0000000..a3ed02d --- /dev/null +++ b/netease_api/module/digitalAlbum_detail.js @@ -0,0 +1,18 @@ +// 数字专辑详情 + +module.exports = (query, request) => { + const data = { + id: query.id, + } + return request( + 'POST', + `https://music.163.com/weapi/vipmall/albumproduct/detail`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/digitalAlbum_sales.js b/netease_api/module/digitalAlbum_sales.js new file mode 100644 index 0000000..89da320 --- /dev/null +++ b/netease_api/module/digitalAlbum_sales.js @@ -0,0 +1,18 @@ +// 数字专辑销量 + +module.exports = (query, request) => { + const data = { + albumIds: query.ids, + } + return request( + 'POST', + `https://music.163.com/weapi/vipmall/albumproduct/album/query/sales`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/homepage_block_page.js b/netease_api/module/homepage_block_page.js index 618e534..af4b074 100644 --- a/netease_api/module/homepage_block_page.js +++ b/netease_api/module/homepage_block_page.js @@ -4,7 +4,7 @@ module.exports = (query, request) => { query.cookie.os = 'ios' query.cookie.appver = '8.1.20' - const data = { refresh: query.refresh || true } + const data = { refresh: query.refresh || false, cursor: query.cursor } return request( 'POST', `https://music.163.com/api/homepage/block/page`, diff --git a/netease_api/module/homepage_dragon_ball.js b/netease_api/module/homepage_dragon_ball.js index 76973aa..00231dd 100644 --- a/netease_api/module/homepage_dragon_ball.js +++ b/netease_api/module/homepage_dragon_ball.js @@ -4,9 +4,6 @@ // !需要登录或者匿名登录,非登录返回 [] const config = require('../util/config.json') module.exports = (query, request) => { - if (typeof query.cookie === 'string') { - query.cookie = cookieToJson(query.cookie) - } if (!('MUSIC_U' in query.cookie)) query.cookie.MUSIC_A = config.anonymous_token const data = {} diff --git a/netease_api/module/listen_together_status.js b/netease_api/module/listen_together_status.js new file mode 100644 index 0000000..61fd902 --- /dev/null +++ b/netease_api/module/listen_together_status.js @@ -0,0 +1,15 @@ +// 一起听状态 + +module.exports = (query, request) => { + return request( + 'POST', + `https://music.163.com/api/listen/together/status/get`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/login_cellphone.js b/netease_api/module/login_cellphone.js index 0d2e7ae..a66b592 100644 --- a/netease_api/module/login_cellphone.js +++ b/netease_api/module/login_cellphone.js @@ -7,9 +7,11 @@ module.exports = async (query, request) => { const data = { phone: query.phone, countrycode: query.countrycode || '86', - password: - query.md5_password || - crypto.createHash('md5').update(query.password).digest('hex'), + captcha: query.captcha, + [query.captcha ? 'captcha' : 'password']: query.captcha + ? query.captcha + : query.md5_password || + crypto.createHash('md5').update(query.password).digest('hex'), rememberLogin: 'true', } let result = await request( diff --git a/netease_api/module/mlog_music_rcmd.js b/netease_api/module/mlog_music_rcmd.js new file mode 100644 index 0000000..a4e00bb --- /dev/null +++ b/netease_api/module/mlog_music_rcmd.js @@ -0,0 +1,23 @@ +// 歌曲相关视频 + +module.exports = (query, request) => { + const data = { + id: query.mvid || 0, + type: 2, + rcmdType: 20, + limit: query.limit || 10, + extInfo: JSON.stringify({ songId: query.songid }), + } + return request( + 'POST', + `https://interface.music.163.com/eapi/mlog/rcmd/feed/list`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + url: '/api/mlog/rcmd/feed/list', + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/mlog_to_video.js b/netease_api/module/mlog_to_video.js new file mode 100644 index 0000000..54b279e --- /dev/null +++ b/netease_api/module/mlog_to_video.js @@ -0,0 +1,18 @@ +// 将mlog id转为video id + +module.exports = (query, request) => { + const data = { + mlogId: query.id, + } + return request( + 'POST', + `https://music.163.com/weapi/mlog/video/convert/id`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/mlog_url.js b/netease_api/module/mlog_url.js new file mode 100644 index 0000000..f7223e0 --- /dev/null +++ b/netease_api/module/mlog_url.js @@ -0,0 +1,15 @@ +// mlog链接 + +module.exports = (query, request) => { + const data = { + id: query.id, + resolution: query.res || 1080, + type: 1, + } + return request('POST', `https://music.163.com/weapi/mlog/detail/v1`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/netease_api/module/musician_cloudbean.js b/netease_api/module/musician_cloudbean.js new file mode 100644 index 0000000..e85a285 --- /dev/null +++ b/netease_api/module/musician_cloudbean.js @@ -0,0 +1,11 @@ +// 账号云豆数 + +module.exports = (query, request) => { + const data = {} + return request('POST', `https://music.163.com/weapi/cloudbean/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/netease_api/module/musician_cloudbean_obtain.js b/netease_api/module/musician_cloudbean_obtain.js new file mode 100644 index 0000000..2320278 --- /dev/null +++ b/netease_api/module/musician_cloudbean_obtain.js @@ -0,0 +1,19 @@ +// 领取云豆 + +module.exports = (query, request) => { + const data = { + userMissionId: query.id, + period: query.period, + } + return request( + 'POST', + `https://music.163.com/weapi/nmusician/workbench/mission/reward/obtain/new`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_data_overview.js b/netease_api/module/musician_data_overview.js new file mode 100644 index 0000000..b96d03e --- /dev/null +++ b/netease_api/module/musician_data_overview.js @@ -0,0 +1,16 @@ +// 音乐人数据概况 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/creator/musician/statistic/data/overview/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_play_trend.js b/netease_api/module/musician_play_trend.js new file mode 100644 index 0000000..d8f14fe --- /dev/null +++ b/netease_api/module/musician_play_trend.js @@ -0,0 +1,19 @@ +// 音乐人歌曲播放趋势 + +module.exports = (query, request) => { + const data = { + startTime: query.startTime, + endTime: query.endTime, + } + return request( + 'POST', + `https://music.163.com/weapi/creator/musician/play/count/statistic/data/trend/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_sign.js b/netease_api/module/musician_sign.js new file mode 100644 index 0000000..6d5717a --- /dev/null +++ b/netease_api/module/musician_sign.js @@ -0,0 +1,16 @@ +// 音乐人签到 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/creator/user/access`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_tasks.js b/netease_api/module/musician_tasks.js new file mode 100644 index 0000000..cb98c93 --- /dev/null +++ b/netease_api/module/musician_tasks.js @@ -0,0 +1,16 @@ +// 获取音乐人任务 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/nmusician/workbench/mission/cycle/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/personalized_newsong.js b/netease_api/module/personalized_newsong.js index 283b92a..2af12a3 100644 --- a/netease_api/module/personalized_newsong.js +++ b/netease_api/module/personalized_newsong.js @@ -1,6 +1,7 @@ // 推荐新歌 module.exports = (query, request) => { + query.cookie.os = 'pc' const data = { type: 'recommend', limit: query.limit || 10, @@ -8,7 +9,7 @@ module.exports = (query, request) => { } return request( 'POST', - `https://music.163.com/weapi/personalized/newsong`, + `https://music.163.com/api/personalized/newsong`, data, { crypto: 'weapi', diff --git a/netease_api/module/playlist_privacy.js b/netease_api/module/playlist_privacy.js new file mode 100644 index 0000000..ded2819 --- /dev/null +++ b/netease_api/module/playlist_privacy.js @@ -0,0 +1,20 @@ +// 公开隐私歌单 + +module.exports = (query, request) => { + const data = { + id: query.id, + privacy: 0, + } + return request( + 'POST', + `https://interface.music.163.com/eapi/playlist/update/privacy`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/playlist/update/privacy', + }, + ) +} diff --git a/netease_api/module/related_playlist.js b/netease_api/module/related_playlist.js index 6f64b3d..02e580f 100644 --- a/netease_api/module/related_playlist.js +++ b/netease_api/module/related_playlist.js @@ -13,7 +13,8 @@ module.exports = (query, request) => { }, ).then((response) => { try { - const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g + const pattern = + /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g let result, playlists = [] while ((result = pattern.exec(response.body)) != null) { diff --git a/netease_api/module/simi_artist.js b/netease_api/module/simi_artist.js index effef6b..36d2572 100644 --- a/netease_api/module/simi_artist.js +++ b/netease_api/module/simi_artist.js @@ -1,9 +1,6 @@ // 相似歌手 const config = require('../util/config.json') module.exports = (query, request) => { - if (typeof query.cookie === 'string') { - query.cookie = cookieToJson(query.cookie) - } if (!('MUSIC_U' in query.cookie)) query.cookie.MUSIC_A = config.anonymous_token const data = { diff --git a/netease_api/module/song_detail.js b/netease_api/module/song_detail.js index 172b34c..338fddc 100644 --- a/netease_api/module/song_detail.js +++ b/netease_api/module/song_detail.js @@ -5,7 +5,7 @@ module.exports = (query, request) => { const data = { c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']', } - return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, { + return request('POST', `https://music.163.com/api/v3/song/detail`, data, { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy, diff --git a/netease_api/module/song_purchased.js b/netease_api/module/song_purchased.js new file mode 100644 index 0000000..c86dfa1 --- /dev/null +++ b/netease_api/module/song_purchased.js @@ -0,0 +1,19 @@ +// 已购单曲 + +module.exports = (query, request) => { + const data = { + limit: query.limit || 20, + offset: query.offset || 0, + } + return request( + 'POST', + `https://music.163.com/weapi/single/mybought/song/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/song_url.js b/netease_api/module/song_url.js index 49b5ed7..46e6bf1 100644 --- a/netease_api/module/song_url.js +++ b/netease_api/module/song_url.js @@ -1,11 +1,7 @@ // 歌曲链接 const crypto = require('crypto') -const { cookieToJson } = require('../util/index') module.exports = (query, request) => { - if (typeof query.cookie === 'string') { - query.cookie = cookieToJson(query.cookie) - } if (!('MUSIC_U' in query.cookie)) query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex') query.cookie.os = 'pc' diff --git a/netease_api/module/user_comment_history.js b/netease_api/module/user_comment_history.js new file mode 100644 index 0000000..bb98221 --- /dev/null +++ b/netease_api/module/user_comment_history.js @@ -0,0 +1,22 @@ +module.exports = (query, request) => { + query.cookie.os = 'ios' + query.cookie.appver = '8.1.20' + const data = { + compose_reminder: 'true', + compose_hot_comment: 'true', + limit: query.limit || 10, + user_id: query.uid, + time: query.time || 0, + } + return request( + 'POST', + `https://music.163.com/api/comment/user/comment/history`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_growthpoint.js b/netease_api/module/vip_growthpoint.js new file mode 100644 index 0000000..e035c5a --- /dev/null +++ b/netease_api/module/vip_growthpoint.js @@ -0,0 +1,16 @@ +// 会员成长值 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_growthpoint_details.js b/netease_api/module/vip_growthpoint_details.js new file mode 100644 index 0000000..be9c927 --- /dev/null +++ b/netease_api/module/vip_growthpoint_details.js @@ -0,0 +1,19 @@ +// 会员成长值领取记录 + +module.exports = (query, request) => { + const data = { + limit: query.limit || 20, + offset: query.offset || 0, + } + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/growth/details`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_growthpoint_get.js b/netease_api/module/vip_growthpoint_get.js new file mode 100644 index 0000000..69ae94b --- /dev/null +++ b/netease_api/module/vip_growthpoint_get.js @@ -0,0 +1,18 @@ +// 领取会员成长值 + +module.exports = (query, request) => { + const data = { + taskIds: query.ids, + } + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_info.js b/netease_api/module/vip_info.js new file mode 100644 index 0000000..30cba78 --- /dev/null +++ b/netease_api/module/vip_info.js @@ -0,0 +1,15 @@ +// 获取 VIP 信息 + +module.exports = (query, request) => { + return request( + 'POST', + `https://music.163.com/weapi/music-vip-membership/front/vip/info`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_tasks.js b/netease_api/module/vip_tasks.js new file mode 100644 index 0000000..256e67a --- /dev/null +++ b/netease_api/module/vip_tasks.js @@ -0,0 +1,16 @@ +// 会员任务 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/task/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/yunbei_rcmd_song.js b/netease_api/module/yunbei_rcmd_song.js new file mode 100644 index 0000000..94ddeaa --- /dev/null +++ b/netease_api/module/yunbei_rcmd_song.js @@ -0,0 +1,21 @@ +// 云贝推歌 + +module.exports = (query, request) => { + const data = { + songId: query.id, + reason: query.reason || '好歌献给你', + scene: '', + fromUserId: -1, + } + return request( + 'POST', + `https://music.163.com/weapi/yunbei/rcmd/song/submit`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/yunbei_rcmd_song_history.js b/netease_api/module/yunbei_rcmd_song_history.js new file mode 100644 index 0000000..224a4f8 --- /dev/null +++ b/netease_api/module/yunbei_rcmd_song_history.js @@ -0,0 +1,21 @@ +// 云贝推歌历史记录 + +module.exports = (query, request) => { + const data = { + page: JSON.stringify({ + size: query.size || 20, + cursor: query.cursor || '', + }), + } + return request( + 'POST', + `https://music.163.com/weapi/yunbei/rcmd/song/history/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/plugins/songUpload.js b/netease_api/plugins/songUpload.js index c5c85f3..89d85fc 100644 --- a/netease_api/plugins/songUpload.js +++ b/netease_api/plugins/songUpload.js @@ -5,7 +5,7 @@ module.exports = async (query, request) => { 'POST', `https://music.163.com/weapi/nos/token/alloc`, { - bucket: '', + bucket: 'jd-musicrep-privatecloud-audio-public', ext: 'mp3', filename: query.songFile.name.replace('.mp3', ''), local: false, @@ -21,7 +21,7 @@ module.exports = async (query, request) => { try { await axios({ method: 'post', - url: `http://45.127.129.8/ymusic/${objectKey}?offset=0&complete=true&version=1.0`, + url: `http://45.127.129.8/jd-musicrep-privatecloud-audio-public/${objectKey}?offset=0&complete=true&version=1.0`, headers: { 'x-nos-token': tokenRes.body.result.token, 'Content-MD5': query.songFile.md5, @@ -29,9 +29,12 @@ module.exports = async (query, request) => { 'Content-Length': String(query.songFile.size), }, data: query.songFile.data, + maxContentLength: Infinity, + maxBodyLength: Infinity, }) } catch (error) { console.log('error', error.response) + throw error.response } return { ...tokenRes, diff --git a/src/api/user.js b/src/api/user.js index 5caa95a..8269297 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -150,6 +150,9 @@ export function uploadSong(file) { headers: { 'Content-Type': 'multipart/form-data', }, + timeout: 200000, + }).catch(error => { + alert(`上传失败,Error: ${error}`); }); } From 47784a4af3b0e4de220587ef1bbda3524b23f2d3 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 23:54:48 +0800 Subject: [PATCH 8/8] docs: update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2acb247..5edf246 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yesplaymusic", - "version": "0.4.0", + "version": "0.4.1", "private": true, "description": "A third party music player for Netease Music", "author": "hawtim",