- Rename varaverk.page → Varaverk.page: unRAID nginx only routes URLs starting with a capital letter (~^/[A-Z].*), lowercase caused 404 - Add require_once config.php to include/scheduler.php and include/docs.php: both used SCRIPTS_DIR constant without including the file that defines it - Replace hardcoded SCRIPTS_DIR with cfg-file-backed setting: reads from /boot/config/plugins/varaverk/varaverk.cfg, falls back to default on first run - Add Plugin Settings card to Config tab with scripts path field - Add api/settings.php to write the cfg file (validates directory exists)
41 lines
984 B
Plaintext
41 lines
984 B
Plaintext
Menu="Utilities:85"
|
|
Title="Varaverk"
|
|
Icon="varaverk.png"
|
|
---
|
|
<?php
|
|
$plugin = 'varaverk';
|
|
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
|
$pluginDir = "$docroot/plugins/$plugin";
|
|
|
|
// Determine active tab
|
|
$tab = $_GET['tab'] ?? 'monitor';
|
|
$validTabs = ['monitor', 'scheduler', 'config', 'docs'];
|
|
if (!in_array($tab, $validTabs)) $tab = 'monitor';
|
|
?>
|
|
|
|
<link rel="stylesheet" href="/plugins/<?=$plugin?>/css/varaverk.css">
|
|
|
|
<div id="varaverk-wrap">
|
|
|
|
<!-- Tab bar -->
|
|
<div id="vv-tabs">
|
|
<?php foreach ($validTabs as $t): ?>
|
|
<a href="?tab=<?=$t?>" class="vv-tab<?= $t === $tab ? ' active' : '' ?>">
|
|
<?= ucfirst($t) ?>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
|
|
<!-- Tab content -->
|
|
<div id="vv-content">
|
|
<?php
|
|
$page = "$pluginDir/pages/$tab.php";
|
|
if (file_exists($page)) include $page;
|
|
else echo "<p>Page not found: $tab</p>";
|
|
?>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script src="/plugins/<?=$plugin?>/js/varaverk.js"></script>
|