this repo has no description

Merge branch 'develop' into mb-ctx-sub

Changed files
+232 -194
packages
core
src
core-extensions
src
common
contextMenu
disableSentry
moonbase
noTrack
quietLoggers
settings
spacepack
webpackModules
types
src
coreExtensions
+1 -4
packages/core-extensions/src/common/index.ts
···
},
flux: {
-
dependencies: [
-
{ ext: "spacepack", id: "spacepack" },
-
"useStateFromStores:function"
-
]
},
fluxDispatcher: {
···
},
flux: {
+
dependencies: [{ ext: "spacepack", id: "spacepack" }, "connectStores:"]
},
fluxDispatcher: {
+19 -4
packages/core-extensions/src/common/webpackModules/components.ts
···
const Components = spacepack.findByCode("MasonryList:function")[0].exports;
const MarkdownParser = spacepack.findByCode(
"parseAutoModerationSystemMessage:"
-
)[0].exports.default;
const LegacyText = spacepack.findByCode(".selectable", ".colorStandard")[0]
.exports.default;
-
const Flex = spacepack.findByCode(".flex" + "GutterSmall,")[0].exports.Flex;
-
const CardClasses = spacepack.findByCode("card", "cardHeader", "inModal")[0]
-
.exports;
const ControlClasses = spacepack.findByCode(
"title",
"titleDefault",
···
const Components = spacepack.findByCode("MasonryList:function")[0].exports;
const MarkdownParser = spacepack.findByCode(
"parseAutoModerationSystemMessage:"
+
)[0].exports.Z;
const LegacyText = spacepack.findByCode(".selectable", ".colorStandard")[0]
.exports.default;
+
const Flex = Object.values(
+
spacepack.findByCode(".flex" + "GutterSmall,")[0].exports
+
)[0];
+
+
const CardClasses = {};
+
spacepack
+
.lazyLoad(
+
"renderArtisanalHack",
+
/\[(?:.\.e\("\d+?"\),?)+\][^}]+?webpackId:\d+,name:"ChannelSettings"/,
+
/webpackId:(\d+),name:"ChannelSettings"/
+
)
+
.then(() =>
+
Object.assign(
+
CardClasses,
+
spacepack.findByExports("card", "cardHeader", "inModal")[0].exports
+
)
+
);
+
const ControlClasses = spacepack.findByCode(
"title",
"titleDefault",
+26 -4
packages/core-extensions/src/common/webpackModules/flux.ts
···
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
-
module.exports = spacepack.findByCode(
-
["useStateFromStores", ":function"].join(""),
-
"Store:"
-
)[0].exports;
···
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
+
const mod = spacepack.findByCode("connectStores:")[0].exports;
+
+
const useStateFromStores = spacepack.findFunctionByStrings(
+
mod,
+
'"useStateFromStores"'
+
)!;
+
+
module.exports = {
+
BatchedStoreListener: spacepack.findFunctionByStrings(
+
mod,
+
" tried to load a non-existent store."
+
),
+
Dispatcher: spacepack.findFunctionByStrings(mod, "_dispatchWithDevtools("),
+
Store: spacepack.findFunctionByStrings(mod, "registerActionHandlers("),
+
default: mod.ZP,
+
statesWillNeverBeEqual: spacepack.findFunctionByStrings(mod, "return!1"),
+
useStateFromStores,
+
useStateFromStoresArray: spacepack.findFunctionByStrings(
+
mod,
+
new RegExp(`return ${useStateFromStores.name}\\(.+?\\.[^Z]\\)`)
+
),
+
useStateFromStoresObject: spacepack.findFunctionByStrings(
+
mod,
+
new RegExp(`return ${useStateFromStores.name}\\(.+?\\.Z\\)`)
+
)
+
};
+1 -1
packages/core-extensions/src/common/webpackModules/fluxDispatcher.ts
···
module.exports = spacepack.findByExports(
"isDispatching",
"dispatch"
-
)[0].exports.default;
···
module.exports = spacepack.findByExports(
"isDispatching",
"dispatch"
+
)[0].exports.Z;
+4 -1
packages/core-extensions/src/contextMenu/index.tsx
···
export const webpackModules: Record<string, ExtensionWebpackModule> = {
contextMenu: {
-
dependencies: [{ ext: "spacepack", id: "spacepack" }, "MenuGroup:"]
},
evilMenu: {
dependencies: [
···
export const webpackModules: Record<string, ExtensionWebpackModule> = {
contextMenu: {
+
dependencies: [
+
{ ext: "spacepack", id: "spacepack" },
+
"Menu API only allows Items and groups of Items as children."
+
]
},
evilMenu: {
dependencies: [
+31 -4
packages/core-extensions/src/contextMenu/webpackModules/contextMenu.ts
···
return el;
}
-
const MenuElements = spacepack.findByCode("return null", "MenuGroup:")[0]
-
.exports;
-
module.exports = {
-
...MenuElements,
addItem,
_patchMenu,
_saveProps
};
···
return el;
}
module.exports = {
addItem,
_patchMenu,
_saveProps
};
+
+
// Unmangle Menu elements
+
const code =
+
spacepack.require.m[
+
spacepack.findByCode(
+
"Menu API only allows Items and groups of Items as children."
+
)[0].id
+
].toString();
+
+
let MangledMenu;
+
+
const typeRegex = /if\(.\.type===(.)\.(.+?)\).+?type:"(.+?)"/g;
+
const typeMap: Record<string, string | undefined> = {
+
checkbox: "MenuCheckboxItem",
+
control: "MenuControlItem",
+
groupstart: "MenuGroup",
+
customitem: "MenuItem",
+
radio: "MenuRadioItem",
+
separator: "MenuSeparator"
+
};
+
+
for (const [, modIdent, mangled, type] of code.matchAll(typeRegex)) {
+
if (!MangledMenu) {
+
const modId = code.match(new RegExp(`${modIdent}=.\\((\\d+?)\\)`))![1];
+
MangledMenu = spacepack.require(modId);
+
}
+
+
const prop = typeMap[type];
+
if (!prop) continue;
+
module.exports[prop] = MangledMenu[mangled];
+
}
+5 -1
packages/core-extensions/src/contextMenu/webpackModules/evilMenu.ts
···
);
const exp: any = {};
mod({}, exp, require);
module.exports = (el: any) => {
-
return exp.Menu({
children: el,
__contextMenu_evilMenu: true
});
···
);
const exp: any = {};
mod({}, exp, require);
+
const Menu = spacepack.findFunctionByStrings(
+
exp,
+
"Menu API only allows Items and groups of Items as children."
+
)!;
module.exports = (el: any) => {
+
return Menu({
children: el,
__contextMenu_evilMenu: true
});
+3 -1
packages/core-extensions/src/disableSentry/host.ts
···
{
urls: [
"https://*.sentry.io/*",
-
"https://*.discord.com/error-reporting-proxy/*"
]
},
function (details, callback) {
···
{
urls: [
"https://*.sentry.io/*",
+
"https://*.discord.com/error-reporting-proxy/*",
+
"https://discord.com/assets/sentry.*.js",
+
"https://*.discord.com/assets/sentry.*.js"
]
},
function (details, callback) {
+4 -12
packages/core-extensions/src/disableSentry/index.ts
···
export const patches: Patch[] = [
{
-
find: "DSN:function",
replace: {
type: PatchReplaceType.Normal,
-
match: /(?<=\.default=){.+?}}/,
replacement: 'require("disableSentry_stub").proxy()'
}
},
···
find: "window.DiscordSentry.addBreadcrumb",
replace: {
type: PatchReplaceType.Normal,
-
match: /default:function\(\){return .}/,
replacement:
'default:function(){return (...args)=>{moonlight.getLogger("disableSentry").debug("Sentry calling addBreadcrumb passthrough:", ...args);}}'
}
},
{
-
find: "initSentry:function",
-
replace: {
-
type: PatchReplaceType.Normal,
-
match: /initSentry:function\(\){return .}/,
-
replacement: "default:function(){return ()=>{}}"
-
}
-
},
-
{
find: "window.DiscordErrors=",
replace: {
type: PatchReplaceType.Normal,
-
match: /\(0,.\.usesClientMods\)\(\)/,
replacement: "false"
}
}
···
export const patches: Patch[] = [
{
+
find: "profiledRootComponent:",
replace: {
type: PatchReplaceType.Normal,
+
match: /(?<=\.Z=){.+?}}/,
replacement: 'require("disableSentry_stub").proxy()'
}
},
···
find: "window.DiscordSentry.addBreadcrumb",
replace: {
type: PatchReplaceType.Normal,
+
match: /Z:function\(\){return .}/,
replacement:
'default:function(){return (...args)=>{moonlight.getLogger("disableSentry").debug("Sentry calling addBreadcrumb passthrough:", ...args);}}'
}
},
{
find: "window.DiscordErrors=",
replace: {
type: PatchReplaceType.Normal,
+
match: /(?<=uses_client_mods:)./,
replacement: "false"
}
}
+2 -7
packages/core-extensions/src/moonbase/index.tsx
···
import { ExtensionWebExports } from "@moonlight-mod/types";
-
import { CircleXIconSVG, DownloadIconSVG, TrashIconSVG } from "./types";
-
export const webpackModules: ExtensionWebExports["webpackModules"] = {
stores: {
dependencies: [
···
{ ext: "common", id: "react" },
{ ext: "common", id: "components" },
{ ext: "moonbase", id: "stores" },
-
DownloadIconSVG,
-
TrashIconSVG,
-
CircleXIconSVG,
"Masks.PANEL_BUTTON",
-
"removeButtonContainer:",
'"Missing channel in Channel.openChannelContextMenu"',
-
".default.HEADER_BAR"
]
},
···
import { ExtensionWebExports } from "@moonlight-mod/types";
export const webpackModules: ExtensionWebExports["webpackModules"] = {
stores: {
dependencies: [
···
{ ext: "common", id: "react" },
{ ext: "common", id: "components" },
{ ext: "moonbase", id: "stores" },
"Masks.PANEL_BUTTON",
+
"renderArtisanalHack(){",
'"Missing channel in Channel.openChannelContextMenu"',
+
".forumOrHome]:"
]
},
-15
packages/core-extensions/src/moonbase/types.ts
···
import { DetectedExtension, ExtensionManifest } from "types/src";
-
export const DownloadIconSVG =
-
"M12 2a1 1 0 0 1 1 1v10.59l3.3-3.3a1 1 0 1 1 1.4 1.42l-5 5a1 1 0 0 1-1.4 0l-5-5a1 1 0 1 1 1.4-1.42l3.3 3.3V3a1 1 0 0 1 1-1ZM3 20a1 1 0 1 0 0 2h18a1 1 0 1 0 0-2H3Z";
-
export const TrashIconSVG =
-
"M5 6.99902V18.999C5 20.101 5.897 20.999 7 20.999H17C18.103 20.999 19 20.101 19 18.999V6.99902H5ZM11 17H9V11H11V17ZM15 17H13V11H15V17Z";
-
export const CircleXIconSVG =
-
"M7.02799 0.333252C3.346 0.333252 0.361328 3.31792 0.361328 6.99992C0.361328 10.6819 3.346 13.6666 7.02799 13.6666C10.71 13.6666 13.6947 10.6819 13.6947 6.99992C13.6947 3.31792 10.7093 0.333252 7.02799 0.333252ZM10.166 9.19525L9.22333 10.1379L7.02799 7.94325L4.83266 10.1379L3.89 9.19525L6.08466 6.99992L3.88933 4.80459L4.832 3.86259L7.02733 6.05792L9.22266 3.86259L10.1653 4.80459L7.97066 6.99992L10.166 9.19525Z";
-
export const DangerIconSVG =
-
"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm1.44-15.94L13.06 14a1.06 1.06 0 0 1-2.12 0l-.38-6.94a1 1 0 0 1 1-1.06h.88a1 1 0 0 1 1 1.06Zm-.19 10.69a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z";
-
export const ChevronSmallDownIconSVG =
-
"M16.59 8.59003L12 13.17L7.41 8.59003L6 10L12 16L18 10L16.59 8.59003Z";
-
export const ChevronSmallUpIconSVG =
-
"M7.41 16.0001L12 11.4201L16.59 16.0001L18 14.5901L12 8.59006L6 14.5901L7.41 16.0001Z";
-
export const ArrowsUpDownIconSVG =
-
"M3.81962 11.3333L3.81962 1.33325L5.52983 1.33325L5.52985 11.3333L7.46703 9.36658L8.66663 10.5916L4.67068 14.6666L0.666626 10.5916L1.86622 9.34158L3.81962 11.3333Z";
-
export type MoonbaseNatives = {
fetchRepositories(
repos: string[]
···
import { DetectedExtension, ExtensionManifest } from "types/src";
export type MoonbaseNatives = {
fetchRepositories(
repos: string[]
+5 -3
packages/core-extensions/src/moonbase/webpackModules/moonbase.tsx
···
import { MenuItem } from "@moonlight-mod/wp/common_components";
const { open } = spacepack.findByExports("setSection", "clearSubsection")[0]
-
.exports.default;
settings.addSection("moonbase", "Moonbase", Moonbase, null, -2, {
stores: [MoonbaseSettingsStore],
element: () => {
// Require it here because lazy loading SUX
-
const SettingsNotice =
-
spacepack.findByCode("onSaveButtonColor")[0].exports.default;
return (
<SettingsNotice
submitting={MoonbaseSettingsStore.submitting}
···
import { MenuItem } from "@moonlight-mod/wp/common_components";
const { open } = spacepack.findByExports("setSection", "clearSubsection")[0]
+
.exports.Z;
settings.addSection("moonbase", "Moonbase", Moonbase, null, -2, {
stores: [MoonbaseSettingsStore],
element: () => {
// Require it here because lazy loading SUX
+
const SettingsNotice = spacepack.findByCode(
+
"onSaveButtonColor",
+
"FocusRingScope"
+
)[0].exports.Z;
return (
<SettingsNotice
submitting={MoonbaseSettingsStore.submitting}
+15 -4
packages/core-extensions/src/moonbase/webpackModules/ui/config/index.tsx
···
import { LogLevel } from "@moonlight-mod/types";
-
import { CircleXIconSVG } from "../../../types";
const logLevels = Object.values(LogLevel).filter(
(v) => typeof v === "string"
···
Tooltip,
Clickable
} from "@moonlight-mod/wp/common_components";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
const FormClasses = spacepack.findByCode("dividerDefault:")[0].exports;
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
-
const RemoveButtonClasses = spacepack.findByCode("removeButtonContainer")[0]
-
.exports;
-
const CircleXIcon = spacepack.findByCode(CircleXIconSVG)[0].exports.default;
function RemoveEntryButton({ onClick }: { onClick: () => void }) {
return (
<div className={RemoveButtonClasses.removeButtonContainer}>
···
import { LogLevel } from "@moonlight-mod/types";
const logLevels = Object.values(LogLevel).filter(
(v) => typeof v === "string"
···
Tooltip,
Clickable
} from "@moonlight-mod/wp/common_components";
+
import CommonComponents from "@moonlight-mod/wp/common_components";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
const FormClasses = spacepack.findByCode("dividerDefault:")[0].exports;
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
+
let RemoveButtonClasses: any;
+
spacepack
+
.lazyLoad(
+
"renderArtisanalHack",
+
/\[(?:.\.e\("\d+?"\),?)+\][^}]+?webpackId:\d+,name:"GuildSettings"/,
+
/webpackId:(\d+),name:"GuildSettings"/
+
)
+
.then(
+
() =>
+
(RemoveButtonClasses = spacepack.findByCode("removeButtonContainer")[0]
+
.exports)
+
);
+
+
const { CircleXIcon } = CommonComponents;
function RemoveEntryButton({ onClick }: { onClick: () => void }) {
return (
<div className={RemoveButtonClasses.removeButtonContainer}>
+36 -50
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/card.tsx
···
-
import {
-
DangerIconSVG,
-
DownloadIconSVG,
-
ExtensionState,
-
TrashIconSVG
-
} from "../../../types";
import { ExtensionLoadSource } from "@moonlight-mod/types";
import React from "@moonlight-mod/wp/common_react";
···
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
-
const UserProfileClasses = spacepack.findByCode(
-
"tabBarContainer",
-
"topSection"
-
)[0].exports;
-
-
const DownloadIcon =
-
spacepack.findByCode(DownloadIconSVG)[0].exports.DownloadIcon;
-
const TrashIcon = spacepack.findByCode(TrashIconSVG)[0].exports.default;
-
const DangerIcon =
-
spacepack.findByCode(DangerIconSVG)[0].exports.CircleExclamationPointIcon;
-
const PanelButton =
-
spacepack.findByCode("Masks.PANEL_BUTTON")[0].exports.default;
export default function ExtensionCard({ uniqueId }: { uniqueId: number }) {
const [tab, setTab] = React.useState(ExtensionPage.Info);
···
{restartNeeded && (
<PanelButton
icon={() => (
-
<DangerIcon
color={CommonComponents.tokens.colors.STATUS_DANGER}
/>
)}
···
</Flex>
</div>
-
<div className={UserProfileClasses.body}>
{(description != null || settings != null) && (
-
<div
-
className={UserProfileClasses.tabBarContainer}
style={{
-
padding: "0 10px"
}}
>
-
<TabBar
-
selectedItem={tab}
-
type="top"
-
onItemSelect={setTab}
-
className={UserProfileClasses.tabBar}
>
<TabBar.Item
-
className={UserProfileClasses.tabBarItem}
-
id={ExtensionPage.Info}
>
-
Info
</TabBar.Item>
-
{description != null && (
-
<TabBar.Item
-
className={UserProfileClasses.tabBarItem}
-
id={ExtensionPage.Description}
-
>
-
Description
-
</TabBar.Item>
-
)}
-
-
{settings != null && (
-
<TabBar.Item
-
className={UserProfileClasses.tabBarItem}
-
id={ExtensionPage.Settings}
-
>
-
Settings
-
</TabBar.Item>
-
)}
-
</TabBar>
-
</div>
)}
<Flex
···
+
import { ExtensionState } from "../../../types";
import { ExtensionLoadSource } from "@moonlight-mod/types";
import React from "@moonlight-mod/wp/common_react";
···
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
+
const { DownloadIcon, TrashIcon, CircleWarningIcon } = CommonComponents;
+
const PanelButton = spacepack.findByCode("Masks.PANEL_BUTTON")[0].exports.Z;
+
const TabBarClasses = spacepack.findByExports(
+
"tabBar",
+
"tabBarItem",
+
"headerContentWrapper"
+
)[0].exports;
export default function ExtensionCard({ uniqueId }: { uniqueId: number }) {
const [tab, setTab] = React.useState(ExtensionPage.Info);
···
{restartNeeded && (
<PanelButton
icon={() => (
+
<CircleWarningIcon
color={CommonComponents.tokens.colors.STATUS_DANGER}
/>
)}
···
</Flex>
</div>
+
<div>
{(description != null || settings != null) && (
+
<TabBar
+
selectedItem={tab}
+
type="top"
+
onItemSelect={setTab}
+
className={TabBarClasses.tabBar}
style={{
+
padding: "0 20px"
}}
>
+
<TabBar.Item
+
className={TabBarClasses.tabBarItem}
+
id={ExtensionPage.Info}
>
+
Info
+
</TabBar.Item>
+
+
{description != null && (
<TabBar.Item
+
className={TabBarClasses.tabBarItem}
+
id={ExtensionPage.Description}
>
+
Description
</TabBar.Item>
+
)}
+
{settings != null && (
+
<TabBar.Item
+
className={TabBarClasses.tabBarItem}
+
id={ExtensionPage.Settings}
+
>
+
Settings
+
</TabBar.Item>
+
)}
+
</TabBar>
)}
<Flex
+26 -40
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/filterBar.tsx
···
import { tagNames } from "./info";
-
import {
-
ArrowsUpDownIconSVG,
-
ChevronSmallDownIconSVG,
-
ChevronSmallUpIconSVG
-
} from "../../../types";
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
import React from "@moonlight-mod/wp/common_react";
···
MenuCheckboxItem,
MenuItem
} from "@moonlight-mod/wp/common_components";
export enum Filter {
Core = 1 << 0,
···
}
export const defaultFilter = ~(~0 << 7);
-
const modPromise = spacepack.lazyLoad(
-
'"Missing channel in Channel.openChannelContextMenu"',
-
/e\("(\d+)"\)/g,
-
/webpackId:"(.+?)"/
-
);
-
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
const SortMenuClasses = spacepack.findByCode("container:", "clearText:")[0]
.exports;
-
const FilterDialogClasses = spacepack.findByCode(
-
"countContainer:",
-
"tagContainer:"
-
)[0].exports;
-
const FilterBarClasses = spacepack.findByCode("tagsButtonWithCount:")[0]
-
.exports;
const TagItem = spacepack.findByCode(".FORUM_TAG_A11Y_FILTER_BY_TAG")[0].exports
-
.default;
-
const ChevronSmallDownIcon = spacepack.findByCode(ChevronSmallDownIconSVG)[0]
-
.exports.default;
-
const ChevronSmallUpIcon = spacepack.findByCode(ChevronSmallUpIconSVG)[0]
-
.exports.default;
-
let ArrowsUpDownIcon: React.FunctionComponent;
function toggleTag(
selectedTags: Set<string>,
···
);
}
-
function FilterBar({
filter,
setFilter,
selectedTags,
···
className={FilterBarClasses.sortDropdown}
innerClassName={FilterBarClasses.sortDropdownInner}
>
-
<ArrowsUpDownIcon />
<Text
className={FilterBarClasses.sortDropdownText}
variant="text-sm/medium"
···
Sort & filter
</Text>
{isShown ? (
-
<ChevronSmallUpIcon size={20} />
) : (
-
<ChevronSmallDownIcon size={20} />
)}
</Button>
)}
···
<>All</>
)}
{isShown ? (
-
<ChevronSmallUpIcon size={20} />
) : (
-
<ChevronSmallDownIcon size={20} />
)}
</Button>
)}
···
</div>
);
}
-
-
// TODO: spacepack lazy loading utils
-
export default React.lazy(() =>
-
modPromise.then(async () => {
-
await modPromise;
-
ArrowsUpDownIcon ??=
-
spacepack.findByCode(ArrowsUpDownIconSVG)[0].exports.default;
-
-
return { default: FilterBar };
-
})
-
);
···
import { tagNames } from "./info";
import spacepack from "@moonlight-mod/wp/spacepack_spacepack";
import React from "@moonlight-mod/wp/common_react";
···
MenuCheckboxItem,
MenuItem
} from "@moonlight-mod/wp/common_components";
+
import CommonComponents from "@moonlight-mod/wp/common_components";
export enum Filter {
Core = 1 << 0,
···
}
export const defaultFilter = ~(~0 << 7);
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
const SortMenuClasses = spacepack.findByCode("container:", "clearText:")[0]
.exports;
+
+
let FilterDialogClasses: any;
+
let FilterBarClasses: any;
+
spacepack
+
.lazyLoad(
+
'"Missing channel in Channel.openChannelContextMenu"',
+
/e\("(\d+)"\)/g,
+
/webpackId:(\d+?),/
+
)
+
.then(() => {
+
FilterBarClasses = spacepack.findByCode("tagsButtonWithCount:")[0].exports;
+
FilterDialogClasses = spacepack.findByCode(
+
"countContainer:",
+
"tagContainer:"
+
)[0].exports;
+
});
const TagItem = spacepack.findByCode(".FORUM_TAG_A11Y_FILTER_BY_TAG")[0].exports
+
.Z;
+
const { ChevronSmallDownIcon, ChevronSmallUpIcon, ArrowsUpDownIcon } =
+
CommonComponents;
function toggleTag(
selectedTags: Set<string>,
···
);
}
+
export default function FilterBar({
filter,
setFilter,
selectedTags,
···
className={FilterBarClasses.sortDropdown}
innerClassName={FilterBarClasses.sortDropdownInner}
>
+
<ArrowsUpDownIcon size="xs" />
<Text
className={FilterBarClasses.sortDropdownText}
variant="text-sm/medium"
···
Sort & filter
</Text>
{isShown ? (
+
<ChevronSmallUpIcon size={"custom"} width={20} />
) : (
+
<ChevronSmallDownIcon size={"custom"} width={20} />
)}
</Button>
)}
···
<>All</>
)}
{isShown ? (
+
<ChevronSmallUpIcon size={"custom"} width={20} />
) : (
+
<ChevronSmallDownIcon size={"custom"} width={20} />
)}
</Button>
)}
···
</div>
);
}
+9 -11
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/index.tsx
···
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
-
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
-
const SearchBar = spacepack.findByCode("Messages.SEARCH", "hideSearchIcon")[0]
-
.exports.SearchBar;
export default function ExtensionsPage() {
const moonbaseId = MoonbaseSettingsStore.getExtensionUniqueId("moonbase")!;
···
spellCheck: "false"
}}
/>
-
<React.Suspense fallback={<div className={Margins.marginBottom20}></div>}>
-
<FilterBar
-
filter={filter}
-
setFilter={setFilter}
-
selectedTags={selectedTags}
-
setSelectedTags={setSelectedTags}
-
/>
-
</React.Suspense>
{filtered.map((ext) => (
<ExtensionCard uniqueId={ext.uniqueId} key={ext.id} />
))}
···
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
+
const SearchBar: any = Object.values(
+
spacepack.findByCode("Messages.SEARCH", "hideSearchIcon")[0].exports
+
)[0];
export default function ExtensionsPage() {
const moonbaseId = MoonbaseSettingsStore.getExtensionUniqueId("moonbase")!;
···
spellCheck: "false"
}}
/>
+
<FilterBar
+
filter={filter}
+
setFilter={setFilter}
+
selectedTags={selectedTags}
+
setSelectedTags={setSelectedTags}
+
/>
{filtered.map((ext) => (
<ExtensionCard uniqueId={ext.uniqueId} key={ext.id} />
))}
+2 -6
packages/core-extensions/src/moonbase/webpackModules/ui/extensions/settings.tsx
···
SelectSettingType
} from "@moonlight-mod/types/config";
-
import {
-
CircleXIconSVG,
-
ExtensionState,
-
MoonbaseExtension
-
} from "../../../types";
import React from "@moonlight-mod/wp/common_react";
import CommonComponents from "@moonlight-mod/wp/common_components";
···
const RemoveButtonClasses = spacepack.findByCode("removeButtonContainer")[0]
.exports;
-
const CircleXIcon = spacepack.findByCode(CircleXIconSVG)[0].exports.default;
function RemoveEntryButton({
onClick,
disabled
···
SelectSettingType
} from "@moonlight-mod/types/config";
+
import { ExtensionState, MoonbaseExtension } from "../../../types";
import React from "@moonlight-mod/wp/common_react";
import CommonComponents from "@moonlight-mod/wp/common_components";
···
const RemoveButtonClasses = spacepack.findByCode("removeButtonContainer")[0]
.exports;
+
const CircleXIcon = CommonComponents.CircleXIcon;
function RemoveEntryButton({
onClick,
disabled
+2 -3
packages/core-extensions/src/moonbase/webpackModules/ui/index.tsx
···
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
-
const { Divider } = spacepack.findByCode(".default.HEADER_BAR")[0].exports
-
.default;
const TitleBarClasses = spacepack.findByCode("iconWrapper:", "children:")[0]
.exports;
const TabBarClasses = spacepack.findByCode("nowPlayingColumn:")[0].exports;
const { setSection, clearSubsection } = spacepack.findByExports(
"setSection",
"clearSubsection"
-
)[0].exports.default;
export const pages: {
id: string;
···
const Margins = spacepack.findByCode("marginCenterHorz:")[0].exports;
+
const { Divider } = spacepack.findByCode(".forumOrHome]:")[0].exports.Z;
const TitleBarClasses = spacepack.findByCode("iconWrapper:", "children:")[0]
.exports;
const TabBarClasses = spacepack.findByCode("nowPlayingColumn:")[0].exports;
const { setSection, clearSubsection } = spacepack.findByExports(
"setSection",
"clearSubsection"
+
)[0].exports.Z;
export const pages: {
id: string;
+1 -1
packages/core-extensions/src/noTrack/index.ts
···
{
find: "analyticsTrackingStoreMaker:function",
replace: {
-
match: /analyticsTrackingStoreMaker:function\(\){return .}/,
replacement: "analyticsTrackingStoreMaker:function(){return ()=>{}}"
}
},
···
{
find: "analyticsTrackingStoreMaker:function",
replace: {
+
match: /analyticsTrackingStoreMaker:function\(\){return .+?}/,
replacement: "analyticsTrackingStoreMaker:function(){return ()=>{}}"
}
},
+6 -6
packages/core-extensions/src/quietLoggers/index.ts
···
{
find: '"./ggsans-800-extrabolditalic.woff2":',
replace: {
-
match: /\.then\(function\(\){var.+?"MODULE_NOT_FOUND",.\}\)/,
-
replacement: ".then(()=>(()=>{}))"
}
},
{
···
['="RunningGameStore"', /.\.info\("games",{.+?}\),/],
[
'"[BUILD INFO] Release Channel: "',
-
/new .{1,2}\.default\(\)\.log\("\[BUILD INFO\] Release Channel: ".+?"\)\),/
],
[
-
'.AnalyticEvents.APP_NATIVE_CRASH,"Storage"',
/console\.log\("AppCrashedFatalReport lastCrash:",.,.\);/
],
[
-
'.AnalyticEvents.APP_NATIVE_CRASH,"Storage"',
'console.log("AppCrashedFatalReport: getLastCrash not supported.");'
],
-
['"[NATIVE INFO] ', /new .{1,2}\.default\(\)\.log\("\[NATIVE INFO] .+?\)\),/],
['"Spellchecker"', /.\.info\("Switching to ".+?"\(unavailable\)"\);?/g],
[
'throw Error("Messages are still loading.");',
···
{
find: '"./ggsans-800-extrabolditalic.woff2":',
replace: {
+
match: /throw .+?,./,
+
replacement: "return{}"
}
},
{
···
['="RunningGameStore"', /.\.info\("games",{.+?}\),/],
[
'"[BUILD INFO] Release Channel: "',
+
/new .{1,2}\.Z\(\)\.log\("\[BUILD INFO\] Release Channel: ".+?"\)\),/
],
[
+
'.APP_NATIVE_CRASH,"Storage"',
/console\.log\("AppCrashedFatalReport lastCrash:",.,.\);/
],
[
+
'.APP_NATIVE_CRASH,"Storage"',
'console.log("AppCrashedFatalReport: getLastCrash not supported.");'
],
+
['"[NATIVE INFO] ', /new .{1,2}\.Z\(\)\.log\("\[NATIVE INFO] .+?\)\);/],
['"Spellchecker"', /.\.info\("Switching to ".+?"\(unavailable\)"\);?/g],
[
'throw Error("Messages are still loading.");',
+5 -5
packages/core-extensions/src/settings/index.ts
···
export const patches: Patch[] = [
{
-
find: ".useUnseenOutboundPromotions)().length",
replace: {
-
match: /(\.push\(.+?\)}\)\)}\),)(.)}/,
-
replacement: (_, orig, sections) =>
-
`${orig}require("settings_settings").Settings._mutateSections(${sections})}`
}
},
{
···
match: /children:\[(.)\.map\(.+?\),children:.\((.)\)/,
replacement: (orig, sections, section) =>
`${orig.replace(
-
/Object\.values\(.\.UserSettingsSections\)/,
(orig) =>
`[...require("settings_settings").Settings.sectionNames,...${orig}]`
)}??${sections}.find(x=>x.section==${section})?._moonlight_submenu?.()`
···
export const patches: Patch[] = [
{
+
find: '"useGenerateUserSettingsSections"',
replace: {
+
match: /(?<=\.push\(.+?\)}\)\)}\),)./,
+
replacement: (sections: string) =>
+
`require("settings_settings").Settings._mutateSections(${sections})`
}
},
{
···
match: /children:\[(.)\.map\(.+?\),children:.\((.)\)/,
replacement: (orig, sections, section) =>
`${orig.replace(
+
/Object\.values\(.\..+?\)/,
(orig) =>
`[...require("settings_settings").Settings.sectionNames,...${orig}]`
)}??${sections}.find(x=>x.section==${section})?._moonlight_submenu?.()`
+11 -5
packages/core-extensions/src/spacepack/webpackModules/spacepack.ts
···
chunk: RegExp,
module: RegExp
) => {
-
if (!chunk.flags.includes("g"))
-
return Promise.reject("Chunk ID regex must be global");
-
const mod = Array.isArray(find)
? spacepack.findByCode(...find)
: spacepack.findByCode(find);
···
const findId = mod[0].id;
const findCode = webpackRequire.m[findId].toString().replace(/\n/g, "");
-
const chunkIds = [...findCode.matchAll(chunk)].map(([, id]) => id);
-
if (chunkIds.length === 0) return Promise.reject("Chunk ID match failed");
const moduleId = findCode.match(module)?.[1];
if (!moduleId) return Promise.reject("Module ID match failed");
···
chunk: RegExp,
module: RegExp
) => {
const mod = Array.isArray(find)
? spacepack.findByCode(...find)
: spacepack.findByCode(find);
···
const findId = mod[0].id;
const findCode = webpackRequire.m[findId].toString().replace(/\n/g, "");
+
let chunkIds;
+
if (chunk.flags.includes("g")) {
+
chunkIds = [...findCode.matchAll(chunk)].map(([, id]) => id);
+
} else {
+
const match = findCode.match(chunk);
+
if (match)
+
chunkIds = [...match[0].matchAll(/"(\d+)"/g)].map(([, id]) => id);
+
}
+
+
if (!chunkIds || chunkIds.length === 0)
+
return Promise.reject("Chunk ID match failed");
const moduleId = findCode.match(module)?.[1];
if (!moduleId) return Promise.reject("Module ID match failed");
+17 -6
packages/core/src/patch.ts
···
}
});
-
registerWebpackModule({
-
ext: "moonlight",
-
id: "fix_rspack_init_modules",
-
entrypoint: true,
-
run: function (module, exports, require) {
-
patchModules(require.m);
}
});
}
···
}
});
+
Object.defineProperty(Function.prototype, "m", {
+
configurable: true,
+
set(modules: any) {
+
const { stack } = new Error();
+
if (stack!.includes("/assets/") && !Array.isArray(modules)) {
+
patchModules(modules);
+
if (!window.webpackChunkdiscord_app)
+
window.webpackChunkdiscord_app = [];
+
injectModules(modules);
+
}
+
+
Object.defineProperty(this, "m", {
+
value: modules,
+
configurable: true,
+
enumerable: true,
+
writable: true
+
});
}
});
}
+1
packages/types/src/coreExtensions/components.ts
···
// TODO: wtaf is up with react types not working in jsx
export type CommonComponents = {
Clickable: ComponentClass<
PropsWithChildren<{
onClick?: () => void;
···
// TODO: wtaf is up with react types not working in jsx
export type CommonComponents = {
+
[index: string]: any;
Clickable: ComponentClass<
PropsWithChildren<{
onClick?: () => void;