Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
feature: allow sending a GET request at countdown and while processing
Browse files Browse the repository at this point in the history
Change-Id: I2b447f7dcfabe7618ebc3372a183914f32ef94d3
  • Loading branch information
andi34 committed Sep 6, 2021
1 parent bdb3f0e commit bf4f76d
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@
$config['synctodrive']['interval'] = 300;


// G E T R E Q U E S T
$config['get_request']['enabled'] = false;
$config['get_request']['server'] = NULL;
$config['get_request']['picture'] = 'CNTDWNPHOTO';
$config['get_request']['collage'] = 'CNTDWNCOLLAGE';


// A U T H E N T I C A T I O N
$config['login']['enabled'] = false;
$config['login']['username'] = 'Photo';
Expand Down
31 changes: 31 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,37 @@
'value' => $config['synctodrive']['logfile'],
],
],
'get_request' => [
'platform' => 'linux',
'view' => 'advanced',
'get_request_enabled' => [
'view' => 'basic',
'type' => 'checkbox',
'name' => 'get_request[enabled]',
'value' => $config['get_request']['enabled'],
],
'get_request_server' => [
'view' => 'advanced',
'type' => 'input',
'placeholder' => 'http://xxx.xxx.xxx.xxx',
'name' => 'get_request[server]',
'value' => htmlentities($config['get_request']['server']),
],
'get_request_picture' => [
'view' => 'advanced',
'type' => 'input',
'placeholder' => $defaultConfig['get_request']['picture'],
'name' => 'get_request[picture]',
'value' => htmlentities($config['get_request']['picture']),
],
'get_request_collage' => [
'view' => 'advanced',
'type' => 'input',
'placeholder' => $defaultConfig['get_request']['collage'],
'name' => 'get_request[collage]',
'value' => htmlentities($config['get_request']['collage']),
],
],
'authentication' => [
'view' => 'basic',
'login_enabled' => [
Expand Down
9 changes: 9 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
"general:ui_language": "Choose Language",
"general:webserver_ip": "IP address of the Photobooth web server",
"general:webserver_ssid": "Wireless network name (SSID) used to access the photobooth",
"get_request": "GET request",
"get_request:get_request_collage": "GET request for collage",
"get_request:get_request_enabled": "Send GET request to server at countdown and after processing",
"get_request:get_request_picture": "GET request for picture",
"get_request:get_request_server": "GET request server",
"githead": "Latest changes",
"home": "Home",
"insertMail": "Enter your e-mail address to receive the photo.",
Expand Down Expand Up @@ -296,6 +301,10 @@
"manual:general:ui_language": "Choose interface language.<p>If you're missing a language or like to help improving translations visit the <a href=\"https://github.com/andi34/photobooth/wiki/FAQ#how-to-update-or-add-translations\" target=\"_blank\">\"How to update or add translations?\"</a> inside the Photobooth Wiki for instructions.</p>",
"manual:general:webserver_ip": "Please define the IP address of the Photobooth web server to make the QR-Code working if you're accessing Photobooth via \"localhost\", \"127.0.0.1\" or if you have Photobooth installed inside a subfolder. <p>Example if Photobooth can be accessed directly: <code>192.168.0.50</code>.</p><p>Example if Photobooth is installed inside a subfolder: <code>192.168.0.50/photobooth</code>.</p>",
"manual:general:webserver_ssid": "Please define the wireless network name (SSID) to be used to access the Photobooth. The wireless network name (SSID) is displayed on the results page when the QR code is called up.",
"manual:get_request:get_request_collage": "Define GET request at countdown while taking a collage.",
"manual:get_request:get_request_enabled": "If enabled, a GET request will be made to defined Server.",
"manual:get_request:get_request_picture": "Define GET request at countdown while taking a picture.",
"manual:get_request:get_request_server": "Define the server for a GET request.",
"manual:jpeg_quality:jpeg_quality_chroma": "Picture quality used for chromakeying pictures.",
"manual:jpeg_quality:jpeg_quality_image": "Picture quality used for taking pictures. Value of -1 means the original file from the camera will be retained, if there is no other mods i.e. filters active.",
"manual:jpeg_quality:jpeg_quality_thumb": "Picture quality used for thumbnails.",
Expand Down
18 changes: 18 additions & 0 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,14 @@ const photoBooth = (function () {
success: (data) => {
console.log('picture processed', data);

if (config.get_request.enabled) {
const getUrl = config.get_request.server + '/' + photoStyle;
const request = new XMLHttpRequest();
console.log('Sending GET request to: ' + getUrl);
request.open('GET', getUrl);
request.send();
}

if (data.error) {
api.errorPic(data);
} else if (photoStyle === 'chroma') {
Expand Down Expand Up @@ -905,6 +913,16 @@ const photoBooth = (function () {
let current = start;
const stop = start > 2 ? start - 2 : start;

if (config.get_request.enabled) {
const getMode =
start == config.picture.cntdwn_time ? config.get_request.picture : config.get_request.collage;
const getUrl = config.get_request.server + '/' + getMode;
const request = new XMLHttpRequest();
console.log('Sending GET request to: ' + getUrl);
request.open('GET', getUrl);
request.send();
}

function timerFunction() {
element.text(Number(current) + Number(config.picture.cntdwn_offset));
current--;
Expand Down

0 comments on commit bf4f76d

Please sign in to comment.