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
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { initWs } from "@plugins/devCompanion.dev/initWs";
|
||||||
import { Logger } from "@utils/Logger";
|
import { Logger } from "@utils/Logger";
|
||||||
import * as Webpack from "@webpack";
|
import * as Webpack from "@webpack";
|
||||||
import { initWs } from "plugins/devCompanion.dev/initWs";
|
|
||||||
import { getBuildNumber, patchTimings } from "webpack/patchWebpack";
|
import { getBuildNumber, patchTimings } from "webpack/patchWebpack";
|
||||||
|
|
||||||
import { addPatch, patches } from "../plugins";
|
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 DiscordNative: any;
|
||||||
export var Vesktop: any;
|
export var Vesktop: any;
|
||||||
|
export var Equibop: any;
|
||||||
export var VesktopNative: any;
|
export var VesktopNative: any;
|
||||||
|
|
||||||
interface Window extends Record<PropertyKey, any> {
|
interface Window extends Record<PropertyKey, any> {
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,13 @@ function makeShortcuts() {
|
||||||
experimentBucket: bucket,
|
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 definePlugin, { OptionType, ReporterTestable } from "@utils/types";
|
||||||
|
|
||||||
import { initWs, socket, stopWs } from "./initWs";
|
import { initWs, socket, stopWs } from "./initWs";
|
||||||
console.log("imported");
|
|
||||||
export const PORT = 8485;
|
export const PORT = 8485;
|
||||||
|
export const CLIENT_VERSION: readonly [major: number, minor: number, patch: number] = [0, 1, 1];
|
||||||
|
|
||||||
export const logger = new Logger("DevCompanion");
|
export const logger = new Logger("DevCompanion");
|
||||||
|
|
||||||
|
|
@ -67,4 +67,3 @@ export default definePlugin({
|
||||||
|
|
||||||
stop: stopWs,
|
stop: stopWs,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import { loadLazyChunks } from "debug/loadLazyChunks";
|
||||||
import { reporterData } from "debug/reporterData";
|
import { reporterData } from "debug/reporterData";
|
||||||
import { Settings } from "Vencord";
|
import { Settings } from "Vencord";
|
||||||
|
|
||||||
import { logger, PORT, settings } from ".";
|
import { CLIENT_VERSION, logger, PORT, settings } from ".";
|
||||||
import { Recieve } from "./types";
|
import { Recieve } from "./types";
|
||||||
import { FullOutgoingMessage, OutgoingMessage } from "./types/send";
|
import { FullOutgoingMessage, OutgoingMessage } from "./types/send";
|
||||||
import { extractModule, extractOrThrow, findModuleId, getModulePatchedBy, mkRegexFind, parseNode, toggleEnabled, } from "./util";
|
import { extractModule, extractOrThrow, findModuleId, getModulePatchedBy, mkRegexFind, parseNode, toggleEnabled, } from "./util";
|
||||||
|
|
@ -63,7 +63,6 @@ export function initWs(isManual = false) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (settings.store.notifyOnAutoConnect || isManual) {
|
if (settings.store.notifyOnAutoConnect || isManual) {
|
||||||
Toasts.show({
|
Toasts.show({
|
||||||
|
|
@ -449,6 +448,16 @@ export function initWs(isManual = false) {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "version": {
|
||||||
|
replyData({
|
||||||
|
type: "version",
|
||||||
|
ok: true,
|
||||||
|
data: {
|
||||||
|
clientVersion: CLIENT_VERSION
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
// @ts-expect-error should be never
|
// @ts-expect-error should be never
|
||||||
reply("Unknown Type " + d?.type);
|
reply("Unknown Type " + d?.type);
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export type FindData = {
|
||||||
args: FindNode[];
|
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 FullIncomingMessage = IncomingMessage & { nonce: number; };
|
||||||
|
|
||||||
export type DisablePlugin = {
|
export type DisablePlugin = {
|
||||||
|
|
@ -109,6 +109,14 @@ export type ExtractModule = {
|
||||||
data: FindOrSearchData;
|
data: FindOrSearchData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type Version = {
|
||||||
|
type: "version";
|
||||||
|
data: {
|
||||||
|
// major minor patch
|
||||||
|
server_version: [number, number, number];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export type TestPatch = {
|
export type TestPatch = {
|
||||||
type: "testPatch";
|
type: "testPatch";
|
||||||
data: (
|
data: (
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,19 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// should be the same types as src/server/types/recieve.ts in the companion
|
import { ReporterData } from "debug/reporterData";
|
||||||
import { ReporterData as IReporterData } from "debug/reporterData";
|
|
||||||
export type ReporterData = IReporterData;
|
|
||||||
|
|
||||||
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 FullOutgoingMessage = OutgoingMessage & Nonce;
|
||||||
|
|
||||||
export type Base = {
|
export type Base<T> = ({
|
||||||
ok: true;
|
ok: true;
|
||||||
} | {
|
} & T) | ({
|
||||||
ok: false;
|
ok: false;
|
||||||
data?: any;
|
data: null;
|
||||||
error: string;
|
error: string;
|
||||||
};
|
} & Omit<T, "data">);
|
||||||
|
|
||||||
export type Nonce = {
|
export type Nonce = {
|
||||||
nonce: number;
|
nonce: number;
|
||||||
};
|
};
|
||||||
|
|
@ -81,4 +80,11 @@ export type RawId = {
|
||||||
type: "rawId";
|
type: "rawId";
|
||||||
data: string;
|
data: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type VersionResponse = {
|
||||||
|
type: "version";
|
||||||
|
data: {
|
||||||
|
clientVersion: readonly [number, number, number];
|
||||||
|
};
|
||||||
|
};
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue