stuff
This commit is contained in:
parent
16c3247280
commit
43cd98a51b
|
@ -220,7 +220,7 @@ module.exports = (_ => {
|
|||
|
||||
BDFDB.ObjectUtils = {};
|
||||
BDFDB.ObjectUtils.is = function (obj) {
|
||||
return obj && Object.prototype.isPrototypeOf(obj) && !Array.prototype.isPrototypeOf(obj);
|
||||
return obj && !Array.isArray(obj) && !Set.prototype.isPrototypeOf(obj) && (typeof obj == "function" || typeof obj == "object");
|
||||
};
|
||||
BDFDB.ObjectUtils.get = function (nodeOrObj, valuePath) {
|
||||
if (!nodeOrObj || !valuePath) return null;
|
||||
|
@ -1787,7 +1787,7 @@ module.exports = (_ => {
|
|||
config.nonPrototype = InternalData.ModuleUtilsConfig.NonPrototype.includes(unmappedType) || !!(config.codeFind || config.propertyFind || config.nonRender);
|
||||
|
||||
let component = InternalData.ModuleUtilsConfig.LoadedInComponents[type] && BDFDB.ObjectUtils.get(InternalComponents, InternalData.ModuleUtilsConfig.LoadedInComponents[type]);
|
||||
if (component) InternalBDFDB.patchInstance(pluginData, config.nonRender ? (BDFDB.ModuleUtils.find(m => m == component, false) || {}).exports : component, type, config);
|
||||
if (component) InternalBDFDB.patchComponent(pluginData, config.nonRender ? (BDFDB.ModuleUtils.find(m => m == component, false) || {}).exports : component, type, config);
|
||||
else {
|
||||
let mappedType = config.mapped ? config.mapped + " _ _ " + type : type;
|
||||
let name = mappedType.split(" _ _ ")[0];
|
||||
|
@ -1800,21 +1800,21 @@ module.exports = (_ => {
|
|||
if (config.classNames.length) InternalBDFDB.checkForInstance(pluginData, mappedType, config);
|
||||
else if (config.stringFind) {
|
||||
let exports = (BDFDB.ModuleUtils.findByString(config.stringFind, false) || {}).exports;
|
||||
InternalBDFDB.patchInstance(pluginData, exports && config.memoComponent ? exports.default : exports, mappedType, config);
|
||||
InternalBDFDB.patchComponent(pluginData, exports && config.memoComponent ? exports.default : exports, mappedType, config);
|
||||
}
|
||||
else if (config.propertyFind) {
|
||||
let exports = (BDFDB.ModuleUtils.findByProperties(config.propertyFind, false) || {}).exports;
|
||||
InternalBDFDB.patchInstance(pluginData, exports && config.memoComponent ? exports.default : exports, mappedType, config);
|
||||
InternalBDFDB.patchComponent(pluginData, exports && config.memoComponent ? exports.default : exports, mappedType, config);
|
||||
}
|
||||
else if (config.nonRender) {
|
||||
let exports = (BDFDB.ModuleUtils.findByName(name, false) || {}).exports;
|
||||
InternalBDFDB.patchInstance(pluginData, exports && config.memoComponent ? exports.default : exports, mappedType, config);
|
||||
InternalBDFDB.patchComponent(pluginData, exports && config.memoComponent ? exports.default : exports, mappedType, config);
|
||||
}
|
||||
else InternalBDFDB.patchInstance(pluginData, BDFDB.ModuleUtils.findByName(name), mappedType, config);
|
||||
else InternalBDFDB.patchComponent(pluginData, BDFDB.ModuleUtils.findByName(name), mappedType, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
InternalBDFDB.patchInstance = function (pluginDataObjs, instance, type, config) {
|
||||
InternalBDFDB.patchComponent = function (pluginDataObjs, instance, type, config) {
|
||||
pluginDataObjs = [pluginDataObjs].flat(10).filter(n => n);
|
||||
if (pluginDataObjs.length && instance) {
|
||||
let name = type.split(" _ _ ")[0];
|
||||
|
@ -1854,15 +1854,15 @@ module.exports = (_ => {
|
|||
if (component) {
|
||||
if (config.nonRender) {
|
||||
let exports = (BDFDB.ModuleUtils.find(m => m == component, false) || {}).exports;
|
||||
InternalBDFDB.patchInstance(pluginDataObjs, exports && config.memoComponent ? exports.default : exports, type, config);
|
||||
InternalBDFDB.patchComponent(pluginDataObjs, exports && config.memoComponent ? exports.default : exports, type, config);
|
||||
}
|
||||
else InternalBDFDB.patchInstance(pluginDataObjs, component, type, config);
|
||||
else InternalBDFDB.patchComponent(pluginDataObjs, component, type, config);
|
||||
BDFDB.PatchUtils.forceAllUpdates(pluginDataObjs.map(n => n.plugin), type);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (InternalBDFDB.isCorrectPatchInstance(ins, type)) {
|
||||
InternalBDFDB.patchInstance(pluginDataObjs, ins, type, config);
|
||||
InternalBDFDB.patchComponent(pluginDataObjs, ins, type, config);
|
||||
BDFDB.PatchUtils.forceAllUpdates(pluginDataObjs.map(n => n.plugin), type);
|
||||
return true;
|
||||
}
|
||||
|
@ -1874,11 +1874,11 @@ module.exports = (_ => {
|
|||
if (!config.forceObserve) {
|
||||
if (app) {
|
||||
let appIns = BDFDB.ReactUtils.findConstructor(app, type, {unlimited: true}) || BDFDB.ReactUtils.findConstructor(app, type, {unlimited: true, up: true});
|
||||
if (appIns && (instanceFound = true)) InternalBDFDB.patchInstance(pluginData, appIns, type, config);
|
||||
if (appIns && (instanceFound = true)) InternalBDFDB.patchComponent(pluginData, appIns, type, config);
|
||||
}
|
||||
if (!instanceFound && bdSettings) {
|
||||
let bdSettingsIns = BDFDB.ReactUtils.findConstructor(bdSettings, type, {unlimited: true});
|
||||
if (bdSettingsIns && (instanceFound = true)) InternalBDFDB.patchInstance(pluginData, bdSettingsIns, type, config);
|
||||
if (bdSettingsIns && (instanceFound = true)) InternalBDFDB.patchComponent(pluginData, bdSettingsIns, type, config);
|
||||
}
|
||||
}
|
||||
if (!instanceFound) {
|
||||
|
@ -8002,7 +8002,7 @@ module.exports = (_ => {
|
|||
BDFDB.LibraryRequires.electron.clipboard.write({text: result});
|
||||
}
|
||||
else (config.useBackup ? gt : gt2)(lang, translation => {
|
||||
console.log(lang);
|
||||
BDFDB.LogUtils.log(lang);
|
||||
if (!translation) {
|
||||
console.warn("no translation");
|
||||
fails++;
|
||||
|
|
|
@ -656,7 +656,7 @@ module.exports = (_ => {
|
|||
processSettingsView (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.sections) && e.instance.props.sections[0] && e.instance.props.sections[0].label == BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS) {
|
||||
e.instance.props.sections = e.instance.props.sections.filter(n => n.section != "pluginrepo");
|
||||
let index = e.instance.props.sections.indexOf(e.instance.props.sections.find(n => n.section == "themes") || e.instance.props.sections.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS));
|
||||
let index = e.instance.props.sections.indexOf(e.instance.props.sections.find(n => n.section == "themes") || e.instance.props.sections.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e.instance.props.sections.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
|
||||
if (index > -1) {
|
||||
e.instance.props.sections.splice(index + 1, 0, {
|
||||
section: "pluginrepo",
|
||||
|
|
|
@ -949,7 +949,7 @@ module.exports = (_ => {
|
|||
processSettingsView (e) {
|
||||
if (BDFDB.ArrayUtils.is(e.instance.props.sections) && e.instance.props.sections[0] && e.instance.props.sections[0].label == BDFDB.LanguageUtils.LanguageStrings.USER_SETTINGS) {
|
||||
e.instance.props.sections = e.instance.props.sections.filter(n => n.section != "themerepo");
|
||||
let index = e.instance.props.sections.indexOf(e.instance.props.sections.find(n => n.section == "pluginrepo") || e.instance.props.sections.find(n => n.section == "themes") || e.instance.props.sections.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS));
|
||||
let index = e.instance.props.sections.indexOf(e.instance.props.sections.find(n => n.section == "pluginrepo") || e.instance.props.sections.find(n => n.section == "themes") || e.instance.props.sections.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.DEVELOPER_OPTIONS) || e.instance.props.sections.find(n => n.section == BDFDB.DiscordConstants.UserSettingsSections.HYPESQUAD_ONLINE));
|
||||
if (index > -1) {
|
||||
e.instance.props.sections.splice(index + 1, 0, {
|
||||
section: "themerepo",
|
||||
|
|
Loading…
Reference in New Issue