diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts
index bb764063..41e38429 100644
--- a/scripts/generateReport.ts
+++ b/scripts/generateReport.ts
@@ -299,9 +299,6 @@ function runTime(token: string) {
delete patch.predicate;
delete patch.group;
- if (!Array.isArray(patch.find))
- patch.find = [patch.find];
-
if (!Array.isArray(patch.replacement))
patch.replacement = [patch.replacement];
diff --git a/src/components/VencordSettings/PatchHelperTab.tsx b/src/components/VencordSettings/PatchHelperTab.tsx
index c08c366c..064c872a 100644
--- a/src/components/VencordSettings/PatchHelperTab.tsx
+++ b/src/components/VencordSettings/PatchHelperTab.tsx
@@ -33,8 +33,8 @@ if (IS_DEV) {
var differ = require("diff") as typeof import("diff");
}
-const findCandidates = debounce(function ({ finds, setModule, setError }) {
- const candidates = search(...finds);
+const findCandidates = debounce(function ({ find, setModule, setError }) {
+ const candidates = search(find);
const keys = Object.keys(candidates);
const len = keys.length;
if (len === 0)
@@ -180,8 +180,7 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) {
return (
<>
- {/* FormTitle adds a class if className is not set, so we set it to an empty string to prevent that */}
- replacement
+ replacement
{!isFunc && (
-
Cheat Sheet
+
Cheat Sheet
{Object.entries({
"\\i": "Special regex escape sequence that matches identifiers (varnames, classnames, etc.)",
"$$": "Insert a $",
@@ -221,12 +220,11 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) {
interface FullPatchInputProps {
setFind(v: string): void;
- setFinds(v: string[]): void;
setMatch(v: string): void;
setReplacement(v: string | ReplaceFn): void;
}
-function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPatchInputProps) {
+function FullPatchInput({ setFind, setMatch, setReplacement }: FullPatchInputProps) {
const [fullPatch, setFullPatch] = React.useState
("");
const [fullPatchError, setFullPatchError] = React.useState("");
@@ -258,8 +256,7 @@ function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPat
if (!parsed.replacement.match) throw new Error("No 'replacement.match' field");
if (!parsed.replacement.replace) throw new Error("No 'replacement.replace' field");
- setFind(JSON.stringify(parsed.find));
- setFinds(parsed.find instanceof Array ? parsed.find : [parsed.find]);
+ setFind(parsed.find);
setMatch(parsed.replacement.match instanceof RegExp ? parsed.replacement.match.source : parsed.replacement.match);
setReplacement(parsed.replacement.replace);
setFullPatchError("");
@@ -269,7 +266,7 @@ function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPat
}
return <>
- Paste your full JSON patch here to fill out the fields
+ Paste your full JSON patch here to fill out the fields
{fullPatchError !== "" && {fullPatchError}}
>;
@@ -277,7 +274,6 @@ function FullPatchInput({ setFind, setFinds, setMatch, setReplacement }: FullPat
function PatchHelper() {
const [find, setFind] = React.useState("");
- const [finds, setFinds] = React.useState([]);
const [match, setMatch] = React.useState("");
const [replacement, setReplacement] = React.useState("");
@@ -289,39 +285,20 @@ function PatchHelper() {
const code = React.useMemo(() => {
return `
{
- find: ${finds.length > 1 ? `[${finds.map(f => JSON.stringify(f)).join(", ")}]` : finds.length > 0 ? JSON.stringify(finds[0]) : "[]"},
+ find: ${JSON.stringify(find)},
replacement: {
match: /${match.replace(/(?full patch
- find
+ find
- match
+ match
-
code.replace(match, replace));
if (patch.predicate && !patch.predicate()) continue;
- // we change all patch.find to array in plugins/index
- if ((patch.find as string[]).every(f => code.includes(f))) {
+ if (code.includes(patch.find)) {
patchedBy.add(patch.plugin);
const previousMod = mod;