Files

81 lines
2.7 KiB
PHP

<?php
declare(strict_types=1);
script('custom_pwa', 'admin');
style('custom_pwa', 'admin');
?>
<div
id="custom-pwa-admin-root"
class="section"
data-settings-get-url="<?php p((string)($_['settingsGetUrl'] ?? '')); ?>"
data-settings-save-url="<?php p((string)($_['settingsSaveUrl'] ?? '')); ?>"
>
<h2><?php p((string)($_['title'] ?? 'CustomPWA')); ?></h2>
<p class="settings-hint">CustomPWA settings are managed independently from Qortal Integration.</p>
<div class="custom-pwa-admin-actions">
<a class="button" href="<?php p((string)($_['installerUrl'] ?? '/apps/custom_pwa/install')); ?>" target="_blank" rel="noopener">Open Installer</a>
</div>
<div class="custom-pwa-admin-form">
<div class="custom-pwa-field">
<label for="custom-pwa-vapid-subject">VAPID Subject</label>
<input
type="text"
id="custom-pwa-vapid-subject"
placeholder="mailto:admin@example.com"
value="<?php p((string)($_['vapidSubject'] ?? '')); ?>"
>
</div>
<div class="custom-pwa-field">
<label for="custom-pwa-vapid-public-key">VAPID Public Key</label>
<textarea
id="custom-pwa-vapid-public-key"
rows="3"
placeholder="Base64URL public key"
><?php p((string)($_['vapidPublicKey'] ?? '')); ?></textarea>
</div>
<div class="custom-pwa-field">
<label for="custom-pwa-vapid-private-key">VAPID Private Key (optional update)</label>
<textarea
id="custom-pwa-vapid-private-key"
rows="5"
placeholder="Leave empty to keep existing key"
></textarea>
<p class="settings-hint custom-pwa-private-key-status">
Current private key status:
<strong id="custom-pwa-private-key-status"><?php p(!empty($_['vapidPrivateKeyConfigured']) ? 'configured' : 'not configured'); ?></strong>
</p>
</div>
<div class="custom-pwa-checkbox-row">
<label>
<input type="checkbox" id="custom-pwa-clear-vapid-private-key">
Clear saved private key
</label>
</div>
<div class="custom-pwa-checkbox-row">
<label>
<input type="checkbox" id="custom-pwa-email-fallback" <?php if (!empty($_['emailFallbackEnabled'])) { print_unescaped('checked'); } ?>>
Enable email fallback notifications
</label>
</div>
<div class="custom-pwa-checkbox-row">
<label>
<input type="checkbox" id="custom-pwa-sms-critical-fallback" <?php if (!empty($_['smsCriticalFallbackEnabled'])) { print_unescaped('checked'); } ?>>
Enable SMS fallback for critical events
</label>
</div>
</div>
<div class="custom-pwa-admin-actions">
<button id="custom-pwa-save-settings" class="button button-primary">Save CustomPWA Settings</button>
<button id="custom-pwa-refresh-settings" class="button">Refresh</button>
</div>
<p id="custom-pwa-admin-feedback" class="settings-hint" aria-live="polite"></p>
</div>