Files
adminandClaude Opus 5.5 1dd6b4a724 No third-party code in Galena's origin, no session token in the console (Atrium#68, R2)
- ReaderJS, tesseract.js (+ WASM core, language models) and PDF.js are served by
  Galena from static/: backend/scripts/fetch_vendor.py fetches them at image build
  (Dockerfile `vendor` stage, Netlify prepare, local dev) - ReaderJS by full commit
  SHA through git, the npm tarballs at exact versions checked against their
  integrity hashes; a mismatch fails the build. tesseract.js was loaded as `@5`.
- The console and reader CSPs name no CDN; READERJS_DEFAULT_BASE is `dist/`, the
  shell-relative own copy (a remote, immutable override still works).
- POST /auth/login returns the raw session token only with `issue_token: true`
  (Galena Connect asks); the console signs in by the httpOnly cookie alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 16:40:25 +01:00

7.8 KiB
Raw Permalink Blame History

Credits & licenses

Galena is Apache-2.0. Every runtime dependency in core is permissive (Apache / MIT / BSD / HPND / PSF) — no copyleft (not even LGPL) — so it clears a corporate legal/IT license scan. A CI gate (backend/scripts/license_gate.py + a JS license-checker) fails the build on GPL/AGPL/SSPL.

Optional plugins are separate. Galena supports drop-in frontend plugins (see Plugins below) that an operator installs deliberately, outside the core tree. A plugin may carry its own license — e.g. the DjVu Viewer plugin is GPL-2.0 because DjVu has no permissive decoder (see below). Core ships none of that; the copyleft-free guarantee is about what's installed by default.

Backend (Python)

Dependency Purpose License
FastAPI web framework MIT
uvicorn ASGI server BSD-3-Clause
python-multipart file uploads Apache-2.0
pydantic / pydantic-settings validation & settings MIT
SQLAlchemy ORM MIT
Alembic migrations MIT
pg8000 pure-Python Postgres driver (no libpq) BSD-3-Clause
argon2-cffi Argon2id password + passphrase KDF MIT
cryptography AES-256-GCM envelope encryption Apache-2.0 / BSD-3-Clause
GitPython the git facade (wraps the system git) BSD-3-Clause
Pillow image thumbnails + EXIF HPND
python-docx DOCX read/write (in-app editing) MIT
odfdo ODT read/write (in-app editing) Apache-2.0
striprtf RTF → text extraction (read-only) BSD-3-Clause
OpenTelemetry SDK/exporters (opt-in) tracing Apache-2.0

