Webserver to serve the Webdesq Office client code and act as a gateway for certain operations
  • Rust 96.5%
  • Shell 3.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Bart Pype 5720d29f3f initial import of Webdesq Office server
Rust based webserver to serve the webdesq office client and act as gateway for certain operations.
2026-11-19 00:48:47 +01:00
.cargo initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
src initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
.gitignore initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
build-linux.sh initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
build-windows.sh initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
Cargo.lock initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
Cargo.toml initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
config.toml initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00
readme.md initial import of Webdesq Office server 2026-11-19 00:48:47 +01:00

Webdesq Office server

Serves the Office web client, plugins, plugin ratings, the font library, document templates, and a CORS/SSRF-safe HTTP gateway. Deployment is a single static binary, same idea as the storage server.

dependencies

Rust edition 2021. Direct crates (see Cargo.toml):

data storage

All on-disk state lives under data/ (data_dir in config.toml):

  • data/client/ — built Office SPA (index.html and assets). Unknown paths fall back to index.html.
  • data/plugins/ — compiled *.plugin.mjs files
  • data/fonts/ — font files served at /api/fonts/:name
  • data/templates/ — .write / .calc / .present / .plan / .site templates
  • data/keys/ — {placeholder}.key files for plugin API keys (not committed)
  • data/db/ — Turso SQLite (office.db) for plugin ratings
  • data/certs/ — TLS certificate and key

logs/ holds daily access logs when [log] enabled = true.

run

cd servers/officeserver
cargo run

Copy a production client build into data/client/, plugins into data/plugins/, and fonts into data/fonts/.

Override the config path with WEBDESQ_OFFICE_CONFIG.

Linux release binaries (static musl, no glibc)

Same cross-compile path as the storage server: musl via Zig so the binary is not tied to a host glibc.

On the machine you build from (this can be macOS):

  1. Rust (rustup)
  2. Zig 0.13+ — brew install zig on macOS
  3. cargo install cargo-zigbuild

Then:

cd servers/officeserver
chmod +x build-linux.sh
./build-linux.sh

Outputs:

  • dist/webdesq-office-linux-x64
  • dist/webdesq-office-linux-arm64

Windows 11 release binaries

Same Zig/cargo-zigbuild setup as Linux. No Visual Studio or Windows SDK on the build machine. Turso’s Windows build step needs windres; build-windows.sh wraps Zig’s zig rc as that tool.

cd servers/officeserver
chmod +x build-windows.sh
./build-windows.sh

Outputs:

  • dist/webdesq-office-windows-x64.exe — Intel/AMD Windows 11
  • dist/webdesq-office-windows-arm64.exe — ARM Windows 11 (Snapdragon X and similar)

Copy the matching .exe, config.toml, and a data/ tree onto the host.

Copy the binary, config.toml, and a data/ tree onto the host. On first start without Let's Encrypt files, a self-signed cert is written under data/certs/.

Behind a TLS terminator, set [tls] enabled = false and bind localhost. The process already sends CSP, HSTS, and cache headers. nginx should only proxy — do not add Content-Security-Policy or location /assets/ (a location without proxy_pass 404s hashed JS/CSS). Multiple CSP headers all apply.

server {
    listen 443 ssl http2;
    server_name test.office.webdesq.net;
    # ssl_certificate / ssl_certificate_key …

    location / {
        proxy_pass http://127.0.0.1:4444;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Hashed files under /assets/ are Cache-Control: public, max-age=31536000, immutable with no ETag / Last-Modified (no 304 revalidation). index.html, /sw.js, and /api/* are no-cache / no-store.

CORS is off unless [cors] origins is set. Leave it empty in production (same host as nginx). For Vite against this API: origins = ["http://localhost:5173"].

Rate limit applies only to POST, PUT, and PATCH from the same client IP (default burst 60, then 15 per second). Loading the client (GET of HTML, JS, fonts, plugins) is unlimited. Set burst or per_second to 0 to disable. Keys use the TCP peer unless trusted_proxies lists your nginx address; then the last X-Forwarded-For hop is used.

[rate_limit]
burst = 60
per_second = 15
trusted_proxies = ["127.0.0.1", "::1"]

HTTP surface

  • GET / — Office client
  • GET /api/status
  • GET /api/plugins?app=&version=
  • GET /api/plugins/:file
  • GET /api/plugins/ratings
  • POST /api/plugins/ratings/:id
  • GET /api/fonts/:font
  • GET /api/templates/all (also /templates/all)
  • GET /api/templates/:file
  • POST /api/gateway — fetch URL / article HTML (SSRF-filtered)
  • POST /api/plugingateway — signed plugin proxy with optional server-side API keys