Add support for global prep commands (#977)

This commit is contained in:
pgrunzjr
2023-03-27 11:02:20 -05:00
committed by GitHub
parent c2fba6f651
commit 8c86baf627
7 changed files with 152 additions and 24 deletions

View File

@@ -57,9 +57,18 @@
</div>
<!--prep-cmd-->
<div class="mb-3 d-flex flex-column">
<div class="mb-3">
<label for="excludeGlobalPrep" class="form-label">Global Prep Commands</label>
<select id="excludeGlobalPrep" class="form-select" v-model="editForm['exclude-global-prep-cmd']">
<option v-for="val in [false, true]" :value="val">{{ !val ? 'Enabled' : 'Disabled' }}</option>
</select>
<div class="form-text">
Enable/Disable the execution of Global Prep Commands for this application.
</div>
</div>
<label for="appName" class="form-label">Command Preparations</label>
<div class="form-text">
A list of commands to be run before/after the application. <br />
A list of commands to be run before/after this application. <br />
If any of the prep-commands fail, starting the application is aborted
</div>
<table v-if="editForm['prep-cmd'].length > 0">
@@ -183,7 +192,7 @@
Find Cover
</button>
<div class="dropdown-menu dropdown-menu-end w-50 cover-finder overflow-hidden"
aria-labelledby="findCoverToggle">
aria-labelledby="findCoverToggle">
<div class="modal-header">
<h4 class="modal-title">Covers Found</h4>
<button type="button" class="btn-close" aria-label="Close" @click="closeCoverFinder"></button>
@@ -198,7 +207,7 @@
</div>
</div>
<div v-for="(cover,i) in coverCandidates" :key="i" class="col-12 col-sm-6 col-lg-4 mb-3"
@click="useCover(cover)">
@click="useCover(cover)">
<div class="cover-container result">
<img class="rounded" :src="cover.url"/>
</div>
@@ -246,7 +255,7 @@
detachedCmd: "",
coverSearching: false,
coverFinderBusy: false,
coverCandidates: [],
coverCandidates: []
};
},
created() {
@@ -438,4 +447,10 @@
object-fit: cover;
}
.config-page {
padding: 1em;
border: 1px solid #dee2e6;
border-top: none;
}
</style>

View File

@@ -213,10 +213,58 @@
<option value="disabled">Disabled</option>
<option value="enabled">Enabled</option>
</select>
<div class="form-text">
It may be possible that you cannot send the Windows Key from Moonlight directly.<br />
In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key
</div>
</div>
<div class="form-text">
It may be possible that you cannot send the Windows Key from Moonlight directly.<br />
In those cases it may be useful to make Sunshine think the Right Alt key is the Windows key
<!-- Global Prep Commands -->
<div class="mb-3 d-flex flex-column">
<label class="form-label">Command Preparations</label>
<div class="form-text">
A list of commands to be run before/after all applications. <br />
If any of the prep-commands fail, starting the application is aborted.
</div>
<table v-if="global_prep_cmd.length > 0">
<thead>
<th>Do</th>
<th>Undo</th>
<th style="width: 48px"></th>
</thead>
<tbody>
<tr v-for="(c,i) in global_prep_cmd">
<td>
<input
type="text"
class="form-control monospace"
v-model="c.do"
/>
</td>
<td>
<input
type="text"
class="form-control monospace"
v-model="c.undo"
/>
</td>
<td>
<button
class="btn btn-danger"
@click="global_prep_cmd.splice(i,1)"
>
&times;
</button>
</td>
</tr>
</tbody>
</table>
<button
class="mt-2 btn btn-success"
style="margin: 0 auto"
@click="add_global_prep_cmd"
>
&plus; Add
</button>
</div>
</div>
<!--Files Tab-->
@@ -951,6 +999,7 @@
"vt_coder": "auto",
"vt_realtime": "enabled",
"vt_software": "auto",
"global_prep_cmd": "[]",
}
new Vue({
@@ -967,6 +1016,7 @@
currentTab: "general",
resIn: "",
fpsIn: "",
global_prep_cmd: [],
tabs: [
{
id: "general",
@@ -1061,6 +1111,9 @@
let resolutions = [];
res.split(",").forEach((r) => resolutions.push(r.trim()));
this.resolutions = resolutions;
this.config.global_prep_cmd = this.config.global_prep_cmd || [];
this.global_prep_cmd = JSON.parse(this.config.global_prep_cmd);
});
},
methods: {
@@ -1075,6 +1128,7 @@
"]";
// remove quotes from values in fps
this.config.fps = JSON.stringify(this.fps).replace(/"/g, "");
this.config.global_prep_cmd = JSON.stringify(this.global_prep_cmd);
},
save() {
this.saved = false;
@@ -1135,6 +1189,12 @@
}
});
},
add_global_prep_cmd() {
this.global_prep_cmd.push({
do: "",
undo: "",
});
},
},
});
</script>