From 9ba1e24b6ca01184a6e35ed66d9673db4e70c00f Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 3 Aug 2019 12:57:14 +0200 Subject: [PATCH] [htdocs] Show message in admin web interface if forked-daapd is missing a Spotify web API scope --- htdocs/admin.html | 1 + htdocs/admin/js/forked-daapd.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/htdocs/admin.html b/htdocs/admin.html index 0198ba78..3e5bdaf2 100644 --- a/htdocs/admin.html +++ b/htdocs/admin.html @@ -213,6 +213,7 @@

Spotify Web API: access authorized for {{ spotify.webapi_user }}

+

Please reauthorize Web API access to grant forked-daapd the following additional access rights: {{ spotify_missing_scope | join }}

Reauthorize Web API access
diff --git a/htdocs/admin/js/forked-daapd.js b/htdocs/admin/js/forked-daapd.js index 0404f75f..de51bb76 100644 --- a/htdocs/admin/js/forked-daapd.js +++ b/htdocs/admin/js/forked-daapd.js @@ -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 => {