This commit is contained in:
Mirco Wittrien 2023-04-04 11:16:32 +02:00
parent 5a7e598d34
commit 7bf4f2e4aa
2 changed files with 14 additions and 8 deletions

View File

@ -1284,6 +1284,16 @@ module.exports = (_ => {
else return defaultExport ? r : req.c[i]; else return defaultExport ? r : req.c[i];
} }
} }
if (config.moduleName && m && m.__esModule && m[config.moduleName] && (typeof m[config.moduleName] == "object" || typeof m[config.moduleName] == "function")) {
if (!!(r = filter(m[config.moduleName]))) {
if (all) found.push(defaultExport ? r : req.c[i]);
else return defaultExport ? r : req.c[i];
}
else if (m[config.moduleName].type && (typeof m[config.moduleName].type == "object" || typeof m[config.moduleName].type == "function") && !!(r = filter(m[config.moduleName].type))) {
if (all) found.push(defaultExport ? r : req.c[i]);
else return defaultExport ? r : req.c[i];
}
}
if (m && m.__esModule && m.default && (typeof m.default == "object" || typeof m.default == "function")) { if (m && m.__esModule && m.default && (typeof m.default == "object" || typeof m.default == "function")) {
if (!!(r = filter(m.default))) { if (!!(r = filter(m.default))) {
if (all) found.push(defaultExport ? r : req.c[i]); if (all) found.push(defaultExport ? r : req.c[i]);
@ -2149,7 +2159,7 @@ module.exports = (_ => {
if (InternalData.PatchModules[type]) { if (InternalData.PatchModules[type]) {
let found = false; let found = false;
if (!InternalData.PatchModules[type].noSearch && (patchType == "before" || patchType == "after")) { if (!InternalData.PatchModules[type].noSearch && (patchType == "before" || patchType == "after")) {
let exports = (BDFDB.ModuleUtils.find(m => Internal.isCorrectModule(m, type) && m, {defaultExport: false}) || {}).exports; let exports = (BDFDB.ModuleUtils.find(m => Internal.isCorrectModule(m, type) && m, {defaultExport: false, moduleName: type}) || {}).exports;
if (exports && !exports.default) for (let key of Object.keys(exports)) if (typeof exports[key] == "function" && !(exports[key].prototype && exports[key].prototype.render) && Internal.isCorrectModule(exports[key], type, false) && exports[key].toString().length < 50000) { if (exports && !exports.default) for (let key of Object.keys(exports)) if (typeof exports[key] == "function" && !(exports[key].prototype && exports[key].prototype.render) && Internal.isCorrectModule(exports[key], type, false) && exports[key].toString().length < 50000) {
found = true; found = true;
BDFDB.PatchUtils.patch(plugin, exports, key, {[patchType]: e => Internal.initiatePatch(plugin, type, { BDFDB.PatchUtils.patch(plugin, exports, key, {[patchType]: e => Internal.initiatePatch(plugin, type, {
@ -2411,7 +2421,7 @@ module.exports = (_ => {
else if (dataStorage[item].name) moduleStorage[item] = BDFDB.ModuleUtils.findByName(dataStorage[item].name, {defaultExport}); else if (dataStorage[item].name) moduleStorage[item] = BDFDB.ModuleUtils.findByName(dataStorage[item].name, {defaultExport});
else if (dataStorage[item].strings) { else if (dataStorage[item].strings) {
if (dataStorage[item].nonStrings) { if (dataStorage[item].nonStrings) {
moduleStorage[item] = Internal.findModule("strings + nonStrings", JSON.stringify([dataStorage[item].strings, dataStorage[item].nonStrings].flat(10)), m => Internal.checkModuleStrings(m, dataStorage[item].strings) && Internal.checkModuleStrings(m, dataStorage[item].nonStrings, {hasNot: true}) && m, {defaultExport}); moduleStorage[item] = Internal.findModule("strings + nonStrings", JSON.stringify([dataStorage[item].strings, dataStorage[item].nonStrings].flat(10)), m => Internal.checkModuleStrings(m, dataStorage[item].strings) && Internal.checkModuleStrings(m, dataStorage[item].nonStrings, {hasNot: true}) && m, {defaultExport: defaultExport, moduleName: item});
} }
else moduleStorage[item] = BDFDB.ModuleUtils.findByString(dataStorage[item].strings, {defaultExport}); else moduleStorage[item] = BDFDB.ModuleUtils.findByString(dataStorage[item].strings, {defaultExport});
} }

View File

@ -270,11 +270,11 @@
"Checkmark": {"strings": ["d:\"M8.99991 16.17L4.82991"]}, "Checkmark": {"strings": ["d:\"M8.99991 16.17L4.82991"]},
"Emoji": {"strings": ["emojiName", "shouldAnimate", "jumboable"], "funcStrings": ["autoplay"]}, "Emoji": {"strings": ["emojiName", "shouldAnimate", "jumboable"], "funcStrings": ["autoplay"]},
"EmojiButton": {"strings": ["renderButtonContents", "PickerPerRow", "SELECT_EMOJI"]}, "EmojiButton": {"strings": ["renderButtonContents", "PickerPerRow", "SELECT_EMOJI"]},
"EmojiPicker": {"strings": ["emojiSize", "inExpressionPicker", ",emojiPaddingHorizontal:"], "funcStrings": ["compare"]}, "EmojiPicker": {"strings": ["emojiSize", "disableEmojiTutorial", ",emojiPaddingHorizontal:"], "funcStrings": ["compare"]},
"Flex": {"props": ["Wrap", "Direction", "Child"]}, "Flex": {"props": ["Wrap", "Direction", "Child"]},
"FlowerStar": {"strings": ["flowerStarContainer", ".jsx)"]}, "FlowerStar": {"strings": ["flowerStarContainer", ".jsx)"]},
"FocusRingScope": {"strings": ["FocusRing", "ringTarget was not"]}, "FocusRingScope": {"strings": ["FocusRing", "ringTarget was not"]},
"FormComponents": {"props": ["INPUT_PLACEHOLDER", "LABEL_SELECTED"], "exported": false, "value": "exports", "map": { "FormComponents": {"strings": ["INPUT_PLACEHOLDER", "LABEL_SELECTED"], "exported": false, "value": "exports", "map": {
"FormDivider": [".divider"], "FormDivider": [".divider"],
"FormItem": [".titleClassName", "required"], "FormItem": [".titleClassName", "required"],
"FormNotice": [".iconClassName", ".imageData"], "FormNotice": [".iconClassName", ".imageData"],
@ -289,7 +289,6 @@
"Sizes": ["\"SMOL\"", "\"SMALLER\""] "Sizes": ["\"SMOL\"", "\"SMALLER\""]
}}, }},
"GuildTooltipMutedText": {"strings": [".muteConfig", "color:\"text-muted\""]}, "GuildTooltipMutedText": {"strings": [".muteConfig", "color:\"text-muted\""]},
"Header": {"props": ["Sizes", "Tags"]},
"Heading": {"strings": ["data-excessive", ".defaultColor"]}, "Heading": {"strings": ["data-excessive", ".defaultColor"]},
"HeaderBarComponents": {"strings": ["isAuthenticated", ".HEADER_BAR"]}, "HeaderBarComponents": {"strings": ["isAuthenticated", ".HEADER_BAR"]},
"ImageComponents": {"strings": ["containerRef", "zoomable", "LOADING"], "exported": false, "value": "exports", "map": { "ImageComponents": {"strings": ["containerRef", "zoomable", "LOADING"], "exported": false, "value": "exports", "map": {
@ -303,7 +302,6 @@
"LayerContainer": [".layerContainer", "missing parent"] "LayerContainer": [".layerContainer", "missing parent"]
}}, }},
"LazyImage": {"protos": ["loadImage", "getRatio", "getSrc"]}, "LazyImage": {"protos": ["loadImage", "getRatio", "getSrc"]},
"ListHeader": {"strings": [".container", "\"h2\"", "[\"aria-label\"]"]},
"Mask": {"props": "Masks"}, "Mask": {"props": "Masks"},
"Menu": {"strings": ["Menu API only allows Items and groups of Items as children"], "funcStrings": ["keyboardModeEnabled"]}, "Menu": {"strings": ["Menu API only allows Items and groups of Items as children"], "funcStrings": ["keyboardModeEnabled"]},
"MessageGroup": {"strings": ["renderThreadAccessory", "HAS_THREAD", "allowHeading"], "nonStrings": ["THREAD_STARTER"]}, "MessageGroup": {"strings": ["renderThreadAccessory", "HAS_THREAD", "allowHeading"], "nonStrings": ["THREAD_STARTER"]},
@ -330,7 +328,6 @@
"GroupDM": [".getGuildId", "selected:n,muted"], "GroupDM": [".getGuildId", "selected:n,muted"],
"LinkButton": [".apply(this"] "LinkButton": [".apply(this"]
}}, }},
"RoleMention": {"strings": ["rolePopout", "inlinePreview"], "funcStrings": ["inlinePreview"]},
"Scrollers": {"strings": ["().thin", "().none", "().auto", "().fade)}"], "exported": false, "value": "exports"}, "Scrollers": {"strings": ["().thin", "().none", "().auto", "().fade)}"], "exported": false, "value": "exports"},
"SpinnerComponents": {"strings": ["WANDERING_CUBES", "wanderingCubes", ".spinningCircleInner"], "exported": false, "value": "exports", "map": { "SpinnerComponents": {"strings": ["WANDERING_CUBES", "wanderingCubes", ".spinningCircleInner"], "exported": false, "value": "exports", "map": {
"Spinner": [".spinningCircleInner"], "Spinner": [".spinningCircleInner"],
@ -343,7 +340,6 @@
"Text": {"strings": ["lineClamp:", ".selectable", ".defaultColor"]}, "Text": {"strings": ["lineClamp:", ".selectable", ".defaultColor"]},
"TextElement": {"strings": [".strong,", ".STANDARD"]}, "TextElement": {"strings": [".strong,", ".STANDARD"]},
"Timeout": {"protos": ["start", "stop", "isStarted"]}, "Timeout": {"protos": ["start", "stop", "isStarted"]},
"UserBadges": {"props": ["BadgeSizes"]},
"UserBadgeComponents": {"strings": [".PROFILE_USER_BADGES", "SIZE_24"], "exported": false, "value": "exports", "map": { "UserBadgeComponents": {"strings": [".PROFILE_USER_BADGES", "SIZE_24"], "exported": false, "value": "exports", "map": {
"UserBadges": [".PROFILE_USER_BADGES"], "UserBadges": [".PROFILE_USER_BADGES"],
"Sizes": ["\"SIZE_24\":"] "Sizes": ["\"SIZE_24\":"]