[spotify] Add an API endpoint for logging out of Spotify

This commit is contained in:
ejurgensen
2020-06-29 22:20:29 +02:00
parent 1b74966ef1
commit 5e60527f40
6 changed files with 142 additions and 72 deletions

View File

@@ -1251,6 +1251,15 @@ jsonapi_reply_spotify_login(struct httpd_request *hreq)
return HTTP_OK;
}
static int
jsonapi_reply_spotify_logout(struct httpd_request *hreq)
{
#ifdef HAVE_SPOTIFY_H
spotify_logout();
#endif
return HTTP_NOCONTENT;
}
static int
jsonapi_reply_lastfm(struct httpd_request *hreq)
{
@@ -4217,6 +4226,7 @@ static struct httpd_uri_map adm_handlers[] =
EVHTTP_REQ_PUT, "^/api/update$", jsonapi_reply_update },
{ EVHTTP_REQ_PUT, "^/api/rescan$", jsonapi_reply_meta_rescan },
{ EVHTTP_REQ_POST, "^/api/spotify-login$", jsonapi_reply_spotify_login },
{ EVHTTP_REQ_GET, "^/api/spotify-logout$", jsonapi_reply_spotify_logout },
{ EVHTTP_REQ_GET, "^/api/spotify$", jsonapi_reply_spotify },
{ EVHTTP_REQ_GET, "^/api/pairing$", jsonapi_reply_pairing_get },
{ EVHTTP_REQ_POST, "^/api/pairing$", jsonapi_reply_pairing_pair },