aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/settings.tsx
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2022-12-01 03:38:17 +0100
committerVendicated <vendicated@riseup.net>2022-12-01 03:38:17 +0100
commit734054ff68a103482bff903bb384bc24576c5499 (patch)
treeed2d9b1c23d027c00692dae01c8ffffa4aada6ad /src/plugins/settings.tsx
parentf94cbfb2f498a121a5dbb3a22acdb74b446c952b (diff)
downloadVencord-734054ff68a103482bff903bb384bc24576c5499.tar.gz
Vencord-734054ff68a103482bff903bb384bc24576c5499.tar.bz2
Vencord-734054ff68a103482bff903bb384bc24576c5499.zip
feat(Settings): Allow moving Vencord section to different places
Diffstat (limited to 'src/plugins/settings.tsx')
-rw-r--r--src/plugins/settings.tsx38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/plugins/settings.tsx b/src/plugins/settings.tsx
index 975c399..e5afbbc 100644
--- a/src/plugins/settings.tsx
+++ b/src/plugins/settings.tsx
@@ -16,9 +16,11 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import { Settings } from "@api/settings";
import { Devs } from "@utils/constants";
+import Logger from "@utils/Logger";
import { LazyComponent } from "@utils/misc";
-import definePlugin from "@utils/types";
+import definePlugin, { OptionType } from "@utils/types";
import gitHash from "~git-hash";
@@ -43,7 +45,23 @@ export default definePlugin({
}, {
find: "Messages.ACTIVITY_SETTINGS",
replacement: {
- match: /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/,
+ get match() {
+ switch (Settings.plugins.Settings.settingsLocation) {
+ case "top": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.USER_SETTINGS\}/;
+ case "aboveNitro": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.BILLING_SETTINGS\}/;
+ case "belowNitro": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.APP_SETTINGS\}/;
+ case "aboveActivity": return /\{section:(.{1,2})\.ID\.HEADER,\s*label:(.{1,2})\..{1,2}\.Messages\.ACTIVITY_SETTINGS\}/;
+ case "belowActivity": return /(?<=\{section:(.{1,2})\.ID\.DIVIDER},)\{section:"changelog"/;
+ case "bottom": return /\{section:(.{1,2})\.ID\.CUSTOM,\s*element:.+?}/;
+ default: {
+ new Logger("Settings").error(
+ new Error("No switch case matched????? Don't mess with the settings, silly")
+ );
+ // matches nothing
+ return /(?!a)a/;
+ }
+ }
+ },
replace: (m, mod) => {
const updater = !IS_WEB ? '{section:"VencordUpdater",label:"Updater",element:Vencord.Plugins.plugins.Settings.tabs.updater},' : "";
const patchHelper = IS_DEV ? '{section:"VencordPatchHelper",label:"Patch Helper",element:Vencord.Components.PatchHelper},' : "";
@@ -61,6 +79,22 @@ export default definePlugin({
}
}],
+ options: {
+ settingsLocation: {
+ type: OptionType.SELECT,
+ description: "Where to put the Vencord settings section",
+ options: [
+ { label: "At the very top", value: "top" },
+ { label: "Above the Nitro section", value: "aboveNitro" },
+ { label: "Below the Nitro section", value: "belowNitro" },
+ { label: "Above Activity Settings", value: "aboveActivity", default: true },
+ { label: "Below Activity Settings", value: "belowActivity" },
+ { label: "At the very bottom", value: "bottom" },
+ ],
+ restartNeeded: true
+ },
+ },
+
tabs: {
vencord: () => <SettingsComponent tab="VencordSettings" />,
plugins: () => <SettingsComponent tab="VencordPlugins" />,