From f58ca1c6137b9e083b5ce9663306d984f1faf3ef Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Tue, 28 Jun 2022 13:39:09 +0100 Subject: [PATCH] Manual token submission functionality --- src/i18n/en_US.json | 2 ++ src/i18n/source/en_US.json | 2 ++ src/main/plugins/lastfm.ts | 4 +++- src/renderer/views/components/settings-window.ejs | 11 +++++++---- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/i18n/en_US.json b/src/i18n/en_US.json index 102cbd42..a75588dd 100644 --- a/src/i18n/en_US.json +++ b/src/i18n/en_US.json @@ -237,6 +237,7 @@ "action.delete": "Delete", "action.edit": "Edit", "action.done": "Done", + "action.submit": "Submit", "action.editTracklist": "Edit Tracklist", "action.addToLibrary": "Add to Library", "action.addToLibrary.success": "Added to Library", @@ -535,6 +536,7 @@ "settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)", "settings.option.connectivity.lastfmScrobble.filterLoop.description": "Prevent looped tracks from being scrobbled or displayed in the Now Playing list on Last.fm.", "settings.option.connectivity.lastfmScrobble.filterTypes": "Filter Media Types (Last.fm)", + "settings.option.connectivity.lastfmScrobble.manualToken": "Enter Last.fm Token Manually", "settings.notyf.connectivity.lastfmScrobble.connectError": "Last.fm Connection Timed Out", "settings.notyf.connectivity.lastfmScrobble.connectSuccess": "Last.fm Connection Successful", "settings.notyf.connectivity.lastfmScrobble.connecting": "Connecting to Last.fm...", diff --git a/src/i18n/source/en_US.json b/src/i18n/source/en_US.json index 17d27d46..53c13dc8 100644 --- a/src/i18n/source/en_US.json +++ b/src/i18n/source/en_US.json @@ -232,6 +232,7 @@ "action.delete": "Delete", "action.edit": "Edit", "action.done": "Done", + "action.submit": "Submit", "action.editTracklist": "Edit Tracklist", "action.addToLibrary": "Add to Library", "action.addToLibrary.success": "Added to Library", @@ -522,6 +523,7 @@ "settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)", "settings.option.connectivity.lastfmScrobble.filterLoop.description": "Prevent looped tracks from being scrobbled or displayed in the Now Playing list on Last.fm.", "settings.option.connectivity.lastfmScrobble.filterTypes": "Filter Media Types (Last.fm)", + "settings.option.connectivity.lastfmScrobble.manualToken": "Enter Last.fm Token Manually", "settings.notyf.connectivity.lastfmScrobble.connectError": "Last.fm Connection Timed Out", "settings.notyf.connectivity.lastfmScrobble.connectSuccess": "Last.fm Connection Successful", "settings.notyf.connectivity.lastfmScrobble.connecting": "Connecting to Last.fm...", diff --git a/src/main/plugins/lastfm.ts b/src/main/plugins/lastfm.ts index b4a24aa8..b57a497a 100644 --- a/src/main/plugins/lastfm.ts +++ b/src/main/plugins/lastfm.ts @@ -38,7 +38,7 @@ export default class lastfm { // Register the ipcMain handlers this._utils.getIPCMain().handle('lastfm:url', (event: any) => { - console.debug(`${lastfm.name}:url`, event) + console.debug(`${lastfm.name}:url`) return this._lfm.getAuthenticationUrl({"cb": "cider://auth/lastfm"}) }) @@ -114,6 +114,8 @@ export default class lastfm { this._lfm.authenticate(token, (err: any, session: any) => { if (err) { console.error(err); + + this._utils.getWindow().webContents.executeJavaScript(`app.notyf.error("${err.message}");`) return; } this._utils.getWindow().webContents.send('lastfm:authenticated', session) diff --git a/src/renderer/views/components/settings-window.ejs b/src/renderer/views/components/settings-window.ejs index 013e1b72..f7df7049 100644 --- a/src/renderer/views/components/settings-window.ejs +++ b/src/renderer/views/components/settings-window.ejs @@ -1096,17 +1096,20 @@ -