91 lines
4.5 KiB
PHP
91 lines
4.5 KiB
PHP
|
|
<?php
|
||
|
|
$pageTitle = 'Updates';
|
||
|
|
$status = is_array($status ?? null) ? $status : [];
|
||
|
|
$channel = (string)($channel ?? 'stable');
|
||
|
|
$message = (string)($message ?? '');
|
||
|
|
$messageType = (string)($message_type ?? '');
|
||
|
|
|
||
|
|
ob_start();
|
||
|
|
?>
|
||
|
|
<section class="admin-card" style="display:grid; gap:18px;">
|
||
|
|
<div class="badge">System</div>
|
||
|
|
<div style="display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap;">
|
||
|
|
<div>
|
||
|
|
<h1 style="margin:0; font-size:42px; line-height:1;">Updates</h1>
|
||
|
|
<p style="margin:10px 0 0; color:var(--muted);">Check for new AudioCore releases from your Gitea manifest.</p>
|
||
|
|
</div>
|
||
|
|
<form method="post" action="/admin/updates">
|
||
|
|
<input type="hidden" name="updates_action" value="check_now">
|
||
|
|
<button class="btn" type="submit">Check Now</button>
|
||
|
|
</form>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if ($message !== ''): ?>
|
||
|
|
<div style="padding:12px 14px; border-radius:12px; border:1px solid <?= $messageType === 'error' ? 'rgba(255,124,124,.45)' : 'rgba(57,244,179,.45)' ?>; background:<?= $messageType === 'error' ? 'rgba(180,40,40,.18)' : 'rgba(10,90,60,.22)' ?>;">
|
||
|
|
<?= htmlspecialchars($message, ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
|
||
|
|
<div class="admin-card" style="padding:16px; background:rgba(255,255,255,.03); box-shadow:none;">
|
||
|
|
<div style="display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px;">
|
||
|
|
<div>
|
||
|
|
<div class="badge" style="margin-bottom:6px;">Installed</div>
|
||
|
|
<div style="font-size:26px; font-weight:700;"><?= htmlspecialchars((string)($status['current_version'] ?? '0.0.0'), ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<div class="badge" style="margin-bottom:6px;">Latest</div>
|
||
|
|
<div style="font-size:26px; font-weight:700;"><?= htmlspecialchars((string)($status['latest_version'] ?? '-'), ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<div class="badge" style="margin-bottom:6px;">Status</div>
|
||
|
|
<?php if (!empty($status['ok']) && !empty($status['update_available'])): ?>
|
||
|
|
<div style="font-size:20px; font-weight:700; color:#9ff8d8;">Update available</div>
|
||
|
|
<?php elseif (!empty($status['ok'])): ?>
|
||
|
|
<div style="font-size:20px; font-weight:700; color:#9ff8d8;">Up to date</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<div style="font-size:20px; font-weight:700; color:#ffb7b7;">Check failed</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
<div>
|
||
|
|
<div class="badge" style="margin-bottom:6px;">Channel</div>
|
||
|
|
<div style="font-size:18px; font-weight:700; text-transform:uppercase;"><?= htmlspecialchars((string)($status['channel'] ?? 'stable'), ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<?php if (!empty($status['error'])): ?>
|
||
|
|
<div style="margin-top:12px; color:#ffb7b7;"><?= htmlspecialchars((string)$status['error'], ENT_QUOTES, 'UTF-8') ?></div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<div style="margin-top:10px; color:var(--muted); font-size:13px;">
|
||
|
|
Last checked: <?= htmlspecialchars((string)($status['checked_at'] ?? 'never'), ENT_QUOTES, 'UTF-8') ?>
|
||
|
|
</div>
|
||
|
|
<?php if (!empty($status['changelog_url'])): ?>
|
||
|
|
<div style="margin-top:8px;">
|
||
|
|
<a href="<?= htmlspecialchars((string)$status['changelog_url'], ENT_QUOTES, 'UTF-8') ?>" target="_blank" rel="noopener" style="color:#9ff8d8;">View changelog</a>
|
||
|
|
</div>
|
||
|
|
<?php endif; ?>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<form method="post" action="/admin/updates" class="admin-card" style="padding:16px; background:rgba(255,255,255,.03); box-shadow:none; display:grid; gap:12px;">
|
||
|
|
<input type="hidden" name="updates_action" value="save_config">
|
||
|
|
<div class="badge">Update Source</div>
|
||
|
|
<div style="display:grid; grid-template-columns:1fr 1fr; gap:12px;">
|
||
|
|
<label style="display:grid; gap:6px;">
|
||
|
|
<span class="label">Channel</span>
|
||
|
|
<select class="input" name="update_channel">
|
||
|
|
<option value="stable" <?= $channel === 'stable' ? 'selected' : '' ?>>Stable</option>
|
||
|
|
<option value="beta" <?= $channel === 'beta' ? 'selected' : '' ?>>Beta</option>
|
||
|
|
</select>
|
||
|
|
</label>
|
||
|
|
<label style="display:grid; gap:6px;">
|
||
|
|
<span class="label">Manifest Source</span>
|
||
|
|
<input class="input" type="text" value="<?= htmlspecialchars((string)($status['manifest_url'] ?? ''), ENT_QUOTES, 'UTF-8') ?>" readonly>
|
||
|
|
</label>
|
||
|
|
</div>
|
||
|
|
<div style="display:flex; justify-content:flex-end;">
|
||
|
|
<button class="btn" type="submit">Save Update Settings</button>
|
||
|
|
</div>
|
||
|
|
</form>
|
||
|
|
</section>
|
||
|
|
<?php
|
||
|
|
$content = ob_get_clean();
|
||
|
|
require __DIR__ . '/layout.php';
|