mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-02-16 23:22:57 +08:00
fix: bugs
This commit is contained in:
parent
17ef0e927c
commit
bb87b7f20d
|
@ -52,7 +52,7 @@
|
||||||
"express-fileupload": "^1.2.0",
|
"express-fileupload": "^1.2.0",
|
||||||
"express-http-proxy": "^1.6.2",
|
"express-http-proxy": "^1.6.2",
|
||||||
"extract-zip": "^2.0.1",
|
"extract-zip": "^2.0.1",
|
||||||
"howler": "^2.2.1",
|
"howler": "^2.2.3",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"node-vibrant": "^3.1.6",
|
"node-vibrant": "^3.1.6",
|
||||||
|
|
|
@ -22,9 +22,10 @@ const sign = params => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export function auth() {
|
export function auth() {
|
||||||
window.open(
|
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`
|
||||||
);
|
: `https://www.last.fm/api/auth/?api_key=${apiKey}&cb=${baseUrl}/lastfm/callback`;
|
||||||
|
window.open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function authGetSession(token) {
|
export function authGetSession(token) {
|
||||||
|
|
|
@ -26,6 +26,11 @@ const log = text => {
|
||||||
console.log(`${clc.blueBright('[background.js]')} ${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 {
|
class Background {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.window = null;
|
this.window = null;
|
||||||
|
@ -38,7 +43,7 @@ class Background {
|
||||||
});
|
});
|
||||||
this.neteaseMusicAPI = null;
|
this.neteaseMusicAPI = null;
|
||||||
this.expressApp = null;
|
this.expressApp = null;
|
||||||
this.willQuitApp = process.platform === 'darwin' ? false : true;
|
this.willQuitApp = isMac ? false : true;
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
@ -73,7 +78,7 @@ class Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit cleanly on request from parent process in development mode.
|
// Exit cleanly on request from parent process in development mode.
|
||||||
if (process.platform === 'win32') {
|
if (isWindows) {
|
||||||
process.on('message', data => {
|
process.on('message', data => {
|
||||||
if (data === 'graceful-exit') {
|
if (data === 'graceful-exit') {
|
||||||
app.quit();
|
app.quit();
|
||||||
|
@ -119,7 +124,7 @@ class Background {
|
||||||
minWidth: 1080,
|
minWidth: 1080,
|
||||||
minHeight: 720,
|
minHeight: 720,
|
||||||
titleBarStyle: 'hiddenInset',
|
titleBarStyle: 'hiddenInset',
|
||||||
frame: process.platform !== 'win32',
|
frame: !isWindows,
|
||||||
title: 'YesPlayMusic',
|
title: 'YesPlayMusic',
|
||||||
show: false,
|
show: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
@ -165,7 +170,7 @@ class Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdates() {
|
checkForUpdates() {
|
||||||
if (process.env.NODE_ENV === 'development') return;
|
if (isDevelopment) return;
|
||||||
log('checkForUpdates');
|
log('checkForUpdates');
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|
||||||
|
@ -195,17 +200,20 @@ class Background {
|
||||||
|
|
||||||
handleWindowEvents() {
|
handleWindowEvents() {
|
||||||
this.window.once('ready-to-show', () => {
|
this.window.once('ready-to-show', () => {
|
||||||
log('windows ready-to-show event');
|
log('window ready-to-show event');
|
||||||
this.window.show();
|
this.window.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.window.on('close', e => {
|
this.window.on('close', e => {
|
||||||
log('windows close event');
|
log('window close event');
|
||||||
let closeOpt = this.store.get('settings.closeAppOption');
|
let closeOpt = this.store.get('settings.closeAppOption');
|
||||||
if (this.willQuitApp && (closeOpt === 'exit' || closeOpt === 'ask')) {
|
if (this.willQuitApp && (closeOpt === 'exit' || closeOpt === 'ask')) {
|
||||||
/* the user tried to quit the app */
|
/* the user tried to quit the app */
|
||||||
this.window = null;
|
this.window = null;
|
||||||
app.quit();
|
app.quit();
|
||||||
|
} else if (!this.willQuitApp && isMac) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.window.hide();
|
||||||
} else {
|
} else {
|
||||||
/* the user only tried to close the window */
|
/* the user only tried to close the window */
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -223,7 +231,7 @@ class Background {
|
||||||
|
|
||||||
this.window.on('minimize', () => {
|
this.window.on('minimize', () => {
|
||||||
if (
|
if (
|
||||||
['win32', 'linux'].includes(process.platform) &&
|
!isMac &&
|
||||||
this.store.get('settings.closeAppOption') === 'minimizeToTray'
|
this.store.get('settings.closeAppOption') === 'minimizeToTray'
|
||||||
) {
|
) {
|
||||||
this.window.hide();
|
this.window.hide();
|
||||||
|
@ -263,7 +271,7 @@ class Background {
|
||||||
log('app ready event');
|
log('app ready event');
|
||||||
|
|
||||||
// for development
|
// for development
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (isDevelopment) {
|
||||||
this.initDevtools();
|
this.initDevtools();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,10 +300,7 @@ class Background {
|
||||||
createMenu(this.window, this.store);
|
createMenu(this.window, this.store);
|
||||||
|
|
||||||
// create tray
|
// create tray
|
||||||
if (
|
if (isWindows || isLinux || isDevelopment) {
|
||||||
['win32', 'linux'].includes(process.platform) ||
|
|
||||||
process.env.NODE_ENV === 'development'
|
|
||||||
) {
|
|
||||||
this.tray = createTray(this.window);
|
this.tray = createTray(this.window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +328,7 @@ class Background {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
if (process.platform !== 'darwin') {
|
if (!isMac) {
|
||||||
app.quit();
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,6 +101,7 @@ img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
aspect-ratio: 1 / 1;
|
aspect-ratio: 1 / 1;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.cover-hover {
|
.cover-hover {
|
||||||
|
|
|
@ -86,6 +86,7 @@ export default {
|
||||||
this.getColor();
|
this.getColor();
|
||||||
},
|
},
|
||||||
getColor() {
|
getColor() {
|
||||||
|
if (!this.player.personalFMTrack?.album?.picUrl) return;
|
||||||
const cover = `${this.player.personalFMTrack.album.picUrl.replace(
|
const cover = `${this.player.personalFMTrack.album.picUrl.replace(
|
||||||
'http://',
|
'http://',
|
||||||
'https://'
|
'https://'
|
||||||
|
|
|
@ -38,22 +38,26 @@ export default {
|
||||||
}
|
}
|
||||||
let like = true;
|
let like = true;
|
||||||
if (state.liked.songs.includes(id)) like = false;
|
if (state.liked.songs.includes(id)) like = false;
|
||||||
likeATrack({ id, like }).then(() => {
|
likeATrack({ id, like })
|
||||||
if (like === false) {
|
.then(() => {
|
||||||
commit('updateLikedXXX', {
|
if (like === false) {
|
||||||
name: 'songs',
|
commit('updateLikedXXX', {
|
||||||
data: state.liked.songs.filter(d => d !== id),
|
name: 'songs',
|
||||||
});
|
data: state.liked.songs.filter(d => d !== id),
|
||||||
} else {
|
});
|
||||||
let newLikeSongs = state.liked.songs;
|
} else {
|
||||||
newLikeSongs.push(id);
|
let newLikeSongs = state.liked.songs;
|
||||||
commit('updateLikedXXX', {
|
newLikeSongs.push(id);
|
||||||
name: 'songs',
|
commit('updateLikedXXX', {
|
||||||
data: newLikeSongs,
|
name: 'songs',
|
||||||
});
|
data: newLikeSongs,
|
||||||
}
|
});
|
||||||
dispatch('fetchLikedSongsWithDetails');
|
}
|
||||||
});
|
dispatch('fetchLikedSongsWithDetails');
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
dispatch('showToast', '操作失败,专辑下架或版权锁定');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
fetchLikedSongs: ({ state, commit }) => {
|
fetchLikedSongs: ({ state, commit }) => {
|
||||||
if (!isLooseLoggedIn()) return;
|
if (!isLooseLoggedIn()) return;
|
||||||
|
@ -140,7 +144,7 @@ export default {
|
||||||
},
|
},
|
||||||
fetchLikedMVs: ({ commit }) => {
|
fetchLikedMVs: ({ commit }) => {
|
||||||
if (!isAccountLoggedIn()) return;
|
if (!isAccountLoggedIn()) return;
|
||||||
return likedMVs({ limit: 2000 }).then(result => {
|
return likedMVs({ limit: 1000 }).then(result => {
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
commit('updateLikedXXX', {
|
commit('updateLikedXXX', {
|
||||||
name: 'mvs',
|
name: 'mvs',
|
||||||
|
|
|
@ -17,14 +17,14 @@ let localStorage = {
|
||||||
outputDevice: 'default',
|
outputDevice: 'default',
|
||||||
showPlaylistsByAppleMusic: true,
|
showPlaylistsByAppleMusic: true,
|
||||||
enableUnblockNeteaseMusic: true,
|
enableUnblockNeteaseMusic: true,
|
||||||
automaticallyCacheSongs: false,
|
automaticallyCacheSongs: true,
|
||||||
cacheLimit: false,
|
cacheLimit: 8192,
|
||||||
nyancatStyle: false,
|
nyancatStyle: false,
|
||||||
showLyricsTranslation: true,
|
showLyricsTranslation: true,
|
||||||
lyricsBackground: true,
|
lyricsBackground: true,
|
||||||
closeAppOption: 'ask',
|
closeAppOption: 'ask',
|
||||||
enableDiscordRichPresence: false,
|
enableDiscordRichPresence: false,
|
||||||
enableGlobalShortcut: true,
|
enableGlobalShortcut: false,
|
||||||
showLibraryDefault: false,
|
showLibraryDefault: false,
|
||||||
enabledPlaylistCategories,
|
enabledPlaylistCategories,
|
||||||
proxyConfig: {
|
proxyConfig: {
|
||||||
|
|
|
@ -51,6 +51,7 @@ async function deleteExcessCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function cacheTrackSource(trackInfo, url, bitRate, from = 'netease') {
|
export function cacheTrackSource(trackInfo, url, bitRate, from = 'netease') {
|
||||||
|
if (!process.env.IS_ELECTRON) return;
|
||||||
const name = trackInfo.name;
|
const name = trackInfo.name;
|
||||||
const artist =
|
const artist =
|
||||||
(trackInfo.ar && trackInfo.ar[0]?.name) ||
|
(trackInfo.ar && trackInfo.ar[0]?.name) ||
|
||||||
|
|
|
@ -6355,10 +6355,10 @@ hosted-git-info@^4.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
lru-cache "^6.0.0"
|
lru-cache "^6.0.0"
|
||||||
|
|
||||||
howler@^2.2.1:
|
howler@^2.2.3:
|
||||||
version "2.2.1"
|
version "2.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/howler/-/howler-2.2.1.tgz#a521a9b495841e8bb9aa12e651bebba0affc179e"
|
resolved "https://registry.yarnpkg.com/howler/-/howler-2.2.3.tgz#a2eff9b08b586798e7a2ee17a602a90df28715da"
|
||||||
integrity sha512-0iIXvuBO/81CcrQ/HSSweYmbT50fT2mIc9XMFb+kxIfk2pW/iKzDbX1n3fZmDXMEIpYvyyfrB+gXwPYSDqUxIQ==
|
integrity sha512-QM0FFkw0LRX1PR8pNzJVAY25JhIWvbKMBFM4gqk+QdV+kPXOhleWGCB6AiAF/goGjIHK2e/nIElplvjQwhr0jg==
|
||||||
|
|
||||||
hpack.js@^2.1.6:
|
hpack.js@^2.1.6:
|
||||||
version "2.1.6"
|
version "2.1.6"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user