From 5339248cf8db3faa58ef24579d3617c210e80429 Mon Sep 17 00:00:00 2001 From: Andreas Skomski Date: Mon, 7 Apr 2025 19:18:04 +0200 Subject: [PATCH 1/5] Update buttons.js --- assets/js/admin/buttons.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/admin/buttons.js b/assets/js/admin/buttons.js index 64802fb56..6c913c0b7 100644 --- a/assets/js/admin/buttons.js +++ b/assets/js/admin/buttons.js @@ -290,6 +290,9 @@ $(function () { $('#reboot-btn').on('click', function (ev) { ev.preventDefault(); + if (config.get_request.processed) { + photoboothTools.getRequest(config.get_request.server + '/reboot'); + } shellCommand('reboot'); return false; @@ -297,6 +300,9 @@ $(function () { $('#shutdown-btn').on('click', function (ev) { ev.preventDefault(); + if (config.get_request.processed) { + photoboothTools.getRequest(config.get_request.server + '/shutdown'); + } shellCommand('shutdown'); return false; From 624c7a64ce4db5817dc43d3fa2a5ba4202aaefe3 Mon Sep 17 00:00:00 2001 From: Andreas Skomski Date: Mon, 7 Apr 2025 19:20:32 +0200 Subject: [PATCH 2/5] Update core.js --- assets/js/core.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/js/core.js b/assets/js/core.js index d44d48a53..9b0ee7e4a 100644 --- a/assets/js/core.js +++ b/assets/js/core.js @@ -826,6 +826,9 @@ const photoBooth = (function () { loaderMessage.append($('

').text(data.error)); } api.takingPic = false; + if (config.get_request.processed) { + photoboothTools.getRequest(config.get_request.server + '/error'); + } remoteBuzzerClient.inProgress(false); photoboothTools.console.logDev('Taking picture in progress: ' + api.takingPic); if (config.dev.reload_on_error) { From c69528396b57cf5de1fdb34d2076f2b940009d4a Mon Sep 17 00:00:00 2001 From: Andreas Skomski Date: Mon, 7 Apr 2025 20:31:43 +0200 Subject: [PATCH 3/5] Update remotebuzzer-server.js --- assets/js/remotebuzzer-server.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/assets/js/remotebuzzer-server.js b/assets/js/remotebuzzer-server.js index 2a4a60fa7..b35d03fc8 100644 --- a/assets/js/remotebuzzer-server.js +++ b/assets/js/remotebuzzer-server.js @@ -368,6 +368,22 @@ const requestListener = function (req, res) { log('http: GET /commands/reboot-now'); if (config.remotebuzzer.usebuttons && config.remotebuzzer.rebootbutton) { sendText('REBOOTING NOW'); + + const url = `${config.getrequest_server}/reboot`; + const curlCommand = `curl ${url}`; + + exec(curlCommand, (error, stdout, stderr) => { + if (error) { + log(`Error: ${error.message}`); + return; + } + if (stderr) { + log(`Stderr: ${stderr}`); + return; + } + log(`Response: ${stdout}`); + }); + /* Initiate system shutdown */ const cmd = 'sudo ' + config.commands.reboot; execSync(cmd); From 59ca7603d40401dac2254e9bcae6aab2dd8abb1f Mon Sep 17 00:00:00 2001 From: Andreas Skomski Date: Mon, 7 Apr 2025 21:32:45 +0200 Subject: [PATCH 4/5] Update remotebuzzer-server.js --- assets/js/remotebuzzer-server.js | 48 ++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/assets/js/remotebuzzer-server.js b/assets/js/remotebuzzer-server.js index b35d03fc8..7ff7d9cbc 100644 --- a/assets/js/remotebuzzer-server.js +++ b/assets/js/remotebuzzer-server.js @@ -357,6 +357,24 @@ const requestListener = function (req, res) { log('http: GET /commands/shutdown-now'); if (config.remotebuzzer.usebuttons && config.remotebuzzer.shutdownbutton) { sendText('SHUTTING DOWN'); + + if (config.get_request.processed) { + const url = `${config.get_request.server}/shutdown`; + const curlCommand = `curl ${url}`; + + exec(curlCommand, (error, stdout, stderr) => { + if (error) { + log(`Error: ${error.message}`); + return; + } + if (stderr) { + log(`Stderr: ${stderr}`); + return; + } + log(`Response: ${stdout}`); + }); + } + /* Initiate system shutdown */ const cmd = 'sudo ' + config.commands.shutdown; execSync(cmd); @@ -369,20 +387,22 @@ const requestListener = function (req, res) { if (config.remotebuzzer.usebuttons && config.remotebuzzer.rebootbutton) { sendText('REBOOTING NOW'); - const url = `${config.getrequest_server}/reboot`; - const curlCommand = `curl ${url}`; - - exec(curlCommand, (error, stdout, stderr) => { - if (error) { - log(`Error: ${error.message}`); - return; - } - if (stderr) { - log(`Stderr: ${stderr}`); - return; - } - log(`Response: ${stdout}`); - }); + if (config.get_request.processed) { + const url = `${config.get_request.server}/reboot`; + const curlCommand = `curl ${url}`; + + exec(curlCommand, (error, stdout, stderr) => { + if (error) { + log(`Error: ${error.message}`); + return; + } + if (stderr) { + log(`Stderr: ${stderr}`); + return; + } + log(`Response: ${stdout}`); + }); + } /* Initiate system shutdown */ const cmd = 'sudo ' + config.commands.reboot; From a4e7f72e56f59822443da5054926a2b2fec02968 Mon Sep 17 00:00:00 2001 From: Andreas Skomski Date: Mon, 7 Apr 2025 21:38:40 +0200 Subject: [PATCH 5/5] Update remotebuzzer-server.js --- assets/js/remotebuzzer-server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/remotebuzzer-server.js b/assets/js/remotebuzzer-server.js index 7ff7d9cbc..bb6d9ee2d 100644 --- a/assets/js/remotebuzzer-server.js +++ b/assets/js/remotebuzzer-server.js @@ -16,7 +16,7 @@ let collageInProgress = false, const SYNC_DESTINATION_DIR = 'photobooth-pic-sync'; let rotaryClkPin, rotaryDtPin; -const { execSync, spawnSync } = require('child_process'); +const { exec, execSync, spawnSync } = require('child_process'); const path = require('path'); const { pid: PID, platform: PLATFORM } = process; @@ -360,7 +360,7 @@ const requestListener = function (req, res) { if (config.get_request.processed) { const url = `${config.get_request.server}/shutdown`; - const curlCommand = `curl ${url}`; + const curlCommand = `curl -s ${url}`; exec(curlCommand, (error, stdout, stderr) => { if (error) { @@ -389,7 +389,7 @@ const requestListener = function (req, res) { if (config.get_request.processed) { const url = `${config.get_request.server}/reboot`; - const curlCommand = `curl ${url}`; + const curlCommand = `curl -s ${url}`; exec(curlCommand, (error, stdout, stderr) => { if (error) {