stuff
This commit is contained in:
parent
c9ad6a5b96
commit
865307d349
|
@ -2585,24 +2585,28 @@ module.exports = (_ => {
|
||||||
if (dataStorage[item].funcStrings) moduleStorage[item] = (Object.entries(moduleStorage[item]).find(n => {
|
if (dataStorage[item].funcStrings) moduleStorage[item] = (Object.entries(moduleStorage[item]).find(n => {
|
||||||
if (!n || !n[1]) return;
|
if (!n || !n[1]) return;
|
||||||
let funcString = typeof n[1] == "function" ? n[1].toString() : (_ => {try {return JSON.stringify(n[1])}catch(err){return n[1].toString()}})();
|
let funcString = typeof n[1] == "function" ? n[1].toString() : (_ => {try {return JSON.stringify(n[1])}catch(err){return n[1].toString()}})();
|
||||||
return [dataStorage[item].funcStrings].flat(10).filter(s => s && typeof s == "string").every(string => funcString.indexOf(string) > -1);
|
let renderFuncString = typeof n[1].render == "function" && n[1].render.toString() || "";
|
||||||
|
return [dataStorage[item].funcStrings].flat(10).filter(s => s && typeof s == "string").every(string => funcString.indexOf(string) > -1 || renderFuncString.indexOf(string) > -1);
|
||||||
}) || [])[1];
|
}) || [])[1];
|
||||||
if (dataStorage[item].map) {
|
if (dataStorage[item].map) {
|
||||||
dataStorage[item]._originalModule = moduleStorage[item];
|
dataStorage[item]._originalModule = moduleStorage[item];
|
||||||
dataStorage[item]._mappedItems = {};
|
dataStorage[item]._mappedItems = {};
|
||||||
moduleStorage[item] = new Proxy(Object.assign({}, dataStorage[item]._originalModule, dataStorage[item].map), {
|
moduleStorage[item] = new Proxy(Object.assign({}, dataStorage[item]._originalModule, dataStorage[item].map), {
|
||||||
get: function (_, item2) {
|
get: function (_, item2) {
|
||||||
|
if (dataStorage[item]._originalModule[item2]) return dataStorage[item]._originalModule[item2];
|
||||||
if (dataStorage[item]._mappedItems[item2]) return dataStorage[item]._originalModule[dataStorage[item]._mappedItems[item2]];
|
if (dataStorage[item]._mappedItems[item2]) return dataStorage[item]._originalModule[dataStorage[item]._mappedItems[item2]];
|
||||||
if (!dataStorage[item].map[item2]) return dataStorage[item]._originalModule[item2];
|
if (!dataStorage[item].map[item2]) return dataStorage[item]._originalModule[item2];
|
||||||
let foundFunc = Object.entries(dataStorage[item]._originalModule).find(n => {
|
let foundFunc = Object.entries(dataStorage[item]._originalModule).find(n => {
|
||||||
if (!n || !n[1]) return;
|
if (!n || !n[1]) return;
|
||||||
let funcString = typeof n[1] == "function" ? n[1].toString() : (_ => {try {return JSON.stringify(n[1])}catch(err){return n[1].toString()}})();
|
let funcString = typeof n[1] == "function" ? n[1].toString() : (_ => {try {return JSON.stringify(n[1])}catch(err){return n[1].toString()}})();
|
||||||
return [dataStorage[item].map[item2]].flat(10).filter(s => s && typeof s == "string").every(string => funcString.indexOf(string) > -1);
|
let renderFuncString = typeof n[1].render == "function" && n[1].render.toString() || "";
|
||||||
|
return [dataStorage[item].map[item2]].flat(10).filter(s => s && typeof s == "string").every(string => funcString.indexOf(string) > -1 || renderFuncString.indexOf(string) > -1);
|
||||||
});
|
});
|
||||||
if (foundFunc) {
|
if (foundFunc) {
|
||||||
dataStorage[item]._mappedItems[item2] = foundFunc[0];
|
dataStorage[item]._mappedItems[item2] = foundFunc[0];
|
||||||
return foundFunc[1];
|
return foundFunc[1];
|
||||||
}
|
}
|
||||||
|
return "div";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -8117,6 +8121,23 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CustomComponents.UserMention = reactInitialized && class BDFDB_UserMention extends Internal.LibraryModules.React.Component {
|
||||||
|
render() {
|
||||||
|
let user = this.props.user || Internal.LibraryStores.UserStore.getUser(this.props.userId);
|
||||||
|
let channel = Internal.LibraryStores.ChannelStore.getChannel(this.props.channelId);
|
||||||
|
let guildId = this.props.guildId || channel && channel.guild_id;
|
||||||
|
let mention = BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Clickable, {
|
||||||
|
className: this.props.className,
|
||||||
|
onContextMenu: event => BDFDB.UserUtils.openMenu(user, guildId, event),
|
||||||
|
children: "@" + BDFDB.LibraryModules.UserNameUtils.getName(guildId, this.props.channelId, user)
|
||||||
|
});
|
||||||
|
return this.props.inlinePreview ? mention : BDFDB.ReactUtils.createElement(Internal.LibraryComponents.UserPopoutContainer, Object.assign({}, this.props, {
|
||||||
|
position: Internal.LibraryComponents.PopoutContainer.Positions.RIGHT,
|
||||||
|
children: mention
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const VideoInner = function (props) {
|
const VideoInner = function (props) {
|
||||||
let ref = BDFDB.ReactUtils.useRef(null);
|
let ref = BDFDB.ReactUtils.useRef(null);
|
||||||
BDFDB.ReactUtils.useEffect(_ => {
|
BDFDB.ReactUtils.useEffect(_ => {
|
||||||
|
@ -8167,34 +8188,6 @@ module.exports = (_ => {
|
||||||
|
|
||||||
if (CustomComponents[item]) LibraryComponents[item] = LibraryComponents[item] ? Object.assign({}, LibraryComponents[item], CustomComponents[item]) : CustomComponents[item];
|
if (CustomComponents[item]) LibraryComponents[item] = LibraryComponents[item] ? Object.assign({}, LibraryComponents[item], CustomComponents[item]) : CustomComponents[item];
|
||||||
|
|
||||||
if (InternalData.LibraryComponents[item] && InternalData.LibraryComponents[item].children) {
|
|
||||||
const SubComponents = LibraryComponents[item] && typeof LibraryComponents[item] == "object" ? LibraryComponents[item] : {};
|
|
||||||
const InternalParentData = InternalData.LibraryComponents[item].children;
|
|
||||||
LibraryComponents[item] = new Proxy(SubComponents, {
|
|
||||||
get: function (_, item2) {
|
|
||||||
if (CustomComponents[item] && CustomComponents[item][item2]) return CustomComponents[item][item2];
|
|
||||||
if (SubComponents[item2]) return SubComponents[item2];
|
|
||||||
if (!InternalParentData[item2]) return "div";
|
|
||||||
if (InternalParentData[item2].name) SubComponents[item2] = BDFDB.ModuleUtils.findByName(InternalParentData[item2].name);
|
|
||||||
else if (InternalParentData[item2].strings) SubComponents[item2] = BDFDB.ModuleUtils.findByString(InternalParentData[item2].strings);
|
|
||||||
else if (InternalParentData[item2].props) SubComponents[item2] = BDFDB.ModuleUtils.findByProperties(InternalParentData[item2].props);
|
|
||||||
|
|
||||||
if (InternalParentData[item2].value) SubComponents[item2] = (SubComponents[item2] || {})[InternalParentData[item2].value];
|
|
||||||
if (InternalParentData[item2].assign) SubComponents[item] = Object.assign({}, SubComponents[item2]);
|
|
||||||
if (CustomComponents[item2]) SubComponents[item2] = SubComponents[item2] ? Object.assign({}, SubComponents[item2], CustomComponents[item2]) : CustomComponents[item2];
|
|
||||||
|
|
||||||
const NativeComponent = Internal.NativeSubComponents[item2];
|
|
||||||
if (NativeComponent && typeof NativeComponent != "string") {
|
|
||||||
for (let key in NativeComponent) if (key != "displayName" && key != "name" && (typeof NativeComponent[key] != "function" || key.charAt(0) == key.charAt(0).toUpperCase())) {
|
|
||||||
if (key == "defaultProps") SubComponents[item2][key] = Object.assign({}, SubComponents[item2][key], NativeComponent[key]);
|
|
||||||
else if (!SubComponents[item2][key]) SubComponents[item2][key] = NativeComponent[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return SubComponents[item2] ? SubComponents[item2] : "div";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const NativeComponent = LibraryComponents[item] && Internal.NativeSubComponents[item];
|
const NativeComponent = LibraryComponents[item] && Internal.NativeSubComponents[item];
|
||||||
if (NativeComponent && typeof NativeComponent != "string") {
|
if (NativeComponent && typeof NativeComponent != "string") {
|
||||||
for (let key in NativeComponent) if (key != "displayName" && key != "name" && (typeof NativeComponent[key] != "function" || key.charAt(0) == key.charAt(0).toUpperCase())) {
|
for (let key in NativeComponent) if (key != "displayName" && key != "name" && (typeof NativeComponent[key] != "function" || key.charAt(0) == key.charAt(0).toUpperCase())) {
|
||||||
|
@ -8206,6 +8199,30 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (InternalData.LibraryComponents.Scrollers && Internal.LibraryComponents.Scrollers) {
|
||||||
|
InternalData.LibraryComponents.Scrollers._originalModule = Internal.LibraryComponents.Scrollers;
|
||||||
|
InternalData.LibraryComponents.Scrollers._mappedItems = {};
|
||||||
|
for (let type of Object.keys(Internal.LibraryComponents.Scrollers)) if (Internal.LibraryComponents.Scrollers[type] && typeof Internal.LibraryComponents.Scrollers[type].render == "function") {
|
||||||
|
let scroller = BDFDB.ReactUtils.hookCall(Internal.LibraryComponents.Scrollers[type].render, {});
|
||||||
|
if (scroller && scroller.props && scroller.props.className) {
|
||||||
|
let mappedType = "";
|
||||||
|
switch (scroller.props.className) {
|
||||||
|
case BDFDB.disCN.scrollerthin: mappedType = "Thin"; break;
|
||||||
|
case BDFDB.disCN.scrollerauto: mappedType = "Auto"; break;
|
||||||
|
case BDFDB.disCN.scrollernone: mappedType = "None"; break;
|
||||||
|
}
|
||||||
|
if (mappedType) InternalData.LibraryComponents.Scrollers._mappedItems[mappedType] = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Internal.LibraryComponents.Scrollers = new Proxy(Object.assign({}, InternalData.LibraryComponents.Scrollers._originalModule), {
|
||||||
|
get: function (_, item) {
|
||||||
|
if (InternalData.LibraryComponents.Scrollers._originalModule[item]) return InternalData.LibraryComponents.Scrollers._originalModule[item];
|
||||||
|
if (InternalData.LibraryComponents.Scrollers._mappedItems[item]) return InternalData.LibraryComponents.Scrollers._originalModule[InternalData.LibraryComponents.Scrollers._mappedItems[item]];
|
||||||
|
return "div";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for (let type of Object.keys(RealMenuItems)) {
|
for (let type of Object.keys(RealMenuItems)) {
|
||||||
let children = BDFDB.ObjectUtils.get(BDFDB.ReactUtils.hookCall(Internal.LibraryComponents.Menu, {hideScroller: true, children: BDFDB.ReactUtils.createElement(RealMenuItems[type], {})}), "props.children.props.children.props.children");
|
let children = BDFDB.ObjectUtils.get(BDFDB.ReactUtils.hookCall(Internal.LibraryComponents.Menu, {hideScroller: true, children: BDFDB.ReactUtils.createElement(RealMenuItems[type], {})}), "props.children.props.children.props.children");
|
||||||
let menuItem = (BDFDB.ArrayUtils.is(children) ? children : []).flat(10).filter(n => n)[0];
|
let menuItem = (BDFDB.ArrayUtils.is(children) ? children : []).flat(10).filter(n => n)[0];
|
||||||
|
|
|
@ -456,7 +456,7 @@
|
||||||
}},
|
}},
|
||||||
"Paginator": {"strings": ["totalPageCount", "selectedPage"]},
|
"Paginator": {"strings": ["totalPageCount", "selectedPage"]},
|
||||||
"PanelButton": {"strings": ["Masks.PANEL_BUTTON"]},
|
"PanelButton": {"strings": ["Masks.PANEL_BUTTON"]},
|
||||||
"PopoutFocusLock": {"strings": ["impressionName", "useImperativeHandle"], "funcStrings": ["{}"]},
|
"PopoutFocusLock": {"strings": ["impressionName", "useImperativeHandle"], "funcStrings": ["impressionName"]},
|
||||||
"PrivateChannelItems": {"props": ["DirectMessage", "GroupDM"]},
|
"PrivateChannelItems": {"props": ["DirectMessage", "GroupDM"]},
|
||||||
"PrivateChannelItems": {"strings": ["handleCloseButtonMouseDown", "LEAVE_GROUP_DM_MANAGED_BODY"], "exported": false, "value": "exports", "map": {
|
"PrivateChannelItems": {"strings": ["handleCloseButtonMouseDown", "LEAVE_GROUP_DM_MANAGED_BODY"], "exported": false, "value": "exports", "map": {
|
||||||
"DirectMessage": ["getUser", "getRecipientId"],
|
"DirectMessage": ["getUser", "getRecipientId"],
|
||||||
|
@ -464,13 +464,7 @@
|
||||||
"LinkButton": [".apply(this"]
|
"LinkButton": [".apply(this"]
|
||||||
}},
|
}},
|
||||||
"RoleMention": {"strings": ["rolePopout", "inlinePreview"], "funcStrings": ["inlinePreview"]},
|
"RoleMention": {"strings": ["rolePopout", "inlinePreview"], "funcStrings": ["inlinePreview"]},
|
||||||
"Scrollers": {
|
"Scrollers": {"strings": [".fade", ".auto", "paddingFix", "getScrollerNode"], "exported": false, "value": "exports"},
|
||||||
"children": {
|
|
||||||
"Auto": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerAuto"},
|
|
||||||
"None": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerNone"},
|
|
||||||
"Thin": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerThin"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"SpinnerComponents": {"strings": ["WANDERING_CUBES", "CHASING_DOTS"], "exported": false, "value": "exports", "map": {
|
"SpinnerComponents": {"strings": ["WANDERING_CUBES", "CHASING_DOTS"], "exported": false, "value": "exports", "map": {
|
||||||
"Spinner": ["LOADING"],
|
"Spinner": ["LOADING"],
|
||||||
"Types": ["WANDERING_CUBES", "CHASING_DOTS"]
|
"Types": ["WANDERING_CUBES", "CHASING_DOTS"]
|
||||||
|
@ -487,11 +481,10 @@
|
||||||
"UserBadges": [".PROFILE_USER_BADGES"],
|
"UserBadges": [".PROFILE_USER_BADGES"],
|
||||||
"Sizes": ["\"SIZE_24\":"]
|
"Sizes": ["\"SIZE_24\":"]
|
||||||
}},
|
}},
|
||||||
"UserMention": {"strings": [".inlinePreview", "renderPopout", ".openContextMenu", ".isMobile"]},
|
"UserPopout": {"strings": ["canViewThemes?", "Unexpected missing user"], "funcStrings": ["canViewThemes"]},
|
||||||
"UserPopout": {"name": "UserPopoutContainer"},
|
"UserPopoutSection": {"strings": [".section,", ".lastSection"]},
|
||||||
"UserPopoutSection": {"name": "UserPopoutSection"},
|
"UserSummaryItem": {"strings": ["popoutUserId:", ".clickableAvatar"]},
|
||||||
"UserSummaryItem": {"name": "UserSummaryItem"},
|
"VideoForwardRef": {"strings": ["HTMLSourceElement", "autoPlay"], "funcStrings": ["externalRef"]}
|
||||||
"VideoForwardRef": {"strings": ["displayName=\"Video\"", "\"video\"", "HTMLImageElement"], "value": "default"}
|
|
||||||
},
|
},
|
||||||
"SvgIcons": {
|
"SvgIcons": {
|
||||||
"ACTIVITY": {
|
"ACTIVITY": {
|
||||||
|
|
Loading…
Reference in New Issue