various optimisations
This commit is contained in:
parent
69c460ad03
commit
bd330c1ec0
6 changed files with 23 additions and 21 deletions
|
@ -450,4 +450,6 @@ Update 10/06/2022 20:00 UTC
|
|||
|
||||
Update 15/06/2022 20:00 UTC
|
||||
|
||||
* `settings.notyf.connectivity.lastfmScrobble.connectError`: Added to `en_US`
|
||||
* `settings.notyf.connectivity.lastfmScrobble.connectError`: Added to `en_US`
|
||||
* `settings.notyf.connectivity.lastfmScrobble.connectSuccess`: Added to `en_US`
|
||||
* `settings.notyf.connectivity.lastfmScrobble.connecting`: Added to `en_US`
|
|
@ -540,6 +540,8 @@
|
|||
"settings.option.connectivity.lastfmScrobble.removeFeatured": "Remove featuring artists from song title (Last.fm)",
|
||||
"settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)",
|
||||
"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...",
|
||||
"settings.header.debug": "Debug",
|
||||
"settings.option.debug.copy_log": "Copy logs to clipboard",
|
||||
"settings.option.debug.openAppData": "Open Cider Folder",
|
||||
|
|
|
@ -528,6 +528,8 @@
|
|||
"settings.option.connectivity.lastfmScrobble.removeFeatured": "Remove featuring artists from song title (Last.fm)",
|
||||
"settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)",
|
||||
"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...",
|
||||
"settings.header.debug": "Debug",
|
||||
"settings.option.debug.copy_log": "Copy logs to clipboard",
|
||||
"settings.option.debug.openAppData": "Open Cider Folder",
|
||||
|
|
|
@ -224,8 +224,7 @@ export class Store {
|
|||
"scrobble_after": 50,
|
||||
"secrets": {
|
||||
"username": "",
|
||||
"key": "",
|
||||
"token": ""
|
||||
"key": ""
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -829,12 +829,6 @@ 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('setStoreValue', (e, key, value) => {
|
||||
app.cfg[key] = value
|
||||
})
|
||||
|
|
|
@ -1063,12 +1063,9 @@
|
|||
{{$root.getLz('settings.option.connectivity.lastfmScrobble')}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<button v-if="app.cfg.lastfm.secrets.username" class="md-btn" @click="lfmDisconnect">
|
||||
{{$root.getLz('term.disconnect')}}<br>
|
||||
<small>{{$root.getLz('term.authed')}}: {{app.cfg.lastfm.secrets.username}}</small>
|
||||
</button>
|
||||
<button v-else class="md-btn" @click="lfmAuthorize">
|
||||
{{$root.getLz('term.connect')}}
|
||||
<button class="md-btn" id="lfmConnect" @click="app.cfg.lastfm.enabled ? lfmDisconnect() : lfmAuthorize()">
|
||||
{{$root.getLz(`term.${$root.cfg.lastfm.enabled ? "disconnect" : "connect"}`)}}<br>
|
||||
<small>{{app.cfg.lastfm.enabled ? `${$root.getLz('term.authed')}: ${$root.cfg.lastfm.secrets.username}` : '' }}</small>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1471,23 +1468,29 @@
|
|||
},
|
||||
lfmDisconnect() {
|
||||
app.cfg.lastfm.enabled = false;
|
||||
app.cfg.lastfm.username = "";
|
||||
app.cfg.lastfm.key = "";
|
||||
app.cfg.lastfm.secrets.username = "";
|
||||
app.cfg.lastfm.secrets.key = "";
|
||||
ipcRenderer.send('lastfm:disconnect');
|
||||
},
|
||||
async lfmAuthorize(event) {
|
||||
async lfmAuthorize() {
|
||||
window.open(await ipcRenderer.invoke('lastfm:url'));
|
||||
event.target.innerText = app.getLz('term.connecting') + '...';
|
||||
app.notyf.success(app.getLz('settings.notyf.connectivity.lastfmScrobble.connecting'));
|
||||
|
||||
/* Just a timeout for the button */
|
||||
setTimeout(() => {
|
||||
if (event.target.innerText === app.getLz('term.connecting') + '...') {
|
||||
event.target.innerText = app.getLz('term.connect');
|
||||
if (document.getElementById('lfmConnect').innerText === app.getLz('term.connecting') + '...') {
|
||||
app.notyf.error(app.getLz('settings.notyf.connectivity.lastfmScrobble.connectError'));
|
||||
console.warn('[lastfm:authorize] Last.fm authorization timed out.');
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
ipcRenderer.once('lastfm:authenticated', (_e, session) => {
|
||||
app.cfg.lastfm.secrets.username = session.username
|
||||
app.cfg.lastfm.secrets.key = session.key
|
||||
app.cfg.lastfm.enabled = true
|
||||
app.notyf.success(app.getLz('settings.notyf.connectivity.lastfmScrobble.connectSuccess'));
|
||||
})
|
||||
|
||||
},
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue