mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-05 16:37:09 +00:00
@@ -325,8 +325,12 @@ async function run_shell_command(ip: string, command: string): Promise<RequestRe
|
|||||||
return await request_display(ip, '/shellCommand', options);
|
return await request_display(ip, '/shellCommand', options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function shutdown(ip: string): Promise<RequestResponse> {
|
export async function shutdown(ip: string): Promise<boolean> {
|
||||||
return await run_shell_command(ip, 'xfce4-session-logout --halt');
|
const command = 'xfce4-session-logout --halt';
|
||||||
|
const raw_response = await run_shell_command(ip, command);
|
||||||
|
if (!raw_response.ok) return false;
|
||||||
|
if (handle_shell_error(ip, raw_response, command, true)) return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function startup(mac: string): Promise<RequestResponse> {
|
export async function startup(mac: string): Promise<RequestResponse> {
|
||||||
|
|||||||
@@ -114,12 +114,13 @@
|
|||||||
|
|
||||||
async function shutdown_action() {
|
async function shutdown_action() {
|
||||||
popup_content.open = false;
|
popup_content.open = false;
|
||||||
await run_on_all_selected_displays((d) => {
|
await run_on_all_selected_displays(async (d) => {
|
||||||
shutdown(d.ip); // no await here because we want to be fast
|
if (await shutdown(d.ip)) {
|
||||||
db.displays.update(d.id, {
|
db.displays.update(d.id, {
|
||||||
status: 'app_offline',
|
status: 'app_offline',
|
||||||
preview: { currently_updating: false, url: null }
|
preview: { currently_updating: false, url: null }
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user