Implement server commands through control stream

This commit is contained in:
Yukino Song
2024-09-11 07:30:50 +08:00
parent 2d084ed6f5
commit df7c742ca8
10 changed files with 190 additions and 24 deletions

View File

@@ -38,6 +38,7 @@
v-if="currentTab === 'general'"
:config="config"
:global-prep-cmd="global_prep_cmd"
:server-cmd="server_cmd"
:platform="platform">
</general>
@@ -134,6 +135,7 @@
currentTab: "general",
vdisplayStatus: "1",
global_prep_cmd: [],
server_cmd: [],
tabs: [ // TODO: Move the options to each Component instead, encapsulate.
{
id: "general",
@@ -143,6 +145,7 @@
"sunshine_name": "",
"min_log_level": 2,
"global_prep_cmd": "[]",
"server_cmd": "[]",
"notify_pre_releases": "disabled",
},
},
@@ -328,7 +331,9 @@
});
this.config.global_prep_cmd = this.config.global_prep_cmd || [];
this.config.server_cmd = this.config.server_cmd || [];
this.global_prep_cmd = JSON.parse(this.config.global_prep_cmd);
this.server_cmd = JSON.parse(this.config.server_cmd);
});
},
methods: {
@@ -336,7 +341,8 @@
this.$forceUpdate()
},
serialize() {
this.config.global_prep_cmd = JSON.stringify(this.global_prep_cmd);
this.config.global_prep_cmd = JSON.stringify(this.global_prep_cmd.filter(cmd => cmd.do || cmd.undo));
this.config.server_cmd = JSON.stringify(this.server_cmd.filter(cmd => cmd.name && cmd.cmd));
},
save() {
this.saved = false;