Compare commits
11 commits
remove-unu
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 29687c8878 | |||
|
|
c7fa921cee | ||
| cd90828ec1 | |||
|
|
edd182e091 | ||
|
|
499eafa0ac | ||
| f3a0d2dd73 | |||
|
|
b04d7475ad | ||
| 200226015e | |||
| 74a0d0dbb7 | |||
| e27a9d7e7d | |||
| 8c1429ea13 |
|
|
@ -1,4 +1,15 @@
|
||||||
|
# Node.js / npm
|
||||||
node_modules
|
node_modules
|
||||||
|
package-lock.json
|
||||||
|
pnpm-lock.yaml
|
||||||
|
|
||||||
|
# Python / uv
|
||||||
|
web/.venv
|
||||||
|
**/__pycache__/
|
||||||
|
**/*.pyc
|
||||||
|
uv.lock
|
||||||
|
|
||||||
|
# General
|
||||||
.git
|
.git
|
||||||
*.log
|
*.log
|
||||||
.env
|
.env
|
||||||
|
|
|
||||||
12
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
|
# General
|
||||||
node_modules/
|
node_modules/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.tmp/
|
.tmp/
|
||||||
|
|
@ -7,3 +8,14 @@ coverage/
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Python
|
||||||
|
web/.venv/
|
||||||
|
web/__pycache__/
|
||||||
|
web/*.py[cod]
|
||||||
|
**/__pycache__/
|
||||||
|
**/*.pyc
|
||||||
|
|
||||||
|
# Tailwind standalone CLI
|
||||||
|
web/tailwindcss
|
||||||
|
web/app/static/css/output.css
|
||||||
|
|
|
||||||
13
.vscode/settings.json
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"css.lint.unknownAtRules": "ignore",
|
||||||
|
"python.defaultInterpreterPath": "${workspaceFolder}/web/.venv/bin/python",
|
||||||
|
"python.analysis.typeCheckingMode": "off",
|
||||||
|
"mypy-type-checker.importStrategy": "fromEnvironment",
|
||||||
|
"mypy-type-checker.cwd": "${workspaceFolder}/web",
|
||||||
|
"mypy-type-checker.reportingScope": "workspace",
|
||||||
|
"mypy-type-checker.args": [
|
||||||
|
"--config-file",
|
||||||
|
"pyproject.toml",
|
||||||
|
"--show-error-codes"
|
||||||
|
]
|
||||||
|
}
|
||||||
13
.zed/settings.json
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"languages": {
|
||||||
|
"HTML": {
|
||||||
|
"formatter": {
|
||||||
|
"external": {
|
||||||
|
"command": "uv",
|
||||||
|
"arguments": ["run", "--directory", "web", "djlint", "--reformat", "-"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"format_on_save": "on"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
96
README.md
|
|
@ -1,14 +1,14 @@
|
||||||
# Myst
|
# Firebreak
|
||||||
|
|
||||||
> My stuff, kept private.
|
> Fight fire with fire. Your code. Your rules.
|
||||||
|
|
||||||
Myst is a companion service for Forgejo that lets repo owners create expiring, revocable, read-only share links for code snapshots.
|
Firebreak is a companion service for Forgejo that lets repo owners create expiring, revocable, read-only share links for code snapshots.
|
||||||
|
|
||||||
## System Diagram
|
## System Diagram
|
||||||
|
|
||||||
This diagram shows how traffic moves through the public internet, the VPS or self-hosted server, the host firewall, the platform router, Myst, Forgejo, and Postgres.
|
This diagram shows how traffic moves through the public internet, the VPS or self-hosted server, the host firewall, the platform router, Firebreak, Forgejo, and Postgres.
|
||||||
|
|
||||||
[](docs/diagrams/system-routing.svg)
|
[](docs/diagrams/system-routing.svg)
|
||||||
|
|
||||||
Click the diagram to open the full-size SVG.
|
Click the diagram to open the full-size SVG.
|
||||||
|
|
||||||
|
|
@ -33,8 +33,8 @@ Click the diagram to open the full-size SVG.
|
||||||
|
|
||||||
| Purpose | Method |
|
| Purpose | Method |
|
||||||
|---------|--------|
|
|---------|--------|
|
||||||
| User Identity | Forgejo Sessions |
|
| User Identity | Forgejo OAuth |
|
||||||
| Data Access | Dedicated Forgejo User PAT |
|
| Data Access | User's Forgejo PAT |
|
||||||
|
|
||||||
### Tech Stack
|
### Tech Stack
|
||||||
|
|
||||||
|
|
@ -46,68 +46,62 @@ HTMX provides interactivity (filtering, form submissions) with minimal JavaScrip
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### 1. Run `myst config init`
|
### 1. Deploy with Docker Compose
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
myst config init
|
|
||||||
```
|
|
||||||
|
|
||||||
Prompts for:
|
|
||||||
|
|
||||||
- Forgejo API URL — Docker: `http://forgejo:3000`, bare metal: `http://localhost:3000`, cross-host: `https://git.example.com`
|
|
||||||
- Forgejo PAT (with `read:user` and `read:repository` scopes)
|
|
||||||
|
|
||||||
### 2. Deploy with Docker Compose
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd packages/cli/examples
|
|
||||||
cp docker-compose.example.yml docker-compose.yml
|
|
||||||
# Edit .env with your FORGEJO_BASE_URL and FORGEJO_PAT
|
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
The DATABASE_URL is injected automatically by Docker Compose.
|
### 2. Generate an Encryption Key
|
||||||
|
|
||||||
### 3. Alternative Deployments
|
Firebreak encrypts OAuth tokens and PATs at rest using a Fernet key. Generate one and add it to your environment before running the setup wizard:
|
||||||
|
|
||||||
For non-Docker deployments, you must supply DATABASE_URL yourself:
|
```bash
|
||||||
|
uv run python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'
|
||||||
- VPS deployment: Hostinger or another VPS with Dokploy, Traefik, UFW, Myst, Forgejo, and a shared Postgres instance that contains separate `forgejo` and `myst` databases.
|
|
||||||
- Self-hosted server deployment: a home server, mini PC, NAS, or other self-hosted Linux machine running Myst with Docker, Podman, Docker Compose, Coolify, Caddy, Nginx, or another reverse proxy.
|
|
||||||
|
|
||||||
Myst should not assume a VPS-only environment. The requirement is an existing Forgejo instance, Myst's own database, and a way to route the public and admin hostnames to the Myst app.
|
|
||||||
|
|
||||||
## Example Configuration
|
|
||||||
|
|
||||||
Create a `.env` file with:
|
|
||||||
|
|
||||||
```env
|
|
||||||
# Docker (same Compose network):
|
|
||||||
FORGEJO_BASE_URL=http://forgejo:3000
|
|
||||||
# Bare metal / non-container:
|
|
||||||
# FORGEJO_BASE_URL=http://localhost:3000
|
|
||||||
# Cross-host:
|
|
||||||
# FORGEJO_BASE_URL=https://git.example.com
|
|
||||||
FORGEJO_PAT=forgejo_pat_xxxxxxxxxxxx
|
|
||||||
```
|
```
|
||||||
|
|
||||||
When using the provided Docker Compose example, DATABASE_URL is injected automatically. For other deployment approaches (e.g., bare metal, Kubernetes), you must supply DATABASE_URL yourself.
|
Add the output to your `.env` file (or your deployment platform's environment variables):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
TOKEN_ENCRYPTION_KEY=your-generated-key-here
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Run the Setup Wizard
|
||||||
|
|
||||||
|
Open `http://localhost:8000` in your browser. On first boot, Firebreak redirects to a setup wizard where you configure:
|
||||||
|
|
||||||
|
- **Forgejo instance URL** — where your Forgejo server lives
|
||||||
|
- **OAuth credentials** — register an OAuth application in Forgejo first (Settings → Applications → Create OAuth2 Application), then paste the Client ID and Client Secret
|
||||||
|
- **Public base URL** (optional) — your production domain for OAuth redirects
|
||||||
|
|
||||||
|
### 4. Sign In and Register Your Token
|
||||||
|
|
||||||
|
After setup, sign in with your Forgejo account via OAuth. On first login, Firebreak prompts you to register a `read:repository`-scoped Personal Access Token (PAT) to enable share link viewing.
|
||||||
|
|
||||||
|
### 5. Alternative Deployments
|
||||||
|
|
||||||
|
For non-Docker deployments, supply `DATABASE_URL` yourself:
|
||||||
|
|
||||||
|
- VPS deployment: Hostinger or another VPS with Dokploy, Traefik, UFW, Firebreak, Forgejo, and a shared Postgres instance that contains separate `forgejo` and `firebreak` databases.
|
||||||
|
- Self-hosted server deployment: a home server, mini PC, NAS, or other self-hosted Linux machine running Firebreak with Docker, Podman, Docker Compose, Coolify, Caddy, Nginx, or another reverse proxy.
|
||||||
|
|
||||||
|
Firebreak should not assume a VPS-only environment. The requirement is an existing Forgejo instance, Firebreak's own database, and a way to route the public and admin hostnames to the Firebreak app.
|
||||||
|
|
||||||
## Phase 1 Progress
|
## Phase 1 Progress
|
||||||
|
|
||||||
- [x] Project renamed from Embargo to Myst
|
- [x] Project renamed from Embargo to Firebreak
|
||||||
- [x] CLI scaffold (`myst config init`)
|
- [x] CLI scaffold (`firebreak config init`)
|
||||||
- [x] Config generation (`.env`)
|
- [x] Config generation (`.env`)
|
||||||
- [ ] Service foundation (FastAPI + PostgreSQL)
|
- [ ] Service foundation (FastAPI + PostgreSQL)
|
||||||
- [x] `myst config verify` — verify Forgejo connectivity
|
- [x] `firebreak config verify` — verify Forgejo connectivity
|
||||||
- [x] `myst config verify --diagnostic` — comprehensive diagnostics
|
- [x] `firebreak config verify --diagnostic` — comprehensive diagnostics
|
||||||
- [x] `myst config view` — show current config
|
- [x] `firebreak config view` — show current config
|
||||||
- [ ] Forgejo session authentication
|
- [x] Forgejo OAuth authentication
|
||||||
- [ ] Repo ownership verification
|
- [ ] Repo ownership verification
|
||||||
- [ ] Private link creation (email-verified)
|
- [ ] Private link creation (email-verified)
|
||||||
- [ ] Public link creation (time-expired)
|
- [ ] Public link creation (time-expired)
|
||||||
- [ ] Web-based code viewer
|
- [ ] Web-based code viewer
|
||||||
- [ ] User dashboard
|
- [x] User dashboard
|
||||||
- [ ] SMTP configuration UI
|
- [ ] SMTP configuration UI
|
||||||
- [ ] Access logs
|
- [ ] Access logs
|
||||||
|
|
||||||
|
|
|
||||||
60
agents.md
|
|
@ -67,3 +67,63 @@ This file is the single source of truth for codebase obstacles, oddities, and th
|
||||||
**Obstacle:** process.exit(0) stops execution immediately, never runs cleanup code.
|
**Obstacle:** process.exit(0) stops execution immediately, never runs cleanup code.
|
||||||
**Solution:** Use process.exitCode = 1 and return instead of process.exit().
|
**Solution:** Use process.exitCode = 1 and return instead of process.exit().
|
||||||
**Preference:** Set exitCode and return to allow cleanup.
|
**Preference:** Set exitCode and return to allow cleanup.
|
||||||
|
|
||||||
|
### Logout cookie not reaching browser
|
||||||
|
**Area:** web/app/routers/auth.py, web/app/auth/session.py
|
||||||
|
**Obstacle:** `revoke_session` set cookies on the injected `Response` parameter, but the logout handler returned a new `RedirectResponse` — so `Set-Cookie` was discarded.
|
||||||
|
**Solution:** Create `RedirectResponse` first, then pass it into `revoke_session`. Same pattern used in `callback_forgejo` for `create_session`.
|
||||||
|
**Preference:** Pass the actual response object that will be returned.
|
||||||
|
|
||||||
|
### Dashboard leaking ORM session object
|
||||||
|
**Area:** web/app/main.py
|
||||||
|
**Obstacle:** `/dashboard` returned the full ORM `Session` object (`sess`), leaking `token_hash`, `revoked_at`, etc. to the client.
|
||||||
|
**Solution:** Return a plain dict with only safe fields: `user_id`, `display_name`, `email`, `session_id`, `created_at`.
|
||||||
|
**Preference:** Never return ORM objects directly in API responses.
|
||||||
|
|
||||||
|
### crypto.py decrypt functions kept proactively
|
||||||
|
**Area:** web/app/auth/crypto.py
|
||||||
|
**Obstacle:** CodeRabbit flagged missing decryption functions and key validation. Added `decrypt_token`/`decrypt_optional` + key format validation in `fernet_from_encryption_key`.
|
||||||
|
**Solution:** Added the functions even though no consumer exists yet. They will be used for PAT decryption in share link flow.
|
||||||
|
**Preference:** Keep dead code if it's small, symmetric (`encrypt`/`decrypt`), and has an obvious future consumer.
|
||||||
|
|
||||||
|
### User model Session import direct instead of TYPE_CHECKING
|
||||||
|
**Area:** web/app/models/user.py
|
||||||
|
**Obstacle:** `Session` was imported directly (`from .session import Session`) while `Grant` used `TYPE_CHECKING`. Inconsistent and risked circular imports.
|
||||||
|
**Solution:** Moved `Session` import under `TYPE_CHECKING`, changed relationship to string ref `"Session"`.
|
||||||
|
**Preference:** Always use `TYPE_CHECKING` for model references within models to avoid circular imports.
|
||||||
|
|
||||||
|
### Boilerplate UI must follow attached light vault system
|
||||||
|
**Area:** web/app/static/css/input.css, web/app/templates/*.html
|
||||||
|
**Obstacle:** Existing boilerplate used dark-mode pink tokens that conflicted with the attached "Mystique Minimalist Security" design system.
|
||||||
|
**Solution/Workaround:** Use light Geist/JetBrains Mono typography, glacier-blue primary actions, white/off-white tonal surfaces, hairline slate borders, compact labels, mono technical strings, and pill status badges.
|
||||||
|
**Preference:** Keep visual changes in Tailwind tokens and boilerplate templates; avoid backend route changes for design-only updates.
|
||||||
|
|
||||||
|
### Tailwind design tokens should use paired semantic roles
|
||||||
|
**Area:** web/app/static/css/input.css, web/app/templates/*.html
|
||||||
|
**Obstacle:** Early UI templates mixed old role names (`background-*`, `text-*`, `stroke`) and hardcoded `white` values inside component classes, which made dark mode and future theming brittle.
|
||||||
|
**Solution/Workaround:** Use Tailwind v4 `@theme` tokens with semantic pairs such as `background/foreground`, `card/card-foreground`, `primary/primary-foreground`, `secondary/secondary-foreground`, `border`, `input`, and `ring`. Keep shared component structure in base classes like `.btn`, with variant classes only setting semantic colors.
|
||||||
|
**Preference:** Prefer semantic token names over appearance-based names; add dark mode by overriding CSS variables under `.dark`.
|
||||||
|
|
||||||
|
### Header brand SVG inherits unwanted icon styling
|
||||||
|
**Area:** web/app/templates/base.html, web/app/templates/index.html, web/app/static/css/input.css
|
||||||
|
**Obstacle:** The inline Firebreak header wordmark uses hardcoded SVG fills, and page-level header rules can accidentally apply icon `stroke` styles to the brand SVG. On forced-dark landing headers, the `#17191C` wordmark fill disappears against the obsidian nav.
|
||||||
|
**Solution/Workaround:** Give the header brand link a stable `brand-link` class, prevent inherited SVG strokes on `.brand-link svg`, and override only the hardcoded wordmark fill in dark contexts or forced-dark page headers.
|
||||||
|
**Preference:** Scope icon stroke rules to nav icons; do not apply broad `header svg` stroke styles.
|
||||||
|
|
||||||
|
### Landing video poster caused logo flash
|
||||||
|
**Area:** web/app/templates/index.html, web/app/static/img/
|
||||||
|
**Obstacle:** Using a logo SVG as the `<video poster>` made the browser briefly stretch the logo across the full hero video area before the MP4 painted, which looked like the center logo flashing huge on refresh.
|
||||||
|
**Solution/Workaround:** Use a real video-frame poster image (`firebreak-hero-poster.jpg`) or omit `poster`; do not use logo assets as full-bleed video posters.
|
||||||
|
**Preference:** Keep logo sizing in the logo `<img>` and use a frame still for video loading states.
|
||||||
|
|
||||||
|
### POST forms lack CSRF tokens
|
||||||
|
**Area:** web/app/routers/setup.py, web/app/routers/settings.py, web/app/templates/setup.html, web/app/templates/settings.html
|
||||||
|
**Obstacle:** All state-changing forms (`/setup`, `/settings/pat`, `/settings/pat/delete`) use plain POST with no CSRF token. SameSite=Lax on the session cookie mitigates most cross-origin attacks, but does not fully cover same-site subdomain scenarios.
|
||||||
|
**Solution/Workaround:** Deferred. Low practical risk since Firebreak runs behind a VPN. Add server-generated CSRF tokens (hidden form field + server-side check) before exposing the app to the public internet.
|
||||||
|
**Preference:** Use a FastAPI CSRF middleware or manual double-submit cookie pattern when addressing this.
|
||||||
|
|
||||||
|
### Firebreak UI is currently dark-only
|
||||||
|
**Area:** web/app/templates/base.html, web/app/static/css/input.css
|
||||||
|
**Obstacle:** Theme switching and persisted localStorage theme state conflicted with the current Firebreak brand pass, especially on the cinematic landing page.
|
||||||
|
**Solution/Workaround:** Force the root document to use the `.dark` token set and remove the theme toggle UI/scripts.
|
||||||
|
**Preference:** Keep semantic dark tokens; only reintroduce theme switching after the dark Firebreak identity is stable.
|
||||||
|
|
|
||||||
40
docker-compose.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: ./web
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
env_file: ./web/.env
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgresql+asyncpg://firebreak:firebreak@db:5432/firebreak_db
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: firebreak
|
||||||
|
POSTGRES_PASSWORD: firebreak
|
||||||
|
POSTGRES_DB: firebreak_db
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U firebreak -d firebreak_db"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer:latest
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
92
docs/plans/2026-05-15-myst-ui-design.md
Normal file
|
|
@ -0,0 +1,92 @@
|
||||||
|
# Myst UI Design
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Web application for creating secure, time-limited, view-only links to self-hosted Forgejo repositories. Users share specific commits as read-only web views with expiration dates.
|
||||||
|
|
||||||
|
## Pages
|
||||||
|
|
||||||
|
### Landing Page (`GET /`)
|
||||||
|
- Explains Myst
|
||||||
|
- "Sign in with Forgejo" button
|
||||||
|
- Nav shows Sign in (anonymous) or Dashboard/Logout (authenticated)
|
||||||
|
|
||||||
|
### Dashboard (`GET /dashboard`, auth required)
|
||||||
|
- Welcome message with user display name
|
||||||
|
- **Display name editor** — inline edit
|
||||||
|
- **Default expiration** — dropdown/number input for new links (e.g., 1 day, 7 days, 30 days)
|
||||||
|
- **PAT registration** — text input to register `read:repository,read:user`-scoped PAT
|
||||||
|
- **Links list** — table of created share links with status (active/expired/revoked), view count, last viewed, and a revoke button
|
||||||
|
- **Audit log** — expandable per-link logs showing viewer IP, country, user agent, and timestamp
|
||||||
|
|
||||||
|
### Links List (seperate page)
|
||||||
|
- Paginated list of all share links created by the user
|
||||||
|
- Search/filter by repo name, status, expiration date
|
||||||
|
- Link status: active, expired, revoked
|
||||||
|
- Click a link to view details and audit log
|
||||||
|
|
||||||
|
### Create Link (modal or inline form on dashboard)
|
||||||
|
- Repo owner, repo name, branch, commit SHA
|
||||||
|
- Expiration date
|
||||||
|
- Public/private toggle
|
||||||
|
- Optional recipient email (for private links)
|
||||||
|
|
||||||
|
### Share Link View (`/links/<id>`)
|
||||||
|
- Read-only file tree viewer at the pinned commit
|
||||||
|
- Gated by auth if the link is private
|
||||||
|
- Public links are open to anyone
|
||||||
|
- Tracked: log viewer IP, country, user agent, timestamp
|
||||||
|
|
||||||
|
## Infrastructure
|
||||||
|
|
||||||
|
- **Stack:** FastAPI + Jinja2 + HTMX + Pico CSS (jade theme)
|
||||||
|
- **Auth:** Forgejo OAuth with cookie-based sessions (existing)
|
||||||
|
- **Templates:** Jinja2 blocks via `jinja2-fragments` for HTMX partials
|
||||||
|
- **No build step** — all CSS/JS from CDN
|
||||||
|
- **Database models needed:**
|
||||||
|
- `Link` — supersedes current `Grant` model (or extends it)
|
||||||
|
- `LinkView` — audit log entries (link_id, ip, country, user_agent, viewed_at)
|
||||||
|
- `UserSettings` — display_name, default_expiration_days, geo_block_list (optional)
|
||||||
|
- `ViewerSession` — for private link viewer auth (separate from user sessions)
|
||||||
|
|
||||||
|
## Routes
|
||||||
|
|
||||||
|
| Method | Path | Auth | Description |
|
||||||
|
|--------|------|------|-------------|
|
||||||
|
| GET | `/` | optional | Landing page |
|
||||||
|
| GET | `/dashboard` | required | Dashboard |
|
||||||
|
| GET/PUT | `/settings` | required | Update display name, default expiration, geo-blocking settings, PAT, theme |
|
||||||
|
| POST | `/dashboard/pat` | required | Register PAT |
|
||||||
|
| GET | `/links/create` | required | Create link form |
|
||||||
|
| GET | `/links` | required | List user's links |
|
||||||
|
| POST | `/links` | required | Create link |
|
||||||
|
| GET | `/links/{id}` | public/private | View shared repo |
|
||||||
|
| POST | `/links/{id}/revoke` | required | Revoke a link |
|
||||||
|
| GET | `/links/{id}/audit` | required | Audit log for a link |
|
||||||
|
|
||||||
|
## Data Flow
|
||||||
|
|
||||||
|
1. User signs in with Forgejo OAuth → session cookie created
|
||||||
|
2. User registers PAT → encrypted and stored on their account
|
||||||
|
3. User creates share link → pin a repo + commit → stored as Link record
|
||||||
|
4. Viewer visits `/links/{id}`:
|
||||||
|
- If public → render view immediately, log the visit
|
||||||
|
- If private → require viewer auth (future), log the visit
|
||||||
|
- If expired or revoked → show "link unavailable"
|
||||||
|
5. Revoke sets `revoked_at` on the Link
|
||||||
|
6. Audit log shows all `LinkView` entries for the link
|
||||||
|
|
||||||
|
## Future Considerations
|
||||||
|
|
||||||
|
- Per-link geo-blocking
|
||||||
|
- Email notification when a link is viewed
|
||||||
|
- Viewer authentication for private links (simple email + magic link)
|
||||||
|
- Expiration countdown timer on the share link view page
|
||||||
|
- Option to extend expiration from the dashboard
|
||||||
|
- anti-bot measures for public links (e.g., rate limiting, CAPTCHA)
|
||||||
|
- ctrl+copy disable on the share link view page to prevent easy copying of content (optional)
|
||||||
|
- ability to pin a branch instead of a specific commit, with the view always showing the latest commit on that branch (optional)
|
||||||
|
- ability to create a portfolio page showing multiple pinned repos/links in a grid (optional) with a custom URL (e.g., `/users/{username}/portfolio`) user can share instead of individual links
|
||||||
|
- Watermarking the share link view with the viewer's IP address and timestamp to discourage screenshots (optional)
|
||||||
|
- Disable screenshotting on the share link view page using CSS (e.g., `-webkit-user-select: none;`, `pointer-events: none;`) (optional)
|
||||||
|
- Disable command hot keys inspect open dev tools on the share link view page (optional)
|
||||||
9
examples/.env.example
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Application
|
||||||
|
APP_NAME=Myst
|
||||||
|
|
||||||
|
# Database (Docker Compose auto-configures this)
|
||||||
|
DATABASE_URL=postgresql+asyncpg://myst:myst@db:5432/myst_db
|
||||||
|
|
||||||
|
# Forgejo
|
||||||
|
FORGEJO_BASE_URL=
|
||||||
|
FORGEJO_PAT=
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
# Docker Compose example for deploying Myst with PostgreSQL
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# 1. Copy to docker-compose.yml: cp packages/cli/examples/docker-compose.example.yml docker-compose.yml
|
|
||||||
# 2. Edit .env with your Forgejo config
|
|
||||||
# 3. Run: docker compose up -d
|
|
||||||
#
|
|
||||||
# The DATABASE_URL is auto-handled by Docker Compose networking.
|
|
||||||
|
|
||||||
services:
|
|
||||||
myst:
|
|
||||||
image: myst:latest
|
|
||||||
container_name: myst
|
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- "3000:3000"
|
|
||||||
environment:
|
|
||||||
- DATABASE_URL=postgresql://myst:myst@db:5432/myst
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
depends_on:
|
|
||||||
db:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
db:
|
|
||||||
image: postgres:16-alpine
|
|
||||||
container_name: myst-db
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER=myst
|
|
||||||
- POSTGRES_PASSWORD=myst
|
|
||||||
- POSTGRES_DB=myst
|
|
||||||
volumes:
|
|
||||||
- myst-postgres:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U myst -d myst"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
myst-postgres:
|
|
||||||
|
|
@ -22,7 +22,6 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clack/prompts": "^1.2.0",
|
"@clack/prompts": "^1.2.0",
|
||||||
"@myst/shared": "workspace:*",
|
|
||||||
"yoctocolors": "^2.1.2"
|
"yoctocolors": "^2.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,11 +107,13 @@ function showCommandHelp(
|
||||||
lines.push("");
|
lines.push("");
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasSubcommands = cmdConf.subcommands && Object.keys(cmdConf.subcommands).length > 0;
|
const hasSubcommands =
|
||||||
|
cmdConf.subcommands && Object.keys(cmdConf.subcommands).length > 0;
|
||||||
const usageCmd = subcommand ? `${command} ${subcommand}` : command;
|
const usageCmd = subcommand ? `${command} ${subcommand}` : command;
|
||||||
const usageLine = hasSubcommands && !subcommand
|
const usageLine =
|
||||||
? `myst ${command} <subcommand> [options]`
|
hasSubcommands && !subcommand
|
||||||
: `myst ${usageCmd} [options]`;
|
? `myst ${command} <subcommand> [options]`
|
||||||
|
: `myst ${usageCmd} [options]`;
|
||||||
lines.push(c.bold("Usage:"));
|
lines.push(c.bold("Usage:"));
|
||||||
lines.push(`${INDENT}${usageLine}`);
|
lines.push(`${INDENT}${usageLine}`);
|
||||||
lines.push("");
|
lines.push("");
|
||||||
|
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@myst/service",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc -p tsconfig.json",
|
|
||||||
"start": "node dist/index.js",
|
|
||||||
"check": "tsc -b tsconfig.json",
|
|
||||||
"clean": "rm -rf dist"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@myst/shared": "workspace:*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
import { MYST_DEFAULT_SERVICE_PORT } from "@myst/shared";
|
|
||||||
|
|
||||||
process.stdout.write(`Myst service bootstrap on port ${MYST_DEFAULT_SERVICE_PORT}\n`);
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "../../tsconfig.base.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"composite": true,
|
|
||||||
"rootDir": "src",
|
|
||||||
"outDir": "dist"
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{ "path": "../shared" }
|
|
||||||
],
|
|
||||||
"include": ["src/**/*.ts"]
|
|
||||||
}
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
"files": [],
|
"files": [],
|
||||||
"references": [
|
"references": [
|
||||||
{ "path": "./packages/shared" },
|
{ "path": "./packages/shared" },
|
||||||
{ "path": "./packages/cli" },
|
{ "path": "./packages/cli" }
|
||||||
{ "path": "./packages/service" }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
web/.python-version
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
3.13
|
||||||
27
web/Dockerfile
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
FROM python:3.13-slim
|
||||||
|
|
||||||
|
COPY --from=ghcr.io/astral-sh/uv:0.7.4 /uv /uvx /bin/
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
RUN useradd --create-home --shell /bin/bash appuser
|
||||||
|
|
||||||
|
COPY --chown=appuser:appuser pyproject.toml uv.lock ./
|
||||||
|
RUN UV_NO_DEV=1 uv sync --frozen --no-cache && chown -R appuser:appuser /app
|
||||||
|
|
||||||
|
COPY --chown=appuser:appuser . .
|
||||||
|
|
||||||
|
# Build Tailwind CSS
|
||||||
|
RUN curl -sL https://github.com/tailwindlabs/tailwindcss/releases/download/v4.3.0/tailwindcss-linux-x64 -o /tmp/tailwindcss && \
|
||||||
|
chmod +x /tmp/tailwindcss && \
|
||||||
|
/tmp/tailwindcss -i app/static/css/input.css -o app/static/css/output.css --minify && \
|
||||||
|
rm /tmp/tailwindcss
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
0
web/app/__init__.py
Normal file
0
web/app/auth/__init__.py
Normal file
59
web/app/auth/crypto.py
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
"""Fernet (AES) encryption for OAuth tokens at rest."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from cryptography.fernet import Fernet, InvalidToken
|
||||||
|
from pydantic import SecretStr
|
||||||
|
|
||||||
|
|
||||||
|
def fernet_from_encryption_key(key: SecretStr) -> Fernet | None:
|
||||||
|
raw = key.get_secret_value().strip()
|
||||||
|
if not raw:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
return Fernet(raw.encode())
|
||||||
|
except Exception as e:
|
||||||
|
msg = (
|
||||||
|
f"Invalid TOKEN_ENCRYPTION_KEY: {e}. "
|
||||||
|
"Generate a valid key with: uv run python -c "
|
||||||
|
"'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'"
|
||||||
|
)
|
||||||
|
raise ValueError(msg) from e
|
||||||
|
|
||||||
|
|
||||||
|
def encrypt_token(fernet: Fernet, raw_token: str) -> str:
|
||||||
|
return fernet.encrypt(raw_token.encode()).decode()
|
||||||
|
|
||||||
|
|
||||||
|
def encrypt_optional(fernet: Fernet | None, raw_token: str | None) -> str | None:
|
||||||
|
if raw_token is None:
|
||||||
|
return None
|
||||||
|
if fernet is None:
|
||||||
|
msg = (
|
||||||
|
"Token encryption is not configured. "
|
||||||
|
"Set TOKEN_ENCRYPTION_KEY in your .env file or deployment environment."
|
||||||
|
)
|
||||||
|
raise ValueError(msg)
|
||||||
|
return encrypt_token(fernet, raw_token)
|
||||||
|
|
||||||
|
|
||||||
|
def decrypt_token(fernet: Fernet, encrypted_token: str) -> str:
|
||||||
|
try:
|
||||||
|
return fernet.decrypt(encrypted_token.encode()).decode()
|
||||||
|
except InvalidToken:
|
||||||
|
raise ValueError(
|
||||||
|
"Cannot decrypt stored token — the encryption key may have changed or the "
|
||||||
|
"token data is corrupted. The user may need to re-connect their account."
|
||||||
|
) from None
|
||||||
|
|
||||||
|
|
||||||
|
def decrypt_optional(fernet: Fernet | None, encrypted_token: str | None) -> str | None:
|
||||||
|
if encrypted_token is None:
|
||||||
|
return None
|
||||||
|
if fernet is None:
|
||||||
|
msg = (
|
||||||
|
"Token encryption is not configured. "
|
||||||
|
"Set TOKEN_ENCRYPTION_KEY in your .env file or deployment environment."
|
||||||
|
)
|
||||||
|
raise ValueError(msg)
|
||||||
|
return decrypt_token(fernet, encrypted_token)
|
||||||
73
web/app/auth/identity.py
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import select
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
|
from app.auth.crypto import encrypt_optional
|
||||||
|
from app.config import get_fernet
|
||||||
|
from app.models.app_settings import AppSettings
|
||||||
|
from app.models.user import LinkedIdentity, User
|
||||||
|
|
||||||
|
|
||||||
|
async def find_or_create_user(
|
||||||
|
db: AsyncSession,
|
||||||
|
app_settings: AppSettings,
|
||||||
|
*,
|
||||||
|
provider: str,
|
||||||
|
provider_user_id: str,
|
||||||
|
provider_username: str,
|
||||||
|
email: str | None,
|
||||||
|
access_token_raw: str | None,
|
||||||
|
access_token_expires_at: datetime | None,
|
||||||
|
refresh_token_raw: str | None,
|
||||||
|
) -> User:
|
||||||
|
"""Find or create a user based on the given provider and identity details."""
|
||||||
|
|
||||||
|
fernet = get_fernet()
|
||||||
|
|
||||||
|
result = await db.execute(
|
||||||
|
select(LinkedIdentity)
|
||||||
|
.options(selectinload(LinkedIdentity.user))
|
||||||
|
.where(
|
||||||
|
LinkedIdentity.provider == provider,
|
||||||
|
LinkedIdentity.provider_user_id == provider_user_id,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
identity = result.scalar_one_or_none()
|
||||||
|
|
||||||
|
if identity:
|
||||||
|
identity.provider_username = provider_username
|
||||||
|
if access_token_raw is not None:
|
||||||
|
identity.access_token_encrypted = encrypt_optional(fernet, access_token_raw)
|
||||||
|
identity.access_token_expires_at = access_token_expires_at
|
||||||
|
if refresh_token_raw is not None:
|
||||||
|
identity.refresh_token_encrypted = encrypt_optional(fernet, refresh_token_raw)
|
||||||
|
user = identity.user
|
||||||
|
if email:
|
||||||
|
user.email = email
|
||||||
|
if not user.display_name:
|
||||||
|
user.display_name = provider_username
|
||||||
|
await db.commit()
|
||||||
|
await db.refresh(user)
|
||||||
|
return user
|
||||||
|
|
||||||
|
user = User(email=email, display_name=provider_username)
|
||||||
|
db.add(user)
|
||||||
|
await db.flush()
|
||||||
|
|
||||||
|
linked = LinkedIdentity(
|
||||||
|
user_id=user.id,
|
||||||
|
provider=provider,
|
||||||
|
provider_user_id=provider_user_id,
|
||||||
|
provider_username=provider_username,
|
||||||
|
access_token_encrypted=encrypt_optional(fernet, access_token_raw),
|
||||||
|
access_token_expires_at=access_token_expires_at,
|
||||||
|
refresh_token_encrypted=encrypt_optional(fernet, refresh_token_raw),
|
||||||
|
)
|
||||||
|
db.add(linked)
|
||||||
|
await db.commit()
|
||||||
|
await db.refresh(user)
|
||||||
|
return user
|
||||||
125
web/app/auth/session.py
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import hashlib
|
||||||
|
import secrets
|
||||||
|
import uuid
|
||||||
|
from datetime import UTC, datetime, timedelta
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import Cookie, Depends, HTTPException, Response, status
|
||||||
|
from sqlalchemy import select, update
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
from sqlalchemy.orm import selectinload
|
||||||
|
|
||||||
|
from app.deps import get_db
|
||||||
|
from app.models.session import Session
|
||||||
|
|
||||||
|
SESSION_COOKIE = "firebreak_session"
|
||||||
|
SESSION_DURATION_DAYS = 7
|
||||||
|
|
||||||
|
|
||||||
|
async def create_session(
|
||||||
|
db: AsyncSession, response: Response, user_id: uuid.UUID, secure: bool = True
|
||||||
|
) -> None:
|
||||||
|
"""Create a persisted browser session and set its cookie on the response."""
|
||||||
|
|
||||||
|
# The browser gets the raw token, but the database only stores its hash.
|
||||||
|
# This keeps a leaked sessions table from containing usable cookie values.
|
||||||
|
raw_token = secrets.token_hex(32)
|
||||||
|
token_hash = hashlib.sha256(raw_token.encode()).hexdigest()
|
||||||
|
expires_at = datetime.now(UTC) + timedelta(days=SESSION_DURATION_DAYS)
|
||||||
|
row = Session(
|
||||||
|
user_id=user_id,
|
||||||
|
token_hash=token_hash,
|
||||||
|
expires_at=expires_at,
|
||||||
|
)
|
||||||
|
db.add(row)
|
||||||
|
await db.commit()
|
||||||
|
# HttpOnly keeps client-side scripts from reading the session cookie. Lax is
|
||||||
|
# enough for normal navigation while reducing cross-site request exposure.
|
||||||
|
response.set_cookie(
|
||||||
|
key=SESSION_COOKIE,
|
||||||
|
value=raw_token, # raw token is stored in the cookie, not the hash
|
||||||
|
httponly=True,
|
||||||
|
samesite="lax",
|
||||||
|
secure=secure,
|
||||||
|
max_age=60 * 60 * 24 * SESSION_DURATION_DAYS,
|
||||||
|
path="/",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def lookup_session(
|
||||||
|
db: AsyncSession,
|
||||||
|
firebreak_session: str | None,
|
||||||
|
) -> Session | None:
|
||||||
|
"""Return the active session for a raw cookie token, if one exists."""
|
||||||
|
|
||||||
|
if not firebreak_session:
|
||||||
|
return None
|
||||||
|
token_hash = hashlib.sha256(firebreak_session.encode()).hexdigest()
|
||||||
|
now = datetime.now(UTC)
|
||||||
|
stmt = (
|
||||||
|
select(Session)
|
||||||
|
.options(selectinload(Session.user))
|
||||||
|
.where(
|
||||||
|
Session.token_hash == token_hash,
|
||||||
|
Session.expires_at > now,
|
||||||
|
Session.revoked_at.is_(None),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
result = await db.execute(stmt)
|
||||||
|
sess = result.scalar_one_or_none()
|
||||||
|
if sess is None:
|
||||||
|
return None
|
||||||
|
# Track activity whenever a valid cookie is used, then refresh the related
|
||||||
|
# user so route handlers can safely access sess.user.
|
||||||
|
sess.last_seen_at = now
|
||||||
|
await db.commit()
|
||||||
|
await db.refresh(sess, attribute_names=["user"])
|
||||||
|
return sess
|
||||||
|
|
||||||
|
|
||||||
|
async def get_current_session(
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
firebreak_session: Annotated[str | None, Cookie()] = None,
|
||||||
|
) -> Session:
|
||||||
|
"""FastAPI dependency that requires a valid signed-in session."""
|
||||||
|
|
||||||
|
sess = await lookup_session(db, firebreak_session)
|
||||||
|
if sess is None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail="Not signed in",
|
||||||
|
)
|
||||||
|
return sess
|
||||||
|
|
||||||
|
|
||||||
|
async def get_optional_session(
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
firebreak_session: Annotated[str | None, Cookie()] = None,
|
||||||
|
) -> Session | None:
|
||||||
|
"""FastAPI dependency that returns the current session when available."""
|
||||||
|
|
||||||
|
return await lookup_session(db, firebreak_session)
|
||||||
|
|
||||||
|
|
||||||
|
async def revoke_session(
|
||||||
|
db: AsyncSession, response: Response, firebreak_session: str | None
|
||||||
|
) -> None:
|
||||||
|
"""Delete the browser cookie and mark the matching session as revoked."""
|
||||||
|
|
||||||
|
response.delete_cookie(
|
||||||
|
key=SESSION_COOKIE,
|
||||||
|
path="/",
|
||||||
|
samesite="lax",
|
||||||
|
httponly=True,
|
||||||
|
)
|
||||||
|
if not firebreak_session:
|
||||||
|
return
|
||||||
|
token_hash = hashlib.sha256(firebreak_session.encode()).hexdigest()
|
||||||
|
result = await db.execute(
|
||||||
|
update(Session)
|
||||||
|
.where(Session.token_hash == token_hash, Session.revoked_at.is_(None))
|
||||||
|
.values(revoked_at=datetime.now(UTC))
|
||||||
|
)
|
||||||
|
await db.commit()
|
||||||
61
web/app/config.py
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from functools import lru_cache
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from cryptography.fernet import Fernet
|
||||||
|
from fastapi import Request
|
||||||
|
from pydantic import SecretStr
|
||||||
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
|
from app.auth.crypto import fernet_from_encryption_key
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from app.models.app_settings import AppSettings
|
||||||
|
|
||||||
|
_env_file = Path(__file__).parent.parent / ".env"
|
||||||
|
|
||||||
|
|
||||||
|
class Settings(BaseSettings):
|
||||||
|
"""Bootstrap settings loaded from environment variables.
|
||||||
|
|
||||||
|
Only contains fields needed before the database is available.
|
||||||
|
Forgejo config lives in the AppSettings DB table after setup.
|
||||||
|
"""
|
||||||
|
|
||||||
|
app_name: str = "Firebreak"
|
||||||
|
database_url: str = "postgresql+asyncpg://firebreak:firebreak@db:5432/firebreak_db"
|
||||||
|
token_encryption_key: str = ""
|
||||||
|
|
||||||
|
model_config = SettingsConfigDict(env_file=str(_env_file))
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def get_settings() -> Settings:
|
||||||
|
"""Cached settings instance."""
|
||||||
|
return Settings()
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def get_fernet() -> Fernet:
|
||||||
|
"""Return a cached Fernet cipher from the TOKEN_ENCRYPTION_KEY env var."""
|
||||||
|
key = get_settings().token_encryption_key
|
||||||
|
if not key:
|
||||||
|
raise ValueError(
|
||||||
|
"TOKEN_ENCRYPTION_KEY is not set. Add it to your .env file or deployment "
|
||||||
|
"environment. Generate one with: uv run python -c "
|
||||||
|
"'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'"
|
||||||
|
)
|
||||||
|
fernet = fernet_from_encryption_key(SecretStr(key))
|
||||||
|
if fernet is None:
|
||||||
|
raise ValueError(
|
||||||
|
"TOKEN_ENCRYPTION_KEY is invalid. Generate a valid key with: uv run python -c "
|
||||||
|
"'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'"
|
||||||
|
)
|
||||||
|
return fernet
|
||||||
|
|
||||||
|
|
||||||
|
def get_app_settings(request: Request) -> AppSettings:
|
||||||
|
"""FastAPI dependency returning the AppSettings row from app state."""
|
||||||
|
return request.app.state.app_settings
|
||||||
10
web/app/database.py
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from sqlalchemy.orm import DeclarativeBase
|
||||||
|
from sqlalchemy.types import DateTime
|
||||||
|
|
||||||
|
|
||||||
|
class Base(DeclarativeBase):
|
||||||
|
type_annotation_map = {
|
||||||
|
datetime.datetime: DateTime(timezone=True),
|
||||||
|
}
|
||||||
10
web/app/deps.py
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
from collections.abc import AsyncGenerator
|
||||||
|
|
||||||
|
from fastapi import Request
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
|
|
||||||
|
async def get_db(request: Request) -> AsyncGenerator[AsyncSession, None]:
|
||||||
|
"""Yield a request-scoped async database session."""
|
||||||
|
async with request.app.state.db_session() as session:
|
||||||
|
yield session
|
||||||
131
web/app/main.py
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
import logging
|
||||||
|
import secrets
|
||||||
|
from contextlib import asynccontextmanager
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import Depends, FastAPI, Request
|
||||||
|
from fastapi.responses import HTMLResponse, JSONResponse
|
||||||
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||||
|
from starlette.responses import Response
|
||||||
|
from sqlalchemy import func as sql_func, select
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||||
|
|
||||||
|
from app import models as _models # noqa: F401 - register ORM tables on metadata
|
||||||
|
from app.auth.session import get_current_session, get_optional_session
|
||||||
|
from app.config import get_settings
|
||||||
|
from app.database import Base
|
||||||
|
from app.middleware import SetupRequiredMiddleware
|
||||||
|
from app.models.app_settings import AppSettings
|
||||||
|
from app.models.session import Session as UserBrowserSession
|
||||||
|
from app.routers import auth, links, settings, setup
|
||||||
|
from app.templating import templates
|
||||||
|
|
||||||
|
|
||||||
|
@asynccontextmanager
|
||||||
|
async def lifespan(app: FastAPI):
|
||||||
|
"""Manage database engine lifecycle and load app settings."""
|
||||||
|
boot_settings = get_settings()
|
||||||
|
engine = create_async_engine(
|
||||||
|
url=boot_settings.database_url,
|
||||||
|
pool_pre_ping=True,
|
||||||
|
echo=boot_settings.app_name != "Firebreak",
|
||||||
|
)
|
||||||
|
app.state.db_session = async_sessionmaker(
|
||||||
|
engine,
|
||||||
|
class_=AsyncSession,
|
||||||
|
expire_on_commit=False,
|
||||||
|
)
|
||||||
|
async with engine.begin() as conn:
|
||||||
|
await conn.run_sync(Base.metadata.create_all)
|
||||||
|
|
||||||
|
async with app.state.db_session() as db:
|
||||||
|
from app.models.user import User
|
||||||
|
|
||||||
|
result = await db.execute(select(AppSettings).where(AppSettings.id == 1))
|
||||||
|
row = result.scalar_one_or_none()
|
||||||
|
user_count = await db.scalar(select(sql_func.count()).select_from(User))
|
||||||
|
|
||||||
|
app.state.app_settings = row
|
||||||
|
|
||||||
|
# Generate a setup token whenever no users exist yet — whether it's
|
||||||
|
# a fresh install or a retry after bad OAuth config.
|
||||||
|
if not user_count:
|
||||||
|
app.state.setup_token = secrets.token_urlsafe(32)
|
||||||
|
logger = logging.getLogger("firebreak")
|
||||||
|
logger.warning(
|
||||||
|
"\n"
|
||||||
|
"╔══════════════════════════════════════════════════════════╗\n"
|
||||||
|
"║ SETUP TOKEN (paste this into the setup wizard): ║\n"
|
||||||
|
"║ %-54s ║\n"
|
||||||
|
"╚══════════════════════════════════════════════════════════╝",
|
||||||
|
app.state.setup_token,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
app.state.setup_token = None
|
||||||
|
|
||||||
|
yield
|
||||||
|
await engine.dispose()
|
||||||
|
|
||||||
|
|
||||||
|
app = FastAPI(lifespan=lifespan)
|
||||||
|
app.add_middleware(SetupRequiredMiddleware)
|
||||||
|
|
||||||
|
app.mount("/static", StaticFiles(directory=Path(__file__).parent / "static"), name="static")
|
||||||
|
app.include_router(auth.router)
|
||||||
|
app.include_router(links.router)
|
||||||
|
app.include_router(settings.router)
|
||||||
|
app.include_router(setup.router)
|
||||||
|
|
||||||
|
ERROR_TITLES = {
|
||||||
|
400: "Bad Request",
|
||||||
|
401: "Unauthorized",
|
||||||
|
403: "Forbidden",
|
||||||
|
404: "Not Found",
|
||||||
|
500: "Internal Server Error",
|
||||||
|
503: "Service Unavailable",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@app.exception_handler(StarletteHTTPException)
|
||||||
|
async def http_exception_handler(request: Request, exc: StarletteHTTPException) -> Response:
|
||||||
|
"""Render a styled error page for browser requests, JSON for API clients."""
|
||||||
|
accept = request.headers.get("accept", "")
|
||||||
|
if "text/html" in accept:
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
request,
|
||||||
|
"error.html",
|
||||||
|
{
|
||||||
|
"status_code": exc.status_code,
|
||||||
|
"title": ERROR_TITLES.get(exc.status_code, "Error"),
|
||||||
|
"detail": exc.detail,
|
||||||
|
},
|
||||||
|
status_code=exc.status_code,
|
||||||
|
)
|
||||||
|
return JSONResponse({"detail": exc.detail}, status_code=exc.status_code)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/", response_class=HTMLResponse)
|
||||||
|
async def root(
|
||||||
|
request: Request, sess: Annotated[UserBrowserSession | None, Depends(get_optional_session)]
|
||||||
|
) -> Response:
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
request,
|
||||||
|
"index.html",
|
||||||
|
{"user": sess.user if sess else None},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/dashboard", response_class=HTMLResponse)
|
||||||
|
async def dashboard(
|
||||||
|
request: Request, sess: Annotated[UserBrowserSession, Depends(get_current_session)]
|
||||||
|
) -> Response:
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
request,
|
||||||
|
"dashboard.html",
|
||||||
|
{
|
||||||
|
"user": sess.user,
|
||||||
|
"pat_registered": sess.user.has_pat,
|
||||||
|
},
|
||||||
|
)
|
||||||
21
web/app/middleware.py
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
from starlette.middleware.base import BaseHTTPMiddleware
|
||||||
|
from starlette.requests import Request
|
||||||
|
from starlette.responses import RedirectResponse, Response
|
||||||
|
|
||||||
|
|
||||||
|
class SetupRequiredMiddleware(BaseHTTPMiddleware):
|
||||||
|
"""Redirect all requests to /setup when the app has not been configured yet."""
|
||||||
|
|
||||||
|
async def dispatch(self, request: Request, call_next) -> Response:
|
||||||
|
path = request.url.path
|
||||||
|
if path.startswith("/setup") or path.startswith("/static") or path == "/favicon.ico":
|
||||||
|
return await call_next(request)
|
||||||
|
|
||||||
|
if request.app.state.app_settings is None:
|
||||||
|
if request.headers.get("HX-Request"):
|
||||||
|
response = Response(status_code=200)
|
||||||
|
response.headers["HX-Redirect"] = "/setup"
|
||||||
|
return response
|
||||||
|
return RedirectResponse("/setup", status_code=302)
|
||||||
|
|
||||||
|
return await call_next(request)
|
||||||
8
web/app/models/__init__.py
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
"""Import ORM modules so ``Base.metadata`` is populated before ``create_all``."""
|
||||||
|
|
||||||
|
from app.models.app_settings import AppSettings
|
||||||
|
from app.models.grant import Grant
|
||||||
|
from app.models.session import Session
|
||||||
|
from app.models.user import LinkedIdentity, User
|
||||||
|
|
||||||
|
__all__ = ["AppSettings", "Grant", "LinkedIdentity", "Session", "User"]
|
||||||
22
web/app/models/app_settings.py
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import CheckConstraint, DateTime, String, Text, func
|
||||||
|
from sqlalchemy.orm import Mapped, mapped_column
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
|
||||||
|
class AppSettings(Base):
|
||||||
|
__tablename__ = "app_settings"
|
||||||
|
__table_args__ = (CheckConstraint("id = 1", name="single_row"),)
|
||||||
|
|
||||||
|
id: Mapped[int] = mapped_column(primary_key=True, default=1)
|
||||||
|
forgejo_base_url: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
forgejo_oauth_client_id: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
forgejo_oauth_client_secret_encrypted: Mapped[str] = mapped_column(Text, nullable=False)
|
||||||
|
firebreak_public_base_url: Mapped[str] = mapped_column(String, nullable=False, default="")
|
||||||
|
setup_completed_at: Mapped[datetime.datetime] = mapped_column(
|
||||||
|
DateTime(timezone=True), server_default=func.now()
|
||||||
|
)
|
||||||
43
web/app/models/grant.py
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import TYPE_CHECKING, Literal, get_args
|
||||||
|
|
||||||
|
from sqlalchemy import Enum, ForeignKey, String, Uuid, func
|
||||||
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .user import User
|
||||||
|
|
||||||
|
GrantType = Literal["public", "private"]
|
||||||
|
|
||||||
|
|
||||||
|
class Grant(Base):
|
||||||
|
__tablename__ = "grants"
|
||||||
|
|
||||||
|
id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid,
|
||||||
|
primary_key=True,
|
||||||
|
server_default=func.gen_random_uuid(),
|
||||||
|
)
|
||||||
|
token_hash: Mapped[str] = mapped_column(String, unique=True, nullable=False, index=True)
|
||||||
|
user_id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid, ForeignKey("users.id", ondelete="CASCADE"), nullable=False
|
||||||
|
)
|
||||||
|
created_at: Mapped[datetime] = mapped_column(server_default=func.now())
|
||||||
|
expires_at: Mapped[datetime] = mapped_column(nullable=False)
|
||||||
|
revoked_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||||
|
repo_owner: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
repo_name: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
commit_sha: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
grant_type: Mapped[GrantType] = mapped_column(
|
||||||
|
Enum(*get_args(GrantType), name="grant_type_enum"),
|
||||||
|
nullable=False,
|
||||||
|
default="public",
|
||||||
|
)
|
||||||
|
recipient_email: Mapped[str | None] = mapped_column(String, nullable=True)
|
||||||
|
|
||||||
|
user: Mapped[User] = relationship("User", back_populates="grants")
|
||||||
31
web/app/models/session.py
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from sqlalchemy import ForeignKey, String, Uuid, func
|
||||||
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from app.models.user import User
|
||||||
|
|
||||||
|
|
||||||
|
class Session(Base):
|
||||||
|
__tablename__ = "sessions"
|
||||||
|
|
||||||
|
id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid, primary_key=True, server_default=func.gen_random_uuid()
|
||||||
|
)
|
||||||
|
user_id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid, ForeignKey("users.id", ondelete="CASCADE"), nullable=False
|
||||||
|
)
|
||||||
|
token_hash: Mapped[str] = mapped_column(String(64), unique=True, nullable=False, index=True)
|
||||||
|
created_at: Mapped[datetime] = mapped_column(server_default=func.now())
|
||||||
|
expires_at: Mapped[datetime] = mapped_column(nullable=False, index=True)
|
||||||
|
last_seen_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||||
|
revoked_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||||
|
|
||||||
|
user: Mapped[User] = relationship("User", back_populates="sessions")
|
||||||
67
web/app/models/user.py
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from sqlalchemy import ForeignKey, String, Text, UniqueConstraint, Uuid, func
|
||||||
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .grant import Grant
|
||||||
|
from .session import Session
|
||||||
|
|
||||||
|
|
||||||
|
class User(Base):
|
||||||
|
__tablename__ = "users"
|
||||||
|
|
||||||
|
id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid, primary_key=True, server_default=func.gen_random_uuid()
|
||||||
|
)
|
||||||
|
display_name: Mapped[str | None] = mapped_column(String, nullable=True)
|
||||||
|
email: Mapped[str | None] = mapped_column(String, nullable=True, index=True)
|
||||||
|
pat_encrypted: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||||
|
pat_registered_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||||
|
created_at: Mapped[datetime] = mapped_column(server_default=func.now())
|
||||||
|
|
||||||
|
@property
|
||||||
|
def has_pat(self) -> bool:
|
||||||
|
return self.pat_encrypted is not None
|
||||||
|
|
||||||
|
identities: Mapped[list[LinkedIdentity]] = relationship(
|
||||||
|
back_populates="user",
|
||||||
|
cascade="all, delete-orphan",
|
||||||
|
)
|
||||||
|
sessions: Mapped[list[Session]] = relationship(
|
||||||
|
"Session",
|
||||||
|
back_populates="user",
|
||||||
|
cascade="all, delete-orphan",
|
||||||
|
)
|
||||||
|
grants: Mapped[list[Grant]] = relationship(
|
||||||
|
"Grant",
|
||||||
|
back_populates="user",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class LinkedIdentity(Base):
|
||||||
|
__tablename__ = "linked_identities"
|
||||||
|
|
||||||
|
id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid, primary_key=True, server_default=func.gen_random_uuid()
|
||||||
|
)
|
||||||
|
user_id: Mapped[uuid.UUID] = mapped_column(
|
||||||
|
Uuid, ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True
|
||||||
|
)
|
||||||
|
provider: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
provider_user_id: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
provider_username: Mapped[str] = mapped_column(String, nullable=False)
|
||||||
|
access_token_encrypted: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||||
|
access_token_expires_at: Mapped[datetime | None] = mapped_column(nullable=True)
|
||||||
|
refresh_token_encrypted: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||||
|
created_at: Mapped[datetime] = mapped_column(server_default=func.now())
|
||||||
|
|
||||||
|
user: Mapped[User] = relationship(back_populates="identities")
|
||||||
|
|
||||||
|
__table_args__ = (UniqueConstraint("provider", "provider_user_id"),)
|
||||||
0
web/app/routers/__init__.py
Normal file
232
web/app/routers/auth.py
Normal file
|
|
@ -0,0 +1,232 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import secrets
|
||||||
|
from datetime import UTC, datetime, timedelta
|
||||||
|
from typing import Annotated
|
||||||
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
from fastapi import APIRouter, Cookie, Depends, HTTPException, Request, status
|
||||||
|
from fastapi.responses import RedirectResponse
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
|
from app.auth.crypto import decrypt_token
|
||||||
|
from app.auth.identity import find_or_create_user
|
||||||
|
from app.auth.session import create_session, revoke_session
|
||||||
|
from app.config import get_app_settings, get_fernet
|
||||||
|
from app.deps import get_db
|
||||||
|
from app.models.app_settings import AppSettings
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/auth", tags=["auth"])
|
||||||
|
|
||||||
|
|
||||||
|
# ── Forgejo API client ──
|
||||||
|
|
||||||
|
|
||||||
|
async def _forgejo_post(app_settings: AppSettings, path: str, data: dict) -> dict:
|
||||||
|
url = f"{app_settings.forgejo_base_url}{path}"
|
||||||
|
try:
|
||||||
|
async with httpx.AsyncClient(timeout=30.0) as client:
|
||||||
|
resp = await client.post(url, data=data, headers={"Accept": "application/json"})
|
||||||
|
except httpx.RequestError:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Cannot reach Forgejo. Check your connection settings.",
|
||||||
|
)
|
||||||
|
if resp.status_code != 200:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail=f"Forgejo returned an error ({resp.status_code}). Verify your OAuth configuration.",
|
||||||
|
)
|
||||||
|
return resp.json()
|
||||||
|
|
||||||
|
|
||||||
|
async def _forgejo_get(app_settings: AppSettings, path: str, token: str) -> dict:
|
||||||
|
url = f"{app_settings.forgejo_base_url}{path}"
|
||||||
|
try:
|
||||||
|
async with httpx.AsyncClient(timeout=30.0) as client:
|
||||||
|
resp = await client.get(url, headers={"Authorization": f"token {token}"})
|
||||||
|
except httpx.RequestError:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Cannot reach Forgejo. Check your connection settings.",
|
||||||
|
)
|
||||||
|
if resp.status_code != 200:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail=f"Forgejo returned an error ({resp.status_code}). Verify your OAuth configuration.",
|
||||||
|
)
|
||||||
|
return resp.json()
|
||||||
|
|
||||||
|
|
||||||
|
# ── OAuth CSRF helpers ──
|
||||||
|
|
||||||
|
|
||||||
|
def _set_oauth_state_cookie(response: RedirectResponse, state: str) -> None:
|
||||||
|
response.set_cookie(
|
||||||
|
key="oauth_state",
|
||||||
|
value=state,
|
||||||
|
httponly=True,
|
||||||
|
samesite="lax",
|
||||||
|
path="/",
|
||||||
|
max_age=600,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _verify_oauth_state(state: str | None, oauth_state: str | None) -> None:
|
||||||
|
if not state or not oauth_state or not secrets.compare_digest(state, oauth_state):
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail="OAuth state mismatch. Possible CSRF attack.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ── Forgejo response parsers ──
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_token_response(data: dict) -> tuple[str, str | None, datetime | None]:
|
||||||
|
access_token = data.get("access_token")
|
||||||
|
if not access_token or not isinstance(access_token, str):
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Forgejo OAuth response did not include an access_token.",
|
||||||
|
)
|
||||||
|
refresh_token = data.get("refresh_token")
|
||||||
|
refresh_plain = refresh_token if isinstance(refresh_token, str) else None
|
||||||
|
expires_in = data.get("expires_in")
|
||||||
|
if expires_in is not None:
|
||||||
|
expires_at = datetime.now(UTC) + timedelta(seconds=int(expires_in))
|
||||||
|
else:
|
||||||
|
expires_at = None
|
||||||
|
return access_token, refresh_plain, expires_at
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_user_response(data: dict) -> tuple[str, str, str | None]:
|
||||||
|
provider_user_id = str(data.get("id", "")).strip()
|
||||||
|
provider_username = str(data.get("username", "")).strip()
|
||||||
|
if not provider_user_id or not provider_username:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Forgejo user response missing id or username.",
|
||||||
|
)
|
||||||
|
email_val = data.get("email")
|
||||||
|
email = email_val if isinstance(email_val, str) and email_val.strip() else None
|
||||||
|
return provider_user_id, provider_username, email
|
||||||
|
|
||||||
|
|
||||||
|
# ── OAuth config helpers ──
|
||||||
|
|
||||||
|
|
||||||
|
def _forgejo_oauth_redirect_uri(request: Request, app_settings: AppSettings) -> str:
|
||||||
|
base_url = app_settings.firebreak_public_base_url.strip().rstrip("/")
|
||||||
|
if base_url:
|
||||||
|
return f"{base_url}/auth/callback/forgejo"
|
||||||
|
return str(request.url_for("forgejo_oauth_callback"))
|
||||||
|
|
||||||
|
|
||||||
|
def _get_oauth_client_secret(app_settings: AppSettings) -> str:
|
||||||
|
try:
|
||||||
|
return decrypt_token(get_fernet(), app_settings.forgejo_oauth_client_secret_encrypted)
|
||||||
|
except ValueError:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||||
|
detail="Forgejo OAuth credentials could not be decrypted. Reconfigure at /setup.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# ── Routes ──
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/login/forgejo")
|
||||||
|
async def login_forgejo(
|
||||||
|
request: Request, app_settings: Annotated[AppSettings, Depends(get_app_settings)]
|
||||||
|
) -> RedirectResponse:
|
||||||
|
"""Redirect the browser to Forgejo to begin OAuth sign-in."""
|
||||||
|
|
||||||
|
redirect_uri = _forgejo_oauth_redirect_uri(request, app_settings)
|
||||||
|
state = secrets.token_urlsafe(32)
|
||||||
|
query = urlencode(
|
||||||
|
{
|
||||||
|
"client_id": app_settings.forgejo_oauth_client_id,
|
||||||
|
"response_type": "code",
|
||||||
|
"redirect_uri": redirect_uri,
|
||||||
|
"state": state,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
authorization_url = f"{app_settings.forgejo_base_url}/login/oauth/authorize?{query}"
|
||||||
|
response = RedirectResponse(authorization_url, status_code=status.HTTP_302_FOUND)
|
||||||
|
_set_oauth_state_cookie(response, state)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/callback/forgejo", name="forgejo_oauth_callback")
|
||||||
|
async def callback_forgejo(
|
||||||
|
request: Request,
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
app_settings: Annotated[AppSettings, Depends(get_app_settings)],
|
||||||
|
code: str | None = None,
|
||||||
|
state: str | None = None,
|
||||||
|
oauth_state: Annotated[str | None, Cookie()] = None,
|
||||||
|
) -> RedirectResponse:
|
||||||
|
"""Handle Forgejo's OAuth callback and create a local app session."""
|
||||||
|
|
||||||
|
_verify_oauth_state(state, oauth_state)
|
||||||
|
|
||||||
|
if not code:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail="Forgejo did not return an authorization code. The user may have denied consent.",
|
||||||
|
)
|
||||||
|
|
||||||
|
client_secret = _get_oauth_client_secret(app_settings)
|
||||||
|
redirect_uri = _forgejo_oauth_redirect_uri(request, app_settings)
|
||||||
|
|
||||||
|
token_data = await _forgejo_post(
|
||||||
|
app_settings,
|
||||||
|
"/login/oauth/access_token",
|
||||||
|
{
|
||||||
|
"grant_type": "authorization_code",
|
||||||
|
"client_id": app_settings.forgejo_oauth_client_id,
|
||||||
|
"client_secret": client_secret,
|
||||||
|
"code": code,
|
||||||
|
"redirect_uri": redirect_uri,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
access_token, refresh_plain, expires_at = _parse_token_response(token_data)
|
||||||
|
|
||||||
|
user_data = await _forgejo_get(app_settings, "/api/v1/user", access_token)
|
||||||
|
provider_user_id, provider_username, email = _parse_user_response(user_data)
|
||||||
|
|
||||||
|
user = await find_or_create_user(
|
||||||
|
db,
|
||||||
|
app_settings,
|
||||||
|
provider="forgejo",
|
||||||
|
provider_user_id=provider_user_id,
|
||||||
|
provider_username=provider_username,
|
||||||
|
email=email,
|
||||||
|
access_token_raw=access_token,
|
||||||
|
access_token_expires_at=expires_at,
|
||||||
|
refresh_token_raw=refresh_plain,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Clear setup token on first successful login — setup is proven to work
|
||||||
|
if request.app.state.setup_token is not None:
|
||||||
|
request.app.state.setup_token = None
|
||||||
|
|
||||||
|
redirect = RedirectResponse("/dashboard", status_code=status.HTTP_302_FOUND)
|
||||||
|
redirect.delete_cookie("oauth_state")
|
||||||
|
|
||||||
|
await create_session(db, redirect, user.id, secure=request.url.scheme == "https")
|
||||||
|
return redirect
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/logout")
|
||||||
|
async def logout(
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
firebreak_session: Annotated[str | None, Cookie()] = None,
|
||||||
|
) -> RedirectResponse:
|
||||||
|
"""Revoke the current app session and redirect back to the home page."""
|
||||||
|
|
||||||
|
redirect = RedirectResponse("/", status_code=status.HTTP_302_FOUND)
|
||||||
|
await revoke_session(db, redirect, firebreak_session)
|
||||||
|
return redirect
|
||||||
31
web/app/routers/links.py
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from pydantic import BaseModel, EmailStr
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/links", tags=["links"])
|
||||||
|
|
||||||
|
|
||||||
|
class CreateLinkRequest(BaseModel):
|
||||||
|
repo_owner: str
|
||||||
|
repo_name: str
|
||||||
|
branch: str
|
||||||
|
expires_at: datetime
|
||||||
|
link_type: Literal["public", "private"] = "public"
|
||||||
|
recipient_email: EmailStr | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class CreateLinkResponse(BaseModel):
|
||||||
|
repo_owner: str
|
||||||
|
repo_name: str
|
||||||
|
branch: str
|
||||||
|
expires_at: datetime
|
||||||
|
commit_sha: str
|
||||||
|
share_url: str
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/", status_code=501)
|
||||||
|
async def create_link(request: CreateLinkRequest) -> dict:
|
||||||
|
"""Stub — link creation not yet implemented."""
|
||||||
|
return {"detail": "Link creation is not yet implemented."}
|
||||||
74
web/app/routers/settings.py
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from datetime import UTC, datetime
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, Form, HTTPException, Request, status
|
||||||
|
from fastapi.responses import HTMLResponse, RedirectResponse
|
||||||
|
from starlette.responses import Response
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
|
from app.auth.crypto import encrypt_optional
|
||||||
|
from app.auth.session import get_current_session
|
||||||
|
from app.config import get_fernet
|
||||||
|
from app.deps import get_db
|
||||||
|
from app.models.session import Session as UserBrowserSession
|
||||||
|
from app.templating import templates
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/settings", tags=["settings"])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("", response_class=HTMLResponse)
|
||||||
|
async def settings_page(
|
||||||
|
request: Request,
|
||||||
|
sess: Annotated[UserBrowserSession, Depends(get_current_session)],
|
||||||
|
) -> Response:
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
request,
|
||||||
|
"settings.html",
|
||||||
|
{
|
||||||
|
"user": sess.user,
|
||||||
|
"pat_registered": sess.user.has_pat,
|
||||||
|
"pat_registered_at": sess.user.pat_registered_at,
|
||||||
|
"pat_deleted": request.query_params.get("pat") == "deleted",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/pat")
|
||||||
|
async def register_pat(
|
||||||
|
pat: Annotated[str, Form()],
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
sess: Annotated[UserBrowserSession, Depends(get_current_session)],
|
||||||
|
) -> RedirectResponse:
|
||||||
|
pat = pat.strip()
|
||||||
|
if not pat:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail="Forgejo access token is required.",
|
||||||
|
)
|
||||||
|
|
||||||
|
fernet = get_fernet()
|
||||||
|
sess.user.pat_encrypted = encrypt_optional(fernet, pat)
|
||||||
|
sess.user.pat_registered_at = datetime.now(UTC)
|
||||||
|
await db.commit()
|
||||||
|
|
||||||
|
return RedirectResponse(
|
||||||
|
"/settings?pat=registered",
|
||||||
|
status_code=status.HTTP_303_SEE_OTHER,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/pat/delete")
|
||||||
|
async def delete_pat(
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
sess: Annotated[UserBrowserSession, Depends(get_current_session)],
|
||||||
|
) -> RedirectResponse:
|
||||||
|
sess.user.pat_encrypted = None
|
||||||
|
sess.user.pat_registered_at = None
|
||||||
|
await db.commit()
|
||||||
|
|
||||||
|
return RedirectResponse(
|
||||||
|
"/settings?pat=deleted",
|
||||||
|
status_code=status.HTTP_303_SEE_OTHER,
|
||||||
|
)
|
||||||
173
web/app/routers/setup.py
Normal file
|
|
@ -0,0 +1,173 @@
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Cookie, Depends, Form, HTTPException, Request, status
|
||||||
|
from fastapi.responses import RedirectResponse
|
||||||
|
from starlette.responses import Response
|
||||||
|
from sqlalchemy import func as sql_func, select
|
||||||
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
|
from app.auth.crypto import encrypt_token
|
||||||
|
from app.auth.session import lookup_session
|
||||||
|
from app.config import get_fernet
|
||||||
|
from app.deps import get_db
|
||||||
|
from app.models.app_settings import AppSettings
|
||||||
|
from app.models.user import User
|
||||||
|
from app.templating import templates
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/setup", tags=["setup"])
|
||||||
|
|
||||||
|
|
||||||
|
async def _require_auth_if_configured(
|
||||||
|
request: Request,
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
firebreak_session: Annotated[str | None, Cookie()] = None,
|
||||||
|
) -> None:
|
||||||
|
"""Block anonymous access to /setup after initial configuration.
|
||||||
|
|
||||||
|
If no users exist yet (e.g. bad OAuth config on first setup), the setup
|
||||||
|
token is still required but login is not — there's nobody to log in as.
|
||||||
|
"""
|
||||||
|
if request.app.state.app_settings is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
# If no users exist, allow access — the setup token still protects POST
|
||||||
|
user_count = await db.scalar(select(sql_func.count()).select_from(User)) or 0
|
||||||
|
if user_count == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
sess = await lookup_session(db, firebreak_session)
|
||||||
|
if sess is None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail="Sign in to reconfigure Firebreak.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("", dependencies=[Depends(_require_auth_if_configured)])
|
||||||
|
async def setup_page(request: Request, db: Annotated[AsyncSession, Depends(get_db)]) -> Response:
|
||||||
|
"""Render the setup wizard. Pre-fills fields when reconfiguring."""
|
||||||
|
existing = request.app.state.app_settings
|
||||||
|
user_count = await db.scalar(select(sql_func.count()).select_from(User)) or 0
|
||||||
|
has_users = user_count > 0
|
||||||
|
public_base = (existing.firebreak_public_base_url if existing else "") or str(
|
||||||
|
request.base_url
|
||||||
|
).rstrip("/")
|
||||||
|
ctx = {
|
||||||
|
"reconfiguring": existing is not None and has_users,
|
||||||
|
"forgejo_base_url": existing.forgejo_base_url if existing else "",
|
||||||
|
"forgejo_oauth_client_id": existing.forgejo_oauth_client_id if existing else "",
|
||||||
|
"firebreak_public_base_url": existing.firebreak_public_base_url if existing else "",
|
||||||
|
"oauth_callback_url": f"{public_base}/auth/callback/forgejo",
|
||||||
|
}
|
||||||
|
return templates.TemplateResponse(request, "setup.html", ctx)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("", dependencies=[Depends(_require_auth_if_configured)])
|
||||||
|
async def setup_submit(
|
||||||
|
request: Request,
|
||||||
|
db: Annotated[AsyncSession, Depends(get_db)],
|
||||||
|
forgejo_base_url: Annotated[str, Form()],
|
||||||
|
forgejo_oauth_client_id: Annotated[str, Form()],
|
||||||
|
forgejo_oauth_client_secret: Annotated[str, Form()] = "",
|
||||||
|
firebreak_public_base_url: Annotated[str, Form()] = "",
|
||||||
|
setup_token: Annotated[str, Form()] = "",
|
||||||
|
) -> RedirectResponse:
|
||||||
|
"""Process the setup wizard — creates or updates Forgejo settings."""
|
||||||
|
user_count = await db.scalar(select(sql_func.count()).select_from(User)) or 0
|
||||||
|
has_users = user_count > 0
|
||||||
|
is_reconfiguring = request.app.state.app_settings is not None and has_users
|
||||||
|
|
||||||
|
# Require setup token when no users exist (first-time or fixing bad config)
|
||||||
|
if not has_users:
|
||||||
|
expected = request.app.state.setup_token
|
||||||
|
if not expected or setup_token.strip() != expected:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
|
detail="Invalid setup token. Check your server logs for the correct token.",
|
||||||
|
)
|
||||||
|
|
||||||
|
forgejo_base_url = forgejo_base_url.strip().rstrip("/")
|
||||||
|
forgejo_oauth_client_id = forgejo_oauth_client_id.strip()
|
||||||
|
forgejo_oauth_client_secret = forgejo_oauth_client_secret.strip()
|
||||||
|
firebreak_public_base_url = firebreak_public_base_url.strip().rstrip("/")
|
||||||
|
|
||||||
|
if not forgejo_base_url or not forgejo_oauth_client_id:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail="Forgejo URL and Client ID are required.",
|
||||||
|
)
|
||||||
|
|
||||||
|
if is_reconfiguring:
|
||||||
|
result = await db.execute(select(AppSettings).where(AppSettings.id == 1))
|
||||||
|
row = result.scalar_one_or_none()
|
||||||
|
if row is None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=500, detail="Settings row missing during reconfiguration."
|
||||||
|
)
|
||||||
|
row.forgejo_base_url = forgejo_base_url
|
||||||
|
row.forgejo_oauth_client_id = forgejo_oauth_client_id
|
||||||
|
row.firebreak_public_base_url = firebreak_public_base_url
|
||||||
|
if forgejo_oauth_client_secret:
|
||||||
|
try:
|
||||||
|
fernet = get_fernet()
|
||||||
|
except ValueError:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||||
|
detail=(
|
||||||
|
"TOKEN_ENCRYPTION_KEY is not set. Add it to your .env file or deployment "
|
||||||
|
"environment. Generate one with: "
|
||||||
|
"uv run python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
row.forgejo_oauth_client_secret_encrypted = encrypt_token(
|
||||||
|
fernet, forgejo_oauth_client_secret
|
||||||
|
)
|
||||||
|
await db.commit()
|
||||||
|
await db.refresh(row)
|
||||||
|
request.app.state.app_settings = row
|
||||||
|
return RedirectResponse("/", status_code=status.HTTP_303_SEE_OTHER)
|
||||||
|
|
||||||
|
# First-time setup (or retry after bad config) — no users exist yet
|
||||||
|
if not forgejo_oauth_client_secret:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_400_BAD_REQUEST,
|
||||||
|
detail="Client Secret is required during initial setup.",
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
fernet = get_fernet()
|
||||||
|
except ValueError:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
|
||||||
|
detail=(
|
||||||
|
"TOKEN_ENCRYPTION_KEY is not set. Add it to your .env file or deployment "
|
||||||
|
"environment. Generate one with: "
|
||||||
|
"uv run python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
encrypted_secret = encrypt_token(fernet, forgejo_oauth_client_secret)
|
||||||
|
|
||||||
|
# Update existing row if retrying after bad config, otherwise create
|
||||||
|
result = await db.execute(select(AppSettings).where(AppSettings.id == 1))
|
||||||
|
row = result.scalar_one_or_none()
|
||||||
|
if row:
|
||||||
|
row.forgejo_base_url = forgejo_base_url
|
||||||
|
row.forgejo_oauth_client_id = forgejo_oauth_client_id
|
||||||
|
row.forgejo_oauth_client_secret_encrypted = encrypted_secret
|
||||||
|
row.firebreak_public_base_url = firebreak_public_base_url
|
||||||
|
else:
|
||||||
|
row = AppSettings(
|
||||||
|
id=1,
|
||||||
|
forgejo_base_url=forgejo_base_url,
|
||||||
|
forgejo_oauth_client_id=forgejo_oauth_client_id,
|
||||||
|
forgejo_oauth_client_secret_encrypted=encrypted_secret,
|
||||||
|
firebreak_public_base_url=firebreak_public_base_url,
|
||||||
|
)
|
||||||
|
db.add(row)
|
||||||
|
await db.commit()
|
||||||
|
await db.refresh(row)
|
||||||
|
request.app.state.app_settings = row
|
||||||
|
|
||||||
|
return RedirectResponse("/", status_code=status.HTTP_303_SEE_OTHER)
|
||||||
297
web/app/static/css/input.css
Normal file
|
|
@ -0,0 +1,297 @@
|
||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
|
@theme {
|
||||||
|
--font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;
|
||||||
|
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
|
||||||
|
|
||||||
|
--color-background: #f8f8f6;
|
||||||
|
--color-foreground: #17191c;
|
||||||
|
|
||||||
|
--color-card: #f8f8f6;
|
||||||
|
--color-card-foreground: #17191c;
|
||||||
|
|
||||||
|
--color-muted: #eeeeea;
|
||||||
|
--color-muted-foreground: #3a3d42;
|
||||||
|
|
||||||
|
--color-accent: #f1f1ee;
|
||||||
|
--color-accent-foreground: #17191c;
|
||||||
|
|
||||||
|
--color-primary: #2a2d31;
|
||||||
|
--color-primary-foreground: #ffffff;
|
||||||
|
--color-primary-hover: #17191c;
|
||||||
|
--color-primary-muted: rgb(23 25 28 / 10%);
|
||||||
|
|
||||||
|
--color-secondary: #eeeeea;
|
||||||
|
--color-secondary-foreground: #17191c;
|
||||||
|
|
||||||
|
--color-border: #d8d8d2;
|
||||||
|
--color-border-subtle: #e9e9e4;
|
||||||
|
--color-input: #ffffff;
|
||||||
|
--color-ring: #2a2d31;
|
||||||
|
--color-ring-muted: rgb(23 25 28 / 12%);
|
||||||
|
--shadow-card: 0 1px 2px rgb(23 25 28 / 5%);
|
||||||
|
|
||||||
|
--color-success: oklch(47.8% 0.13 150);
|
||||||
|
--color-success-foreground: oklch(47.8% 0.13 150);
|
||||||
|
--color-success-muted: oklch(94.8% 0.055 150);
|
||||||
|
|
||||||
|
--color-warning: oklch(54.7% 0.13 65);
|
||||||
|
--color-warning-foreground: oklch(54.7% 0.13 65);
|
||||||
|
--color-warning-muted: oklch(96.3% 0.052 85);
|
||||||
|
|
||||||
|
--color-danger: #c62030;
|
||||||
|
--color-danger-foreground: #c62030;
|
||||||
|
--color-danger-muted: rgb(198 32 48 / 10%);
|
||||||
|
|
||||||
|
--color-expired: #5c5c58;
|
||||||
|
--color-expired-foreground: #4b4b47;
|
||||||
|
--color-expired-muted: #eeeeea;
|
||||||
|
|
||||||
|
--radius-sm: 0.125rem;
|
||||||
|
--radius-md: 0.25rem;
|
||||||
|
--radius-lg: 0.375rem;
|
||||||
|
--radius-xl: 0.5rem;
|
||||||
|
--radius-2xl: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@custom-variant dark (&:where(.dark, .dark *));
|
||||||
|
|
||||||
|
.dark {
|
||||||
|
--color-background: #17191c;
|
||||||
|
--color-foreground: #f7f2e8;
|
||||||
|
|
||||||
|
--color-card: #1f2226;
|
||||||
|
--color-card-foreground: #f7f2e8;
|
||||||
|
|
||||||
|
--color-muted: #282b30;
|
||||||
|
--color-muted-foreground: #bdb8ad;
|
||||||
|
|
||||||
|
--color-accent: #2f2728;
|
||||||
|
--color-accent-foreground: #f7f2e8;
|
||||||
|
|
||||||
|
--color-primary: #2a2d31;
|
||||||
|
--color-primary-foreground: #f7f2e8;
|
||||||
|
--color-primary-hover: #17191c;
|
||||||
|
--color-primary-muted: rgb(247 242 232 / 14%);
|
||||||
|
|
||||||
|
--color-secondary: #282b30;
|
||||||
|
--color-secondary-foreground: #f7f2e8;
|
||||||
|
|
||||||
|
--color-border: #34373d;
|
||||||
|
--color-border-subtle: #282b30;
|
||||||
|
--color-input: #1f2226;
|
||||||
|
--color-ring: #f7f2e8;
|
||||||
|
--color-ring-muted: rgb(247 242 232 / 18%);
|
||||||
|
--shadow-card: 0 1px 2px rgb(0 0 0 / 22%);
|
||||||
|
|
||||||
|
--color-success: oklch(75% 0.12 150);
|
||||||
|
--color-success-foreground: oklch(82% 0.12 150);
|
||||||
|
--color-success-muted: oklch(32% 0.07 150);
|
||||||
|
|
||||||
|
--color-warning: oklch(82% 0.13 75);
|
||||||
|
--color-warning-foreground: oklch(86% 0.13 75);
|
||||||
|
--color-warning-muted: oklch(35% 0.075 75);
|
||||||
|
|
||||||
|
--color-danger: #f04a36;
|
||||||
|
--color-danger-foreground: #ff7a66;
|
||||||
|
--color-danger-muted: rgb(240 74 54 / 18%);
|
||||||
|
|
||||||
|
--color-expired: #bdb8ad;
|
||||||
|
--color-expired-foreground: #d6d0c4;
|
||||||
|
--color-expired-muted: #282b30;
|
||||||
|
|
||||||
|
--image-wrapper-size: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer base {
|
||||||
|
* {
|
||||||
|
@apply border-border;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
@apply bg-background text-foreground;
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
@apply bg-background text-foreground antialiased;
|
||||||
|
letter-spacing: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3 {
|
||||||
|
@apply text-foreground;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer components {
|
||||||
|
.btn {
|
||||||
|
@apply inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md px-4 py-2.5 text-sm font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-xs {
|
||||||
|
@apply px-2 py-1 text-xs;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm {
|
||||||
|
@apply px-3 py-2 text-sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-md {
|
||||||
|
@apply px-4 py-2.5 text-sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-lg {
|
||||||
|
@apply px-5 py-3 text-base;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
@apply text-primary-foreground bg-primary-hover hover:bg-[#c62030]/90 hover:text-[#f7f2e8];
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
@apply border border-border bg-card text-secondary-foreground hover:border-border hover:bg-accent hover:text-accent-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-borderless {
|
||||||
|
@apply bg-transparent text-foreground hover:bg-accent hover:text-accent-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header {
|
||||||
|
position: relative;
|
||||||
|
z-index: 10;
|
||||||
|
background: lab(0% 0 0);
|
||||||
|
border-bottom: 0;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header a,
|
||||||
|
.app-header button,
|
||||||
|
.app-header nav svg {
|
||||||
|
color: #f7f2e8;
|
||||||
|
stroke: #f7f2e8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header .brand-link svg {
|
||||||
|
stroke: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header .brand-link svg path[fill="#17191C"] {
|
||||||
|
fill: #f7f2e8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header .btn-borderless {
|
||||||
|
color: #f7f2e8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header .btn-borderless:hover {
|
||||||
|
background: rgb(247 242 232 / 10%);
|
||||||
|
color: #fffdf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header .btn-secondary {
|
||||||
|
background: rgb(247 242 232 / 8%);
|
||||||
|
border-color: rgb(247 242 232 / 18%);
|
||||||
|
color: #f7f2e8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.app-header .btn-secondary:hover {
|
||||||
|
background: rgb(247 242 232 / 14%);
|
||||||
|
border-color: rgb(247 242 232 / 28%);
|
||||||
|
color: #fffdf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-page .app-header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.landing-page {
|
||||||
|
background: #17191c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-link svg {
|
||||||
|
@apply shrink-0;
|
||||||
|
stroke: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.brand-link svg:last-child {
|
||||||
|
width: 5.25rem;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dark .brand-link svg path[fill="#17191C"] {
|
||||||
|
fill: var(--color-foreground);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header-subtle {
|
||||||
|
@apply text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
@apply rounded-full px-2.5 py-1 text-xs font-medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-success {
|
||||||
|
@apply rounded-full bg-success-muted px-2.5 py-1 text-xs font-medium text-success-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-warning {
|
||||||
|
@apply rounded-full bg-warning-muted px-2.5 py-1 text-xs font-medium text-warning-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-danger {
|
||||||
|
@apply rounded-full bg-danger-muted px-2.5 py-1 text-xs font-medium text-danger-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-expired {
|
||||||
|
@apply rounded-full bg-expired-muted px-2.5 py-1 text-xs font-medium text-expired-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
@apply rounded-lg border border-border bg-card text-card-foreground;
|
||||||
|
box-shadow: var(--shadow-card);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
@apply border-b border-border px-4 py-3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header-label {
|
||||||
|
@apply text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header-title {
|
||||||
|
@apply mt-1 text-base font-semibold text-card-foreground;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
@apply px-4 py-4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-mono {
|
||||||
|
@apply rounded-md border border-border bg-input px-3 py-2 font-mono text-[13px] leading-5 text-foreground transition placeholder:text-muted-foreground focus:border-ring focus:outline-none focus:ring-2 focus:ring-ring-muted;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-error {
|
||||||
|
@apply text-sm font-medium text-danger-foreground;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@utility img-wrapper-* {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-width: --value(--max-w-*, [length], [percentage], [*], "none", "inherit", "initial", "unset");
|
||||||
|
|
||||||
|
/* Automatically target the image inside */
|
||||||
|
& img {
|
||||||
|
width: 100%; /* Replaces 'stretch' for better compatibility */
|
||||||
|
height: auto; /* Maintains aspect ratio */
|
||||||
|
display: block; /* Removes bottom whitespace common in inline images */
|
||||||
|
}
|
||||||
|
}
|
||||||
43
web/app/static/img/firebreak-brand.svg
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<svg width="560" height="625" viewBox="0 0 560 625" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M239.045 529.037C240.53 530.438 240.04 561.512 240.04 565.584C247.645 559.786 255.661 555.698 265.554 557.162C287.473 560.404 298.726 587.311 288.737 606.182C285.609 612.092 282.182 615.36 276.881 619.217C264.339 627.169 251.833 624.191 240.56 616.033C240.564 618.637 240.291 620.372 239.954 622.931C235.389 622.811 230.673 622.939 226.096 623.002C225.471 593.567 226.406 563.457 225.99 533.892C230.259 532.643 234.869 530.69 239.045 529.037ZM260.64 610.436C284.761 605.061 282.438 567.669 255.615 570.622C249.413 573.033 244.263 576.126 241.468 582.461C237.184 592.171 240.963 605.137 251.256 608.98C254.258 610.076 257.447 610.571 260.64 610.436Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M376.834 557.131C392.589 554.955 407.281 563.642 411.99 578.812C413.916 585.013 413.713 589.752 413.639 596.108C396.945 596.011 380.25 596.022 363.557 596.143C370.021 613.753 383.312 614.185 398.211 606.767C399.505 605.947 399.654 605.731 401.176 605.418C404.595 606.431 405.973 610.217 407.828 613.479C396.781 625.571 375.369 627.427 362.001 618.04C354.887 612.964 350.104 605.25 348.721 596.622C345.602 577.079 357.101 560.362 376.834 557.131ZM363.575 584.291C370.086 584.47 376.064 584.245 382.569 584.018C387.325 583.948 393.355 584.022 397.989 583.543C394.911 574.445 390.287 569.024 379.923 569.65C370.034 571.512 366.785 574.812 363.575 584.291Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M450.783 556.683C463.381 555.396 478.525 561.432 480.177 574.966C482.013 589.997 481.097 607.716 481.059 622.972C476.834 622.916 471.01 623.44 467.07 622.848C466.173 621.773 466.562 620.541 466.57 618.704L466.096 618.331C453.885 624.577 438.62 628.267 427.46 616.265C425.658 614.327 424.818 612.114 423.811 609.703C418.781 584.159 448.1 580.968 466.25 583.222C464.708 562.359 441.917 568.688 430.435 577.863C428.5 574.384 426.645 571.298 424.541 567.914C433.821 560.832 439.131 558.117 450.783 556.683ZM449.019 612.193C456.215 612.376 462.633 609.752 466.804 603.733C466.664 600.371 466.477 596.958 466.484 593.596C463.339 593.768 460.779 593.778 457.63 593.738C451.389 593.999 444.694 593.973 440.086 598.85C436.914 602.209 436.393 606.57 440.481 609.387C443.187 611.251 445.834 611.816 449.019 612.193Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M174.311 557.085C176.186 556.901 178.071 556.838 179.955 556.897C193.937 557.222 205.662 563.913 209.952 577.863C211.943 584.336 211.684 589.207 211.383 595.937C196.105 596.648 177.607 596.176 162.094 596.157C162.639 598.091 163.385 599.963 164.319 601.743C166.757 606.361 171.023 609.743 176.077 611.064C183.72 612.992 190.477 610.332 196.849 606.488C199.815 604.371 200.807 604.418 203.029 607.614C204.363 609.534 205.591 611.785 206.818 613.794C173.446 641.427 131.378 608.811 152.853 570.474C157.246 562.631 165.956 558.854 174.311 557.085ZM161.667 584.511C167.996 584.44 174.931 584.019 181.09 584.072C183.945 584.178 194.052 585.123 195.85 583.468C196.244 573.365 185.451 569.415 176.934 569.629C167.477 572.205 165.106 575.662 161.667 584.511Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M510.587 529.005C511.181 529.059 510.77 528.996 511.77 529.4C512.16 548.156 511.996 567.458 512.018 586.244C519.805 577.97 529.089 567.106 536.717 558.525C543.54 558.565 550.363 558.519 557.184 558.387C548.665 567.496 539.906 576.024 531.014 584.762C538.813 595.169 546.737 605.483 554.783 615.7C555.562 616.973 558.892 621.12 559.962 622.526C554.024 622.511 548.088 622.686 542.162 623.053C537.701 618.421 525.057 601.375 520.404 595.443C517.653 598.072 515.051 600.163 512.094 602.564C511.931 609.287 512.076 616.538 512.092 623.301C507.521 623.077 502.222 623.233 497.597 623.26C497.181 593.488 497.492 563.18 497.415 533.338C501.414 532.349 506.602 530.386 510.587 529.005Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M0.0149994 534.434C20.369 534.942 43.334 534.419 63.895 534.477C61.753 539.081 60.057 543.636 58.243 548.367C47.704 547.425 26.906 548.038 15.505 548.07L15.541 571.474C19.604 571.429 49.409 571.031 50.987 571.976L50.897 573.617C50.257 577.46 49.469 581.269 48.836 585.154C37.717 584.953 26.596 584.904 15.476 585.008L15.549 623.02L0 622.994L0.0149994 534.434Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M318.451 555.048L318.823 555.121C320.222 556.589 319.69 565.854 319.649 568.46C328.361 560.507 333.189 559.52 344.3 556.331C344.2 561.078 344.303 566.144 344.315 570.918C333.744 573.959 327.319 575.546 320.563 584.547L320.523 598.25L320.546 622.57C315.602 622.521 311.286 622.545 306.317 622.767C305.626 602.473 306.044 579.821 306.004 559.414C310.106 557.828 314.257 556.373 318.451 555.048Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M118.058 555.015L118.792 555.518C119.261 559.079 119.091 565.229 119.097 569.009C128.728 561.094 132.245 559.995 144.057 556.507C144.041 561.336 143.921 566.268 144.369 571.067C133.869 573.574 127.89 576.137 120.539 583.934L120.496 598.25L120.527 623.032L105.912 622.943C105.635 602.116 105.962 580.428 105.994 559.552C110.156 557.835 113.8 556.485 118.058 555.015Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M87.61 556.171L88.113 556.31C88.879 557.858 88.576 617.132 88.576 623.017L74.541 623.015C74.477 622.971 74.397 622.945 74.349 622.884C72.844 620.967 73.564 565.017 73.551 559.334C78.393 558.131 82.684 557.096 87.61 556.171Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M77.945 530.844C81.329 529.768 85.031 530.618 87.606 533.062C90.181 535.507 91.223 539.159 90.325 542.595C89.426 546.03 86.73 548.705 83.288 549.576C78.181 550.868 72.973 547.867 71.528 542.802C70.083 537.737 72.925 532.44 77.945 530.844Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M409.992 129.188C417.441 128.358 432.247 129.01 438.239 133.886C445.934 140.147 444.321 141.893 454.577 143.756C453.658 160.141 456.451 155.076 462.342 167.016C466.632 178.302 471.575 190.292 474.386 201.998C477.631 215.507 464.545 224.911 483.246 229.969C478.35 253.35 491.486 263.677 512.057 267.911C494.134 273.673 487.464 280.725 482.873 298.856C481.4 304.277 479.555 309.812 478.493 315.322C476.919 323.49 476.518 331.703 470.503 338.129C468.564 340.201 466.598 341.721 464.357 343.476C464.988 346.046 465.74 348.707 466.429 351.274C457.886 364.031 453.875 377.694 445.313 390.288C442.778 394.017 440.506 397.854 438.528 401.912C463.688 396.635 481.42 388.554 503.388 375.723C497.416 384.405 488.826 396.09 481.228 403.364C473.435 410.63 465.188 417.326 457.393 424.611C447.951 433.437 438.713 442.49 429.26 451.3C424.6 455.643 419.438 459.468 414.658 463.716C417.363 458.74 420.744 452.274 422.704 447.102C426.793 436.314 429.465 414.849 427.431 403.561C424.792 388.915 423.146 388.029 424.24 372.764C417.259 387.788 419.873 391.997 420.883 407.542C421.153 411.695 417.872 421.395 414.736 424.163C407.064 426.11 404.341 431.758 398.106 436.337C391.062 441.509 383.299 445.415 375.741 449.763C380.22 444.046 382.62 441.303 388.113 436.573C381.325 439.91 373.759 444.088 367.829 448.749C365.489 450.587 363.433 453.953 360.781 455.431C345.095 464.172 325.355 469.279 308.069 472.712C290.958 475.778 273.542 476.788 256.192 475.721C246.043 474.999 240.996 473.493 231.662 469.783C231.235 469.614 228.649 471.959 227.379 472.005C221.343 472.222 215.102 471.029 209.34 469.272C189.617 460.851 169.75 451.155 151.576 439.758C145.975 436.245 141.355 430.952 135.664 427.607C128.738 423.534 121.426 420.568 114.632 416.378C143.207 419.184 152.007 416.864 179.086 414.508C183.761 416.853 189.699 420.887 194.39 423.634C201.457 427.713 208.942 431.019 216.717 433.495C232.335 438.277 248.675 440.261 264.983 439.354C274.379 438.789 284.27 436.844 293.621 437.9C317.295 440.572 336.745 429.336 356.982 418.77L358.068 424.703C366.199 417.28 368.579 412.358 374.432 403.525C375.939 401.252 384.365 395.226 387.13 392.996C394.185 387.306 401.572 381.653 408.026 375.179C430.864 352.405 429.51 335.602 460.724 320.978C436.159 308.756 443.501 302.401 451.289 281.878C452.786 277.933 453.065 270.918 453.205 266.656C457.509 268.107 462.307 269.341 466.71 270.567C465.814 269.589 464.936 268.594 464.078 267.582C452.484 253.795 443.244 230.104 440.903 212.131C440.416 208.393 440.975 202.195 441.291 198.376C439.76 195.834 433.443 189.401 432.968 188.184C423.67 164.373 411.411 151.492 391.831 135.067C398.76 131.041 402.025 130.362 409.992 129.188Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M265.12 0.233836C271.95 -0.550164 278.983 0.807827 285.758 1.79283C274.972 6.95983 265.54 9.77284 256.829 18.6518C243.223 32.4778 235.066 52.4348 234.256 71.7428C233.731 84.2438 236.21 95.4258 232.555 107.755C228.926 119.993 221.494 128.06 212.694 136.796C217.996 124.088 219.54 119.167 218.647 105.616C214.889 115.368 210.444 122.814 200.011 126.433C200.138 123.403 201.149 115.356 199.08 113.39C198.057 113.655 197.27 114.297 196.688 115.17C191.044 123.635 185.863 131.929 179.085 139.629C168.837 151.126 155.304 158.896 143.867 169.138C132.752 179.091 125.971 190.385 117.812 202.569C114.688 207.234 109.819 211.293 107.234 216.478C104.054 222.859 103.613 230.133 100.589 236.545C98.781 240.277 93.289 244.21 91.529 248.4C87.249 258.59 92.588 261.489 95.917 269.894C98.726 276.986 95.162 283.023 92.064 289.207C108.523 302.204 94.499 320.543 108.335 335.334C113.996 341.385 118.658 351.947 123.024 359.408C134.666 379.306 149.471 392.376 167.388 406.178C158.686 409.773 140.853 415.301 131.751 413.476C125.67 412.257 123.388 409.007 120.256 404.357C94.472 400.535 107.784 422.835 113.148 436.794C116.986 446.781 123.002 457.846 127.663 467.627C112.905 455.728 102.369 442.378 88.524 429.717C82.034 423.783 75.863 417.666 69.734 411.363C59.631 401.183 49.397 387.401 41.1 375.795C46.508 378.808 51.31 382.412 57.211 385.498C72.21 393.343 86.066 396.27 102.342 399.064C88.937 383.747 81.159 368.374 73.25 349.856L79.17 353.238C75.266 345.434 69.992 336.712 66.85 328.753C67.225 326.153 68.054 322.598 68.6 319.944C67.081 317.799 61.437 310.199 60.597 308.256C57.714 301.589 57.302 293.991 54.414 286.725C49.945 275.48 42.502 271.542 32.03 266.979C51.679 264.03 66.635 247.297 61.625 226.935C65.362 225.178 69.103 223.071 72.744 221.095C71.877 217.611 69.059 209.094 67.744 205.857C59.62 185.845 79.037 178.747 86.027 164.814C89.995 156.907 90.572 143.283 96.059 133.218C107.763 111.748 124.978 94.1708 146.642 82.5658C153.103 79.1048 159.994 76.8178 166.788 74.5428C160.427 79.4308 154.444 84.7938 148.89 90.5838C138.695 101.327 130.616 114.076 130.825 129.561C130.88 133.652 132.326 136.776 135.368 139.452C137.473 141.303 140.913 142.651 143.742 142.052C161.275 138.335 177.142 109.966 183.128 94.9598C184.823 90.7118 186.476 79.3968 187.108 74.9898C189.274 59.8748 194.959 46.7948 204.304 34.7808C219.073 15.5188 241.011 3.05584 265.12 0.233836Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M334.936 63.3759C356.574 68.7329 379.514 77.6769 398.404 89.6779C403.324 92.9379 407.766 97.3269 412.795 100.384C420.42 105.019 428.32 109.134 435.292 114.779C438.823 117.638 440.003 119.451 441.933 123.422C429.107 121.539 422.081 121.087 409.332 121.153C401.495 121.675 394.253 123.046 386.515 123.814C375.85 124.873 362.709 117.679 353.368 112.932C349.916 111.178 346.275 105.6 341.276 103.579C335.435 101.217 330.16 102.173 324.854 100.863C318.02 99.1749 310.749 96.9778 303.865 95.1358C308.34 90.4778 313.386 86.0619 317.883 81.4429C323.633 75.5379 329.308 69.4059 334.936 63.3759Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M319.086 10.4429C320.067 11.3969 319.55 13.4899 319.333 14.7619C313.095 51.3959 289.666 83.0359 259.466 104.285C261.866 97.4399 266.944 87.3949 270.127 80.8129C278.647 64.7889 288.343 49.4179 299.136 34.8279C287.6 38.1369 283.549 39.9349 273.249 45.5469C273.114 44.2189 272.864 40.9859 272.952 39.8279C273.414 33.7359 288.899 29.2769 294.136 27.1309C297.188 25.8869 300.142 24.4149 302.973 22.7289C308.744 19.2989 313.917 14.7429 319.086 10.4429Z" fill="#C62030"/>
|
||||||
|
<path d="M345.325 127.731C358.33 130.726 382.679 145.122 392.546 154.765C397.859 159.957 403.134 168.71 402.736 176.294C402.607 178.752 402.224 182.806 400.342 184.636C399.074 180.931 398.444 178.883 396.548 175.496C387.672 160.155 379.311 153.013 363.514 146.495C365.729 151.229 367.968 154.654 370.943 158.906C360.26 151.42 351.061 139.345 345.325 127.731Z" fill="#C62030"/>
|
||||||
|
<path d="M167.534 384.543C171.598 385.886 182.102 391.509 187.164 393.578C207.871 402.041 226.401 406.735 248.53 409.936C244.364 411.154 239.58 412.128 235.309 413.095C232.603 413.511 229.79 414.362 227.13 415.079L232.982 420.249C228.788 419.368 224.624 418.351 220.496 417.199C203.318 412.324 176.676 400.866 167.534 384.543Z" fill="#C62030"/>
|
||||||
|
<path d="M409.717 183.898C411.582 185.267 416.013 192.853 417.156 195.036C427.277 214.352 430.491 234.795 432.809 256.162C430.527 253.472 427.908 249.815 425.735 246.951C415.903 232.804 412.937 227.958 409.036 211.575L417.211 220.88C415.467 211.047 410.351 192.628 409.717 183.898Z" fill="#C62030"/>
|
||||||
|
<path d="M360.994 392.524L361.423 393.126C337.904 418.773 315.735 424.874 281.864 422.345C285.007 420.089 305.945 414.168 311.156 412.07C318.126 409.597 324.805 406.338 331.78 403.895C333.121 403.425 334.084 404.213 335.269 404.853C340.199 404.855 355.7 395.351 360.994 392.524Z" fill="#C62030"/>
|
||||||
|
<path d="M126.101 307.798C128.641 309.644 131.488 320.784 132.897 324.443C138.952 340.165 147.178 357.148 155.514 371.719C150.422 368.128 146.907 364.87 142.575 360.411C131.445 348.598 122.809 335.054 117.855 319.494L129.218 334.11C127.466 324.99 125.854 317.149 126.101 307.798Z" fill="#C62030"/>
|
||||||
|
<path d="M137.081 202.535L137.335 202.827C137.267 206.488 125.219 225.359 123.617 234.04C125.169 235.388 125.564 233.475 127.341 234.764C126.888 240.699 124.717 246.476 123.708 252.249C122.819 257.34 122.245 262.897 121.565 268.059L120.995 268.208C114.292 254.16 111.932 246.014 117.381 231.004C121.836 218.734 127.743 211.415 137.081 202.535Z" fill="#C62030"/>
|
||||||
|
<path d="M433.626 276.713C436.295 283.545 429.011 311.688 426.338 319.3L423.263 314.499C418.739 307.62 417.734 299.885 416.829 291.86C421.148 285.628 427.379 280.866 433.626 276.713Z" fill="#C62030"/>
|
||||||
|
<path d="M415.252 318.362C415.842 319.528 416.172 320.983 416.362 322.268C418.555 337.098 415.762 345.071 407.054 356.974C399.111 367.831 388.597 376.413 375.127 378.576C378.135 374.81 384.689 370.215 388.465 366.233C391.093 363.46 398.83 352.512 400.929 351.734C402.429 352.657 401.8 352.56 403.377 352.601C410.444 346.511 413.078 327.399 415.252 318.362Z" fill="#C62030"/>
|
||||||
|
<path d="M451.979 95.8309C453.936 95.2029 456.08 95.6879 457.575 97.0969C459.071 98.5069 459.683 100.618 459.172 102.609C458.662 104.6 457.109 106.156 455.12 106.672C452.162 107.438 449.131 105.712 448.281 102.777C447.431 99.8429 449.069 96.7639 451.979 95.8309Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M80.154 112.87C82.928 111.59 86.214 112.814 87.475 115.596C88.737 118.379 87.492 121.657 84.701 122.9C81.936 124.132 78.695 122.901 77.445 120.144C76.195 117.387 77.405 114.138 80.154 112.87Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M499.254 323.257C501.215 322.358 503.532 323.226 504.419 325.192C505.305 327.158 504.423 329.469 502.451 330.344C500.497 331.211 498.21 330.338 497.331 328.389C496.452 326.44 497.311 324.148 499.254 323.257Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M416.619 257.375C417.828 256.815 419.246 256.962 420.315 257.757C421.384 258.553 421.932 259.869 421.744 261.188C421.556 262.506 420.661 263.617 419.413 264.081C417.582 264.763 415.54 263.876 414.789 262.072C414.038 260.269 414.846 258.195 416.619 257.375Z" fill="#C62030"/>
|
||||||
|
<path d="M37.985 322.801C39.73 321.843 41.921 322.477 42.885 324.219C43.848 325.961 43.22 328.154 41.481 329.123C39.734 330.096 37.53 329.465 36.562 327.715C35.595 325.965 36.233 323.763 37.985 322.801Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M113.417 289.288C115.078 288.358 117.178 288.926 118.142 290.567C119.107 292.208 118.583 294.319 116.962 295.318C115.883 295.983 114.53 296.012 113.423 295.395C112.316 294.778 111.63 293.611 111.629 292.344C111.627 291.076 112.311 289.908 113.417 289.288Z" fill="#C62030"/>
|
||||||
|
<path d="M35.89 417.228C36.968 416.654 38.272 416.705 39.303 417.362C40.333 418.018 40.93 419.179 40.864 420.399C40.799 421.619 40.082 422.709 38.988 423.253C37.329 424.076 35.316 423.414 34.469 421.767C33.622 420.12 34.255 418.098 35.89 417.228Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M498.395 417.31C500.048 416.626 501.943 417.404 502.638 419.052C503.333 420.701 502.568 422.601 500.924 423.307C499.265 424.02 497.342 423.246 496.641 421.582C495.939 419.918 496.726 418 498.395 417.31Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M379.857 52.7558C381.33 52.1078 383.054 52.7359 383.764 54.1819C384.473 55.6269 383.918 57.3749 382.503 58.1449C381.534 58.6719 380.354 58.6259 379.429 58.0239C378.504 57.4229 377.983 56.3629 378.073 55.2629C378.162 54.1629 378.847 53.2008 379.857 52.7558Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M163.85 478.38C164.904 478 166.083 478.244 166.9 479.011C167.717 479.778 168.035 480.939 167.722 482.015C167.41 483.092 166.52 483.902 165.419 484.112C163.891 484.404 162.396 483.471 161.985 481.971C161.574 480.471 162.386 478.907 163.85 478.38Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M375.001 478.816C376.512 478.301 378.155 479.103 378.679 480.612C379.203 482.12 378.411 483.768 376.907 484.301C375.389 484.839 373.723 484.039 373.194 482.517C372.666 480.996 373.476 479.335 375.001 478.816Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M142.124 53.2519C143.532 52.7199 145.107 53.4079 145.674 54.8029C146.241 56.1969 145.593 57.7889 144.213 58.3909C143.289 58.7929 142.22 58.6629 141.419 58.0509C140.619 57.4389 140.213 56.4409 140.359 55.4439C140.506 54.4469 141.181 53.6079 142.124 53.2519Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M474.436 130.344C475.717 129.545 477.403 129.923 478.22 131.193C479.036 132.463 478.681 134.153 477.423 134.987C476.593 135.537 475.532 135.598 474.645 135.147C473.757 134.695 473.182 133.8 473.139 132.806C473.096 131.811 473.592 130.871 474.436 130.344Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M40.965 194.671C41.803 194.296 42.777 194.403 43.513 194.951C44.25 195.499 44.632 196.402 44.514 197.312C44.395 198.221 43.794 198.996 42.943 199.337C41.662 199.85 40.206 199.244 39.667 197.974C39.129 196.703 39.706 195.235 40.965 194.671Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M65.597 146.733C66.886 146.252 68.323 146.894 68.823 148.175C69.324 149.457 68.702 150.903 67.428 151.422C66.587 151.765 65.627 151.628 64.915 151.064C64.204 150.5 63.851 149.597 63.992 148.7C64.133 147.803 64.746 147.051 65.597 146.733Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M305.74 120.247C306.457 119.799 307.363 119.783 308.096 120.204C308.829 120.626 309.27 121.417 309.244 122.262C309.217 123.107 308.728 123.869 307.97 124.244C306.875 124.785 305.548 124.373 304.953 123.306C304.358 122.24 304.704 120.894 305.74 120.247Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M329.206 124.846C330.445 124.661 331.6 125.508 331.797 126.745C331.993 127.981 331.157 129.145 329.923 129.353C328.671 129.564 327.488 128.714 327.289 127.461C327.09 126.208 327.951 125.033 329.206 124.846Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M110.366 75.3648C111.433 74.8778 112.695 75.2898 113.269 76.3118C113.842 77.3348 113.537 78.6258 112.565 79.2828C111.861 79.7588 110.949 79.7978 110.206 79.3848C109.464 78.9708 109.017 78.1748 109.051 77.3258C109.085 76.4758 109.593 75.7178 110.366 75.3648Z" fill="#DBDAD3"/>
|
||||||
|
<path d="M483.44 435.805C484.393 435.292 485.582 435.628 486.125 436.564C486.669 437.501 486.37 438.7 485.452 439.273C484.831 439.66 484.048 439.678 483.41 439.32C482.772 438.962 482.379 438.285 482.385 437.554C482.391 436.822 482.796 436.152 483.44 435.805Z" fill="#DBDAD3"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 19 KiB |
BIN
web/app/static/img/firebreak-hero-poster.jpg
Normal file
|
After Width: | Height: | Size: 298 KiB |
3
web/app/static/img/firebreak-logo-black.svg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
14
web/app/static/img/firebreak-logo-cream-red.svg
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<svg width="481" height="477" viewBox="0 0 481 477" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M377.962 129.188C385.411 128.358 400.217 129.01 406.209 133.886C413.904 140.147 412.291 141.893 422.547 143.756C421.628 160.141 424.421 155.076 430.312 167.016C434.602 178.302 439.545 190.292 442.356 201.998C445.601 215.507 432.515 224.911 451.216 229.969C446.32 253.35 459.456 263.677 480.027 267.911C462.104 273.673 455.434 280.725 450.843 298.856C449.37 304.277 447.525 309.812 446.463 315.322C444.889 323.49 444.488 331.703 438.473 338.129C436.534 340.201 434.568 341.721 432.327 343.476C432.958 346.046 433.71 348.707 434.399 351.274C425.856 364.031 421.845 377.694 413.283 390.288C410.748 394.017 408.476 397.854 406.498 401.912C431.658 396.635 449.39 388.554 471.358 375.723C465.386 384.405 456.796 396.09 449.198 403.364C441.405 410.63 433.158 417.326 425.363 424.611C415.921 433.437 406.683 442.49 397.23 451.3C392.57 455.643 387.408 459.468 382.628 463.716C385.333 458.74 388.714 452.274 390.674 447.102C394.763 436.314 397.435 414.849 395.401 403.561C392.762 388.915 391.116 388.029 392.21 372.764C385.229 387.788 387.843 391.997 388.853 407.542C389.123 411.695 385.842 421.395 382.706 424.163C375.034 426.11 372.311 431.758 366.076 436.337C359.032 441.509 351.269 445.415 343.711 449.763C348.19 444.046 350.59 441.303 356.083 436.573C349.295 439.91 341.729 444.088 335.799 448.749C333.459 450.587 331.403 453.953 328.751 455.431C313.065 464.172 293.325 469.279 276.039 472.712C258.928 475.778 241.512 476.788 224.162 475.721C214.013 474.999 208.966 473.493 199.632 469.783C199.205 469.614 196.619 471.959 195.349 472.005C189.313 472.222 183.072 471.029 177.31 469.272C157.587 460.851 137.72 451.155 119.546 439.758C113.945 436.245 109.325 430.952 103.634 427.607C96.708 423.534 89.396 420.568 82.602 416.378C111.177 419.184 119.977 416.864 147.056 414.508C151.731 416.853 157.669 420.887 162.36 423.634C169.427 427.713 176.912 431.019 184.687 433.495C200.305 438.277 216.645 440.261 232.953 439.354C242.349 438.789 252.24 436.844 261.591 437.9C285.265 440.572 304.715 429.336 324.952 418.77L326.038 424.703C334.169 417.28 336.549 412.358 342.402 403.525C343.909 401.252 352.335 395.226 355.1 392.996C362.155 387.306 369.542 381.653 375.996 375.179C398.834 352.405 397.48 335.602 428.694 320.978C404.129 308.756 411.471 302.401 419.259 281.878C420.756 277.933 421.035 270.918 421.175 266.656C425.479 268.107 430.277 269.341 434.68 270.567C433.784 269.589 432.906 268.594 432.048 267.582C420.454 253.795 411.214 230.104 408.873 212.131C408.386 208.393 408.945 202.195 409.261 198.376C407.73 195.834 401.413 189.401 400.938 188.184C391.64 164.373 379.381 151.492 359.801 135.067C366.73 131.041 369.995 130.362 377.962 129.188Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M233.09 0.233836C239.92 -0.550164 246.953 0.807827 253.728 1.79283C242.942 6.95983 233.51 9.77284 224.799 18.6518C211.193 32.4778 203.036 52.4348 202.226 71.7428C201.701 84.2438 204.18 95.4258 200.525 107.755C196.896 119.993 189.464 128.06 180.664 136.796C185.966 124.088 187.51 119.167 186.617 105.616C182.859 115.368 178.414 122.814 167.981 126.433C168.108 123.403 169.119 115.356 167.05 113.39C166.027 113.655 165.24 114.297 164.658 115.17C159.014 123.635 153.833 131.929 147.055 139.629C136.807 151.126 123.274 158.896 111.837 169.138C100.722 179.091 93.941 190.385 85.782 202.569C82.658 207.234 77.789 211.293 75.204 216.478C72.024 222.859 71.583 230.133 68.559 236.545C66.751 240.277 61.259 244.21 59.499 248.4C55.219 258.59 60.558 261.489 63.887 269.894C66.696 276.986 63.132 283.023 60.034 289.207C76.493 302.204 62.469 320.543 76.305 335.334C81.966 341.385 86.628 351.947 90.994 359.408C102.636 379.306 117.441 392.376 135.358 406.178C126.656 409.773 108.823 415.301 99.721 413.476C93.64 412.257 91.358 409.007 88.226 404.357C62.442 400.535 75.754 422.835 81.118 436.794C84.956 446.781 90.972 457.846 95.633 467.627C80.875 455.728 70.339 442.378 56.494 429.717C50.004 423.783 43.833 417.666 37.704 411.363C27.601 401.183 17.367 387.401 9.07001 375.795C14.478 378.808 19.28 382.412 25.181 385.498C40.18 393.343 54.036 396.27 70.312 399.064C56.907 383.747 49.129 368.374 41.22 349.856L47.14 353.238C43.236 345.434 37.962 336.712 34.82 328.753C35.195 326.153 36.024 322.598 36.57 319.944C35.051 317.799 29.407 310.199 28.567 308.256C25.684 301.589 25.272 293.991 22.384 286.725C17.915 275.48 10.472 271.542 0 266.979C19.649 264.03 34.605 247.297 29.595 226.935C33.332 225.178 37.073 223.071 40.714 221.095C39.847 217.611 37.029 209.094 35.714 205.857C27.59 185.845 47.007 178.747 53.997 164.814C57.965 156.907 58.542 143.283 64.029 133.218C75.733 111.748 92.948 94.1708 114.612 82.5658C121.073 79.1048 127.964 76.8178 134.758 74.5428C128.397 79.4308 122.414 84.7938 116.86 90.5838C106.665 101.327 98.586 114.076 98.795 129.561C98.85 133.652 100.296 136.776 103.338 139.452C105.443 141.303 108.883 142.651 111.712 142.052C129.245 138.335 145.112 109.966 151.098 94.9598C152.793 90.7118 154.446 79.3968 155.078 74.9898C157.244 59.8748 162.929 46.7948 172.274 34.7808C187.043 15.5188 208.981 3.05584 233.09 0.233836Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M302.906 63.3759C324.544 68.7329 347.484 77.6769 366.374 89.6779C371.294 92.9379 375.736 97.3269 380.765 100.384C388.39 105.019 396.29 109.134 403.262 114.779C406.793 117.638 407.973 119.451 409.903 123.422C397.077 121.539 390.051 121.087 377.302 121.153C369.465 121.675 362.223 123.046 354.485 123.814C343.82 124.873 330.679 117.679 321.338 112.932C317.886 111.178 314.245 105.6 309.246 103.579C303.405 101.217 298.13 102.173 292.824 100.863C285.99 99.1749 278.719 96.9778 271.835 95.1358C276.31 90.4778 281.356 86.0619 285.853 81.4429C291.603 75.5379 297.278 69.4059 302.906 63.3759Z" fill="#F7F2E8"/>
|
||||||
|
<path d="M287.056 10.4429C288.037 11.3969 287.52 13.4899 287.303 14.7619C281.065 51.3959 257.636 83.0359 227.436 104.285C229.836 97.4399 234.914 87.3949 238.097 80.8129C246.617 64.7889 256.313 49.4179 267.106 34.8279C255.57 38.1369 251.519 39.9349 241.219 45.5469C241.084 44.2189 240.834 40.9859 240.922 39.8279C241.384 33.7359 256.869 29.2769 262.106 27.1309C265.158 25.8869 268.112 24.4149 270.943 22.7289C276.714 19.2989 281.887 14.7429 287.056 10.4429Z" fill="#C62030"/>
|
||||||
|
<path d="M313.295 127.731C326.3 130.726 350.649 145.122 360.516 154.765C365.829 159.957 371.104 168.71 370.706 176.294C370.577 178.752 370.194 182.806 368.312 184.636C367.044 180.931 366.414 178.883 364.518 175.496C355.642 160.155 347.281 153.013 331.484 146.495C333.699 151.229 335.938 154.654 338.913 158.906C328.23 151.42 319.031 139.345 313.295 127.731Z" fill="#F04A36"/>
|
||||||
|
<path d="M135.504 384.543C139.568 385.886 150.072 391.509 155.134 393.578C175.841 402.041 194.371 406.735 216.5 409.936C212.334 411.154 207.55 412.128 203.279 413.095C200.573 413.511 197.76 414.362 195.1 415.079L200.952 420.249C196.758 419.368 192.594 418.351 188.466 417.199C171.288 412.324 144.646 400.866 135.504 384.543Z" fill="#C62030"/>
|
||||||
|
<path d="M377.687 183.898C379.552 185.267 383.983 192.853 385.126 195.036C395.247 214.352 398.461 234.795 400.779 256.162C398.497 253.472 395.878 249.815 393.705 246.951C383.873 232.804 380.907 227.958 377.006 211.575L385.181 220.88C383.437 211.047 378.321 192.628 377.687 183.898Z" fill="#F04A36"/>
|
||||||
|
<path d="M328.964 392.524L329.393 393.126C305.874 418.773 283.705 424.874 249.834 422.345C252.977 420.089 273.915 414.168 279.126 412.07C286.096 409.597 292.775 406.338 299.75 403.895C301.091 403.425 302.054 404.213 303.239 404.853C308.169 404.855 323.67 395.351 328.964 392.524Z" fill="#C62030"/>
|
||||||
|
<path d="M90.246 298C92.786 299.846 95.633 310.986 97.042 314.645C103.097 330.367 111.323 347.35 119.659 361.921C114.567 358.33 111.052 355.072 106.72 350.613C95.59 338.8 86.954 325.256 82 309.696L93.363 324.312C91.611 315.192 89.999 307.351 90.246 298Z" fill="#C62030"/>
|
||||||
|
<path d="M105.051 202.535L105.305 202.827C105.237 206.488 93.189 225.359 91.587 234.04C93.139 235.388 93.534 233.475 95.311 234.764C94.858 240.699 92.687 246.476 91.678 252.249C90.789 257.34 90.215 262.897 89.535 268.059L88.965 268.208C82.262 254.16 79.902 246.014 85.351 231.004C89.806 218.734 95.713 211.415 105.051 202.535Z" fill="#C62030"/>
|
||||||
|
<path d="M401.596 276.713C404.265 283.545 396.981 311.688 394.308 319.3L391.233 314.499C386.709 307.62 385.704 299.885 384.799 291.86C389.118 285.628 395.349 280.866 401.596 276.713Z" fill="#E23A32"/>
|
||||||
|
<path d="M383.222 318.362C383.812 319.528 384.142 320.983 384.332 322.268C386.525 337.098 383.732 345.071 375.024 356.974C367.081 367.831 356.567 376.413 343.097 378.576C346.105 374.81 352.659 370.215 356.435 366.233C359.063 363.46 366.8 352.512 368.899 351.734C370.399 352.657 369.77 352.56 371.347 352.601C378.414 346.511 381.048 327.399 383.222 318.362Z" fill="#E23A32"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 8.5 KiB |
3
web/app/static/img/firebreak-logo-red.svg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
1
web/app/static/img/forgejo-logo.svg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 212 212" width="32" height="32"><style>circle,path{fill:none;stroke:#000;stroke-width:15}path{stroke-width:25}.orange{stroke:#f60}.red{stroke:#d40000}</style><g transform="translate(6 6)"><path d="M58 168V70a50 50 0 0 1 50-50h20" class="orange"/><path d="M58 168v-30a50 50 0 0 1 50-50h20" class="red"/><circle cx="142" cy="20" r="18" class="orange"/><circle cx="142" cy="88" r="18" class="red"/><circle cx="58" cy="180" r="18" class="red"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 503 B |
BIN
web/app/static/img/mark_cuckerberg.png
Normal file
|
After Width: | Height: | Size: 117 KiB |
BIN
web/app/static/video/firebreak-hero.mp4
Normal file
80
web/app/templates/base.html
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" class="dark">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>
|
||||||
|
{% block title %}Firebreak{% endblock %}
|
||||||
|
</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
|
||||||
|
rel="stylesheet" />
|
||||||
|
<link rel="stylesheet" href="/static/css/output.css" />
|
||||||
|
<script src="https://unpkg.com/htmx.org@2"></script>
|
||||||
|
</head>
|
||||||
|
<body class="min-h-screen bg-background text-sm text-foreground antialiased {% block body_class %}{% endblock %}">
|
||||||
|
<header class="app-header">
|
||||||
|
<div class="flex items-center justify-between px-4 py-3 mx-auto max-w-7xl sm:px-8">
|
||||||
|
<a href="/"
|
||||||
|
class="brand-link flex items-center gap-2 text-base text-foreground hover:text-primary"
|
||||||
|
aria-label="Firebreak home">
|
||||||
|
<svg width="28"
|
||||||
|
height="30"
|
||||||
|
viewBox="0 0 28 30"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M21.5596 8.01157C21.9844 7.96011 22.829 8.0003 23.1709 8.30259C23.6097 8.69079 23.5179 8.79938 24.1025 8.91489C24.0501 9.93095 24.2099 9.61686 24.5459 10.3573C24.7906 11.0572 25.0721 11.8012 25.2324 12.5272C25.4173 13.3648 24.6717 13.9479 25.7383 14.2616C25.4591 15.7115 26.2085 16.3515 27.3818 16.6141C26.3596 16.9714 25.9787 17.4089 25.7168 18.5331C25.6328 18.8692 25.5274 19.2128 25.4668 19.5545C25.377 20.0609 25.3545 20.5702 25.0117 20.9686C24.9012 21.097 24.7889 21.1919 24.6611 21.3006C24.6971 21.46 24.74 21.6249 24.7793 21.784C24.292 22.5752 24.0626 23.4229 23.5742 24.204C23.4297 24.4351 23.3003 24.6731 23.1875 24.9247C24.6225 24.5974 25.6338 24.0962 26.8867 23.3006C26.5461 23.839 26.0563 24.5635 25.623 25.0145C25.1786 25.465 24.7082 25.8802 24.2637 26.3319C23.7252 26.8791 23.1983 27.4409 22.6592 27.9872C22.3934 28.2565 22.0988 28.4942 21.8262 28.7577C21.9804 28.4492 22.1733 28.0481 22.2852 27.7274C22.5183 27.0585 22.6706 25.7273 22.5547 25.0272C22.4042 24.119 22.3097 24.0636 22.3721 23.117C21.9741 24.0484 22.123 24.3097 22.1807 25.2733C22.1961 25.5308 22.009 26.1329 21.8301 26.3045C21.3927 26.4253 21.2374 26.7755 20.8818 27.0594C20.4801 27.3801 20.0375 27.6228 19.6064 27.8924C19.8619 27.5379 19.9983 27.3673 20.3115 27.0741C19.9244 27.281 19.4925 27.5399 19.1543 27.829C19.0209 27.943 18.9042 28.1524 18.7529 28.244C17.8582 28.786 16.7321 29.1024 15.7461 29.3153C14.7702 29.5054 13.7767 29.5679 12.7871 29.5018C12.2082 29.457 11.9201 29.3637 11.3877 29.1336C11.3634 29.1232 11.2161 29.2681 11.1436 29.2713C10.7993 29.2848 10.4429 29.2104 10.1143 29.1014C8.98932 28.5792 7.85592 27.9781 6.81934 27.2713C6.50006 27.0536 6.23649 26.7258 5.91211 26.5184C5.51707 26.2658 5.09943 26.0819 4.71191 25.8221C6.34186 25.9961 6.84406 25.852 8.38867 25.7059C8.65531 25.8513 8.99419 26.101 9.26172 26.2713C9.66483 26.5243 10.0917 26.7301 10.5352 26.8836C11.4259 27.1801 12.358 27.3031 13.2881 27.2469C13.824 27.2119 14.3885 27.0906 14.9219 27.1561C16.2722 27.3218 17.3818 26.6248 18.5361 25.9696L18.5977 26.3377C19.0615 25.8774 19.1974 25.5721 19.5312 25.0243C19.6175 24.8832 20.0982 24.5102 20.2559 24.3719C20.6583 24.0191 21.0791 23.6679 21.4473 23.2665C22.7499 21.8542 22.6729 20.812 24.4531 19.9051C23.0524 19.1473 23.4708 18.7529 23.915 17.4803C24.0003 17.2358 24.0164 16.8013 24.0244 16.537C24.2699 16.6269 24.5438 16.7031 24.7949 16.7792C24.7438 16.7185 24.6935 16.6564 24.6445 16.5936C23.9833 15.7385 23.4568 14.2696 23.3232 13.1551C23.2955 12.9235 23.3267 12.5395 23.3447 12.3026C23.2574 12.1449 22.8972 11.7452 22.8701 11.6698C22.3398 10.1933 21.6402 9.39436 20.5234 8.37583C20.9186 8.12619 21.1053 8.08436 21.5596 8.01157Z" fill="#C62030" />
|
||||||
|
<path d="M13.2959 0.0145017C13.6855 -0.0341185 14.0872 0.0500961 14.4736 0.111181C13.8585 0.431567 13.3201 0.605665 12.8232 1.1561C12.0471 2.01353 11.5814 3.25168 11.5352 4.44907C11.5052 5.22427 11.6469 5.91793 11.4385 6.68247C11.2315 7.44129 10.8076 7.94154 10.3057 8.48325C10.6081 7.69518 10.6964 7.38997 10.6455 6.54966C10.4311 7.15443 10.1771 7.61624 9.58203 7.84067C9.58927 7.65292 9.64694 7.15451 9.5293 7.03208C9.47094 7.04851 9.42578 7.08829 9.39258 7.14243C9.07071 7.6673 8.77523 8.1816 8.38867 8.65903C7.80412 9.37201 7.03225 9.85396 6.37988 10.4891C5.74587 11.1064 5.35895 11.8068 4.89355 12.5624C4.71537 12.8516 4.43748 13.1032 4.29004 13.4247C4.10871 13.8203 4.08348 14.2712 3.91113 14.6688C3.80804 14.9001 3.49506 15.1444 3.39453 15.4042C3.15043 16.036 3.45464 16.2161 3.64453 16.7372C3.80476 17.177 3.60152 17.5519 3.4248 17.9354C4.36334 18.7414 3.56357 19.8786 4.35254 20.7958C4.67545 21.171 4.94139 21.8262 5.19043 22.2889C5.8545 23.5229 6.6997 24.3334 7.72168 25.1893C7.22531 25.4123 6.20766 25.7546 5.68848 25.6415C5.34174 25.5658 5.21182 25.3643 5.0332 25.076C3.56246 24.839 4.32196 26.2221 4.62793 27.0877C4.84684 27.707 5.18924 28.3934 5.45508 28.9999C4.6134 28.262 4.01229 27.4344 3.22266 26.6493C2.8525 26.2813 2.50094 25.9014 2.15137 25.5106C1.57508 24.8793 0.990847 24.0243 0.517578 23.3045C0.826056 23.4914 1.09992 23.7157 1.43652 23.9071C2.29197 24.3935 3.08249 24.5746 4.01074 24.7479C3.24619 23.7981 2.80267 22.8445 2.35156 21.6961L2.68945 21.9061C2.46677 21.4221 2.16555 20.8811 1.98633 20.3875C2.0077 20.2265 2.05479 20.0062 2.08594 19.8417C1.99929 19.7086 1.6778 19.2366 1.62988 19.1161C1.46554 18.7027 1.44204 18.2316 1.27734 17.7811C1.02243 17.0837 0.597331 16.8395 0 16.5565C1.1208 16.3736 1.97425 15.3359 1.68848 14.0731C1.90163 13.9641 2.11556 13.8333 2.32324 13.7108C2.27375 13.4947 2.11213 12.9673 2.03711 12.7665C1.57371 11.5254 2.68136 11.0846 3.08008 10.2206C3.30636 9.73027 3.33952 8.8857 3.65234 8.26157C4.31995 6.9301 5.30235 5.83966 6.53809 5.11997C6.90658 4.90538 7.30002 4.76397 7.6875 4.6229C7.32469 4.92601 6.9828 5.25801 6.66602 5.61704C6.08448 6.28327 5.62382 7.0747 5.63574 8.03501C5.63897 8.28848 5.72113 8.48244 5.89453 8.64829C6.0146 8.76308 6.21168 8.84657 6.37305 8.80942C7.37298 8.57853 8.27774 6.819 8.61914 5.88853C8.7158 5.62493 8.81064 4.92348 8.84668 4.65024C8.97023 3.71302 9.29421 2.90205 9.82715 2.15708C10.6695 0.962598 11.9208 0.189561 13.2959 0.0145017Z" fill="#C62030" />
|
||||||
|
<path d="M18.7891 24.3797C17.4476 25.9701 16.1829 26.3481 14.251 26.1913C14.4305 26.0513 15.6244 25.6847 15.9219 25.5545C16.3195 25.4012 16.7008 25.1992 17.0986 25.0477C17.1751 25.0186 17.2303 25.0676 17.2979 25.1073C17.5794 25.1068 18.4626 24.518 18.7646 24.3426L18.7891 24.3797Z" fill="#C62030" />
|
||||||
|
<path d="M7.72949 23.8475C7.96131 23.9308 8.56087 24.2797 8.84961 24.4081C10.0306 24.9328 11.0876 25.2232 12.3496 25.4217C12.112 25.4973 11.8393 25.5581 11.5957 25.618C11.4414 25.6438 11.2806 25.6966 11.1289 25.7411L11.4629 26.0614C11.2238 26.0068 10.9863 25.9443 10.751 25.8729C9.77113 25.5706 8.25097 24.8598 7.72949 23.8475Z" fill="#C62030" />
|
||||||
|
<path d="M21.8594 19.743C21.893 19.8153 21.912 19.9056 21.9229 19.9852C22.0479 20.9048 21.8891 21.3995 21.3926 22.1375C20.9396 22.8108 20.3395 23.3432 19.5713 23.4774C19.7429 23.2439 20.1167 22.9587 20.332 22.7118C20.4821 22.5395 20.9233 21.8606 21.043 21.8124C21.1285 21.8696 21.0927 21.8635 21.1826 21.8661C21.5855 21.488 21.7354 20.3033 21.8594 19.743Z" fill="#C62030" />
|
||||||
|
<path d="M5.36621 19.0877C5.51104 19.2022 5.6735 19.8928 5.75391 20.12C6.09929 21.095 6.56845 22.149 7.04395 23.0526C6.75349 22.8299 6.55277 22.627 6.30566 22.3504C5.67096 21.6179 5.17804 20.7781 4.89551 19.8133L5.54395 20.7196C5.44402 20.1541 5.35212 19.6676 5.36621 19.0877Z" fill="#C62030" />
|
||||||
|
<path d="M22.9082 17.16C23.0604 17.5837 22.6447 19.3295 22.4922 19.8016L22.3164 19.5038C22.0584 19.0772 22.0018 18.5971 21.9502 18.0995C22.1965 17.7131 22.552 17.4175 22.9082 17.16Z" fill="#C62030" />
|
||||||
|
<path d="M6.00684 12.578C6.00296 12.805 5.31622 13.975 5.22461 14.5135C5.31314 14.5971 5.33614 14.4785 5.4375 14.5584C5.41166 14.9265 5.28705 15.2854 5.22949 15.6434C5.17881 15.959 5.1462 16.3039 5.10742 16.6239L5.0752 16.6327C4.69292 15.7616 4.55847 15.2567 4.86914 14.326C5.1232 13.5653 5.45975 13.1109 5.99219 12.5604L6.00684 12.578Z" fill="#C62030" />
|
||||||
|
<path d="M21.5439 11.4042C21.6503 11.489 21.9034 11.9589 21.9688 12.0946C22.546 13.2924 22.7291 14.5606 22.8613 15.8856C22.7312 15.7188 22.5819 15.4919 22.458 15.3143C21.8972 14.4371 21.7274 14.1368 21.5049 13.1209L21.9717 13.6981C21.8722 13.0883 21.5801 11.9455 21.5439 11.4042Z" fill="#C62030" />
|
||||||
|
<path d="M17.8711 7.92075C18.6129 8.10648 20.0016 8.99949 20.5645 9.59751C20.8675 9.91944 21.1681 10.4622 21.1455 10.9325C21.1381 11.0849 21.1161 11.3366 21.0088 11.45C20.9365 11.2205 20.9009 11.0934 20.793 10.8836C20.2867 9.93226 19.8093 9.48903 18.9082 9.08481C19.0345 9.37833 19.1624 9.59074 19.332 9.85435C18.7228 9.39008 18.1982 8.64091 17.8711 7.92075Z" fill="#C62030" />
|
||||||
|
<path d="M17.2783 3.93052C18.5125 4.26272 19.821 4.81717 20.8984 5.56138C21.1791 5.76355 21.4329 6.03586 21.7197 6.22544C22.1546 6.51282 22.6053 6.768 23.0029 7.11802C23.2042 7.29526 23.2718 7.40794 23.3818 7.65415C22.6504 7.5374 22.2494 7.50944 21.5225 7.51353C21.0755 7.54589 20.6621 7.63093 20.2207 7.67856C19.6125 7.74422 18.8629 7.29815 18.3301 7.00376C18.1332 6.89498 17.9248 6.54901 17.6396 6.42368C17.3066 6.27732 17.0057 6.33596 16.7031 6.25474C16.3134 6.15006 15.8984 6.01348 15.5059 5.89927C15.7611 5.61047 16.0492 5.33701 16.3057 5.05063C16.6336 4.68454 16.9574 4.30436 17.2783 3.93052Z" fill="#C62030" />
|
||||||
|
<path d="M16.374 0.647314C16.4299 0.706385 16.4011 0.835973 16.3887 0.914892C16.0329 3.18667 14.6962 5.14888 12.9736 6.46665C13.1106 6.04216 13.4005 5.41964 13.582 5.01157C14.068 4.01794 14.6208 3.06473 15.2363 2.16001C14.5785 2.36517 14.3471 2.47613 13.7598 2.82407C13.7521 2.74152 13.7382 2.5413 13.7432 2.46958C13.7698 2.09189 14.6524 1.81555 14.9512 1.68247C15.1253 1.60532 15.2936 1.51359 15.4551 1.40903C15.7842 1.19636 16.0792 0.913941 16.374 0.647314Z" fill="#C62030" />
|
||||||
|
</svg>
|
||||||
|
<svg width="114"
|
||||||
|
height="20"
|
||||||
|
viewBox="0 0 114 20"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M48.4923 0.00654069C48.7964 0.29344 48.6961 6.65684 48.6961 7.49071C50.2534 6.30339 51.895 5.46624 53.9209 5.76604C58.4095 6.42994 60.7139 11.94 58.6683 15.8045C58.0278 17.0147 57.326 17.6839 56.2404 18.4738C53.6721 20.1022 51.1111 19.4924 48.8025 17.8218C48.8034 18.355 48.7475 18.7103 48.6785 19.2344C47.7436 19.2098 46.7779 19.236 45.8406 19.2489C45.7126 13.2211 45.9041 7.05515 45.8189 1.00077C46.6931 0.744994 47.6371 0.345046 48.4923 0.00654069ZM52.9146 16.6756C57.8541 15.5749 57.3784 7.91769 51.8855 8.52241C50.6155 9.01614 49.5609 9.64953 48.9885 10.9468C48.1112 12.9353 48.8851 15.5905 50.9929 16.3774C51.6077 16.6019 52.2607 16.7032 52.9146 16.6756Z" fill="#17191C" />
|
||||||
|
<path d="M76.8226 5.75962C80.0489 5.31401 83.0576 7.09296 84.0219 10.1995C84.4163 11.4694 84.3748 12.4398 84.3596 13.7414C80.941 13.7215 77.5221 13.7238 74.1037 13.7486C75.4274 17.3548 78.1492 17.4433 81.2002 15.9242C81.4652 15.7563 81.4957 15.712 81.8074 15.6479C82.5075 15.8554 82.7897 16.6307 83.1696 17.2987C80.9074 19.7749 76.5226 20.155 73.7851 18.2327C72.3282 17.1932 71.3488 15.6135 71.0655 13.8467C70.4268 9.84462 72.7816 6.42127 76.8226 5.75962ZM74.1074 11.3215C75.4407 11.3582 76.6649 11.3121 77.997 11.2656C78.971 11.2513 80.2058 11.2664 81.1547 11.1683C80.5244 9.30522 79.5775 8.1951 77.4552 8.32329C75.4301 8.7046 74.7647 9.38038 74.1074 11.3215Z" fill="#17191C" />
|
||||||
|
<path d="M91.1896 5.66801C93.7694 5.40445 96.8706 6.64052 97.2089 9.41204C97.5849 12.4901 97.3973 16.1187 97.3895 19.2428C96.5243 19.2313 95.3317 19.3387 94.5248 19.2174C94.3411 18.9973 94.4208 18.745 94.4224 18.3688L94.3254 18.2924C91.8248 19.5715 88.6988 20.3271 86.4134 17.8693C86.0444 17.4725 85.8724 17.0193 85.6662 16.5256C84.6361 11.2946 90.6401 10.6411 94.3569 11.1027C94.0411 6.83035 89.374 8.12642 87.0227 10.0053C86.6264 9.29286 86.2465 8.6609 85.8157 7.96792C87.716 6.51765 88.8034 5.96167 91.1896 5.66801ZM90.8283 17.0355C92.3019 17.0729 93.6162 16.5356 94.4704 15.303C94.4417 14.6145 94.4034 13.9156 94.4048 13.2271C93.7608 13.2624 93.2365 13.2644 92.5917 13.2562C91.3136 13.3097 89.9426 13.3043 88.999 14.3031C88.3494 14.9909 88.2427 15.884 89.0799 16.4609C89.634 16.8426 90.1761 16.9583 90.8283 17.0355Z" fill="#17191C" />
|
||||||
|
<path d="M35.9596 5.7504C36.3435 5.71272 36.7295 5.69981 37.1153 5.71189C39.9786 5.77844 42.3797 7.14864 43.2582 10.0054C43.6659 11.3309 43.6129 12.3284 43.5512 13.7066C40.4226 13.8522 36.6345 13.7555 33.4577 13.7516C33.5693 14.1477 33.7221 14.531 33.9134 14.8955C34.4126 15.8412 35.2862 16.5338 36.3212 16.8043C37.8863 17.1992 39.2701 16.6544 40.5749 15.8672C41.1823 15.4337 41.3855 15.4433 41.8405 16.0978C42.1137 16.491 42.3651 16.952 42.6164 17.3634C35.7824 23.0221 27.1676 16.343 31.5653 8.49222C32.4649 6.88612 34.2486 6.11266 35.9596 5.7504ZM33.3703 11.3667C34.6664 11.3522 36.0865 11.266 37.3478 11.2769C37.9324 11.2986 40.0022 11.4921 40.3704 11.1532C40.451 9.08425 38.2408 8.27536 36.4967 8.31919C34.5601 8.8467 34.0745 9.55463 33.3703 11.3667Z" fill="#17191C" />
|
||||||
|
<path d="M103.265 0C103.387 0.0110582 103.303 -0.00183904 103.508 0.080893C103.587 3.92179 103.554 7.87449 103.558 11.7215C105.153 10.0272 107.054 7.80241 108.616 6.04517C110.014 6.05336 111.411 6.04394 112.808 6.01691C111.063 7.88227 109.269 9.62866 107.448 11.418C109.046 13.5492 110.668 15.6613 112.316 17.7536C112.475 18.0143 113.157 18.8635 113.376 19.1514C112.16 19.1484 110.945 19.1842 109.731 19.2593C108.818 18.3108 106.229 14.8201 105.276 13.6053C104.712 14.1437 104.18 14.5719 103.574 15.0636C103.541 16.4403 103.57 17.9252 103.574 19.3101C102.637 19.2643 101.552 19.2962 100.605 19.3017C100.52 13.205 100.584 6.99843 100.568 0.887323C101.387 0.684793 102.449 0.282804 103.265 0Z" fill="#17191C" />
|
||||||
|
<path d="M0.00307161 1.11183C4.17121 1.21586 8.87403 1.10876 13.0846 1.12063C12.6459 2.06345 12.2986 2.99623 11.9271 3.96506C9.76893 3.77215 5.50987 3.89769 3.17515 3.90424L3.18252 8.69696C4.01455 8.68774 10.1181 8.60624 10.4412 8.79976L10.4228 9.13581C10.2917 9.92279 10.1304 10.7028 10.0007 11.4984C7.72377 11.4572 5.44639 11.4472 3.16921 11.4685L3.18416 19.2527L0 19.2473L0.00307161 1.11183Z" fill="#17191C" />
|
||||||
|
<path d="M64.3923 5.33318L64.4685 5.34813C64.755 5.64875 64.6461 7.54606 64.6377 8.07972C66.4217 6.45109 67.4104 6.24897 69.6858 5.59592C69.6653 6.56802 69.6864 7.60545 69.6888 8.58308C67.5241 9.20582 66.2084 9.53081 64.8248 11.3741L64.8166 14.1802L64.8214 19.1605C63.8089 19.1504 62.9251 19.1554 61.9075 19.2008C61.766 15.045 61.8516 10.4063 61.8434 6.22726C62.6834 5.90248 63.5335 5.60451 64.3923 5.33318Z" fill="#17191C" />
|
||||||
|
<path d="M23.7341 5.32638L23.8844 5.42939C23.9804 6.15862 23.9456 7.41802 23.9468 8.1921C25.9191 6.57125 26.6393 6.3462 29.0582 5.63192C29.0549 6.62081 29.0303 7.6308 29.1221 8.61355C26.9719 9.12694 25.7475 9.6518 24.2421 11.2485L24.2333 14.1801L24.2397 19.255L21.2468 19.2368C21.1901 14.9718 21.257 10.5305 21.2636 6.25548C22.1159 5.90387 22.8621 5.62741 23.7341 5.32638Z" fill="#17191C" />
|
||||||
|
<path d="M17.4168 5.56308L17.5198 5.59154C17.6766 5.90854 17.6146 18.0468 17.6146 19.2519L14.7405 19.2515C14.7274 19.2425 14.711 19.2372 14.7011 19.2247C14.3929 18.8321 14.5404 7.37457 14.5377 6.2108C15.5293 5.96444 16.408 5.7525 17.4168 5.56308Z" fill="#17191C" />
|
||||||
|
<path d="M15.4375 0.376667C16.1305 0.156321 16.8886 0.33039 17.4159 0.830877C17.9432 1.33157 18.1566 2.07943 17.9727 2.78306C17.7886 3.48648 17.2365 4.03428 16.5317 4.21265C15.4858 4.47722 14.4193 3.86267 14.1234 2.82545C13.8275 1.78823 14.4095 0.703499 15.4375 0.376667Z" fill="#17191C" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
<nav class="flex items-center gap-2">
|
||||||
|
{% if user %}
|
||||||
|
<a href="/dashboard" class="btn btn-sm btn-borderless">Dashboard</a>
|
||||||
|
<a href="/settings" class="btn btn-sm btn-borderless">Settings</a>
|
||||||
|
<a href="/auth/logout" class="btn btn-sm btn-secondary">Logout</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/auth/login/forgejo" class="btn btn-sm btn-primary">
|
||||||
|
<img src="/static/img/forgejo-logo.svg"
|
||||||
|
alt=""
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
class="size-4 shrink-0 brightness-0 invert"
|
||||||
|
aria-hidden="true" />
|
||||||
|
<span>Sign in with Forgejo</span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main class="{% block main_class %}px-4 py-8 mx-auto max-w-7xl sm:px-8{% endblock %}">
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
70
web/app/templates/dashboard.html
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}Dashboard — Firebreak{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="flex flex-col gap-6">
|
||||||
|
<section class="flex flex-col justify-between gap-4 pb-6 border-b border-border sm:flex-row sm:items-end">
|
||||||
|
<div>
|
||||||
|
<h1 class="mt-2 text-3xl font-semibold leading-10 tracking-normal">Welcome,</h1>
|
||||||
|
<p class=" text-2xl text-muted-foreground">{{ user.display_name or user.email }}.</p>
|
||||||
|
</div>
|
||||||
|
{% if pat_registered %}
|
||||||
|
<a href="/links/create" class="btn btn-primary w-fit">Create share link</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="btn btn-primary w-fit opacity-50 pointer-events-none"
|
||||||
|
aria-disabled="true">Create share link</span>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
<section class="grid gap-4 md:grid-cols-3">
|
||||||
|
<div class="p-4 card">
|
||||||
|
<p class="section-header-subtle">Active links</p>
|
||||||
|
<p class="mt-3 text-2xl font-semibold text-foreground">0</p>
|
||||||
|
<p class="mt-2 text-xs text-muted-foreground">No repository snapshots published yet.</p>
|
||||||
|
</div>
|
||||||
|
<div class="p-4 card">
|
||||||
|
<p class="section-header-subtle">Default expiry</p>
|
||||||
|
<p class="mt-3 text-2xl font-semibold text-foreground">7 days</p>
|
||||||
|
<p class="mt-2 text-xs text-muted-foreground">Applied to newly created links.</p>
|
||||||
|
</div>
|
||||||
|
<div class="p-4 card">
|
||||||
|
<p class="section-header-subtle">Audit events</p>
|
||||||
|
<p class="mt-3 text-2xl font-semibold text-foreground">0</p>
|
||||||
|
<p class="mt-2 text-xs text-muted-foreground">Viewer activity will appear here.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% if not pat_registered %}
|
||||||
|
<div class="rounded-lg border border-warning-muted bg-warning-muted/40 px-5 py-4">
|
||||||
|
<p class="text-sm font-semibold text-warning-foreground">Access token required</p>
|
||||||
|
<p class="mt-1 text-sm text-muted-foreground">
|
||||||
|
Register a Forgejo access token to create share links.
|
||||||
|
</p>
|
||||||
|
<a href="/settings" class="btn btn-sm btn-primary mt-3 w-fit">Go to Settings</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="space-y-3">
|
||||||
|
<div>
|
||||||
|
<h2 class="text-base font-semibold">Share links</h2>
|
||||||
|
<p class="mt-2 text-sm text-muted-foreground">Repository snapshots published from this account.</p>
|
||||||
|
</div>
|
||||||
|
<section class="card">
|
||||||
|
<div class="overflow-x-auto">
|
||||||
|
<table class="w-full min-w-[720px] text-left text-sm">
|
||||||
|
<thead class="bg-muted text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground">
|
||||||
|
<tr>
|
||||||
|
<th class="px-4 py-3">Repository</th>
|
||||||
|
<th class="px-4 py-3">Commit</th>
|
||||||
|
<th class="px-4 py-3">Status</th>
|
||||||
|
<th class="px-4 py-3">Views</th>
|
||||||
|
<th class="px-4 py-3">Expires</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="divide-y divide-border-subtle">
|
||||||
|
<tr class="text-muted-foreground text-center">
|
||||||
|
<td class="px-4 py-5" colspan="5">You have not created any share links yet.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
200
web/app/templates/error.html
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{{ status_code }} — Firebreak{% endblock %}
|
||||||
|
{% block body_class %}landing-page{% endblock %}
|
||||||
|
{% block main_class %}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
{% if status_code == 401 %}
|
||||||
|
<style>
|
||||||
|
@keyframes creep-in {
|
||||||
|
from { transform: translateX(100%); opacity: 0; }
|
||||||
|
to { transform: translateX(0); opacity: 1; }
|
||||||
|
}
|
||||||
|
@keyframes trot {
|
||||||
|
0%, 100% { transform: translateY(0) rotate(0deg); }
|
||||||
|
25% { transform: translateY(-3px) rotate(-0.6deg); }
|
||||||
|
75% { transform: translateY(-3px) rotate(0.6deg); }
|
||||||
|
}
|
||||||
|
@keyframes look-up {
|
||||||
|
from { transform: rotate(0deg); }
|
||||||
|
to { transform: rotate(3deg); }
|
||||||
|
}
|
||||||
|
@keyframes laser-pulse {
|
||||||
|
0%, 100% { opacity: 0.8; box-shadow: 0 0 6px 2px #ff0000, 0 0 16px 4px #ff000066; }
|
||||||
|
50% { opacity: 1; box-shadow: 0 0 10px 4px #ff0000, 0 0 30px 8px #ff000088; }
|
||||||
|
}
|
||||||
|
@keyframes btn-hit {
|
||||||
|
0% { filter: brightness(1); }
|
||||||
|
20% { filter: brightness(3) drop-shadow(0 0 12px #ff0000); }
|
||||||
|
100% { filter: brightness(1); }
|
||||||
|
}
|
||||||
|
.guard-dog-wrap {
|
||||||
|
animation: creep-in 6s ease-out both;
|
||||||
|
animation-delay: 1.5s;
|
||||||
|
}
|
||||||
|
.guard-dog-trot {
|
||||||
|
animation: trot 0.4s ease-in-out 15;
|
||||||
|
animation-delay: 1.5s;
|
||||||
|
}
|
||||||
|
.guard-dog-look {
|
||||||
|
animation: look-up 0.8s ease-out both;
|
||||||
|
animation-delay: 7.5s;
|
||||||
|
transform-origin: bottom center;
|
||||||
|
}
|
||||||
|
.laser-eye {
|
||||||
|
position: absolute;
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #ff0000;
|
||||||
|
animation: laser-pulse 2s ease-in-out infinite;
|
||||||
|
animation-delay: 7.5s;
|
||||||
|
opacity: 0;
|
||||||
|
animation-fill-mode: both;
|
||||||
|
}
|
||||||
|
.laser-eye-left { inset-block-start: 40px; inset-inline-start: 81px; }
|
||||||
|
.laser-eye-right { inset-block-start: 39px; inset-inline-start: 100px; }
|
||||||
|
.laser-beam {
|
||||||
|
position: fixed;
|
||||||
|
height: 2px;
|
||||||
|
background: linear-gradient(90deg, #ff0000, #ff000000);
|
||||||
|
transform-origin: left center;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 100;
|
||||||
|
opacity: 0;
|
||||||
|
box-shadow: 0 0 8px 2px #ff0000aa, 0 0 20px 4px #ff000044;
|
||||||
|
}
|
||||||
|
.laser-beam.fire { opacity: 1; transition: opacity 0.05s; }
|
||||||
|
.laser-beam.fade { opacity: 0; transition: opacity 0.4s; }
|
||||||
|
@keyframes rattle {
|
||||||
|
0%, 100% { transform: translate(0, 0); }
|
||||||
|
10% { transform: translate(-1px, 1px); }
|
||||||
|
20% { transform: translate(1px, -1px); }
|
||||||
|
30% { transform: translate(-2px, 0px); }
|
||||||
|
40% { transform: translate(2px, 1px); }
|
||||||
|
50% { transform: translate(-1px, -2px); }
|
||||||
|
60% { transform: translate(2px, 2px); }
|
||||||
|
70% { transform: translate(-3px, 1px); }
|
||||||
|
80% { transform: translate(3px, -1px); }
|
||||||
|
90% { transform: translate(-2px, 2px); }
|
||||||
|
}
|
||||||
|
.btn-zapped {
|
||||||
|
background: #c62030 !important;
|
||||||
|
color: #f7f2e8 !important;
|
||||||
|
box-shadow: 0 0 12px 4px rgba(198, 32, 48, 0.5), 0 0 30px 8px rgba(198, 32, 48, 0.25);
|
||||||
|
animation: rattle 0.15s linear infinite;
|
||||||
|
}
|
||||||
|
#go-home-btn:hover {
|
||||||
|
background: #c62030;
|
||||||
|
color: #f7f2e8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endif %}
|
||||||
|
<section class="relative flex min-h-dvh items-center justify-center overflow-hidden px-6 py-20">
|
||||||
|
<div class="img-wrapper-[800px] absolute inset-bs-8 opacity-50">
|
||||||
|
<img src="/static/img/firebreak-logo-red.svg"
|
||||||
|
alt="Firebreak"
|
||||||
|
width="240"
|
||||||
|
height="268" />
|
||||||
|
</div>
|
||||||
|
<div class="relative z-10 w-full max-w-md text-center">
|
||||||
|
{% if status_code == 401 %}
|
||||||
|
<p class="text-8xl font-bold text-[#f7f2e8]/20 sm:text-9xl">{{ status_code }}</p>
|
||||||
|
<h1 class="mt-1 text-xl font-semibold text-[#f7f2e8]">{{ title }}</h1>
|
||||||
|
{% else %}
|
||||||
|
<p class="text-8xl font-bold text-[#f7f2e8]/20 sm:text-9xl">{{ status_code }}</p>
|
||||||
|
<h1 class="mt-1 text-xl font-semibold text-[#f7f2e8]">{{ title }}</h1>
|
||||||
|
{% endif %}
|
||||||
|
<p class="mt-4 text-sm leading-6 text-[#f7f2e8]/60">{{ detail }}</p>
|
||||||
|
{% if status_code == 401 %}
|
||||||
|
{% set quips = [
|
||||||
|
"I'm not saying you're a data scraper, but I AM saying that this page is off-limits.",
|
||||||
|
"I'm watching you Wazowski.... ALWAYS watching.",
|
||||||
|
"He doesn't bite. He just harvests your data.",
|
||||||
|
"Move along clanker! Nothing to see here.",
|
||||||
|
"Just get out of here you STUPID, DUMB ANIMAL!"
|
||||||
|
] %}
|
||||||
|
<p class="text-xs italic text-[#f7f2e8]/30">{{ quips | random }}</p>
|
||||||
|
{% endif %}
|
||||||
|
<div class="mt-8">
|
||||||
|
<a href="/" class="btn btn-primary" id="go-home-btn">Go home</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if status_code == 401 %}
|
||||||
|
<div class="guard-dog-wrap pointer-events-none absolute -bottom-4 -right-8 w-44 sm:w-56"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="guard-dog-trot">
|
||||||
|
<div class="guard-dog-look">
|
||||||
|
<div class="relative">
|
||||||
|
<img src="/static/img/mark_cuckerberg.png"
|
||||||
|
alt=""
|
||||||
|
class="w-full opacity-65 grayscale" />
|
||||||
|
<div class="laser-eye laser-eye-left"></div>
|
||||||
|
<div class="laser-eye laser-eye-right"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
{% if status_code == 401 %}
|
||||||
|
<script>
|
||||||
|
console.log('%cUnauthorized access detected. Deploying CUCKerberg.', 'font-size: 16px; color: red;');
|
||||||
|
|
||||||
|
function fireBeam(eye, target) {
|
||||||
|
const eyeRect = eye.getBoundingClientRect();
|
||||||
|
const btnRect = target.getBoundingClientRect();
|
||||||
|
const x1 = eyeRect.left + eyeRect.width / 2;
|
||||||
|
const y1 = eyeRect.top + eyeRect.height / 2;
|
||||||
|
const x2 = btnRect.left + btnRect.width / 2;
|
||||||
|
const y2 = btnRect.top + btnRect.height / 2;
|
||||||
|
const dx = x2 - x1;
|
||||||
|
const dy = y2 - y1;
|
||||||
|
const length = Math.hypot(dx, dy);
|
||||||
|
const angle = Math.atan2(dy, dx) * (180 / Math.PI);
|
||||||
|
|
||||||
|
const beam = document.createElement('div');
|
||||||
|
beam.className = 'laser-beam';
|
||||||
|
beam.style.left = x1 + 'px';
|
||||||
|
beam.style.top = y1 + 'px';
|
||||||
|
beam.style.width = length + 'px';
|
||||||
|
beam.style.transform = 'rotate(' + angle + 'deg)';
|
||||||
|
document.body.appendChild(beam);
|
||||||
|
|
||||||
|
requestAnimationFrame(() => beam.classList.add('fire'));
|
||||||
|
return beam;
|
||||||
|
}
|
||||||
|
|
||||||
|
const btn = document.getElementById('go-home-btn');
|
||||||
|
let armed = false;
|
||||||
|
if (btn) {
|
||||||
|
setTimeout(() => { armed = true; }, 7500);
|
||||||
|
|
||||||
|
btn.addEventListener('click', (e) => {
|
||||||
|
if (!armed) return;
|
||||||
|
e.preventDefault();
|
||||||
|
const eyes = document.querySelectorAll('.laser-eye');
|
||||||
|
const beams = [];
|
||||||
|
eyes.forEach((eye) => beams.push(fireBeam(eye, btn)));
|
||||||
|
btn.classList.add('btn-zapped');
|
||||||
|
|
||||||
|
// Intensify glow over 2 seconds
|
||||||
|
let start = performance.now();
|
||||||
|
function intensify(now) {
|
||||||
|
const t = Math.min((now - start) / 2000, 1);
|
||||||
|
const spread = 12 + t * 20;
|
||||||
|
const blur = 30 + t * 40;
|
||||||
|
const opacity = 0.5 + t * 0.4;
|
||||||
|
const scale = 1 + t * 0.06;
|
||||||
|
btn.style.boxShadow = `0 0 ${spread}px ${spread/3}px rgba(198,32,48,${opacity}), 0 0 ${blur}px ${blur/3}px rgba(198,32,48,${opacity * 0.5})`;
|
||||||
|
btn.style.scale = scale;
|
||||||
|
if (t < 1) requestAnimationFrame(intensify);
|
||||||
|
}
|
||||||
|
requestAnimationFrame(intensify);
|
||||||
|
|
||||||
|
// Redirect right at peak intensity
|
||||||
|
setTimeout(() => { window.location.href = '/'; }, 2000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
51
web/app/templates/index.html
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}Firebreak — protect your code from scraping{% endblock %}
|
||||||
|
{% block body_class %}landing-page{% endblock %}
|
||||||
|
{% block main_class %}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<section class="relative flex min-h-dvh w-full items-center justify-center overflow-hidden bg-[#17191c] px-6 py-20 text-center text-[#f7f2e8]">
|
||||||
|
<video class="absolute inset-0 h-full w-full object-cover"
|
||||||
|
autoplay
|
||||||
|
muted
|
||||||
|
loop
|
||||||
|
playsinline
|
||||||
|
preload="metadata"
|
||||||
|
poster="/static/img/firebreak-hero-poster.jpg"
|
||||||
|
aria-hidden="true">
|
||||||
|
<source src="/static/video/firebreak-hero.mp4" type="video/mp4" />
|
||||||
|
</video>
|
||||||
|
<div class="absolute inset-0 bg-[#17191c]/65"></div>
|
||||||
|
<div class="absolute inset-0 bg-[radial-gradient(circle_at_center,transparent_0,transparent_30%,rgb(23_25_28_/0.44)_62%,rgb(23_25_28_/0.92)_100%)]">
|
||||||
|
</div>
|
||||||
|
<div class="relative z-10 flex w-full max-w-4xl flex-col items-center">
|
||||||
|
<img src="/static/img/firebreak-brand.svg"
|
||||||
|
alt="Firebreak"
|
||||||
|
width="240"
|
||||||
|
height="268"
|
||||||
|
class="h-auto w-full max-w-36 drop-shadow-[0_14px_34px_rgb(0_0_0_/0.55)] sm:max-w-48 lg:max-w-60" />
|
||||||
|
<p class="mt-8 max-w-2xl text-balance text-base font-medium leading-8 tracking-normal text-[#f7f2e8]/90 drop-shadow-[0_4px_18px_rgb(0_0_0_/0.72)] sm:text-lg sm:leading-9">
|
||||||
|
<span class="block">Fight Fire with Fire.</span>
|
||||||
|
<span class="mt-2 block">Draw a boundary around your code. Let them look, but don't let them scrape.</span>
|
||||||
|
</p>
|
||||||
|
<p class="mt-7 max-w-xl rounded-lg border border-[#f7f2e8]/14 bg-[#17191c]/42 px-5 py-4 text-sm leading-6 text-[#f7f2e8]/76 shadow-[0_18px_50px_rgb(0_0_0_/0.24)] backdrop-blur-sm sm:text-[0.9375rem]">
|
||||||
|
Firebreak creates temporary, read-only links to private Forgejo repository snapshots.
|
||||||
|
Sign in using Forgejo, register an access token, and control what can be viewed and by whom.
|
||||||
|
</p>
|
||||||
|
<div class="mt-7 flex flex-wrap items-center justify-center gap-3">
|
||||||
|
{% if user %}
|
||||||
|
<a href="/dashboard" class="btn btn-primary">Open dashboard</a>
|
||||||
|
{% else %}
|
||||||
|
<a href="/auth/login/forgejo" class="btn btn-primary">
|
||||||
|
<img src="/static/img/forgejo-logo.svg"
|
||||||
|
alt=""
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
class="size-4 shrink-0 brightness-0 invert"
|
||||||
|
aria-hidden="true" />
|
||||||
|
<span>Sign in with Forgejo</span>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
134
web/app/templates/settings.html
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}Settings — Firebreak{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<div class="flex flex-col gap-6">
|
||||||
|
<section class="pb-6 border-b border-border">
|
||||||
|
<h1 class="text-2xl font-semibold">Settings</h1>
|
||||||
|
<p class="mt-2 text-sm text-muted-foreground">Manage your Firebreak configuration.</p>
|
||||||
|
</section>
|
||||||
|
{% 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 pat_registered %}
|
||||||
|
<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 pat_registered_at %}
|
||||||
|
Registered {{ pat_registered_at.strftime("%b %d, %Y") }}
|
||||||
|
{% else %}
|
||||||
|
Registered
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<form method="post" action="/settings/pat/delete">
|
||||||
|
<button type="submit"
|
||||||
|
class="btn btn-xs btn-secondary text-danger-foreground hover:bg-danger-muted hover:border-danger-muted">
|
||||||
|
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"
|
||||||
|
required />
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary self-center">Update</button>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<p id="pat-error" class="input-error hidden">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"
|
||||||
|
required />
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary self-center">Register</button>
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<p id="pat-error" class="input-error hidden">A Forgejo token is required.</p>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
(() => {
|
||||||
|
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 %}
|
||||||
133
web/app/templates/setup.html
Normal file
|
|
@ -0,0 +1,133 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %}{{ "Reconfigure" if reconfiguring else "Setup" }} — Firebreak{% endblock %}
|
||||||
|
{% block body_class %}landing-page{% endblock %}
|
||||||
|
{% block main_class %}{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
<section class="flex min-h-dvh items-center justify-center px-6 py-20">
|
||||||
|
<div class="w-full max-w-lg">
|
||||||
|
<div class="mb-8 text-center">
|
||||||
|
<img src="/static/img/firebreak-brand.svg"
|
||||||
|
alt="Firebreak"
|
||||||
|
width="240"
|
||||||
|
height="268"
|
||||||
|
class="mx-auto h-auto w-full max-w-24" />
|
||||||
|
<h1 class="mt-6 text-2xl font-semibold text-[#f7f2e8]">
|
||||||
|
{{ "Reconfigure" if reconfiguring else "Setup" }}
|
||||||
|
</h1>
|
||||||
|
{% if reconfiguring %}
|
||||||
|
<p class="mt-2 text-sm leading-6 text-[#f7f2e8]/60">
|
||||||
|
Update your Forgejo OAuth connection. Make sure the OAuth application
|
||||||
|
is registered in your Forgejo instance before continuing.
|
||||||
|
</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="mt-2 text-sm leading-6 text-[#f7f2e8]/60">
|
||||||
|
Connect Firebreak to your Forgejo instance. You'll need to
|
||||||
|
<a href="https://forgejo.org/docs/latest/user/oauth2-provider/"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener"
|
||||||
|
class="underline underline-offset-2 text-[#f7f2e8]/80 hover:text-[#f7f2e8]">register an OAuth application</a>
|
||||||
|
in Forgejo first.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% if not reconfiguring %}
|
||||||
|
<div class="mb-8 rounded-lg border border-[#f7f2e8]/10 bg-[#1f2226]/60 px-5 py-4 text-xs leading-5 text-[#f7f2e8]/50">
|
||||||
|
<p class="font-medium text-[#f7f2e8]/70 mb-2.5">How to get your OAuth credentials:</p>
|
||||||
|
<ol class="list-decimal list-inside space-y-1.5">
|
||||||
|
<li>
|
||||||
|
In Forgejo, go to <strong class="text-[#f7f2e8]/70">Settings → Applications</strong>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Under <strong class="text-[#f7f2e8]/70">Manage OAuth2 Applications</strong>, create a new app
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Set the redirect URI to
|
||||||
|
<br />
|
||||||
|
<code class="mt-1 inline-block rounded bg-[#f7f2e8]/8 px-1.5 py-0.5 font-mono text-[10px] text-[#f7f2e8]/60">{{ oauth_callback_url }}</code>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Copy the <strong class="text-[#f7f2e8]/70">Client ID</strong> and <strong class="text-[#f7f2e8]/70">Client Secret</strong> into the form below
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<form method="post" action="/setup" class="space-y-5">
|
||||||
|
{% if not reconfiguring %}
|
||||||
|
<div>
|
||||||
|
<label for="setup_token"
|
||||||
|
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
|
||||||
|
Setup Token
|
||||||
|
</label>
|
||||||
|
<input type="password"
|
||||||
|
id="setup_token"
|
||||||
|
name="setup_token"
|
||||||
|
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 font-mono text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
|
||||||
|
placeholder="Paste the token from your server logs"
|
||||||
|
required />
|
||||||
|
<p class="mt-1.5 text-xs text-[#f7f2e8]/30">Printed to the server console on first boot.</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div>
|
||||||
|
<label for="forgejo_base_url"
|
||||||
|
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
|
||||||
|
Forgejo Instance URL
|
||||||
|
</label>
|
||||||
|
<input type="url"
|
||||||
|
id="forgejo_base_url"
|
||||||
|
name="forgejo_base_url"
|
||||||
|
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
|
||||||
|
placeholder="https://git.example.com"
|
||||||
|
value="{{ forgejo_base_url }}"
|
||||||
|
required />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="forgejo_oauth_client_id"
|
||||||
|
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
|
||||||
|
OAuth Client ID
|
||||||
|
</label>
|
||||||
|
<input type="text"
|
||||||
|
id="forgejo_oauth_client_id"
|
||||||
|
name="forgejo_oauth_client_id"
|
||||||
|
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 font-mono text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
|
||||||
|
placeholder="c8ab3315-537d-44f3-..."
|
||||||
|
value="{{ forgejo_oauth_client_id }}"
|
||||||
|
required />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="forgejo_oauth_client_secret"
|
||||||
|
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
|
||||||
|
OAuth Client Secret
|
||||||
|
{% if reconfiguring %}
|
||||||
|
<span class="ml-1 normal-case tracking-normal font-normal text-[#f7f2e8]/30">(leave blank to keep current)</span>
|
||||||
|
{% endif %}
|
||||||
|
</label>
|
||||||
|
<input type="password"
|
||||||
|
id="forgejo_oauth_client_secret"
|
||||||
|
name="forgejo_oauth_client_secret"
|
||||||
|
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 font-mono text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
|
||||||
|
placeholder="gto_wkxxnv4ewa..."
|
||||||
|
{{ "" if reconfiguring else "required" }} />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="firebreak_public_base_url"
|
||||||
|
class="block text-xs font-semibold uppercase tracking-[0.05em] text-[#f7f2e8]/50 mb-1.5">
|
||||||
|
Public Base URL
|
||||||
|
<span class="ml-1 normal-case tracking-normal font-normal text-[#f7f2e8]/30">(optional)</span>
|
||||||
|
</label>
|
||||||
|
<input type="url"
|
||||||
|
id="firebreak_public_base_url"
|
||||||
|
name="firebreak_public_base_url"
|
||||||
|
class="block w-full rounded-md border border-[#f7f2e8]/14 bg-[#1f2226] px-3 py-2.5 text-sm text-[#f7f2e8] placeholder:text-[#f7f2e8]/30 focus:border-[#f7f2e8]/30 focus:outline-none focus:ring-2 focus:ring-[#f7f2e8]/10"
|
||||||
|
placeholder="https://share.example.com"
|
||||||
|
value="{{ firebreak_public_base_url }}" />
|
||||||
|
<p class="mt-1.5 text-xs text-[#f7f2e8]/30">
|
||||||
|
Your production domain for OAuth redirects. Leave blank on localhost — Firebreak will use <code class="font-mono text-[#f7f2e8]/40">http://localhost:8000</code> automatically.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-full mt-2">
|
||||||
|
{{ "Save Forgejo settings" if reconfiguring else "Complete Setup" }}
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
9
web/app/templating.py
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
"""Shared Jinja2 template engine — importable without circular deps."""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from jinja2_fragments.fastapi import Jinja2Blocks
|
||||||
|
|
||||||
|
TEMPLATES_DIR = Path(__file__).parent / "templates"
|
||||||
|
|
||||||
|
templates = Jinja2Blocks(directory=str(TEMPLATES_DIR))
|
||||||
26
web/dev.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
export DATABASE_URL="postgresql+asyncpg://firebreak:firebreak@localhost:5432/firebreak_db"
|
||||||
|
export FIREBREAK_PUBLIC_BASE_URL="http://localhost:8000"
|
||||||
|
|
||||||
|
echo "Starting local Postgres and Adminer..."
|
||||||
|
docker compose -f ../docker-compose.yml up -d db adminer
|
||||||
|
|
||||||
|
echo "Building Tailwind CSS..."
|
||||||
|
./tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css
|
||||||
|
|
||||||
|
echo "Starting Firebreak dev server..."
|
||||||
|
echo " FastAPI: http://localhost:8000"
|
||||||
|
echo " Adminer: http://localhost:8080"
|
||||||
|
echo " PostgreSQL / db / firebreak / firebreak / firebreak_db"
|
||||||
|
echo " CSS: watching app/static/css/input.css"
|
||||||
|
|
||||||
|
./tailwindcss -i ./app/static/css/input.css -o ./app/static/css/output.css --watch &
|
||||||
|
TW_PID=$!
|
||||||
|
|
||||||
|
trap "kill $TW_PID 2>/dev/null" EXIT
|
||||||
|
|
||||||
|
uv run uvicorn app.main:app --reload --port 8000
|
||||||
44
web/pyproject.toml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
[tool.ruff]
|
||||||
|
target-version = "py313"
|
||||||
|
line-length = 100
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "firebreak-web"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Firebreak: FastAPI + HTMX web interface for managing Forgejo repositories"
|
||||||
|
requires-python = ">=3.13"
|
||||||
|
dependencies = [
|
||||||
|
"aiofiles>=24.1.0",
|
||||||
|
"asyncpg>=0.31.0",
|
||||||
|
"cryptography>=48.0.1",
|
||||||
|
"fastapi>=0.136.0",
|
||||||
|
"httpx>=0.28.1",
|
||||||
|
"jinja2>=3.1.0",
|
||||||
|
"jinja2-fragments>=0.1.0",
|
||||||
|
"pydantic-settings>=2.14.2",
|
||||||
|
"pydantic[email]>=2.13.2",
|
||||||
|
"python-multipart>=0.0.31",
|
||||||
|
"sqlalchemy[asyncio]>=2.0.49",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependency-groups]
|
||||||
|
dev = [
|
||||||
|
"djlint>=1.36.1",
|
||||||
|
"mypy>=1.19.0",
|
||||||
|
"ruff>=0.11.0",
|
||||||
|
"uvicorn[standard]>=0.44.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.mypy]
|
||||||
|
python_version = "3.13"
|
||||||
|
files = ["app"]
|
||||||
|
check_untyped_defs = true
|
||||||
|
warn_unused_ignores = true
|
||||||
|
warn_redundant_casts = true
|
||||||
|
strict_optional = true
|
||||||
|
|
||||||
|
[tool.djlint]
|
||||||
|
indent = 2
|
||||||
|
profile = "jinja"
|
||||||
|
max_line_length = 100
|
||||||
|
extension = "html"
|
||||||