no more mk lookup :)
This commit is contained in:
parent
c8c437449e
commit
d4c8d9001a
8 changed files with 250 additions and 182 deletions
|
@ -4339,37 +4339,6 @@ const app = new Vue({
|
|||
|
||||
}
|
||||
},
|
||||
LastFMDeauthorize() {
|
||||
ipcRenderer.invoke('setStoreValue', 'lastfm.enabled', false).catch((e) => console.error(e));
|
||||
ipcRenderer.invoke('setStoreValue', 'lastfm.auth_token', '').catch((e) => console.error(e));
|
||||
app.cfg.lastfm.auth_token = "";
|
||||
app.cfg.lastfm.enabled = false;
|
||||
const element = document.getElementById('lfmConnect');
|
||||
element.innerHTML = app.getLz('term.connect');
|
||||
element.onclick = app.LastFMAuthenticate;
|
||||
},
|
||||
LastFMAuthenticate() {
|
||||
console.log("[LastFM] Received LastFM authentication callback")
|
||||
const element = document.getElementById('lfmConnect');
|
||||
// new key : f9986d12aab5a0fe66193c559435ede3
|
||||
window.open('https://www.last.fm/api/auth?api_key=f9986d12aab5a0fe66193c559435ede3&cb=cider://auth/lastfm');
|
||||
element.innerText = app.getLz('term.connecting') + '...';
|
||||
|
||||
/* Just a timeout for the button */
|
||||
setTimeout(() => {
|
||||
if (element.innerText === app.getLz('term.connecting') + '...') {
|
||||
element.innerText = app.getLz('term.connect');
|
||||
console.warn('[LastFM] Attempted connection timed out.');
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
ipcRenderer.on('LastfmAuthenticated', function (_event, lfmAuthKey) {
|
||||
app.cfg.lastfm.auth_token = lfmAuthKey;
|
||||
app.cfg.lastfm.enabled = true;
|
||||
element.innerHTML = `${app.getLz('term.disconnect')}\n<p style="font-size: 8px"><i>(${app.getLz('term.authed')}: ${lfmAuthKey})</i></p>`;
|
||||
element.onclick = app.LastFMDeauthorize;
|
||||
});
|
||||
},
|
||||
fullscreen(flag) {
|
||||
this.fullscreenState = flag;
|
||||
if (flag) {
|
||||
|
|
|
@ -1064,7 +1064,7 @@
|
|||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<button class="md-btn" id="lfmConnect" ref="lfmConnect"
|
||||
@click="app.LastFMAuthenticate()">
|
||||
@click="lfmAuthorize">
|
||||
{{$root.getLz('term.connect')}}
|
||||
</button>
|
||||
</div>
|
||||
|
@ -1079,37 +1079,6 @@
|
|||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show="app.cfg.lastfm.enabled">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.connectivity.lastfmScrobble.nowPlaying')}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<label>
|
||||
<input type="checkbox" v-model="app.cfg.lastfm.NowPlaying" switch/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show="app.cfg.lastfm.enabled">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.connectivity.lastfmScrobble.removeFeatured')}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<label>
|
||||
<input type="checkbox" v-model="app.cfg.lastfm.enabledRemoveFeaturingArtists"
|
||||
switch/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show="app.cfg.lastfm.enabled">
|
||||
<div class="md-option-segment">
|
||||
{{$root.getLz('settings.option.connectivity.lastfmScrobble.filterLoop')}}
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<label>
|
||||
<input type="checkbox" v-model="app.cfg.lastfm.filterLoop" switch/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</b-tab>
|
||||
|
@ -1504,7 +1473,32 @@
|
|||
},
|
||||
reloadDiscordRPC() {
|
||||
ipcRenderer.send('reloadRPC')
|
||||
}
|
||||
},
|
||||
lfmDisconnect(event) {
|
||||
ipcRenderer.invoke('setStoreValue', 'lastfm.enabled', false).catch((e) => console.error(e));
|
||||
ipcRenderer.invoke('setStoreValue', 'lastfm.secrets.session', {}).catch((e) => console.error(e));
|
||||
event.target.innerHTML = app.getLz('term.connect');
|
||||
event.target.onclick = this.lfmAuthorize;
|
||||
},
|
||||
async lfmAuthorize(event) {
|
||||
console.debug("[lastfm:authorize] Token received.")
|
||||
window.open(await ipcRenderer.invoke('lastfm:url'));
|
||||
event.target.innerText = app.getLz('term.connecting') + '...';
|
||||
|
||||
/* Just a timeout for the button */
|
||||
setTimeout(() => {
|
||||
if (event.target.innerText === app.getLz('term.connecting') + '...') {
|
||||
event.target.innerText = app.getLz('term.connect');
|
||||
console.warn('[lastfm:authorize] Last.fm authorization timed out.');
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
ipcRenderer.on('lastfm:renderer-auth', function (event, session) {
|
||||
element.innerHTML = `${app.getLz('term.disconnect')}\n<p style="font-size: 8px"><i>(${app.getLz('term.authed')}: ${session.username})</i></p>`;
|
||||
element.onclick = this.lfmDisconnect;
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue