From 6d956f1c7621e81ca22cad14dff5539965e9cbea Mon Sep 17 00:00:00 2001 From: Adam French Date: Wed, 14 Oct 2026 21:49:48 +0100 Subject: [PATCH] Add the website: Go server + Vue SPA in site/, with CI A standalone container for web_server, shaped like job-tracker: serves /usaco/ with solved problems public and solving/skipped plus edits (status, link, notes) for the site admin. Git is the only store: the server clones adamf/usaco from Gitea, pulls on the push webhook, and commits edits back. CI builds the image only when site/ changes. Co-Authored-By: Claude Opus 5.5 --- .gitea/workflows/ci.yaml | 147 ++ site/.dockerignore | 4 + site/.env.example | 42 + site/.gitignore | 3 + site/CLAUDE.md | 26 + site/Dockerfile | 47 + site/Makefile | 31 + site/README.md | 133 + site/cmd/usacosite/main.go | 159 ++ site/docker-compose.yml | 35 + site/go.mod | 39 + site/go.sum | 88 + site/internal/auth/auth.go | 135 + site/internal/auth/auth_test.go | 100 + site/internal/handlers/handlers.go | 335 +++ site/internal/handlers/handlers_test.go | 210 ++ site/internal/handlers/spa.go | 65 + site/internal/handlers/spa_test.go | 61 + site/internal/index/index.go | 424 ++++ site/internal/index/index_test.go | 138 ++ site/internal/repo/repo.go | 237 ++ site/internal/repo/repo_test.go | 218 ++ site/web/index.html | 14 + site/web/package-lock.json | 2177 +++++++++++++++++ site/web/package.json | 26 + .../web/public/fonts/CreatoDisplay-Bold.woff2 | Bin 0 -> 19392 bytes .../web/public/fonts/big_noodle_titling.woff2 | Bin 0 -> 8856 bytes site/web/src/App.vue | 62 + site/web/src/api.js | 37 + site/web/src/assets/styles.css | 215 ++ site/web/src/components/CodeBlock.vue | 109 + site/web/src/format.js | 25 + site/web/src/main.js | 10 + site/web/src/router.js | 19 + site/web/src/session.js | 13 + site/web/src/views/ProblemList.vue | 207 ++ site/web/src/views/ProblemPage.vue | 323 +++ site/web/src/views/StatsPage.vue | 345 +++ site/web/vite.config.js | 26 + 39 files changed, 6285 insertions(+) create mode 100644 .gitea/workflows/ci.yaml create mode 100644 site/.dockerignore create mode 100644 site/.env.example create mode 100644 site/.gitignore create mode 100644 site/CLAUDE.md create mode 100644 site/Dockerfile create mode 100644 site/Makefile create mode 100644 site/README.md create mode 100644 site/cmd/usacosite/main.go create mode 100644 site/docker-compose.yml create mode 100644 site/go.mod create mode 100644 site/go.sum create mode 100644 site/internal/auth/auth.go create mode 100644 site/internal/auth/auth_test.go create mode 100644 site/internal/handlers/handlers.go create mode 100644 site/internal/handlers/handlers_test.go create mode 100644 site/internal/handlers/spa.go create mode 100644 site/internal/handlers/spa_test.go create mode 100644 site/internal/index/index.go create mode 100644 site/internal/index/index_test.go create mode 100644 site/internal/repo/repo.go create mode 100644 site/internal/repo/repo_test.go create mode 100644 site/web/index.html create mode 100644 site/web/package-lock.json create mode 100644 site/web/package.json create mode 100644 site/web/public/fonts/CreatoDisplay-Bold.woff2 create mode 100644 site/web/public/fonts/big_noodle_titling.woff2 create mode 100644 site/web/src/App.vue create mode 100644 site/web/src/api.js create mode 100644 site/web/src/assets/styles.css create mode 100644 site/web/src/components/CodeBlock.vue create mode 100644 site/web/src/format.js create mode 100644 site/web/src/main.js create mode 100644 site/web/src/router.js create mode 100644 site/web/src/session.js create mode 100644 site/web/src/views/ProblemList.vue create mode 100644 site/web/src/views/ProblemPage.vue create mode 100644 site/web/src/views/StatsPage.vue create mode 100644 site/web/vite.config.js diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..a96ea10 --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,147 @@ +# ============================================================================= +# ci.yaml — test the site (site/) on every push that changes it; publish an +# image for such pushes to main that pass. Copied from job-tracker's ci.yaml, +# with the same runner and constraints: a self-hosted act_runner on the Pi in +# HOST mode, with git and docker and no other toolchain. So Go and Node run +# in `docker run` containers, and the source is fetched with plain git rather +# than actions/checkout (which needs Node on the host). +# +# PATHS +# Most pushes here are problems ("Solve moocast", from the CLI or from the +# site itself) and must not rebuild anything: the running site picks those +# up through the Gitea webhook. Only changes to site/ or this workflow run +# it. +# +# TWO JOBS +# test go vet + go test, and a vite build of site/web. The same checks +# as `make check` in site/. +# publish main only, after test: builds the image, pushes it to this +# Gitea's container registry as : and :latest, then pulls it +# into the web_server stack (its `usaco` service) and waits for it +# to be healthy — see "Deploying" in site/README.md. +# +# SECRETS (repo settings -> Actions -> Secrets) +# REGISTRY_USER a Gitea user that can write packages for adamf +# REGISTRY_TOKEN that user's access token with the write:package scope +# ============================================================================= +name: Test and publish the site + +on: + push: + paths: + - "site/**" + - ".gitea/workflows/**" + +env: + IMAGE: adam-french.co.uk/adamf/usaco + +jobs: + test: + runs-on: self-hosted + env: + SHA: ${{ github.sha }} + REF: ${{ github.ref }} + REMOTE: ssh://git@localhost:2222/adamf/usaco.git + GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" + CACHE: /home/adamf/.cache/usaco-ci/repo.git + SRC: /home/adamf/.cache/usaco-ci/src-${{ github.sha }} + steps: + - name: Export the pushed commit's site/ to a scratch directory + shell: bash + run: | + set -eu + mkdir -p "$(dirname "$CACHE")" + [ -d "$CACHE" ] || git init --quiet --bare "$CACHE" + git --git-dir="$CACHE" fetch --quiet --no-tags "$REMOTE" "$REF" + rm -rf "$SRC" + mkdir -p "$SRC" + git --git-dir="$CACHE" archive --format=tar "$SHA" site | tar -x -C "$SRC" + test -f "$SRC/site/go.mod" + + # Read-only source, and named volumes for the module and build + # caches, for the reasons given in web_server's deploy.yaml. git + # is installed because internal/repo and internal/index test + # against real repositories. + - name: Go - vet and test + shell: bash + run: | + set -eu + docker run --rm \ + -v "$SRC/site":/src:ro -w /src \ + -v usaco_ci_gomod:/go/pkg/mod \ + -v usaco_ci_gobuild:/root/.cache/go-build \ + golang:1.26 \ + sh -c 'go vet ./... && go test ./...' + + # Built in the container's own copy: node_modules and dist must not + # be written into $SRC, which is mounted read-only. + - name: Web - vite build + shell: bash + run: | + set -eu + docker run --rm \ + -v "$SRC/site/web":/src:ro \ + -v usaco_ci_npm:/root/.npm \ + node:22-alpine \ + sh -c 'cp -r /src /build && cd /build && npm ci --no-audit --no-fund && npx vite build' + + - name: Remove the scratch directory + if: always() + shell: bash + run: rm -rf "$SRC" + + publish: + needs: test + if: github.ref == 'refs/heads/main' + runs-on: self-hosted + env: + SHA: ${{ github.sha }} + CACHE: /home/adamf/.cache/usaco-ci/repo.git + SRC: /home/adamf/.cache/usaco-ci/publish-${{ github.sha }} + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} + REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} + # The Pi's Docker is 20.10, where plain `docker build` still uses + # the legacy builder, and that rejects the Dockerfile's + # `RUN --mount=type=cache` lines. This switches on BuildKit. + DOCKER_BUILDKIT: "1" + steps: + - name: Build and push the image + shell: bash + run: | + set -eu + rm -rf "$SRC" && mkdir -p "$SRC" + git --git-dir="$CACHE" archive --format=tar "$SHA" site | tar -x -C "$SRC" + printf '%s' "$REGISTRY_TOKEN" | docker login adam-french.co.uk -u "$REGISTRY_USER" --password-stdin + # Built natively on the Pi, so the image is arm64 — the only + # platform it runs on. + docker build -t "$IMAGE:$SHA" -t "$IMAGE:latest" "$SRC/site" + docker push "$IMAGE:$SHA" + docker push "$IMAGE:latest" + + - name: Remove the scratch directory + if: always() + shell: bash + run: rm -rf "$SRC" + + # Put the new image live, exactly as job-tracker's workflow does + # for `jobs`: pull + up of the one service, under the lock that + # web_server's deploy.yaml and env-apply hold, then wait for the + # image's HEALTHCHECK (process up, repository cloned and indexed). + # Pinning USACO_IMAGE_TAG in the site's .env makes this a no-op. + - name: Roll the site onto the new image + working-directory: /home/adamf/deploy/web_server + env: + DOCKER_API_VERSION: "1.41" + shell: bash + run: | + set -eu + flock env-apply/run/lock sh -c 'docker compose pull usaco && docker compose up -d --no-deps usaco' + for i in $(seq 1 30); do + status=$(docker inspect -f '{{.State.Health.Status}}' usaco) + echo "usaco: $status" + [ "$status" = healthy ] && exit 0 + [ "$status" = unhealthy ] && break + sleep 5 + done + docker logs --tail 50 usaco + exit 1 diff --git a/site/.dockerignore b/site/.dockerignore new file mode 100644 index 0000000..2658381 --- /dev/null +++ b/site/.dockerignore @@ -0,0 +1,4 @@ +web/node_modules +web/dist +.env +*.log diff --git a/site/.env.example b/site/.env.example new file mode 100644 index 0000000..ab773d9 --- /dev/null +++ b/site/.env.example @@ -0,0 +1,42 @@ +# Every variable the server reads. In production these are set by the main +# site's docker-compose.yml (see README.md); for standalone development, +# docker-compose.yml here sets what it needs. + +# --- Core ------------------------------------------------------------------- +# URL prefix everything is served under. The SPA is built for /usaco. +BASE_PATH= +# The clone lives in $DATA_DIR/repo (default /data). +DATA_DIR= +# Listen port (default 8080). +PORT= +# "true" enables gin debug logging, and is required for AUTH_MODE=dev. +DEV_MODE= + +# --- Git -------------------------------------------------------------------- +# What to clone. Production: http://gitea:3000/adamf/usaco.git (Gitea on the +# Docker network). Required. +GIT_REMOTE_URL= +# Default main. +GIT_BRANCH= +# HTTP credentials: a Gitea access token with read and write on the repo. +# Given to git through GIT_ASKPASS, never written into .git/config. +# GIT_USER defaults to adamf. +GIT_USER= +GIT_TOKEN= +# Who the site's commits are by. Defaults: "usaco site" / usaco@adam-french.co.uk. +GIT_AUTHOR_NAME= +GIT_AUTHOR_EMAIL= +# "false" keeps edits as local commits (development). Default true. +GIT_PUSH= +# Fallback pull interval, a Go duration. Default 10m; the webhook is the +# normal trigger. +PULL_INTERVAL= +# Shared secret of the Gitea push webhook. Blank turns the hook off. +WEBHOOK_SECRET= + +# --- Auth ------------------------------------------------------------------- +# "forward" (default): ask the main site's backend. "dev": admit everyone. +AUTH_MODE= +# The site backend's validate-admin route, on the Docker network +# (default http://backend:8080/auth/validate-admin). +AUTH_VALIDATE_URL= diff --git a/site/.gitignore b/site/.gitignore new file mode 100644 index 0000000..1837e92 --- /dev/null +++ b/site/.gitignore @@ -0,0 +1,3 @@ +web/node_modules/ +web/dist/ +.env diff --git a/site/CLAUDE.md b/site/CLAUDE.md new file mode 100644 index 0000000..d8a997b --- /dev/null +++ b/site/CLAUDE.md @@ -0,0 +1,26 @@ +# CLAUDE.md + +Guidance for Claude Code in `site/`. README.md has the full picture (routes, git sync, deployment). + +## Commands + +``` +make check # go vet ./... && go test ./..., then a vite build of web/ into a temp dir +make dev # docker compose up --build: this checkout's problems, AUTH_MODE=dev, GIT_PUSH=false +cd web && npm run dev # SPA hot reload; proxies /usaco/api to localhost:8080 +``` + +## Architecture + +One Go binary (`cmd/usacosite`) that serves a REST API and the built Vue SPA, all under `/usaco`. It is deployed as one container inside the `web_server` stack, behind its nginx. It has the same shape as `../job-tracker`, from which `internal/auth` and `handlers.SPA` were copied. + +- **Git is the only store.** `internal/repo` owns the clone and serializes every git command. A sync is fetch + hard reset (the remote wins). `Mutate` does sync, edit, commit and push, and replays the edit once if the push is rejected. Its `onChange` callback (`Server.Reload`) rebuilds the index under the same lock. +- **The index is an immutable snapshot**, swapped in through an `atomic.Pointer`. Handlers read `s.Index()` once per request. +- **Visibility is decided server-side.** Non-admins see only `solved/`, and an unsolved problem is a 404, not a 403. `auth.Forward` returns false for a request with no cookies without a network call. + +## Conventions + +- **Comments explain why, not what.** Preserve them, and update them when behaviour changes. +- **Edits look at the disk.** An edit func passed to `Mutate` may run twice, so it must locate the problem with `findOnDisk`, never from the index. +- **Commit subjects match the CLI's** (`lib/cmd/done.sh`): "Solve " and so on. +- **The problem layout belongs to the CLI** in the repo root (`lib/`). When the CLI's layout changes, update `internal/index`. diff --git a/site/Dockerfile b/site/Dockerfile new file mode 100644 index 0000000..5d155f7 --- /dev/null +++ b/site/Dockerfile @@ -0,0 +1,47 @@ +# ============================================================================= +# The USACO site: one image, one process. Same three stages as the job +# tracker's Dockerfile, which this is copied from: +# +# web builds the Vue SPA (web/) with Vite. Only package*.json is copied +# before `npm ci`, so the dependency layer is cached across edits. +# build compiles the Go server. Same trick with go.mod/go.sum. +# runtime alpine with the binary and the built SPA, which the server serves +# from /app/static (STATIC_DIR) for every non-API path under /usaco/. +# +# The build context is site/, so the problems themselves are never in the +# image: the server clones them from Gitea at runtime into DATA_DIR. +# +# The runtime runs as uid 1000, not root. DATA_DIR (/data) must be writable by +# it: with a bind mount, `chown 1000 ` on the host. git is the server's +# storage layer (internal/repo shells out to it); wget is for the healthcheck. +# ============================================================================= +FROM node:22-alpine AS web +WORKDIR /web +COPY web/package.json web/package-lock.json ./ +RUN npm ci --no-audit --no-fund +COPY web/ ./ +RUN npm run build + +FROM golang:1.26 AS build +WORKDIR /src +COPY go.mod go.sum ./ +RUN --mount=type=cache,target=/go/pkg/mod go mod download +COPY cmd ./cmd +COPY internal ./internal +RUN --mount=type=cache,target=/go/pkg/mod \ + --mount=type=cache,target=/root/.cache/go-build \ + CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/usacosite ./cmd/usacosite + +FROM alpine:3.22 +RUN apk add --no-cache ca-certificates git wget \ + && adduser -D -H -u 1000 app \ + && mkdir /data && chown app /data +COPY --from=build /out/usacosite /app/usacosite +COPY --from=web /web/dist /app/static +USER app +VOLUME /data +EXPOSE 8080 +# start-period covers the first clone, which /api/health waits for. +HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \ + CMD wget -qO- http://localhost:8080/usaco/api/health || exit 1 +CMD ["/app/usacosite"] diff --git a/site/Makefile b/site/Makefile new file mode 100644 index 0000000..a1acf2b --- /dev/null +++ b/site/Makefile @@ -0,0 +1,31 @@ +# ============================================================================= +# Makefile — the commands that verify and run the site. `make check` is the +# thing to run before pushing; .gitea/workflows/ci.yaml (at the repo root) +# runs the same checks in containers before it publishes an image. +# +# Needs on the host: Go (the version in go.mod) for check-go, Node with +# `npm install` done in web/ for check-web, Docker for dev. +# ============================================================================= + +.DEFAULT_GOAL := help + +.PHONY: help check check-go check-web dev + +help: + @echo "Targets:" + @echo " make check run every check below" + @echo " make check-go go vet + go test" + @echo " make check-web vite build of web/ into a throwaway directory" + @echo " make dev build and run the standalone site (http://localhost:8080/usaco/)" + +check: check-go check-web + +check-go: + go vet ./... && go test ./... + +# Built into a temporary directory so a check never replaces web/dist. +check-web: + cd web && npx vite build --outDir "$$(mktemp -d)" --emptyOutDir + +dev: + docker compose up --build diff --git a/site/README.md b/site/README.md new file mode 100644 index 0000000..6994251 --- /dev/null +++ b/site/README.md @@ -0,0 +1,133 @@ +# USACO site + +The public face of this repo, served at `/usaco/` on adam-french.co.uk. It shows the solved problems: each solution, its sample input, saved tests and notes, and its git history, plus a stats page with a solve calendar. When the site's admin is logged in, it also shows problems in `solving/` and `skipped/`, and lets them: + +- mark a problem solved, skipped or back in progress +- set its link +- write notes + +It is one Go binary that serves a REST API and the built Vue SPA. It runs as one container behind the site's nginx and borrows the site's login, the same arrangement as job-tracker (adamf/job-tracker), which it is modelled on. + +## Git is the store + +There is no database. The CLI's layout is the data model (see the root README.md): + +- `solving/`, `solved/` and `skipped//`, each holding the solution files +- `.in` for the sample input +- `tests/N.in` and `N.out` +- `.url` for the problem link +- `notes.md` for notes + +The server keeps a clone of adamf/usaco in `$DATA_DIR/repo` and indexes it into memory. + +- **Reading.** A Gitea push webhook triggers a fetch and hard reset, then a re-index, so a `usaco done && usaco sync` is live in seconds. A pull every `PULL_INTERVAL` (10m) catches missed hooks. The clone is a cache: the remote always wins. +- **Writing.** An admin edit runs under one lock: + 1. sync + 2. change the files + 3. commit as `GIT_AUTHOR_NAME` + 4. push + + The commit subjects match the CLI's: "Solve ", "Skip ", "Reopen " and "Update ". If someone pushed in between and the push is rejected, the edit is replayed once on the new tip. A second rejection returns 409. +- **Dates come from git, not mtimes.** A problem's solve date is the commit that moved it into `solved/`. Its first and last dates are its first and last commits. + +The site commits, so the laptop must pull before pushing. `usaco sync` does `pull --rebase --autostash` and then `push`. + +## Layout + +``` +cmd/usacosite/ main: reads the environment, wires everything, registers routes +internal/auth/ is this request the admin? (asks the site backend; copied from job-tracker) +internal/repo/ the clone: sync, and edit-commit-push with one replay on rejection +internal/index/ reads the clone into memory: problems, files, tests, git dates +internal/handlers/ REST API, Gitea webhook, SPA file server +web/ Vue 3 + Vite SPA, built for base /usaco/ +``` + +## Routes + +Everything is served under `BASE_PATH` (`/usaco`). nginx proxies the prefix through unchanged. + +| Path | Auth | What | +|---|---|---| +| `/usaco/`, `/usaco/p/`, `/usaco/stats` | none | SPA | +| `GET /usaco/api/problems` | open; the admin also gets unsolved problems | the list | +| `GET /usaco/api/problems/` | open for solved problems; 404 for others unless admin | one problem, with files, tests and history | +| `GET /usaco/api/me` | open | `{admin}`, so the SPA knows whether to show the edit controls | +| `PUT /usaco/api/problems//meta` | admin | `{url?, notes?}`: writes `.url` and `notes.md` (blank removes the file) | +| `POST /usaco/api/problems//status` | admin | `{to: solving\|solved\|skipped}`: moves the directory | +| `POST /usaco/api/hooks/gitea` | HMAC (`X-Gitea-Signature`) | queue a pull | +| `GET /usaco/api/health` | open | 200 once the clone is indexed | + +Auth works as in job-tracker: + +- `internal/auth` forwards the browser's cookies to the site backend's `/auth/validate-admin`. +- A "yes" is cached for 30 seconds. +- A refused admin action sends the browser to `/admin/login?redirect=…`. + +## Development + +``` +make check # go vet + go test, and a vite build +make dev # docker compose up --build: this checkout's problems, no login +``` + +Then open http://localhost:8080/usaco/. + +**`make dev`.** The dev compose clones the repo root, mounted read-only, and sets `GIT_PUSH=false`. Edits made in the browser become commits in the container's clone and nowhere else. Only committed work shows up. + +**Hot reload.** Run the server with `make dev`, then run `cd web && npm run dev`. Vite proxies `/usaco/api` to `localhost:8080`. + +**Without Docker:** +``` +go build -o /tmp/usacosite ./cmd/usacosite && (cd web && npx vite build) +DEV_MODE=true AUTH_MODE=dev GIT_PUSH=false GIT_REMOTE_URL=file://$PWD/.. \ + DATA_DIR=/tmp/usaco-data STATIC_DIR=$PWD/web/dist /tmp/usacosite +``` + +Every variable is listed and explained in `.env.example`. + +## Running inside web_server + +The site's `docker-compose.yml` runs the published image as service `usaco`, with an explicit `environment:` list. The site's nginx routes `/usaco/` to it. `./usaco-data` is mounted at `/data` and holds only the clone, so deleting it is safe: the next start re-clones. The container runs as uid 1000, so run `chown 1000 usaco-data` on the host. + +### Deploying + +A push to `main` that touches `site/` or `.gitea/workflows/` runs `.gitea/workflows/ci.yaml` at the repo root. It does the following: + +1. Tests. +2. Builds the image from `site/` and pushes it as `adam-french.co.uk/adamf/usaco:` and `:latest`. +3. Rolls the site onto the new image and waits for the healthcheck. + +Problem commits don't match the path filter, so they never rebuild the image. The webhook brings them in. + +By hand on the Pi: + +``` +cd ~/deploy/web_server && docker compose pull usaco && docker compose up -d --no-deps usaco +``` + +To pin a version, set `USACO_IMAGE_TAG=` in the site's `.env`. + +### One-off setup + +The registry setup is shared with job-tracker (see its README, "One-off: registry setup"). The Pi is already logged in, and the same `REGISTRY_USER` and `REGISTRY_TOKEN` work here. + +1. **CI secrets.** In this repo's Settings → Actions → Secrets, add `REGISTRY_USER` and `REGISTRY_TOKEN`. Use the same values as job-tracker. +2. **A git token for the server.** In Gitea, go to Settings → Applications and create a token with **repository: read and write**. Put it in the site's `.env` as `USACO_GIT_TOKEN`. +3. **The data directory.** On the Pi, in `~/deploy/web_server`, run `mkdir usaco-data && sudo chown 1000:1000 usaco-data`. +4. **A webhook secret.** Generate one, for example with `openssl rand -hex 32`, and put it in the site's `.env` as `USACO_WEBHOOK_SECRET`. +5. **Deploy web_server** with the `usaco` service and the `/usaco/` route. Then push this repo, so CI publishes the first image. +6. **The webhook.** In this repo's Settings → Webhooks → Add webhook → Gitea, set: + - Target URL: `http://usaco:8080/usaco/api/hooks/gitea` + - Method: POST + - Content type: application/json + - Secret: the value of `USACO_WEBHOOK_SECRET` + - Trigger: push events + + Gitea only delivers to Docker-network hosts that are on `[webhook] ALLOWED_HOST_LIST`. web_server's compose sets that to `external,usaco`. Use "Test delivery": the response should be `202`, and `docker logs usaco` should show a new `[index]` line. + +## Things that are easy to get wrong + +- **`BASE_PATH` and Vite's `base` must agree.** The SPA's asset URLs and router base are fixed at build time. +- **Edits must decide from disk, not the index.** `repo.Mutate` may run an edit twice, the second time on a newer tip. The handlers re-locate the problem in the clone each time with `findOnDisk`. +- **`tests/*.out` used to be gitignored** by the root `*.out` rule. The root `.gitignore` now re-includes `**/tests/*.out`. A test whose expected output is shown as "Not saved." predates that change or never had one. diff --git a/site/cmd/usacosite/main.go b/site/cmd/usacosite/main.go new file mode 100644 index 0000000..001871c --- /dev/null +++ b/site/cmd/usacosite/main.go @@ -0,0 +1,159 @@ +// Command usacosite serves the USACO practice log at /usaco/: the problems +// from adamf/usaco on the site's Gitea, their solutions and tests, and a few +// admin edits (problem link, notes, status) that it commits back to git. +// +// It is built to sit behind adam-french.co.uk's nginx and borrow its login +// (internal/auth), like the job tracker. There is no database: the server +// keeps a clone of the repository in DATA_DIR and pulls it when Gitea's push +// webhook fires, and every PULL_INTERVAL in case a hook was missed. main +// reads every setting from the environment (all listed in .env.example), +// wires the pieces together and registers the routes. +package main + +import ( + "context" + "log" + "os" + "path/filepath" + "strings" + "time" + + "github.com/gin-gonic/gin" + + "adam-french.co.uk/usaco-site/internal/auth" + "adam-french.co.uk/usaco-site/internal/handlers" + "adam-french.co.uk/usaco-site/internal/repo" +) + +func main() { + devMode := os.Getenv("DEV_MODE") == "true" + if !devMode { + gin.SetMode(gin.ReleaseMode) + } + + // Everything is served under basePath, and nginx proxies it without + // stripping the prefix. The SPA is built for /usaco/ (web/vite.config.js), + // so changing this means rebuilding it with a matching base. + basePath := strings.TrimRight(getenv("BASE_PATH", "/usaco"), "/") + dataDir := getenv("DATA_DIR", "/data") + staticDir := getenv("STATIC_DIR", "/app/static") + + // AUTH + // "forward" (the default) asks the main site; "dev" admits everyone and + // is refused outside DEV_MODE, so a stray setting cannot open the edits + // in production. + var checker auth.Checker + switch mode := getenv("AUTH_MODE", "forward"); mode { + case "forward": + checker = auth.NewForward(getenv("AUTH_VALIDATE_URL", "http://backend:8080/auth/validate-admin")) + case "dev": + if !devMode { + log.Fatal("AUTH_MODE=dev is only allowed with DEV_MODE=true") + } + log.Println("[auth] AUTH_MODE=dev: every request is treated as the admin") + checker = auth.AllowAll{} + default: + log.Fatalf("unknown AUTH_MODE %q (want forward or dev)", mode) + } + + remote := os.Getenv("GIT_REMOTE_URL") + if remote == "" { + log.Fatal("GIT_REMOTE_URL is not set") + } + + srv := &handlers.Server{Checker: checker, WebhookSecret: os.Getenv("WEBHOOK_SECRET")} + if srv.WebhookSecret == "" { + log.Println("[webhook] WEBHOOK_SECRET is not set: the push hook is off, pulls happen on the interval only") + } + + rp, err := repo.New(repo.Config{ + Dir: filepath.Join(dataDir, "repo"), + Remote: remote, + Branch: getenv("GIT_BRANCH", "main"), + User: getenv("GIT_USER", "adamf"), + Token: os.Getenv("GIT_TOKEN"), + AuthorName: getenv("GIT_AUTHOR_NAME", "usaco site"), + AuthorEmail: getenv("GIT_AUTHOR_EMAIL", "usaco@adam-french.co.uk"), + Push: getenv("GIT_PUSH", "true") == "true", + }, srv.Reload) + if err != nil { + log.Fatal(err) + } + srv.Repo = rp + + // SYNC LOOP + // One goroutine does every pull, so webhook bursts coalesce: a trigger + // that arrives while a pull is running queues exactly one more. Until + // the first pull succeeds (Gitea may still be starting), it retries + // every 30 seconds and /api/health reports not ready. + trigger := make(chan struct{}, 1) + srv.Pull = func() { + select { + case trigger <- struct{}{}: + default: + } + } + go syncLoop(rp, srv, trigger, duration("PULL_INTERVAL", 10*time.Minute)) + + r := gin.New() + r.Use(gin.Logger(), gin.Recovery()) + // Nothing here keys on the client's IP, so no proxy is trusted to + // report one. + if err := r.SetTrustedProxies(nil); err != nil { + log.Fatal(err) + } + srv.Routes(r.Group(basePath + "/api")) + r.NoRoute(handlers.SPA(staticDir, basePath)) + + addr := ":" + getenv("PORT", "8080") + log.Printf("listening on %s%s/", addr, basePath) + if err := r.Run(addr); err != nil { + log.Fatal(err) + } +} + +func syncLoop(rp *repo.Repo, srv *handlers.Server, trigger <-chan struct{}, interval time.Duration) { + pull := func() bool { + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + if err := rp.Sync(ctx); err != nil { + log.Printf("[sync] %v", err) + return false + } + return true + } + for !pull() { + time.Sleep(30 * time.Second) + } + tick := time.NewTicker(interval) + defer tick.Stop() + for { + select { + case <-tick.C: + case <-trigger: + } + pull() + } +} + +func getenv(key, def string) string { + if v := os.Getenv(key); v != "" { + return v + } + return def +} + +// duration reads a Go duration; an unparseable value is logged and the +// default stands. +func duration(key string, def time.Duration) time.Duration { + v := os.Getenv(key) + if v == "" { + return def + } + d, err := time.ParseDuration(v) + if err != nil || d <= 0 { + log.Printf("%s=%q is not a duration; using %s", key, v, def) + return def + } + return d +} diff --git a/site/docker-compose.yml b/site/docker-compose.yml new file mode 100644 index 0000000..d4896dd --- /dev/null +++ b/site/docker-compose.yml @@ -0,0 +1,35 @@ +# Standalone development: the site serving THIS checkout's problems, with no +# login (AUTH_MODE=dev, everyone is the admin). http://localhost:8080/usaco/ +# +# docker compose up --build +# +# The repo root is mounted read-only at /seed and cloned from there, and +# GIT_PUSH=false keeps edits made in the browser as commits in the +# container's own clone (docker compose exec usaco git -C /data/repo log), +# so nothing here can touch your working tree or the real remote. Only +# committed work shows up: it is a clone, not the working tree. +# +# This is NOT how it runs in production. There it is one service in the main +# site's docker-compose.yml, behind its nginx, cloning from Gitea and +# borrowing the site's login; see README.md. +services: + usaco: + build: . + ports: + - "8080:8080" + environment: + DEV_MODE: "true" + AUTH_MODE: dev + GIT_REMOTE_URL: file:///seed + GIT_PUSH: "false" + # The checkout belongs to your host user, which git refuses to read + # from as a different uid unless told it is safe. + GIT_CONFIG_COUNT: "1" + GIT_CONFIG_KEY_0: safe.directory + GIT_CONFIG_VALUE_0: "*" + volumes: + - ..:/seed:ro + - usaco-data:/data + +volumes: + usaco-data: diff --git a/site/go.mod b/site/go.mod new file mode 100644 index 0000000..5d5ade7 --- /dev/null +++ b/site/go.mod @@ -0,0 +1,39 @@ +module adam-french.co.uk/usaco-site + +go 1.26 + +require github.com/gin-gonic/gin v1.11.0 + +require ( + github.com/bytedance/sonic v1.14.0 // indirect + github.com/bytedance/sonic/loader v0.3.0 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect + github.com/gabriel-vasile/mimetype v1.4.8 // indirect + github.com/gin-contrib/sse v1.1.0 // indirect + github.com/go-playground/locales v0.14.1 // indirect + github.com/go-playground/universal-translator v0.18.1 // indirect + github.com/go-playground/validator/v10 v10.27.0 // indirect + github.com/goccy/go-json v0.10.2 // indirect + github.com/goccy/go-yaml v1.18.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.3.0 // indirect + github.com/leodido/go-urn v1.4.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pelletier/go-toml/v2 v2.2.4 // indirect + github.com/quic-go/qpack v0.5.1 // indirect + github.com/quic-go/quic-go v0.54.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + github.com/ugorji/go/codec v1.3.0 // indirect + go.uber.org/mock v0.5.0 // indirect + golang.org/x/arch v0.20.0 // indirect + golang.org/x/crypto v0.40.0 // indirect + golang.org/x/mod v0.25.0 // indirect + golang.org/x/net v0.42.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.35.0 // indirect + golang.org/x/text v0.27.0 // indirect + golang.org/x/tools v0.34.0 // indirect + google.golang.org/protobuf v1.36.9 // indirect +) diff --git a/site/go.sum b/site/go.sum new file mode 100644 index 0000000..a25fff5 --- /dev/null +++ b/site/go.sum @@ -0,0 +1,88 @@ +github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= +github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= +github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= +github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= +github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= +github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= +github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= +github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM= +github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk= +github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls= +github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= +github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4= +github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo= +github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= +github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= +github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= +github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= +github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= +github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= +github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= +github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= +github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= +github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA= +github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4= +go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU= +go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM= +golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c= +golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= +golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/site/internal/auth/auth.go b/site/internal/auth/auth.go new file mode 100644 index 0000000..f9e2107 --- /dev/null +++ b/site/internal/auth/auth.go @@ -0,0 +1,135 @@ +// Package auth decides whether a request comes from the site's admin. +// +// Copied from the job tracker (adamf/job-tracker, internal/auth), which has +// the same arrangement: no users or passwords here. The site runs behind the +// main site's nginx and borrows that site's session: the browser already +// carries the site's HTTP-only auth cookies on every request to /usaco/, so +// the Cookie header is forwarded to the site backend's +// GET /auth/validate-admin and a 2xx means "admin". Logging in and out happen +// on the main site; this only ever asks. +// +// Unlike the tracker, most of this site is public: the verdict decides what a +// visitor sees (solved problems only, or everything) as well as guarding the +// edit routes. +// +// Two consequences worth knowing: +// - validate-admin falls back to the refresh token when the access token has +// expired, and answers with fresh cookies. Those Set-Cookie headers are +// relayed onto this response, or the browser would keep presenting the +// expired token and every request would refresh again. +// - The answer is cached for a short while per cookie. Only "yes" is +// cached: a refusal is re-asked, so logging in takes effect at once. +// Logging out takes up to cacheTTL to reach this site. +// +// Mode "dev" admits everyone. It exists for the standalone docker-compose, +// which has no site backend to ask, and main refuses it unless DEV_MODE=true. +package auth + +import ( + "crypto/sha256" + "encoding/hex" + "log" + "net/http" + "sync" + "time" + + "github.com/gin-gonic/gin" +) + +// cacheTTL is how long a "yes" from the site backend is trusted. +const cacheTTL = 30 * time.Second + +// Checker answers whether the request is the admin's. It may write headers +// (the relayed Set-Cookie) onto w, which is why it gets the writer. +type Checker interface { + IsAdmin(w http.ResponseWriter, r *http.Request) bool +} + +// AllowAll is the "dev" mode checker. +type AllowAll struct{} + +func (AllowAll) IsAdmin(http.ResponseWriter, *http.Request) bool { return true } + +// Forward asks the site backend at URL, forwarding the request's cookies. +type Forward struct { + URL string + Client *http.Client + + mu sync.Mutex + cache map[string]time.Time // sha256(Cookie header) -> when it was confirmed +} + +// NewForward builds a Forward checker for validateURL, normally +// http://backend:8080/auth/validate-admin on the Docker network. +func NewForward(validateURL string) *Forward { + return &Forward{ + URL: validateURL, + // Short: this sits in front of every request that has cookies, and a + // backend that does not answer in a few seconds should be a refusal, + // not a hang. + Client: &http.Client{Timeout: 5 * time.Second}, + cache: map[string]time.Time{}, + } +} + +func (f *Forward) IsAdmin(w http.ResponseWriter, r *http.Request) bool { + cookie := r.Header.Get("Cookie") + if cookie == "" { + return false + } + sum := sha256.Sum256([]byte(cookie)) + key := hex.EncodeToString(sum[:]) + + f.mu.Lock() + confirmed, ok := f.cache[key] + f.mu.Unlock() + if ok && time.Since(confirmed) < cacheTTL { + return true + } + + req, err := http.NewRequestWithContext(r.Context(), http.MethodGet, f.URL, nil) + if err != nil { + log.Printf("[auth] building validate request: %v", err) + return false + } + req.Header.Set("Cookie", cookie) + resp, err := f.Client.Do(req) + if err != nil { + log.Printf("[auth] site backend unreachable: %v", err) + return false + } + defer resp.Body.Close() + + // Relayed whatever the verdict: a refresh that rotated the cookies is + // worth keeping even on a 403. + for _, c := range resp.Header.Values("Set-Cookie") { + w.Header().Add("Set-Cookie", c) + } + + if resp.StatusCode < 200 || resp.StatusCode > 299 { + return false + } + + f.mu.Lock() + defer f.mu.Unlock() + // Pruned on the way through; the map only grows with distinct admin + // sessions, so this is plenty. + for k, t := range f.cache { + if time.Since(t) >= cacheTTL { + delete(f.cache, k) + } + } + f.cache[key] = time.Now() + return true +} + +// Require refuses a non-admin with 401. It guards the REST admin routes. +func Require(c Checker) gin.HandlerFunc { + return func(ctx *gin.Context) { + if !c.IsAdmin(ctx.Writer, ctx.Request) { + ctx.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "admin access required"}) + return + } + ctx.Next() + } +} diff --git a/site/internal/auth/auth_test.go b/site/internal/auth/auth_test.go new file mode 100644 index 0000000..f5c3395 --- /dev/null +++ b/site/internal/auth/auth_test.go @@ -0,0 +1,100 @@ +package auth + +import ( + "net/http" + "net/http/httptest" + "sync/atomic" + "testing" +) + +// site fakes the backend's validate-admin: 200 for the "admin" session, +// 403 for any other cookie, 401 for none, and a rotated cookie on "stale". +func site(t *testing.T, calls *atomic.Int32) *httptest.Server { + t.Helper() + srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + calls.Add(1) + c, err := r.Cookie("access_token") + switch { + case err != nil: + w.WriteHeader(http.StatusUnauthorized) + case c.Value == "admin": + w.WriteHeader(http.StatusOK) + case c.Value == "stale": + http.SetCookie(w, &http.Cookie{Name: "access_token", Value: "fresh"}) + w.WriteHeader(http.StatusOK) + default: + w.WriteHeader(http.StatusForbidden) + } + })) + t.Cleanup(srv.Close) + return srv +} + +func ask(f *Forward, cookie string) (bool, *httptest.ResponseRecorder) { + r := httptest.NewRequest(http.MethodPost, "/usaco/api/problems", nil) + if cookie != "" { + r.Header.Set("Cookie", cookie) + } + w := httptest.NewRecorder() + return f.IsAdmin(w, r), w +} + +func TestForwardVerdicts(t *testing.T) { + var calls atomic.Int32 + f := NewForward(site(t, &calls).URL) + + cases := []struct { + name, cookie string + want bool + }{ + {"admin session", "access_token=admin", true}, + {"signed in, not admin", "access_token=someone", false}, + {"cookies but no session", "theme=dark", false}, + {"no cookies at all", "", false}, + } + for _, c := range cases { + t.Run(c.name, func(t *testing.T) { + if got, _ := ask(f, c.cookie); got != c.want { + t.Fatalf("IsAdmin = %v, want %v", got, c.want) + } + }) + } +} + +func TestForwardCachesOnlyYes(t *testing.T) { + var calls atomic.Int32 + f := NewForward(site(t, &calls).URL) + + ask(f, "access_token=admin") + ask(f, "access_token=admin") + if n := calls.Load(); n != 1 { + t.Fatalf("admin checked %d times, want 1 (second answer from cache)", n) + } + + calls.Store(0) + ask(f, "access_token=someone") + ask(f, "access_token=someone") + if n := calls.Load(); n != 2 { + t.Fatalf("refusal checked %d times, want 2 (refusals are not cached)", n) + } +} + +func TestForwardRelaysRefreshedCookies(t *testing.T) { + var calls atomic.Int32 + f := NewForward(site(t, &calls).URL) + + ok, w := ask(f, "access_token=stale") + if !ok { + t.Fatal("refreshed session refused") + } + if got := w.Header().Get("Set-Cookie"); got != "access_token=fresh" { + t.Fatalf("Set-Cookie = %q, want the backend's rotated cookie", got) + } +} + +func TestForwardBackendDownRefuses(t *testing.T) { + f := NewForward("http://127.0.0.1:1/auth/validate-admin") + if ok, _ := ask(f, "access_token=admin"); ok { + t.Fatal("admitted while the site backend was unreachable") + } +} diff --git a/site/internal/handlers/handlers.go b/site/internal/handlers/handlers.go new file mode 100644 index 0000000..60e9afb --- /dev/null +++ b/site/internal/handlers/handlers.go @@ -0,0 +1,335 @@ +// Package handlers is the site's REST API: the problem list and pages (public +// for solved problems, everything for the admin), the admin's edits, and the +// Gitea webhook that tells the server to pull. +package handlers + +import ( + "context" + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "errors" + "io" + "log" + "net/http" + "net/url" + "os" + "path/filepath" + "regexp" + "sort" + "strings" + "sync/atomic" + "time" + + "github.com/gin-gonic/gin" + + "adam-french.co.uk/usaco-site/internal/auth" + "adam-french.co.uk/usaco-site/internal/index" + "adam-french.co.uk/usaco-site/internal/repo" +) + +// Repo is the part of repo.Repo the handlers use, so tests can fake it. +type Repo interface { + Mutate(ctx context.Context, message string, edit func(dir string) error) error +} + +// Server holds the current index and what is needed to change it. +type Server struct { + Repo Repo + Checker auth.Checker + WebhookSecret string + // Pull asks for a sync. It must not block: the webhook answers at once + // and the sync runs in the background. + Pull func() + + idx atomic.Pointer[index.Index] +} + +// SetIndex swaps in a freshly built index. repo.Repo calls it (through +// Reload) under its lock after every sync and edit. +func (s *Server) SetIndex(idx *index.Index) { s.idx.Store(idx) } + +// Reload rebuilds the index from dir. It has repo.Repo's onChange signature. +func (s *Server) Reload(dir string) error { + idx, err := index.Build(dir) + if err != nil { + return err + } + s.SetIndex(idx) + log.Printf("[index] %d problems at %.12s", len(idx.Problems), idx.Head) + return nil +} + +// Index is the current snapshot; nil until the first sync has finished. +func (s *Server) Index() *index.Index { return s.idx.Load() } + +// Routes registers everything under api. +func (s *Server) Routes(api *gin.RouterGroup) { + admin := api.Group("", auth.Require(s.Checker)) + + api.GET("/health", s.health) + api.GET("/me", s.me) + api.GET("/problems", s.list) + api.GET("/problems/:name", s.get) + admin.PUT("/problems/:name/meta", s.updateMeta) + admin.POST("/problems/:name/status", s.setStatus) + api.POST("/hooks/gitea", s.webhook) +} + +func (s *Server) health(ctx *gin.Context) { + idx := s.Index() + if idx == nil { + ctx.JSON(http.StatusServiceUnavailable, gin.H{"status": "repository not loaded yet"}) + return + } + ctx.JSON(http.StatusOK, gin.H{"status": "ok", "head": idx.Head}) +} + +func (s *Server) me(ctx *gin.Context) { + ctx.JSON(http.StatusOK, gin.H{"admin": s.isAdmin(ctx)}) +} + +// visible says whether a problem may be shown to this caller: solved ones +// to anyone, the rest only to the admin. +func visible(p *index.Problem, admin bool) bool { + return admin || p.Status == index.Solved +} + +// isAdmin asks the checker. auth.Forward answers a request with no cookies +// (nearly every public visitor) without asking the site backend. +func (s *Server) isAdmin(ctx *gin.Context) bool { + return s.Checker.IsAdmin(ctx.Writer, ctx.Request) +} + +func (s *Server) list(ctx *gin.Context) { + idx := s.Index() + if idx == nil { + ctx.JSON(http.StatusServiceUnavailable, gin.H{"error": "repository not loaded yet"}) + return + } + admin := s.isAdmin(ctx) + out := []index.Summary{} + for _, p := range idx.Problems { + if visible(p, admin) { + out = append(out, p.Summary) + } + } + sort.Slice(out, func(i, j int) bool { return out[i].Name < out[j].Name }) + ctx.JSON(http.StatusOK, gin.H{"head": idx.Head, "admin": admin, "problems": out}) +} + +// The CLI's names are slugs. Checking the shape before any lookup keeps +// anything path-like ("..", "a/b") away from the filesystem. +var validName = regexp.MustCompile(`^[a-z0-9][a-z0-9._-]*$`) + +// lookup finds a problem the caller may see. A problem the caller may not +// see is a 404 like a missing one, so its existence does not leak. +func (s *Server) lookup(ctx *gin.Context, admin bool) (*index.Problem, bool) { + name := ctx.Param("name") + idx := s.Index() + if idx == nil { + ctx.JSON(http.StatusServiceUnavailable, gin.H{"error": "repository not loaded yet"}) + return nil, false + } + if !validName.MatchString(name) { + ctx.JSON(http.StatusNotFound, gin.H{"error": "no such problem"}) + return nil, false + } + p, ok := idx.Problems[name] + if !ok || !visible(p, admin) { + ctx.JSON(http.StatusNotFound, gin.H{"error": "no such problem"}) + return nil, false + } + return p, true +} + +func (s *Server) get(ctx *gin.Context) { + if p, ok := s.lookup(ctx, s.isAdmin(ctx)); ok { + ctx.JSON(http.StatusOK, p) + } +} + +// requestError is an edit that cannot be made, with the status to send. +type requestError struct { + status int + msg string +} + +func (e *requestError) Error() string { return e.msg } + +// mutate runs an edit through the repo and answers with the problem as it +// is afterwards (under its possibly new status). +func (s *Server) mutate(ctx *gin.Context, name, message string, edit func(dir string) error) { + c, cancel := context.WithTimeout(ctx.Request.Context(), 60*time.Second) + defer cancel() + err := s.Repo.Mutate(c, message, edit) + var re *requestError + switch { + case err == nil: + if p, ok := s.Index().Problems[name]; ok { + ctx.JSON(http.StatusOK, p) + } else { + ctx.JSON(http.StatusOK, gin.H{}) + } + case errors.As(err, &re): + ctx.JSON(re.status, gin.H{"error": re.msg}) + case errors.Is(err, repo.ErrRejected): + ctx.JSON(http.StatusConflict, gin.H{"error": "the repository changed while saving; try again"}) + default: + log.Printf("[edit] %s: %v", message, err) + ctx.JSON(http.StatusBadGateway, gin.H{"error": "could not save to git"}) + } +} + +// findOnDisk locates a problem in the freshly synced clone. Edits decide +// from the disk, not the index, because Mutate may replay them on a newer +// tip than the one the index was built from. +func findOnDisk(dir, name string) (status string, err error) { + for _, st := range index.Statuses { + if info, err := os.Stat(filepath.Join(dir, st, name)); err == nil && info.IsDir() { + return st, nil + } + } + return "", &requestError{http.StatusNotFound, "no such problem"} +} + +type metaBody struct { + URL *string `json:"url"` + Notes *string `json:"notes"` +} + +const maxNotes = 64 << 10 + +func (s *Server) updateMeta(ctx *gin.Context) { + p, ok := s.lookup(ctx, true) + if !ok { + return + } + var body metaBody + if err := ctx.ShouldBindJSON(&body); err != nil { + ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid JSON"}) + return + } + if body.URL != nil { + u := strings.TrimSpace(*body.URL) + if u != "" { + parsed, err := url.Parse(u) + if err != nil || (parsed.Scheme != "http" && parsed.Scheme != "https") || parsed.Host == "" || len(u) > 2048 { + ctx.JSON(http.StatusBadRequest, gin.H{"error": "url must be an http(s) link"}) + return + } + } + body.URL = &u + } + if body.Notes != nil && len(*body.Notes) > maxNotes { + ctx.JSON(http.StatusBadRequest, gin.H{"error": "notes are too long"}) + return + } + + name := p.Name + s.mutate(ctx, name, "Update "+name, func(dir string) error { + status, err := findOnDisk(dir, name) + if err != nil { + return err + } + pdir := filepath.Join(dir, status, name) + if body.URL != nil { + // Same format `usaco new --url` writes: the link and a newline. + if err := writeOrRemove(filepath.Join(pdir, ".url"), *body.URL); err != nil { + return err + } + } + if body.Notes != nil { + if err := writeOrRemove(filepath.Join(pdir, "notes.md"), *body.Notes); err != nil { + return err + } + } + return nil + }) +} + +// writeOrRemove writes content plus a trailing newline, or removes the file +// when content is blank, so clearing a field leaves no empty file behind. +func writeOrRemove(path, content string) error { + content = strings.TrimRight(content, " \t\r\n") + if content == "" { + if err := os.Remove(path); err != nil && !os.IsNotExist(err) { + return err + } + return nil + } + return os.WriteFile(path, []byte(content+"\n"), 0o644) +} + +type statusBody struct { + To string `json:"to"` +} + +// The commit subjects match the CLI's: `usaco done` commits "Solve ". +var statusVerb = map[string]string{ + index.Solved: "Solve", + index.Skipped: "Skip", + index.Solving: "Reopen", +} + +func (s *Server) setStatus(ctx *gin.Context) { + p, ok := s.lookup(ctx, true) + if !ok { + return + } + var body statusBody + if err := ctx.ShouldBindJSON(&body); err != nil { + ctx.JSON(http.StatusBadRequest, gin.H{"error": "invalid JSON"}) + return + } + verb, ok := statusVerb[body.To] + if !ok { + ctx.JSON(http.StatusBadRequest, gin.H{"error": "to must be solving, solved or skipped"}) + return + } + name := p.Name + s.mutate(ctx, name, verb+" "+name, func(dir string) error { + from, err := findOnDisk(dir, name) + if err != nil { + return err + } + if from == body.To { + return nil + } + if err := os.MkdirAll(filepath.Join(dir, body.To), 0o755); err != nil { + return err + } + return os.Rename(filepath.Join(dir, from, name), filepath.Join(dir, body.To, name)) + }) +} + +// webhook accepts Gitea's push hook. Gitea signs the body with the shared +// secret (HMAC-SHA256, hex, in X-Gitea-Signature). The body itself is not +// read beyond that: any push to the repo is a reason to pull. +func (s *Server) webhook(ctx *gin.Context) { + if s.WebhookSecret == "" { + ctx.JSON(http.StatusServiceUnavailable, gin.H{"error": "webhook not configured"}) + return + } + body, err := io.ReadAll(io.LimitReader(ctx.Request.Body, 5<<20)) + if err != nil { + ctx.JSON(http.StatusBadRequest, gin.H{"error": "unreadable body"}) + return + } + if !validSignature(s.WebhookSecret, body, ctx.GetHeader("X-Gitea-Signature")) { + ctx.JSON(http.StatusUnauthorized, gin.H{"error": "bad signature"}) + return + } + s.Pull() + ctx.JSON(http.StatusAccepted, gin.H{"status": "pull queued"}) +} + +func validSignature(secret string, body []byte, sig string) bool { + got, err := hex.DecodeString(strings.TrimPrefix(sig, "sha256=")) + if err != nil || len(got) == 0 { + return false + } + mac := hmac.New(sha256.New, []byte(secret)) + mac.Write(body) + return hmac.Equal(got, mac.Sum(nil)) +} diff --git a/site/internal/handlers/handlers_test.go b/site/internal/handlers/handlers_test.go new file mode 100644 index 0000000..d66158f --- /dev/null +++ b/site/internal/handlers/handlers_test.go @@ -0,0 +1,210 @@ +package handlers + +import ( + "context" + "crypto/hmac" + "crypto/sha256" + "encoding/hex" + "encoding/json" + "net/http" + "net/http/httptest" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" + + "github.com/gin-gonic/gin" +) + +// cookieChecker: the admin is whoever sends the cookie "admin=1". +type cookieChecker struct{} + +func (cookieChecker) IsAdmin(_ http.ResponseWriter, r *http.Request) bool { + c, err := r.Cookie("admin") + return err == nil && c.Value == "1" +} + +// dirRepo applies edits straight to a work tree and reindexes, standing in +// for repo.Repo without a remote. +type dirRepo struct { + dir string + srv *Server + msg []string +} + +func (d *dirRepo) Mutate(_ context.Context, message string, edit func(string) error) error { + if err := edit(d.dir); err != nil { + return err + } + d.msg = append(d.msg, message) + return d.srv.Reload(d.dir) +} + +func setup(t *testing.T) (*gin.Engine, *dirRepo, *int) { + t.Helper() + gin.SetMode(gin.TestMode) + dir := t.TempDir() + for _, p := range []string{"solved/moocast/main.cpp", "solving/watermelon/main.cpp"} { + os.MkdirAll(filepath.Join(dir, filepath.Dir(p)), 0o755) + os.WriteFile(filepath.Join(dir, p), []byte("int main() {}\n"), 0o644) + } + for _, args := range [][]string{{"init", "--quiet"}, {"add", "-A"}, {"-c", "user.name=t", "-c", "user.email=t@t", "commit", "--quiet", "-m", "init"}} { + cmd := exec.Command("git", args...) + cmd.Dir = dir + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("git %v: %v\n%s", args, err, out) + } + } + + pulls := 0 + srv := &Server{Checker: cookieChecker{}, WebhookSecret: "s3cret", Pull: func() { pulls++ }} + repo := &dirRepo{dir: dir, srv: srv} + srv.Repo = repo + if err := srv.Reload(dir); err != nil { + t.Fatal(err) + } + r := gin.New() + srv.Routes(r.Group("/usaco/api")) + return r, repo, &pulls +} + +func do(r *gin.Engine, method, path, body string, admin bool, headers ...string) *httptest.ResponseRecorder { + req := httptest.NewRequest(method, path, strings.NewReader(body)) + if admin { + req.Header.Set("Cookie", "admin=1") + } + for i := 0; i+1 < len(headers); i += 2 { + req.Header.Set(headers[i], headers[i+1]) + } + rec := httptest.NewRecorder() + r.ServeHTTP(rec, req) + return rec +} + +func names(t *testing.T, rec *httptest.ResponseRecorder) []string { + t.Helper() + var body struct { + Problems []struct{ Name string } `json:"problems"` + } + if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil { + t.Fatal(err) + } + var out []string + for _, p := range body.Problems { + out = append(out, p.Name) + } + return out +} + +func TestVisibility(t *testing.T) { + r, _, _ := setup(t) + + if got := names(t, do(r, "GET", "/usaco/api/problems", "", false)); len(got) != 1 || got[0] != "moocast" { + t.Fatalf("public list = %v, want only the solved problem", got) + } + if got := names(t, do(r, "GET", "/usaco/api/problems", "", true)); len(got) != 2 { + t.Fatalf("admin list = %v, want both", got) + } + if rec := do(r, "GET", "/usaco/api/problems/watermelon", "", false); rec.Code != 404 { + t.Fatalf("public GET of an unsolved problem = %d, want 404", rec.Code) + } + if rec := do(r, "GET", "/usaco/api/problems/watermelon", "", true); rec.Code != 200 { + t.Fatalf("admin GET of an unsolved problem = %d, want 200", rec.Code) + } + if rec := do(r, "GET", "/usaco/api/problems/moocast", "", false); rec.Code != 200 { + t.Fatalf("public GET of a solved problem = %d, want 200", rec.Code) + } +} + +func TestNameValidation(t *testing.T) { + r, _, _ := setup(t) + for _, name := range []string{"..", ".git", "Moocast", "%2e%2e", "a%2Fb"} { + if rec := do(r, "GET", "/usaco/api/problems/"+name, "", true); rec.Code != 404 { + t.Errorf("GET %q = %d, want 404", name, rec.Code) + } + } +} + +func TestWritesNeedAdmin(t *testing.T) { + r, repo, _ := setup(t) + if rec := do(r, "POST", "/usaco/api/problems/moocast/status", `{"to":"skipped"}`, false); rec.Code != 401 { + t.Fatalf("anonymous status change = %d, want 401", rec.Code) + } + if rec := do(r, "PUT", "/usaco/api/problems/moocast/meta", `{"notes":"x"}`, false); rec.Code != 401 { + t.Fatalf("anonymous meta edit = %d, want 401", rec.Code) + } + if len(repo.msg) != 0 { + t.Fatalf("refused writes still committed %v", repo.msg) + } +} + +func TestStatusChange(t *testing.T) { + r, repo, _ := setup(t) + rec := do(r, "POST", "/usaco/api/problems/watermelon/status", `{"to":"solved"}`, true) + if rec.Code != 200 || !strings.Contains(rec.Body.String(), `"status":"solved"`) { + t.Fatalf("solve = %d %s", rec.Code, rec.Body) + } + if _, err := os.Stat(filepath.Join(repo.dir, "solved", "watermelon", "main.cpp")); err != nil { + t.Fatal("directory was not moved") + } + if len(repo.msg) != 1 || repo.msg[0] != "Solve watermelon" { + t.Fatalf("commit messages = %v, want the CLI's \"Solve watermelon\"", repo.msg) + } + if rec := do(r, "POST", "/usaco/api/problems/watermelon/status", `{"to":"elsewhere"}`, true); rec.Code != 400 { + t.Fatalf("bad status = %d, want 400", rec.Code) + } +} + +func TestMetaEdit(t *testing.T) { + r, repo, _ := setup(t) + pdir := filepath.Join(repo.dir, "solved", "moocast") + + rec := do(r, "PUT", "/usaco/api/problems/moocast/meta", `{"url":" https://usaco.org/x ","notes":"# idea\n"}`, true) + if rec.Code != 200 { + t.Fatalf("meta = %d %s", rec.Code, rec.Body) + } + if b, _ := os.ReadFile(filepath.Join(pdir, ".url")); string(b) != "https://usaco.org/x\n" { + t.Fatalf(".url = %q", b) + } + if b, _ := os.ReadFile(filepath.Join(pdir, "notes.md")); string(b) != "# idea\n" { + t.Fatalf("notes.md = %q", b) + } + + // Clearing a field removes its file; leaving one out leaves it alone. + do(r, "PUT", "/usaco/api/problems/moocast/meta", `{"notes":""}`, true) + if _, err := os.Stat(filepath.Join(pdir, "notes.md")); err == nil { + t.Fatal("clearing notes left notes.md") + } + if _, err := os.Stat(filepath.Join(pdir, ".url")); err != nil { + t.Fatal("an edit without url removed .url") + } + + if rec := do(r, "PUT", "/usaco/api/problems/moocast/meta", `{"url":"javascript:alert(1)"}`, true); rec.Code != 400 { + t.Fatalf("javascript: url = %d, want 400", rec.Code) + } +} + +func TestWebhookSignature(t *testing.T) { + r, _, pulls := setup(t) + body := `{"ref":"refs/heads/main"}` + mac := hmac.New(sha256.New, []byte("s3cret")) + mac.Write([]byte(body)) + good := hex.EncodeToString(mac.Sum(nil)) + + if rec := do(r, "POST", "/usaco/api/hooks/gitea", body, false, "X-Gitea-Signature", "00"+good[2:]); rec.Code != 401 { + t.Fatalf("bad signature = %d, want 401", rec.Code) + } + if rec := do(r, "POST", "/usaco/api/hooks/gitea", body, false); rec.Code != 401 { + t.Fatalf("no signature = %d, want 401", rec.Code) + } + if *pulls != 0 { + t.Fatal("an unsigned hook triggered a pull") + } + if rec := do(r, "POST", "/usaco/api/hooks/gitea", body, false, "X-Gitea-Signature", good); rec.Code != 202 { + t.Fatalf("good signature = %d, want 202", rec.Code) + } + if *pulls != 1 { + t.Fatalf("pulls = %d, want 1", *pulls) + } +} diff --git a/site/internal/handlers/spa.go b/site/internal/handlers/spa.go new file mode 100644 index 0000000..26999d5 --- /dev/null +++ b/site/internal/handlers/spa.go @@ -0,0 +1,65 @@ +package handlers + +import ( + "net/http" + "os" + "path" + "path/filepath" + "strings" + + "github.com/gin-gonic/gin" +) + +// SPA serves the built Vue app from dir for every GET under base that no API +// route claimed. It is installed as gin's NoRoute handler rather than as a +// base+"/*path" route because gin will not let a catch-all sit beside the +// /api routes at the same level. +// +// History-mode routing means a path such as /usaco/p/moocast is a page of the app, +// not a file, so anything that is not a file in dir gets index.html — except +// under /api/ and /assets/, where a miss is a real 404: an API typo should +// not come back as a page of HTML, and neither should a stale asset hash. +// +// Caching: Vite fingerprints everything under assets/, so those are cached +// for a year; index.html is never cached, so a deploy is picked up on the +// next load. +func SPA(dir, base string) gin.HandlerFunc { + return func(ctx *gin.Context) { + p := ctx.Request.URL.Path + if ctx.Request.Method != http.MethodGet && ctx.Request.Method != http.MethodHead { + ctx.JSON(http.StatusNotFound, gin.H{"error": "not found"}) + return + } + if p == base { + ctx.Redirect(http.StatusMovedPermanently, base+"/") + return + } + rel, ok := strings.CutPrefix(p, base+"/") + if !ok || strings.HasPrefix(rel, "api/") { + ctx.JSON(http.StatusNotFound, gin.H{"error": "not found"}) + return + } + + // path.Clean on a rooted path cannot climb above the root, so the + // result always stays inside dir. + rel = strings.TrimPrefix(path.Clean("/"+rel), "/") + if rel != "" { + file := filepath.Join(dir, filepath.FromSlash(rel)) + if info, err := os.Stat(file); err == nil && !info.IsDir() { + if strings.HasPrefix(rel, "assets/") { + ctx.Header("Cache-Control", "public, max-age=31536000, immutable") + } else { + ctx.Header("Cache-Control", "no-cache") + } + ctx.File(file) + return + } + if strings.HasPrefix(rel, "assets/") { + ctx.Status(http.StatusNotFound) + return + } + } + ctx.Header("Cache-Control", "no-cache") + ctx.File(filepath.Join(dir, "index.html")) + } +} diff --git a/site/internal/handlers/spa_test.go b/site/internal/handlers/spa_test.go new file mode 100644 index 0000000..d08463a --- /dev/null +++ b/site/internal/handlers/spa_test.go @@ -0,0 +1,61 @@ +package handlers + +import ( + "net/http" + "net/http/httptest" + "os" + "path/filepath" + "testing" + + "github.com/gin-gonic/gin" +) + +func TestSPA(t *testing.T) { + gin.SetMode(gin.TestMode) + dir := t.TempDir() + os.MkdirAll(filepath.Join(dir, "assets"), 0o755) + os.WriteFile(filepath.Join(dir, "index.html"), []byte("index"), 0o644) + os.WriteFile(filepath.Join(dir, "assets", "app-1a2b.js"), []byte("js"), 0o644) + os.WriteFile(filepath.Join(dir, "robots.txt"), []byte("robots"), 0o644) + // Outside dir: must never be reachable. + os.WriteFile(filepath.Join(filepath.Dir(dir), "secret"), []byte("secret"), 0o644) + + r := gin.New() + r.GET("/usaco/api/health", func(c *gin.Context) { c.String(http.StatusOK, "ok") }) + r.NoRoute(SPA(dir, "/usaco")) + + cases := []struct { + method, path string + code int + body string + cache string + }{ + {"GET", "/usaco/", 200, "index", "no-cache"}, + {"GET", "/usaco/p/moocast", 200, "index", "no-cache"}, + {"GET", "/usaco/stats/anything", 200, "index", "no-cache"}, + {"GET", "/usaco/assets/app-1a2b.js", 200, "js", "public, max-age=31536000, immutable"}, + {"GET", "/usaco/robots.txt", 200, "robots", "no-cache"}, + {"GET", "/usaco/api/health", 200, "ok", ""}, + {"GET", "/usaco/api/nope", 404, `{"error":"not found"}`, ""}, + {"GET", "/usaco/assets/gone.js", 404, "404 page not found", ""}, + // net/http refuses a path that climbs, before anything is read. + {"GET", "/usaco/../secret", 400, "invalid URL path\n", ""}, + {"GET", "/usaco/%2e%2e/secret", 400, "invalid URL path\n", ""}, + {"POST", "/usaco/p/moocast", 404, `{"error":"not found"}`, ""}, + {"GET", "/elsewhere", 404, `{"error":"not found"}`, ""}, + } + for _, c := range cases { + rec := httptest.NewRecorder() + r.ServeHTTP(rec, httptest.NewRequest(c.method, c.path, nil)) + if rec.Code != c.code || rec.Body.String() != c.body || rec.Header().Get("Cache-Control") != c.cache { + t.Errorf("%s %s = %d %q (cache %q), want %d %q (cache %q)", + c.method, c.path, rec.Code, rec.Body, rec.Header().Get("Cache-Control"), c.code, c.body, c.cache) + } + } + + rec := httptest.NewRecorder() + r.ServeHTTP(rec, httptest.NewRequest("GET", "/usaco", nil)) + if rec.Code != http.StatusMovedPermanently || rec.Header().Get("Location") != "/usaco/" { + t.Errorf("GET /usaco = %d to %q, want a redirect to /usaco/", rec.Code, rec.Header().Get("Location")) + } +} diff --git a/site/internal/index/index.go b/site/internal/index/index.go new file mode 100644 index 0000000..d89957d --- /dev/null +++ b/site/internal/index/index.go @@ -0,0 +1,424 @@ +// Package index reads a clone of the usaco repository into memory: every +// problem, its files and tests, and the dates git knows about it. +// +// The layout is the CLI's (README.md at the repo root): solving/, solved/ +// and skipped//, each with a solution (main.cpp, sol.py...), an .in +// the CLI wires up, tests/N.in + N.out, an optional .url and an optional +// notes.md. The repo is small, so everything, file contents included, is +// read on each rebuild, and a rebuild only happens when the clone changes. +package index + +import ( + "bufio" + "bytes" + "fmt" + "io" + "net/url" + "os" + "os/exec" + "path/filepath" + "sort" + "strconv" + "strings" + "time" +) + +// The three status directories, in the order the CLI searches them. +const ( + Solving = "solving" + Solved = "solved" + Skipped = "skipped" +) + +var Statuses = []string{Solving, Solved, Skipped} + +// MaxFileSize caps what is held for one file. Test inputs can be large and +// nobody reads a megabyte in a browser; the rest is cut and marked. +const MaxFileSize = 64 << 10 + +// File is a solution file or a test half. +type File struct { + Name string `json:"name"` + Lang string `json:"lang,omitempty"` + Content string `json:"content"` + Truncated bool `json:"truncated,omitempty"` +} + +// Test is one saved case. Output is nil when the expected output is missing +// (tests/*.out were gitignored before the site existed). +type Test struct { + Name string `json:"name"` + Input File `json:"input"` + Output *File `json:"output,omitempty"` +} + +// Commit is one entry of a problem's history. +type Commit struct { + Hash string `json:"hash"` + Date time.Time `json:"date"` + Subject string `json:"subject"` +} + +// Summary is what the list shows. +type Summary struct { + Name string `json:"name"` + Status string `json:"status"` + URL string `json:"url,omitempty"` + Source string `json:"source,omitempty"` + Langs []string `json:"langs"` + Tests int `json:"tests"` + HasNotes bool `json:"hasNotes"` + FirstSeen *time.Time `json:"firstSeen,omitempty"` + SolvedAt *time.Time `json:"solvedAt,omitempty"` + LastTouched *time.Time `json:"lastTouched,omitempty"` +} + +// Problem is everything known about one problem. +type Problem struct { + Summary + IO string `json:"io,omitempty"` + Notes string `json:"notes"` + Files []File `json:"files"` + Sample *File `json:"sample,omitempty"` + TestSet []Test `json:"testCases"` + History []Commit `json:"history"` +} + +// Index is one snapshot of the clone. +type Index struct { + Head string + Built time.Time + Problems map[string]*Problem +} + +// Build reads dir, a git work tree. +func Build(dir string) (*Index, error) { + idx := &Index{Built: time.Now(), Problems: map[string]*Problem{}} + for _, status := range Statuses { + entries, err := os.ReadDir(filepath.Join(dir, status)) + if os.IsNotExist(err) { + continue + } + if err != nil { + return nil, err + } + for _, e := range entries { + if !e.IsDir() || strings.HasPrefix(e.Name(), ".") { + continue + } + // The CLI never lets one name exist in two status dirs; if a + // hand edit did it anyway, the first in search order wins, as + // in find_problem. + if _, dup := idx.Problems[e.Name()]; dup { + continue + } + p, err := readProblem(filepath.Join(dir, status, e.Name()), status) + if err != nil { + return nil, fmt.Errorf("%s/%s: %w", status, e.Name(), err) + } + idx.Problems[p.Name] = p + } + } + head, err := gitOut(dir, "rev-parse", "HEAD") + if err != nil { + return nil, err + } + idx.Head = strings.TrimSpace(head) + if err := addHistory(dir, idx); err != nil { + return nil, err + } + return idx, nil +} + +// solution languages, by extension. Anything else at the top of a problem +// dir (binaries, .bak, the .in/.out) is not a solution. +var langs = map[string]string{ + ".cpp": "cpp", ".cc": "cpp", ".c": "c", ".h": "cpp", ".hpp": "cpp", + ".py": "python", ".java": "java", ".rs": "rust", ".go": "go", +} + +func readProblem(pdir, status string) (*Problem, error) { + p := &Problem{Summary: Summary{Name: filepath.Base(pdir), Status: status, Langs: []string{}}, Files: []File{}, TestSet: []Test{}, History: []Commit{}} + + entries, err := os.ReadDir(pdir) + if err != nil { + return nil, err + } + seenLang := map[string]bool{} + for _, e := range entries { + name := e.Name() + if e.IsDir() { + continue + } + switch { + case name == ".url": + b, _ := os.ReadFile(filepath.Join(pdir, name)) + p.URL = strings.TrimSpace(string(b)) + case name == "notes.md": + b, _ := os.ReadFile(filepath.Join(pdir, name)) + p.Notes = string(b) + case strings.HasSuffix(name, ".in") && p.IO == "": + // The first *.in, as detect_io in lib/common.sh picks it. + p.IO = strings.TrimSuffix(name, ".in") + f, err := readFile(filepath.Join(pdir, name), "") + if err != nil { + return nil, err + } + p.Sample = &f + default: + if lang, ok := langs[filepath.Ext(name)]; ok { + f, err := readFile(filepath.Join(pdir, name), lang) + if err != nil { + return nil, err + } + p.Files = append(p.Files, f) + if !seenLang[lang] { + seenLang[lang] = true + p.Langs = append(p.Langs, lang) + } + } + } + } + // main.cpp first: it is the CLI's solution, anything else is a side + // experiment (sol.py) or a helper. + sort.SliceStable(p.Files, func(i, j int) bool { + return p.Files[i].Name == "main.cpp" && p.Files[j].Name != "main.cpp" + }) + if p.Sample != nil && strings.TrimSpace(p.Sample.Content) == "" { + p.Sample = nil + } + + tests, err := readTests(filepath.Join(pdir, "tests")) + if err != nil { + return nil, err + } + p.TestSet = tests + p.Tests = len(tests) + p.HasNotes = strings.TrimSpace(p.Notes) != "" + p.Source = Source(p.URL) + return p, nil +} + +// readTests pairs tests/N.in with tests/N.out, numerically ordered as +// `usaco test` runs them. +func readTests(tdir string) ([]Test, error) { + entries, err := os.ReadDir(tdir) + if os.IsNotExist(err) { + return []Test{}, nil + } + if err != nil { + return nil, err + } + tests := []Test{} + for _, e := range entries { + base, ok := strings.CutSuffix(e.Name(), ".in") + if !ok || e.IsDir() { + continue + } + in, err := readFile(filepath.Join(tdir, e.Name()), "") + if err != nil { + return nil, err + } + t := Test{Name: base, Input: in} + if out, err := readFile(filepath.Join(tdir, base+".out"), ""); err == nil { + t.Output = &out + } + tests = append(tests, t) + } + sort.Slice(tests, func(i, j int) bool { + a, aerr := strconv.Atoi(tests[i].Name) + b, berr := strconv.Atoi(tests[j].Name) + if aerr == nil && berr == nil { + return a < b + } + return tests[i].Name < tests[j].Name + }) + return tests, nil +} + +func readFile(path, lang string) (File, error) { + f, err := os.Open(path) + if err != nil { + return File{}, err + } + defer f.Close() + b, err := io.ReadAll(io.LimitReader(f, MaxFileSize+1)) + if err != nil { + return File{}, err + } + file := File{Name: filepath.Base(path), Lang: lang} + if len(b) > MaxFileSize { + b = b[:MaxFileSize] + file.Truncated = true + } + file.Content = string(b) + return file, nil +} + +// Source names the judge a problem URL points at, for the list's badge. +func Source(raw string) string { + if raw == "" { + return "" + } + u, err := url.Parse(raw) + if err != nil || u.Host == "" { + return "" + } + host := strings.TrimPrefix(strings.ToLower(u.Hostname()), "www.") + known := map[string]string{ + "usaco.org": "USACO", + "usaco.guide": "USACO Guide", + "cses.fi": "CSES", + "leetcode.com": "LeetCode", + "codeforces.com": "Codeforces", + "atcoder.jp": "AtCoder", + "kattis.com": "Kattis", + "open.kattis.com": "Kattis", + "hackerrank.com": "HackerRank", + "spoj.com": "SPOJ", + "onlinejudge.org": "UVa", + } + if s, ok := known[host]; ok { + return s + } + return host +} + +// addHistory walks the whole log once, oldest first, and gives each problem +// its commits, first and last dates, and solve date. +// +// The solve date is the last time the problem's solved// went from +// empty to non-empty: `usaco done` (a move into solved/) and a reopen + +// re-solve both count, adding a test to an already solved problem does not. +// It is taken from git rather than file mtimes (what `usaco stats` uses) +// because a fresh clone has every mtime set to the clone time. +func addHistory(dir string, idx *Index) error { + // --no-renames: a move between status dirs is then a delete plus an + // add, which is exactly what the solved-file counting below wants. + out, err := gitOut(dir, "-c", "core.quotePath=false", "log", "--reverse", "--no-renames", + "--format=%x00%H%x09%aI%x09%s", "--name-status") + if err != nil { + // A repository with no commits yet has no history to add. + if strings.Contains(err.Error(), "does not have any commits") { + return nil + } + return err + } + + solvedFiles := map[string]map[string]bool{} // name -> paths under solved// + var c Commit + touched := map[string]bool{} + becameSolved := map[string]bool{} + + flush := func() { + for name := range touched { + p, ok := idx.Problems[name] + if !ok { + continue + } + d := c.Date + if p.FirstSeen == nil { + p.FirstSeen = &d + } + p.LastTouched = &d + p.History = append(p.History, c) + } + for name := range becameSolved { + if p, ok := idx.Problems[name]; ok && len(solvedFiles[name]) > 0 { + d := c.Date + p.SolvedAt = &d + } + } + touched = map[string]bool{} + becameSolved = map[string]bool{} + } + + sc := bufio.NewScanner(bytes.NewReader([]byte(out))) + sc.Buffer(make([]byte, 1<<20), 1<<20) + started := false + for sc.Scan() { + line := sc.Text() + if rest, ok := strings.CutPrefix(line, "\x00"); ok { + if started { + flush() + } + started = true + parts := strings.SplitN(rest, "\t", 3) + if len(parts) != 3 { + return fmt.Errorf("unexpected git log line %q", line) + } + date, err := time.Parse(time.RFC3339, parts[1]) + if err != nil { + return err + } + c = Commit{Hash: parts[0][:min(len(parts[0]), 12)], Date: date, Subject: parts[2]} + continue + } + if line == "" { + continue + } + fields := strings.Split(line, "\t") + if len(fields) < 2 { + continue + } + kind, path := fields[0], fields[len(fields)-1] + segs := strings.SplitN(path, "/", 3) + if len(segs) < 3 || !isStatus(segs[0]) { + continue + } + name := segs[1] + touched[name] = true + if segs[0] != Solved { + continue + } + set := solvedFiles[name] + if set == nil { + set = map[string]bool{} + solvedFiles[name] = set + } + wasEmpty := len(set) == 0 + switch kind[0] { + case 'D': + delete(set, path) + default: // A, M, T (and C if it ever appears) + set[path] = true + } + if wasEmpty && len(set) > 0 { + becameSolved[name] = true + } + } + if started { + flush() + } + if err := sc.Err(); err != nil { + return err + } + + for _, p := range idx.Problems { + // Newest first for display. + for i, j := 0, len(p.History)-1; i < j; i, j = i+1, j-1 { + p.History[i], p.History[j] = p.History[j], p.History[i] + } + // A problem that is solved on disk but whose solved/ files never + // showed up in the log (uncommitted, in development) has no date. + if p.Status != Solved { + p.SolvedAt = nil + } + } + return nil +} + +func isStatus(s string) bool { + return s == Solving || s == Solved || s == Skipped +} + +func gitOut(dir string, args ...string) (string, error) { + cmd := exec.Command("git", args...) + cmd.Dir = dir + var out, errb bytes.Buffer + cmd.Stdout, cmd.Stderr = &out, &errb + if err := cmd.Run(); err != nil { + return "", fmt.Errorf("git %s: %w: %s", args[0], err, strings.TrimSpace(errb.String())) + } + return out.String(), nil +} diff --git a/site/internal/index/index_test.go b/site/internal/index/index_test.go new file mode 100644 index 0000000..8a7afad --- /dev/null +++ b/site/internal/index/index_test.go @@ -0,0 +1,138 @@ +package index + +import ( + "os" + "os/exec" + "path/filepath" + "testing" + "time" +) + +// fixture builds a repo the way the CLI would have, with fixed commit dates: +// +// day 1 new moocast (solving), new watermelon (solving) +// day 2 done moocast -> solved +// day 3 skip watermelon -> skipped +// day 4 add a test to moocast (must not move its solve date) +func fixture(t *testing.T) string { + t.Helper() + dir := t.TempDir() + day := func(n int) string { return time.Date(2026, 9, n, 12, 0, 0, 0, time.UTC).Format(time.RFC3339) } + git := func(date string, args ...string) { + t.Helper() + cmd := exec.Command("git", args...) + cmd.Dir = dir + cmd.Env = append(os.Environ(), + "GIT_AUTHOR_NAME=t", "GIT_AUTHOR_EMAIL=t@t", "GIT_COMMITTER_NAME=t", "GIT_COMMITTER_EMAIL=t@t", + "GIT_AUTHOR_DATE="+date, "GIT_COMMITTER_DATE="+date) + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("git %v: %v\n%s", args, err, out) + } + } + write := func(path, content string) { + t.Helper() + p := filepath.Join(dir, path) + os.MkdirAll(filepath.Dir(p), 0o755) + if err := os.WriteFile(p, []byte(content), 0o644); err != nil { + t.Fatal(err) + } + } + commit := func(n int, msg string) { + git(day(n), "add", "-A") + git(day(n), "commit", "--quiet", "-m", msg) + } + move := func(from, to string) { + os.MkdirAll(filepath.Join(dir, filepath.Dir(to)), 0o755) + if err := os.Rename(filepath.Join(dir, from), filepath.Join(dir, to)); err != nil { + t.Fatal(err) + } + } + + git(day(1), "init", "--quiet", "--initial-branch=main") + write("template.cpp", "// template\n") + write("solving/moocast/main.cpp", "int main() {}\n") + write("solving/moocast/moocast.in", "4\n1 2 3\n") + write("solving/moocast/sol.py", "print(1)\n") + write("solving/moocast/.url", "https://usaco.org/index.php?page=viewproblem2&cpid=668\n") + write("solving/moocast/tests/1.in", "a\n") + write("solving/moocast/tests/1.out", "b\n") + write("solving/moocast/tests/10.in", "c\n") + write("solving/moocast/tests/2.in", "d\n") + write("solving/watermelon/main.cpp", "int main() {}\n") + write("solving/watermelon/watermelon.in", "") + commit(1, "new problems") + + move("solving/moocast", "solved/moocast") + commit(2, "Solve moocast") + + move("solving/watermelon", "skipped/watermelon") + commit(3, "Skip watermelon") + + write("solved/moocast/tests/3.in", "e\n") + write("solved/moocast/notes.md", "union find\n") + commit(4, "Add a test") + return dir +} + +func TestBuild(t *testing.T) { + idx, err := Build(fixture(t)) + if err != nil { + t.Fatal(err) + } + if len(idx.Problems) != 2 { + t.Fatalf("got %d problems, want 2", len(idx.Problems)) + } + + m := idx.Problems["moocast"] + if m.Status != Solved || m.IO != "moocast" || m.Source != "USACO" || !m.HasNotes { + t.Fatalf("moocast summary wrong: %+v", m.Summary) + } + if len(m.Files) != 2 || m.Files[0].Name != "main.cpp" || m.Files[1].Lang != "python" { + t.Fatalf("moocast files = %+v, want main.cpp then sol.py", m.Files) + } + if m.Sample == nil || m.Sample.Content != "4\n1 2 3\n" { + t.Fatalf("moocast sample = %+v", m.Sample) + } + var names []string + for _, tc := range m.TestSet { + names = append(names, tc.Name) + } + if got := len(names); got != 4 || names[0] != "1" || names[1] != "2" || names[2] != "3" || names[3] != "10" { + t.Fatalf("test order = %v, want numeric 1 2 3 10", names) + } + if m.TestSet[0].Output == nil || m.TestSet[1].Output != nil { + t.Fatal("test outputs not paired: 1 has one, 2 does not") + } + + day := func(n int) time.Time { return time.Date(2026, 9, n, 12, 0, 0, 0, time.UTC) } + if m.SolvedAt == nil || !m.SolvedAt.Equal(day(2)) { + t.Fatalf("moocast solvedAt = %v, want day 2 (adding a test later does not count)", m.SolvedAt) + } + if !m.FirstSeen.Equal(day(1)) || !m.LastTouched.Equal(day(4)) { + t.Fatalf("moocast first/last = %v / %v", m.FirstSeen, m.LastTouched) + } + if len(m.History) != 3 || m.History[0].Subject != "Add a test" { + t.Fatalf("moocast history = %+v, want 3 commits newest first", m.History) + } + + w := idx.Problems["watermelon"] + if w.Status != Skipped || w.SolvedAt != nil || w.Sample != nil { + t.Fatalf("watermelon = %+v, want skipped, unsolved, no sample (empty .in)", w.Summary) + } +} + +func TestSource(t *testing.T) { + cases := map[string]string{ + "": "", + "not a url": "", + "https://cses.fi/problemset/task/1": "CSES", + "https://www.usaco.org/index.php": "USACO", + "https://leetcode.com/problems/x/": "LeetCode", + "https://example.com/problem/1": "example.com", + } + for in, want := range cases { + if got := Source(in); got != want { + t.Errorf("Source(%q) = %q, want %q", in, got, want) + } + } +} diff --git a/site/internal/repo/repo.go b/site/internal/repo/repo.go new file mode 100644 index 0000000..ccda65f --- /dev/null +++ b/site/internal/repo/repo.go @@ -0,0 +1,237 @@ +// Package repo keeps the server's clone of the usaco repository in step with +// the remote, and turns edits from the web into commits pushed back to it. +// +// Git is the only store: the remote (adamf/usaco on the site's Gitea) is the +// source of truth and the clone is a cache of it. So a sync is fetch + hard +// reset, never a merge, and an edit is "sync, change files, commit, push" +// under one lock. If the push is refused because someone pushed in between +// (the CLI's `usaco sync`), the edit is replayed once on the new tip. +// +// It shells out to the git binary rather than using a Go git library: fetch, +// reset and push over HTTP with a token are one line each that way, and the +// behaviour is exactly what the CLI side sees. +package repo + +import ( + "bytes" + "context" + "errors" + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + "sync" +) + +// ErrRejected means the push was refused twice, normally because the remote +// kept moving. The caller should ask the user to try again. +var ErrRejected = errors.New("push rejected by the remote") + +// Config says where the clone lives and how to talk to the remote. +type Config struct { + Dir string // the working clone, e.g. /data/repo + Remote string // clone URL; a file:// URL works for development + Branch string + + // Token, when set, is given to git as the password for HTTP remotes + // (through GIT_ASKPASS), so it never lands in .git/config or a URL. + User string + Token string + + AuthorName string + AuthorEmail string + + // Push false keeps commits local. Syncs then rebase onto the remote + // instead of resetting, so those commits survive. + Push bool +} + +// Repo serializes every git operation on the clone. +type Repo struct { + cfg Config + askpass string + + // onChange runs under the lock after every sync or edit, with the clone + // in a consistent state, so the index is never built from a half-reset + // tree. + onChange func(dir string) error + + mu sync.Mutex +} + +// New prepares a Repo. Nothing touches the network until Sync. +func New(cfg Config, onChange func(dir string) error) (*Repo, error) { + if cfg.Branch == "" { + cfg.Branch = "main" + } + r := &Repo{cfg: cfg, onChange: onChange} + if cfg.Token != "" { + // The script reads the secret from its environment, so the file + // itself holds nothing sensitive. + f, err := os.CreateTemp("", "usaco-askpass-*") + if err != nil { + return nil, err + } + script := "#!/bin/sh\ncase \"$1\" in Username*) echo \"$USACO_GIT_USER\" ;; *) echo \"$USACO_GIT_TOKEN\" ;; esac\n" + if _, err := f.WriteString(script); err != nil { + return nil, err + } + f.Close() + if err := os.Chmod(f.Name(), 0o700); err != nil { + return nil, err + } + r.askpass = f.Name() + } + return r, nil +} + +// Dir is the clone's path. +func (r *Repo) Dir() string { return r.cfg.Dir } + +func (r *Repo) git(ctx context.Context, args ...string) (string, error) { + cmd := exec.CommandContext(ctx, "git", args...) + cmd.Dir = r.cfg.Dir + cmd.Env = append(os.Environ(), + "GIT_TERMINAL_PROMPT=0", + "GIT_AUTHOR_NAME="+r.cfg.AuthorName, + "GIT_AUTHOR_EMAIL="+r.cfg.AuthorEmail, + "GIT_COMMITTER_NAME="+r.cfg.AuthorName, + "GIT_COMMITTER_EMAIL="+r.cfg.AuthorEmail, + ) + if r.askpass != "" { + cmd.Env = append(cmd.Env, + "GIT_ASKPASS="+r.askpass, + "USACO_GIT_USER="+r.cfg.User, + "USACO_GIT_TOKEN="+r.cfg.Token, + ) + } + var out, errb bytes.Buffer + cmd.Stdout, cmd.Stderr = &out, &errb + if err := cmd.Run(); err != nil { + return out.String(), fmt.Errorf("git %s: %w: %s", args[0], err, strings.TrimSpace(errb.String())) + } + return out.String(), nil +} + +// Sync brings the clone up to the remote's tip, cloning it first if needed. +func (r *Repo) Sync(ctx context.Context) error { + r.mu.Lock() + defer r.mu.Unlock() + if err := r.syncLocked(ctx); err != nil { + return err + } + return r.changed() +} + +func (r *Repo) syncLocked(ctx context.Context) error { + if _, err := os.Stat(filepath.Join(r.cfg.Dir, ".git")); errors.Is(err, os.ErrNotExist) { + if err := os.MkdirAll(r.cfg.Dir, 0o755); err != nil { + return err + } + if _, err := r.git(ctx, "clone", "--quiet", "--branch", r.cfg.Branch, r.cfg.Remote, "."); err != nil { + return err + } + return nil + } + // Set every time, so a changed GIT_REMOTE_URL applies to an existing + // clone. + if _, err := r.git(ctx, "remote", "set-url", "origin", r.cfg.Remote); err != nil { + return err + } + if _, err := r.git(ctx, "fetch", "--quiet", "--prune", "origin", r.cfg.Branch); err != nil { + return err + } + if !r.cfg.Push { + if _, err := r.git(ctx, "rebase", "--quiet", "origin/"+r.cfg.Branch); err != nil { + r.git(ctx, "rebase", "--abort") + return err + } + return nil + } + if _, err := r.git(ctx, "checkout", "--quiet", "-B", r.cfg.Branch, "origin/"+r.cfg.Branch); err != nil { + return err + } + if _, err := r.git(ctx, "reset", "--quiet", "--hard", "origin/"+r.cfg.Branch); err != nil { + return err + } + _, err := r.git(ctx, "clean", "-ffdq") + return err +} + +func (r *Repo) changed() error { + if r.onChange == nil { + return nil + } + return r.onChange(r.cfg.Dir) +} + +// Mutate syncs, lets edit change files in the clone, and commits the result +// as message, pushing it when Push is on. An error from edit is returned as +// is and nothing is committed. If edit changes nothing, nothing is +// committed either and Mutate succeeds. +// +// edit may run twice: a rejected push re-syncs and replays it on the new +// tip, so it must decide what to do from the files on disk, not from +// anything it saw before. +func (r *Repo) Mutate(ctx context.Context, message string, edit func(dir string) error) error { + r.mu.Lock() + defer r.mu.Unlock() + + var pushErr error + for attempt := 0; attempt < 2; attempt++ { + if err := r.syncLocked(ctx); err != nil { + return err + } + if err := edit(r.cfg.Dir); err != nil { + r.discardLocked(ctx) + return err + } + if _, err := r.git(ctx, "add", "-A"); err != nil { + r.discardLocked(ctx) + return err + } + if _, err := r.git(ctx, "diff", "--cached", "--quiet"); err == nil { + return r.changed() + } + if _, err := r.git(ctx, "commit", "--quiet", "-m", message); err != nil { + r.discardLocked(ctx) + return err + } + if !r.cfg.Push { + return r.changed() + } + // Not --quiet: that would also drop the "[rejected]" line that + // isRejection looks for. + _, pushErr = r.git(ctx, "push", "origin", "HEAD:"+r.cfg.Branch) + if pushErr == nil { + return r.changed() + } + if !isRejection(pushErr) { + break + } + } + // Drop the unpushed commit, so the clone matches the remote again. + if err := r.syncLocked(ctx); err == nil { + r.changed() + } + if isRejection(pushErr) { + return fmt.Errorf("%w: %v", ErrRejected, pushErr) + } + return pushErr +} + +// discardLocked throws away uncommitted changes after a failed edit. +func (r *Repo) discardLocked(ctx context.Context) { + r.git(ctx, "reset", "--quiet", "--hard", "HEAD") + r.git(ctx, "clean", "-ffdq") +} + +func isRejection(err error) bool { + if err == nil { + return false + } + s := err.Error() + return strings.Contains(s, "[rejected]") || strings.Contains(s, "non-fast-forward") || strings.Contains(s, "fetch first") || + strings.Contains(s, "Updates were rejected") +} diff --git a/site/internal/repo/repo_test.go b/site/internal/repo/repo_test.go new file mode 100644 index 0000000..b63d2d7 --- /dev/null +++ b/site/internal/repo/repo_test.go @@ -0,0 +1,218 @@ +package repo + +import ( + "context" + "errors" + "os" + "os/exec" + "path/filepath" + "strings" + "testing" +) + +// run is git in dir, failing the test on error. +func run(t *testing.T, dir string, args ...string) string { + t.Helper() + cmd := exec.Command("git", args...) + cmd.Dir = dir + cmd.Env = append(os.Environ(), + "GIT_AUTHOR_NAME=t", "GIT_AUTHOR_EMAIL=t@t", "GIT_COMMITTER_NAME=t", "GIT_COMMITTER_EMAIL=t@t") + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("git %v: %v\n%s", args, err, out) + } + return strings.TrimSpace(string(out)) +} + +// remote makes a bare repo with one commit on main, and a second clone of it +// ("the laptop") for pushing from outside. +func remote(t *testing.T) (bare, laptop string) { + t.Helper() + root := t.TempDir() + bare = filepath.Join(root, "remote.git") + laptop = filepath.Join(root, "laptop") + run(t, root, "init", "--quiet", "--bare", "--initial-branch=main", bare) + run(t, root, "clone", "--quiet", bare, laptop) + os.MkdirAll(filepath.Join(laptop, "solving", "moocast"), 0o755) + os.WriteFile(filepath.Join(laptop, "solving", "moocast", "main.cpp"), []byte("int main(){}\n"), 0o644) + run(t, laptop, "add", "-A") + run(t, laptop, "commit", "--quiet", "-m", "first") + run(t, laptop, "push", "--quiet", "origin", "HEAD:main") + return bare, laptop +} + +func newRepo(t *testing.T, bare string, push bool) (*Repo, *int) { + t.Helper() + changes := 0 + r, err := New(Config{ + Dir: filepath.Join(t.TempDir(), "clone"), Remote: "file://" + bare, Branch: "main", + AuthorName: "site", AuthorEmail: "site@example.com", Push: push, + }, func(string) error { changes++; return nil }) + if err != nil { + t.Fatal(err) + } + return r, &changes +} + +func laptopCommit(t *testing.T, laptop, file, msg string) { + t.Helper() + run(t, laptop, "pull", "--quiet", "--rebase") + os.WriteFile(filepath.Join(laptop, file), []byte(msg+"\n"), 0o644) + run(t, laptop, "add", "-A") + run(t, laptop, "commit", "--quiet", "-m", msg) + run(t, laptop, "push", "--quiet") +} + +func TestSyncClonesThenFollowsRemote(t *testing.T) { + bare, laptop := remote(t) + r, changes := newRepo(t, bare, true) + ctx := context.Background() + + if err := r.Sync(ctx); err != nil { + t.Fatal(err) + } + if _, err := os.Stat(filepath.Join(r.Dir(), "solving", "moocast", "main.cpp")); err != nil { + t.Fatal("clone is missing the problem:", err) + } + + laptopCommit(t, laptop, "README.md", "from laptop") + // Stray local junk must not survive a sync: the remote always wins. + os.WriteFile(filepath.Join(r.Dir(), "junk"), []byte("x"), 0o644) + if err := r.Sync(ctx); err != nil { + t.Fatal(err) + } + if _, err := os.Stat(filepath.Join(r.Dir(), "README.md")); err != nil { + t.Fatal("sync did not bring in the laptop's commit") + } + if _, err := os.Stat(filepath.Join(r.Dir(), "junk")); err == nil { + t.Fatal("sync left an untracked file behind") + } + if *changes != 2 { + t.Fatalf("onChange ran %d times, want 2", *changes) + } +} + +func TestMutateCommitsAndPushes(t *testing.T) { + bare, _ := remote(t) + r, _ := newRepo(t, bare, true) + ctx := context.Background() + + err := r.Mutate(ctx, "Solve moocast", func(dir string) error { + os.MkdirAll(filepath.Join(dir, "solved"), 0o755) + return os.Rename(filepath.Join(dir, "solving", "moocast"), filepath.Join(dir, "solved", "moocast")) + }) + if err != nil { + t.Fatal(err) + } + if got := run(t, bare, "log", "-1", "--format=%s %an", "main"); got != "Solve moocast site" { + t.Fatalf("remote head = %q, want the site's commit", got) + } + if got := run(t, bare, "ls-tree", "-r", "--name-only", "main"); got != "solved/moocast/main.cpp" { + t.Fatalf("remote tree = %q", got) + } +} + +func TestMutateNoChangeMakesNoCommit(t *testing.T) { + bare, _ := remote(t) + r, _ := newRepo(t, bare, true) + before := run(t, bare, "rev-parse", "main") + if err := r.Mutate(context.Background(), "Nothing", func(string) error { return nil }); err != nil { + t.Fatal(err) + } + if after := run(t, bare, "rev-parse", "main"); after != before { + t.Fatal("an edit that changed nothing was committed") + } +} + +func TestMutateEditErrorDiscards(t *testing.T) { + bare, _ := remote(t) + r, _ := newRepo(t, bare, true) + boom := errors.New("boom") + err := r.Mutate(context.Background(), "Broken", func(dir string) error { + os.WriteFile(filepath.Join(dir, "half-done"), []byte("x"), 0o644) + return boom + }) + if !errors.Is(err, boom) { + t.Fatalf("err = %v, want the edit's own error", err) + } + if _, err := os.Stat(filepath.Join(r.Dir(), "half-done")); err == nil { + t.Fatal("a failed edit left its files behind") + } +} + +// An outside push between the site's sync and its push is the normal race +// with `usaco sync` on the laptop. The edit is replayed on the new tip. +func TestMutateReplaysAfterRejectedPush(t *testing.T) { + bare, laptop := remote(t) + r, _ := newRepo(t, bare, true) + ctx := context.Background() + if err := r.Sync(ctx); err != nil { + t.Fatal(err) + } + + calls := 0 + err := r.Mutate(ctx, "Update moocast", func(dir string) error { + calls++ + if calls == 1 { + // Sneak a push in after this attempt's sync. + laptopCommit(t, laptop, "laptop.txt", "laptop wins the race") + } + return os.WriteFile(filepath.Join(dir, "solving", "moocast", "notes.md"), []byte("notes\n"), 0o644) + }) + if err != nil { + t.Fatal(err) + } + if calls != 2 { + t.Fatalf("edit ran %d times, want 2 (once, then a replay)", calls) + } + log := run(t, bare, "log", "--format=%s", "main") + if !strings.HasPrefix(log, "Update moocast\nlaptop wins the race") { + t.Fatalf("remote log =\n%s\nwant the site's commit on top of the laptop's", log) + } +} + +func TestMutateGivesUpAfterTwoRejections(t *testing.T) { + bare, laptop := remote(t) + r, _ := newRepo(t, bare, true) + ctx := context.Background() + if err := r.Sync(ctx); err != nil { + t.Fatal(err) + } + n := 0 + err := r.Mutate(ctx, "Update moocast", func(dir string) error { + n++ + laptopCommit(t, laptop, "laptop.txt", "race "+string(rune('0'+n))) + return os.WriteFile(filepath.Join(dir, "solving", "moocast", "notes.md"), []byte("notes\n"), 0o644) + }) + if !errors.Is(err, ErrRejected) { + t.Fatalf("err = %v, want ErrRejected", err) + } + // And the clone is back on the remote's tip, without the lost commit. + if got, want := run(t, r.Dir(), "rev-parse", "HEAD"), run(t, bare, "rev-parse", "main"); got != want { + t.Fatal("clone was left on an unpushed commit") + } +} + +func TestNoPushKeepsLocalCommitsAcrossSyncs(t *testing.T) { + bare, laptop := remote(t) + r, _ := newRepo(t, bare, false) + ctx := context.Background() + before := run(t, bare, "rev-parse", "main") + + err := r.Mutate(ctx, "Update moocast", func(dir string) error { + return os.WriteFile(filepath.Join(dir, "solving", "moocast", "notes.md"), []byte("notes\n"), 0o644) + }) + if err != nil { + t.Fatal(err) + } + if run(t, bare, "rev-parse", "main") != before { + t.Fatal("pushed with Push off") + } + laptopCommit(t, laptop, "laptop.txt", "laptop") + if err := r.Sync(ctx); err != nil { + t.Fatal(err) + } + if got := run(t, r.Dir(), "log", "--format=%s", "-2"); got != "Update moocast\nlaptop" { + t.Fatalf("local log = %q, want the local commit rebased onto the laptop's", got) + } +} diff --git a/site/web/index.html b/site/web/index.html new file mode 100644 index 0000000..90ceeb2 --- /dev/null +++ b/site/web/index.html @@ -0,0 +1,14 @@ + + + + + + + USACO practice + + + +
+ + + diff --git a/site/web/package-lock.json b/site/web/package-lock.json new file mode 100644 index 0000000..36e2a1e --- /dev/null +++ b/site/web/package-lock.json @@ -0,0 +1,2177 @@ +{ + "name": "usaco-site-web", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "usaco-site-web", + "version": "0.0.0", + "dependencies": { + "highlight.js": "^11.11.1", + "markdown-it": "^14.1.0", + "vue": "^3.5.22", + "vue-router": "^4.6.3" + }, + "devDependencies": { + "@tailwindcss/vite": "^4.1.18", + "@vitejs/plugin-vue": "^6.0.1", + "tailwindcss": "^4.1.18", + "vite": "^7.3.2" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.64.6.tgz", + "integrity": "sha512-FkO19Fowv/OQeJZPVfdetJaI3/VpbZmBsnmAlR/rQ+b3QwfiGQiOpVegpSRH331kelvHTVw9hXYG3DwjAaRzyQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.64.6.tgz", + "integrity": "sha512-si5/Etm6MphPc2xYHnk455Shls/hoMjTy3mhXge4OPmvCw7TwC4KP4fKokAlKLV4XaQvLvgSHfafPcblLMYYdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.64.6.tgz", + "integrity": "sha512-PQCl3q7b0BgvVt72i2xrWM6I5KliwwVe4GpWW5QDGyUQawDS9aPZss/aGyFqBmxdRxlE8wDc9CaxiQ5DHRSp/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.64.6.tgz", + "integrity": "sha512-l9DFl1Itb1YYdSrP1K3U8ih44AOHa/p+Q4WMMDfGvH5qVWp+ajfgS1DlYo4yCRh8wJ2ZJv0Fqccf+ULAmMFjmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.64.6.tgz", + "integrity": "sha512-bR4GR3205N9+od0+l5Dd9/iZTDpJkIe6d6Ydp2qbcQZJLmKBdYQQRp8gbWpbMt92twKJY66o1vK4NkoKQODIrA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.64.6.tgz", + "integrity": "sha512-XTVNaDzcFl2TeBglvxdGgsCv9JGtAGRAoJENmGBR/XvDH2mA2K0IXc2aMfP0dR8mexSXSKifJ85FixoXX1wfTw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.64.6.tgz", + "integrity": "sha512-qWc6qbc+25ugG9vqPR9P422KJBbVfZ05mjcMggoq8tsfWP+eRfC+/tiDdIlRF5VL2pDVZWN9zAhWsmu7R1+7Dw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.64.6.tgz", + "integrity": "sha512-V4Nwkp8844X/Xnww3PI1LYS0YPei8XQEVG70R+5MPZGO7AhYoun4hCN7Svs4U3wbQLZbwiz+9xRFhUZZdRl8Ww==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.64.6.tgz", + "integrity": "sha512-xb72A1aPaaIsp+a88VtRae/ovIEXislbUMyp7b9AQQU7ZkP2m/+ik6DW9TQcJyw5R8/RIailF9zExYwkjR++UA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.64.6.tgz", + "integrity": "sha512-pbcs1BVBwC43hZkjhjlF8Rx8m5G0KnhLZs9Azy/gqccP6UsNSzJr0hKGIAVPqzAH1O/NdPxxC9GVGb4msQg/aw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.64.6.tgz", + "integrity": "sha512-EKOC8os6Vsg487ZLKUqzLF99Jsmnq6tu7O7mAELakNpcA+8KadktFf/JYdRuHe/DzCUXmN38pUKu4XBcKlqGbQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.64.6.tgz", + "integrity": "sha512-v/SQ68GnSlr/HyjB79sNXesGDwkOPu9JjbHfmWaymCiM+nZsQ9TstG1KfA4MuEvTr2d3PoY8PhFxj9bt0e32JA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.64.6.tgz", + "integrity": "sha512-G3pmliMQ7r15zFFNwBlaT/xTdSLi4lfgI7CUrQueyKYheNVhrd8JrWCE6Ll8xf4AA1RZFqq+mNJYntiElsVOyA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.64.6.tgz", + "integrity": "sha512-XQTB/IPoB/wG6x/wu9uomAt8YH61IAr5iZTubMiad/lu88sotq2ocz9hJd556+Jz2kIkF7ZQZIsUuWE3OWqtcA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.64.6.tgz", + "integrity": "sha512-O5mpokth6+ydMuwiGtY8fIjvOBfH7u6SzmDNmZ3k6GK5C6iEAC2q2ZN/T5L9jYILx0IcCT0KnfMDihQ5yQFSBw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.64.6.tgz", + "integrity": "sha512-aIFxbAD9v3TvIaEDsKmukjcDg1JS4/tFXw8SHyQQgzOwzWCQ4cyDK7Ju1pQKqUXDFkEu/BZCFDCDATsKhQcB/Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.64.6.tgz", + "integrity": "sha512-fuNo1UwBc6BxnHDOxxguQL/InhheMN3RJcJMb0b4xP8r5Q3CNCrJbVg0eCIFuJ4e/zAfjR2gYbOfbzO/G7CIyw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.64.6.tgz", + "integrity": "sha512-05v6wFKDKJPZs9xlytVrrRu6IbRuoSvlH9xNwEOafXsKyjBFZPvAcZz2VIAB/M+lblYeKa9iOYC4RDVdfcAAaw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.64.6.tgz", + "integrity": "sha512-wJXKcdMjvkc/FaavZXNP1yW4i0pfOmhZAIWRSLG2yJ0PB0TWi7dkLErhX0u0vptDcXKKO/m1Y/YTeuyvb2MXwg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.64.6.tgz", + "integrity": "sha512-cwg7/h0ThvJwy8CBkmACdiHAxRWpbsCmIsjOt+Zzx0hTnIcSUmKYEV03bGg+hD827OnwUsbKh1ZZDW754xWyBA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.64.6.tgz", + "integrity": "sha512-T0RkYIJbdYXJEQFw+tMBO09KDFdgmNxkHsof3wWAABrvnx15Yh8RytmrgYy9+q9cBeBNZF66MMQZC+5nzEz6vg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.64.6.tgz", + "integrity": "sha512-KlfpmF1AAIdAWxt8QQNClbpLFlAUfYOzqIuJ7IXEStMHpFRuH78RG6FjqPb3Rqhh0K89F5npvG+/i3Fjl6IveQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.64.6.tgz", + "integrity": "sha512-MrTLjd7Jlt9/ZavJZYG61KQv9Iy9bzbY+yXy73Xvwoa2uP66wvDShkyBr5Chz/yrE6lbD/zHMuTmKQVNQqBApg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.64.6.tgz", + "integrity": "sha512-8fWDH1CkPI8GdBKAxzHDza7UmgficsKo2+MVbvUgOGhB0629w5sHMg3Qu5y7TZsrYKHHWpz8fla4KvoT7WsO3Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.64.6.tgz", + "integrity": "sha512-9/c9PWdr5GCIHkkxiHM1HjNBQMVdftP4O8QTcoUAaRza2FSqJ4axbf8QAnBuE6BIGQDl71SaRPeDdDYid5ecTw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@tailwindcss/node": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.3.tgz", + "integrity": "sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "enhanced-resolve": "^5.24.1", + "jiti": "^2.7.0", + "lightningcss": "1.32.0", + "magic-string": "^0.30.21", + "source-map-js": "^1.2.1", + "tailwindcss": "4.3.3" + } + }, + "node_modules/@tailwindcss/oxide": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.3.tgz", + "integrity": "sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "optionalDependencies": { + "@tailwindcss/oxide-android-arm64": "4.3.3", + "@tailwindcss/oxide-darwin-arm64": "4.3.3", + "@tailwindcss/oxide-darwin-x64": "4.3.3", + "@tailwindcss/oxide-freebsd-x64": "4.3.3", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.3", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-x64-musl": "4.3.3", + "@tailwindcss/oxide-wasm32-wasi": "4.3.3", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.3", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.3" + } + }, + "node_modules/@tailwindcss/oxide-android-arm64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.3.tgz", + "integrity": "sha512-Y85A2gmPSkl5Ve5qR86GL4HT509cFqQh1aes9p3sSkyTPwt0Pppf3GkwGe4JPACcRYjgJIEhQgM6dBClnr0NYw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-arm64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.3.tgz", + "integrity": "sha512-BiaWatpBcERQFDlOjRDpIVXuFK5PJez5SA4JMg6VYZdBYU+qKfV/vqjcIs+IYmtitf1xYQZTwXvU/8y4lfZUGw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-x64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.3.tgz", + "integrity": "sha512-fAeUqfV5ndhxRwai8cXGzdLvul9utWOmeTkv69unv4ZXixjn61Z+p9lCWdwOwA3TYboG3BwdVuN/RDjhBRl0mw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-freebsd-x64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.3.tgz", + "integrity": "sha512-iyf5bV6+wnAlflVeEy7R25dupxTNECZN5QMI0qNT6eT+EgaGdZcKhGkr5SdoaWiLJ3spLqIY9VCeSGrwmtg4kw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.3.tgz", + "integrity": "sha512-aAYUprJAJQWWbRrPvtjdroZ56Md+JM8pMiopS6xGEwDfLhqj+2ver2p4nU4Mb3CRqcMmNBjo8KkUgcxhkzVQGQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.3.tgz", + "integrity": "sha512-nDxldcEENOxZRzC2uu9jrutZdAAQtb+8WWDCSnWL1zvBk1+FN+x6MtDViPB5AJMfttVCUhehGWus3XBPgatM/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-musl": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.3.tgz", + "integrity": "sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-gnu": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.3.tgz", + "integrity": "sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-musl": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.3.tgz", + "integrity": "sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.3.tgz", + "integrity": "sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==", + "bundleDependencies": [ + "@napi-rs/wasm-runtime", + "@emnapi/core", + "@emnapi/runtime", + "@tybys/wasm-util", + "@emnapi/wasi-threads", + "tslib" + ], + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.11.1", + "@emnapi/runtime": "^1.11.1", + "@emnapi/wasi-threads": "^1.2.2", + "@napi-rs/wasm-runtime": "^1.1.4", + "@tybys/wasm-util": "^0.10.2", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz", + "integrity": "sha512-3rc292Ca2ceK6Ulcc/bAVnTs/3nDtoPhyEKlgPv+yQJQi/JS/AMJlqzxvlDacL1nekbrcf6bTqp/jV4qgnPxNQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.3.tgz", + "integrity": "sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/vite": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.3.3.tgz", + "integrity": "sha512-yYU8cogLeSh/ms2jh8Fj7jaba/EWa7Ja6GoUqYZaraEuCI5YS6ms6ObZgjjedm+jm6XZjdNRWBpPP6Z86oOxcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tailwindcss/node": "4.3.3", + "@tailwindcss/oxide": "4.3.3", + "tailwindcss": "4.3.3" + }, + "peerDependencies": { + "vite": "^5.2.0 || ^6 || ^7 || ^8" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@vitejs/plugin-vue": { + "version": "6.0.10", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-vue/-/plugin-vue-6.0.10.tgz", + "integrity": "sha512-b80aUQh3n+qEzzZm5oQp3rT2QImeCx58K6eFl/RkJ3d65KW0kTuv5lNsLRVAjbW9YRUpo/wzmvzMgV34bTAItA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", + "vue": "^3.2.25 || ^3.6.0-rc.10" + } + }, + "node_modules/@vue/compiler-core": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.44.tgz", + "integrity": "sha512-k34nCytbK8PQ1gR2mGROYOw6Pnv/mumqIdrZ3x2tbyXZDWm7ViKGLTfdB+DRrWqEQsLgGJvn0WN9jBif5zCTLQ==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.9", + "@vue/shared": "3.5.44", + "entities": "^7.0.1", + "estree-walker": "^2.0.2", + "source-map-js": "^1.2.2" + } + }, + "node_modules/@vue/compiler-core/node_modules/entities": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz", + "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/@vue/compiler-dom": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.44.tgz", + "integrity": "sha512-W5AoBFWdw1lQAKiHowkfgFKFab82oSRT6sGsPfw/q1GRjsy/ZJFLHGhJyBRIFN9APLTUduDH9U2JAiPOIyKuYg==", + "license": "MIT", + "dependencies": { + "@vue/compiler-core": "3.5.44", + "@vue/shared": "3.5.44" + } + }, + "node_modules/@vue/compiler-sfc": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.44.tgz", + "integrity": "sha512-dzHmQ4jXTpdr5FjIQUeykVakN/uzqFbUo9/C5ikBFg3a3PeM6uRxeczx1ZbXBML0/zJstEh3ygYipzR5Z7b2Pw==", + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.9", + "@vue/compiler-core": "3.5.44", + "@vue/compiler-dom": "3.5.44", + "@vue/compiler-ssr": "3.5.44", + "@vue/shared": "3.5.44", + "estree-walker": "^2.0.2", + "magic-string": "^0.30.21", + "postcss": "^8.5.29", + "source-map-js": "^1.2.2" + } + }, + "node_modules/@vue/compiler-ssr": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.44.tgz", + "integrity": "sha512-xr5gb1JVHlfXJwSlRz1FeP6uxoazdzHuMTVLE7up+4Vrqxk219CvxLPxD9NXBt47yvZW7+p4DXfyp4O1fkByIA==", + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.44", + "@vue/shared": "3.5.44" + } + }, + "node_modules/@vue/devtools-api": { + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz", + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==", + "license": "MIT" + }, + "node_modules/@vue/reactivity": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.44.tgz", + "integrity": "sha512-u+QJdKeBBEADkPdevsL+6E12QlYVfBD8Zcw5qjDQKtamI6l14KyqazJMobhCKelhWN5zpyKUiEDoTyHE93cqWw==", + "license": "MIT", + "dependencies": { + "@vue/shared": "3.5.44" + } + }, + "node_modules/@vue/runtime-core": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.44.tgz", + "integrity": "sha512-uEa/ndwjhrrhnOfb2p+sZy6zeoamJOISqaLSJGk/8R6nABT1ZldpzcJoPzKj+zHVomVBPcmQYyC2r4LtvDV6CQ==", + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.44", + "@vue/shared": "3.5.44" + } + }, + "node_modules/@vue/runtime-dom": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.44.tgz", + "integrity": "sha512-3fc4ARcXVhVBaJ3ujWiNZJARD6pkyRcwG+ZYhMzjKtKUp7MAY0HLwr7r3Smep3Li6ZaWT6ewdmx8XqdaD5oNZg==", + "license": "MIT", + "dependencies": { + "@vue/reactivity": "3.5.44", + "@vue/runtime-core": "3.5.44", + "@vue/shared": "3.5.44", + "csstype": "^3.2.3" + } + }, + "node_modules/@vue/server-renderer": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.44.tgz", + "integrity": "sha512-R4S1UoH4h5Frrauv8Z5XE5TxV9oBiUSgWIC4TyVK1FK+RocRnOLwFA5Xcmo2011RlgJp+AbZCnw6afrhlgRuUQ==", + "license": "MIT", + "dependencies": { + "@vue/compiler-ssr": "3.5.44", + "@vue/runtime-dom": "3.5.44", + "@vue/shared": "3.5.44" + } + }, + "node_modules/@vue/shared": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.44.tgz", + "integrity": "sha512-H82XLH0DjmSOdbEwO15x3QTo1f5PWEtv237eLpYKc0mqLu+B8hnq16lFWmuBmNurkeiG3wr+oM1FhOll/YVFRg==", + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.26.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.26.0.tgz", + "integrity": "sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/highlight.js": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.12.0.tgz", + "integrity": "sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/jiti": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/linkify-it": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.2.tgz", + "integrity": "sha512-ONTm2jCMAVZjgQa/Fy1kScXsuOoF5NPTsoFBdE1KVIZ2vAh/r9+Bqo+0jINCBYnavTPQZz38QzFTme79ENoN3Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/markdown-it": { + "version": "14.3.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.3.2.tgz", + "integrity": "sha512-sHHjZ5fJKlgrG4qns2YwVcdNep35h5fERrfkD2YNsb9UFk0UIHarbiTaHKVMlPuWAoiilyK8Fv/jAm11slsY7Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/markdown-it" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.5.0", + "linkify-it": "^5.0.2", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/mdurl": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.1.0.tgz", + "integrity": "sha512-1+HBaOx0zi/dQWht8rNv9MYf9qqpqL/kxI0hXImU6Y547zM6Sni8BQibt7ifgMcYtQg41ao3Ivd6cnSM86inpg==", + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.30", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.30.tgz", + "integrity": "sha512-zkd+e9S1AQHhmaBKye9zlFHWjOwVgqXl1q3ECYy8561K7qxR2cREf/STLskulBFd78k6AOFeA+ff1TtEzk9bAA==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/rollup": { + "version": "4.64.6", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.64.6.tgz", + "integrity": "sha512-fX1Vy+UNKdXn+xKDnu/HBXbHVr1AY8cSdQj9BU4kLv5aFCMqGpvrVbyUMmjN3DdzWhSAuTbcX8PCNEVaumthYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.64.6", + "@rollup/rollup-android-arm64": "4.64.6", + "@rollup/rollup-darwin-arm64": "4.64.6", + "@rollup/rollup-darwin-x64": "4.64.6", + "@rollup/rollup-freebsd-arm64": "4.64.6", + "@rollup/rollup-freebsd-x64": "4.64.6", + "@rollup/rollup-linux-arm-gnueabihf": "4.64.6", + "@rollup/rollup-linux-arm-musleabihf": "4.64.6", + "@rollup/rollup-linux-arm64-gnu": "4.64.6", + "@rollup/rollup-linux-arm64-musl": "4.64.6", + "@rollup/rollup-linux-loong64-gnu": "4.64.6", + "@rollup/rollup-linux-loong64-musl": "4.64.6", + "@rollup/rollup-linux-ppc64-gnu": "4.64.6", + "@rollup/rollup-linux-ppc64-musl": "4.64.6", + "@rollup/rollup-linux-riscv64-gnu": "4.64.6", + "@rollup/rollup-linux-riscv64-musl": "4.64.6", + "@rollup/rollup-linux-s390x-gnu": "4.64.6", + "@rollup/rollup-linux-x64-gnu": "4.64.6", + "@rollup/rollup-linux-x64-musl": "4.64.6", + "@rollup/rollup-openbsd-x64": "4.64.6", + "@rollup/rollup-openharmony-arm64": "4.64.6", + "@rollup/rollup-win32-arm64-msvc": "4.64.6", + "@rollup/rollup-win32-ia32-msvc": "4.64.6", + "@rollup/rollup-win32-x64-gnu": "4.64.6", + "@rollup/rollup-win32-x64-msvc": "4.64.6", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tailwindcss": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.3.tgz", + "integrity": "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/tapable": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "license": "MIT" + }, + "node_modules/vite": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.7.tgz", + "integrity": "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vue": { + "version": "3.5.44", + "resolved": "https://registry.npmjs.org/vue/-/vue-3.5.44.tgz", + "integrity": "sha512-dvvmaOCG7lAMkJTPqPwWeGMsPS6DIsFsfZDUgBp9V6mHf9b3+/wyVwYR4Es+WV6uJC0FKRxp81Obcq0ZwUcGFQ==", + "license": "MIT", + "dependencies": { + "@vue/compiler-dom": "3.5.44", + "@vue/compiler-sfc": "3.5.44", + "@vue/runtime-dom": "3.5.44", + "@vue/server-renderer": "3.5.44", + "@vue/shared": "3.5.44" + }, + "peerDependencies": { + "typescript": "*" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/vue-router": { + "version": "4.6.4", + "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-4.6.4.tgz", + "integrity": "sha512-Hz9q5sa33Yhduglwz6g9skT8OBPii+4bFn88w6J+J4MfEo4KRRpmiNG/hHHkdbRFlLBOqxN8y8gf2Fb0MTUgVg==", + "license": "MIT", + "dependencies": { + "@vue/devtools-api": "^6.6.4" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + } + } +} diff --git a/site/web/package.json b/site/web/package.json new file mode 100644 index 0000000..500d10e --- /dev/null +++ b/site/web/package.json @@ -0,0 +1,26 @@ +{ + "name": "usaco-site-web", + "version": "0.0.0", + "private": true, + "type": "module", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "highlight.js": "^11.11.1", + "markdown-it": "^14.1.0", + "vue": "^3.5.22", + "vue-router": "^4.6.3" + }, + "devDependencies": { + "@tailwindcss/vite": "^4.1.18", + "@vitejs/plugin-vue": "^6.0.1", + "tailwindcss": "^4.1.18", + "vite": "^7.3.2" + } +} diff --git a/site/web/public/fonts/CreatoDisplay-Bold.woff2 b/site/web/public/fonts/CreatoDisplay-Bold.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..799688720dfa796425dd33ead7b94844987e9f9a GIT binary patch literal 19392 zcmZU)V~j3Luq`~cvB$Q}J+^Jzwr$(CZQHhI_SiGe*mK`=^5sizZl!Z= zbd|fj7_+>JiaZdI^Z*bX(0|rl@}KVj1pGh#|7-AfJUGK@xPkZ(20$T3!0aHTpy4X0 zfwc-?5a6Ngkc2qXUDh6b(To1Yw&K-NKv1}IokRk*mu62eeXSrTFUYrQp?Ne8^2G@` z$aH4E|G(9ll9+&E;@$sdPs^&#E-^RPNI?YhFiTYm0wV^ghoxcFJ`WeQGFi!oMlHW} z*qBzqp=EW>wA`bYQjouNZ~PIsn94=$;Z<**2jri*Uj3eg zde=Mq-t{=0p7y89I8m{qNsoq&#VI$qsL-NIn?_VTl5OxQXT4D2HM%$?3<@FtC6=%z z79~TAtwD9q;ZIxsDhWmG;xOOS+5h%uXaz!#;efY*gaJf`2Ps;Y0{u7#8sfJN&S52}0SkQ1 z-zbP?m@en1kD^p@O?PKWL(ED+u)mH1c?+A=;dlg@5z9pWoH?}v{g!Dr%f1eEwj!~} z^UnP?tu9>$;le%$Dlb}a2tmLn;f=_(G!|ABVti7(%y(Jwujza@_njCjYsWHB1}7s@ z%8@ohIcZyPgdxVi7*w>GM3qg68SH|+?uEs7Jk64%#jSpIIas@;v*$rC*!_ThL1R&A zhQ`@-C1Dd9&6@xH<18dwDE6VffjSx&A9*FwBEwQQ*Wf&yn8OVtMzxqtf;JtabwmOO zLqr?NA14U$Z{4r{&W4vF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W=kzRkas$Shs_MT4h*0Pl<(4hjH);DE7m4*BqQo%N{GRa2nO~ zc(1+{E73jAquQ7zQhOGeTr_f^zD+0fmZy3{H6krNj6Pp4=NN~V*m(lRw;_mcL&}~~ z2<76KY__E8_0p=ZauErghsUyjq95tyxbtj#HnA^3-e2lXZTt2f%Zkia>_oL;)O#F( z^-Zhso6`*EeEV9^ANyUpx4`+;Krp0y;T~{I|?XSL;BB_ z!Qs;K?uwF9T^WiQ3?#3pU5J4J-lJ?#(s#xe1O|a#tG)tY_Ep*eQ=nBYpWzYY%E_Y( z9ckYj&XuXXnFZ$YaB?^bGdLq;j0`o|W|I{g4#9AbaVyLK)I2o?J_(aoL{y$r%3$Oh zlWo|ym2sA>QOdmmdkHcv_WCEUekONe>S@!90{M?>3c%#EH;j{Q3OnDeC?^rUFL8*5WHBSTsNDwg(qpnhCaZSFsOnUi|(r^XuD z?%#4%6)L<366(&lsDz;jDD zZMDnR2X3A5VXZGwvmv+!SRB>BKUT;=1GOZ$&SHI^V&@$M@cL zfw&}JeJ(*RW;zp_{Is1v80gb+Uv)=U21-05kv{=!I)INp!1$>SkEi||7&H?13%e?s z`p(h=MC@3K$Q1+0W`MTTyu61n5^sP!ka#4n1c$t^FV-}U=$Je6Dyyr!ytE|%aT!`B znFRcV?BGMSq|<4VW@!Q~lJ~OrHqL;(=ZkO`%var_t;!1Mg&&8ScT|8=r*R7CwM5a* zJm&P|Qo-lt-f{Li2Ucf+Z^&F8gfFluf)<75`L~Zv1~Z60j|`l34hwt9k3=Oyl|sPWbNCQe*neM B38nx5 literal 0 HcmV?d00001 diff --git a/site/web/public/fonts/big_noodle_titling.woff2 b/site/web/public/fonts/big_noodle_titling.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..f9f3500c3bfbc739f777761342654f1c2dcca22c GIT binary patch literal 8856 zcmY+p18^oy`@Vh0wrwYOY}>YN+uCH~Y;4>11{-ICjcwc3CjadF{HnhCj=E;1yJxD; zbGo~_YUc7(lwbjX0KOni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+gmn%Lh{lX`5bve+R2*N-RZs}d&F3x zKyd%g6%LZS7dvkV)+`jxIPRt0x-RKOA*q&|k$r(RfEt05s=A{9?YlvtR{4=Ug3C4Q zMBWOT_!f%t^u+Plun__&iNpZc{IXMQx+ag4Ba z*2uywDN_vU6v_=r2`zsulqIVD7f;?xxDTTbnp{+=w?$8a3v4VZiWV6)1vmimnp$5K zT2VvFsj@_-CSkki0&Q zoNgPmLzsftY^z9}^R5{_AjS<(L}*SpT1n6EwV1~u8QV`pZ*Q_Tm*RdFahdYg^IK8q*$gRNyG7wfh-QQFwZ-94W|`4eJ{gg5xD0J3}?X2 zuipqtvt*2a3VO~4*F!4QmC`Wd^g9y6b#wq=rfIc$P1Kg8<%>;gu*wS&NF~AFQJ5qI z@LXp?c#P0hT&5n>T`XA!7A#@P)CD=8 z)#MB@T4c-m{)|gx4Cbq+sp+)aNSaqPt*&9qW$GS$!-IN}HHF_ej{?vi(P~*}%4uwWBQ}VdiXNnoMJELRxj3ST`IN^HEBQBr?rh zKL}V18jV7=3>S=j^klVpHd^(HQt@j2wsC|vg!a?#Sv_tuD290MV=z>IoF|+a8SYbL zf4mNJuOZ-g^x14>+BZOOtlEaZxI)%kHyP454zGJV{xwVT54fw^vUi=fZ^LKNuPJf6 ztYkg>@pg&Bxx?!d$A3L-{1DJQ!K%o|K7h2DRi+$5`Nx7~xp0VHqDIPIZq@zSfC`RP zrVUtTzfdKa7jWh0wCI}mHbGa{eN&;B{e(h(_kFxpY|j-f<#jV|@?$=f+xD@nap{~8 Oe)0K6Dx3XlFZ_SJtFsFL literal 0 HcmV?d00001 diff --git a/site/web/src/App.vue b/site/web/src/App.vue new file mode 100644 index 0000000..a4f04db --- /dev/null +++ b/site/web/src/App.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/site/web/src/api.js b/site/web/src/api.js new file mode 100644 index 0000000..bfaf4b4 --- /dev/null +++ b/site/web/src/api.js @@ -0,0 +1,37 @@ +/** + * The server's REST API (internal/handlers). Every call goes through + * request(), which turns an error response into a thrown Error carrying the + * server's message, and sends a refused admin action to the site's login. + */ + +import { goToLogin } from "./session"; + +const BASE = `${import.meta.env.BASE_URL}api`; + +export class ApiError extends Error { + constructor(status, message) { + super(message); + this.status = status; + } +} + +async function request(method, path, body) { + const res = await fetch(BASE + path, { + method, + credentials: "same-origin", + headers: body === undefined ? {} : { "Content-Type": "application/json" }, + body: body === undefined ? undefined : JSON.stringify(body), + }); + const data = await res.json().catch(() => ({})); + if (!res.ok) { + if (res.status === 401) goToLogin(); + throw new ApiError(res.status, data.error || `request failed (${res.status})`); + } + return data; +} + +export const listProblems = () => request("GET", "/problems"); +export const getProblem = (name) => request("GET", `/problems/${encodeURIComponent(name)}`); +export const updateMeta = (name, meta) => request("PUT", `/problems/${encodeURIComponent(name)}/meta`, meta); +export const setStatus = (name, to) => request("POST", `/problems/${encodeURIComponent(name)}/status`, { to }); +export const getMe = () => request("GET", "/me"); diff --git a/site/web/src/assets/styles.css b/site/web/src/assets/styles.css new file mode 100644 index 0000000..b6a2d43 --- /dev/null +++ b/site/web/src/assets/styles.css @@ -0,0 +1,215 @@ +/* + * Global stylesheet: tokens, base elements, shared bits (badges, buttons) + * and the code-highlighting colours. + * + * The palette and fonts are the job tracker's paper look (same fonts, copied + * into public/fonts), so the two read as parts of one site. Tailwind is here + * for its preflight reset; components use their own scoped diff --git a/site/web/src/format.js b/site/web/src/format.js new file mode 100644 index 0000000..17a0c28 --- /dev/null +++ b/site/web/src/format.js @@ -0,0 +1,25 @@ +/** + * Small display helpers shared by the views. + */ + +export const STATUS_LABELS = { solving: "Solving", solved: "Solved", skipped: "Skipped" }; + +export const LANG_LABELS = { cpp: "C++", c: "C", python: "Python", java: "Java", rust: "Rust", go: "Go" }; + +// "diamond-collector" -> "Diamond Collector" +export function title(name) { + return name.replace(/[-_]+/g, " ").replace(/\b\w/g, (c) => c.toUpperCase()); +} + +export function formatDate(iso, opts = { day: "numeric", month: "short", year: "numeric" }) { + if (!iso) return ""; + return new Date(iso).toLocaleDateString(undefined, opts); +} + +// Local calendar day, "YYYY-MM-DD": the heatmap and streak count days where +// the viewer is, not in UTC. +export function dayKey(date) { + const d = new Date(date); + const p = (n) => String(n).padStart(2, "0"); + return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}`; +} diff --git a/site/web/src/main.js b/site/web/src/main.js new file mode 100644 index 0000000..4ea3683 --- /dev/null +++ b/site/web/src/main.js @@ -0,0 +1,10 @@ +/** + * App entry point. Mounts on #app with the router. + */ + +import { createApp } from "vue"; +import App from "./App.vue"; +import router from "./router"; +import "./assets/styles.css"; + +createApp(App).use(router).mount("#app"); diff --git a/site/web/src/router.js b/site/web/src/router.js new file mode 100644 index 0000000..2e9f6cf --- /dev/null +++ b/site/web/src/router.js @@ -0,0 +1,19 @@ +/** + * Routes, under the app's base path (/usaco/, from vite.config.js). + * + * Everything is public; what the admin sees beyond solved problems is decided + * by the server per request (the same URLs, more data), so there are no guards. + */ + +import { createRouter, createWebHistory } from "vue-router"; + +export default createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { path: "/", name: "list", component: () => import("@/views/ProblemList.vue") }, + { path: "/p/:name", name: "problem", component: () => import("@/views/ProblemPage.vue"), props: true }, + { path: "/stats", name: "stats", component: () => import("@/views/StatsPage.vue") }, + { path: "/:pathMatch(.*)*", redirect: "/" }, + ], + scrollBehavior: (to, from, saved) => saved || { top: 0 }, +}); diff --git a/site/web/src/session.js b/site/web/src/session.js new file mode 100644 index 0000000..9b4a08c --- /dev/null +++ b/site/web/src/session.js @@ -0,0 +1,13 @@ +/** + * What to do when an admin action is refused. + * + * The site has no login of its own: it borrows the main site's session + * (internal/auth on the server), as the job tracker does. By the time a + * request is refused the server has already tried the site's refresh token, + * so the only way back is the site's login page, which returns here after. + */ + +export function goToLogin() { + const here = window.location.pathname + window.location.search; + window.location.assign(`/admin/login?redirect=${encodeURIComponent(here)}`); +} diff --git a/site/web/src/views/ProblemList.vue b/site/web/src/views/ProblemList.vue new file mode 100644 index 0000000..192de32 --- /dev/null +++ b/site/web/src/views/ProblemList.vue @@ -0,0 +1,207 @@ + + + + + diff --git a/site/web/src/views/ProblemPage.vue b/site/web/src/views/ProblemPage.vue new file mode 100644 index 0000000..3635892 --- /dev/null +++ b/site/web/src/views/ProblemPage.vue @@ -0,0 +1,323 @@ + + + + + diff --git a/site/web/src/views/StatsPage.vue b/site/web/src/views/StatsPage.vue new file mode 100644 index 0000000..89e8527 --- /dev/null +++ b/site/web/src/views/StatsPage.vue @@ -0,0 +1,345 @@ + + + + + diff --git a/site/web/vite.config.js b/site/web/vite.config.js new file mode 100644 index 0000000..2e375b4 --- /dev/null +++ b/site/web/vite.config.js @@ -0,0 +1,26 @@ +import { fileURLToPath, URL } from "node:url"; + +import { defineConfig } from "vite"; +import tailwindcss from "@tailwindcss/vite"; +import vue from "@vitejs/plugin-vue"; + +// The app is served under /usaco/ (BASE_PATH on the server), so every asset +// URL and the router's history base carry it. Changing one means changing both. +// +// `npm run dev` proxies the API to the Go server: VITE_PROXY_USACO (default +// localhost:8080, the standalone docker-compose). +export default defineConfig({ + base: "/usaco/", + plugins: [vue(), tailwindcss()], + resolve: { + alias: { + "@": fileURLToPath(new URL("./src", import.meta.url)), + }, + }, + server: { + host: "0.0.0.0", + proxy: { + "/usaco/api": process.env.VITE_PROXY_USACO || "http://localhost:8080", + }, + }, +});