Add in-browser OCR (text recognition) top-bar tool

A top-bar tool (#/ocr) to extract text from an image or PDF, running ENTIRELY
in the browser — the document is never uploaded.

- Engine selector (per OCR.md): Tesseract.js (Apache-2.0 WASM, recommended —
  100+ languages via on-demand tessdata) or ocrs (experimental). PDFs reuse the
  PDF.js loader: each page → canvas → OCR. Result box with Copy / Download .txt
  and a progress indicator; drag-drop or browse for the file.
- ocrs has no stable in-browser build yet (verified), so it's a best-effort seam
  (window.OCRS.recognize) that degrades with an honest message pointing at
  Tesseract.js — faithful to OCR.md rather than faking it.
- CSP: allow https://cdn.jsdelivr.net (script/worker/connect) for tesseract.js
  and add 'wasm-unsafe-eval' to script-src (needed to compile the WASM engine;
  narrower than 'unsafe-eval'). Documents stay on the box — only the engine and
  language model are fetched.
- New `scan` icon, full EN/PL i18n, .ocr-drop styling.
- Docs: README feature row, FUNCTIONAL section, CLAUDE invariant, CREDITS
  (tesseract.js/tessdata Apache-2.0, ocrs MIT/Apache-2.0). Commit OCR.md (the
  research/merit) and its linked doc-to-docx research note.

Verified end-to-end in the preview: tesseract.js loaded from jsDelivr under the
new CSP and recognized rendered canvas text exactly ("Galena OCR 12345").

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-16 14:18:57 +02:00
co-authored by Claude Opus 4.8
parent 3f110ea46d
commit ef5ea54b10
10 changed files with 524 additions and 5 deletions
+8
View File
@@ -84,6 +84,14 @@ cd frontend/editor && npm run build # rebuild the editor bundle (commit ..
- **Console security:** `esc()` every dynamic value; bearer token in memory only; cookie session is primary.
Untrusted file bytes never execute in-origin: `/raw` forces non-allowlisted media to
`octet-stream` + sandbox CSP; every git write path goes through `git_facade.safe_path`.
- **OCR is in-browser & permissive (`viewOcr` in `app.js`, top-bar tool).** Like RTF, it's a core
permissive feature, not a plugin: **tesseract.js** (Apache-2.0, lazy-loaded from jsDelivr; tessdata
Apache-2.0, on demand) is the engine; **ocrs** is an experimental selectable alternative with no
stable in-browser build — it's a best-effort seam (`window.OCRS.recognize`), don't claim it works.
**The document never leaves the box** (no upload). This needs `https://cdn.jsdelivr.net` in CSP
`script-/worker-/connect-src` **and** `'wasm-unsafe-eval'` in `script-src` (WASM compile; narrower
than `'unsafe-eval'`) — keep both. Higher-accuracy server (PaddleOCR/docTR) and cloud OCR stay
operator opt-ins (privacy), per [`OCR.md`](OCR.md) — never a default; cloud must be explicit.
- **Accent = monochrome** (near-black light / near-white dark). Open Color **violet8** (#5f3dc4) is
used **only** on the brand app icon (rounded square + Tabler `square-asterisk` in violet0). The one
exception is **data-viz**: dashboard charts use a 3-colour Open Color set (`--chart-1/2/3` =
+6
View File
@@ -37,6 +37,12 @@ Core ships none of that; the copyleft-free guarantee is about what's installed b
- **Document previews:** **PDF.js** (Apache-2.0, lazy-loaded from cdnjs) renders PDFs in core.
Images use Pillow thumbnails + an in-app lightbox. **DjVu is not in core** — it ships as the
optional, GPL-2.0 **DjVu Viewer** plugin (see *Plugins*).
- **OCR (text recognition):** **tesseract.js** (Apache-2.0, lazy-loaded from jsDelivr) runs the
Tesseract LSTM engine in the browser; its **tessdata** language models are Apache-2.0 and download
on demand (carry an Apache NOTICE/attribution). **ocrs** (MIT OR Apache-2.0) is offered as an
experimental in-browser alternative. Both are permissive and run client-side (documents never leave
the box). Higher-accuracy server engines (PaddleOCR/docTR, Apache-2.0 but heavy Python deps) and
cloud OCR are documented operator opt-ins, not core — see [`OCR.md`](OCR.md).
- The **editor island** (`frontend/editor/`) bundles **React** (MIT), **Slate** /
[`ianstormtaylor/slate`](https://github.com/ianstormtaylor/slate) + `slate-react` +
`slate-history` (all MIT), built once by **Vite** (MIT) into `frontend/static/editor.js`.
+16 -2
View File
@@ -80,8 +80,8 @@ the schema level, so external identity providers can be added later.
area). The sidebar can be hidden; on narrow screens it becomes a drawer.
- **Top bar** — a sidebar toggle, a **breadcrumb trail** of where you are (each segment is clickable;
it wraps to a second line for long paths), then the right-aligned actions: **Dashboard**, **Drafts**,
**Password generator**, **Administration** (admins only), **search**, **notifications** (bell with an
unread counter), **theme**, **language**, and your **account** menu.
**Password generator**, **Text recognition (OCR)**, **Administration** (admins only), **search**,
**notifications** (bell with an unread counter), **theme**, **language**, and your **account** menu.
- **Main area** — a grid/list of folders and files, or the current view (dashboard, a draft, history…).
The brand mark (a violet square with an asterisk) is the only place the brand colour appears; every
@@ -95,6 +95,20 @@ source (`crypto.getRandomValues`, with rejection sampling so every character is
nothing is ever sent to the server or stored. The sign-in form also has a show/hide toggle on the
password field.
**Text recognition (OCR)** (the scan icon in the top bar) extracts text from a scanned **image or
PDF**. Drop a file (or browse), pick the **engine** and **language**, and click **Extract text**;
the result appears in a box you can **Copy** or **Download** as `.txt`. Like the password generator,
it runs **entirely in your browser — the document is never uploaded.** Two engines:
- **Tesseract.js** (recommended) — the Tesseract OCR engine compiled to WebAssembly (Apache-2.0),
100+ languages; the language model downloads once on first use. Good on clean printed text.
- **ocrs** — an experimental alternative (Latin script only) with no stable in-browser build yet, so
it's best-effort and points you back to Tesseract.js for reliable results.
For tougher material (noisy scans, dense layout, handwriting), higher-accuracy **server** engines
(PaddleOCR / docTR) and **cloud** OCR are documented operator opt-ins (see `OCR.md`) — they're not in
the default in-browser tool because cloud OCR would send documents off the self-hosted box.
---
## 5. Workspaces, groups/folders, and projects
+163
View File
@@ -0,0 +1,163 @@
# OCR options for Galena — research & recommendation
> Scope: **on-demand, interactive** OCR — a user opens a scanned image/PDF and extracts its text to
> copy/paste or download (not bulk indexing; layout/table extraction only secondary). Compared across
> **browser (WASM) / server / cloud**, with exact licenses + pricing, mapped to Galena's constraints:
> Apache-2.0 **core ships only permissive deps**, **plugins are frontend-only** (the backend never
> executes plugin code), it's **self-hosted and privacy-sensitive**, and it already isolates copyleft
> as plugins (the GPL DjVu viewer) while keeping permissive features in core (the 0BSD RTF editor).
>
> _Researched June 2026 via a multi-source, adversarially-verified sweep: 25 sources fetched → 113
> claims extracted → 25 verified (24 confirmed, 1 refuted). License facts are high-confidence
> (checked against primary LICENSE files); accuracy tiers are directional, not measured on Galena's
> own document mix. Cloud pricing and model-weight licenses are time-sensitive — re-verify at adoption._
## TL;DR
- **Unlike `.doc` (see [`docs/doc-to-docx-conversion-research.md`](docs/doc-to-docx-conversion-research.md)),
OCR has a clean permissive, frontend-only, on-box option.** This is an **RTF-style win**, not a
DjVu-style compromise.
- **Primary recommendation: `tesseract.js`** — genuinely **Apache-2.0**, runs OCR **fully in-browser**
(WASM port of Tesseract's LSTM engine), documents **never leave the box**, 100+ languages via
Apache-2.0 tessdata. It can live in **core (like RTF)** or a **permissive plugin**.
- **The trade-off is accuracy tier.** tesseract.js is good on clean printed text but **measurably
weaker than PaddleOCR/docTR/cloud on noisy scans, dense layout, and handwriting.**
- **Higher accuracy, still on-box → operator-installed server sidecar** (PaddleOCR/docTR/EasyOCR,
Apache-2.0 but heavy Python deps). **Highest accuracy → cloud, strictly operator opt-in** (sending
documents off a self-hosted box is a privacy conflict; never a default).
- **Two licensing landmines:** **Surya** (code Apache-2.0 but **model weights** are restricted
Open-Rail-M with a $5M threshold + no-compete) and **OCRmyPDF** (MPL-2.0 **+ AGPL Ghostscript** dep).
Both are isolated-sidecar-only, not permissive-core/plugin.
## Recommendation matrix
| Approach | Runtime | Accuracy | License + cost | Privacy | Galena slot |
|----------|---------|----------|----------------|---------|-------------|
| **tesseract.js** ⭐ | Browser/WASM | **Mid** (good clean print; weak noise/handwriting) | **Apache-2.0** + Apache-2.0 tessdata, free | On-box ✅ | **(a) permissive frontend plugin — or core (RTF model)** |
| **ocrs** | Browser/WASM | Low–Mid (alpha, Latin-only) | **MIT OR Apache-2.0**, free | On-box ✅ | (a) secondary / experimental fallback |
| **transformers.js** + OCR model | Browser/WASM | Varies | Apache-2.0 lib; **model weights vary** (TrOCR **not** supported) | On-box ✅ | (a) only with a permissive in-browser model — not turnkey |
| **PaddleOCR / docTR / EasyOCR / RapidOCR** | Server (Python) | **High** | **Apache-2.0** code (heavy PyTorch/Paddle; audit weights + sub-deps) | On-box ✅ | **(c) operator server / sidecar** — not a frontend plugin |
| **OCRmyPDF** | Server | Mid–High | **MPL-2.0 + AGPL Ghostscript dep** | On-box ✅ | (b) isolated sidecar (copyleft) |
| **Surya** | Server | High | ⚠️ **code Apache-2.0, weights restricted** (Open-Rail-M, $5M + no-compete) | On-box ✅ | (b)/(e) isolated, operator accepts weight terms; **not** permissive-eligible |
| **Google Vision / AWS Textract / Azure / ABBYY / Mathpix** | Cloud | **Highest** (+ handwriting) | Commercial, per page (Google **$1.50/1k** after 1k free) | **Leaves the box** ❌ | **(d) operator opt-in only — never default** |
## (a) Browser / WASM — the permissive frontend-only tier
- **tesseract.js — primary recommendation.** Verified **Apache-2.0** (repo, `LICENSE.md`, npm). It
"works by wrapping a WebAssembly port of Tesseract" and runs OCR **client-side with no backend
calls** (a cited privacy feature) using `oem=1` — the same LSTM neural engine as Tesseract 4/5.
- **Language data:** the **tessdata** files are themselves **Apache-2.0** (`tessdata_fast` /
`tessdata_best_int`), but are **downloaded on demand per language** (a few MB each, not bundled),
so they carry an **Apache NOTICE/attribution** obligation and a first-use download cost.
- **Fully permissive dependency chain (zero copyleft)** → eligible for **core or a permissive
plugin**, your choice.
- **Accuracy:** good on clean printed text; **weaker on noisy scans, dense multi-column layout, and
handwriting** than modern deep-learning engines and cloud APIs.
- **PDF synergy:** Galena already lazy-loads **PDF.js** for the PDF preview — render a page to a
`<canvas>`, hand the canvas to tesseract.js. Images go in directly.
- **ocrs (Rust→WASM)** — the only *other* genuinely permissive in-browser engine, **dual MIT OR
Apache-2.0**, with a real (alpha) browser/Node WASM build. **Early preview, Latin-alphabet only**,
and self-admittedly below commercial accuracy → secondary/experimental fallback, not primary.
(Separately-distributed ONNX weights may carry their own terms.)
- **transformers.js** — clean **Apache-2.0**, runs models client-side via ONNX Runtime Web (WASM on
CPU; WebGPU opt-in). **But the TrOCR-in-browser assumption is FALSE** (refuted 0-3 — TrOCR isn't in
its supported models). Document-vision models like Donut/DiT/Florence-2 are supported, but **each
checkpoint's weights carry their own license** that must be audited before shipping. Not turnkey for OCR.
## (b)/(c) Server-side — higher accuracy, on-box, but not a frontend plugin
The accuracy-leading **permissive** engines — **Tesseract** (Apache-2.0, the engine tesseract.js
wraps), **EasyOCR** (Apache-2.0), **PaddleOCR** (Apache-2.0), **docTR**/Mindee (Apache-2.0), and
**RapidOCR** (Apache-2.0, ONNX-converted PaddleOCR models) — are clean permissive **code**, but the
deep-learning ones run **server-side in Python with heavy PyTorch/Paddle runtimes**. They fit a Galena
**operator server / sidecar** (the same two-tier pattern `OPTIONS.md` proposes for Collabora), **not a
frontend-only plugin**. Audit per-component: EasyOCR/docTR pull PyTorch; PaddleOCR lists an **AGPL
PyMuPDF**; every engine ships separate model **weights** with independent licenses.
> Note: RapidOCR's web offering (`RapidOCRWeb`) is a **Flask server** (browser is only a UI client);
> a true browser-native WASM path for these models is third-party, not on the main repos.
## The two licensing landmines (verified)
1. **Surya** — the **code** `LICENSE` is standard **Apache-2.0** (recently changed from GPL-3.0), but a
separate **`MODEL_LICENSE`** is the **AI Pubs Open-Rail-M (Modified)**: free only for
research/personal use and orgs **under a $5,000,000 revenue/funding threshold**, with a
**no-competing-products** clause; broader commercial use needs a paid license. **The permissive
code is useless without the restricted weights** → not permissive-core/plugin eligible; isolated,
operator-accepted server context only. (History of license churn — re-verify.)
2. **OCRmyPDF** (the standard "make a scanned PDF searchable" tool) — **MPL-2.0** (weak/file-level
copyleft) **plus a runtime dependency on AGPL Ghostscript** → isolated sidecar territory, **never**
permissive core or a permissive plugin. (Pluggable engine: Tesseract default; EasyOCR/PaddleOCR
plugins exist.)
## (d) Cloud — highest accuracy, but it leaves the box
Cloud APIs (Google Cloud Vision **Document Text Detection**, AWS Textract, Azure AI Document
Intelligence, ABBYY, Mathpix for math) deliver **top-tier accuracy** incl. handwriting, but **require
transmitting the document off the self-hosted box** — a direct conflict with Galena's privacy posture.
**Operator opt-in only, never a default.**
- **Google Cloud Vision pricing (verified):** first **1,000 units/month free** (metered **per
feature**), then **$1.50 / 1,000 units** (1,001–5,000,000), then **$0.60 / 1,000** above 5M. Billed
**per image / per page** — each PDF page is a separate billable image, and each feature applied is a
billable unit.
- AWS Textract, Azure Document Intelligence, ABBYY, Mathpix, Aspose.OCR pricing was **not** verified
here — check directly before any cost decision.
## What this means for Galena
| Need | Pick | Galena placement |
|------|------|------------------|
| On-box, permissive, default | **tesseract.js** | **Core feature or permissive plugin** (RTF model) |
| Higher accuracy, still on-box | **PaddleOCR / docTR** | Operator-installed server sidecar |
| Highest accuracy | **Cloud API** | Operator opt-in only (privacy) |
The clean play mirrors the RTF story: ship **tesseract.js** as an on-box **"Extract text"** action for
images and PDFs (reusing PDF.js for page rendering), permissive and private by default; offer a
**server sidecar** (PaddleOCR/docTR) and/or **cloud** as **operator-opt-in** upgrades for accuracy.
## Caveats (honesty)
- **Accuracy tiers are directional** — from maintainers' self-assessments (ocrs and Surya disclose
theirs) and general benchmarks, **not** measured on Galena's actual document profile.
- **License verdicts cover engine CODE only.** Every deep-learning option ships **separate model
weights** and pulls runtime deps (PyTorch, Paddle, **AGPL** Ghostscript, **AGPL** PyMuPDF) with
independent licenses to audit per-component.
- **Only Google Vision** cloud pricing was verified; **AWS / Azure / ABBYY / Mathpix / Aspose** were
not.
- **Surya** has churned licenses ($2M→$5M threshold; GPL→Apache code) — re-verify both code and
weights at adoption.
- **RapidOCR / transformers.js** have permissive libraries but **no substantiated turnkey
browser-native OCR path** on their main repos — a frontend deployment needs extra integration and
third-party ports.
## Open questions
1. tesseract.js's **measured accuracy on Galena's real document mix** (scanned vs born-digital, noisy
faxes, CJK, handwriting) vs a server PaddleOCR/docTR sidecar — is the gap big enough to justify an
opt-in server engine for privacy-sensitive cases?
2. Exact current **per-page pricing + data-retention terms** for AWS Textract, Azure Document
Intelligence/Read, ABBYY, Mathpix, Aspose.OCR.
3. For a transformers.js in-browser plugin, **which specific OCR model checkpoint** is both
browser-supported AND permissively-weighted (given TrOCR is unsupported and weights vary)?
4. Real-world **model/asset download cost and cold-start latency** on typical hardware (tessdata a few
MB/language on demand vs ONNX detection+recognition bundles for ocrs/transformers.js) — impact on
the interactive on-demand UX.
## Sources
- tesseract.js — <https://github.com/naptha/tesseract.js> · license <https://github.com/naptha/tesseract.js/blob/master/LICENSE.md>
- tessdata_fast (Apache-2.0 language data) — <https://github.com/tesseract-ocr/tessdata_fast>
- ocrs (Rust→WASM) — <https://github.com/robertknight/ocrs>
- transformers.js — <https://github.com/huggingface/transformers.js/>
- Tesseract — <https://github.com/tesseract-ocr/tesseract>
- EasyOCR — <https://github.com/JaidedAI/EasyOCR/blob/master/LICENSE>
- PaddleOCR — <https://github.com/PaddlePaddle/PaddleOCR/blob/main/LICENSE>
- docTR — <https://github.com/mindee/doctr>
- RapidOCR — <https://github.com/RapidAI/RapidOCR>
- Surya code license — <https://github.com/datalab-to/surya/blob/master/LICENSE> · model license — <https://github.com/datalab-to/surya/blob/master/MODEL_LICENSE>
- OCRmyPDF — <https://github.com/ocrmypdf/OCRmyPDF>
- Google Cloud Vision pricing — <https://cloud.google.com/vision/pricing>
- AWS Textract pricing — <https://aws.amazon.com/textract/pricing/>
- Azure AI Document Intelligence pricing — <https://azure.microsoft.com/en-us/pricing/details/document-intelligence/>
- Mathpix pricing — <https://mathpix.com/blog/image-api-price-reduction>
+1
View File
@@ -57,6 +57,7 @@ the backend are internal.
| **Previews** | images open in a lightbox (grid cards show Pillow thumbnails); **PDF** renders inline via **PDF.js**. **DjVu** is an optional [plugin](#plugins). |
| **Sessions** | server-side **cookie** sessions (instant kill-switch). JWT was considered — see roadmap. |
| **Password generator** | a top-bar tool to generate strong passwords (length 4–64; toggle upper/lower/numbers/symbols) with a strength estimate, **client-side only** via the Web Crypto CSPRNG (`crypto.getRandomValues`, rejection-sampled — never `Math.random`); plus show/hide on password fields (incl. sign-in). |
| **OCR (text recognition)** | a top-bar tool to extract text from an image or PDF **entirely in the browser** (the file never leaves the box). Pick the engine: **Tesseract.js** (Apache-2.0 WASM, recommended — 100+ languages, model downloaded on demand) or **ocrs** (MIT/Apache-2.0, experimental). PDFs reuse PDF.js (each page → canvas → OCR); copy or download the result as `.txt`. Higher-accuracy server (PaddleOCR/docTR) and cloud engines are documented operator opt-ins — see [`OCR.md`](OCR.md). |
| **Backups** | optional **auto-backup** (off by default), configured in Administration: a scheduled (hourly/daily/weekly) `.tar.gz` of **all files _and_ the whole database** (a portable, pure-Python dump — no `pg_dump`), stored on **local disk** or **S3** (optional `boto3`), with retention pruning. **One-click restore** rebuilds everything (confirmation required). Restore rewrites every table via the migrator role; the encryption master key is never stored in a backup. |
| **Theme & language** | light / dark / system (pre-paint) and full EN/PL localization (auto-detected). |
+7 -3
View File
@@ -90,9 +90,13 @@ _CONSOLE_CSP = (
"img-src 'self' data: blob:; "
"font-src 'self' data:; "
"style-src 'self' 'unsafe-inline'; "
"script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com; "
"worker-src 'self' blob: https://cdnjs.cloudflare.com; "
"connect-src 'self' https://cdnjs.cloudflare.com"
# cdnjs = lazy-loaded PDF.js; jsdelivr = lazy-loaded tesseract.js (in-browser OCR). The OCR/PDF
# engines are WebAssembly, so 'wasm-unsafe-eval' is required to compile the wasm module (it
# permits WASM only — NOT eval()). No document bytes leave the box; only the engine + language
# model are fetched. connect-src/worker-src cover the wasm + worker + tessdata fetches.
"script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net; "
"worker-src 'self' blob: https://cdnjs.cloudflare.com https://cdn.jsdelivr.net; "
"connect-src 'self' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net"
)
+187
View File
@@ -0,0 +1,187 @@
# Converting legacy `.doc` (binary OLE2) → `.docx` — research & options
> Companion to [`../OPTIONS.md`](../OPTIONS.md). Scope: how (and whether) Galena could convert
> **legacy binary `.doc`** (Word 97–2003, OLE2 / Compound File Binary Format) to **`.docx`** (OOXML),
> across **both** in-browser and server-side approaches, with the exact licensing of each. Galena's
> plugins are **frontend-only** (the backend never executes plugin code), so the central question is
> whether reliable in-browser `.doc→.docx` is feasible today.
>
> _Researched June 2026 via a multi-source, adversarially-verified sweep: 24 sources fetched → 111
> claims extracted → 25 verified (24 confirmed, 1 refuted), plus a direct read of the upstream
> LibreOffice WASM build docs. Time-sensitive — the WASM efforts are in active beta; re-check before
> committing._
## TL;DR
- The field **splits on a runtime axis.** Server-side, several tools genuinely **read** binary `.doc`
(LibreOffice, Apache POI HWPF, Aspose/Spire, catdoc). In-browser, the **only** architecturally
viable engine is **LibreOffice compiled to WebAssembly** (a.k.a. "LOWA"; productized as
**ZetaOffice**).
- **Unlike RTF, there is no permissive, frontend-only, reliable `.doc` converter.** RTF is plain-text
markup (trivially done in JS → graduated into core); `.doc` is a binary filesystem that realistically
needs a full office engine.
- **In-browser is real but not shippable off-the-shelf.** The LibreOffice WASM engine *can* run
headless conversion client-side, but it's **experimental**, **~300 MB**, needs **cross-origin
isolation** (COOP/COEP — a real CSP/header change for Galena), and is **MPL-2.0 (+Qt) copyleft**.
No one has publicly demonstrated an end-to-end in-browser **binary-`.doc` → `.docx` with output
extraction**.
- **Recommendation for Galena (unchanged from `OPTIONS.md`):** keep `.doc` on the
**download → edit → re-upload handoff** today; treat high-fidelity conversion as an **operator
sidecar** (server LibreOffice) or a future **isolated copyleft WASM plugin** — the same isolation
pattern as the GPL DjVu viewer.
## Why `.doc` is hard (it is not like RTF)
`.doc` is **not** markup. It is an **OLE2 / Compound File Binary Format** container — a FAT-style
filesystem of "storages" (directories) and "streams" (data) potentially fragmented across sectors. A
converter must implement that container layer **before** it even reaches Word's structures. This is
why ZIP/OOXML-based tools cannot read it:
- **mammoth.js** — docx-only; feeding it a `.doc` throws `Cannot read property root of null` (the
expected failure when an OLE2 binary hits a ZIP parser). _(verified 3-0)_
- **Pandoc** and **python-docx** — per the prompt's premises, also operate on the OOXML container, not
the OLE2 binary. _(consistent with the evidence; not separately re-verified)_
The format itself is **fully and openly documented** by Microsoft as **[MS-DOC]** (free PDF/DOCX,
under the Open Specifications IP regime / Open Specification Promise), so a from-scratch parser is
**legally unencumbered** — but implementing CFBF + MS-DOC is heavy engineering, which is why so few
tools read `.doc` natively. _(verified 3-0)_
## Recommendation matrix
| Option | Runtime | Fidelity | License tier | Galena fit |
|--------|---------|----------|--------------|------------|
| **LibreOffice headless** (`soffice --convert-to docx`) | Server | Full | **MPL-2.0** (copyleft) | Best server option → operator sidecar |
| **LibreOffice → WASM** (LOWA / ZetaOffice + MIT `zetajs`) | **Browser** | Full (engine = desktop LO) | **MIT** wrapper over **MPL-2.0** engine (+Qt) | Only frontend-feasible path; ⚠️ experimental, ~300 MB, COOP/COEP |
| **Apache POI HWPF** | Server (JVM) | Med/High | **Apache-2.0** (permissive) | Permissive, but the `.doc` reader is **orphaned** |
| **Aspose.Words** | Server (.NET/Java/Py/C++) | High | **Commercial** (from **US$1,199** perpetual) | Paid; not free-license-compatible |
| **Spire.Doc** | Server (.NET/Java/Py) | High | **Proprietary** ("Free To Use But Restricted"; para limits) | Paid/limited |
| **catdoc** | Server CLI | **Low** (text only, no `.docx`) | **GPL-2.0+** (copyleft) | Content extraction only |
| **From-scratch [MS-DOC]/CFBF parser** | Either | Scales with effort | Your choice (spec is OSP-clear) | Very high engineering cost |
| **Cloud APIs** (CloudConvert / Zamzar / ConvertAPI) | Remote | Full | Commercial pay-per-use | ⚠️ unverified; sends documents off-box |
## Server-side options (mature)
- **LibreOffice headless** — `soffice --headless --convert-to docx file.doc`. Full-fidelity, reads the
binary format reliably. **MPL-2.0** (LibreOffice is MPL-2.0 / LGPLv3+). The standard
high-fidelity choice; in Galena's model it's an **operator-installed sidecar**, not core.
_(the engine's `.doc` reliability is well established; CLI/MPL asserted as a premise, consistent
with the verified LibreOffice license.)_
- **Apache POI HWPF** (Java) — a pure-Java port of the Word 97(–2007) binary format, with limited
read-only support for Word 6/95. **Apache-2.0** (permissive). Caveat: the umbrella POI library is
actively maintained, but **HWPF is self-described as "an orphan child waiting to be adopted"** — no
committer familiar with the Word format. Server-side (JVM) only. _(verified 3-0)_
- **Aspose.Words** — commercial, full-fidelity, multi-runtime. **From US$1,199** (Developer Small
Business, perpetual) up to OEM/SDK/Site tiers. _(verified 3-0)_
- **Spire.Doc** — proprietary; genuinely reads Word 97–2003 `.doc` and converts to `.docx` without MS
Word. Licensed **"Free To Use But Restricted"** (free tier has paragraph limits / trial watermark;
a temporary license lifts them). Ships compiled native binaries. _(verified 3-0 / 2-1)_
- **catdoc** — lossy **text-only** extractor (parses OLE2, pulls the WordDocument stream to stdout;
preserves tables but not other formatting). **GPL-2.0+** (copyleft). Content extraction, not a
`.docx`-preserving converter. _(verified 3-0)_
- _Unconfirmed / not evaluated:_ antiword & wvWare (GPL), docx4j, GroupDocs, Syncfusion — no claim
survived verification.
## In-browser: LibreOffice WASM ("LOWA") / ZetaOffice — the deep dive
**This is the same engine at three layers:** the official **LibreOffice WASM** port (upstream, The
Document Foundation) → **ZetaOffice** (allotropia's productized distribution of it) → **`zetajs`**
(the MIT JS bridge over LibreOffice's UNO API). The upstream `README.wasm.md` explicitly credits
"patches from Allotropia." So evaluating "LibreOffice WASM" and "ZetaOffice" is evaluating one thing.
**Status — explicitly experimental** (from the upstream `static/README.wasm.md`):
- UNO bindings are "very rough," with "lots of different bits unimplemented" and possible memory
leaks; "Lots of room for improvement! ;)".
- Pinned to **Emscripten 4.0.10** and **Qt 5.15.2** (an LTS that's "not maintained publicly" with
"quite a few bugs"); version-fragile.
**Two build modes — the second is the conversion-relevant one:**
1. **Full Qt UI** — Writer/Calc running in the browser.
2. **Headless "LibreOffice Technology" core** — no UI, for embedding in other software (how Collabora
Online's WASM build works). There is an **in-browser headless conversion demo** (PDF export on the
`feature/wasm` branch). So the **engine genuinely can convert client-side** — the capability is
real.
**What's still unproven for Galena's use case:** binary-`.doc` **import** → `.docx` **export** →
**extracting the result out of the WASM virtual filesystem**, productized and reliable. The one
community wrapper attempting it (`libreoffice-web`) **has not implemented output extraction** ("not
yet implemented"), and the claim that it accepts binary `.doc` input in-browser was **refuted (0-3)**.
Desktop LibreOffice reads `.doc` reliably; the WASM headless build's `.doc` import filter has not been
publicly demonstrated end-to-end.
**The two costs nobody mentions up front:**
- **Cross-origin isolation.** Threads/SharedArrayBuffer require
`Cross-Origin-Opener-Policy: same-origin` + `Cross-Origin-Embedder-Policy: require-corp`. For Galena
that's an **app-wide change** — enabling COEP can break loading of cross-origin resources lacking
CORP/CORS headers (images, embeds) and interacts with the strict CSP. Not just "a big download."
- **Payload & memory.** ~300 MB of WASM/resources to the client; ~1 GB default heap (up to 4 GB).
(The "needs 64 GB RAM" figure is **link-time** only — building it, not running it.)
**Licensing:**
- Engine: **MPL-2.0** (file-level copyleft; LibreOffice is MPL-2.0 / LGPLv3+).
- **Qt wrinkle:** the *UI* build pulls in **Qt 5.15 (LGPLv3 / GPLv3 / commercial)**. The **headless
core** build avoids the Qt GUI — cleaner for conversion-only — but you still ship an MPL-2.0 (and
likely some LGPL) blob.
- The MIT `zetajs` bridge does **not** change this: the bytes you ship are the copyleft engine →
**isolated copyleft plugin**, exactly like the GPL DjVu viewer, **not** core.
## What this means for Galena
This confirms the call already in [`../OPTIONS.md`](../OPTIONS.md). Mapping `.doc` onto Galena's
established licensing pattern:
| Format | Nature | Outcome |
|--------|--------|---------|
| **RTF** | plain-text markup, trivial in JS, 0BSD | **graduated into core** (built-in text-level editor) |
| **DjVu** | GPL decoder, no permissive option | **isolated copyleft plugin** |
| **`.doc`** | binary OLE2; no permissive frontend-only converter exists | **handoff today**; operator sidecar or future isolated copyleft WASM plugin |
Realistic choices, best-fit first:
1. **Keep the handoff** — download → edit in Word/LibreOffice → re-upload. Zero new code, lossless,
what Galena ships now.
2. **Operator-installed server/sidecar** — LibreOffice headless (MPL) or a paid SDK (Aspose/Spire);
the same two-tier split (`OPTIONS.md` rank 3, Collabora) the self-hosted-drive market uses.
3. **Isolated copyleft WASM plugin** — ship the ~300 MB MPL ZetaOffice engine *if/when* output
extraction + `.doc` import are demonstrated reliable, with the COOP/COEP work done. "Watch this
space," not shippable today.
## Caveats (intellectual honesty)
- **Not separately re-verified** (consistent with evidence, no surviving claim): Pandoc & python-docx
being docx-only; LibreOffice CLI specifics; antiword/wvWare; docx4j; GroupDocs/Syncfusion; **all
cloud-API pricing/capabilities**. Treat these as open.
- The WASM efforts (ZetaOffice / `zetajs` / `libreoffice-web`) are **active beta** — the "no output
extraction" limitation and payload size can change quickly; re-check before committing.
- Aspose pricing (US$1,199) current early 2026; verify at purchase. Spire free-tier paragraph limits
affect real-world fidelity on large documents.
- The **refuted** claim matters: do **not** assume the WASM build's binary-`.doc` import filter works
in-browser without your own testing.
## Open questions
1. Can anyone demonstrate a working **client-side `.doc → .docx` round-trip today** (binary import,
output extracted from the WASM FS), and at what fidelity (tables/images/styles)?
2. Current capabilities, pricing, and **frontend-callability** of CloudConvert / Zamzar / ConvertAPI —
can they be invoked from a frontend-only plugin without backend execution while keeping documents
private?
3. Real-world fidelity & maintenance of the GPL alternatives not covered (antiword, wvWare) and
docx4j vs POI HWPF, given HWPF's orphaned status.
4. For Galena specifically: ship the ~300 MB MPL ZetaOffice engine as an isolated plugin, build a
lighter custom WASM/JS CFBF+MS-DOC parser, or accept that reliable conversion needs an out-of-band
server/cloud step?
## Sources
- LibreOffice WASM build doc (official) — <https://github.com/LibreOffice/core/blob/master/static/README.wasm.md>
- TDF Wiki: Development/WASM — <https://wiki.documentfoundation.org/Development/WASM>
- Phoronix: LibreOffice merges initial WASM support — <https://www.phoronix.com/news/LibreOffice-WASM-Build>
- The Register: WebAssembly port of LibreOffice — <https://www.theregister.com/2022/02/19/webassembly_port_libreoffice/>
- zetajs (MIT wrapper) — <https://github.com/allotropia/zetajs>
- ZetaOffice launch (allotropia) — <https://blog.allotropia.de/2024/11/08/launching-zetaoffice/>
- libreoffice-web (community wrapper; output extraction unbuilt) — <https://github.com/mapo80/libreoffice-web>
- Apache POI HWPF (document component) — <https://poi.apache.org/components/document/>
- Microsoft [MS-DOC] binary format spec — <https://learn.microsoft.com/en-us/openspecs/office_file_formats/ms-doc/ccd7b486-7881-484c-a137-51170af7cc22>
- MSRC: How to parse the .doc file format (CFBF/OLE2) — <https://msrc.microsoft.com/blog/2008/07/how-to-parse-the-doc-file-format/>
- Aspose.Words pricing — <https://purchase.aspose.com/pricing/words/net/>
- Spire.Doc for Python (PyPI) — <https://pypi.org/project/Spire.Doc/>
- catdoc — <https://github.com/petewarden/catdoc>
+6
View File
@@ -87,6 +87,12 @@ input:focus,select:focus,textarea:focus{outline:none;border-color:var(--border-h
.pw-strength.strong .pw-bar>i{background:var(--ok-text);} .pw-strength.strong .pw-lbl{color:var(--ok-text);}
@media(max-width:560px){.pw-opts{grid-template-columns:1fr;}}
/* OCR drop zone */
.ocr-drop{margin-top:16px;border:2px dashed var(--border-input);border-radius:12px;padding:28px;text-align:center;cursor:pointer;color:var(--text-secondary);background:var(--surface-muted);transition:border-color .12s,background .12s;}
.ocr-drop:hover,.ocr-drop.over{border-color:var(--border-hover);background:var(--surface);}
.ocr-drop-inner{display:flex;flex-direction:column;align-items:center;gap:6px;}
.ocr-drop svg{color:var(--text-muted);}
/* chips / badges */
.chip{display:inline-flex;align-items:center;gap:5px;padding:2px 8px;border-radius:999px;background:var(--surface-chip);border:1px solid var(--border);font-size:11.5px;color:var(--text-secondary);}
.chip.ok{background:var(--ok-bg);border-color:var(--ok-border);color:var(--ok-text);}
+129
View File
@@ -78,6 +78,7 @@ const ICN = {
eyeoff: '<path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/><path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"/><path d="M3 3l18 18"/>',
key: '<path d="M16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1 -4.069 0l-.301 -.301l-6.558 6.558a2 2 0 0 1 -1.239 .578l-.175 .008h-1.575a1 1 0 0 1 -.993 -.883l-.007 -.117v-1.575a2 2 0 0 1 .467 -1.284l.119 -.13l.414 -.414h2v-2h2v-2l2.144 -2.144l-.301 -.301a2.877 2.877 0 0 1 0 -4.069l2.643 -2.643a2.877 2.877 0 0 1 4.069 0z"/><path d="M15 9h.01"/>',
refresh: '<path d="M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4"/><path d="M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>',
scan: '<path d="M4 7v-1a2 2 0 0 1 2 -2h2"/><path d="M4 17v1a2 2 0 0 0 2 2h2"/><path d="M16 4h2a2 2 0 0 1 2 2v1"/><path d="M16 20h2a2 2 0 0 0 2 -2v-1"/><path d="M5 12l14 0"/>',
fileplus: '<path d="M14 3v4a1 1 0 0 0 1 1h4"/><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2"/><path d="M12 11l0 6"/><path d="M9 14l6 0"/>',
folderplus: '<path d="M12 19h-7a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v3.5"/><path d="M16 19h6"/><path d="M19 16v6"/>',
sun: '<path d="M14.828 14.828a4 4 0 1 0 -5.656 -5.656a4 4 0 0 0 5.656 5.656z"/><path d="M6.343 17.657l-1.414 1.414"/><path d="M6.343 6.343l-1.414 -1.414"/><path d="M17.657 6.343l1.414 -1.414"/><path d="M17.657 17.657l1.414 1.414"/><path d="M4 12h-2"/><path d="M12 4v-2"/><path d="M20 12h2"/><path d="M12 20v2"/>',
@@ -124,6 +125,7 @@ function renderTopActions() {
$('aBell').innerHTML = svg(ICN.bell); $('aDashboard').innerHTML = svg(ICN.dashboard);
$('aDrafts').innerHTML = svg(ICN.pr); $('aAdmin').innerHTML = svg(ICN.adjustments);
$('aPwgen').innerHTML = svg(ICN.key);
$('aOcr').innerHTML = svg(ICN.scan);
$('aTheme').innerHTML = svg(TH[themeMode()]); $('aUser').textContent = initials(state.user && state.user.email);
$('aAdmin').style.display = isAdmin() ? '' : 'none';
}
@@ -222,6 +224,7 @@ async function router() {
if (v === 'edit') return viewEditor(seg[1], q.path, C, q.ref);
if (v === 'admin') return viewAdmin(C);
if (v === 'password') return viewPasswordGen(C);
if (v === 'ocr') return viewOcr(C);
if (v === 'settings') return viewSettings(C);
if (v === 'about') return viewAbout(C);
viewNode(state.home.personal_id, '', C);
@@ -461,6 +464,122 @@ function _pwEye(input, btn) {
btn.onclick = () => { input.type = input.type === 'password' ? 'text' : 'password'; sync(); };
}
/* ── text recognition (OCR) — top-bar tool ──────────────────────────────────────────────────────
On-demand OCR that runs ENTIRELY in the browser — the file is never uploaded. Engines (see
OCR.md): Tesseract.js (Apache-2.0 WASM port of Tesseract's LSTM engine; language data is Apache-2.0,
downloaded on demand) is the recommended, permissive default; ocrs (MIT/Apache-2.0, Rust→WASM) is
offered as an experimental alternative — it has no stable in-browser distribution yet, so it's
best-effort (an operator can expose `window.OCRS.recognize` to enable it). PDFs reuse the PDF.js
loader: each page is rendered to a canvas, then OCR'd. */
const OCRX = { engine: 'tesseract', lang: 'eng', file: null };
const OCR_LANGS = [['eng', 'English'], ['pol', 'Polish'], ['deu', 'German'], ['fra', 'French'], ['spa', 'Spanish']];
const TESSERACT_URL = 'https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.min.js';
function viewOcr(C) {
setCrumb([{ label: 'Text recognition (OCR)' }]);
const langOpts = OCR_LANGS.map(([c, n]) => `<option value="${c}" ${OCRX.lang === c ? 'selected' : ''}>${n}</option>`).join('');
C.innerHTML = `<div class="page" style="max-width:760px">
<div class="page-head"><div><h1>Text recognition (OCR)</h1><div class="sub">Extract text from an image or PDF — it runs entirely in your browser, so the file is never uploaded.</div></div></div>
<div class="card"><div class="card-body">
<div class="grid2">
<label class="field">Engine<select id="ocrEngine" onchange="ocrSetEngine(this.value)"><option value="tesseract" ${OCRX.engine === 'tesseract' ? 'selected' : ''}>Tesseract.js — recommended</option><option value="ocrs" ${OCRX.engine === 'ocrs' ? 'selected' : ''}>ocrs — experimental</option></select></label>
<label class="field" id="ocrLangWrap">Language<select id="ocrLang" onchange="OCRX.lang=this.value">${langOpts}</select></label>
</div>
<div id="ocrEngineNote" class="faint" style="font-size:12px;margin-top:6px"></div>
<div id="ocrDrop" class="ocr-drop"><div class="ocr-drop-inner">${svg(ICN.upload, 22)}<div>Drop an image or PDF here, or <b>browse</b></div><div class="faint" id="ocrFileName" style="font-size:12px"></div></div></div>
<input type="file" id="ocrFile" accept="image/*,application/pdf" style="display:none">
<div style="margin-top:14px;display:flex;gap:8px;align-items:center">${btn('Extract text', { cls: 'primary', icon: ICN.scan, onclick: 'runOcr()' })}<span id="ocrProgress" class="faint" style="font-size:12px"></span></div>
</div></div>
<div class="card" id="ocrResultCard" style="margin-top:16px;display:none"><div class="card-head"><span>Extracted text</span><span class="faint" id="ocrResultMeta" style="font-size:11px"></span></div>
<div class="card-body"><textarea id="ocrResult" data-no-i18n spellcheck="false" style="min-height:240px;font:13px/1.5 var(--font-mono,ui-monospace,monospace)"></textarea>
<div style="margin-top:10px;display:flex;gap:8px">${btn('Copy', { cls: 'ghost', icon: ICN.copy, onclick: 'ocrCopy()' })}${btn('Download .txt', { cls: 'ghost', icon: ICN.download, onclick: 'ocrDownload()' })}</div></div></div>
</div>`;
const drop = $('ocrDrop'), inp = $('ocrFile');
drop.onclick = () => inp.click();
inp.onchange = () => ocrPick(inp.files && inp.files[0]);
drop.ondragover = (e) => { e.preventDefault(); drop.classList.add('over'); };
drop.ondragleave = () => drop.classList.remove('over');
drop.ondrop = (e) => { e.preventDefault(); drop.classList.remove('over'); ocrPick(e.dataTransfer.files && e.dataTransfer.files[0]); };
ocrSetEngine(OCRX.engine);
if (OCRX.file) $('ocrFileName').textContent = OCRX.file.name;
}
function ocrSetEngine(v) {
OCRX.engine = v;
const note = $('ocrEngineNote'), langWrap = $('ocrLangWrap');
if (v === 'ocrs') { if (note) note.textContent = 'ocrs is an experimental Rust/WASM engine (Latin script only) with no stable in-browser build yet — for reliable results use Tesseract.js.'; if (langWrap) langWrap.style.visibility = 'hidden'; }
else { if (note) note.textContent = 'Tesseract.js runs the Tesseract engine in your browser (Apache-2.0). The chosen language model downloads once on first use.'; if (langWrap) langWrap.style.visibility = ''; }
}
function ocrPick(file) { if (!file) return; OCRX.file = file; const n = $('ocrFileName'); if (n) n.textContent = file.name; }
async function runOcr() {
if (!OCRX.file) { toast('Choose an image or PDF first.'); return; }
const prog = $('ocrProgress'); const setP = (m) => { if (prog) prog.textContent = m; };
setP('Preparing…');
try {
const text = OCRX.engine === 'ocrs' ? await ocrWithOcrs(OCRX.file, setP) : await ocrWithTesseract(OCRX.file, OCRX.lang, setP);
$('ocrResultCard').style.display = '';
$('ocrResult').value = text || '';
$('ocrResultMeta').textContent = (text ? text.length : 0) + ' chars · ' + OCRX.engine;
setP('Done');
} catch (e) { setP(''); toast(e.message || 'OCR failed'); }
}
// PDF → one canvas per page (capped); image → the File itself. Both are valid tesseract.js inputs.
async function _ocrSources(file, setP) {
if (file.type === 'application/pdf' || /\.pdf$/i.test(file.name)) {
setP('Rendering PDF…');
await loadScript('https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.min.js');
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/3.11.174/pdf.worker.min.js';
const pdf = await pdfjsLib.getDocument({ data: await file.arrayBuffer() }).promise;
const out = []; const max = Math.min(pdf.numPages, 20);
for (let i = 1; i <= max; i++) {
const page = await pdf.getPage(i); const vp = page.getViewport({ scale: 2 });
const c = document.createElement('canvas'); c.width = vp.width; c.height = vp.height;
await page.render({ canvasContext: c.getContext('2d'), viewport: vp }).promise;
out.push(c);
}
return out;
}
return [file];
}
async function ocrWithTesseract(file, lang, setP) {
setP('Loading engine…');
await loadScript(TESSERACT_URL);
const sources = await _ocrSources(file, setP);
setP('Loading language…');
const worker = await Tesseract.createWorker(lang || 'eng', 1, {
logger: (m) => { if (m && m.status && typeof m.progress === 'number') setP(m.status + ' ' + Math.round(m.progress * 100) + '%'); },
});
try {
const parts = [];
for (let i = 0; i < sources.length; i++) {
if (sources.length > 1) setP('Page ' + (i + 1) + ' / ' + sources.length);
const { data } = await worker.recognize(sources[i]);
parts.push(data.text);
}
return parts.join('\n\n').trim();
} finally { await worker.terminate(); }
}
async function ocrWithOcrs(file, setP) {
// No stable in-browser ocrs distribution exists yet (see OCR.md). If an operator has exposed a
// build as window.OCRS.recognize(source)->Promise<string>, use it; otherwise explain honestly.
if (window.OCRS && typeof window.OCRS.recognize === 'function') {
const sources = await _ocrSources(file, setP);
setP('Running ocrs…');
const parts = [];
for (const s of sources) parts.push(await window.OCRS.recognize(s));
return parts.join('\n\n').trim();
}
throw new Error('ocrs has no in-browser build yet — use Tesseract.js (see OCR.md). Operators can expose window.OCRS to enable it.');
}
async function ocrCopy() { const o = $('ocrResult'); if (!o || !o.value) return; try { await navigator.clipboard.writeText(o.value); toast('Text copied'); } catch { o.select(); try { document.execCommand('copy'); toast('Text copied'); } catch (e) { toast("Couldn't copy — select and copy manually."); } } }
function ocrDownload() {
const o = $('ocrResult'); if (!o) return;
const base = (OCRX.file && OCRX.file.name ? OCRX.file.name.replace(/\.[^.]+$/, '') : 'ocr');
const blob = new Blob([o.value || ''], { type: 'text/plain;charset=utf-8' });
const a = document.createElement('a'); a.href = URL.createObjectURL(blob); a.download = base + '.txt';
document.body.appendChild(a); a.click(); a.remove(); setTimeout(() => URL.revokeObjectURL(a.href), 1000);
}
window.ocrSetEngine = ocrSetEngine; window.runOcr = runOcr; window.ocrCopy = ocrCopy; window.ocrDownload = ocrDownload; window.OCRX = OCRX;
async function viewScope(scope, C) {
const list = await api('GET', '/drive/' + scope);
setCrumb([{ label: scope === 'favorites' ? 'Favourites' : 'Shared with me' }]);
@@ -1428,6 +1547,15 @@ const I18N = { pl: {
'No backups yet.': 'Brak kopii zapasowych.', 'Storage error — check the configuration.': 'Błąd magazynu — sprawdź konfigurację.', 'unavailable': 'niedostępne',
'Each backup contains all files and the full database. S3 storage needs the optional boto3 dependency plus AWS credentials in the server environment; restoring is destructive and replaces everything.': 'Każda kopia zawiera wszystkie pliki i całą bazę danych. Magazyn S3 wymaga opcjonalnej zależności boto3 oraz danych logowania AWS w środowisku serwera; przywracanie jest nieodwracalne i zastępuje wszystko.',
'Backup settings saved': 'Zapisano ustawienia kopii', 'Creating backup…': 'Tworzenie kopii…', 'Backup created': 'Utworzono kopię', 'Restoring…': 'Przywracanie…', 'Restore complete — reloading': 'Przywrócono — przeładowanie', 'Backup deleted': 'Usunięto kopię',
// OCR (text recognition)
'Text recognition (OCR)': 'Rozpoznawanie tekstu (OCR)', 'Extract text from an image or PDF — it runs entirely in your browser, so the file is never uploaded.': 'Wyodrębnij tekst z obrazu lub PDF — działa w całości w przeglądarce, więc plik nie jest nigdzie wysyłany.',
'Engine': 'Silnik', 'Tesseract.js — recommended': 'Tesseract.js — zalecane', 'ocrs — experimental': 'ocrs — eksperymentalne',
'English': 'Angielski', 'Polish': 'Polski', 'German': 'Niemiecki', 'French': 'Francuski', 'Spanish': 'Hiszpański',
'Tesseract.js runs the Tesseract engine in your browser (Apache-2.0). The chosen language model downloads once on first use.': 'Tesseract.js uruchamia silnik Tesseract w przeglądarce (Apache-2.0). Wybrany model językowy pobiera się raz przy pierwszym użyciu.',
'ocrs is an experimental Rust/WASM engine (Latin script only) with no stable in-browser build yet — for reliable results use Tesseract.js.': 'ocrs to eksperymentalny silnik Rust/WASM (tylko alfabet łaciński) bez stabilnej wersji w przeglądarce — dla pewnych wyników użyj Tesseract.js.',
'Drop an image or PDF here, or': 'Upuść obraz lub PDF tutaj, albo', 'browse': 'przeglądaj', 'Extract text': 'Wyodrębnij tekst', 'Extracted text': 'Wyodrębniony tekst', 'Download .txt': 'Pobierz .txt',
'Preparing…': 'Przygotowanie…', 'Rendering PDF…': 'Renderowanie PDF…', 'Loading engine…': 'Ładowanie silnika…', 'Loading language…': 'Ładowanie języka…', 'Done': 'Gotowe',
'Choose an image or PDF first.': 'Najpierw wybierz obraz lub PDF.', 'Text copied': 'Skopiowano tekst', 'OCR failed': 'OCR nie powiodło się',
// drafts / review chat
'Review requests you authored or can approve': 'Wnioski o przegląd, które utworzyłeś lub możesz zatwierdzić', 'No drafts.': 'Brak szkiców.', 'for you': 'dla Ciebie', 'No messages yet.': 'Brak wiadomości.',
// history / changes / resolve
@@ -1565,6 +1693,7 @@ $('loginForm').addEventListener('submit', doLogin);
$('aDashboard').onclick = () => go('dashboard');
$('aDrafts').onclick = () => go('drafts');
$('aPwgen').onclick = () => go('password');
$('aOcr').onclick = () => go('ocr');
$('aAdmin').onclick = () => go('admin');
_pwEye($('password'), $('pwToggleLogin')); // login show/hide toggle
$('aSearch').onclick = openPalette;
+1
View File
@@ -76,6 +76,7 @@
<button class="iconbtn" id="aDashboard" title="Dashboard"></button>
<button class="iconbtn" id="aDrafts" title="Drafts"></button>
<button class="iconbtn" id="aPwgen" title="Password generator"></button>
<button class="iconbtn" id="aOcr" title="Text recognition (OCR)"></button>
<button class="iconbtn" id="aAdmin" title="Administration"></button>
<span class="vdiv"></span>
<button class="iconbtn" id="aSearch" title="Search (Ctrl/⌘K)"></button>