From 042756f933410fb28ea7aa6cf1e337fd1d8dc2cf Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Thu, 26 Nov 2020 09:53:49 +0100 Subject: [PATCH] stuff --- Library/0BDFDB.plugin.js | 58 ++++++++++++++----- .../BetterSearchPage.plugin.js | 9 ++- Plugins/CustomQuoter/CustomQuoter.plugin.js | 6 +- Plugins/EditServers/EditServers.plugin.js | 16 ++--- Plugins/EditUsers/EditUsers.plugin.js | 18 +++--- .../ImageUtilities/ImageUtilities.plugin.js | 12 ++-- Plugins/OwnerTag/OwnerTag.plugin.js | 6 +- Plugins/ServerDetails/ServerDetails.plugin.js | 8 +-- Plugins/ThemeRepo/ThemeRepo.plugin.js | 6 +- 9 files changed, 86 insertions(+), 53 deletions(-) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index 5dc46b6134..a7c2143563 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -16,13 +16,13 @@ module.exports = (_ => { "info": { "name": "BDFDB", "author": "DevilBro", - "version": "1.1.8", + "version": "1.1.9", "description": "Give other plugins utility functions" }, "rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", "changeLog": { "fixed": { - "Canary": "Fixed for canary" + "New React Structure": "Fixed for new internal react structure" } } }; @@ -1622,10 +1622,10 @@ module.exports = (_ => { pluginDataObjs = [pluginDataObjs].flat(10).filter(n => n); if (pluginDataObjs.length && instance) { let name = type.split(" _ _ ")[0]; - instance = instance._reactInternalFiber && instance._reactInternalFiber.type ? instance._reactInternalFiber.type : instance; + instance = instance[BDFDB.ReactUtils.instanceKey] && instance[BDFDB.ReactUtils.instanceKey].type ? instance[BDFDB.ReactUtils.instanceKey].type : instance; instance = config.ignoreCheck || BDFDB.ReactUtils.isCorrectInstance(instance, name) || InternalData.ModuleUtilsConfig.LoadedInComponents[type] ? instance : (BDFDB.ReactUtils.findConstructor(instance, name) || BDFDB.ReactUtils.findConstructor(instance, name, {up: true})); if (instance) { - instance = instance._reactInternalFiber && instance._reactInternalFiber.type ? instance._reactInternalFiber.type : instance; + instance = instance[BDFDB.ReactUtils.instanceKey] && instance[BDFDB.ReactUtils.instanceKey].type ? instance[BDFDB.ReactUtils.instanceKey].type : instance; let toBePatched = config.nonPrototype ? instance : instance.prototype; toBePatched = config.subRender && toBePatched ? toBePatched.type : toBePatched; for (let pluginData of pluginDataObjs) for (let patchType in pluginData.patchTypes) { @@ -1722,7 +1722,7 @@ module.exports = (_ => { InternalBDFDB.isCorrectPatchInstance = function (instance, name) { if (!instance) return false; - instance = instance._reactInternalFiber && instance._reactInternalFiber.type ? instance._reactInternalFiber.type : instance; + instance = instance[BDFDB.ReactUtils.instanceKey] && instance[BDFDB.ReactUtils.instanceKey].type ? instance[BDFDB.ReactUtils.instanceKey].type : instance; instance = BDFDB.ReactUtils.isCorrectInstance(instance, name) ? instance : (BDFDB.ReactUtils.findConstructor(instance, name) || BDFDB.ReactUtils.findConstructor(instance, name, {up: true})); return !!instance; }; @@ -2111,7 +2111,16 @@ module.exports = (_ => { let start = performance.now(); let maxDepth = config.unlimited ? 999999999 : (config.depth === undefined ? 30 : config.depth); let maxTime = config.unlimited ? 999999999 : (config.time === undefined ? 150 : config.time); - let whitelist = config.up ? {return: true, sibling: true, default: true, _reactInternalFiber: true} : {child: true, sibling: true, default: true, _reactInternalFiber: true}; + let whitelist = config.up ? { + return: true, + sibling: true, + default: true + } : { + child: true, + sibling: true, + default: true + }; + whitelist[BDFDB.ReactUtils.instanceKey] = true; let foundConstructors = config.group ? {} : []; let singleConstructor = getConstructor(instance); @@ -2176,7 +2185,16 @@ module.exports = (_ => { let start = performance.now(); let maxDepth = config.unlimited ? 999999999 : (config.depth === undefined ? 30 : config.depth); let maxTime = config.unlimited ? 999999999 : (config.time === undefined ? 150 : config.time); - let whitelist = config.up ? {return: true, sibling: true, _reactInternalFiber: true} : {child: true, sibling: true, _reactInternalFiber: true}; + let whitelist = config.up ? { + return: true, + sibling: true, + default: true + } : { + child: true, + sibling: true, + default: true + }; + whitelist[BDFDB.ReactUtils.instanceKey] = true; let foundInstances = config.group ? {} : []; let singleInstance = getOwner(instance); @@ -2301,7 +2319,16 @@ module.exports = (_ => { let start = performance.now(); let maxDepth = config.unlimited ? 999999999 : (config.depth === undefined ? 30 : config.depth); let maxTime = config.unlimited ? 999999999 : (config.time === undefined ? 150 : config.time); - let whitelist = config.up ? {return: true, sibling: true, _reactInternalFiber: true} : {child: true, sibling: true, _reactInternalFiber: true}; + let whitelist = config.up ? { + return: true, + sibling: true, + default: true + } : { + child: true, + sibling: true, + default: true + }; + whitelist[BDFDB.ReactUtils.instanceKey] = true; return findProps(instance); function findProps (instance) { @@ -2326,7 +2353,7 @@ module.exports = (_ => { if (!nodeOrInstance || typeof searchKey != "string") return config.all ? [] : null; let instance = Node.prototype.isPrototypeOf(nodeOrInstance) ? BDFDB.ReactUtils.getInstance(nodeOrInstance) : nodeOrInstance; if (!BDFDB.ObjectUtils.is(instance)) return config.all ? [] : null; - instance = instance._reactInternalFiber || instance; + instance = instance[BDFDB.ReactUtils.instanceKey] || instance; let depth = -1; let start = performance.now(); let maxDepth = config.unlimited ? 999999999 : (config.depth === undefined ? 30 : config.depth); @@ -2388,9 +2415,10 @@ module.exports = (_ => { BDFDB.ReactUtils.forceUpdate = function (...instances) { for (let ins of instances.flat(10).filter(n => n)) if (ins.updater && typeof ins.updater.isMounted == "function" && ins.updater.isMounted(ins)) ins.forceUpdate(); }; + BDFDB.ReactUtils.instanceKey = "_reactInternals"; BDFDB.ReactUtils.getInstance = function (node) { if (!BDFDB.ObjectUtils.is(node)) return null; - return node[Object.keys(node).find(key => key.startsWith("__reactInternalInstance") || key.startsWith("__reactFiber"))]; + return node[Object.keys(node).find(key => key.startsWith("__reactFiber"))]; }; BDFDB.ReactUtils.isCorrectInstance = function (instance, name) { return instance && ((instance.type && (instance.type.render && instance.type.render.displayName === name || instance.type.displayName === name || instance.type.name === name || instance.type === name)) || instance.render && (instance.render.displayName === name || instance.render.name === name) || instance.displayName == name || instance.name === name); @@ -2422,7 +2450,7 @@ module.exports = (_ => { else BDFDB.ChannelUtils.markAsRead(channel); } let LayerProviderIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.messageswrapper), {name: "LayerProvider", unlimited: true, up: true}); - let LayerProviderPrototype = BDFDB.ObjectUtils.get(LayerProviderIns, "_reactInternalFiber.type.prototype"); + let LayerProviderPrototype = BDFDB.ObjectUtils.get(LayerProviderIns, `${BDFDB.ReactUtils.instanceKey}.type.prototype`); if (LayerProviderIns && LayerProviderPrototype) { BDFDB.PatchUtils.patch(BDFDB, LayerProviderPrototype, "render", {after: e => { e.returnValue.props.children = []; @@ -2611,7 +2639,7 @@ module.exports = (_ => { BDFDB.TimeUtils.clear(GuildsRerenderTimeout); GuildsRerenderTimeout = BDFDB.TimeUtils.timeout(_ => { let GuildsIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name: "Guilds", unlimited: true}); - let GuildsPrototype = BDFDB.ObjectUtils.get(GuildsIns, "_reactInternalFiber.type.prototype"); + let GuildsPrototype = BDFDB.ObjectUtils.get(GuildsIns, `${BDFDB.ReactUtils.instanceKey}.type.prototype`); if (GuildsIns && GuildsPrototype) { let injectPlaceholder = returnValue => { let [children, index] = BDFDB.ReactUtils.findParent(returnValue, {name: "ConnectedUnreadDMs"}); @@ -2722,7 +2750,7 @@ module.exports = (_ => { }; BDFDB.ChannelUtils.getAll = function () { let found = []; - for (let ins of BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.channels), {name: ["ChannelCategoryItem", "ChannelItem", "PrivateChannel"], all: true, unlimited: true})) if (ins.props && !ins.props.ispin && ins.props.channel && ins._reactInternalFiber.return) { + for (let ins of BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.channels), {name: ["ChannelCategoryItem", "ChannelItem", "PrivateChannel"], all: true, unlimited: true})) if (ins.props && !ins.props.ispin && ins.props.channel && ins[BDFDB.ReactUtils.instanceKey] && ins[BDFDB.ReactUtils.instanceKey].return) { let div = BDFDB.ReactUtils.findDOMNode(ins); div = div && BDFDB.DOMUtils.containsClass(div.parentElement, BDFDB.disCN.categorycontainerdefault, BDFDB.disCN.channelcontainerdefault, false) ? div.parentElement : div; found.push(Object.assign(new ins.props.channel.constructor(ins.props.channel), {div, instance: ins})); @@ -2750,7 +2778,7 @@ module.exports = (_ => { BDFDB.TimeUtils.clear(ChannelsRerenderTimeout); ChannelsRerenderTimeout = BDFDB.TimeUtils.timeout(_ => { let ChannelsIns = BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.guildchannels), {name: "Channels", unlimited: true}); - let ChannelsPrototype = BDFDB.ObjectUtils.get(ChannelsIns, "_reactInternalFiber.type.prototype"); + let ChannelsPrototype = BDFDB.ObjectUtils.get(ChannelsIns, `${BDFDB.ReactUtils.instanceKey}.type.prototype`); if (ChannelsIns && ChannelsPrototype) { BDFDB.PatchUtils.patch(BDFDB, ChannelsPrototype, "render", {after: e => { e.returnValue.props.children = typeof e.returnValue.props.children == "function" ? (_ => {return null;}) : []; @@ -6034,7 +6062,7 @@ module.exports = (_ => { "aria-label": BDFDB.LanguageUtils.LanguageStrings.JUMP, tooltipConfig: {zIndex: 3001}, onClick: (event, instance) => { - let jumpInput = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "pagination-list-jumpinput"}); + let jumpInput = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return`), {key: "pagination-list-jumpinput"}); if (jumpInput) this.jump(isNaN(parseInt(jumpInput.props.value)) ? -1 : jumpInput.props.value - 1); }, children: BDFDB.ReactUtils.createElement(InternalComponents.LibraryComponents.Clickable, { diff --git a/Plugins/BetterSearchPage/BetterSearchPage.plugin.js b/Plugins/BetterSearchPage/BetterSearchPage.plugin.js index 9eedeba444..a3eb9f7878 100644 --- a/Plugins/BetterSearchPage/BetterSearchPage.plugin.js +++ b/Plugins/BetterSearchPage/BetterSearchPage.plugin.js @@ -14,8 +14,13 @@ module.exports = (_ => { "info": { "name": "BetterSearchPage", "author": "DevilBro", - "version": "1.1.6", + "version": "1.1.7", "description": "Add some extra controls to the search results page" + }, + "changeLog": { + "fixed": { + "New React Structure": "Fixed for new internal react structure" + } } }; @@ -170,7 +175,7 @@ module.exports = (_ => { text: BDFDB.LanguageUtils.LanguageStrings.JUMP, "aria-label": BDFDB.LanguageUtils.LanguageStrings.JUMP, onClick: (event, instance) => { - let jumpInput = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "BSP-pagination-jumpinput"}); + let jumpInput = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return`), {key: "BSP-pagination-jumpinput"}); if (jumpInput) doJump(jumpInput.props.value); }, children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, { diff --git a/Plugins/CustomQuoter/CustomQuoter.plugin.js b/Plugins/CustomQuoter/CustomQuoter.plugin.js index be906a2afe..485b426c9a 100644 --- a/Plugins/CustomQuoter/CustomQuoter.plugin.js +++ b/Plugins/CustomQuoter/CustomQuoter.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "CustomQuoter", "author": "DevilBro", - "version": "1.2.1", + "version": "1.2.2", "description": "Customize the output of the native quote feature of Discord" }, "changeLog": { "fixed": { - "Canary": "Fixed for canary" + "New React Structure": "Fixed for new internal react structure" } } }; @@ -195,7 +195,7 @@ module.exports = (_ => { value: formats[key], onChange: (value, instance) => { formats[key] = value; - BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "PREVIEW_MESSAGE_" + key.replace(/\s/g, "_")})); + BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return`), {key: "PREVIEW_MESSAGE_" + key.replace(/\s/g, "_")})); } }), BDFDB.ReactUtils.createElement(PreviewMessageComponent, { diff --git a/Plugins/EditServers/EditServers.plugin.js b/Plugins/EditServers/EditServers.plugin.js index 8e5c2301ba..87ab8ae161 100644 --- a/Plugins/EditServers/EditServers.plugin.js +++ b/Plugins/EditServers/EditServers.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "EditServers", "author": "DevilBro", - "version": "2.2.5", + "version": "2.2.6", "description": "Allow you to change the icon, name and color of servers" }, "changeLog": { - "improved": { - "Welcome Message": "Now also changes the server name in the welcome message" + "fixed": { + "New React Structure": "Fixed for new internal react structure" } } }; @@ -426,7 +426,7 @@ module.exports = (_ => { autoFocus: true, onChange: (value, instance) => { if (!currentIgnoreCustomNameState) { - let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return.return, {key: "GUILDACRONYM"}); + let acronymInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return.return`), {key: "GUILDACRONYM"}); if (acronymInputIns) { acronymInputIns.props.placeholder = value && BDFDB.LibraryModules.StringUtils.getAcronym(value) || guild.acronym; BDFDB.ReactUtils.forceUpdate(acronymInputIns); @@ -454,8 +454,8 @@ module.exports = (_ => { value: data.ignoreCustomName, onChange: (value, instance) => { currentIgnoreCustomNameState = value; - let nameInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDNAME"}); - let acronymInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "GUILDACRONYM"}); + let nameInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return`), {key: "GUILDNAME"}); + let acronymInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return`), {key: "GUILDACRONYM"}); if (nameInputIns && acronymInputIns) { acronymInputIns.props.placeholder = !value && nameInputIns.props.value && BDFDB.LibraryModules.StringUtils.getAcronym(nameInputIns.props.value) || guild.acronym; BDFDB.ReactUtils.forceUpdate(acronymInputIns); @@ -484,7 +484,7 @@ module.exports = (_ => { tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, value: data.removeIcon, onChange: (value, instance) => { - let iconInputIins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDICON"}); + let iconInputIins = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "GUILDICON"}); if (iconInputIins) { delete iconInputIins.props.success; delete iconInputIins.props.errorMessage; @@ -532,7 +532,7 @@ module.exports = (_ => { value: data.removeBanner && guild.id != "410787888507256842", disabled: guild.id == "410787888507256842", onChange: (value, instance) => { - let bannerInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "GUILDBANNER"}); + let bannerInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "GUILDBANNER"}); if (bannerInputIns) { delete bannerInputIns.props.success; delete bannerInputIns.props.errorMessage; diff --git a/Plugins/EditUsers/EditUsers.plugin.js b/Plugins/EditUsers/EditUsers.plugin.js index d6bab6649a..7c2a6f1fd4 100644 --- a/Plugins/EditUsers/EditUsers.plugin.js +++ b/Plugins/EditUsers/EditUsers.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "EditUsers", "author": "DevilBro", - "version": "4.0.4", + "version": "4.0.5", "description": "Allow you to change the icon, name, tag and color of users" }, "changeLog": { "fixed": { - "Replies": "Works for replies now too" + "New React Structure": "Fixed for new internal react structure" } } }; @@ -1124,7 +1124,7 @@ module.exports = (_ => { tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, value: data.removeIcon, onChange: (value, instance) => { - let avatarInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERAVATAR"}); + let avatarInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "USERAVATAR"}); if (avatarInputIns) { delete avatarInputIns.props.success; delete avatarInputIns.props.errorMessage; @@ -1171,8 +1171,8 @@ module.exports = (_ => { tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, value: data.removeStatus, onChange: (value, instance) => { - let statusInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERSTATUS"}); - let statusEmojiInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERSTATUSEMOJI"}); + let statusInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "USERSTATUS"}); + let statusEmojiInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "USERSTATUSEMOJI"}); if (statusInputIns && statusEmojiInputIns) { delete statusInputIns.props.success; delete statusInputIns.props.errorMessage; @@ -1214,8 +1214,8 @@ module.exports = (_ => { name: BDFDB.LibraryComponents.SvgIcon.Names.CLOSE_CIRCLE }), onClick: (e, instance) => { - let statusInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERSTATUS"}); - let statusEmojiInputIns = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return.return, {key: "USERSTATUSEMOJI"}); + let statusInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "USERSTATUS"}); + let statusEmojiInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "USERSTATUSEMOJI"}); if (statusInputIns && statusEmojiInputIns) { statusInputIns.props.value = ""; delete statusEmojiInputIns.props.emoji; @@ -1287,8 +1287,8 @@ module.exports = (_ => { tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5, value: data.ignoreTagColor, onChange: (value, instance) => { - let colorpicker3ins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props: [["number",3]]}); - let colorpicker4ins = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {props: [["number",4]]}); + let colorpicker3ins = BDFDB.ReactUtils.findOwner(instance._reactInternals.return, {props: [["number",3]]}); + let colorpicker4ins = BDFDB.ReactUtils.findOwner(instance._reactInternals.return, {props: [["number",4]]}); if (colorpicker3ins) colorpicker3ins.setState({disabled: value}); if (colorpicker4ins) colorpicker4ins.setState({disabled: value}); } diff --git a/Plugins/ImageUtilities/ImageUtilities.plugin.js b/Plugins/ImageUtilities/ImageUtilities.plugin.js index c0c3a8b9f7..e293a77b9b 100644 --- a/Plugins/ImageUtilities/ImageUtilities.plugin.js +++ b/Plugins/ImageUtilities/ImageUtilities.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "ImageUtilities", "author": "DevilBro", - "version": "4.2.0", + "version": "4.2.1", "description": "Add a handful of options for images/emotes/avatars (direct download, reverse image search, zoom, copy image link, copy image to clipboard, gallery mode)" }, "changeLog": { - "added": { - "Infinite loading": "No longer loads images endlessly after opening it a second time" + "fixed": { + "New React Structure": "Fixed for new internal react structure" } } }; @@ -58,13 +58,13 @@ module.exports = (_ => { const ImageDetails = class ImageDetails extends BdApi.React.Component { componentDidMount() { - this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return"), "attachment", {up: true}); + this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return`), "attachment", {up: true}); BDFDB.ReactUtils.forceUpdate(this); } componentDidUpdate() { if ((!this.props.attachment || !this.props.attachment.size) && !this.props.loaded) { this.props.loaded = true; - this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return"), "attachment", {up: true}); + this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return`), "attachment", {up: true}); BDFDB.ReactUtils.forceUpdate(this); } } @@ -760,7 +760,7 @@ module.exports = (_ => { } } else { - if (settings.resizeImage && e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.imagemodalimage) > -1 && BDFDB.ReactUtils.findOwner(e.instance._reactInternalFiber, {name: "ImageModal", up: true})) { + if (settings.resizeImage && e.instance.props.className && e.instance.props.className.indexOf(BDFDB.disCN.imagemodalimage) > -1 && BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(e, `instance.${BDFDB.ReactUtils.instanceKey}`), {name: "ImageModal", up: true})) { let data = settings.enableGallery ? this.getSiblingsAndPosition(e.instance.props.src, this.getMessageGroupOfImage(e.instance.props.src)) : {}; let aRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount)); let ratio = Math.min((aRects.width * (data.previous || data.next ? 0.8 : 1) - 20) / e.instance.props.width, (aRects.height - (settings.addDetails ? 310 : 100)) / e.instance.props.height); diff --git a/Plugins/OwnerTag/OwnerTag.plugin.js b/Plugins/OwnerTag/OwnerTag.plugin.js index 5240c986d8..067c183fb3 100644 --- a/Plugins/OwnerTag/OwnerTag.plugin.js +++ b/Plugins/OwnerTag/OwnerTag.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "OwnerTag", "author": "DevilBro", - "version": "1.3.4", + "version": "1.3.5", "description": "Add a tag or crown to the server owner (or admins/management)" }, "changeLog": { "fixed": { - "Chat": "Works again in chat" + "New React Structure": "Fixed for new internal react structure" } } }; @@ -132,7 +132,7 @@ module.exports = (_ => { label: this.defaults.settings[key].description, value: settings[key], onChange: key == "useCrown" ? (value, instance) => { - let hideNativeCrownInstance = BDFDB.ReactUtils.findOwner(instance._reactInternalFiber.return, {key: "hideNativeCrown"}); + let hideNativeCrownInstance = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return`), {key: "hideNativeCrown"}); if (hideNativeCrownInstance) { hideNativeCrownInstance.props.disabled = value; BDFDB.ReactUtils.forceUpdate(hideNativeCrownInstance); diff --git a/Plugins/ServerDetails/ServerDetails.plugin.js b/Plugins/ServerDetails/ServerDetails.plugin.js index e0defcf7cb..c833a4a8e5 100644 --- a/Plugins/ServerDetails/ServerDetails.plugin.js +++ b/Plugins/ServerDetails/ServerDetails.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "ServerDetails", "author": "DevilBro", - "version": "1.0.3", + "version": "1.0.4", "description": "Show details of a server when you hover over the icon in the server list" }, "changeLog": { "fixed": { - "BD Beta": "Works with BD beta" + "New React Structure": "Fixed for new internal react structure" } } }; @@ -63,7 +63,7 @@ module.exports = (_ => { componentDidUpdate() { if (amounts.tooltipDelay && this.state.delayed && !this.state.repositioned) { this.state.repositioned = true; - let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return.return.stateNode.containerInfo")); + let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return.return.stateNode.containerInfo`)); if (tooltip) tooltip.update(); } } @@ -71,7 +71,7 @@ module.exports = (_ => { if (amounts.tooltipDelay && !this.state.delayed) { BDFDB.TimeUtils.timeout(_ => { this.state.delayed = true; - let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ObjectUtils.get(this, "_reactInternalFiber.return.return.stateNode.containerInfo")); + let tooltip = BDFDB.DOMUtils.getParent(BDFDB.dotCN.tooltip, BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return.return.stateNode.containerInfo`)); if (tooltip) BDFDB.DOMUtils.addClass(tooltip, BDFDB.disCN._serverdetailstooltip); BDFDB.ReactUtils.forceUpdate(this); }, amounts.tooltipDelay * 1000); diff --git a/Plugins/ThemeRepo/ThemeRepo.plugin.js b/Plugins/ThemeRepo/ThemeRepo.plugin.js index eaf126508c..57185a93b2 100644 --- a/Plugins/ThemeRepo/ThemeRepo.plugin.js +++ b/Plugins/ThemeRepo/ThemeRepo.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "ThemeRepo", "author": "DevilBro", - "version": "2.1.0", + "version": "2.1.1", "description": "Allow you to preview all themes from the theme repo and download them on the fly" }, "changeLog": { "fixed": { - "BD Beta": "Fixed some issues with the beta" + "New React Structure": "Fixed for new internal react structure" } } }; @@ -547,7 +547,7 @@ module.exports = (_ => { onChange: (value, instance) => { if (!list) return; - if (list.props.currentTheme) for (let ins of BDFDB.ReactUtils.findOwner(this._reactInternalFiber.return, {name: "ThemeCard", all: true}).filter(ins => ins && ins.props && ins.props.theme && ins.props.theme.url == list.props.currentTheme.url)) BDFDB.ReactUtils.forceUpdate(ins); + if (list.props.currentTheme) for (let ins of BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return`), {name: "ThemeCard", all: true}).filter(ins => ins && ins.props && ins.props.theme && ins.props.theme.url == list.props.currentTheme.url)) BDFDB.ReactUtils.forceUpdate(ins); if (value) list.props.currentTheme = this.props.theme; else delete list.props.currentTheme;