Skip to content

Commit 4bae193

Browse files
authored
Merge pull request rexlManu#6 from PiquelChips/master
feat: send console command
2 parents f5e79f1 + 0575c0c commit 4bae193

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ inputs:
2626
description: "Restart the servers after the upload"
2727
required: false
2828
default: false
29+
command:
30+
description: "Console command to run after upload"
31+
required: false
2932
proxy:
3033
description: "The proxy to use"
3134
required: false

src/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ async function main() {
1818
sourceListPath,
1919
targetPath,
2020
restart,
21+
command,
2122
targets,
2223
decompressTarget,
2324
} = settings;
@@ -68,6 +69,7 @@ async function main() {
6869
}
6970
}
7071

72+
if (command != "") await sendConsoleCommand(serverId, command);
7173
if (restart) await restartServer(serverId);
7274
}
7375

@@ -81,6 +83,7 @@ async function getSettings() {
8183
const panelHost = getInput("panel-host", { required: true });
8284
const apiKey = getInput("api-key", { required: true });
8385
const restart = getInput("restart") == "true";
86+
const command = getInput("command");
8487
const proxy = getInput("proxy");
8588
const decompressTarget = getInput("decompress-target") == "true";
8689
const followSymbolicLinks = getInput("follow-symbolic-links") == "true";
@@ -93,6 +96,7 @@ async function getSettings() {
9396

9497
// Debug print out all the inputs
9598
core.debug(`restart: ${restart}`);
99+
core.debug(`command: ${command}`);
96100
core.debug(`source: ${sourcePath}`);
97101
core.debug(`sources: ${sourceListPath}`);
98102
core.debug(`target: ${targetPath}`);
@@ -141,6 +145,7 @@ async function getSettings() {
141145
panelHost,
142146
apiKey,
143147
restart,
148+
command,
144149
proxy,
145150
sourceListPath,
146151
targetPath,
@@ -253,6 +258,12 @@ async function restartServer(serverId) {
253258
});
254259
}
255260

261+
async function sendConsoleCommand(serverId, command) {
262+
await axios.post(`/api/client/servers/${serverId}/command`, {
263+
command: command,
264+
});
265+
}
266+
256267
async function decompressFile(serverId, targetFile) {
257268
await axios.post(`/api/client/servers/${serverId}/files/decompress`, {
258269
root: "/",

0 commit comments

Comments
 (0)