ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 9m21s
ci / test (pull_request) Successful in 13m53s
ci / build (pull_request) Successful in 11m22s
ci / image (pull_request) Successful in 4m36s
Terms of service join the legal notice and privacy policy, for the platform only. Every account accepts the platform's privacy policy and terms: on sign-up (also through an invitation) by ticking a box for the versions shown, and after a sign-in through a provider right away. When an admin saves a material change with "everyone has to accept again", the document gets a new version and each account is asked at its next request; corrections ask nobody. Acceptances are kept per version with their time, as proof, and are part of the data export. Until an account accepted, and while it is suspended, it can read the documents, export its data, delete itself and sign out, nothing else: pages lead to /consent or /account/suspended, other API calls answer 403 consent_required or account_suspended. Suspended accounts therefore sign in again, by password or provider; their API tokens stay blocked. Deleting an account deletes the organizations it owns, monitors and all, also when they have other members (each organization has one owner); it no longer refuses. The account settings name those organizations first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
119 lines
4.0 KiB
Templ
119 lines
4.0 KiB
Templ
package web
|
|
|
|
import (
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/agentapi"
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/i18n"
|
|
)
|
|
|
|
templ legalLink(l LegalLink) {
|
|
if l.External {
|
|
<a href={ templ.SafeURL(l.Href) } rel="noopener" class="hover:text-ink">{ i18n.T(ctx, LegalTitleID(l.Kind)) }</a>
|
|
} else {
|
|
<a href={ templ.SafeURL(l.Href) } class="hover:text-ink">{ i18n.T(ctx, LegalTitleID(l.Kind)) }</a>
|
|
}
|
|
}
|
|
|
|
// siteFooter links the API documentation and the platform's legal
|
|
// documents.
|
|
templ siteFooter(links []LegalLink) {
|
|
<footer class="mx-auto flex w-full max-w-5xl justify-end gap-4 px-6 py-6 font-mono text-xs text-muted">
|
|
<a href="/api/docs" class="hover:text-ink">{ i18n.T(ctx, "apidocs.footer") }</a>
|
|
for _, l := range links {
|
|
@legalLink(l)
|
|
}
|
|
</footer>
|
|
}
|
|
|
|
templ legalBody(html string) {
|
|
<article class="legal-text max-w-2xl">
|
|
@templ.Raw(html)
|
|
</article>
|
|
}
|
|
|
|
// LegalPage shows a platform legal document.
|
|
// LegalPage shows a platform legal document: inside the console for
|
|
// signed-in users, with a plain header for everyone else, who must be able
|
|
// to read it too.
|
|
templ LegalPage(p Page, me *Me, html string) {
|
|
if me != nil {
|
|
@consoleShell(p, *me) {
|
|
@legalBody(html)
|
|
}
|
|
} else {
|
|
@Layout(p) {
|
|
<header class="border-b border-rule">
|
|
<div class="mx-auto flex max-w-5xl items-center justify-between gap-6 px-6 py-3 text-sm">
|
|
@brandLockup("/")
|
|
<div class="flex items-center gap-5">
|
|
<a href="/login" class="text-muted hover:text-ink">{ i18n.T(ctx, "auth.login.title") }</a>
|
|
@languageSwitch(p.Languages)
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<main class="mx-auto max-w-5xl px-6 py-10">
|
|
@legalBody(html)
|
|
</main>
|
|
}
|
|
}
|
|
}
|
|
|
|
// PublicLegalPage shows a legal document of a status page.
|
|
templ PublicLegalPage(s agentapi.PageSnapshot, a PublicAssets, kind, html, back string) {
|
|
<!DOCTYPE html>
|
|
<html lang={ i18n.Lang(ctx) }>
|
|
<head>
|
|
<meta charset="utf-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>{ i18n.T(ctx, LegalTitleID(kind)) } · { s.Title }</title>
|
|
@faviconLinks()
|
|
<link rel="stylesheet" href={ a.CSSHref }/>
|
|
</head>
|
|
<body class="min-h-screen">
|
|
<main class="mx-auto max-w-3xl px-6 py-14">
|
|
<p class="mb-10"><a href={ templ.SafeURL(back) } class="text-sm text-muted hover:text-ink">{ "← " + s.Title }</a></p>
|
|
@legalBody(html)
|
|
</main>
|
|
</body>
|
|
</html>
|
|
}
|
|
|
|
// LegalForm is the stored state of one legal document.
|
|
type LegalForm struct {
|
|
Kind string
|
|
URL string
|
|
Markdown string
|
|
// Consent marks documents every account accepts, which can be put
|
|
// before everyone again.
|
|
Consent bool
|
|
}
|
|
|
|
// LegalSettingsPage edits legal documents. apiBase plus the kind is the
|
|
// endpoint each form saves to.
|
|
templ LegalSettingsPage(p Page, me Me, titleID, introID, apiBase, next string, docs []LegalForm) {
|
|
@consoleShell(p, me) {
|
|
@settingsHeading(titleID, introID)
|
|
for _, d := range docs {
|
|
<section class="mb-12 max-w-2xl">
|
|
@sectionHeading(LegalTitleID(d.Kind))
|
|
<form data-api={ apiBase + d.Kind } data-method="put" data-next={ next }>
|
|
@formError()
|
|
<label class="mb-4 block">
|
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "legal.url") }</span>
|
|
<input type="url" name="url" value={ d.URL } placeholder="https://" class="w-full border border-rule bg-transparent px-2.5 py-1.5 text-sm outline-none focus:border-ink"/>
|
|
</label>
|
|
<div class="mb-1">
|
|
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "legal.markdown") }</span>
|
|
@MarkdownEditor("markdown", d.Markdown, 14, 100000, MarkdownDocument)
|
|
</div>
|
|
<p class="mb-4 text-xs text-muted">{ i18n.T(ctx, "legal.hint") }</p>
|
|
if d.Consent {
|
|
@checkbox(i18n.T(ctx, "legal.new_version"), "new_version", false)
|
|
<p class="-mt-2 mb-4 ml-6 text-xs text-muted">{ i18n.T(ctx, "legal.new_version_hint") }</p>
|
|
}
|
|
@submit(i18n.T(ctx, "common.save"))
|
|
</form>
|
|
</section>
|
|
}
|
|
}
|
|
}
|