Files
DoGaMa-serv/internal/web/templates/settings.html
T
2026-08-26 22:35:42 +02:00

377 lines
16 KiB
HTML

{{define "settings.html"}}
<!doctype html>
<html lang="{{.Language}}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>
{{.Title}}
· DoGaMa
</title>
<link rel="stylesheet" href="/static/app.css">
<link rel="stylesheet" href="/static/theme.css">
</head>
<body class="app-body">
{{template "sidebar" .}}
<main class="app-main">
<div class="page-heading">
<div>
<p class="eyebrow">
{{.Msg "settings.eyebrow"}}
</p>
<h1>
Administration
</h1>
<p>
{{.Msg "settings.introduction"}}
</p>
</div>
</div>
<nav class="tabs" role="tablist" aria-label="{{.Msg "settings.tabs"}}">
<a href="#users" role="tab" aria-controls="users">
{{.Msg "template_repositories.users"}}
</a>
<a href="#web-access">
{{.Msg "settings.web_access"}}
</a>
<a href="#sessions">
{{.Msg "settings.sessions"}}
</a>
<a href="#notifications">
{{.Msg "settings.notifications"}}
</a>
<a href="#repositories" role="tab" aria-controls="repositories">
{{.Msg "template_repositories.heading"}}
</a>
<a href="#audit">
{{.Msg "settings.audit"}}
</a>
<a href="#containers">
{{.Msg "settings.containers"}}
</a>
<a href="#game-runtime">
{{.Msg "settings.game_runtime"}}
</a>
</nav>
<section class="panel settings-section" id="sessions">
<h2>{{.Msg "settings.sessions"}}</h2>
<p>{{.Msg "settings.sessions_help"}}</p>
<form method="post" action="/admin/session-policy">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label>
{{.Msg "settings.session_max"}}
<input name="max_lifetime_days" type="number" min="1" max="90" step="1" value="{{divDuration .SessionPolicy.MaxLifetime 86400000000000}}">
</label>
<p class="help">{{.Msg "settings.days"}}</p>
<label>
<input type="checkbox" name="inactivity_enabled"{{if .SessionPolicy.InactivityEnabled}} checked{{end}}>
{{.Msg "settings.session_inactivity_enabled"}}
</label>
<label>
{{.Msg "settings.session_inactivity"}}
<input name="inactivity_timeout_hours" type="number" min="1" max="720" step="1" value="{{divDuration .SessionPolicy.InactivityTimeout 3600000000000}}">
</label>
<p class="help">{{.Msg "settings.hours"}}</p>
<button type="submit">{{.Msg "settings.save_sessions"}}</button>
</form>
</section>
<section class="panel settings-section" id="web-access">
<h2>
{{.Msg "settings.web_access"}}
</h2>
<p>
{{.Msg "settings.web_help"}}
</p>
<form method="post" action="/admin/web-access">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label class="check">
<input type="checkbox" name="require_https"{{if .RequireHTTPS}} checked{{end}}>
{{.Msg "settings.require_https"}}
</label>
<p class="help">
{{.Msg "settings.https_help"}}
</p>
<label>
{{.Msg "settings.canonical_url"}}
<input name="canonical_url" type="url" value="{{.CanonicalURL}}" placeholder="https://dogama.example.com">
</label>
<p class="help">
{{.Msg "settings.canonical_help"}}
</p>
<button type="submit">
{{.Msg "settings.save_web"}}
</button>
</form>
</section>
<section class="panel settings-section" id="notifications">
<h2>
{{.Msg "settings.channels"}}
</h2>
<p>
{{.Msg "settings.channels_help"}}
</p>
<div class="tabs">
<a href="#notification-general">
{{.Msg "settings.notification_general"}}
</a>
<a href="#email">
{{.Msg "settings.notification_email"}}
</a>
<a href="#discord">
{{.Msg "settings.notification_discord"}}
</a>
<a href="#gotify">
{{.Msg "settings.notification_gotify"}}
</a>
</div>
<section id="notification-general">
<h3>
{{.Msg "settings.notification_general"}}
</h3>
<p>
{{.Msg "settings.notification_language_help"}}
</p>
<form method="post" action="/admin/notification-language">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label>
{{.Msg "language"}}
<select name="language">
{{range .Languages}}
<option value="{{.Code}}"{{if eq $.NotificationLanguage .Code}} selected{{end}}>
{{.Display}}
</option>
{{end}}
</select>
</label>
<button type="submit">
{{.Msg "language.save"}}
</button>
</form>
</section>
<section id="email">
<h3>
{{.Msg "settings.notification_email"}}
</h3>
{{with index .NotificationForms "email"}}
<form method="post" action="{{.FormAction}}">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="id" value="{{.ID}}">
<input type="hidden" name="name" value="{{.Name}}">
<input type="hidden" name="type" value="{{.Type}}">
<input type="hidden" name="events" value="backup.completed backup.failed restore.completed restore.failed update.completed update.failed start.completed stop.completed">
<label class="check">
<input type="checkbox" name="enabled"{{if .Enabled}} checked{{end}}>
{{$.Msg "settings.enabled"}}
</label>
<div class="form-grid">
<label>
{{$.Msg "settings.sender_name"}}
<input name="from_name" value="{{.Config.from_name}}">
</label>
<label>
{{$.Msg "settings.sender_email"}}
<input required type="email" name="from" value="{{.Config.from}}">
</label>
<label>
{{$.Msg "settings.smtp_server"}}
<input required name="host" value="{{.Config.host}}">
</label>
<label>
{{$.Msg "settings.port"}}
<input required name="port" type="number" min="1" max="65535" value="{{.Config.port}}">
</label>
<label>
{{$.Msg "settings.username"}}
<input name="smtp_username" value="{{.Config.username}}">
</label>
<label>
{{$.Msg "settings.password"}}
<small>
{{$.Msg "settings.password_retain"}}
</small>
<input name="smtp_password" type="password">
{{if .SecretConfigured}}<small>{{$.Msg "settings.configured"}}</small>{{end}}
</label>
<label>
{{$.Msg "settings.tls_mode"}}
<select name="tls_mode">
<option value="starttls"{{if eq .Config.tls_mode "starttls"}} selected{{end}}>
STARTTLS
</option>
<option value="tls"{{if eq .Config.tls_mode "tls"}} selected{{end}}>
Direct TLS / SMTPS
</option>
<option value="none"{{if eq .Config.tls_mode "none"}} selected{{end}}>
No TLS
</option>
</select>
</label>
<label>
{{$.Msg "settings.test_recipient"}}
<input type="email" name="to" value="{{.Config.to}}">
</label>
</div>
<button type="submit">
{{$.Msg "settings.save_smtp"}}
</button>
</form>
{{if .ID}}<form method="post" action="/admin/notification-channels/{{.ID}}/test"><input type="hidden" name="csrf_token" value="{{$.CSRFToken}}"><button type="submit">{{$.Msg "settings.send_test"}}</button></form>{{end}}
{{end}}
</section>
<section id="discord">
<h3>
{{.Msg "settings.notification_discord"}}
</h3>
{{with index .NotificationForms "discord"}}
<form method="post" action="{{.FormAction}}">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="id" value="{{.ID}}">
<input type="hidden" name="name" value="{{.Name}}">
<input type="hidden" name="type" value="{{.Type}}">
<input type="hidden" name="events" value="backup.completed backup.failed restore.completed restore.failed update.completed update.failed">
<label class="check">
<input type="checkbox" name="enabled"{{if .Enabled}} checked{{end}}>
{{$.Msg "settings.enabled"}}
</label>
<label>
{{$.Msg "settings.webhook_url"}}
<input type="url" name="url" placeholder="https://discord.com/api/webhooks/…">
{{if .SecretConfigured}}<small>{{$.Msg "settings.configured"}}</small>{{end}}
</label>
<button type="submit">
{{$.Msg "settings.save_discord"}}
</button>
</form>
{{if .ID}}<form method="post" action="/admin/notification-channels/{{.ID}}/test"><input type="hidden" name="csrf_token" value="{{$.CSRFToken}}"><button type="submit">{{$.Msg "settings.send_test"}}</button></form>{{end}}
{{end}}
</section>
<section id="gotify">
<h3>
{{.Msg "settings.notification_gotify"}}
</h3>
<p>
{{.Msg "settings.gotify_help"}}
</p>
{{with index .NotificationForms "gotify"}}
<form method="post" action="{{.FormAction}}">
<input type="hidden" name="csrf_token" value="{{$.CSRFToken}}">
<input type="hidden" name="id" value="{{.ID}}">
<input type="hidden" name="name" value="{{.Name}}">
<input type="hidden" name="type" value="{{.Type}}">
<input type="hidden" name="events" value="backup.completed backup.failed restore.completed restore.failed update.completed update.failed">
<label class="check">
<input type="checkbox" name="enabled"{{if .Enabled}} checked{{end}}>
{{$.Msg "settings.enabled"}}
</label>
<label>
{{$.Msg "settings.server_url"}}
<input required type="url" name="url" value="{{.Config.url}}" placeholder="https://gotify.example">
</label>
<label>
{{$.Msg "settings.application_token"}}
<input name="gotify_token" type="password">
{{if .SecretConfigured}}<small>{{$.Msg "settings.configured"}}</small>{{end}}
</label>
<button type="submit">
{{$.Msg "settings.save_gotify"}}
</button>
</form>
{{if .ID}}<form method="post" action="/admin/notification-channels/{{.ID}}/test"><input type="hidden" name="csrf_token" value="{{$.CSRFToken}}"><button type="submit">{{$.Msg "settings.send_test"}}</button></form>{{end}}
{{end}}
</section>
</section>
<section class="panel settings-section" id="audit">
<h2>
{{.Msg "settings.audit_retention"}}
</h2>
<p>
{{.Msg "settings.audit_help"}}
</p>
<a class="button-secondary link-button" href="/audit">
{{.Msg "settings.view_audit"}}
</a>
<form method="post" action="/admin/audit-policy">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label>
{{.Msg "settings.retention_days"}}
<input name="retention_days" type="number" min="0" value="{{.AuditPolicy.RetentionDays}}">
</label>
<label>
{{.Msg "settings.maximum_entries"}}
<input name="maximum_count" type="number" min="0" value="{{.AuditPolicy.MaximumCount}}">
</label>
<p class="help">
{{.Msg "settings.zero_unlimited"}}
</p>
<button type="submit">
{{.Msg "settings.save_retention"}}
</button>
</form>
<form method="post" action="/admin/audit-purge">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label>
{{.Msg "settings.delete_before"}}
<input required name="before" type="date">
</label>
<label class="check">
<input required name="confirm" value="yes" type="checkbox">
{{.Msg "settings.confirm_purge"}}
</label>
<button type="submit">
{{.Msg "settings.purge"}}
</button>
</form>
</section>
<section class="panel settings-section" id="game-runtime">
<h2>{{.Msg "settings.game_runtime"}}</h2>
<p>{{.Msg "settings.game_runtime_help"}}</p>
<form method="post" action="/admin/game-container-runtime">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label>{{.Msg "settings.game_runtime_uid"}}<input required name="uid" type="number" min="0" max="4294967295" step="1" value="{{.GameContainerUID}}"></label>
<label>{{.Msg "settings.game_runtime_gid"}}<input required name="gid" type="number" min="0" max="4294967295" step="1" value="{{.GameContainerGID}}"></label>
<p class="help">{{.Msg "settings.game_runtime_policy_help"}}</p>
<button type="submit">{{.Msg "settings.save_game_runtime"}}</button>
</form>
</section>
<section class="panel settings-section" id="containers">
<h2>
{{.Msg "settings.container_labels"}}
</h2>
<p>
{{.Msg "settings.container_labels_help"}}
</p>
<form method="post" action="/admin/game-container-labels">
<input type="hidden" name="csrf_token" value="{{.CSRFToken}}">
<label>
{{.Msg "settings.global_labels"}}
<textarea name="labels" rows="8">
{{.GlobalLabels}}
</textarea>
</label>
<fieldset>
<legend>
{{.Msg "settings.apply"}}
</legend>
<label>
<input type="radio" name="apply" value="next_start" checked>
{{.Msg "settings.next_start"}}
</label>
<label>
<input type="radio" name="apply" value="immediate">
{{.Msg "settings.immediate"}}
</label>
</fieldset>
<button type="submit">
{{.Msg "settings.save_labels"}}
</button>
</form>
</section>
{{template "users-panel" .}}
{{template "repositories-panel" .}}
</main>
<script src="/static/app.js">
</script>
</body>
</html>
{{end}}