Frontend

  • The console (frontend/index.html + app.css + app.js) is hand-written vanilla JS/CSS — no framework, no build step. Icons are Tabler Icons (MIT) outline path data, drawn inline.
  • The console's look comes from the family's shared frontend/ui/v1/tokens.css: colour, shape, type and motion values read from the code of legalwork (MIT, HEAD 8255eba9); no legalwork code is included. The font is Inter (SIL OFL 1.1), frontend/ui/v1/InterVariable.woff2 beside its licence (LICENSE-Inter.txt), served from this origin.
  • Document viewing & version compare: the universal viewer is ReaderJS (Alpaq92/ReaderJS, MIT) — a same-origin iframe viewer. Galena does not vendor its libraries: it keeps only the ~2 KB loader and a tiny shell in frontend/static/readerjs/, and the shell loads ReaderJS's built code (dist-embed/) from Galena's own copy, fetched at image build from an immutable commit. It renders PDF, DjVu, DOC/DOCX/PPTX/XLSX, ODF, images, comics and e-books entirely client-side (documents never leave the box), and its compare mode powers Galena's Changes view — a side-by-side/unified/inline, word-level, blame-aware diff of two versions for any extractable-text format (PDF, DjVu, e-books, Office, text). Every bundled engine is permissive — PDF.js (Apache-2.0), mammoth/RTF.js/marked/foliate-js/JSZip/libarchive.js/exifr/UTIF (MIT/BSD), SheetJS (Apache-2.0), DejaView (clean-room, permissive DjVu — replaces the old GPL DjVu plugin), JSDoc (0BSD) for legacy .doc, and jsdiff (BSD-3) + Open-Color (MIT) behind the compare view; see ReaderJS's own CREDITS.md. Grid cards still use Pillow thumbnails.
  • OCR (text recognition): tesseract.js + tesseract.js-core (Apache-2.0) run the Tesseract LSTM engine in the browser, with PDF.js (Apache-2.0) for PDFs; its tessdata language models are Apache-2.0 (npm packaging @tesseract.js-data/*, MIT). All are served by Galena itself, fetched pinned and verified at image build (backend/scripts/fetch_vendor.py), and load on demand (carry an Apache NOTICE/attribution). Permissive and client-side — documents never leave the box. Alternatives considered (ocrs; server PaddleOCR/docTR; cloud OCR) are documented operator opt-ins, not core — see OCR.md.
  • Code editing: the in-app code editor (line numbers + syntax highlighting for js/ts/json/yaml/css/ html/sql/shell/py/c/… in app.js) is a hand-rolled transparent-textarea overlay highlighted by highlight.js (highlightjs/highlight.js, BSD-3) — vendored at frontend/static/hljs/ (common-languages bundle + GitHub light/dark themes), loaded same-origin, no build step. CSV/TSV files edit as a hand-rolled grid (no dependency).
  • Markdown live preview: the editor's optional Markdown mode (raw editor + live preview, toggled with the Slate rich editor) renders with marked (markedjs/marked, MIT) — vendored at frontend/static/marked.min.js, same-origin. The preview renders inside a sandboxed (scriptless) srcdoc iframe, so untrusted Markdown HTML can't execute.
  • The editor island (frontend/editor/) bundles React (MIT), Slate / ianstormtaylor/slate + slate-react + slate-history (all MIT), built once by Vite (MIT) into frontend/static/editor.js.
  • The built-in RTF editor (text-level read/write in app.js) is the project's own code — it began as the 0BSD RTF Editor plugin and was folded into core under Apache-2.0. It uses no third-party RTF library: the reader implements the well-known striprtf control-word algorithm and the writer emits minimal RTF.
  • Legacy .doc editing uses JSDoc (Alpaq92/JSDoc, 0BSD) — a pure-JS, dependency-free reader/writer for the Word 97–2003 binary OLE2 format, clean-room from Microsoft's [MS-CFB]/[MS-DOC] specs (no GPL catdoc/antiword). Vendored into frontend/static/jsdoc/ and run client-side (the document never leaves the box). Being 0BSD + zero-dependency, it lives in the permissive core like the RTF editor.

Optional extras (not installed by default)

  • pywebpush (MPL-2.0) — only if you enable browser-push delivery. Kept out of the default set so the core dependency tree stays fully copyleft-free. Email uses the stdlib smtplib (no dep).
  • boto3 (Apache-2.0) — only if you choose the S3 backup target. Local-disk backups (the default) use the stdlib (tarfile) with no extra dependency; the database dump is pure-Python (SQLAlchemy), so backups need neither pg_dump nor a cloud SDK unless you opt into S3.

Plugins (installed deliberately, licensed independently)

Frontend plugins live outside core under PLUGINS_DIR; the backend serves their static assets and the console lazy-loads them after sign-in (it never executes plugin code). They are not part of the permissive core tree and may be copyleft.

  • DjVu Viewer (GalenaPlugins/DjVuViewer, GPL-2.0) — inline .djvu preview via djvu.js. The djvu.js library is GPL-2.0 (it borrows DjVuLibre / Java-DjVu code); the viewer wrapper is The Unlicense. There is no permissive DjVu decoder: DjVuLibre and every JS port are GPL. The one exception is djvu-rs (MIT, a clean-room Rust codec with WASM bindings) — promising but young and self-attested clean-room, so a permissive DjVu plugin built on it is a documented future option, not yet shipped.

Design inspirations (no code or assets used)

  • UI design system adapted from the sibling Counsel Scorecard project (tokens, components, Open Color neutrals, Tabler icons).
  • Layout inspired by Cloudreve, ClovaLink, and Nextcloud — visual reference only.
  • The chat-style review takes visual cues from ShadCN UI / NiceGUI chat examples — reference only.
  • The friendly history view was inspired by, but does not use, git-sim.