Equicord/src/plugins/devCompanion.dev/index.tsx

70 lines
2.5 KiB
TypeScript
Raw Normal View History

/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2023 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2023-05-06 01:36:00 +02:00
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
2023-05-06 01:36:00 +02:00
import { Logger } from "@utils/Logger";
import definePlugin, { OptionType, ReporterTestable } from "@utils/types";
2024-08-19 23:13:21 -04:00
2024-08-21 01:41:47 -04:00
import { initWs, socket, stopWs } from "./initWs";
export const PORT = 8485;
2025-09-07 20:48:12 -04:00
export const CLIENT_VERSION: readonly [major: number, minor: number, patch: number] = [0, 1, 1];
2024-08-21 01:41:47 -04:00
export const logger = new Logger("DevCompanion");
2024-08-19 23:13:21 -04:00
export const settings = definePluginSettings({
notifyOnAutoConnect: {
description: "Whether to notify when Dev Companion has automatically connected.",
type: OptionType.BOOLEAN,
default: true
2024-08-19 23:13:21 -04:00
},
usePatchedModule: {
2024-08-28 01:35:47 -04:00
description: "On extract requests, reply with the current patched module (if it is patched) instead of the original.",
default: true,
2024-08-19 23:13:21 -04:00
type: OptionType.BOOLEAN,
2024-08-28 01:35:47 -04:00
},
reloadAfterToggle: {
description: "Reload after a disable/enable plugin command is recived.",
2024-08-27 17:02:04 -04:00
default: true,
2024-08-28 01:35:47 -04:00
type: OptionType.BOOLEAN
}
});
export default definePlugin({
2025-01-09 07:19:41 -05:00
name: "DevCompanion",
2025-02-04 23:24:22 -05:00
description: "Dev Companion Plugin. Please report anything not working or being weird (most likely its a bug) to sadan, either ping or dm, thanks!",
2024-08-27 17:02:04 -04:00
authors: [Devs.Ven, Devs.sadan, Devs.Samwich],
2024-08-28 01:35:47 -04:00
reporterTestable: ReporterTestable.None,
settings,
2023-05-02 02:55:38 +02:00
toolboxActions: {
"Reconnect"() {
socket?.close(1000, "Reconnecting");
initWs(true);
}
},
start() {
2025-01-09 10:37:02 -05:00
// if we're running the reporter, we need to initws in the reporter file to avoid a race condition
2025-04-25 14:52:29 -04:00
if (!IS_DEV) throw new Error("This plugin requires dev mode to run, please build with pnpm build --dev");
initWs();
},
2024-08-21 01:41:47 -04:00
stop: stopWs,
});