constheadings={certificates:["Certificates","Expiration, issuer, and certificate-detection status for automatic HTTPS."],logs:["Access Logs & Gateway Events","Recent requests, upstream responses, and gateway health events served through Caddy."],performance:["Performance","Live and historical request throughput across your gateway."],administration:["Administration","Users, gateway defaults, backups, security, and updates."],streaming:["Streaming hosts","Forward raw TCP/UDP traffic on a specific port straight to another host and port."],redirects:["Redirect hosts","Send domains to a new destination with clear, predictable rules."],access:["Access Lists","Create reusable network and login protection for your hosts."],documentation:["Documentation","Plain-language guidance and real-world Site Gateway examples."],account:["My Account","Manage your profile, password, and two-factor authentication."]};
constheadings={certificates:["Certificates","Expiration, issuer, and certificate-detection status for automatic HTTPS."],logs:["Access Logs & Gateway Events","Recent requests, upstream responses, and gateway health events served through Caddy."],performance:["Performance","Live and historical request throughput across your gateway."],administration:["Administration","Users, gateway defaults, backups, and updates."],streaming:["Streaming hosts","Forward raw TCP/UDP traffic on a specific port straight to another host and port."],redirects:["Redirect hosts","Send domains to a new destination with clear, predictable rules."],access:["Access Lists","Create reusable network and login protection for your hosts."],documentation:["Documentation","Plain-language guidance and real-world Site Gateway examples."],account:["My Account","Manage your profile, password, and two-factor authentication."]};
$("#open-create").textContent=state.view==="administration"?"+ Create user":state.view==="streaming"?"+ New streaming host":state.view==="redirects"?"+ New redirect host":state.view==="access"?"+ New Access List":$("#open-create").textContent;
<divclass="diagnostic-section-heading"><pclass="eyebrow">Certificate inventory</p><h2>Certificates</h2><pclass="muted">Managed and uploaded certificates assigned to configured domains.</p></div><divid="certificate-list"class="data-list diagnostic-list"><pclass="quiet-state">Loading certificates…</p></div>
<sectionclass="dashboard-panel readiness-panel"><divclass="panel-heading"><div><pclass="eyebrow">Guided diagnostics</p><h2>Domain readiness</h2><pclass="muted">DNS, listener, TLS, and upstream checks for every configured domain.</p></div></div><divid="readiness-list"class="dashboard-list diagnostic-list"><pclass="quiet-state">Checking configured domains…</p></div></section>
<sectionclass="dashboard-panel readiness-panel"><divclass="panel-heading"><div><pclass="eyebrow">Guided diagnostics</p><h2>Domain readiness</h2><pclass="muted">DNS, listener, TLS, and upstream checks for every configured domain.</p></div></div><divid="readiness-list"class="dashboard-list diagnostic-list"><pclass="quiet-state">Checking configured domains…</p></div></section><sectionclass="dashboard-panel"><divclass="panel-heading"><div><pclass="eyebrow">Certificate health</p><h2>Renewal thresholds</h2><pclass="muted">Control when a certificate is flagged as renewing soon, critical, or stale on this page and the dashboard.</p></div></div><formid="health-settings-form"class="settings-form"><label>Renewing-soon warning<inputname="warningDays"type="number"min="8"max="120"value="30"><small>Days remaining before a certificate is highlighted.</small></label><label>Critical warning<inputname="criticalDays"type="number"min="1"max="119"value="7"><small>Must be lower than the renewing-soon threshold.</small></label><label>Stale health data<inputname="staleMinutes"type="number"min="2"max="1440"value="10"><small>Minutes before a displayed check is considered old.</small></label><divclass="dialog-actions"><buttonclass="button primary">Save health settings</button></div></form></section>
<sectiondata-admin-panel="backups"class="hidden settings-panel"><divclass="panel-heading"><div><h2>Backup & restore</h2><pclass="muted">Create a copy, restore a previous version, or schedule automatic backups.</p></div><divclass="row-actions"><buttonid="import-backup"class="button secondary">Import backup</button><buttonid="create-backup"class="button primary">Create backup</button></div></div><inputid="backup-upload"type="file"accept=".sgbackup,application/zip"hidden><formid="backup-settings-form"class="settings-form backup-settings"><divclass="form-section form-section-wide"><pclass="eyebrow">Scheduled backups</p><divclass="form-grid"><labelclass="check-control"><inputname="enabled"type="checkbox"><span>Enable scheduled backups</span></label><label>Backup type<selectname="type"><optionvalue="complete">Complete (Recommended) — configuration + hosted files</option><optionvalue="configuration">Configuration only</option></select><smallid="backup-type-help">Configuration only includes settings and metadata, not uploaded Hosted Site files.</small></label><pid="backup-config-only-warning"class="callout hidden"style="grid-column:1/-1"><strong>Heads up</strong><span>Scheduled backups are set to Configuration only — they will not include your Hosted Site files, icons, or certificates. Switch to Complete if you want scheduled backups to protect those too.</span></p><label>Schedule<selectname="frequency"><optionvalue="daily">Daily</option><optionvalue="weekly">Weekly</option><optionvalue="monthly">Monthly</option></select></label><label>Hour<selectname="hour"></select></label><label>Keep<inputname="retention"type="number"min="1"max="100"value="7"></label><labelclass="check-control"><inputname="includeLogs"type="checkbox"><span>Include logs</span></label></div></div><divclass="form-section form-section-wide"><pclass="eyebrow">Encryption</p><divclass="form-grid encryption-grid"><labelclass="backup-password-field"><spanclass="field-label">Backup encryption password <spanclass="optional">Optional</span></span><inputname="backupPassword"type="password"autocomplete="new-password"><small>Used for manually created backups and required when restoring an encrypted archive. It is not stored by Site Gateway.</small></label><labelclass="check-control encryption-toggle"><inputname="encrypt"type="checkbox"><span>Encrypt scheduled backups<small>Uses the container’s <code>BACKUP_PASSWORD</code> value. Enable only after configuring that value.</small></span></label></div></div><divclass="dialog-actions"><buttonclass="button secondary">Save schedule</button></div></form><divclass="callout"><strong>Storage guidance</strong><spanid="backup-path">Backups are stored in /data/backups. Mount /backups separately to protect against appdata disk failure.</span><spanid="backup-summary"class="backup-summary"></span></div><divid="backup-list"class="data-list"></div></section>
<!-- Security & updates tab -->
<sectiondata-admin-panel="security"class="hidden settings-panel"><h2>Security, health & updates</h2><sectionclass="dashboard-panel"><divclass="panel-heading"><div><pclass="eyebrow">Reliability</p><h2>Configuration safety & updates</h2></div></div><dlclass="system-grid"><divclass="system-tile"><dt>Configuration safety</dt><dd>Validates generated Caddy configuration before every reload and retains the active configuration when validation fails.</dd></div><divclass="system-tile"><dt>Container updates</dt><dd>Installed by pulling a new pinned image. Create a backup before changing versions.</dd></div></dl></section><sectionclass="dashboard-panel"><divclass="panel-heading"><div><pclass="eyebrow">Troubleshooting & support</p><h2>Gateway diagnostics</h2><pclass="muted">Run checks and download a redacted report when you need to investigate a gateway issue.</p></div><buttonid="download-support"class="button secondary admin-only">Download support report</button></div><pclass="muted feature-note">The report includes version, configuration health, certificate readiness, upstream checks, and recent events. Passwords, private keys, session secrets, cookies, and certificate contents are excluded.</p></section><formid="health-settings-form"class="settings-form"><label>Renewing-soon warning<inputname="warningDays"type="number"min="8"max="120"value="30"><small>Days remaining before a certificate is highlighted.</small></label><label>Critical warning<inputname="criticalDays"type="number"min="1"max="119"value="7"><small>Must be lower than the renewing-soon threshold.</small></label><label>Stale health data<inputname="staleMinutes"type="number"min="2"max="1440"value="10"><small>Minutes before a displayed check is considered old.</small></label><divclass="dialog-actions"><buttonclass="button primary">Save health settings</button></div></form></section>
<sectiondata-admin-panel="backups"class="hidden settings-panel"><divclass="panel-heading"><div><h2>Backup & restore</h2><pclass="muted">Create a copy, restore a previous version, or schedule automatic backups.</p></div><divclass="row-actions"><buttonid="import-backup"class="button secondary">Import backup</button><buttonid="create-backup"class="button primary">Create backup</button></div></div><inputid="backup-upload"type="file"accept=".sgbackup,application/zip"hidden><formid="backup-settings-form"class="settings-form backup-settings"><divclass="form-section form-section-wide"><pclass="eyebrow">Scheduled backups</p><divclass="form-grid"><labelclass="check-control"><inputname="enabled"type="checkbox"><span>Enable scheduled backups</span></label><label>Backup type<selectname="type"><optionvalue="complete">Complete (Recommended) — configuration + hosted files</option><optionvalue="configuration">Configuration only</option></select><smallid="backup-type-help">Configuration only includes settings and metadata, not uploaded Hosted Site files.</small></label><pid="backup-config-only-warning"class="callout hidden"style="grid-column:1/-1"><strong>Heads up</strong><span>Scheduled backups are set to Configuration only — they will not include your Hosted Site files, icons, or certificates. Switch to Complete if you want scheduled backups to protect those too.</span></p><label>Schedule<selectname="frequency"><optionvalue="daily">Daily</option><optionvalue="weekly">Weekly</option><optionvalue="monthly">Monthly</option></select></label><label>Hour<selectname="hour"></select></label><label>Keep<inputname="retention"type="number"min="1"max="100"value="7"></label><labelclass="check-control"><inputname="includeLogs"type="checkbox"><span>Include logs</span></label></div></div><divclass="form-section form-section-wide"><pclass="eyebrow">Encryption</p><divclass="form-grid encryption-grid"><labelclass="backup-password-field"><spanclass="field-label">Backup encryption password <spanclass="optional">Optional</span></span><inputname="backupPassword"type="password"autocomplete="new-password"><small>Used for manually created backups and required when restoring an encrypted archive. It is not stored by Site Gateway.</small></label><labelclass="check-control encryption-toggle"><inputname="encrypt"type="checkbox"><span>Encrypt scheduled backups<small>Uses the container’s <code>BACKUP_PASSWORD</code> value. Enable only after configuring that value.</small></span></label></div></div><divclass="dialog-actions"><buttonclass="button secondary">Save schedule</button></div></form><divclass="callout"><strong>Storage guidance</strong><spanid="backup-path">Backups are stored in /data/backups. Mount /backups separately to protect against appdata disk failure.</span><spanid="backup-summary"class="backup-summary"></span></div><divid="backup-list"class="data-list"></div></section><sectionclass="dashboard-panel"><divclass="panel-heading"><div><pclass="eyebrow">Troubleshooting & support</p><h2>Gateway diagnostics</h2><pclass="muted">Run checks and download a redacted report when you need to investigate a gateway issue.</p></div><buttonid="download-support"class="button secondary admin-only">Download support report</button></div><pclass="muted feature-note">The report includes version, configuration health, certificate readiness, upstream checks, and recent events. Passwords, private keys, session secrets, cookies, and certificate contents are excluded.</p></section>
<!-- Danger Zone tab -->
<sectiondata-admin-panel="danger"class="hidden settings-panel danger-zone"><h2>Danger Zone</h2><pclass="muted">These actions can permanently remove Site Gateway data. Review each warning carefully before continuing.</p><divclass="danger-card"><pclass="eyebrow">Restore defaults</p><h3>Reset gateway preferences</h3><p>Restore default site behavior, backup scheduling, certificate thresholds, and interface preferences. Your users, routes, certificates, logs, and backups remain intact.</p><buttonid="restore-defaults"class="button secondary">Restore default settings</button></div><divclass="danger-card destructive"><pclass="eyebrow">Permanent action</p><h3>Factory reset</h3><p>Deletes all Site Gateway data under <code>/data</code>, including users, routes, certificates, logs, backups, and settings. Docker-mounted files outside <code>/data</code> are not affected. The container restarts at first-install setup.</p><formid="factory-reset-form"class="danger-form"><label>Administrator username<inputname="username"autocomplete="username"required></label><label>Administrator password<inputname="password"type="password"autocomplete="current-password"required></label><label>Type <strong>FACTORY RESET</strong> to confirm<inputname="confirmation"requiredautocomplete="off"></label><pid="factory-reset-error"class="error"></p><divclass="danger-actions"><buttonclass="button secondary"type="button"id="factory-reset-cancel">Cancel</button><buttonclass="button danger"type="submit">Erase all data and reset</button></div></form></div></section>
</section>
@@ -432,6 +430,6 @@
<divid="toast"class="toast"role="status"></div>
<divid="update-banner"class="update-banner hidden"role="status"><span>A new version of Site Gateway is available.</span><divclass="update-banner-actions"><buttonid="update-banner-refresh"class="button primary">Refresh</button><buttonid="update-banner-dismiss"class="text-button">Dismiss</button></div></div>
<!-- App scripts: core (app.js) then extended views/admin (features.js) -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.