Remove Raiden's Themes: superseded, no longer maintained
This commit is contained in:
parent
9500adbfc7
commit
9b686a052b
5 changed files with 0 additions and 417 deletions
|
|
@ -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"
|
||||
}
|
||||
|
|
@ -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
|
||||
};
|
||||
|
|
@ -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"
|
||||
}
|
||||
];
|
||||
|
|
@ -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?.();
|
||||
};
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<SettingsScaffold>
|
||||
<NoteBox>
|
||||
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.
|
||||
</NoteBox>
|
||||
<TableRowGroup title="Default">
|
||||
<TableRow
|
||||
label="Reset to default"
|
||||
onPress={reset}
|
||||
/>
|
||||
</TableRowGroup>
|
||||
<TableRowGroup title="Raiden's Themes">
|
||||
{THEMES.map((theme) => (
|
||||
<TableRow
|
||||
key={theme.id}
|
||||
label={theme.name}
|
||||
subLabel={theme.id}
|
||||
onPress={() => applyTheme(theme)}
|
||||
trailing={
|
||||
storage.current === theme.id
|
||||
? <Text style={{ fontSize: 16 }}>✓</Text>
|
||||
: <TableRowArrow />
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</TableRowGroup>
|
||||
</SettingsScaffold>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue