mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
Cloudflare Publish Worker (Skeleton)
This worker accepts publish payloads and stores transit blobs in R2 while keeping metadata in a Durable Object backed by SQLite.
Bindings
PUBLISH_META_DO: Durable Object namespacePUBLISH_R2: R2 bucketR2_ACCOUNT_ID: Cloudflare account id for signingR2_BUCKET: R2 bucket name for signingR2_ACCESS_KEY_ID: R2 access key for signingR2_SECRET_ACCESS_KEY: R2 secret key for signingCOGNITO_JWKS_URL: JWKS URL for Cognito user poolCOGNITO_ISSUER: Cognito issuer URLCOGNITO_CLIENT_ID: Cognito client IDDEV_SKIP_AUTH: set totrueto bypass JWT verification in local dev
Routes
GET /p/:graph-uuid/:page-uuid- Returns server-rendered HTML for the page
POST /pages- Requires
Authorization: Bearer <JWT> - Requires
x-publish-metaheader (JSON) - Body is transit payload (stored in R2 as-is)
- Requires
GET /pages/:graph-uuid/:page-uuid- Returns metadata for the page
GET /pages/:graph-uuid/:page-uuid/transit- Returns JSON with a signed R2 URL and
etag
- Returns JSON with a signed R2 URL and
DELETE /pages/:graph-uuid/:page-uuid- Deletes a published page
DELETE /pages/:graph-uuid- Deletes all pages for a graph
GET /pages- Lists metadata entries (from the index DO)
GET /tag/:tag-name- List all pages tagged with
:tag-name
- List all pages tagged with
GET /ref/:page-name- List all pages that reference
:page-name
- List all pages that reference
GET /user/:user-name- List all pages for
:user-name
- List all pages for
Notes
- This is a starter implementation. Integrate with your deployment tooling (wrangler, etc.) as needed.
- For local testing, run
wrangler devand usedeps/publish/worker/scripts/dev_test.sh. - If you switch schema versions, clear local DO state with
deps/publish/worker/scripts/clear_dev_state.sh. - Build the worker bundle with
clojure -M:cljs release publish-workerbefore running the worker. - For dev, you can run
clojure -M:cljs watch publish-workerin one terminal.