@@ -272,6 +314,7 @@
const data = () => {
return {
+ platform: '',
editingHost: false,
currentTab: location.hash || '#OTP',
otp: '',
@@ -290,6 +333,11 @@
}
}
+ const cmdTpl = {
+ cmd: '',
+ elevated: 'false'
+ }
+
let app = createApp({
components: {
Navbar
@@ -413,6 +461,17 @@
clickedApplyBanner() {
this.showApplyMessage = false;
},
+ addCmd(arr, idx) {
+ const newCmd = Object.assign({}, cmdTpl);
+ if (idx < 0) {
+ arr.push(newCmd);
+ } else {
+ arr.splice(idx + 1, 0, newCmd);
+ }
+ },
+ removeCmd(arr, idx) {
+ arr.splice(idx, 1);
+ },
editClient(client) {
if (currentEditingClient) {
this.cancelEdit(currentEditingClient);
@@ -421,6 +480,10 @@
client.editing = true;
client.editPerm = client.perm;
client.editName = client.name;
+ client.edit_do = JSON.parse(JSON.stringify(client.do || []));
+ client.edit_undo = JSON.parse(JSON.stringify(client.undo || []));
+
+ console.log(client.do, client.undo)
},
cancelEdit(client) {
client.editing = false;
@@ -434,7 +497,27 @@
const editedClient = {
uuid: client.uuid,
name: client.editName,
- perm: client.editPerm & permissionMapping._all
+ perm: client.editPerm & permissionMapping._all,
+ do: client.edit_do.reduce((filtered, {cmd: _cmd, elevated}) => {
+ const cmd = _cmd.trim()
+ if (cmd) {
+ filtered.push({
+ cmd,
+ elevated
+ })
+ }
+ return filtered
+ }, []),
+ undo: client.edit_undo.reduce((filtered, {cmd: _cmd, elevated}) => {
+ const cmd = _cmd.trim()
+ if (cmd) {
+ filtered.push({
+ cmd,
+ elevated
+ })
+ }
+ return filtered
+ }, [])
}
fetch("./api/clients/update", {
credentials: 'include',
@@ -515,9 +598,9 @@
fetch("./api/clients/list", { credentials: 'include' })
.then((response) => response.json())
.then((response) => {
- const clientList = document.querySelector("#client-list");
if (response.status === 'true' && response.named_certs && response.named_certs.length) {
- this.clients = response.named_certs.map(({name, uuid, perm, connected}) => {
+ this.platform = response.platform
+ this.clients = response.named_certs.map(({name, uuid, perm, connected, do: _do, undo}) => {
const permInt = parseInt(perm, 10);
return {
name,
@@ -525,8 +608,8 @@
perm: permInt,
connected: connected === 'true',
editing: false,
- editPerm: permInt,
- editName: name
+ do: _do,
+ undo
}
})
currentEditingClient = null;
diff --git a/src_assets/common/assets/web/public/assets/locale/en.json b/src_assets/common/assets/web/public/assets/locale/en.json
index 292141a4..b0bb8525 100644
--- a/src_assets/common/assets/web/public/assets/locale/en.json
+++ b/src_assets/common/assets/web/public/assets/locale/en.json
@@ -169,6 +169,10 @@
"channels": "Maximum Connected Clients",
"channels_desc_1": "Apollo can allow a single streaming session to be shared with multiple clients simultaneously.",
"channels_desc_2": "Some hardware encoders may have limitations that reduce performance with multiple streams.",
+ "client_do_cmd": "Client connect commands",
+ "client_do_cmd_desc": "Commands to be executed when client connects. All of the commands are executed detached.",
+ "client_undo_cmd": "Client disconnect commands",
+ "client_undo_cmd_desc": "Commands to be executed when client disconnects. All of the commands are executed detached.",
"coder_cabac": "cabac -- context adaptive binary arithmetic coding - higher quality",
"coder_cavlc": "cavlc -- context adaptive variable-length coding - faster decode",
"configuration": "Configuration",