diff --git a/plugins/raidens-themes/manifest.json b/plugins/raidens-themes/manifest.json deleted file mode 100644 index 5be4402..0000000 --- a/plugins/raidens-themes/manifest.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "Raiden's Themes", - "description": "A one-tap theme switcher that gathers and applies themes from backroomsa3-a11y/Mythemesssss.", - "authors": [ - { "name": "Raiden" } - ], - "main": "src/index.ts" -} diff --git a/plugins/raidens-themes/src/index.ts b/plugins/raidens-themes/src/index.ts deleted file mode 100644 index 37ae6c6..0000000 --- a/plugins/raidens-themes/src/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { logger } from "@vendetta"; -import { storage } from "@vendetta/plugin"; -import { getAssetIDByName } from "@vendetta/ui/assets"; -import Settings from "./ui/Settings"; -import patchSettings from "./patches/settings"; - -storage.current ??= ""; - -let unpatch: (() => void) | undefined; - -export default { - onLoad: () => { - try { - unpatch = patchSettings({ - key: "RaidensThemes", - icon: getAssetIDByName("SettingsIcon"), - title: () => "Raiden's Themes", - predicate: () => true, - page: Settings - }); - } catch (e: any) { - logger.error("[Raiden's Themes] Failed to patch settings:", e?.message ?? e); - } - }, - onUnload: () => { - unpatch?.(); - unpatch = undefined; - }, - settings: Settings -}; diff --git a/plugins/raidens-themes/src/lib/themes.ts b/plugins/raidens-themes/src/lib/themes.ts deleted file mode 100644 index c7a6746..0000000 --- a/plugins/raidens-themes/src/lib/themes.ts +++ /dev/null @@ -1,112 +0,0 @@ -export const THEMES = [ - { - "id": "911", - "name": "Porsche 911 GT Silver", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/911.json" - }, - { - "id": "A", - "name": "Salon Solitaire: Liquid Glass", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/A.json" - }, - { - "id": "Bill", - "name": "mogger of World", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Bill.json" - }, - { - "id": "Dante", - "name": "Sanguine Shadows", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Dante.json" - }, - { - "id": "E", - "name": "Noctra", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/E.json" - }, - { - "id": "Emma", - "name": "Emma Veil", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Emma.json" - }, - { - "id": "Falh", - "name": "Porsche 911 GT Silver", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Falh.json" - }, - { - "id": "Fraud", - "name": "Noctra", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Fraud.json" - }, - { - "id": "Furina", - "name": "Salon Solitaire: Furina", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Furina.json" - }, - { - "id": "Genshin", - "name": "Salon Solitaire: Furina", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Genshin.json" - }, - { - "id": "Goatjo", - "name": "i love kitkats", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Goatjo.json" - }, - { - "id": "Idk", - "name": "Salon Solitaire: Lumine Hydro", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Idk.json" - }, - { - "id": "No", - "name": "Salon Solitaire: Liquid Glass", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/No.json" - }, - { - "id": "Rs", - "name": "Porsche 911 (992)", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Rs.json" - }, - { - "id": "Ryomen", - "name": "Noctra", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Ryomen.json" - }, - { - "id": "Snowman", - "name": "Snowy Rain", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Snowman.json" - }, - { - "id": "This", - "name": "Obsidian Luxe", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/This.json" - }, - { - "id": "Tung", - "name": "Limitless", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Tung.json" - }, - { - "id": "Twin", - "name": "Porsche 911 (992)", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Twin.json" - }, - { - "id": "Vergil", - "name": "Noctra", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Vergil.json" - }, - { - "id": "Yes", - "name": "Salon Solitaire: Liquid Glass", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/Yes.json" - }, - { - "id": "You", - "name": "Salon Solitaire: Liquid Glass", - "url": "https://raw.githubusercontent.com/backroomsa3-a11y/Mythemesssss/main/You.json" - } -]; diff --git a/plugins/raidens-themes/src/patches/settings.ts b/plugins/raidens-themes/src/patches/settings.ts deleted file mode 100644 index e5a4efb..0000000 --- a/plugins/raidens-themes/src/patches/settings.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { React, NavigationNative } from "@vendetta/metro/common"; -import { findByProps, findByName } from "@vendetta/metro"; -import { after } from "@vendetta/patcher"; -import { Forms } from "@vendetta/ui/components"; -import { findInReactTree } from "@vendetta/utils"; - -const { FormSection, FormRow } = Forms; - -// Pins a settings entry into Discord's own App Settings screen instead of leaving it buried under -// Revenge's Plugins list - ported from Commands (kmmiio99o/vd-plugins), swapped from bunny to -// Vendetta's findByProps/findByName. -const tabsNavigationRef = findByProps("getRootNavigationRef"); -const settingConstants = findByProps("SETTING_RENDERER_CONFIG"); -const createListModule = findByProps("createList"); -const SettingsOverviewScreen = findByName("SettingsOverviewScreen", false); -const TableRowIconModule = findByProps("TableRowIcon"); - -function Section({ tabs }: { tabs: any }) { - const navigation = NavigationNative.useNavigation(); - - return React.createElement(FormRow, { - label: tabs.title(), - leading: React.createElement(FormRow.Icon, { source: tabs.icon }), - trailing: React.createElement(React.Fragment, {}, [ - tabs.trailing ? tabs.trailing() : null, - React.createElement(FormRow.Arrow, { key: "arrow" }) - ]), - onPress: () => { - const Component = tabs.page; - navigation.navigate("VendettaCustomPage", { - title: tabs.title(), - render: () => React.createElement(Component) - }); - } - }); -} - -function patchPanelUI(tabs: any, patches: any[]) { - const target = findByProps("renderTitle", "sections"); - if (!target) return; - - try { - patches.push( - after("default", target, (_: any, ret: any) => { - const UserSettingsOverview = findInReactTree( - ret.props.children, - (n: any) => n.type?.name === "UserSettingsOverview" - ); - - if (UserSettingsOverview) { - patches.push( - after("render", UserSettingsOverview.type.prototype, (_args: any, res: any) => { - const sections = findInReactTree( - res.props.children, - (n: any) => n?.children?.[1]?.type === FormSection - )?.children; - - if (sections) { - const index = sections.findIndex((c: any) => - ["BILLING_SETTINGS", "PREMIUM_SETTINGS"].includes(c?.props?.label) - ); - sections.splice( - -~index || 4, - 0, - React.createElement(Section, { key: tabs.key, tabs }) - ); - } - }) - ); - } - }, true) - ); - } catch { - // This surface may not exist on this build - patchTabsUI below covers the mobile list. - } -} - -function patchTabsUI(tabs: any, patches: any[]) { - if (!settingConstants || !tabsNavigationRef) { - console.warn("[Raiden's Themes] Missing constants for tabs UI patch"); - return; - } - - const row = { - [tabs.key]: { - type: "pressable", - useTitle: tabs.title, - title: tabs.title, - icon: tabs.icon, - IconComponent: - tabs.icon && - TableRowIconModule && - (() => React.createElement(TableRowIconModule.TableRowIcon, { source: tabs.icon })), - usePredicate: tabs.predicate, - useTrailing: tabs.trailing, - onPress: () => { - const navigation = tabsNavigationRef.getRootNavigationRef(); - const Component = tabs.page; - - navigation.navigate("VendettaCustomPage", { - title: tabs.title(), - render: () => React.createElement(Component) - }); - }, - withArrow: true - } - }; - - let rendererConfigValue = settingConstants.SETTING_RENDERER_CONFIG; - - Object.defineProperty(settingConstants, "SETTING_RENDERER_CONFIG", { - enumerable: true, - configurable: true, - get: () => ({ - ...rendererConfigValue, - ...row - }), - set(v: any) { rendererConfigValue = v; } - }); - - const firstRender = Symbol("raidens-themes-first-render"); - - try { - if (!createListModule) return; - patches.push( - after("createList", createListModule, function (args: any) { - if (!args[0][firstRender]) { - args[0][firstRender] = true; - - const [config] = args; - const sections = config.sections; - - const section = sections?.find((x: any) => - ["Bunny", "Revenge", "Kettu", "Vencore", "ShiggyCord"].some( - (mod) => x.label === mod && x.title === mod - ) - ); - - if (section?.settings) { - section.settings = [...section.settings, tabs.key]; - } - } - }) - ); - } catch { - if (!SettingsOverviewScreen) return; - patches.push( - after("default", SettingsOverviewScreen, (args: any, ret: any) => { - if (!args[0][firstRender]) { - args[0][firstRender] = true; - - const { sections } = findInReactTree( - ret, - (i: any) => i.props?.sections - ).props; - - const section = sections?.find((x: any) => - ["Bunny", "Revenge", "Kettu", "Vencore", "ShiggyCord"].some( - (mod) => x.label === mod && x.title === mod - ) - ); - - if (section?.settings) { - section.settings = [...section.settings, tabs.key]; - } - } - }) - ); - } -} - -export default function patchSettings(tabs: any) { - const patches: any[] = []; - let disabled = false; - - const realPredicate = tabs.predicate || (() => true); - tabs.predicate = () => (disabled ? false : realPredicate()); - - patchPanelUI(tabs, patches); - patchTabsUI(tabs, patches); - patches.push(() => (disabled = true)); - - return () => { - for (const x of patches) x?.(); - }; -} diff --git a/plugins/raidens-themes/src/ui/Settings.tsx b/plugins/raidens-themes/src/ui/Settings.tsx deleted file mode 100644 index 6a20808..0000000 --- a/plugins/raidens-themes/src/ui/Settings.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { React, ReactNative } from "@vendetta/metro/common"; -import { storage } from "@vendetta/plugin"; -import { useProxy } from "@vendetta/storage"; -import { clipboard } from "@vendetta/metro/common"; -import { showToast } from "@vendetta/ui/toasts"; -import { themes } from "@vendetta"; -import { TableRow, TableRowGroup, TableRowArrow } from "@shared/ui/table"; -import SettingsScaffold from "@shared/ui/SettingsScaffold"; -import NoteBox from "@shared/ui/NoteBox"; -import { THEMES } from "../lib/themes"; - -const { Text } = ReactNative; - -// Used to check window.bunny.themes - this client only has vendetta, so every tap silently fell -// back to the clipboard-copy path. vendetta.themes has the same shape, ported directly. -export default function Settings() { - useProxy(storage); - - const applyTheme = async (theme: typeof THEMES[number]) => { - if (!themes?.installTheme) { - clipboard.setString(theme.url); - showToast("Theme URL copied — paste it into Settings > Revenge > Themes"); - return; - } - - try { - await themes.installTheme(theme.url); - // vendetta-types says selectTheme takes an id string, but that resolves without - // applying anything - it actually wants the installed theme object. - const installed = themes.themes?.[theme.url]; - if (installed && themes.selectTheme) { - await themes.selectTheme(installed as any); - } - storage.current = theme.id; - showToast(`Switched to ${theme.name}`); - } catch (e: any) { - showToast(`Failed to apply theme: ${e?.message ?? e}`); - } - }; - - const reset = () => { - if (!themes?.selectTheme) { - showToast("Revenge theme engine not available"); - return; - } - - themes.selectTheme(null); - storage.current = ""; - showToast("Default theme restored"); - }; - - return ( - - - Tap a theme to install and apply it instantly. If the one-tap theme engine isn't available, - the theme URL is copied to your clipboard instead. - - - - - - {THEMES.map((theme) => ( - applyTheme(theme)} - trailing={ - storage.current === theme.id - ? ✓ - : - } - /> - ))} - - - ); -}