mirror of
https://github.com/ZTatman/myst.git
synced 2026-11-20 20:07:59 +00:00
Dark-only Tailwind v4 @theme tokens, cinematic landing hero, operational dashboard styling, and the Firebreak logo/wordmark assets. Templates use semantic component classes instead of inline styles and color literals.
173 lines
6.8 KiB
HTML
173 lines
6.8 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Settings — Firebreak{% endblock %}
|
|
{% block content %}
|
|
<div class="flex flex-col gap-10">
|
|
<section class="page-header">
|
|
<div>
|
|
<p class="text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground">Settings</p>
|
|
<h1 class="mt-3 text-3xl font-semibold leading-tight text-foreground sm:text-4xl">
|
|
Configuration
|
|
</h1>
|
|
<p class="mt-2 text-base leading-7 text-foreground/68 sm:text-lg">
|
|
Manage your Firebreak configuration.
|
|
</p>
|
|
</div>
|
|
</section>
|
|
<div class="max-w-3xl">
|
|
{% if pat_deleted %}
|
|
<div class="rounded-md border-l-4 border-warning bg-warning-muted px-4 py-3 text-sm font-semibold text-warning-foreground"
|
|
role="status">Access token removed.</div>
|
|
{% endif %}
|
|
<div id="forgejo-access-token">
|
|
<h2 class="text-base font-semibold">Forgejo access token</h2>
|
|
<p class="mt-2 text-sm text-muted-foreground">
|
|
A <code class="rounded-sm bg-secondary px-1.5 py-0.5 text-foreground">read:repository</code>-scoped
|
|
Personal Access Token is required for share link viewing.
|
|
</p>
|
|
{% if user.has_pat %}
|
|
<div class="mt-4 card">
|
|
<div class="flex items-center justify-between px-4 py-3.5">
|
|
<div class="flex items-center gap-3">
|
|
<div class="flex size-8 items-center justify-center rounded-md bg-success-muted text-success-foreground">
|
|
<svg xmlns="http://www.w3.org/2000/svg"
|
|
width="16"
|
|
height="16"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round">
|
|
<path d="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4" />
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<p class="text-sm font-medium text-foreground">Access token</p>
|
|
<p class="mt-0.5 text-xs text-muted-foreground">
|
|
{% if user.pat_registered_at %}
|
|
Registered <time datetime="{{ user.pat_registered_at.isoformat() }}" data-local-date>{{ user.pat_registered_at.isoformat() }}</time>
|
|
{% else %}
|
|
Registered
|
|
{% endif %}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<form method="post"
|
|
action="/settings/pat/delete"
|
|
data-confirm="Delete this access token? You can register a new token later.">
|
|
<button type="submit" class="btn btn-xs btn-danger">Delete</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<details class="mt-4">
|
|
<summary class="cursor-pointer text-sm text-muted-foreground hover:text-foreground">
|
|
Update token
|
|
</summary>
|
|
<form id="pat-form"
|
|
class="mt-3"
|
|
method="post"
|
|
action="/settings/pat"
|
|
novalidate>
|
|
<div class="grid gap-2 sm:gap-4 sm:grid-cols-[1fr_auto] sm:items-end">
|
|
<input type="password"
|
|
id="pat"
|
|
name="pat"
|
|
class="block w-full input-mono"
|
|
placeholder="Paste new token…"
|
|
aria-describedby="pat-error"
|
|
aria-invalid="false"
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
required />
|
|
<button type="submit" class="btn btn-sm btn-primary self-center">Update</button>
|
|
</div>
|
|
<div class="mt-2">
|
|
<p id="pat-error"
|
|
class="text-sm font-medium text-danger-foreground hidden"
|
|
aria-live="polite">A Forgejo token is required.</p>
|
|
</div>
|
|
</form>
|
|
</details>
|
|
{% else %}
|
|
<form id="pat-form"
|
|
class="mt-4"
|
|
method="post"
|
|
action="/settings/pat"
|
|
novalidate>
|
|
<div class="grid gap-2 sm:gap-4 sm:grid-cols-[1fr_auto] sm:items-end">
|
|
<input type="password"
|
|
id="pat"
|
|
name="pat"
|
|
class="block w-full input-mono"
|
|
placeholder="ad8j3…"
|
|
aria-describedby="pat-error"
|
|
aria-invalid="false"
|
|
autocomplete="off"
|
|
spellcheck="false"
|
|
required />
|
|
<button type="submit" class="btn btn-sm btn-primary self-center">Register</button>
|
|
</div>
|
|
<div class="mt-2">
|
|
<p id="pat-error"
|
|
class="text-sm font-medium text-danger-foreground hidden"
|
|
aria-live="polite">A Forgejo token is required.</p>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
(() => {
|
|
document.querySelectorAll("form[data-confirm]").forEach((confirmForm) => {
|
|
confirmForm.addEventListener("submit", (event) => {
|
|
const message = confirmForm.getAttribute("data-confirm");
|
|
if (message && !window.confirm(message)) {
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
});
|
|
|
|
document.querySelectorAll("time[data-local-date]").forEach((time) => {
|
|
const value = time.getAttribute("datetime");
|
|
if (!value) return;
|
|
|
|
const date = new Date(value);
|
|
if (Number.isNaN(date.valueOf())) return;
|
|
|
|
time.textContent = new Intl.DateTimeFormat(undefined, {
|
|
month: "short",
|
|
day: "numeric",
|
|
year: "numeric",
|
|
}).format(date);
|
|
});
|
|
|
|
const form = document.getElementById("pat-form");
|
|
const input = document.getElementById("pat");
|
|
const error = document.getElementById("pat-error");
|
|
|
|
if (!form || !input || !error) return;
|
|
|
|
const showError = () => {
|
|
input.setAttribute("aria-invalid", "true");
|
|
input.classList.add("border-danger", "focus:border-danger", "focus:ring-danger-muted");
|
|
error.classList.remove("hidden");
|
|
input.focus();
|
|
};
|
|
|
|
const clearError = () => {
|
|
input.setAttribute("aria-invalid", "false");
|
|
input.classList.remove("border-danger", "focus:border-danger", "focus:ring-danger-muted");
|
|
error.classList.add("hidden");
|
|
};
|
|
|
|
form.addEventListener("submit", (event) => {
|
|
if (input.value.trim()) return;
|
|
event.preventDefault();
|
|
showError();
|
|
});
|
|
|
|
input.addEventListener("input", clearError);
|
|
})();
|
|
</script>
|
|
{% endblock %}
|