fix ReviewDB/Vencloud auth, NoMosaic, BetterSettings (#4025)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
thororen 2026-03-07 22:24:44 -05:00 committed by End
parent 8e0ac73745
commit 8e04e1ac40
No known key found for this signature in database
4 changed files with 30 additions and 54 deletions

View file

@ -13,12 +13,10 @@ import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types";
import { findCssClassesLazy } from "@webpack";
import { ComponentDispatch, FocusLock, Menu, useEffect, useRef } from "@webpack/common";
import type { HTMLAttributes, ReactElement } from "react";
import type { HTMLAttributes, ReactNode } from "react";
import fullHeightStyle from "./fullHeightContext.css?managed";
type SettingsEntry = { section: string, label: string; };
const cl = classNameFactory("");
const Classes = findCssClassesLazy("animating", "baseLayer", "bg", "layer", "layers");
@ -43,11 +41,6 @@ const settings = definePluginSettings({
}
});
interface TransformedSettingsEntry {
section: string;
items: SettingsEntry[];
}
interface LayerProps extends HTMLAttributes<HTMLDivElement> {
mode: "SHOWN" | "HIDDEN";
baseLayer?: boolean;
@ -158,23 +151,16 @@ export default definePlugin({
},
{ // Settings cog context menu
find: "#{intl::USER_SETTINGS_ACTIONS_MENU_LABEL}",
predicate: () => settings.store.organizeMenu,
replacement: [
{
match: /=\[\];(\i)(?=\.forEach.{0,200}?"logout"===\i.{0,100}?(\i)\.get\(\i\))/,
replace: "=$self.wrapMap([]);$self.transformSettingsEntries($1,$2)",
predicate: () => settings.store.organizeMenu
match: /children:\[(\i),(?<=\1=.{0,30}\.openUserSettings.+?)/,
replace: "children:[$self.transformSettingsEntries($1),",
},
{
match: /case \i\.\i\.DEVELOPER_OPTIONS:return \i;/,
replace: "$&case 'VencordPlugins':return $self.buildPluginMenuEntries(true);$&case 'VencordThemes':return $self.buildThemeMenuEntries();"
}
]
},
],
buildPluginMenuEntries,
buildThemeMenuEntries,
// This is the very outer layer of the entire ui, so we can't wrap this in an ErrorBoundary
// without possibly also catching unrelated errors of children.
//
@ -190,44 +176,34 @@ export default definePlugin({
return <Layer {...props} />;
},
transformSettingsEntries(list: SettingsEntry[], keyMap: Map<string, string>) {
const items = [] as TransformedSettingsEntry[];
transformSettingsEntries(list) {
const items: ReactNode[] = [];
for (const item of list) {
if (item.section === "HEADER") {
keyMap.set(item.label, item.label);
items.push({ section: item.label, items: [] });
} else if (item.section !== "DIVIDER" && keyMap.has(item.section)) {
items.at(-1)?.items.push(item);
const { key, props } = item;
if (!props) continue;
if (key === "vencord_plugins" || key === "vencord_themes") {
const children = key === "vencord_plugins"
? buildPluginMenuEntries()
: buildThemeMenuEntries();
items.push(
<Menu.MenuItem key={key} label={props.label} id={props.label} {...props}>
{children}
</Menu.MenuItem>
);
} else if (key.endsWith("_section") && props.label) {
items.push(
<Menu.MenuItem key={key} label={props.label} id={props.label}>
{this.transformSettingsEntries(props.children)}
</Menu.MenuItem>
);
} else {
items.push(item);
}
}
return items;
},
wrapMap(toWrap: TransformedSettingsEntry[]) {
// @ts-expect-error
toWrap.map = function (render: (item: SettingsEntry) => ReactElement<any>) {
return this
.filter(a => a.items.length > 0)
.map(({ section, items }) => {
const children = items.map(render);
if (section) {
return (
<Menu.MenuItem
key={section}
id={section.replace(/\W/, "_")}
label={section}
>
{children}
</Menu.MenuItem>
);
} else {
return children;
}
});
};
return toWrap;
}
});

View file

@ -26,7 +26,7 @@ export default definePlugin({
patches: [{
find: "setDevtoolsCallbacks",
replacement: {
match: /if\(null!=\i&&"0.0.0"===\i\.remoteApp\.getVersion\(\)\)/,
match: /if\(null!=\i&&"0.0.0"===\i\.app\.getVersion\(\)\)/,
replace: "if(true)"
}
}]

View file

@ -27,7 +27,7 @@ export default definePlugin({
patches: [
{
find: '=>"IMAGE"===',
find: '"PLAINTEXT_PREVIEW":"OTHER"',
replacement: {
match: /=>"IMAGE"===\i\|\|"VIDEO"===\i(?:\|\|("VISUAL_PLACEHOLDER"===\i))?;/,
replace: (_, visualPlaceholderPred) => visualPlaceholderPred != null ? `=>${visualPlaceholderPred};` : "=>false;"

View file

@ -112,7 +112,7 @@ waitFor(m => {
export const MaskedLink = waitForComponent<t.MaskedLink>("MaskedLink", filters.componentByCode("MASKED_LINK)"));
export const Timestamp = waitForComponent<t.Timestamp>("Timestamp", filters.componentByCode("#{intl::MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL}"));
export const OAuth2AuthorizeModal = waitForComponent("OAuth2AuthorizeModal", filters.componentByCode("hasContentBackground", "oauth2_authorize"));
export const OAuth2AuthorizeModal = waitForComponent("OAuth2AuthorizeModal", filters.componentByCode("hasContentBackground", "nextStep", "onClose?.()"));
export const Animations = mapMangledModuleLazy(".assign({colorNames:", {
Transition: filters.componentByCode('["items","children"]', ",null,"),