Fix SpotifyControls

This commit is contained in:
Vendicated 2023-10-25 19:28:07 +02:00
parent 685f44d40f
commit c3ccbbfa99
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
2 changed files with 4 additions and 4 deletions

View file

@ -71,7 +71,7 @@ export const SpotifyStore = proxyLazy(() => {
const { Store } = Flux; const { Store } = Flux;
const SpotifySocket = findByPropsLazy("getActiveSocketAndDevice"); const SpotifySocket = findByPropsLazy("getActiveSocketAndDevice");
const SpotifyAPI = findByPropsLazy("SpotifyAPIMarker"); const SpotifyUtils = findByPropsLazy("SpotifyAPI");
const API_BASE = "https://api.spotify.com/v1/me/player"; const API_BASE = "https://api.spotify.com/v1/me/player";
@ -169,7 +169,7 @@ export const SpotifyStore = proxyLazy(() => {
(data.query ??= {}).device_id = this.device.id; (data.query ??= {}).device_id = this.device.id;
const { socket } = SpotifySocket.getActiveSocketAndDevice(); const { socket } = SpotifySocket.getActiveSocketAndDevice();
return SpotifyAPI[method](socket.accountId, socket.accessToken, { return SpotifyUtils.SpotifyAPI[method](socket.accountId, socket.accessToken, {
url: API_BASE + route, url: API_BASE + route,
...data ...data
}); });

View file

@ -59,8 +59,8 @@ export default definePlugin({
{ {
find: ".PLAYER_DEVICES", find: ".PLAYER_DEVICES",
replacement: { replacement: {
match: /get:(.{1,3})\.bind\(null,(.{1,6})\.get\)/, match: /get:(\i)\.bind\(null,(\i\.\i)\.get\)/,
replace: "SpotifyAPIMarker:1,post:$1.bind(null,$2.post),$&" replace: "post:$1.bind(null,$2.post),$&"
} }
}, },
// Discord doesn't give you the repeat kind, only a boolean // Discord doesn't give you the repeat kind, only a boolean