ConsoleShortcuts: Add functions to switch branch on vesktop (#3204)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
4c8a734233
commit
6662647472
1 changed files with 13 additions and 0 deletions
|
|
@ -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"),
|
||||
} : {},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue