ConsoleShortcuts: Add functions to switch branch on vesktop (#3204)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
sadan4 2025-12-11 10:25:55 -05:00 • committed by GitHub
parent 4c8a734233
commit 6662647472
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -35,6 +35,14 @@ const DESKTOP_ONLY = (f: string) => () => {
throw new Error(`'${f}' is Discord Desktop only.`);
};
const makeVesktopSwitcher = (branch: string) => () => {
if (Vesktop.Settings.store.discordBranch === branch)
throw new Error(`Already on ${branch}`);
Vesktop.Settings.store.discordBranch = branch;
VesktopNative.app.relaunch();
};
const define: typeof Object.defineProperty =
(obj, prop, desc) => {
if (Object.hasOwn(desc, "value"))
@ -180,6 +188,11 @@ function makeShortcuts() {
experimentBucket: bucket,
});
},
...IS_VESKTOP ? {
vesktopStable: makeVesktopSwitcher("stable"),
vesktopCanary: makeVesktopSwitcher("canary"),
vesktopPtb: makeVesktopSwitcher("ptb"),
} : {},
};
}