@fiduswriter/dav
v0.1.1
Published
DAV/WebDAV file store and editor adapter for embedding the Fidus Writer editor in Nextcloud, opencloud and other WebDAV-based hosts
Maintainers
Readme
@fiduswriter/dav — DAV/WebDAV adapter for the Fidus Writer editor
This repository is the storage adapter that lets the Fidus Writer editor
run against documents stored as .fidus files on a DAV/WebDAV server —
Nextcloud, opencloud, ownCloud or any generic WebDAV host. It is published on
npm as @fiduswriter/dav and is the piece that the
fiduswriter-nextcloud
app builds on. It deliberately contains no editor code itself and no Fidus
Writer server backend: it only turns "a .fidus file somewhere on a DAV
server" into a running editor and back.
Fidus Writer is an online collaborative editor especially made for academics who need to use citations and/or formulas. The editor focuses on the content rather than the layout, so that with the same text, you can later on publish it in multiple ways: on a website, as a printed book, or as an ebook.
What this package does
- Loads a
.fidusfile from a DAV server: Fetches the container, validates its MIME type and schema version, migrates older document versions and hands the editor everything it needs — document content, bibliography, and images as ready-to-display data URLs — through the@fiduswriter/editorstatic bootstrapping API. - Saves the editor state back to a
.fidusfile: Re-serializes the document, comments, bibliography and images into a byte-exact.fiduscontainer (including any embedded document template) andPUTs it to the server with anIf-Matchetag, so concurrent edits are detected rather than silently overwritten. - Handles conflicts: When the server rejects a save because the file changed elsewhere, it returns a 409 so the editor's built-in merge kicks in — local changes are re-fetched against the server version and merged without losing work.
- Manages editing locks: Acquires a Nextcloud Files lock (or a WebDAV
LOCK, or no-op fallback) for the editing session and releases it when the page is left, so two users do not edit the same file at the same time. - Switches storage backends behind one interface: A
NextcloudStore(Nextcloud WebDAV + thefiles_lockOCS API) and aWebdavStore(generic WebDAV withIf-Match/LOCK) both implement the same smallDavFileStoreinterface, which makes porting to other DAV systems a matter of adding another implementation. - Boots the whole editor for you:
mountFidusEditoris a single high-level entry point that takes a store and a file id, loads the document, starts the editor in direct-save mode with autosave and the 409 merge wired up, and reports save status to the host page.
Quick start (development)
Development happens with all Fidus Writer repositories checked out next to one
another, since this package depends on @fiduswriter/editor,
@fiduswriter/document, @fiduswriter/image-manager and fwtoolkit from
their sibling checkouts:
npm install
npm run build
npm testThe test suite covers .fidus round-trips (content, bibliography, images and
embedded templates), the conflict path and the store implementations.
License
All of Fidus Writer's original code is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE, for details see LICENSE. Some third party libraries are licensed under other, compatible open source libraries. Licensing information is included in those files.
