| 1 | // Package sites implements NIP-5A site manifests and serves their content. |
| 2 | // |
| 3 | // A manifest event maps URL paths to blob hashes. SiteLabel and ParseSite |
| 4 | // translate the three supported labels: an owner's npub, a named site, and a |
| 5 | // snapshot. ValidateManifest checks path entries, aggregate hashes and |
| 6 | // lineage before a manifest is indexed. |
| 7 | // |
| 8 | // Service keeps the label-to-event index in the site_manifests table of the |
| 9 | // supplied storage.Store. New creates that table and its deletion trigger. |
| 10 | // SaveOptions supplies the storage transaction hook that updates the index |
| 11 | // with an accepted event and, when mirroring is enabled by policy, queues a |
| 12 | // site-mirror intent. ApplyTx and DeleteTx are the corresponding transaction |
| 13 | // hooks for callers that already own the event transaction. |
| 14 | // |
| 15 | // Mirror reads missing files from the servers advertised by a manifest, |
| 16 | // verifies each response against its declared hash and stores it through the |
| 17 | // configured BlobPut callback. RunMirrorIntent resolves the event captured by |
| 18 | // storage and retries that idempotent operation. Handler serves only GET and |
| 19 | // HEAD content after host, policy and optional ReadAccess checks; the manifest |
| 20 | // remains the authority for path selection and discovery responses. |
| 21 | package sites |