sx-pub Phase 2: publish to IPFS, browse collections, resolve by path + CID
New endpoints: - POST /pub/publish — pin SX content to IPFS, store path→CID in DB - GET /pub/browse/<collection> — list published documents - GET /pub/doc/<collection>/<slug> — resolve path to CID, fetch from IPFS - GET /pub/cid/<cid> — direct CID fetch (immutable, cache forever) New helpers: pub-publish, pub-collection-items, pub-resolve-document, pub-fetch-cid Tested: published stdlib.sx (6.9KB) → QmQQyR3Ltqi5sFiwZh5dutPbAM4QsEBnw419RyNnTj4fFM Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,10 @@ def _register_sx_helpers() -> None:
|
||||
"pub-actor-data": _pub_actor_data,
|
||||
"pub-collections-data": _pub_collections_data,
|
||||
"pub-status-data": _pub_status_data,
|
||||
"pub-publish": _pub_publish,
|
||||
"pub-collection-items": _pub_collection_items,
|
||||
"pub-resolve-document": _pub_resolve_document,
|
||||
"pub-fetch-cid": _pub_fetch_cid,
|
||||
})
|
||||
|
||||
|
||||
@@ -1740,3 +1744,23 @@ async def _pub_collections_data():
|
||||
async def _pub_status_data():
|
||||
from .pub_helpers import check_status
|
||||
return await check_status()
|
||||
|
||||
|
||||
async def _pub_publish(collection, slug, content, title="", summary=""):
|
||||
from .pub_helpers import publish_document
|
||||
return await publish_document(collection, slug, content, title, summary)
|
||||
|
||||
|
||||
async def _pub_collection_items(collection_slug):
|
||||
from .pub_helpers import collection_items
|
||||
return await collection_items(collection_slug)
|
||||
|
||||
|
||||
async def _pub_resolve_document(collection_slug, slug):
|
||||
from .pub_helpers import resolve_document
|
||||
return await resolve_document(collection_slug, slug)
|
||||
|
||||
|
||||
async def _pub_fetch_cid(cid):
|
||||
from .pub_helpers import fetch_cid
|
||||
return await fetch_cid(cid)
|
||||
|
||||
Reference in New Issue
Block a user