Files
nexus/modules/pihole/pages/lists.php
Lars Gebhardt-Kusche 0174fa9d27
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped
asdasd
2026-04-27 02:16:54 +02:00

98 lines
4.0 KiB
PHP

<?php
$assets = app()->assets();
$assets->addStyle('/module/pihole/asset?file=pihole.css');
$assets->addScript('/module/pihole/asset?file=pihole.js', 'footer', true);
$settings = modules()->settings('pihole');
$instances = module_fn('pihole', 'instances');
$hasConfig = !empty($instances);
$refreshSeconds = (int)($settings['lists_refresh_sec'] ?? 5);
if ($refreshSeconds < 0) {
$refreshSeconds = 5;
}
?>
<?= module_shell_header('pihole', [
'title' => 'Listen & Domains',
'description' => 'Top-Domains, Listen-Updates fuer alle Instanzen und neue Eintraege auf der Primaer-Instanz.',
]) ?>
<div class="module-flow pihole-page" data-pihole-page="lists" data-refresh-seconds="<?= e((string)$refreshSeconds) ?>">
<?php if (!$hasConfig): ?>
<div class="module-box">
<strong>Keine Instanzen konfiguriert</strong>
<div class="muted" style="margin-top:.35rem;">Bitte zuerst eine Pi-hole Instanz hinzufuegen.</div>
<div style="margin-top:.75rem;"><a class="module-button module-button--secondary module-button--small" href="/module/pihole/instances">Instanzen verwalten</a></div>
</div>
<?php else: ?>
<section class="module-box">
<div class="pihole-section-header">
<strong>Listen-Updates</strong>
<span class="muted">Gravity / Blocklisten fuer alle oder einzelne Instanzen neu laden</span>
</div>
<div class="pihole-actions" data-list-actions>
<button class="cta-button" data-action="gravity" data-instance="all">Alle Instanzen aktualisieren</button>
<?php foreach ($instances as $instance): ?>
<button class="nav-link" data-action="gravity" data-instance="<?= e((string)($instance['id'] ?? '')) ?>">
<?= e((string)($instance['name'] ?? $instance['id'] ?? 'Instanz')) ?>
</button>
<?php endforeach; ?>
</div>
<div class="pihole-update" data-list-update-status></div>
</section>
<div class="module-box-grid module-box-grid--panels pihole-split">
<div class="module-box">
<div class="pihole-section-header">
<strong>Top geblockte Domains (Aggregiert)</strong>
<span class="muted">Letzte Statistiken</span>
</div>
<div class="pihole-list" data-top-ads></div>
</div>
<div class="module-box">
<div class="pihole-section-header">
<strong>Top erlaubte Domains (Aggregiert)</strong>
<span class="muted">Letzte Statistiken</span>
</div>
<div class="pihole-list" data-top-queries></div>
</div>
</div>
<section class="module-box">
<div class="pihole-section-header">
<strong>Domainlisten erweitern</strong>
<span class="muted">Eintraege werden auf der Primaer-Instanz gesetzt</span>
</div>
<form class="pihole-form" data-domain-form>
<label>
<span class="muted">Typ</span>
<select name="type">
<option value="block">Blacklist (Blocken)</option>
<option value="allow">Whitelist (Erlauben)</option>
</select>
</label>
<label>
<span class="muted">Domain</span>
<input type="text" name="domain" placeholder="example.com" required>
</label>
<button class="cta-button" type="submit">Hinzufuegen</button>
</form>
<div class="pihole-update" data-domain-status></div>
</section>
<section class="module-box">
<div class="pihole-section-header">
<strong>Adlist-URL hinzufuegen</strong>
<span class="muted">Optional: unterstuetzt nur wenn die API den Endpunkt anbietet.</span>
</div>
<form class="pihole-form" data-adlist-form>
<label>
<span class="muted">Adlist URL</span>
<input type="text" name="url" placeholder="https://example.com/list.txt" required>
</label>
<button class="nav-link" type="submit">Adlist hinzufuegen</button>
</form>
<div class="pihole-update" data-adlist-status></div>
</section>
<?php endif; ?>
</div>
<?= module_shell_footer() ?>