Skip to content

Commit

Permalink
Merge pull request #204 from moonlight-mod/components-crisis
Browse files Browse the repository at this point in the history
  • Loading branch information
Cynosphere authored Jan 28, 2025
2 parents b2dd5b8 + 4220ee1 commit 027f865
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 687 deletions.
4 changes: 2 additions & 2 deletions packages/core-extensions/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export const patches: Patch[] = [
replace: [
// inject commands
{
match: /return (\i)=\i/,
match: /return (\i)\.filter/,
replacement: (orig, commands) =>
`${commands}=[...${commands},...require("commands_commands").default._getCommands()];${orig}`
`return [...${commands},...require("commands_commands").default._getCommands()].filter`
},

// section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let code =

const parserSym = code.match(/(?<=_patchMenu\(.,).+?(?=\()/)![0];

code = code.replace(/(?<=function\(\){return ).(?=})/, parserSym);
code = code.replace(/{(.):\(\)=>./, (orig, e) => `{${e}:()=>${parserSym}`);
const mod = new Function("module", "exports", "require", `(${code}).apply(this, arguments)`);

const exp: any = {};
Expand Down
4 changes: 2 additions & 2 deletions packages/core-extensions/src/disableSentry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const patches: Patch[] = [
find: "profiledRootComponent:",
replace: {
type: PatchReplaceType.Normal,
match: /(?<=\.Z=){.+?}}/,
replacement: 'require("disableSentry_stub").proxy()'
match: /Z:\(\)=>\i/,
replacement: 'Z:()=>require("disableSentry_stub").proxy()'
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/core-extensions/src/experiments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const patches: Patch[] = [
{
find: '"scientist:triggered"', // Scientist? Triggered.
replace: {
match: /(?<=personal_connection_id\|\|)!1/,
replacement: "!0"
match: ".personal_connection_id",
replacement: ".personal_connection_id || true"
}
},

Expand Down
3 changes: 3 additions & 0 deletions packages/core-extensions/src/moonbase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export const webpackModules: Record<string, ExtensionWebpackModule> = {
{ id: "discord/components/common/index" },
{ ext: "moonbase", id: "stores" },
{ id: "discord/modules/guild_settings/web/AppCard.css" },
{ ext: "contextMenu", id: "contextMenu" },
{ id: "discord/modules/modals/Modals" },
"Masks.PANEL_BUTTON",
'"Missing channel in Channel.openChannelContextMenu"',
".forumOrHome]:"
Expand All @@ -55,6 +57,7 @@ export const webpackModules: Record<string, ExtensionWebpackModule> = {
{ ext: "settings", id: "settings" },
{ id: "react" },
{ ext: "moonbase", id: "ui" },
{ ext: "contextMenu", id: "contextMenu" },
':"USER_SETTINGS_MODAL_SET_SECTION"'
],
entrypoint: true
Expand Down
2 changes: 1 addition & 1 deletion packages/core-extensions/src/moonbase/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"tagline": "The official settings UI for moonlight",
"authors": ["Cynosphere", "NotNite", "redstonekasi"]
},
"dependencies": ["spacepack", "settings", "common", "notices"],
"dependencies": ["spacepack", "settings", "common", "notices", "contextMenu"],
"settings": {
"sections": {
"advice": "reload",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Moonbase, pages, RestartAdviceMessage, Update } from "@moonlight-mod/wp
import UserSettingsModalActionCreators from "@moonlight-mod/wp/discord/actions/UserSettingsModalActionCreators";
import Margins from "@moonlight-mod/wp/discord/styles/shared/Margins.css";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
import { MenuItem, Text, Breadcrumbs } from "@moonlight-mod/wp/discord/components/common/index";
import { Text, Breadcrumbs } from "@moonlight-mod/wp/discord/components/common/index";
import { MenuItem } from "@moonlight-mod/wp/contextMenu_contextMenu";

const notice = {
stores: [MoonbaseSettingsStore],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { constants, ExtensionLoadSource, ExtensionTag } from "@moonlight-mod/typ

import { ExtensionCompat } from "@moonlight-mod/core/extension/loader";
import {
BeakerIcon,
ScienceIcon,
DownloadIcon,
TrashIcon,
AngleBracketsIcon,
Expand Down Expand Up @@ -118,7 +118,7 @@ export default function ExtensionCard({ uniqueId, selectTag }: { uniqueId: numbe
<Text variant="text-md/semibold">{ext.manifest?.meta?.name ?? ext.id}</Text>
{ext.source.type === ExtensionLoadSource.Developer && (
<Tooltip text="This is a local extension" position="top">
{(props: any) => <BeakerIcon {...props} class={BuildOverrideClasses.infoIcon} size="xs" />}
{(props: any) => <ScienceIcon {...props} class={BuildOverrideClasses.infoIcon} size="xs" />}
</Tooltip>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import {
Popout,
Dialog,
Menu,
MenuGroup,
MenuCheckboxItem,
MenuItem,
ChevronSmallDownIcon,
ChevronSmallUpIcon,
ArrowsUpDownIcon,
RetryIcon,
Tooltip
} from "@moonlight-mod/wp/discord/components/common/index";
import { MenuGroup, MenuCheckboxItem, MenuItem } from "@moonlight-mod/wp/contextMenu_contextMenu";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
import Margins from "@moonlight-mod/wp/discord/styles/shared/Margins.css";
import TagItem from "@moonlight-mod/wp/discord/modules/forums/web/Tag";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
// TODO: clean up the styling here
import React from "@moonlight-mod/wp/react";
import { MoonbaseExtension } from "core-extensions/src/moonbase/types";
import {
openModalLazy,
useModalsStore,
closeModal,
SingleSelect,
Text
} from "@moonlight-mod/wp/discord/components/common/index";
import { openModalLazy, useModalsStore, closeModal } from "@moonlight-mod/wp/discord/modules/modals/Modals";
import { SingleSelect, Text } from "@moonlight-mod/wp/discord/components/common/index";
import { MoonbaseSettingsStore } from "@moonlight-mod/wp/moonbase_stores";
import { ExtensionLoadSource } from "@moonlight-mod/types";
import Flex from "@moonlight-mod/wp/discord/uikit/Flex";
Expand Down
6 changes: 3 additions & 3 deletions packages/core-extensions/src/noHideToken/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Patch } from "@moonlight-mod/types";

export const patches: Patch[] = [
{
find: "hideToken:function",
find: "hideToken:()=>",
replace: {
match: /(?<=hideToken:function\(\){)/,
replacement: `return()=>{};`
match: /hideToken:\(\)=>.+?,/,
replacement: `hideToken:()=>{},`
}
}
];
6 changes: 3 additions & 3 deletions packages/core-extensions/src/noTrack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { Patch } from "@moonlight-mod/types";

export const patches: Patch[] = [
{
find: "analyticsTrackingStoreMaker:function",
find: "analyticsTrackingStoreMaker:()=>",
replace: {
match: /analyticsTrackingStoreMaker:function\(\){return .+?}/,
replacement: "analyticsTrackingStoreMaker:function(){return ()=>{}}"
match: /analyticsTrackingStoreMaker:\(\)=>.+?,/,
replacement: "analyticsTrackingStoreMaker:()=>()=>{},"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"dependencies": {
"@moonlight-mod/lunast": "^1.0.0",
"@moonlight-mod/mappings": "^1.1.10",
"@moonlight-mod/moonmap": "^1.0.3",
"@moonlight-mod/mappings": "^1.1.11",
"@moonlight-mod/moonmap": "^1.0.4",
"@types/react": "^18.3.10",
"csstype": "^3.1.2",
"standalone-electron-types": "^1.0.0"
Expand Down
Loading

0 comments on commit 027f865

Please sign in to comment.