diff --git a/CLAUDE.md b/CLAUDE.md index a2b1e52..db3908b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -32,7 +32,7 @@ Watari is a Rust/Axum web GUI that sits in front of [rustypaste](https://github. - `rustypaste.rs` — the rustypaste HTTP client. Field names/headers here were confirmed against rustypaste's actual source, not guessed — see the "rustypaste's real API" doc comment at the top of the file before changing it. - `csrf.rs` / `csp.rs` / `ratelimit.rs` — `axum_csrf` verification helper, static CSP header middleware, and `tower_governor` layer factories. - `templates.rs` — `Tpl`, a tiny `IntoResponse` wrapper around `askama::Template::render()` (replaces the `askama_axum` crate, which no longer exists as of askama ≥0.13), and `Layout`, the struct every page template embeds as a `layout: Layout` field for the data `base.html` needs (csrf token, pbkdf2 iterations, user email, admin flag). -- `routes/` — `pages.rs` (dashboard/upload/paste/shorten form pages), `api.rs` (the mutating `/api/*` proxy endpoints + pagination), `decrypt.rs` (public, SSRF-guarded), `admin.rs` (token bindings viewer). +- `routes/` — `pages.rs` (home overview at `/home`, dashboard, upload/paste/shorten form pages; the Home diagram in `templates/home.html` is hand-aligned box-drawing text, so keep columns intact when editing it), `api.rs` (the mutating `/api/*` proxy endpoints + pagination), `decrypt.rs` (public, SSRF-guarded), `admin.rs` (token bindings viewer). ## Known deviations from `watari.md` diff --git a/src/routes/mod.rs b/src/routes/mod.rs index bcc7a6c..abb92d0 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -30,6 +30,7 @@ pub fn router(max_body_bytes: usize) -> Router { Router::new() .route("/", get(pages::dashboard)) + .route("/home", get(pages::home_page)) .route("/upload", get(pages::upload_page)) .route("/paste", get(pages::paste_page)) .route("/shorten", get(pages::shorten_page)) diff --git a/src/routes/pages.rs b/src/routes/pages.rs index 4d238c5..846a7e5 100644 --- a/src/routes/pages.rs +++ b/src/routes/pages.rs @@ -126,6 +126,23 @@ pub async fn dashboard( .into_response() } +#[derive(Template)] +#[template(path = "home.html")] +struct HomeTemplate { + layout: Layout, +} + +pub async fn home_page( + State(state): State, + session: UserSession, + csrf_token: CsrfToken, +) -> axum::response::Response { + match layout_for(&state, &csrf_token, &session) { + Ok(layout) => (csrf_token, Tpl(HomeTemplate { layout })).into_response(), + Err(e) => crate::error::AppError::Internal(e).into_response(), + } +} + #[derive(Template)] #[template(path = "upload.html")] struct UploadTemplate { diff --git a/static/app.css b/static/app.css index e217430..890f73a 100644 --- a/static/app.css +++ b/static/app.css @@ -167,6 +167,31 @@ main { h1 { font-size: 1.4rem; } +/* --- Home page --- */ +.home p, +.home ul { max-width: 42rem; line-height: 1.55; } +.home .lead { font-size: 1.05rem; opacity: 0.8; margin-top: -0.25rem; } +.home h2 { font-size: 1.1rem; margin: 2rem 0 0.5rem; } +.feature-list { padding-left: 1.25rem; } +.feature-list li { margin-bottom: 0.4rem; } + +/* Box-drawing diagram in a terminal-UI style; columns must stay aligned, so + it scrolls horizontally instead of wrapping on narrow screens. */ +.tui-diagram { + width: fit-content; + max-width: 100%; + overflow-x: auto; + margin: 0.75rem 0 0; + padding: 1rem 1.25rem; + font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; + font-size: 0.78rem; + line-height: 1.2; + border: 1px solid var(--border); + border-radius: 0.4rem; + background: color-mix(in srgb, currentColor 4%, transparent); +} +.tui-title { color: var(--accent); font-weight: 600; } + table.upload-table { width: 100%; border-collapse: collapse; @@ -328,6 +353,13 @@ button.copy-btn { color: inherit; } +.footer-icon { + width: 1em; + height: 1em; + margin-right: 0.3em; + vertical-align: -0.125em; +} + .error-page { max-width: 32rem; margin: 4rem auto; diff --git a/templates/base.html b/templates/base.html index 36b82bc..2ae403b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -13,11 +13,15 @@ diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..6a21206 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block title %}Home — Watari{% endblock %} + +{% block content %} +
+

Watari

+

A web front end for rustypaste that gives every teammate their own login.

+ +

Why Watari?

+

rustypaste is a minimal self-hosted pastebin and file-sharing server. It only offers an HTTP API protected by shared tokens and has no notion of users, so everyone who wants to use it ends up holding the same raw token.

+

Watari sits in front of it. You sign in with your organization's SSO, and Watari calls rustypaste for you with a token picked from your groups. That token never reaches your browser, and rustypaste itself runs unchanged: shared links still point straight at it.

+ +

Features

+
    +
  • Upload, paste, shorten: files, text and URLs, with optional expiry or one-shot links that disappear after the first view.
  • +
  • Password protection: content is encrypted in your browser (AES-GCM). The password and plaintext never reach the server; recipients unlock it on Watari's decrypt page without an account.
  • +
  • Single sign-on: OIDC login. Your groups decide which rustypaste token, and therefore which permissions, you get.
  • +
  • Dashboard: everything you've shared through Watari, with copy and delete.
  • +
+ +

How it works

+ +
+{% endblock %}