diff --git a/src/core/i18n/default.json b/src/core/i18n/default.json index 74b98a4..4249051 100644 --- a/src/core/i18n/default.json +++ b/src/core/i18n/default.json @@ -54,6 +54,7 @@ "MACHINE_ID": "Machine ID", "MANUFACTURER": "Manufacturer", "MESSAGE": "Message", + "MISCELLANEOUS": "Miscellaneous", "MODAL_THEME_REFETCHED": "Theme refetched", "MODAL_THEME_REFETCHED_DESC": "A reload is required to see the changes. Do you want to reload now?", "MODAL_UNPROXIED_PLUGIN_DESC": "The plugin you are trying to install has not been proxied/verified by staffs. Are you sure you want to continue?", @@ -77,6 +78,8 @@ "SAFE_MODE_NOTICE_PLUGINS": "You are in Safe Mode, so plugins cannot be loaded. Disable any misbehaving plugins, then return to Normal Mode from the General settings page.", "SAFE_MODE_NOTICE_THEMES": "You are in Safe Mode, meaning themes have been temporarily disabled. {enabled, select, true {If a theme appears to be causing the issue, you can press below to disable it persistently.} false {}}", "SEARCH": "Search", + "SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS": "Activate Discord Experiments", + "SETTINGS_ACTIVATE_DISCORD_EXPERIMENTS_DESC": "Warning: Messing with this feature may lead to account termination. We are not responsible for what you do with this feature.", "STACK_TRACE": "Stack Trace", "SUCCESSFULLY_INSTALLED": "Successfully installed", "THEME_REFETCH_FAILED": "Failed to refetch theme!", diff --git a/src/core/ui/settings/pages/General.tsx b/src/core/ui/settings/pages/General.tsx index c134399..0972ef7 100644 --- a/src/core/ui/settings/pages/General.tsx +++ b/src/core/ui/settings/pages/General.tsx @@ -84,6 +84,18 @@ export default function General() { }} /> + + } + value={settings.enableDiscordDeveloperSettings} + onValueChange={(v: boolean) => { + settings.enableDiscordDeveloperSettings = v; + }} + /> + + ); diff --git a/src/lib/metro/filters.ts b/src/lib/metro/filters.ts index b26e5e5..55b903c 100644 --- a/src/lib/metro/filters.ts +++ b/src/lib/metro/filters.ts @@ -1,6 +1,5 @@ import { instead } from "@lib/api/patcher"; - export type MetroModules = { [id: string]: any; }; export type PropIntellisense

= Record & Record; export type PropsFinder = (...props: T[]) => PropIntellisense; @@ -42,6 +41,20 @@ const onModuleCheck = (exports: any) => { } }); } + + if (exports?.default?.constructor?.displayName === "DeveloperExperimentStore") { + exports.default = new Proxy(exports.default, { + get: (target, property, receiver) => { + if (property === "isDeveloper") { + // Hopefully won't explode accessing it here :3 + const { settings } = require("@lib/settings"); + return settings.enableDiscordDeveloperSettings ?? false; + } + + return Reflect.get(target, property, receiver); + } + }); + } }; function maybeInitializeModule(id: string) { diff --git a/src/lib/settings.ts b/src/lib/settings.ts index 266ebc6..1416d09 100644 --- a/src/lib/settings.ts +++ b/src/lib/settings.ts @@ -4,6 +4,7 @@ import { createFileBackend, createMMKVBackend, createStorage, wrapSync } from "@ export interface Settings { debuggerUrl: string; developerSettings: boolean; + enableDiscordDeveloperSettings: boolean; safeMode?: { enabled: boolean; currentThemeId?: string;