feat(control): startup button

This commit is contained in:
2026-01-06 19:41:15 +01:00
parent f7b0c9978d
commit f76337efc7
2 changed files with 23 additions and 2 deletions
+9 -1
View File
@@ -199,7 +199,7 @@ async function request_control(
api_route: string,
options: { method: string; headers?: Record<string, string>; body?: string }
): Promise<RequestResponse> {
const url = `${window.location.origin}/api${api_route}`;
const url = `http://127.0.0.1:8080/api${api_route}`;
return await request(url, options);
}
@@ -296,3 +296,11 @@ async function run_shell_command(ip: string, command: string): Promise<RequestRe
export async function shutdown(ip: string): Promise<void> {
await run_shell_command(ip, 'shutdown -h now');
}
export async function startup(mac: string): Promise<void> {
await request_control(`/wakeOnLan`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ mac_address: mac })
});
}