Update SpotifyControls.plugin.js

This commit is contained in:
Mirco Wittrien 2022-11-03 12:25:15 +01:00
parent ddf25e12ac
commit 199dd89184
1 changed files with 3 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* @name SpotifyControls * @name SpotifyControls
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.2.9 * @version 1.3.0
* @description Adds a Control Panel while listening to Spotify on a connected Account * @description Adds a Control Panel while listening to Spotify on a connected Account
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -85,12 +85,8 @@ module.exports = (_ => {
method = "get"; method = "get";
break; break;
}; };
BDFDB.LibraryRequires.request[method]({ BDFDB.LibraryRequires.request(`https://api.spotify.com/v1/me/player${type ? "/" + type : ""}?${Object.entries(Object.assign({device_id: device.id}, data)).map(n => `${n[0]}=${n[1]}`).join("&")}`, {method: method, headers: {authorization: `Bearer ${socket.accessToken}`}}, (error, response, result) => {
url: `https://api.spotify.com/v1/me/player${type ? "/" + type : ""}?${Object.entries(Object.assign({device_id: device.id}, data)).map(n => `${n[0]}=${n[1]}`).join("&")}`, console.log(response);
headers: {
authorization: `Bearer ${socket.accessToken}`
}
}, (error, response, result) => {
if (response && response.statusCode == 401) { if (response && response.statusCode == 401) {
BDFDB.LibraryModules.SpotifyUtils.getAccessToken(socket.accountId).then(promiseResult => { BDFDB.LibraryModules.SpotifyUtils.getAccessToken(socket.accountId).then(promiseResult => {
let newSocketDevice = BDFDB.LibraryStores.SpotifyStore.getActiveSocketAndDevice(); let newSocketDevice = BDFDB.LibraryStores.SpotifyStore.getActiveSocketAndDevice();