remote power button
This commit is contained in:
1 parent
d89b1c519d
commit
af091fe8f7
4 files changed
+32
-1
No files matched your search
@@ -0,0 +1,13 @@
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="22"
|
||||
height="22"
|
||||
fill="currentColor"
|
||||
class="bi bi-power"
|
||||
viewBox="0 0 16 16"
|
||||
>
|
||||
<path d="M7.5 1v7h1V1h-1z" />
|
||||
<path
|
||||
d="M3 8.812a4.999 4.999 0 0 1 2.578-4.375l-.485-.874A6 6 0 1 0 11 3.616l-.501.865A5 5 0 1 1 3 8.812z"
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 295 B |
@@ -8,6 +8,12 @@ export class ExternalControlProtocol {
|
||||
body: '',
|
||||
})
|
||||
}
|
||||
static async pressKey(key) {
|
||||
return fetch(`http://${getIp()}:8060/keypress/${key}`, {
|
||||
method: 'POST',
|
||||
body: '',
|
||||
})
|
||||
}
|
||||
|
||||
static async pressKeyUp(key) {
|
||||
console.log("Pressing key up", key)
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
bind:this={button}
|
||||
class="{small
|
||||
? 'w-16'
|
||||
: 'w-24'} h-11 btn-primary rounded-xl flex items-center justify-center"
|
||||
: 'w-24'} h-11 btn-primary rounded-full flex items-center justify-center"
|
||||
>
|
||||
<svelte:component this={icon} />
|
||||
</button>
|
||||
@@ -16,6 +16,7 @@
|
||||
import VolumeDownIcon from "assets/remote-control/volume-down.svg.svelte";
|
||||
import VolumeMuteIcon from "assets/remote-control/volume-mute.svg.svelte";
|
||||
import VolumeUpIcon from "assets/remote-control/volume-up.svg.svelte";
|
||||
import PowerIcon from "assets/remote-control/power.svg.svelte";
|
||||
|
||||
import RemoteButton from "./RemoteControl/RemoteButton.svelte";
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
@@ -102,6 +103,17 @@
|
||||
|
||||
<div bind:this={screen} tabindex="-1" class={visibility ? "" : "hidden"}>
|
||||
<div class="flex flex-col items-center justify-center p-6">
|
||||
<div class="flex space-x-2 m-2">
|
||||
<button
|
||||
on:click={() => {
|
||||
ExternalControlProtocol.pressKey(BUTTONS.powerOff);
|
||||
}}
|
||||
class="btn-primary rounded-full flex items-center justify-center bg-red-600 hover:bg-red-400 w-12 h-12"
|
||||
>
|
||||
<PowerIcon />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex space-x-2 m-2">
|
||||
<RemoteButton key={BUTTONS.back} icon={ArrowBackIcon} />
|
||||
<RemoteButton key={BUTTONS.home} icon={HomeIcon} />
|
||||
|
||||
Reference in new issue
Block a user