Initial import of LogDarioSeq baseline

Establishes version control for the personal Logseq DB fork before
starting the server-client architecture migration and domain features
described in docs/agent-guide and the approved implementation plan.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-25 15:32:15 +02:00
commit 40631362b3
2016 changed files with 543898 additions and 0 deletions

50
deps/publish/worker/README.md vendored Normal file
View File

@@ -0,0 +1,50 @@
## 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 namespace
- `PUBLISH_R2`: R2 bucket
- `R2_ACCOUNT_ID`: Cloudflare account id for signing
- `R2_BUCKET`: R2 bucket name for signing
- `R2_ACCESS_KEY_ID`: R2 access key for signing
- `R2_SECRET_ACCESS_KEY`: R2 secret key for signing
- `COGNITO_JWKS_URL`: JWKS URL for Cognito user pool
- `COGNITO_ISSUER`: Cognito issuer URL
- `COGNITO_CLIENT_ID`: Cognito client ID
- `DEV_SKIP_AUTH`: set to `true` to 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-meta` header (JSON)
- Body is transit payload (stored in R2 as-is)
- `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`
- `DELETE /pages/:graph-uuid/:page-uuid`
- Deletes a published page
- `DELETE /pages/:graph-uuid`
- Deletes all pages for a graph
- `GET /tag/:tag-name`
- List all pages tagged with `:tag-name`
- `GET /ref/:page-name`
- List all pages that reference `:page-name`
- `GET /user/:user-name`
- List all pages for `:user-name`
### Notes
- This is a starter implementation. Integrate with your deployment tooling
(wrangler, etc.) as needed.
- For local testing, run `wrangler dev` and use `deps/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-worker` before running the worker.
- For dev, you can run `clojure -M:cljs watch publish-worker` in one terminal.

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
GRAPH_UUID=${GRAPH_UUID:-"00000000-0000-0000-0000-000000000000"}
cat <<MSG
To clear local Durable Object state, remove the miniflare state directory:
rm -rf .wrangler/state/v3/durable-objects/${GRAPH_UUID}
If your dev environment uses a different state path, locate it under:
.wrangler/state/v3/
MSG

36
deps/publish/worker/scripts/dev_test.sh vendored Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail
BASE_URL=${BASE_URL:-"http://127.0.0.1:8787"}
GRAPH_UUID=${GRAPH_UUID:-"00000000-0000-0000-0000-000000000000"}
PAGE_UUID=${PAGE_UUID:-"00000000-0000-0000-0000-000000000001"}
META=$(cat <<JSON
{"page-uuid":"${PAGE_UUID}","block-count":1,"schema-version":"0","publish/format":"transit","publish/compression":"none","publish/content-hash":"dev","publish/content-length":1,"publish/graph":"${GRAPH_UUID}","publish/created-at":0}
JSON
)
PAYLOAD="{}"
curl -sS -X POST "${BASE_URL}/pages" \
-H "content-type: application/transit+json" \
-H "x-publish-meta: ${META}" \
--data-binary "${PAYLOAD}"
echo
curl -sS "${BASE_URL}/pages/${GRAPH_UUID}/${PAGE_UUID}"
echo
curl -sS "${BASE_URL}/pages/${GRAPH_UUID}/${PAGE_UUID}/transit"
echo
curl -sS "${BASE_URL}/pages"
echo
curl -sS "${BASE_URL}/p/${GRAPH_UUID}/${PAGE_UUID}"
echo

71
deps/publish/worker/wrangler.toml vendored Normal file
View File

@@ -0,0 +1,71 @@
name = "logseq-publish"
main = "dist/worker/main.js"
compatibility_date = "2025-05-05"
compatibility_flags = ["nodejs_compat"]
# Workers Logs
# Docs: https://developers.cloudflare.com/workers/observability/logs/workers-logs/
# Configuration: https://developers.cloudflare.com/workers/observability/logs/workers-logs/#enable-workers-logs
[observability]
enabled = true
[[durable_objects.bindings]]
name = "PUBLISH_META_DO"
class_name = "PublishMetaDO"
[[migrations]]
tag = "v2"
new_sqlite_classes = ["PublishMetaDO"]
[[r2_buckets]]
binding = "PUBLISH_R2"
bucket_name = "logseq-publish-dev"
[vars]
COGNITO_JWKS_URL = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_dtagLnju8/.well-known/jwks.json"
COGNITO_ISSUER = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_dtagLnju8"
COGNITO_CLIENT_ID = "69cs1lgme7p8kbgld8n5kseii6"
[env.staging]
name = "logseq-publish-staging"
[env.staging.vars]
COGNITO_JWKS_URL = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_dtagLnju8/.well-known/jwks.json"
COGNITO_ISSUER = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_dtagLnju8"
COGNITO_CLIENT_ID = "69cs1lgme7p8kbgld8n5kseii6"
[[env.staging.durable_objects.bindings]]
name = "PUBLISH_META_DO"
class_name = "PublishMetaDO"
[[env.staging.migrations]]
tag = "v2"
new_sqlite_classes = ["PublishMetaDO"]
[[env.staging.r2_buckets]]
binding = "PUBLISH_R2"
bucket_name = "logseq-publish-dev"
[env.prod]
name = "logseq-publish-prod"
[env.prod.vars]
COGNITO_JWKS_URL = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_dtagLnju8/.well-known/jwks.json"
COGNITO_ISSUER = "https://cognito-idp.us-east-1.amazonaws.com/us-east-1_dtagLnju8"
COGNITO_CLIENT_ID = "69cs1lgme7p8kbgld8n5kseii6"
[[env.prod.durable_objects.bindings]]
name = "PUBLISH_META_DO"
class_name = "PublishMetaDO"
[[env.prod.migrations]]
tag = "v2"
new_sqlite_classes = ["PublishMetaDO"]
[[env.prod.r2_buckets]]
binding = "PUBLISH_R2"
bucket_name = "logseq-publish-prod"
[[env.prod.routes]]
pattern = "logseq.io"
custom_domain = true