Skip to content

Commit

Permalink
Merge branch 'dev' into HEAD
Browse files Browse the repository at this point in the history
Change-Id: I4bc754d4ccd1f1d238c37472b76cb9fe7293775e
  • Loading branch information
andi34 committed Sep 30, 2022
2 parents 175c87d + a79f5dc commit 6614040
Show file tree
Hide file tree
Showing 41 changed files with 779 additions and 589 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- dev
- stable4
pull_request:
branches:
- dev
- stable4
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gulp_sass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches:
- dev
- stable3
- stable4
paths:
- '**.scss'
pull_request:
branches:
- dev
- stable3
- stable4
paths:
- '**.scss'
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ on:
push:
branches:
- dev
- stable3
- stable4
paths:
- '**.js'
pull_request:
branches:
- dev
- stable3
- stable4
paths:
- '**.js'
workflow_dispatch:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ _(The full changelog can be found on [https://photoboothproject.github.io](https
[![Translate on Crowdin](https://img.shields.io/badge/Traslate%20on-Crowdin-green.svg)](https://crowdin.com/project/photobooth)

_Latest stable release:_
[![Lint](https://github.com/PhotoboothProject/photobooth/workflows/Lint/badge.svg?branch=stable3)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Astable3+workflow%3ALint)
[![gulp-sass](https://github.com/PhotoboothProject/photobooth/workflows/gulp-sass/badge.svg?branch=stable3)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Astable3+workflow%3Agulp-sass)
[![Build](https://github.com/PhotoboothProject/photobooth/workflows/Build/badge.svg?branch=stable3)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Astable3+workflow%3ABuild)
[![Lint](https://github.com/PhotoboothProject/photobooth/workflows/Lint/badge.svg?branch=stable4)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Astable4+workflow%3ALint)
[![gulp-sass](https://github.com/PhotoboothProject/photobooth/workflows/gulp-sass/badge.svg?branch=stable4)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Astable4+workflow%3Agulp-sass)
[![Build](https://github.com/PhotoboothProject/photobooth/workflows/Build/badge.svg?branch=stable4)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Astable4+workflow%3ABuild)

_Latest development version:_
[![Lint](https://github.com/PhotoboothProject/photobooth/workflows/Lint/badge.svg?branch=dev)](https://github.com/PhotoboothProject/photobooth/actions?query=branch%3Adev+workflow%3ALint)
Expand Down Expand Up @@ -195,4 +195,4 @@ If you like my work and like to keep me motivated you can buy me a coconut water
- [Moarqi](https://github.com/Moarqi)
- [kreativmonkey](https://github.com/kreativmonkey)
- [Khaos66](https://github.com/Khaos66)

- [DJ DT-Sommer](https://dt-sommer.jimdofree.com)
15 changes: 8 additions & 7 deletions admin/debugpanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<link rel="stylesheet" type="text/css" href="../node_modules/normalize.css/normalize.css">
<link rel="stylesheet" type="text/css" href="../node_modules/font-awesome/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="../node_modules/selectize/dist/css/selectize.css">
<link rel="stylesheet" type="text/css" href="../resources/css/<?php echo $config['ui']['style']; ?>_admin.css">
<link rel="stylesheet" type="text/css" href="../resources/css/<?php echo $config['ui']['style']; ?>_admin.css?v=<?php echo $config['photobooth']['version']; ?>">
<?php if (is_file("../private/overrides.css")): ?>
<link rel="stylesheet" href="../private/overrides.css" />
<link rel="stylesheet" href="../private/overrides.css?v=<?php echo $config['photobooth']['version']; ?>" />
<?php endif; ?>
</head>
<body>
Expand Down Expand Up @@ -99,6 +99,7 @@ function html_src_indent($num)
echo '<li><a class="'. $btnClass .'" href="#devlog" id="nav-devlog"><div><span data-i18n="devlog">devlog</span></div></a></li>';
echo '<li><a class="'. $btnClass .'" href="#serverprocesses" id="nav-serverprocesses"><div><span data-i18n="serverprocesses">serverprocesses</span></div></a></li>';
echo '<li><a class="'. $btnClass .'" href="#bootconfig" id="nav-bootconfig"><div><span data-i18n="bootconfig">bootconfig</span></div></a></li>';
echo '<li><a class="'. $btnClass .'" href="#installlog" id="nav-installlog"><div><span data-i18n="installlog">installlog</span></div></a></li>';
echo '<li><a class="'. $btnClass .'" href="#githead" id="nav-githead"><div><span data-i18n="githead">githead</span></div></a></li>';

html_src_indent(--$indent);
Expand All @@ -112,14 +113,14 @@ function html_src_indent($num)
</div>
</div>
<script src="../node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../api/config.php?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../node_modules/selectize/dist/js/standalone/selectize.min.js"></script>
<script type="text/javascript" src="../resources/js/tools.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="text/javascript" src="../resources/js/debugpanel.js"></script>
<script type="text/javascript" src="../resources/js/tools.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/theme.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/debugpanel.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script src="../node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="../resources/js/i18n.js"></script>
<script type="text/javascript" src="../resources/js/i18n.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
</body>
</html>

16 changes: 8 additions & 8 deletions admin/diskusage.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@

<link rel="stylesheet" href="../node_modules/normalize.css/normalize.css" />
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="../resources/css/login.css" />
<link rel="stylesheet" href="../resources/css/login.css?v=<?php echo $config['photobooth']['version']; ?>" />
<?php if (is_file("../private/overrides.css")): ?>
<link rel="stylesheet" href="../private/overrides.css" />
<link rel="stylesheet" href="../private/overrides.css?v=<?php echo $config['photobooth']['version']; ?>" />
<?php endif; ?>
</head>

Expand Down Expand Up @@ -81,14 +81,14 @@
<div class="modal__body" id="save_mesg_text"><span data-i18n="saving"></span></div>
</div>

<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../api/config.php?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../resources/js/tools.js"></script>
<script type="text/javascript" src="../resources/js/adminshortcut.js"></script>
<script type="text/javascript" src="../resources/js/diskusage.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="text/javascript" src="../resources/js/tools.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/adminshortcut.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/diskusage.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/theme.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script src="../node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="module" src="../resources/js/i18n.js"></script>
<script type="module" src="../resources/js/i18n.js?v=<?php echo $config['photobooth']['version']; ?>"></script>

</body>
</html>
14 changes: 7 additions & 7 deletions admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<link rel="stylesheet" type="text/css" href="../node_modules/normalize.css/normalize.css">
<link rel="stylesheet" type="text/css" href="../node_modules/font-awesome/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="../node_modules/selectize/dist/css/selectize.css">
<link rel="stylesheet" type="text/css" href="../resources/css/<?php echo $config['ui']['style']; ?>_admin.css">
<link rel="stylesheet" type="text/css" href="../resources/css/<?php echo $config['ui']['style']; ?>_admin.css?v=<?php echo $config['photobooth']['version']; ?>">
<?php if (is_file("../private/overrides.css")): ?>
<link rel="stylesheet" href="../private/overrides.css" />
<link rel="stylesheet" href="../private/overrides.css?v=<?php echo $config['photobooth']['version']; ?>" />
<?php endif; ?>
</head>
<body>
Expand Down Expand Up @@ -289,14 +289,14 @@ function isElementHidden($element_class, $setting)
</div>
</form>
<script src="../node_modules/whatwg-fetch/dist/fetch.umd.js"></script>
<script type="text/javascript" src="../api/config.php"></script>
<script type="text/javascript" src="../api/config.php?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../node_modules/waypoints/lib/jquery.waypoints.min.js"></script>
<script type="text/javascript" src="../node_modules/selectize/dist/js/standalone/selectize.min.js"></script>
<script type="text/javascript" src="../resources/js/tools.js"></script>
<script type="text/javascript" src="../resources/js/theme.js"></script>
<script type="text/javascript" src="../resources/js/admin.js"></script>
<script type="text/javascript" src="../resources/js/tools.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/theme.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script type="text/javascript" src="../resources/js/admin.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
<script src="../node_modules/@andreasremdt/simple-translator/dist/umd/translator.min.js"></script>
<script type="text/javascript" src="../resources/js/i18n.js"></script>
<script type="text/javascript" src="../resources/js/i18n.js?v=<?php echo $config['photobooth']['version']; ?>"></script>
</body>
</html>
157 changes: 99 additions & 58 deletions api/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,15 @@
require_once '../lib/config.php';
require_once '../lib/db.php';

$data = $_POST;
if (!isset($data['type'])) {
echo json_encode('error');
}

if ($data['type'] == 'reset') {
if ($config['reset']['remove_images']) {
// empty folders
foreach ($config['foldersAbs'] as $folder) {
if (is_dir($folder)) {
$files = glob($folder . '/*.jpg');
foreach ($files as $file) {
// iterate files
if (is_file($file)) {
// delete file
unlink($file);
}
}
}
}
}

if ($config['reset']['remove_mailtxt']) {
if (is_file(MAIL_FILE)) {
unlink(MAIL_FILE); // delete file
}
}
$LogData = [
'php' => basename($_SERVER['PHP_SELF']),
];

if ($config['reset']['remove_config']) {
// delete personal config
if (is_file('../config/my.config.inc.php')) {
unlink('../config/my.config.inc.php');
}
}

$logFiles = glob($config['foldersAbs']['tmp'] . '/*.log');
foreach ($logFiles as $logFile) {
// iterate files
if (is_file($logFile)) {
// delete file
unlink($logFile);
}
}

// delete db.txt
if (is_file(DB_FILE)) {
// delete file
unlink(DB_FILE);
}

die(json_encode('success'));
}
$data = $_POST;

if ($data['type'] == 'config') {
if (isset($data['type'])) {
$newConfig = [];
$LogData[] = ['config' => 'Saving Photobooth configuration'];

foreach ($config as $k => $conf) {
if (is_array($conf)) {
Expand Down Expand Up @@ -94,13 +48,17 @@
}
} else {
$newConfig['login']['enabled'] = false;
$LogData[] = ['login' => 'Password not set. Login disabled.'];
}
} else {
$newConfig['login']['password'] = null;
}

if ($newConfig['preview']['mode'] != 'device_cam' && $newConfig['preview']['mode'] != 'gphoto') {
if ($newConfig['preview']['camTakesPic'] && $newConfig['preview']['mode'] != 'device_cam' && $newConfig['preview']['mode'] != 'gphoto') {
$newConfig['preview']['camTakesPic'] = false;
$LogData = [
'preview' => 'Device cam takes picture disabled. Can take images from preview only from gphoto2 and device cam preview.',
];
}

if ($newConfig['ui']['style'] === 'custom') {
Expand All @@ -112,6 +70,9 @@
!is_readable('../resources/css/custom_live_chromakeying.css')
) {
$newConfig['ui']['style'] = 'modern_squared';
$LogData[] = [
'ui' => 'No custom style resources found. Falling back to modern squared style.',
];
} else {
if (!file_exists('../template/custom.template.php')) {
copy('../template/modern.template.php', '../template/custom.template.php');
Expand All @@ -132,8 +93,18 @@
}

if (SERVER_OS === 'windows') {
$newConfig['remotebuzzer']['enabled'] = false;
$newConfig['synctodrive']['enabled'] = false;
if (!empty($newConfig['remotebuzzer']['enabled'])) {
$newConfig['remotebuzzer']['enabled'] = false;
$LogData[] = [
'remotebuzzer' => 'Remotebuzzer server unsupported on Windows.',
];
}
if (!empty($newConfig['synctodrive']['enabled'])) {
$newConfig['synctodrive']['enabled'] = false;
$LogData[] = [
'synctodrive' => 'Sync pictures to USB stick unsupported on Windows.',
];
}
}

if (isset($newConfig['database']['file']) && empty($newConfig['database']['file'])) {
Expand All @@ -148,9 +119,14 @@
$newConfig['remotebuzzer']['port'] = 14711;
}

if (isset($newConfig['get_request']['server']) && empty($newConfig['get_request']['server'])) {
$newConfig['get_request']['countdown'] = false;
$newConfig['get_request']['processed'] = false;
if ($newConfig['get_request']['countdown'] || $newConfig['get_request']['processed']) {
if (isset($newConfig['get_request']['server']) && empty($newConfig['get_request']['server'])) {
$newConfig['get_request']['countdown'] = false;
$newConfig['get_request']['processed'] = false;
$LogData[] = [
'get_request' => 'No GET request server entered. Disabled GET request options.',
];
}
}

$collageLayout = $newConfig['collage']['layout'];
Expand Down Expand Up @@ -182,12 +158,77 @@

if (file_put_contents($my_config_file, $content)) {
clearCache($my_config_file);
$LogData[] = ['config' => 'New config saved'];

if ($data['type'] == 'reset') {
$LogData[] = ['reset' => 'Resetting Photobooth'];

if ($newConfig['reset']['remove_images']) {
$LogData[] = ['remove_images' => 'Removing images'];
// empty folders
foreach ($config['foldersAbs'] as $folder) {
if ($folder != $config['foldersAbs']['archives'] && $folder != $config['foldersAbs']['private']) {
if (is_dir($folder)) {
$files = glob($folder . '/*.jpg');
foreach ($files as $file) {
// iterate files
if (is_file($file)) {
// delete file
unlink($file);
$LogData[] = [$file => 'deleted'];
}
}
}
} else {
$LogData[] = [$folder => 'skipped'];
}
}
}

if ($newConfig['reset']['remove_mailtxt']) {
if (is_file(MAIL_FILE)) {
unlink(MAIL_FILE); // delete file
$LogData[] = [MAIL_FILE => 'deleted'];
}
}

if ($newConfig['reset']['remove_config']) {
// delete personal config
if (is_file('../config/my.config.inc.php')) {
unlink('../config/my.config.inc.php');
$LogData[] = ['my.config.inc.php' => 'deleted'];
}
}

$logFiles = glob($config['foldersAbs']['tmp'] . '/*.log');
foreach ($logFiles as $logFile) {
// iterate files
if (is_file($logFile)) {
// delete file
unlink($logFile);
$LogData[] = [$logFile => 'deleted'];
}
}

// delete db.txt
if (is_file(DB_FILE)) {
// delete file
unlink(DB_FILE);
$LogData[] = [DB_FILE => 'deleted'];
}
}
echo json_encode('success');
} else {
$LogData[] = ['config' => 'ERROR: Config can not be saved!'];

echo json_encode('error');
}
} else {
$LogData[] = ['type' => 'ERROR: Unknown action.'];
logError($LogData);
die(json_encode('error'));
}
logError($LogData);

/* Kill service daemons after config has changed */
require_once '../lib/services_stop.php';
Expand Down
5 changes: 1 addition & 4 deletions api/checkVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
$content = file_get_contents($url, false, $context);
$data = json_decode($content, true);
$remoteVersion = substr($data['tag_name'], 1);

$packageContent = file_get_contents('../package.json');
$package = json_decode($packageContent, true);
$localVersion = $package['version'];
$localVersion = $config['photobooth']['version'];

$LogData = [
'updateAvailable' => $remoteVersion !== $localVersion,
Expand Down
Loading

0 comments on commit 6614040

Please sign in to comment.