Skip to content

feat: connect Nextcloud to an office suite; 34.0.3:2 -> 34.0.3:3 - #139

Merged
MattDHill merged 3 commits into
masterfrom
feat/office-suite
Sep 1, 2026
Merged

feat: connect Nextcloud to an office suite; 34.0.3:2 -> 34.0.3:3#139
MattDHill merged 3 commits into
masterfrom
feat/office-suite

Conversation

@MattDHill

Copy link
Copy Markdown
Member

Connects Nextcloud to an office suite, via the two new packages
collabora-online-startos and
onlyoffice-docs-startos.

What it adds

  • An Office Suite action — Collabora Online, ONLYOFFICE Docs, or none — with a conditional running dependency on the chosen service.
  • A generated startos-office.conf and its four proxy modules, written into the container on every start, serving the document server from Nextcloud's own origin.
  • An office-connectors health check, present only while a suite is selected.

The connector app itself stays user-installed, following the Talk/Coturn precedent already in this package.

Why the editor is served from Nextcloud's origin

Both document servers can only be told one browser-facing address, so any instance reachable at more than one — a LAN address and a public domain, or a .onion — would get a working editor on exactly one of them. Proxying under Nextcloud's own origin removes the choice: the editor is always served from whichever address the browser already holds. It also means neither service needs an address, a certificate or a domain of its own, and both stay off the LAN entirely.

ONLYOFFICE derives its public URLs per request from X-Forwarded-Host/-Proto/-Prefix, so a prefix and those headers are all it needs. Collabora writes an absolute origin into its WOPI discovery document, which Nextcloud caches and copies into the editor frame verbatim — so the config rewrites that origin out with mod_substitute, leaving a root-relative urlsrc the browser resolves itself. Filed upstream as nextcloud/richdocuments#6019; if it lands, the rewrite can go.

Two failures worth calling out

trusted_domains. The existing mapper excludes bridge addresses. A document server fetches and saves over the bridge, so without the bridge IP every one of those requests comes back {"error": "Trusted domain error.", "code": 15} — the editor opens and then fails to load the document. Nothing on the Collabora side catches this: richdocuments:activate-config passes all four of its checks, because it only exercises discovery and capabilities, never the callback leg.

A second office connector. richdocuments drops the Microsoft formats out of its default-open capability whenever it finds onlyoffice or officeonline enabled (CapabilitiesService::hasOtherOOXMLApps), and the rival does not claim them unless it is configured too. Word, Excel and PowerPoint then open in neither and silently download, with nothing in Nextcloud saying why. Hence a failing health check naming the app to disable, rather than a task, which can be dismissed while the breakage remains.

Verified on a dev box

  • Documents open and edit in the browser on both backends, ODF and OOXML.
  • richdocuments:activate-config passes discovery, mimetype, capabilities and WOPI-server checks, with an empty public URL — which is what a relative urlsrc produces.
  • occ onlyoffice:documentserver --check reports the document server connected at /ds-vpath/, a real conversion round-trip that exercises the relative URL, the proxy, the JWT pairing and the download over the bridge.
  • Both of Collabora's websocket URL shapes proxy — the bare /cool/ws and the encoded-slash compat form.
  • Switching backends clears the previous connector's settings in both directions; the connector health check goes red naming the rival app and recovers when it is disabled.

MattDHill and others added 3 commits September 1, 2026 12:10
Adds an Office Suite action selecting Collabora Online or ONLYOFFICE Docs, a
conditional running dependency on the chosen one, and a generated Apache config
that serves it from Nextcloud's own origin.

Serving the editor from Nextcloud's own address is what makes it work on LAN, a
domain and Tor at once rather than on whichever single address the document
server was told to advertise. ONLYOFFICE derives its public URLs per request from
X-Forwarded-*; Collabora writes an absolute origin into its discovery document,
which Nextcloud copies into the editor frame verbatim, so the config rewrites it
to a relative URL on the way through (nextcloud/richdocuments#6019).

The bridge IP joins trusted_domains while a suite is selected. A document server
fetches and saves over the bridge, and Nextcloud otherwise answers every one of
those requests with `Trusted domain error` — the editor opens and then fails to
load the document, which no check on the Collabora side catches.

The office-connectors health check fails while a second office connector app is
enabled. richdocuments drops the Microsoft formats the moment it sees a rival
(CapabilitiesService::hasOtherOOXMLApps), and the rival does not claim them
unless it is configured too, so Word, Excel and PowerPoint open in neither and
silently download. A check rather than a task, which can be dismissed while the
breakage remains.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both engines round-trip a complex Word document without losing anything —
measured on calibre's demo.docx: identical text, and every table, cell, image,
hyperlink, bookmark, footnote, endnote and field count preserved by each.

They differ in how they write it back. ONLYOFFICE returns the file structurally
byte-identical. LibreOffice resolves style-inherited formatting into direct
formatting on each run (w:rPr 260 -> 826, w:rFonts 82 -> 503, w:color 66 -> 403),
which is invisible on screen but stops later style changes cascading in Word.
It converges after one pass rather than growing without bound.

That is a narrow reason to spend four times the memory, so the action labels
Collabora recommended and the instructions say when the other one is worth it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…y Registry

The per-run formatting Collabora writes out costs nothing on one document —
it is invisible on screen and repairable by hand. It only earns four times the
memory across a large corpus of style-dependent documents that keeps cycling
back to Word, so say that rather than "moves back and forth with Office".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@MattDHill
MattDHill merged commit 3e7d5c6 into master Sep 1, 2026
3 checks passed
@MattDHill
MattDHill deleted the feat/office-suite branch September 1, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant