Make the metaphor structural: a thing gets visual heat only if it increases exposure; contained things stay silent. - Badge diet: private repos render unmarked (an unmarked row is the "contained" statement); only Public/Archived/Empty earn a badge. Public wears the ember "live ember" badge (a public repo is a fire starter); fork/mirror demote to muted mono provenance beside the name. - Containment status grammar in empty/warning states (STATUS · CONTAINED — 0 EXPOSED); firebreak-rule dividers under page headings; remove the settings sidebar (one section doesn't earn a rail) in favor of a single column; reuse .notice-rail for the success notice. - Sweep the ad-hoc text-foreground/NN gray ladder to text-muted-foreground, fixing sub-AA helper text. Includes the landing hero (index.html) legibility pass so hero copy stays cream after the foreground token flipped to charcoal. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
156 lines
6.4 KiB
HTML
156 lines
6.4 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Settings — Firebreak{% endblock %}
|
|
{% block content %}
|
|
{# One section doesn't earn a sidebar — a single quiet column until it does. #}
|
|
<div class="mx-auto flex w-full max-w-3xl flex-col gap-6">
|
|
<section>
|
|
<h1 class="text-2xl font-semibold leading-tight text-foreground sm:text-3xl">Settings</h1>
|
|
<div class="firebreak-rule mt-6" aria-hidden="true"></div>
|
|
</section>
|
|
<div class="flex min-w-0 flex-col gap-4">
|
|
{% if pat_deleted %}
|
|
<div class="notice-rail" role="status">
|
|
<p class="text-sm font-semibold text-warning-foreground">Access token removed.</p>
|
|
</div>
|
|
{% endif %}
|
|
{% if pat_registered %}
|
|
<div class="notice-rail border-success" role="status">
|
|
<p class="text-sm font-semibold text-success-foreground">Access token registered.</p>
|
|
</div>
|
|
{% endif %}
|
|
<section class="table-panel">
|
|
<div class="flex flex-col gap-1 border-b border-border px-4 py-3.5 sm:px-5 sm:py-4">
|
|
<h2 class="text-base font-semibold text-foreground">Forgejo access token</h2>
|
|
<p class="text-sm leading-6 text-muted-foreground">
|
|
A <code class="mono-chip">read:repository</code>-scoped
|
|
Personal Access Token is required for share link viewing.
|
|
</p>
|
|
</div>
|
|
{% if user.has_pat %}
|
|
<div class="flex items-center justify-between gap-4 border-b border-border-subtle px-4 py-3.5 sm:px-5">
|
|
<div class="flex items-center gap-2.5">
|
|
<svg class="status-icon text-success-foreground"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true">
|
|
<path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z" />
|
|
<circle cx="16.5" cy="7.5" r=".5" fill="currentColor" stroke="none" />
|
|
</svg>
|
|
<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-sm btn-danger-quiet">Delete</button>
|
|
</form>
|
|
</div>
|
|
{% else %}
|
|
<div class="flex items-center gap-2.5 border-b border-border-subtle px-4 py-3.5 sm:px-5">
|
|
<svg class="status-icon text-warning-foreground"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true">
|
|
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4m0 4h.01" />
|
|
</svg>
|
|
<p class="status-line text-warning-foreground">Status · No token registered</p>
|
|
</div>
|
|
{% endif %}
|
|
<div class="px-4 py-3.5 sm:px-5 sm:py-4">
|
|
<form id="pat-form" method="post" action="/settings/pat" novalidate>
|
|
<label for="pat" class="form-label">
|
|
{{ "Replace token" if user.has_pat else "Register token" }}
|
|
</label>
|
|
<div class="grid gap-2 sm:grid-cols-[1fr_auto] sm:gap-3">
|
|
<input type="password"
|
|
id="pat"
|
|
name="pat"
|
|
class="form-input font-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" if user.has_pat else "Register" }}
|
|
</button>
|
|
</div>
|
|
<p id="pat-error"
|
|
class="mt-2 hidden text-sm font-medium text-danger-foreground"
|
|
aria-live="polite">A Forgejo token is required.</p>
|
|
</form>
|
|
</div>
|
|
</section>
|
|
</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 %}
|