Translate user-facing docs and node help to English
README, NODES.md, install scripts, palette help text, and example flows — node .js logic unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+45
-176
@@ -1,205 +1,74 @@
|
||||
# Assistentmanual — Nextcloud Office + Collabora Node-RED
|
||||
# Agent manual — Nextcloud Collabora Node-RED nodes
|
||||
|
||||
**Version 1.0 — 22 augusti 2026**
|
||||
For flow agents building automations on Nextcloud + Collabora CODE. You edit Node-RED flows, not LibreOffice macros in the browser. File I/O goes through WebDAV or OCS. Document conversion goes through CODE REST.
|
||||
|
||||
Gäller sidecaren `nextcloud-collabora-nodered` mot Nextcloud på `cloud.hannesahlin.se` och Collabora CODE 26.04.x (container `code`, `127.0.0.1:9980`). Odds-scraper ignoreras.
|
||||
## Rules
|
||||
|
||||
Du är en **flödesagent**. Du skapar och modifierar Node-RED-flöden, inte LibreOffice-makron i webbläsaren. All fil-I/O går via Nextcloud WebDAV eller OCS. All dokumentmotor går via CODE REST.
|
||||
1. Use **app passwords** in `nc-collab-config`. Never account passwords.
|
||||
2. Do **not overwrite originals**. Default output: `/Dokument/OfficeOut/`.
|
||||
3. `postMessage` and iframe APIs are browser-only — not Node-RED.
|
||||
4. Save files with **WebDAV PUT**, not WOPI PutFile.
|
||||
5. Do not expose port 9980 beyond loopback on the host.
|
||||
6. Do not touch odds-scraper or unrelated services in flows.
|
||||
|
||||
---
|
||||
## Environment
|
||||
|
||||
## 1. Uppdrag och gränser
|
||||
| Key | Value |
|
||||
|-----|-------|
|
||||
| Nextcloud | `https://cloud.example.com` |
|
||||
| Existing Node-RED | `nextcloud-node-red` on `:1880` — Collabora nodes integrate here |
|
||||
| Internal CODE | `https://172.17.0.2:9980` on Docker bridge (container `code`) |
|
||||
| Auth | Basic + app password, header `OCS-APIRequest: true` |
|
||||
|
||||
1. Använd **app-lösenord** i `nc-collab-config`. Aldrig vanligt kontolösen.
|
||||
2. Skriv **inte över original**. Standardmål: `/Dokument/OfficeOut/`.
|
||||
3. `postMessage`-API och `CallPythonScript` är iframe/webbläsare. **Inte Node-RED.**
|
||||
4. WOPI PutFile är CODE:s jobb mot Nextcloud. Agenten använder **WebDAV PUT**.
|
||||
5. Exponera inte port 9980 utanför loopback.
|
||||
6. Rör inte odds-scraper eller Gitea-databaslösen i flöden.
|
||||
See [INFRASTRUCTURE.md](INFRASTRUCTURE.md) for network layout.
|
||||
|
||||
---
|
||||
## Nodes
|
||||
|
||||
## 2. Miljö
|
||||
Full reference: [NODES.md](NODES.md).
|
||||
|
||||
| Nyckel | Värde |
|
||||
|--------|-------|
|
||||
| Nextcloud | `https://cloud.hannesahlin.se` (host 192.168.1.26) |
|
||||
| CODE | container `code`, `127.0.0.1:9980`, aliasgroup `https://cloud.hannesahlin.se:443` |
|
||||
| Befintlig Node-RED | `nextcloud-node-red` `:1880` — **Collabora-noder integreras här** |
|
||||
| Sidecar :1881 | Endast med `INSTALL_MODE=sidecar` (ej standard) |
|
||||
| Intern CODE-URL från sidecar | `http://172.17.0.2:9980` (Docker bridge, container `code`) |
|
||||
| Auth | Basic + Nextcloud app-lösenord, header `OCS-APIRequest: true` |
|
||||
**Config:** one `nc-collab-config` per environment — all six flow nodes need it.
|
||||
|
||||
Se [INFRASTRUCTURE.md](INFRASTRUCTURE.md) för container- och nätverkskartor.
|
||||
**Common msg fields:** `ncPath`, `fileId`, `payload`, `format`, `destNcPath`, `fields`, `transform`, `operation`.
|
||||
|
||||
---
|
||||
**Prefer `collabora-bridge`** for everyday tasks (`ncFileToPdf`, `fillTemplateSave`). Use low-level `collabora-*` nodes when bridge is not enough.
|
||||
|
||||
## 3. Kartan Nextcloud → Collabora
|
||||
## Example flows
|
||||
|
||||
| Nextcloud | Collabora-yta | Nod |
|
||||
|-----------|-----------------|-----|
|
||||
| WebDAV GET fil | input till convert/extract/transform | convert, extract, transform, bridge |
|
||||
| WebDAV PUT | spara PDF/DOCX/PNG | samma + `destNcPath` |
|
||||
| files convert OCS | samma motor via richdocuments | nc-office `files:convert` |
|
||||
| richdocuments mallar | convert-to `template=` eller NC create-from-template | nc-office `templates:*` |
|
||||
| template fields | content controls | extractFields / fillFields / transform |
|
||||
| file versions | compare= på convert-to | bridge `compareVersionsPdf` |
|
||||
| fileId + direct token | WOPISrc + editor iframe | nc-office `document:direct`, wopi `buildEditor` |
|
||||
| assets API | linking / insert graphic URL | assets:create + klient postMessage |
|
||||
| shares | public edit URL | document:public |
|
||||
| preview | convert-to png | ncFileToPng |
|
||||
| HTML/MD | convert-to office | htmlToOffice |
|
||||
|
||||
Talk, Tables, Mail, Collectives ska **konsumera resultatet** (dela PDF, bifoga, lägg i collective) — de ersätter inte WOPI-host.
|
||||
|
||||
---
|
||||
|
||||
## 4. Noder och msg-kontrakt
|
||||
|
||||
### 4.1 nc-collab-config
|
||||
|
||||
En instans per miljö. Fält: `nextcloudUrl`, `collaboraUrl`, ev. `collaboraPublicUrl`, `username`, app-lösen, `verifyTls` (false i labb-VM tills certkedjan är ren).
|
||||
|
||||
### 4.2 Gemensamma msg-fält
|
||||
|
||||
| Fält | Betydelse |
|
||||
|------|-----------|
|
||||
| `ncPath` | Sökväg i användarens filrot, t.ex. `/Mallar/avtal.docx` |
|
||||
| `fileId` | Numeriskt Nextcloud-fileid |
|
||||
| `payload` | Buffer eller text om källan inte ligger i NC |
|
||||
| `format` | pdf \| png \| docx \| odt \| html \| txt \| xlsx \| pptx … |
|
||||
| `destNcPath` / `destFolder` / `destName` | Var resultatet skrivs |
|
||||
| `transform` / `fields` | JSON för struktur-API eller mallfält |
|
||||
| `templateNcPath` / `compareNcPath` | Extra filer till convert-to |
|
||||
| `operation` | Överstyr dropdown |
|
||||
| `statusCode` / `error` / `filename` / `contentType` | Utdata |
|
||||
|
||||
### 4.3 Operationskatalog
|
||||
|
||||
| Nod.operation | När |
|
||||
|---------------|-----|
|
||||
| bridge.ncFileToPdf/Png/Html | Standardkonvertering NC-fil → NC-fil |
|
||||
| bridge.htmlToOffice | Agentgenererad HTML/MD → office |
|
||||
| bridge.fillTemplateSave | Fyll content controls/fält och spara kopia |
|
||||
| bridge.compareVersionsPdf | Ny + gammal fil → PDF med ändringar |
|
||||
| bridge.extractToPayload | Struktur-JSON till nästa nod |
|
||||
| bridge.createAssetLink | Engångs-URL för insert i öppet dokument |
|
||||
| nc-office.templates:list\|create | Office-mallar i richdocuments |
|
||||
| nc-office.template:extractFields\|fillFields | Föredra när fileId finns |
|
||||
| nc-office.document:direct\|public | Engångs redigerings-URL |
|
||||
| nc-office.files:convert | Konvertera via Nextcloud (CODE bakom) |
|
||||
| convert + extract + transform | Låg nivå när bridge inte räcker |
|
||||
| wopi.discovery\|capabilities | Hälsokoll och mime→urlsrc |
|
||||
| wopi.buildEditor | Bygg editorUrl om token redan finns |
|
||||
| wopi.checkFileInfo\|getFile | Endast felsökning av WOPI-host |
|
||||
|
||||
---
|
||||
|
||||
## 5. Recept
|
||||
|
||||
### A. NC-fil till PDF
|
||||
### A. NC file → PDF
|
||||
|
||||
```
|
||||
inject {ncPath} → collabora-bridge ncFileToPdf → ev. filesharing createShare (OCS :1880)
|
||||
inject { ncPath: "/Documents/contract.docx" }
|
||||
→ collabora-bridge (ncFileToPdf)
|
||||
→ debug destNcPath
|
||||
```
|
||||
|
||||
Kontrollera `destNcPath` i svaret.
|
||||
|
||||
### B. Avtalsmall
|
||||
### B. Template fill
|
||||
|
||||
```
|
||||
extractFields eller extract contentcontrol
|
||||
→ mappa data till fields/transform
|
||||
→ fillTemplateSave eller template:fillFields med destination
|
||||
→ valfritt ncFileToPdf
|
||||
→ document:direct för mänsklig granskning
|
||||
extractToPayload or template:extractFields
|
||||
→ function (map data to fields)
|
||||
→ fillTemplateSave or template:fillFields
|
||||
```
|
||||
|
||||
### C. Versionsdiff
|
||||
### C. Open in browser
|
||||
|
||||
```
|
||||
{ncPath: ny, compareNcPath: gammal} → compareVersionsPdf
|
||||
→ skicka PDF via Talk eller Mail-noden i OCS-paketet (:1880)
|
||||
nc-office (document:direct) → debug editorUrl
|
||||
```
|
||||
|
||||
### D. Generera dokument
|
||||
## Troubleshooting
|
||||
|
||||
HTML i `payload` → `htmlToOffice` format docx eller pdf. Använd mall via convert `templateNcPath` om typografi måste följa husmall.
|
||||
| Symptom | Fix |
|
||||
|---------|-----|
|
||||
| ECONNREFUSED :9980 | Connect Node-RED to Docker bridge; use detected CODE IP |
|
||||
| Empty convert response | Use HTTPS to internal CODE; check CODE is healthy |
|
||||
| WebDAV 401 | New app password; same user as file path |
|
||||
| WebDAV 404 | Leading slash on path; URL-encode segments |
|
||||
|
||||
---
|
||||
## Acceptance criteria
|
||||
|
||||
## 6. Vad du inte ska bygga
|
||||
- Test document converts to PDF under `/Dokument/OfficeOut/`
|
||||
- Original unchanged
|
||||
- Errors in `msg.error`, node status red — no silent failure
|
||||
|
||||
- En Node-RED-nod som postMessage:ar in i Collabora-iframe (kräver webbsida utanför iframen).
|
||||
- Dynamisk Python mot share/Scripts/python (kräver paket på CODE och omstart).
|
||||
- Andra CODE-container i compose (`code` körs redan med aliasgroup1).
|
||||
- Portkrock på 1880 mot nextcloud-node-red.
|
||||
|
||||
---
|
||||
|
||||
## 7. Felsökning
|
||||
|
||||
| Symptom | Orsak | Åtgärd |
|
||||
|---------|-------|--------|
|
||||
| ECONNREFUSED :9980 | Sidecar inte på bridge / fel IP | Använd `http://172.17.0.2:9980`, kontrollera `docker network inspect bridge` |
|
||||
| Tomt convert-svar | CODE storage / fel URL | Anropa intern 9980, inte publik host |
|
||||
| WebDAV 401 | App-lösen / user | Nytt app-lösen, samma uid som sökvägen |
|
||||
| WebDAV 404 | Fel sökväg | Leading slash, rätt folder, URL-encode segment |
|
||||
| extract tomt | Filter / capability | capabilities, prova documentproperties |
|
||||
| WOPI 401/proof | Sessionstoken | Lämna WOPI. Använd WebDAV. |
|
||||
| TLS-fel mot NC | Cert i containern | verifyTls=false |
|
||||
|
||||
---
|
||||
|
||||
## 8. Acceptanskriterier för ett flöde
|
||||
|
||||
- `capabilities` mot CODE returnerar JSON.
|
||||
- En känd testdokumentsökväg konverteras till PDF under `/Dokument/OfficeOut/`.
|
||||
- Originalfilen är oförändrad.
|
||||
- Fel hamnar i `msg.error` och nodstatus röd, flödet kraschar inte tyst.
|
||||
- Inga hemligheter i debug-payload till Talk.
|
||||
|
||||
---
|
||||
|
||||
## 9. Installation (Ubuntu)
|
||||
|
||||
```bash
|
||||
# /home/ncadmin/nextcloud-collabora-nodered
|
||||
chmod +x install.sh
|
||||
./install.sh
|
||||
# UI: http://192.168.1.26:1881
|
||||
```
|
||||
|
||||
Överföring från Windows:
|
||||
|
||||
```bash
|
||||
./package.sh # skapar artifacts/nextcloud-collabora-nodered-1.0.0.tar.gz
|
||||
scp artifacts/*.tar.gz ncadmin@192.168.1.26:/home/ncadmin/
|
||||
# på servern:
|
||||
tar -xzf nextcloud-collabora-nodered-1.0.0.tar.gz -C nextcloud-collabora-nodered
|
||||
cd nextcloud-collabora-nodered && ./install.sh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 10. Arkitektur
|
||||
|
||||
```
|
||||
Befintligt (orört):
|
||||
nextcloud-ocs 16 noder + nextcloud-config
|
||||
container nextcloud-node-red :1880
|
||||
CODE "code" :127.0.0.1:9980
|
||||
|
||||
Ny yta (det här paketet):
|
||||
nc-collab-config
|
||||
nc-office richdocuments OCS
|
||||
collabora-convert /cool/convert-to
|
||||
collabora-extract /cool/extract-document-structure
|
||||
collabora-transform /cool/transform-document-structure
|
||||
collabora-wopi discovery, capabilities, editor-URL
|
||||
collabora-bridge agent-pipelines
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*cloud.hannesahlin.se · nextcloud-collabora-nodered v1.0*
|
||||
See also [NODES.md](NODES.md) for operation tables and examples.
|
||||
|
||||
+30
-52
@@ -1,66 +1,44 @@
|
||||
# Infrastruktur — cloud.hannesahlin.se (192.168.1.26)
|
||||
# Infrastructure
|
||||
|
||||
Verifierad 2026-08-22. Sidecar ska passa in utan att röra befintliga tjänster.
|
||||
Verified layout for integrate mode (nodes on existing `:1880`, not sidecar).
|
||||
|
||||
## Containers
|
||||
|
||||
| Container | Image | Port | Nätverk | IP |
|
||||
|-----------|-------|------|---------|-----|
|
||||
| `code` | collabora/code:latest (26.04.3.1) | 127.0.0.1:9980 | `bridge` | 172.17.0.2 |
|
||||
| `nextcloud-node-red` | nextcloud-node-red:latest | 0.0.0.0:1880 | `nextcloud-node-red_odds_network` | 172.18.0.3 |
|
||||
| `nextcloud-node-red` | nextcloud-node-red:latest | 0.0.0.0:1880 | odds_network + **bridge** (efter install) | 172.18.0.3 |
|
||||
| ~~nextcloud-collabora-nodered~~ | — | — | **Används ej** — noder integreras i :1880 | — |
|
||||
| `gitea_server` | gitea/gitea:latest | 127.0.0.1:3000 | (egen) | — |
|
||||
| `odds-postgres` | postgres:16-alpine | 5433 | odds_network | — |
|
||||
| Container | Image | Port | Network | Notes |
|
||||
|-----------|-------|------|---------|-------|
|
||||
| nextcloud-node-red | custom | 1880 | odds_network (+ bridge for CODE) | Existing Node-RED |
|
||||
| code | collabora/code | 127.0.0.1:9980 | bridge | Collabora CODE |
|
||||
| odds-postgres | postgres:16 | 5433→5432 | odds_network | Odds scraper DB — do not touch |
|
||||
|
||||
## Viktigt om nätverk
|
||||
Sidecar `nextcloud-collabora-nodered` on :1881 is **not used** — integrate mode patches the :1880 instance.
|
||||
|
||||
- **CODE** ligger på Docker **`bridge`** (172.17.0.0/16), inte på `odds_network`.
|
||||
- **Collabora-noder** installeras i befintlig `nextcloud-node-red` — ingen ny container
|
||||
- **`install.sh`** patchar `/home/ncadmin/nextcloud-node-red` och bygger om samma image
|
||||
- Efter install: `docker network connect bridge nextcloud-node-red` (sker automatiskt)
|
||||
- `127.0.0.1:9980` på host når CODE, men **inte** från en container utan bridge/host-mode.
|
||||
- `host.docker.internal` är opålitligt på Linux — använd **172.17.0.2**.
|
||||
- **nextcloud-node-red** (:1880) ska **inte** flyttas till bridge; den stannar på odds_network.
|
||||
## Networking
|
||||
|
||||
## Nextcloud
|
||||
- **CODE** runs on Docker **`bridge`** (typically 172.17.0.x), not on `odds_network`.
|
||||
- After `docker compose up`, connect Node-RED to bridge:
|
||||
`docker network connect bridge nextcloud-node-red`
|
||||
- Host `127.0.0.1:9980` reaches CODE from the host, not from containers without bridge.
|
||||
- On Linux, prefer detected bridge IP over `host.docker.internal`.
|
||||
- **nextcloud-node-red** stays on `odds_network`; bridge is an extra attachment for CODE only.
|
||||
|
||||
- URL: https://cloud.hannesahlin.se
|
||||
- Host: 192.168.1.26, `/var/www/nextcloud`
|
||||
- Sidecar: `extra_hosts: cloud.hannesahlin.se:192.168.1.26`, `verifyTls: false` tills cert i container
|
||||
|
||||
## CODE
|
||||
|
||||
- `aliasgroup1=https://cloud.hannesahlin.se:443`
|
||||
- Starta **ingen** ny CODE-container
|
||||
- REST: `/cool/convert-to`, `/cool/extract-document-structure`, `/cool/transform-document-structure`
|
||||
- WOPI discovery: `/hosting/discovery`, `/hosting/capabilities`
|
||||
|
||||
## Git (Gitea)
|
||||
|
||||
- https://kode.hannesahlin.se/n3wk/nextcloud-collabora-nodered
|
||||
- SSH port **2222** på host
|
||||
|
||||
## Bootstrap (ny VM)
|
||||
|
||||
```bash
|
||||
curl -fsSL https://kode.hannesahlin.se/n3wk/nextcloud-collabora-nodered/raw/branch/main/bootstrap-install.sh | bash
|
||||
```
|
||||
|
||||
## Kataloger på host
|
||||
## Install paths (example host)
|
||||
|
||||
```
|
||||
/home/ncadmin/
|
||||
├── nextcloud-node-red/ # :1880 — orört
|
||||
├── nextcloud-collabora-nodered/ # :1881 — detta paket
|
||||
├── n3wkode/ # Gitea compose
|
||||
├── odds-scraper/ # ignoreras
|
||||
└── nodered-embed/
|
||||
├── nextcloud-node-red/ # :1880 — patched by integrate
|
||||
│ └── nodes/nextcloud-collabora/ # copied package (lib/ + nodes/)
|
||||
└── nextcloud-collabora-nodered/ # this repo
|
||||
```
|
||||
|
||||
## Collabora SDK (referens)
|
||||
## Public vs internal URLs
|
||||
|
||||
- [Conversion API](https://sdk.collaboraonline.com/docs/conversion_api.html)
|
||||
- [Extract/Transform API](https://sdk.collaboraonline.com/docs/extract_transform_api.html)
|
||||
- [Linking API](https://sdk.collaboraonline.com/docs/linking_api.html)
|
||||
- postMessage: webbläsare/iframe — **inte** Node-RED
|
||||
| Use | URL |
|
||||
|-----|-----|
|
||||
| Nextcloud API / WebDAV | `https://cloud.example.com` |
|
||||
| CODE from Node-RED container | `https://<bridge-ip>:9980` (verifyTls=false) |
|
||||
| Browser editor / WOPI | `collaboraPublicUrl` — usually same as Nextcloud proxy |
|
||||
|
||||
## Gitea (optional)
|
||||
|
||||
- https://kode.hannesahlin.se/n3wk/nextcloud-collabora-nodered
|
||||
- SSH git on port 2222 if configured
|
||||
|
||||
+81
-81
@@ -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`.
|
||||
|
||||
Reference in New Issue
Block a user