Plugin lives in Plugin/ — invisible to User Script Plugin. dev_install.sh symlinks into /usr/local/emhttp/plugins/varaverk/ for development. Pages: Monitor (5s poll), Scheduler (orchs + Advanced children, toggle + cron), Config (raw editor, host-aware file access), Docs (markdown + live $VAR substitution). API endpoints: monitor.php (JSON), scheduler.php (writes schedule.json + cron.d), config.php (writes conf files with host permission check). Includes: config.php (parser, host detection, var map), scheduler.php (job tree, cron.d rebuild), monitor.php (docker, GPU, resources, fallback, transcode), docs.php (file tree, var substitution, Parsedown renderer).
18 lines
570 B
PHP
18 lines
570 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
require_once dirname(__DIR__) . '/include/config.php';
|
|
|
|
$body = json_decode(file_get_contents('php://input'), true);
|
|
$file = trim($body['file'] ?? '');
|
|
$content = $body['content'] ?? '';
|
|
|
|
// Must be an allowed file for this host
|
|
$allowed = vv_get_conf_files();
|
|
if (!$file || !in_array($file, $allowed)) {
|
|
echo json_encode(['ok' => false, 'error' => 'File not permitted']);
|
|
exit;
|
|
}
|
|
|
|
$ok = vv_write_conf_raw($file, $content);
|
|
echo json_encode(['ok' => $ok, 'error' => $ok ? null : 'Failed to write file']);
|