enabled=0|1 // // RESPONSE // {"ok":true,"error":null} // {"ok":false,"error":"POST only"|"Invalid id"|"Failed to write master.conf"} // // DEPENDS ON // include/scheduler.php vv_conf_toggle_script() → vv_conf_edit() → vv_write_conf_raw() // Configurations/master.conf the *_SCRIPTS arrays // ═══════════════════════════════════════════════════════════════════════════════════════════════ header('Content-Type: application/json'); require_once dirname(__DIR__) . '/include/scheduler.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { echo json_encode(['ok' => false, 'error' => 'POST only']); exit; } $id = trim($_POST['id'] ?? ''); $enabled = ($_POST['enabled'] ?? '0') === '1'; if (!$id || !preg_match('/^[a-zA-Z0-9_.\/\-]+\.sh$/', $id) || str_contains($id, '..')) { echo json_encode(['ok' => false, 'error' => 'Invalid id']); exit; } $ok = vv_conf_toggle_script($id, $enabled); echo json_encode(['ok' => $ok, 'error' => $ok ? null : 'Failed to write master.conf']);