Complete wrapper migration to shared message types
This commit is contained in:
+21
-20
@@ -301,55 +301,56 @@ class Wrapper {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const command =
|
const rawCommand =
|
||||||
JSON.parse(
|
JSON.parse(
|
||||||
msg.content.toString()
|
msg.content.toString()
|
||||||
) as ServerStartCommand | ServerStopCommand | {
|
) as unknown;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const commandType = (rawCommand as { type?: string }).type;
|
||||||
|
switch(commandType){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case "test": {
|
||||||
|
const command = rawCommand as {
|
||||||
type: string;
|
type: string;
|
||||||
[key: string]: unknown;
|
message?: unknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch(command.type){
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case "test":
|
|
||||||
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"TEST COMMAND:",
|
"TEST COMMAND:",
|
||||||
command.message
|
command.message
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case "server.start":
|
case "server.start": {
|
||||||
|
const command = rawCommand as ServerStartCommand;
|
||||||
|
|
||||||
this.processManager.startServer(
|
this.processManager.startServer(
|
||||||
command
|
command
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
case "server.stop":
|
case "server.stop": {
|
||||||
|
const command = rawCommand as ServerStopCommand;
|
||||||
|
|
||||||
this.processManager.stopServer(
|
this.processManager.stopServer(
|
||||||
command.serverId
|
command.serverId
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -357,7 +358,7 @@ class Wrapper {
|
|||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"Unbekannter Command:",
|
"Unbekannter Command:",
|
||||||
command
|
rawCommand
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { spawn, ChildProcess } from "child_process";
|
import { spawn, ChildProcess } from "child_process";
|
||||||
|
import { ServerStartCommand } from "server-manager-shared";
|
||||||
|
|
||||||
|
|
||||||
interface ServerProcess {
|
interface ServerProcess {
|
||||||
|
|||||||
Reference in New Issue
Block a user