[htdocs] Show message in admin web interface if forked-daapd is missing

a Spotify web API scope
This commit is contained in:
chme 2019-08-03 12:57:14 +02:00
parent a87059265d
commit 9ba1e24b6c
2 changed files with 10 additions and 0 deletions

View File

@ -213,6 +213,7 @@
</div>
<div v-show="spotify.webapi_token_valid">
<p><b>Spotify Web API</b>: access authorized for <b>{{ spotify.webapi_user }}</b></p>
<p v-if="spotify_missing_scope.length > 0" class="help is-danger">Please reauthorize Web API access to grant forked-daapd the following additional access rights: <b>{{ spotify_missing_scope | join }}</b></p>
<a class="button" v-bind:href="spotify.oauth_uri">Reauthorize Web API access</a>
</div>
</div>

View File

@ -24,6 +24,15 @@ var app = new Vue({
this.loadLastfm();
},
computed: {
spotify_missing_scope () {
if (this.spotify.webapi_token_valid && this.spotify.webapi_granted_scope && this.spotify.webapi_required_scope) {
return this.spotify.webapi_required_scope.split(' ').filter(scope => this.spotify.webapi_granted_scope.indexOf(scope) < 0)
}
return []
}
},
methods: {
loadConfig: function() {
axios.get('/api/config').then(response => {