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

Commit bf4f76d

Browse files
committed
feature: allow sending a GET request at countdown and while processing
Change-Id: I2b447f7dcfabe7618ebc3372a183914f32ef94d3
1 parent bdb3f0e commit bf4f76d

File tree

4 files changed

+65
-0
lines changed

4 files changed

+65
-0
lines changed

config/config.inc.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@
259259
$config['synctodrive']['interval'] = 300;
260260

261261

262+
// G E T R E Q U E S T
263+
$config['get_request']['enabled'] = false;
264+
$config['get_request']['server'] = NULL;
265+
$config['get_request']['picture'] = 'CNTDWNPHOTO';
266+
$config['get_request']['collage'] = 'CNTDWNCOLLAGE';
267+
268+
262269
// A U T H E N T I C A T I O N
263270
$config['login']['enabled'] = false;
264271
$config['login']['username'] = 'Photo';

lib/configsetup.inc.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,37 @@
15311531
'value' => $config['synctodrive']['logfile'],
15321532
],
15331533
],
1534+
'get_request' => [
1535+
'platform' => 'linux',
1536+
'view' => 'advanced',
1537+
'get_request_enabled' => [
1538+
'view' => 'basic',
1539+
'type' => 'checkbox',
1540+
'name' => 'get_request[enabled]',
1541+
'value' => $config['get_request']['enabled'],
1542+
],
1543+
'get_request_server' => [
1544+
'view' => 'advanced',
1545+
'type' => 'input',
1546+
'placeholder' => 'http://xxx.xxx.xxx.xxx',
1547+
'name' => 'get_request[server]',
1548+
'value' => htmlentities($config['get_request']['server']),
1549+
],
1550+
'get_request_picture' => [
1551+
'view' => 'advanced',
1552+
'type' => 'input',
1553+
'placeholder' => $defaultConfig['get_request']['picture'],
1554+
'name' => 'get_request[picture]',
1555+
'value' => htmlentities($config['get_request']['picture']),
1556+
],
1557+
'get_request_collage' => [
1558+
'view' => 'advanced',
1559+
'type' => 'input',
1560+
'placeholder' => $defaultConfig['get_request']['collage'],
1561+
'name' => 'get_request[collage]',
1562+
'value' => htmlentities($config['get_request']['collage']),
1563+
],
1564+
],
15341565
'authentication' => [
15351566
'view' => 'basic',
15361567
'login_enabled' => [

resources/lang/en.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@
149149
"general:ui_language": "Choose Language",
150150
"general:webserver_ip": "IP address of the Photobooth web server",
151151
"general:webserver_ssid": "Wireless network name (SSID) used to access the photobooth",
152+
"get_request": "GET request",
153+
"get_request:get_request_collage": "GET request for collage",
154+
"get_request:get_request_enabled": "Send GET request to server at countdown and after processing",
155+
"get_request:get_request_picture": "GET request for picture",
156+
"get_request:get_request_server": "GET request server",
152157
"githead": "Latest changes",
153158
"home": "Home",
154159
"insertMail": "Enter your e-mail address to receive the photo.",
@@ -296,6 +301,10 @@
296301
"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>",
297302
"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>",
298303
"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.",
304+
"manual:get_request:get_request_collage": "Define GET request at countdown while taking a collage.",
305+
"manual:get_request:get_request_enabled": "If enabled, a GET request will be made to defined Server.",
306+
"manual:get_request:get_request_picture": "Define GET request at countdown while taking a picture.",
307+
"manual:get_request:get_request_server": "Define the server for a GET request.",
299308
"manual:jpeg_quality:jpeg_quality_chroma": "Picture quality used for chromakeying pictures.",
300309
"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.",
301310
"manual:jpeg_quality:jpeg_quality_thumb": "Picture quality used for thumbnails.",

src/js/core.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,14 @@ const photoBooth = (function () {
658658
success: (data) => {
659659
console.log('picture processed', data);
660660

661+
if (config.get_request.enabled) {
662+
const getUrl = config.get_request.server + '/' + photoStyle;
663+
const request = new XMLHttpRequest();
664+
console.log('Sending GET request to: ' + getUrl);
665+
request.open('GET', getUrl);
666+
request.send();
667+
}
668+
661669
if (data.error) {
662670
api.errorPic(data);
663671
} else if (photoStyle === 'chroma') {
@@ -905,6 +913,16 @@ const photoBooth = (function () {
905913
let current = start;
906914
const stop = start > 2 ? start - 2 : start;
907915

916+
if (config.get_request.enabled) {
917+
const getMode =
918+
start == config.picture.cntdwn_time ? config.get_request.picture : config.get_request.collage;
919+
const getUrl = config.get_request.server + '/' + getMode;
920+
const request = new XMLHttpRequest();
921+
console.log('Sending GET request to: ' + getUrl);
922+
request.open('GET', getUrl);
923+
request.send();
924+
}
925+
908926
function timerFunction() {
909927
element.text(Number(current) + Number(config.picture.cntdwn_offset));
910928
current--;

0 commit comments

Comments
 (0)