This commit is contained in:
Mirco Wittrien 2021-03-03 10:55:51 +01:00
parent 31a4e75455
commit 86e7a1d4b9
7 changed files with 27 additions and 68 deletions

View File

@ -16,15 +16,10 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "1.4.0",
"version": "1.4.1",
"description": "Give other plugins utility functions"
},
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js",
"changeLog": {
"progress": {
"New Meta Headers": "Adjusted Update Check for new Plugin Meta Headers"
}
}
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js"
};
const DiscordObjects = {};
@ -1843,15 +1838,12 @@ module.exports = (_ => {
stringFind: InternalData.ModuleUtilsConfig.Finder[unmappedType] && InternalData.ModuleUtilsConfig.Finder[unmappedType].strings,
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),
memoComponent: InternalData.ModuleUtilsConfig.MemoComponent.includes(unmappedType),
subRender: InternalData.ModuleUtilsConfig.SubRender.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,
exported: InternalData.ModuleUtilsConfig.Finder[unmappedType] && InternalData.ModuleUtilsConfig.Finder[unmappedType].exported || false,
mapped: InternalData.ModuleUtilsConfig.PatchMap[type]
};
config.ignoreCheck = !!(config.codeFind || config.propertyFind || config.specialFilter || config.nonRender || config.memoComponent);
config.nonPrototype = InternalData.ModuleUtilsConfig.NonPrototype.includes(unmappedType) || !!(config.codeFind || config.propertyFind || config.nonRender);
config.nonRender = config.specialFilter || BDFDB.ObjectUtils.toArray(pluginData.patchTypes).flat(10).filter(n => n && !InternalData.ModuleUtilsConfig.InstanceFunctions.includes(n)).length > 0;
config.nonPrototype = !!(config.codeFind || config.propertyFind || config.nonRender);
let component = InternalData.ModuleUtilsConfig.LoadedInComponents[type] && BDFDB.ObjectUtils.get(InternalComponents, InternalData.ModuleUtilsConfig.LoadedInComponents[type]);
if (component) InternalBDFDB.patchComponent(pluginData, config.nonRender ? (BDFDB.ModuleUtils.find(m => m == component, config.exported) || {}).exports : component, type, config);
@ -1868,7 +1860,7 @@ module.exports = (_ => {
let patchSpecial = (func, argument) => {
let module = BDFDB.ModuleUtils[func](argument, config.exported);
let exports = module && !config.exported && module.exports || module;
exports && InternalBDFDB.patchComponent(pluginData, config.memoComponent ? exports.default : exports, mappedType, config);
exports && InternalBDFDB.patchComponent(pluginData, InternalBDFDB.isMemo(exports) ? exports.default : exports, mappedType, config);
};
if (config.classNames.length) InternalBDFDB.checkForInstance(pluginData, mappedType, config);
else if (config.stringFind) patchSpecial("findByString", config.stringFind);
@ -1883,11 +1875,11 @@ module.exports = (_ => {
if (pluginDataObjs.length && instance) {
let name = type.split(" _ _ ")[0];
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}));
instance = config.nonPrototype || 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[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;
let toBePatched = config.nonPrototype || !instance.prototype ? instance : instance.prototype;
toBePatched = toBePatched && toBePatched.type && typeof toBePatched.type.render == "function" ? toBePatched.type : toBePatched;
for (let pluginData of pluginDataObjs) for (let patchType in pluginData.patchTypes) {
let patchMethods = {};
patchMethods[patchType] = e => {
@ -1898,7 +1890,7 @@ module.exports = (_ => {
patchtypes: [patchType]
});
};
BDFDB.PatchUtils.patch(pluginData.plugin, toBePatched, config.subRender ? "render" : pluginData.patchTypes[patchType], patchMethods);
BDFDB.PatchUtils.patch(pluginData.plugin, toBePatched, pluginData.patchTypes[patchType], patchMethods);
}
}
}
@ -1909,6 +1901,9 @@ module.exports = (_ => {
return value && (!prop.value || [prop.value].flat(10).filter(n => typeof n == "string").some(n => value.toUpperCase().indexOf(n.toUpperCase()) == 0));
}) && ins.return.type;
};
InternalBDFDB.isMemo = function (exports) {
return exports && exports.default && typeof exports.default.$$typeof == "symbol" && (exports.default.$$typeof.toString() || "").indexOf("memo") > -1
};
InternalBDFDB.checkEle = function (pluginDataObjs, ele, type, config) {
pluginDataObjs = [pluginDataObjs].flat(10).filter(n => n);
let unmappedType = type.split(" _ _ ")[1] || type;
@ -1918,7 +1913,7 @@ module.exports = (_ => {
if (component) {
if (config.nonRender) {
let exports = (BDFDB.ModuleUtils.find(m => m == component, false) || {}).exports;
InternalBDFDB.patchComponent(pluginDataObjs, exports && config.memoComponent ? exports.default : exports, type, config);
InternalBDFDB.patchComponent(pluginDataObjs, InternalBDFDB.isMemo(exports) ? exports.default : exports, type, config);
}
else InternalBDFDB.patchComponent(pluginDataObjs, component, type, config);
BDFDB.PatchUtils.forceAllUpdates(pluginDataObjs.map(n => n.plugin), type);
@ -7338,7 +7333,7 @@ module.exports = (_ => {
InternalBDFDB.patchedModules = {
after: {
DiscordTag: "default",
Message: "default",
Message: "type",
MessageHeader: "default",
MemberListItem: ["componentDidMount", "componentDidUpdate"],
PrivateChannel: ["componentDidMount", "componentDidUpdate"],
@ -7365,7 +7360,7 @@ module.exports = (_ => {
if (MessageHeaderExport && BDFDB.ObjectUtils.get(e, "instance.props.childrenHeader.type.type.name") && BDFDB.ObjectUtils.get(e, "instance.props.childrenHeader.props.message")) {
e.instance.props.childrenHeader.type = MessageHeaderExport.exports.default;
}
if (e.returnvalue && e.returnvalue.props && e.returnvalue.props.children && e.returnvalue.props.children.props) {
if (BDFDB.ObjectUtils.get(e, "returnvalue.props.children.props")) {
let message;
for (let key in e.instance.props) {
if (!message) message = BDFDB.ObjectUtils.get(e.instance.props[key], "props.message");

View File

@ -14,19 +14,8 @@ module.exports = (_ => {
"info": {
"name": "ChatFilter",
"author": "DevilBro",
"version": "3.5.1",
"version": "3.5.2",
"description": "Allows the user to censor Words or block complete Messages/Statuses"
},
"changeLog": {
"added": {
"Ignore own Messages/Status": "Added option to ignore your own Messages/Status"
},
"improved": {
"Zero Width Spaces": "Ignores any zero width space, since some ppl like to troll with it"
},
"fixed": {
"Settings Update": "Fixed issue where the settings panel wouldn't show new words without having to close it first"
}
}
};
@ -95,7 +84,7 @@ module.exports = (_ => {
this.patchedModules = {
before: {
Message: "default",
Message: "type",
MessageContent: "type",
UserPopout: "render",
UserProfile: "render",

View File

@ -14,13 +14,8 @@ module.exports = (_ => {
"info": {
"name": "CompleteTimestamps",
"author": "DevilBro",
"version": "1.5.2",
"version": "1.5.3",
"description": "Replace all timestamps with complete timestamps"
},
"changeLog": {
"fixed": {
"Mini Stamp Tooltip": "Fixes the issue where tooltips for mini time stamps wouldn't show, smh this is discord's own fault for their shitty css"
}
}
};
@ -94,7 +89,7 @@ module.exports = (_ => {
this.patchedModules = {
after: {
Message: "default",
Message: "type",
MessageHeader: "default",
MessageContent: "type",
Embed: "render",

View File

@ -14,13 +14,8 @@ module.exports = (_ => {
"info": {
"name": "DisplayServersAsChannels",
"author": "DevilBro",
"version": "1.4.6",
"version": "1.4.7",
"description": "Display servers in a similar way as channels"
},
"changeLog": {
"fixed": {
"Works again": "Can discord stop messing with the server list, jeez"
}
}
};
@ -84,7 +79,7 @@ module.exports = (_ => {
DefaultHomeButton: "render",
DirectMessage: "render",
Guild: "render",
GuildFolder: "type",
GuildFolder: "render",
CircleIconButton: "render",
UnavailableGuildsButton: "UnavailableGuildsButton"
}

View File

@ -14,13 +14,8 @@ module.exports = (_ => {
"info": {
"name": "EditUsers",
"author": "DevilBro",
"version": "4.1.6",
"version": "4.1.7",
"description": "Allow you to change the icon, name, tag and color of users"
},
"changeLog": {
"fixed": {
"Mentions": ""
}
}
};
@ -112,7 +107,7 @@ module.exports = (_ => {
NowPlayingHeader: "Header",
VoiceUser: "render",
Account: "render",
Message: "default",
Message: "type",
MessageUsername: "default",
MessageContent: "type",
ReactorsComponent: "render",

View File

@ -14,13 +14,8 @@ module.exports = (_ => {
"info": {
"name": "RemoveBlockedMessages",
"author": "DevilBro",
"version": "1.2.4",
"version": "1.2.5",
"description": "Removes blocked messages/users completely"
},
"changeLog": {
"fixed": {
"Mentions": ""
}
}
};
@ -86,7 +81,7 @@ module.exports = (_ => {
this.patchedModules = {
before: {
Message: "default",
Message: "type",
ReactorsComponent: "render",
ChannelMembers: "render",
PrivateChannelRecipients: "default",

View File

@ -14,13 +14,8 @@ module.exports = (_ => {
"info": {
"name": "ServerFolders",
"author": "DevilBro",
"version": "6.8.8",
"version": "6.8.9",
"description": "Patch Discords native Folders in a way to open Servers within a Folder in a new bar to the right, also adds a bunch of new features to more easily organize, customize and manage your Folders"
},
"changeLog": {
"improved": {
"Canary Changes": "Preparing Plugins for the changes that are already done on Discord Canary"
}
}
};
@ -404,7 +399,7 @@ module.exports = (_ => {
this.patchedModules = {
after: {
AppView: "default",
GuildFolder: "type",
GuildFolder: "render",
Guilds: "render",
Guild: ["componentDidMount", "render"],
GuildFolderSettingsModal: ["componentDidMount", "render"]