Skip to main content

Module preview

Module preview 

Source
Expand description

POST <prefix>/api/repos/<owner>/<repo>/preview: the unstaged tier.

Follows the JSS forge apiRepoPreview and EPHEMERAL_PREVIEW_KIND (cited by name only). The endpoint publishes one signed, ephemeral Nostr event (kind EPHEMERAL_PREVIEW_KIND, 21617, inside the NIP-01 20000-29999 ephemeral range) that carries the file content, and makes no commit, no ref update and no anchor, and writes nothing to disk. Relays do not store ephemeral events, so only viewers connected at that moment see the preview.

Authorisation, body rules, size caps and CORS are exactly those of crate::web_edit: owner-signed unless ForgeConfig::open_edit is on. The event is signed with the forge-instance announce key and sent through the same relay publisher and SSRF policy as the repository announcements; it needs the announce feature (without it the endpoint validates and then answers 501).

The event tags are ["d", "<owner>/<repo>"], ["f", "<path>"] and ["branch", "<branch>"]; the content is the file content as sent.

§Examples

assert_eq!(solid_pod_rs_forge::preview::EPHEMERAL_PREVIEW_KIND, 21617);

Constants§

EPHEMERAL_PREVIEW_KIND
The NIP-01 ephemeral event kind used for previews (JSS EPHEMERAL_PREVIEW_KIND).