mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
fix: bugs
This commit is contained in:
parent
571d0d71f8
commit
3d29bb5ca1
4 changed files with 18 additions and 14 deletions
|
|
@ -21,6 +21,10 @@ import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer';
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
import expressProxy from 'express-http-proxy';
|
import expressProxy from 'express-http-proxy';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
const clc = require('cli-color');
|
||||||
|
const log = text => {
|
||||||
|
console.log(`${clc.blueBright('[background.js]')} ${text}`);
|
||||||
|
};
|
||||||
|
|
||||||
class Background {
|
class Background {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
@ -41,7 +45,7 @@ class Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
console.log('initializing');
|
log('initializing');
|
||||||
|
|
||||||
// Make sure the app is singleton.
|
// Make sure the app is singleton.
|
||||||
if (!app.requestSingleInstanceLock()) return app.quit();
|
if (!app.requestSingleInstanceLock()) return app.quit();
|
||||||
|
|
@ -84,7 +88,7 @@ class Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
createExpressApp() {
|
createExpressApp() {
|
||||||
console.log('creating express app');
|
log('creating express app');
|
||||||
|
|
||||||
const expressApp = express();
|
const expressApp = express();
|
||||||
expressApp.use('/', express.static(__dirname + '/'));
|
expressApp.use('/', express.static(__dirname + '/'));
|
||||||
|
|
@ -105,7 +109,7 @@ class Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
createWindow() {
|
createWindow() {
|
||||||
console.log('creating app window');
|
log('creating app window');
|
||||||
|
|
||||||
const appearance = this.store.get('settings.appearance');
|
const appearance = this.store.get('settings.appearance');
|
||||||
const showLibraryDefault = this.store.get('settings.showLibraryDefault');
|
const showLibraryDefault = this.store.get('settings.showLibraryDefault');
|
||||||
|
|
@ -227,6 +231,7 @@ class Background {
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdates() {
|
checkForUpdates() {
|
||||||
|
log('checkForUpdates');
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|
||||||
const showNewVersionMessage = info => {
|
const showNewVersionMessage = info => {
|
||||||
|
|
@ -255,12 +260,12 @@ class Background {
|
||||||
|
|
||||||
handleOSDEvents() {
|
handleOSDEvents() {
|
||||||
this.osdlyrics.once('ready-to-show', () => {
|
this.osdlyrics.once('ready-to-show', () => {
|
||||||
console.log('OSD ready-to-show event');
|
log('OSD ready-to-show event');
|
||||||
this.osdlyrics.show();
|
this.osdlyrics.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.osdlyrics.on('closed', e => {
|
this.osdlyrics.on('closed', e => {
|
||||||
console.log('OSD close event');
|
log('OSD close event');
|
||||||
this.osdlyrics = null;
|
this.osdlyrics = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -279,12 +284,12 @@ class Background {
|
||||||
|
|
||||||
handleWindowEvents() {
|
handleWindowEvents() {
|
||||||
this.window.once('ready-to-show', () => {
|
this.window.once('ready-to-show', () => {
|
||||||
console.log('windows ready-to-show event');
|
log('windows ready-to-show event');
|
||||||
this.window.show();
|
this.window.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.window.on('close', e => {
|
this.window.on('close', e => {
|
||||||
console.log('windows close event');
|
log('windows close event');
|
||||||
if (this.willQuitApp) {
|
if (this.willQuitApp) {
|
||||||
/* the user tried to quit the app */
|
/* the user tried to quit the app */
|
||||||
this.window = null;
|
this.window = null;
|
||||||
|
|
@ -315,7 +320,7 @@ class Background {
|
||||||
|
|
||||||
this.window.webContents.on('new-window', function (e, url) {
|
this.window.webContents.on('new-window', function (e, url) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log('open url');
|
log('open url');
|
||||||
const excludeHosts = ['www.last.fm'];
|
const excludeHosts = ['www.last.fm'];
|
||||||
const exclude = excludeHosts.find(host => url.includes(host));
|
const exclude = excludeHosts.find(host => url.includes(host));
|
||||||
if (exclude) {
|
if (exclude) {
|
||||||
|
|
@ -343,7 +348,7 @@ class Background {
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
console.log('app ready event');
|
log('app ready event');
|
||||||
|
|
||||||
// for development
|
// for development
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
|
@ -373,7 +378,7 @@ class Background {
|
||||||
const proxyRules = this.store.get('proxy');
|
const proxyRules = this.store.get('proxy');
|
||||||
if (proxyRules) {
|
if (proxyRules) {
|
||||||
this.window.webContents.session.setProxy({ proxyRules }, result => {
|
this.window.webContents.session.setProxy({ proxyRules }, result => {
|
||||||
console.log('finished setProxy', result);
|
log('finished setProxy', result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -412,7 +417,7 @@ class Background {
|
||||||
app.on('activate', () => {
|
app.on('activate', () => {
|
||||||
// On macOS it's common to re-create a window in the app when the
|
// On macOS it's common to re-create a window in the app when the
|
||||||
// dock icon is clicked and there are no other windows open.
|
// dock icon is clicked and there are no other windows open.
|
||||||
console.log('app activate event');
|
log('app activate event');
|
||||||
if (this.window === null) {
|
if (this.window === null) {
|
||||||
this.createWindow();
|
this.createWindow();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,6 @@ export default {
|
||||||
fetchCloudDisk: ({ commit }) => {
|
fetchCloudDisk: ({ commit }) => {
|
||||||
if (!isAccountLoggedIn()) return;
|
if (!isAccountLoggedIn()) return;
|
||||||
return cloudDisk().then(result => {
|
return cloudDisk().then(result => {
|
||||||
console.log(result);
|
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
commit('updateLikedXXX', {
|
commit('updateLikedXXX', {
|
||||||
name: 'cloudDisk',
|
name: 'cloudDisk',
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@
|
||||||
@change="uploadSongToCloudDisk"
|
@change="uploadSongToCloudDisk"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ContextMenu>
|
<ContextMenu ref="playlistTabMenu">
|
||||||
<div class="item" @click="changePlaylistFilter('all')">{{
|
<div class="item" @click="changePlaylistFilter('all')">{{
|
||||||
$t('contextMenu.allPlaylists')
|
$t('contextMenu.allPlaylists')
|
||||||
}}</div>
|
}}</div>
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3>缓存</h3>
|
<h3 v-if="isElectron">缓存</h3>
|
||||||
<div v-if="isElectron" class="item">
|
<div v-if="isElectron" class="item">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue