Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assets/js/admin/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,19 @@ $(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;
});

$('#shutdown-btn').on('click', function (ev) {
ev.preventDefault();
if (config.get_request.processed) {
photoboothTools.getRequest(config.get_request.server + '/shutdown');
}
shellCommand('shutdown');

return false;
Expand Down
3 changes: 3 additions & 0 deletions assets/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,9 @@ const photoBooth = (function () {
loaderMessage.append($('<p>').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) {
Expand Down
38 changes: 37 additions & 1 deletion assets/js/remotebuzzer-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 -s ${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);
Expand All @@ -368,6 +386,24 @@ const requestListener = function (req, res) {
log('http: GET /commands/reboot-now');
if (config.remotebuzzer.usebuttons && config.remotebuzzer.rebootbutton) {
sendText('REBOOTING NOW');

if (config.get_request.processed) {
const url = `${config.get_request.server}/reboot`;
const curlCommand = `curl -s ${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);
Expand Down
Loading