this repo has no description
1import { ExtensionWebpackModule, Patch } from "@moonlight-mod/types";
2
3export const patches: Patch[] = [
4 {
5 find: "window.DiscordErrors=",
6 replace: [
7 // replace reporting line with update status
8 {
9 // CvQlAA mapped to ERRORS_ACTION_TO_TAKE
10 // FIXME: Better patch find?
11 match: /,(\(0,(.)\.jsx\))\("p",{children:.\.intl\.string\(.\..\.CvQlAA\)}\)/,
12 replacement: (_, createElement, ReactJSX) =>
13 `,${createElement}(require("moonbase_crashScreen")?.UpdateText??${ReactJSX}.Fragment,{state:this.state,setState:this.setState.bind(this)})`
14 },
15
16 // wrap actions field to display error details
17 {
18 match: /(?<=return(\(0,(.)\.jsx\))\(.+?,)action:(.),className:/,
19 replacement: (_, createElement, ReactJSX, action) =>
20 `action:require("moonbase_crashScreen")?.wrapAction?${createElement}(require("moonbase_crashScreen").wrapAction,{action:${action},state:this.state}):${action},className:`
21 },
22
23 // add update button
24 // +hivLS -> ERRORS_RELOAD
25 {
26 match: /(?<=\["\+hivLS"\]\)}\),(\(0,(.)\.jsx\))\(.,{}\))/,
27 replacement: (_, createElement, ReactJSX) =>
28 `,${createElement}(require("moonbase_crashScreen")?.UpdateButton??${ReactJSX}.Fragment,{state:this.state,setState:this.setState.bind(this)})`
29 }
30 ]
31 }
32];
33
34export const webpackModules: Record<string, ExtensionWebpackModule> = {
35 stores: {
36 dependencies: [{ id: "discord/packages/flux" }, { id: "discord/Dispatcher" }]
37 },
38
39 ui: {
40 dependencies: [
41 { ext: "spacepack", id: "spacepack" },
42 { id: "react" },
43 { id: "discord/components/common/index" },
44 { ext: "moonbase", id: "stores" },
45 { id: "discord/modules/guild_settings/IntegrationCard.css" },
46 "Masks.PANEL_BUTTON",
47 '"Missing channel in Channel.openChannelContextMenu"',
48 ".forumOrHome]:"
49 ]
50 },
51
52 settings: {
53 dependencies: [
54 { ext: "spacepack", id: "spacepack" },
55 { ext: "settings", id: "settings" },
56 { id: "react" },
57 { ext: "moonbase", id: "ui" }
58 ],
59 entrypoint: true
60 },
61
62 updates: {
63 dependencies: [
64 { id: "react" },
65 { ext: "moonbase", id: "stores" },
66 { ext: "notices", id: "notices" },
67 {
68 ext: "spacepack",
69 id: "spacepack"
70 },
71 { id: "discord/Constants" },
72 { id: "discord/components/common/index" }
73 ],
74 entrypoint: true
75 },
76
77 moonbase: {
78 dependencies: [{ ext: "moonbase", id: "stores" }]
79 },
80
81 crashScreen: {
82 dependencies: [
83 { ext: "spacepack", id: "spacepack" },
84 { id: "react" },
85 { ext: "moonbase", id: "stores" },
86 { id: "discord/packages/flux" },
87 { id: "discord/components/common/index" },
88 /tabBar:"tabBar_[a-z0-9]+",tabBarItem:"tabBarItem_[a-z0-9]+"/
89 ]
90 }
91};