You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
plugin api: api.headers.link() — plugins add Link relations to every LDP response #625
LWS requires Link: <storage>; rel="https://www.w3.org/ns/lws#storage" on every response from the storage, plus up, type and linkset relations on resources. Plugins get a scoped Fastify instance (api.fastify), so an onSend hook registered there only fires under the plugin's prefix — never on /alice/foo.
Discovery links are the canonical "a plugin wants to be visible from pod resources" need (ActivityPub rel="alternate" to an actor, Nostr rel="nostr", remoteStorage rel="remotestorage" would all use it), so this is worth a general seam rather than LWS-specific code.
Proposal
api.headers.link((request,{ url, isContainer, isRoot, pod })=>{// return an array of { href, rel, attrs? } or nothingreturn[{href: pod.storageUrl,rel: 'https://www.w3.org/ns/lws#storage'}];});
Called from the existing header builder in src/ldp/headers.js (getLinkHeader) for every LDP response, so output is merged into the one Link header rather than appended as a second one.
Also exposed under the plugin's own prefix for symmetry.
Activity