diff --git a/src/main/plugins/lastfm.ts b/src/main/plugins/lastfm.ts index 4960781d..db808902 100644 --- a/src/main/plugins/lastfm.ts +++ b/src/main/plugins/lastfm.ts @@ -56,9 +56,6 @@ export default class lastfm { this._utils.getIPCMain().on('lastfm:disconnect', (event: any) => { this._lfm.setSessionCredentials(null, null); this._authenticated = false; - this._utils.setStoreValue('lastfm.enabled', false) - this._utils.setStoreValue('lastfm.secrets.username', "") - this._utils.setStoreValue('lastfm.secrets.key', "") console.debug('[lastfm] [disconnect] Disconnected') }) } @@ -119,9 +116,7 @@ export default class lastfm { console.error(err); return; } - this._utils.setStoreValue('lastfm.secrets.username', session.username); - this._utils.setStoreValue('lastfm.secrets.key', session.key); - this._utils.setStoreValue('lastfm.enabled', true) + this._utils.getWindow().webContents.send('lastfm:authenticated', session) this._authenticated = true; console.debug(`[${lastfm.name}] [authenticate] Authenticated as ${session.username}`) }); diff --git a/src/renderer/main/vueapp.js b/src/renderer/main/vueapp.js index 58f54f25..7e051b58 100644 --- a/src/renderer/main/vueapp.js +++ b/src/renderer/main/vueapp.js @@ -829,6 +829,12 @@ const app = new Vue({ MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player") + ipcRenderer.on('lastfm:authenticated', (_e, session) => { + app.cfg.lastfm.username = session.username + app.cfg.lastfm.key = session.key + app.cfg.lastfm.enabled = true + }) + ipcRenderer.on('theme-update', async (event, arg) => { await less.refresh(true, true, true) self.setTheme(self.cfg.visual.theme, true) diff --git a/src/renderer/views/pages/settings.ejs b/src/renderer/views/pages/settings.ejs index 8e0d45aa..3aef03bb 100644 --- a/src/renderer/views/pages/settings.ejs +++ b/src/renderer/views/pages/settings.ejs @@ -1470,6 +1470,9 @@ ipcRenderer.send('reloadRPC') }, lfmDisconnect() { + app.cfg.lastfm.enabled = false; + app.cfg.lastfm.username = ""; + app.cfg.lastfm.key = ""; ipcRenderer.send('lastfm:disconnect'); }, async lfmAuthorize(event) {