Scheduler UI: - Arrange mode: drag scripts between orchs and reorder within arrays; right panel shows unassigned script pool; Save Arrangement commits to master.conf - + Folder: named collapsible subfolders for Custom Scripts stored in schedule.json - Rsync children: hide Run/Dry Run/Log/location when orch is ON; show standalone location + cron controls when orch is OFF; cron only fires when both filled - Non-conf-managed children (transcode): toggles now show enabled when orch is on - Right panel height sync: fix ResizeObserver feedback loop via align-self:flex-start on left panel and left.offsetHeight in vvFitRight - How do I use this: updated to cover arrange, folders, rsync standalone, transcode New API endpoints: - board.php, clearlock.php, movescript.php, rawconf.php, readscript.php - reorderarray.php, rsync_standalone.php, savefolders.php run.php / dryrun.php: accept optional --location= arg for standalone rsync calls
42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
// Save custom-script folder assignments to schedule.json (__folders key).
|
|
// POST: folders (JSON-encoded object: {"FolderName": ["Custom/script.sh", ...]})
|
|
header('Content-Type: application/json');
|
|
require_once dirname(__DIR__) . '/include/config.php';
|
|
require_once dirname(__DIR__) . '/include/scheduler.php';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
echo json_encode(['ok' => false, 'error' => 'POST only']);
|
|
exit;
|
|
}
|
|
|
|
$raw = $_POST['folders'] ?? '';
|
|
$decoded = json_decode($raw, true);
|
|
if (!is_array($decoded)) {
|
|
echo json_encode(['ok' => false, 'error' => 'Invalid JSON']);
|
|
exit;
|
|
}
|
|
|
|
$clean = [];
|
|
foreach ($decoded as $name => $scripts) {
|
|
$name = trim((string)$name);
|
|
if (!$name || strlen($name) > 80) continue;
|
|
if (!is_array($scripts)) continue;
|
|
$cleanScripts = [];
|
|
foreach ($scripts as $s) {
|
|
$s = trim((string)$s);
|
|
if (!$s || str_contains($s, '..') || !preg_match('/^[A-Za-z0-9_.\-\/]+\.sh$/', $s)) continue;
|
|
$cleanScripts[] = $s;
|
|
}
|
|
$clean[$name] = $cleanScripts;
|
|
}
|
|
|
|
$schedule = vv_schedule_load();
|
|
$schedule['__folders'] = $clean;
|
|
if (!vv_schedule_save($schedule)) {
|
|
echo json_encode(['ok' => false, 'error' => 'Write failed']);
|
|
exit;
|
|
}
|
|
|
|
echo json_encode(['ok' => true]);
|