mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Webatrice admin commands (#5051)
* Add AdminCommand.updateServerMessage * Add AdminCommand.shutdownServer * Add AdminCommand.reloadConfig * Cleanup * Add AdminCommand.adjustMod * Lint * Lint
This commit is contained in:
parent
e45c4042fe
commit
34d70980e8
11 changed files with 167 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue