aboutsummaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorVen <vendicated@riseup.net>2023-01-24 01:42:57 +0100
committerGitHub <noreply@github.com>2023-01-24 01:42:57 +0100
commitb2ecb02335fa51a7c7eadab0acb3beb91c289802 (patch)
tree032a1461d001a5e9164289a31fb60f15ac282597 /src/components
parent25d32ce2922f276f1a7f67c8d3be978a8d360042 (diff)
downloadVencord-b2ecb02335fa51a7c7eadab0acb3beb91c289802.tar.gz
Vencord-b2ecb02335fa51a7c7eadab0acb3beb91c289802.tar.bz2
Vencord-b2ecb02335fa51a7c7eadab0acb3beb91c289802.zip
Make Windows Ctrl+Q feature optional; add opt-in auto update (#451)
Diffstat (limited to 'src/components')
-rw-r--r--src/components/VencordSettings/Updater.tsx22
-rw-r--r--src/components/VencordSettings/VencordTab.tsx21
2 files changed, 34 insertions, 9 deletions
diff --git a/src/components/VencordSettings/Updater.tsx b/src/components/VencordSettings/Updater.tsx
index dea8766..8a126a8 100644
--- a/src/components/VencordSettings/Updater.tsx
+++ b/src/components/VencordSettings/Updater.tsx
@@ -16,6 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import { useSettings } from "@api/settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { ErrorCard } from "@components/ErrorCard";
import { Flex } from "@components/Flex";
@@ -23,7 +24,7 @@ import { handleComponentFailed } from "@components/handleComponentFailed";
import { Link } from "@components/Link";
import { classes, useAwaiter } from "@utils/misc";
import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "@utils/updater";
-import { Alerts, Button, Card, Forms, Margins, Parser, React, Toasts } from "@webpack/common";
+import { Alerts, Button, Card, Forms, Margins, Parser, React, Switch, Toasts } from "@webpack/common";
import gitHash from "~git-hash";
@@ -183,6 +184,8 @@ function Newer(props: CommonProps) {
}
function Updater() {
+ const settings = useSettings(["notifyAboutUpdates", "autoUpdate"]);
+
const [repo, err, repoPending] = useAwaiter(getRepo, { fallbackValue: "Loading..." });
React.useEffect(() => {
@@ -197,6 +200,23 @@ function Updater() {
return (
<Forms.FormSection>
+ <Forms.FormTitle tag="h5">Updater Settings</Forms.FormTitle>
+ <Switch
+ value={settings.notifyAboutUpdates}
+ onChange={(v: boolean) => settings.notifyAboutUpdates = v}
+ note="Shows a toast on startup"
+ disabled={settings.autoUpdate}
+ >
+ Get notified about new updates
+ </Switch>
+ <Switch
+ value={settings.autoUpdate}
+ onChange={(v: boolean) => settings.autoUpdate = v}
+ note="Automatically update Vencord without confirmation prompt"
+ >
+ Automatically update
+ </Switch>
+
<Forms.FormTitle tag="h5">Repo</Forms.FormTitle>
<Forms.FormText>{repoPending ? repo : err ? "Failed to retrieve - check console" : (
diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx
index 9429cdd..5da4442 100644
--- a/src/components/VencordSettings/VencordTab.tsx
+++ b/src/components/VencordSettings/VencordTab.tsx
@@ -97,21 +97,26 @@ function VencordSettings() {
<Switch
value={settings.enableReactDevtools}
onChange={(v: boolean) => settings.enableReactDevtools = v}
- note="Requires a full restart">
+ note="Requires a full restart"
+ >
Enable React Developer Tools
</Switch>
<Switch
- value={settings.notifyAboutUpdates}
- onChange={(v: boolean) => settings.notifyAboutUpdates = v}
- note="Shows a toast on startup">
- Get notified about new updates
- </Switch>
- <Switch
value={settings.frameless}
onChange={(v: boolean) => settings.frameless = v}
- note="Requires a full restart">
+ note="Requires a full restart"
+ >
Disable the window frame
</Switch>
+ {navigator.platform.toLowerCase().startsWith("win") && (
+ <Switch
+ value={settings.winCtrlQ}
+ onChange={(v: boolean) => settings.winCtrlQ = v}
+ note="Requires a full restart"
+ >
+ Register Ctrl+Q as shortcut to close Discord (Alternative to Alt+F4)
+ </Switch>
+ )}
</React.Fragment>
)}