Render chkbox turns off once rendering job starts

This commit is contained in:
hbrain 2026-06-20 18:40:18 +02:00
parent 55b2da4ed9
commit 2d38a1673b
2 changed files with 11 additions and 1 deletions

View file

@ -5,6 +5,7 @@ $config = require __DIR__ . '/config.php';
header('Content-Type: application/json; charset=UTF-8');
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
$jobs = [];
$switches = [];
$dirs = glob($config['uploads_dir'] . '/*', GLOB_ONLYDIR) ?: [];
foreach ($dirs as $dir) {
$name = basename($dir);
@ -16,6 +17,12 @@ foreach ($dirs as $dir) {
$articleId = is_array($state) ? strtolower((string)($state['article_id'] ?? '')) : '';
if ($articleId === '' && is_file($idFile)) $articleId = strtolower(trim((string)file_get_contents($idFile)));
if (!preg_match('/^[0-9]{14}[a-f0-9]{16}$/', $articleId)) $articleId = '';
$switches[] = [
'dir' => $name,
'id' => $articleId,
'enabled' => is_file($dir . '/.movmaker-enabled'),
'preview' => is_file($dir . '/.movmaker-preview'),
];
$locked = is_dir($lockDir);
if ($locked || $status === 'processing') {
$started = '';
@ -29,4 +36,4 @@ foreach ($dirs as $dir) {
];
}
}
echo json_encode(['jobs' => $jobs, 'checked_at' => date('c')], JSON_UNESCAPED_UNICODE);
echo json_encode(['jobs' => $jobs, 'switches' => $switches, 'checked_at' => date('c')], JSON_UNESCAPED_UNICODE);