Update 0BDFDB.plugin.js

This commit is contained in:
Mirco Wittrien 2020-11-16 10:55:23 +01:00
parent 42ef3b0f08
commit 6b97a31733
1 changed files with 5 additions and 3 deletions

View File

@ -16,13 +16,13 @@ module.exports = (_ => {
"info": { "info": {
"name": "BDFDB", "name": "BDFDB",
"author": "DevilBro", "author": "DevilBro",
"version": "1.1.2", "version": "1.1.3",
"description": "Give other plugins utility functions" "description": "Give other plugins utility functions"
}, },
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", "rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js",
"changeLog": { "changeLog": {
"fixed": { "fixed": {
"BD Beta": "Fixed some issues with the BD Beta" "Works ": "Can discord stop messing with the server list, jeez"
} }
} }
}; };
@ -1569,6 +1569,7 @@ module.exports = (_ => {
propertyFind: InternalData.ModuleUtilsConfig.Finder[unmappedType] && InternalData.ModuleUtilsConfig.Finder[unmappedType].props, propertyFind: InternalData.ModuleUtilsConfig.Finder[unmappedType] && InternalData.ModuleUtilsConfig.Finder[unmappedType].props,
specialFilter: InternalData.ModuleUtilsConfig.Finder[unmappedType] && InternalData.ModuleUtilsConfig.Finder[unmappedType].special && InternalBDFDB.createFilter(InternalData.ModuleUtilsConfig.Finder[unmappedType].special), specialFilter: InternalData.ModuleUtilsConfig.Finder[unmappedType] && InternalData.ModuleUtilsConfig.Finder[unmappedType].special && InternalBDFDB.createFilter(InternalData.ModuleUtilsConfig.Finder[unmappedType].special),
memoComponent: InternalData.ModuleUtilsConfig.MemoComponent.includes(unmappedType), memoComponent: InternalData.ModuleUtilsConfig.MemoComponent.includes(unmappedType),
subRender: InternalData.ModuleUtilsConfig.SubRender.includes(unmappedType) && Object.keys(pluginData.patchTypes)[0] == "type" && Object.keys(pluginData.patchTypes).length == 1,
forceObserve: InternalData.ModuleUtilsConfig.ForceObserve.includes(unmappedType), forceObserve: InternalData.ModuleUtilsConfig.ForceObserve.includes(unmappedType),
nonRender: BDFDB.ObjectUtils.toArray(pluginData.patchTypes).flat(10).filter(n => n && !InternalData.ModuleUtilsConfig.InstanceFunctions.includes(n)).length > 0, nonRender: BDFDB.ObjectUtils.toArray(pluginData.patchTypes).flat(10).filter(n => n && !InternalData.ModuleUtilsConfig.InstanceFunctions.includes(n)).length > 0,
mapped: InternalData.ModuleUtilsConfig.PatchMap[type] mapped: InternalData.ModuleUtilsConfig.PatchMap[type]
@ -1613,6 +1614,7 @@ module.exports = (_ => {
if (instance) { if (instance) {
instance = instance._reactInternalFiber && instance._reactInternalFiber.type ? instance._reactInternalFiber.type : instance; instance = instance._reactInternalFiber && instance._reactInternalFiber.type ? instance._reactInternalFiber.type : instance;
let toBePatched = config.nonPrototype ? instance : instance.prototype; 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) { for (let pluginData of pluginDataObjs) for (let patchType in pluginData.patchTypes) {
let patchMethods = {}; let patchMethods = {};
patchMethods[patchType] = e => { patchMethods[patchType] = e => {
@ -1623,7 +1625,7 @@ module.exports = (_ => {
patchtypes: [patchType] patchtypes: [patchType]
}); });
}; };
BDFDB.PatchUtils.patch(pluginData.plugin, toBePatched, pluginData.patchTypes[patchType], patchMethods); BDFDB.PatchUtils.patch(pluginData.plugin, toBePatched, config.subRender ? "render" : pluginData.patchTypes[patchType], patchMethods);
} }
} }
} }