- Rust 96.5%
- Shell 3.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Rust based webserver to serve the webdesq office client and act as gateway for certain operations. |
||
| .cargo | ||
| src | ||
| .gitignore | ||
| build-linux.sh | ||
| build-windows.sh | ||
| Cargo.lock | ||
| Cargo.toml | ||
| config.toml | ||
| readme.md | ||
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):
- tokio 1 — async runtime
- axum 0.8 — HTTP API
- axum-server 0.7 — TLS listener
- tower 0.5 + tower-http 0.6 — CORS, tracing, static files
- rustls 0.23 + rustls-pemfile 2 + rcgen 0.13 — TLS 1.3 and local dev certs
- turso 0.8 — embedded SQLite for plugin ratings
- serde 1 + serde_json 1 + toml 0.8 — JSON and
config.toml - reqwest 0.12 (rustls) — outbound gateway fetches
- url 2 — URL parsing
- zip 2 — template document metadata
- chrono 0.4 — timestamps
- tracing 0.1 + tracing-subscriber 0.3 — logs
- thiserror 2 — API errors
- sha2 0.10 + hex 0.4 — gateway request hashing
- base64 0.22 — Basic auth credentials
- mime_guess 2 — font content types
data storage
All on-disk state lives under data/ (data_dir in config.toml):
data/client/— built Office SPA (index.htmland assets). Unknown paths fall back toindex.html.data/plugins/— compiled*.plugin.mjsfilesdata/fonts/— font files served at/api/fonts/:namedata/templates/—.write/.calc/.present/.plan/.sitetemplatesdata/keys/—{placeholder}.keyfiles for plugin API keys (not committed)data/db/— Turso SQLite (office.db) for plugin ratingsdata/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):
Then:
cd servers/officeserver
chmod +x build-linux.sh
./build-linux.sh
Outputs:
dist/webdesq-office-linux-x64dist/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 11dist/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 clientGET /api/statusGET /api/plugins?app=&version=GET /api/plugins/:fileGET /api/plugins/ratingsPOST /api/plugins/ratings/:idGET /api/fonts/:fontGET /api/templates/all(also/templates/all)GET /api/templates/:filePOST /api/gateway— fetch URL / article HTML (SSRF-filtered)POST /api/plugingateway— signed plugin proxy with optional server-side API keys