Update DevCompanion
This commit is contained in:
parent
cdc15fb7a0
commit
129ba3695b
7 changed files with 44 additions and 14 deletions
|
|
@ -4,9 +4,9 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { initWs } from "@plugins/devCompanion.dev/initWs";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import * as Webpack from "@webpack";
|
||||
import { initWs } from "plugins/devCompanion.dev/initWs";
|
||||
import { getBuildNumber, patchTimings } from "webpack/patchWebpack";
|
||||
|
||||
import { addPatch, patches } from "../plugins";
|
||||
|
|
|
|||
1
src/globals.d.ts
vendored
1
src/globals.d.ts
vendored
|
|
@ -65,6 +65,7 @@ declare global {
|
|||
*/
|
||||
export var DiscordNative: any;
|
||||
export var Vesktop: any;
|
||||
export var Equibop: any;
|
||||
export var VesktopNative: any;
|
||||
|
||||
interface Window extends Record<PropertyKey, any> {
|
||||
|
|
|
|||
|
|
@ -180,6 +180,13 @@ function makeShortcuts() {
|
|||
experimentBucket: bucket,
|
||||
});
|
||||
},
|
||||
makeBranchSwitcher: (branch: string) => {
|
||||
if (!IS_VESKTOP) throw new Error("This function only works on vesktop and equibop.");
|
||||
const target = IS_VESKTOP ? Vesktop : Equibop;
|
||||
if (target.Settings.store.discordBranch === branch) throw new Error(`Already on ${branch}.`);
|
||||
target.Settings.store.discordBranch = branch;
|
||||
VesktopNative.app.relaunch();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ import { Logger } from "@utils/Logger";
|
|||
import definePlugin, { OptionType, ReporterTestable } from "@utils/types";
|
||||
|
||||
import { initWs, socket, stopWs } from "./initWs";
|
||||
console.log("imported");
|
||||
export const PORT = 8485;
|
||||
export const CLIENT_VERSION: readonly [major: number, minor: number, patch: number] = [0, 1, 1];
|
||||
|
||||
export const logger = new Logger("DevCompanion");
|
||||
|
||||
|
|
@ -67,4 +67,3 @@ export default definePlugin({
|
|||
|
||||
stop: stopWs,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { loadLazyChunks } from "debug/loadLazyChunks";
|
|||
import { reporterData } from "debug/reporterData";
|
||||
import { Settings } from "Vencord";
|
||||
|
||||
import { logger, PORT, settings } from ".";
|
||||
import { CLIENT_VERSION, logger, PORT, settings } from ".";
|
||||
import { Recieve } from "./types";
|
||||
import { FullOutgoingMessage, OutgoingMessage } from "./types/send";
|
||||
import { extractModule, extractOrThrow, findModuleId, getModulePatchedBy, mkRegexFind, parseNode, toggleEnabled, } from "./util";
|
||||
|
|
@ -63,7 +63,6 @@ export function initWs(isManual = false) {
|
|||
}));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if (settings.store.notifyOnAutoConnect || isManual) {
|
||||
Toasts.show({
|
||||
|
|
@ -449,6 +448,16 @@ export function initWs(isManual = false) {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case "version": {
|
||||
replyData({
|
||||
type: "version",
|
||||
ok: true,
|
||||
data: {
|
||||
clientVersion: CLIENT_VERSION
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// @ts-expect-error should be never
|
||||
reply("Unknown Type " + d?.type);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export type FindData = {
|
|||
args: FindNode[];
|
||||
};
|
||||
|
||||
export type IncomingMessage = DisablePlugin | RawId | DiffPatch | Reload | ExtractModule | TestPatch | TestFind | AllModules | I18nLookup;
|
||||
export type IncomingMessage = DisablePlugin | RawId | DiffPatch | Reload | ExtractModule | TestPatch | TestFind | AllModules | I18nLookup | Version;
|
||||
export type FullIncomingMessage = IncomingMessage & { nonce: number; };
|
||||
|
||||
export type DisablePlugin = {
|
||||
|
|
@ -109,6 +109,14 @@ export type ExtractModule = {
|
|||
data: FindOrSearchData;
|
||||
};
|
||||
|
||||
export type Version = {
|
||||
type: "version";
|
||||
data: {
|
||||
// major minor patch
|
||||
server_version: [number, number, number];
|
||||
};
|
||||
};
|
||||
|
||||
export type TestPatch = {
|
||||
type: "testPatch";
|
||||
data: (
|
||||
|
|
|
|||
|
|
@ -4,20 +4,19 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
// should be the same types as src/server/types/recieve.ts in the companion
|
||||
import { ReporterData as IReporterData } from "debug/reporterData";
|
||||
export type ReporterData = IReporterData;
|
||||
import { ReporterData } from "debug/reporterData";
|
||||
|
||||
export type OutgoingMessage = (Report | DiffModule | ExtractModule | ModuleList | RawId | I18nValue) & Base;
|
||||
export type OutgoingMessage = Base<DiffModule | ExtractModule | ModuleList | RawId | I18nValue | VersionResponse>;
|
||||
export type FullOutgoingMessage = OutgoingMessage & Nonce;
|
||||
|
||||
export type Base = {
|
||||
export type Base<T> = ({
|
||||
ok: true;
|
||||
} | {
|
||||
} & T) | ({
|
||||
ok: false;
|
||||
data?: any;
|
||||
data: null;
|
||||
error: string;
|
||||
};
|
||||
} & Omit<T, "data">);
|
||||
|
||||
export type Nonce = {
|
||||
nonce: number;
|
||||
};
|
||||
|
|
@ -81,4 +80,11 @@ export type RawId = {
|
|||
type: "rawId";
|
||||
data: string;
|
||||
};
|
||||
|
||||
export type VersionResponse = {
|
||||
type: "version";
|
||||
data: {
|
||||
clientVersion: readonly [number, number, number];
|
||||
};
|
||||
};
|
||||
// #endregion
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue