renderer side of lastfm updated

This commit is contained in:
Core 2022-06-15 22:11:54 +01:00
parent 47e3ad5b44
commit 2827dfb36d
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
5 changed files with 24 additions and 22 deletions

View file

@ -52,6 +52,15 @@ export default class lastfm {
// console.debug('lastfm:auth', event, token)
this.authenticateLastFM(token)
})
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')
})
}
/**
@ -110,10 +119,11 @@ export default class lastfm {
console.error(err);
return;
}
this._utils.setStoreValue("lastfm.secrets.token", token)
this._utils.setStoreValue('lastfm.secrets.username', session.username);
this._utils.setStoreValue('lastfm.secrets.key', session.key);
this._utils.setStoreValue('lastfm.enabled', true)
this._authenticated = true;
console.debug(`[${lastfm.name}] [authenticate] Authenticated as ${session.username}`)
});
}