From 6114b244e850d12ac538e39f2450a278ff46cb07 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Sat, 21 Mar 2020 18:16:30 +0100 Subject: [PATCH] Update BDFDB.js --- Plugins/BDFDB.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Plugins/BDFDB.js b/Plugins/BDFDB.js index 343fa9a70a..4c8636c76d 100644 --- a/Plugins/BDFDB.js +++ b/Plugins/BDFDB.js @@ -1160,11 +1160,14 @@ V2C_PluginCard: "_repolist", V2C_ThemeCard: "_repolist" }; + WebModulesData.CodeFinder = { + MessageHeader: ["usernameProfile", "avatarProfile", "subscribeToGroupId"] + }; WebModulesData.PropsFinder = { - MessageHeader: "MessageTimestamp", + PopoutMessageHeader: "MessageTimestamp", UnavailableGuildsButton: "UnavailableGuildsButton" }; - WebModulesData.NonPrototype = [].concat(WebModulesData.NonRender, Object.keys(WebModulesData.PropsFinder), WebModulesData.MemoComponent, [ + WebModulesData.NonPrototype = [].concat(WebModulesData.NonRender, Object.keys(WebModulesData.CodeFinder), Object.keys(WebModulesData.PropsFinder), WebModulesData.MemoComponent, [ "ChannelTextAreaContainer" ]); @@ -1355,6 +1358,7 @@ if (component) patchInstance(WebModulesData.NonRender.includes(unmappedType) ? (BDFDB.ModuleUtils.find(m => m == component, false) || {}).exports : component, type, patchType); else { let className = WebModulesData.PatchFinder[unmappedType]; + let codeFind = WebModulesData.CodeFinder[unmappedType]; let propertyFind = WebModulesData.PropsFinder[unmappedType]; let mapped = WebModulesData.PatchMap[type]; let mappedType = mapped ? mapped + " _ _ " + type : type; @@ -1363,7 +1367,8 @@ plugin.patchedModules[patchType][mappedType] = plugin.patchedModules[patchType][type]; delete plugin.patchedModules[patchType][type]; } - if (propertyFind) patchInstance((BDFDB.ModuleUtils.findByProperties(propertyFind, false) || {}).exports, mappedType, patchType, true); + if (codeFind) patchInstance((BDFDB.ModuleUtils.findByString(codeFind, false) || {}).exports, mappedType, patchType, true); + else if (propertyFind) patchInstance((BDFDB.ModuleUtils.findByProperties(propertyFind, false) || {}).exports, mappedType, patchType, true); else if (WebModulesData.NonRender.includes(unmappedType)) patchInstance((BDFDB.ModuleUtils.findByName(name, false) || {}).exports, mappedType, patchType, true); else if (WebModulesData.MemoComponent.includes(unmappedType)) patchInstance((BDFDB.ModuleUtils.findByName(name, false) || {exports:{}}).exports.default, mappedType, patchType, true); else if (!className) patchInstance(BDFDB.ModuleUtils.findByName(name), mappedType, patchType); @@ -9053,13 +9058,6 @@ return settingspanel = BDFDB.PluginUtils.createSettingsPanel(BDFDB, settingsitems); }; - - let MessageHeaderExport = BDFDB.ModuleUtils.findByProperties("MessageTimestamp", false); - if (MessageHeaderExport) InternalBDFDB.processMessage = function (e) { - if (BDFDB.ReactUtils.getValue(e, "instance.props.childrenHeader.type.type.displayName") == "MessageHeader" && !e.instance.props.childrenHeader.type.type.__isBDFDBpatched) { - e.instance.props.childrenHeader.type = MessageHeaderExport.exports.default; - } - }; const BDFDB_Patrons = [ "363785301195358221"