Skip to content

feat(wopi): point WopiFileSource at collab WOPI host endpoints + client-push save#100

Merged
schnsrw merged 1 commit into
mainfrom
feat/wopi-filesource-collab-endpoints
Jun 24, 2026
Merged

feat(wopi): point WopiFileSource at collab WOPI host endpoints + client-push save#100
schnsrw merged 1 commit into
mainfrom
feat/wopi-filesource-collab-endpoints

Conversation

@schnsrw

@schnsrw schnsrw commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

What

Reworks the editor's Mode 2 (WOPI) WopiFileSource to talk directly to the collab server's WOPI host endpoints — the contract Casual Sheets already uses — instead of the legacy Go gateway's embed-proxy routes. This unblocks the WOPI half of the Go→collab cutover.

Endpoint changes

Op Before (Go gateway) After (collab)
open GET /api/docs/{id}/download GET /wopi/files/:id/contents
version ETag header X-WOPI-ItemVersion header
save threw WopiNotSupportedError POST /wopi/files/:id/contents + X-WOPI-ItemVersion If-Match
name/size WS preflight only GET /wopi/files/:id (CheckFileInfo)

save() is now the client-push snapshot the autosave hook already drives. A host-side version conflict (collab 409) surfaces as the new exported WopiSaveConflictError (with expected/actual). The JWT still rides as ?access_token=; collab enforces file_id == :id and per-route read/write. Boot/probe (extractWopiContext, /doc/{id}?access_token=) is unchanged; rename()/delete() still throw since the host owns lifecycle.

Verified: typecheck, lint (0 errors), 57 file-source unit tests (WOPI contract incl. PutFile If-Match + 409 conflict), and build all pass locally.

…nt-push save

Rework Mode 2 (WOPI) to consume the collab server's WOPI host contract
directly — the same one Casual Sheets already uses — instead of the legacy
Go gateway's embed-proxy routes:

- open()  -> GET  /wopi/files/:id/contents  (was /api/docs/{id}/download);
            item version read from X-WOPI-ItemVersion (was ETag).
- save()  -> POST /wopi/files/:id/contents  with X-WOPI-ItemVersion If-Match;
            previously threw. This is the client-push snapshot model the
            autosave hook already drives. A 409 surfaces as the new
            WopiSaveConflictError (exported).
- list()  -> enriches the single embedded entry via CheckFileInfo
            (GET /wopi/files/:id) for the authoritative name + size.

The JWT still rides as ?access_token=; collab verifies file_id == :id and
the per-route read/write permission. Boot/probe (extractWopiContext,
/doc/{id}?access_token=) is unchanged. rename()/delete() still throw — the
host owns the file lifecycle.
@schnsrw schnsrw merged commit 0e7ffaa into main Jun 24, 2026
7 checks passed
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