Add Varaverk plugin scaffold (PHP, unRAID native)

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).
This commit is contained in:
Gmer4Lfe
2026-05-23 16:19:12 -04:00
parent 5e4f510a42
commit 4ab3ddbc47
15 changed files with 829 additions and 0 deletions
@@ -0,0 +1,79 @@
<?php
require_once dirname(__DIR__) . '/include/scheduler.php';
$tree = vv_job_tree();
?>
<div id="vv-scheduler">
<p class="vv-hint">Orchestrators run their child scripts in the correct order.
Disable an orchestrator and enable individual scripts below it to run them
in isolation for debugging or testing.</p>
<?php foreach ($tree as $orch): ?>
<div class="vv-job vv-orch" data-id="<?= htmlspecialchars($orch['id']) ?>">
<div class="vv-job-row">
<label class="vv-toggle">
<input type="checkbox" class="vv-enabled"
<?= $orch['enabled'] ? 'checked' : '' ?>
onchange="vvSaveJob(this)">
<span class="vv-slider"></span>
</label>
<span class="vv-job-label"><?= htmlspecialchars($orch['label']) ?></span>
<input type="text" class="vv-cron" value="<?= htmlspecialchars($orch['cron']) ?>"
placeholder="cron expression" onblur="vvSaveJob(this)">
<span class="vv-job-status" id="vv-status-<?= md5($orch['id']) ?>"></span>
<?php if (!empty($orch['children'])): ?>
<button class="vv-advanced-toggle" onclick="vvToggleAdvanced(this)">Advanced ▸</button>
<?php endif; ?>
</div>
<?php if (!empty($orch['children'])): ?>
<div class="vv-children" style="display:none;">
<?php foreach ($orch['children'] as $child): ?>
<div class="vv-job vv-script" data-id="<?= htmlspecialchars($child['id']) ?>">
<div class="vv-job-row">
<label class="vv-toggle">
<input type="checkbox" class="vv-enabled"
<?= $child['enabled'] ? 'checked' : '' ?>
onchange="vvSaveJob(this)">
<span class="vv-slider"></span>
</label>
<span class="vv-job-label"><?= htmlspecialchars($child['label']) ?></span>
<input type="text" class="vv-cron" value="<?= htmlspecialchars($child['cron']) ?>"
placeholder="cron expression" onblur="vvSaveJob(this)">
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<script>
function vvSaveJob(el) {
const row = el.closest('.vv-job');
const id = row.dataset.id;
const enabled = row.querySelector('.vv-enabled').checked;
const cron = row.querySelector('.vv-cron').value.trim();
fetch('/plugins/varaverk/api/scheduler.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id, enabled, cron})
})
.then(r => r.json())
.then(d => {
const statusEl = document.getElementById('vv-status-' + btoa(id).replace(/=/g,''));
if (statusEl) statusEl.textContent = d.ok ? '✓' : '✗ ' + (d.error ?? '');
});
}
function vvToggleAdvanced(btn) {
const children = btn.closest('.vv-job').querySelector('.vv-children');
const visible = children.style.display !== 'none';
children.style.display = visible ? 'none' : 'block';
btn.textContent = visible ? 'Advanced ▸' : 'Advanced ▾';
}
</script>