Translate user-facing docs and node help to English

README, NODES.md, install scripts, palette help text, and example flows — node .js logic unchanged.
This commit is contained in:
root
2026-08-22 17:36:38 +02:00
parent 5f5a381662
commit ec74e9208c
18 changed files with 361 additions and 390 deletions
+81 -81
View File
@@ -1,71 +1,71 @@
# Noder — nextcloud collabora
# Nodes — nextcloud collabora
Sex flödesnoder i paletten + en config. Alla sex pekar på samma **nc-collab-config** (kugghjul, inte i paletten). Utan config händer inget.
Six flow nodes in the palette plus one config node. All six point at the same **nc-collab-config** (gear menu, not in the palette). Without config, nothing works.
## Backends
| Backend | Typisk adress | Roll |
|---------|---------------|------|
| Nextcloud | `https://cloud.hannesahlin.se` | Filer (WebDAV) + Office-API (OCS) |
| Collabora CODE | `https://172.17.0.2:9980` | Konvertering (`/cool/...`) på Docker bridge |
| Backend | Typical URL | Role |
|---------|-------------|------|
| Nextcloud | `https://cloud.example.com` | Files (WebDAV) + Office API (OCS) |
| Collabora CODE | `https://172.17.0.2:9980` | Conversion (`/cool/...`) on Docker bridge |
Auth: **användarnamn + app-lösenord**. Inte kontolösen.
Auth: **username + app password**. Not your account password.
Standardutdata om du inte anger sökväg: `/Dokument/OfficeOut/`
Default output folder if you omit a path: `/Dokument/OfficeOut/` (or set your own via `destNcPath`).
---
## Så hänger de ihop
## How they fit together
```
nc-collab-config (URL + app-lösen)
nc-collab-config (URLs + app password)
│
┌────┼────┬────────────┐
▼ ▼ ▼ ▼
collabora-* nc-office collabora-wopi collabora-bridge
(direkt CODE) (NC OCS) (health/WOPI) (kedjor + sparar)
(direct CODE) (NC OCS) (health/WOPI) (pipelines + save)
```
**Tumregel**
**Rules of thumb**
- PDF i Nextcloud → `collabora-bridge` **ncFileToPdf**
- Fylla mall i NC → **fillTemplateSave** eller `nc-office template:fillFields`
- Öppna i webbläsaren → `nc-office` **document:direct**
- Bara byta format i minnet → `collabora-convert`
- Se fältnamn → `collabora-extract` eller bridge **extractToPayload**
- Kolla att CODE lever → `collabora-wopi` **capabilities**
- PDF in Nextcloud → `collabora-bridge` **ncFileToPdf**
- Fill template in NC → **fillTemplateSave** or `nc-office template:fillFields`
- Open in browser → `nc-office` **document:direct**
- Convert in memory only → `collabora-convert`
- List field names → `collabora-extract` or bridge **extractToPayload**
- Check CODE is alive → `collabora-wopi` **capabilities**
---
## Gemensamma fält i msg
## Common `msg` fields
| Fält | Betydelse |
|------|-----------|
| `ncPath` | Sökväg i användarens filer, t.ex. `/Dokument/avtal.docx` |
| `fileId` | NC fil-id (slås upp från ncPath om saknas) |
| `payload` | Rådata redan i flödet (Buffer eller HTML) |
| Field | Meaning |
|-------|---------|
| `ncPath` | Path in the user's files, e.g. `/Documents/contract.docx` |
| `fileId` | Nextcloud numeric file id (resolved from `ncPath` if missing) |
| `payload` | Raw data already in the flow (Buffer or HTML string) |
| `format` | pdf, png, docx, html, … |
| `destNcPath` | Exakt målsökväg |
| `destFolder` / `destName` | Mapp + namn (default `/Dokument/OfficeOut/`) |
| `fields` / `transform` | JSON att skriva in i mall |
| `templateNcPath` | Extra mall till convert |
| `compareNcPath` | Gammal version för diff-PDF |
| `operation` | Överstyr dropdown på noden |
| `destNcPath` | Exact destination path |
| `destFolder` / `destName` | Folder + name (default folder `/Dokument/OfficeOut/`) |
| `fields` / `transform` | JSON to merge into a template |
| `templateNcPath` | Extra template file for convert |
| `compareNcPath` | Older version for diff PDF |
| `operation` | Overrides the node dropdown |
Fel → `msg.error` + röd nod. Flödet dör inte tyst.
Errors go to `msg.error` and turn the node red. The flow does not fail silently.
---
## 1. collabora-convert
Gör om fil till annat format via CODE. Sparar **inte** i Nextcloud — utdata i `msg.payload` (Buffer).
Convert a file to another format via CODE. Does **not** save to Nextcloud — output is `msg.payload` (Buffer).
**In:** `msg.payload` eller WebDAV GET `msg.ncPath`. Valfritt `templateNcPath`, `compareNcPath`, `format`.
**In:** `msg.payload` or WebDAV GET `msg.ncPath`. Optional `templateNcPath`, `compareNcPath`, `format`.
**Ut:** `payload`, `filename`, `format`, `contentType`, `statusCode`.
**Out:** `payload`, `filename`, `format`, `contentType`, `statusCode`.
```
inject { ncPath: "/Dokument/avtal.docx", format: "pdf" }
inject { ncPath: "/Documents/contract.docx", format: "pdf" }
→ collabora-convert → debug
```
@@ -73,12 +73,12 @@ inject { ncPath: "/Dokument/avtal.docx", format: "pdf" }
## 2. collabora-extract
Lista struktur (content controls, fält …). JSON ut, ingen fil.
List structure inside a document (content controls, fields, etc.). JSON out, no file.
**In:** samma källa som convert. Filter: nod eller `msg.filter` (default `contentcontrol`).
**In:** same as convert. Filter: node dropdown or `msg.filter` (default `contentcontrol`).
```
inject { ncPath: "/Mallar/avtal.docx" }
inject { ncPath: "/Templates/contract.docx" }
→ collabora-extract → function → collabora-transform
```
@@ -86,50 +86,50 @@ inject { ncPath: "/Mallar/avtal.docx" }
## 3. collabora-transform
Skriv värden i dokument via CODE. Kräver `msg.fields` eller `msg.transform`.
Write values into a document via CODE. Requires `msg.fields` or `msg.transform`.
```
msg.ncPath = "/Mallar/avtal.docx"
msg.fields = { "Kund": "AB Exempel", "Datum": "2026-08-22" }
msg.ncPath = "/Templates/contract.docx"
msg.fields = { "Customer": "ACME Ltd", "Date": "2026-08-22" }
→ collabora-transform
```
Spara själv efteråt om filen ska ligga i NC.
Save yourself afterwards if the file should live in Nextcloud.
---
## 4. collabora-wopi
Hälsokoll och WOPI — inte konvertering.
Health checks and WOPI helpers — not conversion.
| Operation | Syfte |
|-----------|--------|
| `capabilities` | Första test att CODE svarar |
| `discovery` | mime → editor-URL |
| Operation | Purpose |
|-----------|---------|
| `capabilities` | First test that CODE responds |
| `discovery` | mime → editor URL |
| `buildEditor` | `wopiSrc` + `token` → `editorUrl` |
| `checkFileInfo` / `getFile` | Felsökning |
| `checkFileInfo` / `getFile` | Debugging |
Publik editor-URL går via Nextcloud (`collaboraPublicUrl`), inte intern IP.
Public editor URLs go through Nextcloud (`collaboraPublicUrl`), not the internal CODE IP.
---
## 5. nc-office
Nextcloud richdocuments OCS — mallar, fält, editor-URL, assets.
Nextcloud richdocuments OCS — templates, fields, editor URL, assets.
| Operation | Kort |
|-----------|------|
| `templates:list` | Lista mallar |
| `templates:create` | Ny fil från mall |
| `template:extractFields` | Fält-JSON via NC |
| `template:fillFields` | Fyll + spara i NC |
| `document:direct` | `editorUrl` för inloggad användare |
| `document:public` | Samma med shareToken |
| `files:convert` | NC → NC konvertering |
| `assets:create` | Infogningslänk till öppen editor |
| Operation | Summary |
|-----------|---------|
| `templates:list` | List templates |
| `templates:create` | New file from template |
| `template:extractFields` | Field JSON via NC |
| `template:fillFields` | Fill + save in NC |
| `document:direct` | `editorUrl` for logged-in user |
| `document:public` | Same with `shareToken` |
| `files:convert` | NC → NC conversion |
| `assets:create` | One-shot insert URL for open editor |
```
inject { ncPath: "/Dokument/avtal.docx" }
inject { ncPath: "/Documents/contract.docx" }
→ nc-office (document:direct) → debug editorUrl
```
@@ -137,38 +137,38 @@ inject { ncPath: "/Dokument/avtal.docx" }
## 6. collabora-bridge
Färdiga pipelines — det mesta i vardagsflöden.
Ready-made pipelines — what you'll use most day to day.
| Operation | Gör |
|-----------|-----|
| `ncFileToPdf` | NC-fil → PDF i OfficeOut |
| `ncFileToPng` | Förhandsvisning |
| `ncFileToHtml` | HTML-export |
| Operation | Does |
|-----------|------|
| `ncFileToPdf` | NC file → PDF in OfficeOut |
| `ncFileToPng` | Preview PNG |
| `ncFileToHtml` | HTML export |
| `htmlToOffice` | HTML → docx/pdf … |
| `fillTemplateSave` | Mall + fält → spara i NC |
| `compareVersionsPdf` | Diff-PDF |
| `extractToPayload` | Fält-JSON i msg |
| `createAssetLink` | assetUrl |
| `fillTemplateSave` | Template + fields → save in NC |
| `compareVersionsPdf` | Diff PDF |
| `extractToPayload` | Field JSON in msg |
| `createAssetLink` | `assetUrl` |
```
inject { ncPath: "/Dokument/avtal.docx" }
inject { ncPath: "/Documents/contract.docx" }
→ collabora-bridge (ncFileToPdf)
→ debug destNcPath
```
Efter bridge kan du koppla dina befintliga OCS-noder (Talk, Mail, dela länk): först PDF i `/Dokument/OfficeOut/`, sedan dela.
Chain your existing OCS nodes (Talk, Mail, share link) after bridge: PDF lands in `/Dokument/OfficeOut/`, then share or send.
---
## Config: nc-collab-config
Skapas under kugghjul i Node-RED. Alla sex noder väljer samma config-instans.
Create under the gear icon in Node-RED. All six flow nodes pick the same config instance.
| Fält | Exempel |
|------|---------|
| nextcloudUrl | `https://cloud.hannesahlin.se` |
| collaboraUrl | `https://172.17.0.2:9980` (bridge-IP, verifyTls=false) |
| collaboraPublicUrl | `https://cloud.hannesahlin.se` |
| username + app-lösenord | Nextcloud-inloggning |
| Field | Example |
|-------|---------|
| nextcloudUrl | `https://cloud.example.com` |
| collaboraUrl | `https://172.17.0.2:9980` (bridge IP, verifyTls=false) |
| collaboraPublicUrl | `https://cloud.example.com` |
| username + app password | Nextcloud login |
IP för CODE detekteras vid `./install.sh` — se `.env.example`.
CODE IP is detected when you run `./install.sh` — see `.env.example`.