Add ability to load Vencord from custom location (dev install)
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { getValueAndOnChange, useSettings } from "renderer/settings";
|
||||
import { Common } from "../vencord";
|
||||
import { Common, Util } from "../vencord";
|
||||
|
||||
import "./settings.css";
|
||||
|
||||
const { Margins } = Util;
|
||||
|
||||
export default function SettingsUi() {
|
||||
const Settings = useSettings();
|
||||
const { Forms: { FormSection, FormText, FormDivider, FormSwitch, FormTitle }, Text, Select } = Common;
|
||||
const { Forms: { FormSection, FormText, FormDivider, FormSwitch, FormTitle }, Text, Select, Button } = Common;
|
||||
|
||||
return (
|
||||
<FormSection>
|
||||
@@ -11,7 +15,9 @@ export default function SettingsUi() {
|
||||
Vencord Desktop Settings
|
||||
</Text>
|
||||
|
||||
<FormTitle>Discord Branch</FormTitle>
|
||||
<FormTitle className={Margins.top16}>
|
||||
Discord Branch
|
||||
</FormTitle>
|
||||
<Select
|
||||
placeholder="Stable"
|
||||
options={[
|
||||
@@ -25,12 +31,58 @@ export default function SettingsUi() {
|
||||
serialize={s => s}
|
||||
/>
|
||||
|
||||
<FormDivider className={Margins.top16 + " " + Margins.bottom16} />
|
||||
|
||||
<FormSwitch
|
||||
{...getValueAndOnChange("openLinksWithElectron")}
|
||||
note={"This will open links in a new window instead of your WebBrowser"}
|
||||
>
|
||||
Open Links in app
|
||||
</FormSwitch>
|
||||
|
||||
<FormTitle>Vencord Desktop Location</FormTitle>
|
||||
<FormText>
|
||||
Files are loaded from
|
||||
{" "}
|
||||
{Settings.vencordDir
|
||||
? (
|
||||
<a
|
||||
href="about:blank"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
VencordDesktopNative.fileManager.showItemInFolder(Settings.vencordDir!);
|
||||
}}
|
||||
>
|
||||
{Settings.vencordDir}
|
||||
</a>
|
||||
)
|
||||
: "the default location"
|
||||
}
|
||||
</FormText>
|
||||
<div className="vcd-location-btns">
|
||||
<Button
|
||||
size={Button.Sizes.SMALL}
|
||||
onClick={async () => {
|
||||
const choice = await VencordDesktopNative.fileManager.selectVencordDir();
|
||||
switch (choice) {
|
||||
case "cancelled":
|
||||
case "invalid":
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
Settings.vencordDir = choice;
|
||||
}}
|
||||
>
|
||||
Change
|
||||
</Button>
|
||||
<Button
|
||||
size={Button.Sizes.SMALL}
|
||||
color={Button.Colors.RED}
|
||||
onClick={() => Settings.vencordDir = void 0}
|
||||
>
|
||||
Reset
|
||||
</Button>
|
||||
</div>
|
||||
</FormSection>
|
||||
);
|
||||
}
|
||||
|
||||
6
src/renderer/components/settings.css
Normal file
6
src/renderer/components/settings.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.vcd-location-btns {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.5em;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
// TODO: Taaaips when?
|
||||
// FIXME: this is terrible
|
||||
|
||||
const { Webpack, Plugins } = Vencord;
|
||||
const { Webpack, Plugins, Util } = Vencord;
|
||||
const { Common } = Webpack;
|
||||
const { plugins } = Plugins;
|
||||
|
||||
export {
|
||||
Webpack,
|
||||
Common,
|
||||
Util,
|
||||
Plugins,
|
||||
plugins
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user