This commit is contained in:
Mirco Wittrien 2021-08-14 19:43:46 +02:00
parent efbec1680a
commit 1409da19e5
4 changed files with 19 additions and 6703 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 1.8.1
* @version 1.8.2
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -19,7 +19,7 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "1.8.1",
"version": "1.8.2",
"description": "Required Library for DevilBro's Plugins"
},
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`,
@ -1208,11 +1208,11 @@ module.exports = (_ => {
getExport = typeof getExport != "boolean" ? true : getExport;
let req = InternalBDFDB.getWebModuleReq();
for (let i in req.c) if (req.c.hasOwnProperty(i)) {
let m = req.c[i].exports;
if (m && (typeof m == "object" || typeof m == "function") && filter(m)) return getExport ? m : req.c[i];
let m = req.c[i].exports, r = null;
if (m && (typeof m == "object" || typeof m == "function") && !!(r = filter(m))) return getExport ? r : req.c[i];
if (m && m.__esModule && m.default && (typeof m.default == "object" || typeof m.default == "function")) {
if (filter(m.default)) return getExport ? m.default : req.c[i];
else if (m.default.type && (typeof m.default.type == "object" || typeof m.default.type == "function") && filter(m.default.type)) return getExport ? m.default.type : req.c[i];
if (!!(r = filter(m.default))) return getExport ? r : req.c[i];
else if (m.default.type && (typeof m.default.type == "object" || typeof m.default.type == "function") && !!(r = filter(m.default.type))) return getExport ? r : req.c[i];
}
}
for (let i in req.m) if (req.m.hasOwnProperty(i)) {
@ -1238,10 +1238,10 @@ module.exports = (_ => {
return InternalBDFDB.findModule("prop", JSON.stringify(properties), m => properties.every(prop => {
const value = m[prop];
return value !== undefined && !(typeof value == "string" && !value);
}), getExport);
}) && m, getExport);
};
BDFDB.ModuleUtils.findByName = function (name, getExport) {
return InternalBDFDB.findModule("name", JSON.stringify(name), m => m.displayName === name || m.render && m.render.displayName === name || m[name] && m[name].displayName === name, typeof getExport != "boolean" ? true : getExport);
return InternalBDFDB.findModule("name", JSON.stringify(name), m => m.displayName === name && m || m.render && m.render.displayName === name && m || m[name] && m[name].displayName === name && m[name], typeof getExport != "boolean" ? true : getExport);
};
BDFDB.ModuleUtils.findByString = function (...strings) {
strings = strings.flat(10);
@ -1250,7 +1250,7 @@ module.exports = (_ => {
strings.push(getExport);
getExport = true;
}
return InternalBDFDB.findModule("string", JSON.stringify(strings), m => strings.every(string => typeof m == "function" && (m.toString().indexOf(string) > -1 || typeof m.__originalMethod == "function" && m.__originalMethod.toString().indexOf(string) > -1 || typeof m.__originalFunction == "function" && m.__originalFunction.toString().indexOf(string) > -1) || BDFDB.ObjectUtils.is(m) && typeof m.type == "function" && m.type.toString().indexOf(string) > -1), getExport);
return InternalBDFDB.findModule("string", JSON.stringify(strings), m => strings.every(string => typeof m == "function" && (m.toString().indexOf(string) > -1 || typeof m.__originalMethod == "function" && m.__originalMethod.toString().indexOf(string) > -1 || typeof m.__originalFunction == "function" && m.__originalFunction.toString().indexOf(string) > -1) || BDFDB.ObjectUtils.is(m) && typeof m.type == "function" && m.type.toString().indexOf(string) > -1) && m, getExport);
};
BDFDB.ModuleUtils.findByPrototypes = function (...protoProps) {
protoProps = protoProps.flat(10);
@ -1262,7 +1262,7 @@ module.exports = (_ => {
return InternalBDFDB.findModule("proto", JSON.stringify(protoProps), m => m.prototype && protoProps.every(prop => {
const value = m.prototype[prop];
return value !== undefined && !(typeof value == "string" && !value);
}), getExport);
}) && m, getExport);
};
BDFDB.ObserverUtils = {};
@ -2138,7 +2138,7 @@ module.exports = (_ => {
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);
if (component) InternalBDFDB.patchComponent(pluginData, config.nonRender ? (BDFDB.ModuleUtils.find(m => m == component && m, config.exported) || {}).exports : component, type, config);
else {
let mappedType = config.mapped ? config.mapped + " _ _ " + type : type;
let name = mappedType.split(" _ _ ")[0];
@ -2203,7 +2203,7 @@ module.exports = (_ => {
let component = config.specialFilter(ins);
if (component) {
if (config.nonRender) {
let exports = (BDFDB.ModuleUtils.find(m => m == component, false) || {}).exports;
let exports = (BDFDB.ModuleUtils.find(m => m == component && m, false) || {}).exports;
InternalBDFDB.patchComponent(pluginDataObjs, InternalBDFDB.isMemo(exports) ? exports.default : exports, type, config);
}
else InternalBDFDB.patchComponent(pluginDataObjs, component, type, config);
@ -2477,7 +2477,7 @@ module.exports = (_ => {
if (InternalData.LibraryModules[name].nonProps) LibraryModules[name] = BDFDB.ModuleUtils.find(m => InternalData.LibraryModules[name].props.every(prop => {
const value = m[prop];
return value !== undefined && !(typeof value == "string" && !value);
}) && InternalData.LibraryModules[name].nonProps.every(prop => m[prop] === undefined));
}) && InternalData.LibraryModules[name].nonProps.every(prop => m[prop] === undefined) && m);
else LibraryModules[name] = BDFDB.ModuleUtils.findByProperties(InternalData.LibraryModules[name].props);
}
else if (InternalData.LibraryModules[name].strings) LibraryModules[name] = BDFDB.ModuleUtils.findByString(InternalData.LibraryModules[name].strings);
@ -2494,7 +2494,7 @@ module.exports = (_ => {
BDFDB.ReactUtils = Object.assign({}, LibraryModules.React, LibraryModules.ReactDOM);
BDFDB.ReactUtils.childrenToArray = function (parent) {
if (parent && parent.props && parent.props.children && !BDFDB.ArrayUtils.is(parent.props.children)) {
var child = parent.props.children;
const child = parent.props.children;
parent.props.children = [];
parent.props.children.push(child);
}
@ -4258,7 +4258,7 @@ module.exports = (_ => {
};
BDFDB.DiscordUtils.getExperiment = function (id) {
if (!id) return null;
const module = BDFDB.ModuleUtils.find(m => m.definition && m.definition.defaultConfig && m.definition.defaultConfig[id] != null && typeof m.getCurrentConfig == "function");
const module = BDFDB.ModuleUtils.find(m => m.definition && m.definition.defaultConfig && m.definition.defaultConfig[id] != null && typeof m.getCurrentConfig == "function" && m);
return module && (module.getCurrentConfig({}) || {})[id];
};
BDFDB.DiscordUtils.getTheme = function () {
@ -4369,7 +4369,7 @@ module.exports = (_ => {
const DiscordClassModules = Object.assign({}, InternalData.CustomClassModules);
for (let name in InternalData.DiscordClassModules) {
if (InternalData.DiscordClassModules[name].length) DiscordClassModules[name] = BDFDB.ModuleUtils.find(m => InternalData.DiscordClassModules[name].props.every(prop => typeof m[prop] == "string") && (InternalData.DiscordClassModules[name].smaller ? Object.keys(m).length < InternalData.DiscordClassModules[name].length : Object.keys(m).length == InternalData.DiscordClassModules[name].length));
if (InternalData.DiscordClassModules[name].length) DiscordClassModules[name] = BDFDB.ModuleUtils.find(m => InternalData.DiscordClassModules[name].props.every(prop => typeof m[prop] == "string") && (InternalData.DiscordClassModules[name].smaller ? Object.keys(m).length < InternalData.DiscordClassModules[name].length : Object.keys(m).length == InternalData.DiscordClassModules[name].length) && m);
else DiscordClassModules[name] = BDFDB.ModuleUtils.findByProperties(InternalData.DiscordClassModules[name].props);
}
BDFDB.DiscordClassModules = Object.assign({}, DiscordClassModules);
@ -4741,7 +4741,7 @@ module.exports = (_ => {
for (let name in InternalData.NativeSubComponents) {
if (InternalData.NativeSubComponents[name].name) {
if (InternalData.NativeSubComponents[name].protos) InternalComponents.NativeSubComponents[name] = BDFDB.ModuleUtils.find(m => m && m.displayName == InternalData.NativeSubComponents[name].name && m.prototype && InternalData.NativeSubComponents[name].protos.every(proto => m.prototype[proto]));
if (InternalData.NativeSubComponents[name].protos) InternalComponents.NativeSubComponents[name] = BDFDB.ModuleUtils.find(m => m && m.displayName == InternalData.NativeSubComponents[name].name && m.prototype && InternalData.NativeSubComponents[name].protos.every(proto => m.prototype[proto]) && m);
else InternalComponents.NativeSubComponents[name] = BDFDB.ModuleUtils.findByName(InternalData.NativeSubComponents[name].name);
}
else if (InternalData.NativeSubComponents[name].props) InternalComponents.NativeSubComponents[name] = BDFDB.ModuleUtils.findByProperties(InternalData.NativeSubComponents[name].props);
@ -8056,7 +8056,7 @@ module.exports = (_ => {
if (BDFDB.ObjectUtils.is(menu) && menu.type && menu.type.displayName) {
for (let type of ContextMenuTypes) if (menu.type.displayName.indexOf(type) > -1) {
let patchType = type + "ContextMenu";
let module = BDFDB.ModuleUtils.find(m => m == menu.type, false);
let module = BDFDB.ModuleUtils.find(m => m == menu.type && m, false);
if (module && module.exports && module.exports.default && PluginStores.patchQueues[patchType]) {
PluginStores.patchQueues[patchType].modules.push(module);
PluginStores.patchQueues[patchType].modules = BDFDB.ArrayUtils.removeCopies(PluginStores.patchQueues[patchType].modules);

View File

@ -336,7 +336,7 @@
"Scrollers None": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerNone"},
"Scrollers Thin": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerThin"},
"Spinner": {"name": "Spinner"},
"Status": {"name": "Status", "value": "Status"},
"Status": {"name": "Status"},
"StatusPickerPopout": {"strings": ["\"StatusPickerPopout\""], "value": "default"},
"TextElement": {"name": "Text"},
"UserBadges": {"props": ["BadgeSizes"]},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff