fix(SpotifyControls): sync with external shuffle toggles (#2767)
Co-authored-by: v <vendicated@riseup.net>
This commit is contained in:
parent
87e6fa8647
commit
1a712e75a6
|
@ -55,6 +55,7 @@ interface PlayerState {
|
||||||
|
|
||||||
// added by patch
|
// added by patch
|
||||||
actual_repeat: Repeat;
|
actual_repeat: Repeat;
|
||||||
|
shuffle: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Device {
|
interface Device {
|
||||||
|
@ -182,6 +183,7 @@ export const SpotifyStore = proxyLazyWebpack(() => {
|
||||||
store.isPlaying = e.isPlaying ?? false;
|
store.isPlaying = e.isPlaying ?? false;
|
||||||
store.volume = e.volumePercent ?? 0;
|
store.volume = e.volumePercent ?? 0;
|
||||||
store.repeat = e.actual_repeat || "off";
|
store.repeat = e.actual_repeat || "off";
|
||||||
|
store.shuffle = e.shuffle ?? false;
|
||||||
store.position = e.position ?? 0;
|
store.position = e.position ?? 0;
|
||||||
store.isSettingPosition = false;
|
store.isSettingPosition = false;
|
||||||
store.emitChange();
|
store.emitChange();
|
||||||
|
|
|
@ -70,21 +70,20 @@ export default definePlugin({
|
||||||
replace: "false",
|
replace: "false",
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
// Discord doesn't give you the repeat kind, only a boolean
|
|
||||||
{
|
{
|
||||||
find: 'repeat:"off"!==',
|
find: 'repeat:"off"!==',
|
||||||
replacement: {
|
replacement: [
|
||||||
match: /repeat:"off"!==(.{1,3}),/,
|
{
|
||||||
replace: "actual_repeat:$1,$&"
|
// Discord doesn't give you shuffle state and the repeat kind, only a boolean
|
||||||
}
|
match: /repeat:"off"!==(\i),/,
|
||||||
|
replace: "shuffle:arguments[2]?.shuffle_state??false,actual_repeat:$1,$&"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "artists.filter",
|
|
||||||
replacement: {
|
|
||||||
match: /(?<=artists.filter\(\i=>).{0,10}\i\.id\)&&/,
|
match: /(?<=artists.filter\(\i=>).{0,10}\i\.id\)&&/,
|
||||||
replace: ""
|
replace: ""
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
start: () => toggleHoverControls(Settings.plugins.SpotifyControls.hoverControls),
|
start: () => toggleHoverControls(Settings.plugins.SpotifyControls.hoverControls),
|
||||||
|
|
Loading…
Reference in a new issue