Restart playlet from web app
This commit is contained in:
1 parent
72f547cc22
commit
4c90cf1e98
2 files changed
+17
-2
No files matched your search
@@ -8,6 +8,15 @@ export class ExternalControlProtocol {
|
|||||||
body: '',
|
body: '',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async restartApp(appId) {
|
||||||
|
console.log("Restarting app", appId)
|
||||||
|
return fetch(`http://${getIp()}:8060/launch/${appId}?restart=true`, {
|
||||||
|
method: 'POST',
|
||||||
|
body: '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
static async pressKey(key) {
|
static async pressKey(key) {
|
||||||
return fetch(`http://${getIp()}:8060/keypress/${key}`, {
|
return fetch(`http://${getIp()}:8060/keypress/${key}`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||||
import { playletStateStore } from "lib/Stores";
|
import { playletStateStore } from "lib/Stores";
|
||||||
|
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||||
|
|
||||||
let selectedRelease = "";
|
let selectedRelease = "";
|
||||||
let releases = [];
|
let releases = [];
|
||||||
|
|
||||||
let libUrl;
|
let libUrl;
|
||||||
let libUrlType;
|
let libUrlType;
|
||||||
|
let appId = "693751";
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
releases = await fetchReleaseTags();
|
releases = await fetchReleaseTags();
|
||||||
@@ -17,6 +19,9 @@
|
|||||||
playletStateStore.subscribe((value) => {
|
playletStateStore.subscribe((value) => {
|
||||||
libUrl = value?.app?.lib_url;
|
libUrl = value?.app?.lib_url;
|
||||||
libUrlType = value?.app?.lib_url_type;
|
libUrlType = value?.app?.lib_url_type;
|
||||||
|
if (value?.app?.id) {
|
||||||
|
appId = value?.app?.id;
|
||||||
|
}
|
||||||
setCurrentlyUsedRelease();
|
setCurrentlyUsedRelease();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -62,11 +67,12 @@
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
confirm(
|
confirm(
|
||||||
`Are you sure you want to change the Playlet Library version to "${version}"?`
|
`Are you sure you want to change the Playlet Library version to "${version}"?\nThis will restart Playlet.`
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
await PlayletApi.setPlayletLibVersion(selectedRelease);
|
await PlayletApi.setPlayletLibVersion(selectedRelease);
|
||||||
alert("Playlet Library version set. Restart playlet to apply changes.");
|
alert("Playlet Library version set. Playlet will now restart.");
|
||||||
|
await ExternalControlProtocol.restartApp(appId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in new issue
Block a user