Add the initial mediamark app #1
Reference in New Issue
Block a user
Delete Branch "benvin/initial-app"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Kids-safe media needs a curated
cheeztvtree, and today promoting a title means somebody SSHing in to runcp -alby hand. mediamark makes it a two-keystroke web action for theakP-mediamark-usergroup, with the hardlink mechanics and the traversal guards written down and tested.internal/library: a recursive hardlink sync that promotes afafflix/<section>/<title>directory intocheeztv/, idempotent on re-run (relinks only new/changed files), and reports per-title size, file count, marked state and link drift (needsSync). Unmark removes only the kids-side directory, so media is never destroyed..., or absolute paths) and re-verifies containment before every filesystem call; table tests cover the traversal cases.internal/arr: a minimal typed sonarr/radarr v3 client with a 60s list cache, matching *arr entries to library directories by path basename, plus a poster proxy that injects the API key server-side and never leaks it into a body, header, or error.internal/auth: server-side Authentik group enforcement on every API call and on the page load itself, so oauth2-proxy is defence in depth rather than the only gate. An empty allow-list fails startup.internal/server: the library JSON API, mark/unmark mutations, the art proxy,/livez+/readyz, and the embedded SPA with deep-link fallback.m/t), an autofocused fuzzy search over a title list (arrow to select,mto toggle, Enter for detail), and a detail panel with an optimistic toggle and toast. Plain HTML/CSS/JS on the arrproxy pirate skin, no CDNs and no build step.mediamark-ci, and the shared pre-commit config; extends the README with the env var table, keyboard map, and dev run.go test -race,gofmt,go vet,golangci-lintandpre-commit run --all-filesare green, and the binary was smoke-tested against a scratch library (hardlinks verified by inode, 403 without the group header).Review fixes pushed as
df07085(additive commit on benvin/initial-app).1. CI lint gap — widened the existing
.woodpecker/pre-commit.yaml(context nameci/woodpecker/pr/pre-commitunchanged; no new workflow) with two steps alongside the gofmt/vet one:lint:golangci-lint run ./...ongolangci/golangci-lint:latesthooks:uvx pre-commit run --all-filesongit.unkin.net/unkin/almalinux9-gobuilder:20260606Both images mirror estate precedent (node-lookup, pdbmux, encapic, clickhouse-tools, agent-tools all use exactly these). Every step keeps its
backend_options.kubernetesrequests/limits andserviceAccountName: mediamark-ci.make pre-commitwas extended to match so the local target still mirrors CI.2. HTTP server timeouts —
cmd/mediamark/main.gonow setsReadTimeout: 30s,WriteTimeout: 60s,IdleTimeout: 120son top of the existingReadHeaderTimeout. The 60s write budget is sized for the art proxy streaming posters.3. Security headers — a
secureHeadersmiddleware wraps the root handler, so the API, the SPA shell, static assets, the health probes and the 403 rejections all carry:Content-Security-Policy: default-src 'self'; img-src 'self' data:; style-src 'self'; script-src 'self'X-Content-Type-Options: nosniffReferrer-Policy: no-referrerVerified the SPA works under it unchanged —
index.htmlhas no inline<script>body, no<style>block, nostyle=oron*=attributes, andapp.cssreferences onlybg-space-pirate.svg(same-origin).data:is inimg-srcsolely for the inline SVG favicon, which is the onlydata:URI shipped. No policy loosening was needed.Tests:
TestSecurityHeadersOnEveryResponseasserts all three headers across/,/movies,/app.js,/api/library/movies,/livez,/readyzand an unauthorized 403. Newui/embed_test.goguards the no-unsafe-inline assumption so a future asset that grows an inline script/style fails the build rather than silently breaking in the browser.Resolved by convention, not changed:
docker-internalis the documented estate design for artifactapi's local registry, not a missing secret.Local validation all clean:
go test -race ./...,gofmt -l,go vet ./...,golangci-lint run ./...(0 issues),uvx pre-commit run --all-files(8/8 hooks pass).