From 3d29bb5ca1abb866306e497a2c6e886abb11c075 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 5 Jun 2021 23:41:29 +0800 Subject: [PATCH] fix: bugs --- src/background.js | 27 ++++++++++++++++----------- src/store/actions.js | 1 - src/views/library.vue | 2 +- src/views/settings.vue | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/background.js b/src/background.js index f9d2794..bd90e18 100644 --- a/src/background.js +++ b/src/background.js @@ -21,6 +21,10 @@ import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'; import express from 'express'; import expressProxy from 'express-http-proxy'; import Store from 'electron-store'; +const clc = require('cli-color'); +const log = text => { + console.log(`${clc.blueBright('[background.js]')} ${text}`); +}; class Background { constructor() { @@ -41,7 +45,7 @@ class Background { } init() { - console.log('initializing'); + log('initializing'); // Make sure the app is singleton. if (!app.requestSingleInstanceLock()) return app.quit(); @@ -84,7 +88,7 @@ class Background { } createExpressApp() { - console.log('creating express app'); + log('creating express app'); const expressApp = express(); expressApp.use('/', express.static(__dirname + '/')); @@ -105,7 +109,7 @@ class Background { } createWindow() { - console.log('creating app window'); + log('creating app window'); const appearance = this.store.get('settings.appearance'); const showLibraryDefault = this.store.get('settings.showLibraryDefault'); @@ -227,6 +231,7 @@ class Background { } checkForUpdates() { + log('checkForUpdates'); autoUpdater.checkForUpdatesAndNotify(); const showNewVersionMessage = info => { @@ -255,12 +260,12 @@ class Background { handleOSDEvents() { this.osdlyrics.once('ready-to-show', () => { - console.log('OSD ready-to-show event'); + log('OSD ready-to-show event'); this.osdlyrics.show(); }); this.osdlyrics.on('closed', e => { - console.log('OSD close event'); + log('OSD close event'); this.osdlyrics = null; }); @@ -279,12 +284,12 @@ class Background { handleWindowEvents() { this.window.once('ready-to-show', () => { - console.log('windows ready-to-show event'); + log('windows ready-to-show event'); this.window.show(); }); this.window.on('close', e => { - console.log('windows close event'); + log('windows close event'); if (this.willQuitApp) { /* the user tried to quit the app */ this.window = null; @@ -315,7 +320,7 @@ class Background { this.window.webContents.on('new-window', function (e, url) { e.preventDefault(); - console.log('open url'); + log('open url'); const excludeHosts = ['www.last.fm']; const exclude = excludeHosts.find(host => url.includes(host)); if (exclude) { @@ -343,7 +348,7 @@ class Background { // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. - console.log('app ready event'); + log('app ready event'); // for development if (process.env.NODE_ENV === 'development') { @@ -373,7 +378,7 @@ class Background { const proxyRules = this.store.get('proxy'); if (proxyRules) { 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', () => { // 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. - console.log('app activate event'); + log('app activate event'); if (this.window === null) { this.createWindow(); } else { diff --git a/src/store/actions.js b/src/store/actions.js index fe10817..b7f1501 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -151,7 +151,6 @@ export default { fetchCloudDisk: ({ commit }) => { if (!isAccountLoggedIn()) return; return cloudDisk().then(result => { - console.log(result); if (result.data) { commit('updateLikedXXX', { name: 'cloudDisk', diff --git a/src/views/library.vue b/src/views/library.vue index 38bd0fd..ebb301c 100644 --- a/src/views/library.vue +++ b/src/views/library.vue @@ -153,7 +153,7 @@ @change="uploadSongToCloudDisk" /> - +
{{ $t('contextMenu.allPlaylists') }}
diff --git a/src/views/settings.vue b/src/views/settings.vue index 636b40a..818712b 100644 --- a/src/views/settings.vue +++ b/src/views/settings.vue @@ -95,7 +95,7 @@ -

缓存

+

缓存