Webatrice admin commands (#5051)

* Add AdminCommand.updateServerMessage

* Add AdminCommand.shutdownServer

* Add AdminCommand.reloadConfig

* Cleanup

* Add AdminCommand.adjustMod

* Lint

* Lint
This commit is contained in:
Zach H 2024-06-12 22:52:40 -04:00 committed by GitHub
parent e45c4042fe
commit 34d70980e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 167 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import webClient from '../../WebClient';
import { AdminPersistence } from '../../persistence';
export function updateServerMessage(): void {
const command = webClient.protobuf.controller.Command_UpdateServerMessage.create();
const sc = webClient.protobuf.controller.AdminCommand.create({
'.Command_UpdateServerMessage.ext': command
});
webClient.protobuf.sendAdminCommand(sc, (raw) => {
const { responseCode } = raw;
let error: string;
switch (responseCode) {
case webClient.protobuf.controller.Response.ResponseCode.RespOk:
AdminPersistence.updateServerMessage();
return;
default:
error = 'Failed to update server message.';
break;
}
if (error) {
console.error(responseCode, error);
}
});
}