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);
|
||||
}
|
||||
|
||||
export async function shutdown(ip: string): Promise<RequestResponse> {
|
||||
return await run_shell_command(ip, 'xfce4-session-logout --halt');
|
||||
export async function shutdown(ip: string): Promise<boolean> {
|
||||
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> {
|
||||
|
||||
@@ -114,12 +114,13 @@
|
||||
|
||||
async function shutdown_action() {
|
||||
popup_content.open = false;
|
||||
await run_on_all_selected_displays((d) => {
|
||||
shutdown(d.ip); // no await here because we want to be fast
|
||||
db.displays.update(d.id, {
|
||||
status: 'app_offline',
|
||||
preview: { currently_updating: false, url: null }
|
||||
});
|
||||
await run_on_all_selected_displays(async (d) => {
|
||||
if (await shutdown(d.ip)) {
|
||||
db.displays.update(d.id, {
|
||||
status: 'app_offline',
|
||||
preview: { currently_updating: false, url: null }
|
||||
});
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user