Skip to content

Commit e6abed4

Browse files
authored
admin: show saving status after saving go2rtc config (#1420)
Change-Id: I22e6c0dbc9f785fe3e977d9507ea3a5d1ea78224 Co-authored-by: Andreas Skomski <andi34@users.noreply.github.com>
1 parent c5762bd commit e6abed4

File tree

2 files changed

+50
-32
lines changed

2 files changed

+50
-32
lines changed

admin/captureconfig.php

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use Photobooth\Service\ProcessService;
1010
use Photobooth\Utility\PathUtility;
1111

12-
header('Content-Type: application/json');
13-
1412
$loggerService = LoggerService::getInstance();
1513
$logger = $loggerService->getLogger('main');
1614
$logger->debug(basename($_SERVER['PHP_SELF']));
@@ -30,22 +28,33 @@
3028

3129
try {
3230
$configurationService->update($config);
33-
$logger->debug('New config saved.');
34-
echo json_encode([
35-
'status' => 'success',
36-
'message' => 'New config saved.',
37-
]);
31+
$message = 'New config saved.';
32+
$status = 'success';
3833
} catch (\Exception $exception) {
39-
$logger->error('ERROR: Config can not be saved!');
40-
echo json_encode([
41-
'status' => 'error',
42-
'message' => $exception->getMessage(),
43-
]);
34+
$message = $exception->getMessage();
35+
$status = 'error';
4436
}
4537

4638
// Kill service daemons after config has changed
4739
ProcessService::getInstance()->shutdown();
48-
49-
// return to Adminpanel
50-
header('location: ' . PathUtility::getPublicPath('admin'));
51-
exit();
40+
?>
41+
42+
<!DOCTYPE html>
43+
<html>
44+
<head>
45+
<meta http-equiv="refresh" content="2;url=<?= PathUtility::getPublicPath('admin') ?>">
46+
<style>
47+
body { font-family: sans-serif; padding: 2rem; }
48+
.success { color: green; }
49+
.error { color: red; }
50+
</style>
51+
</head>
52+
<body>
53+
<div class="<?= $status ?>">
54+
<?= htmlspecialchars($message) ?>
55+
</div>
56+
<p>Redirecting…</p>
57+
</body>
58+
</html>
59+
<?php
60+
exit;

admin/wgetcaptureconfig.php

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use Photobooth\Service\ProcessService;
1010
use Photobooth\Utility\PathUtility;
1111

12-
header('Content-Type: application/json');
13-
1412
$loggerService = LoggerService::getInstance();
1513
$logger = $loggerService->getLogger('main');
1614
$logger->debug(basename($_SERVER['PHP_SELF']));
@@ -30,22 +28,33 @@
3028

3129
try {
3230
$configurationService->update($config);
33-
$logger->debug('New config saved.');
34-
echo json_encode([
35-
'status' => 'success',
36-
'message' => 'New config saved.',
37-
]);
31+
$message = 'New config saved.';
32+
$status = 'success';
3833
} catch (\Exception $exception) {
39-
$logger->error('ERROR: Config can not be saved!');
40-
echo json_encode([
41-
'status' => 'error',
42-
'message' => $exception->getMessage(),
43-
]);
34+
$message = $exception->getMessage();
35+
$status = 'error';
4436
}
4537

4638
// Kill service daemons after config has changed
4739
ProcessService::getInstance()->shutdown();
48-
49-
// return to Adminpanel
50-
header('location: ' . PathUtility::getPublicPath('admin'));
51-
exit();
40+
?>
41+
42+
<!DOCTYPE html>
43+
<html>
44+
<head>
45+
<meta http-equiv="refresh" content="2;url=<?= PathUtility::getPublicPath('admin') ?>">
46+
<style>
47+
body { font-family: sans-serif; padding: 2rem; }
48+
.success { color: green; }
49+
.error { color: red; }
50+
</style>
51+
</head>
52+
<body>
53+
<div class="<?= $status ?>">
54+
<?= htmlspecialchars($message) ?>
55+
</div>
56+
<p>Redirecting…</p>
57+
</body>
58+
</html>
59+
<?php
60+
exit;

0 commit comments

Comments
 (0)