Ryan Malloy a485092767 feat: add WebFinger resource discovery (RFC 7033)
Implemented complete WebFinger support for resource discovery with dual-mode configuration:

## Core Implementation

### Types (src/types.ts)
- WebFingerConfig: Main configuration with static resources + content collections
- WebFingerResource: JRD (JSON Resource Descriptor) structure
- WebFingerLink: RFC 7033 compliant link relations
- Content collection integration with builder functions

### Generator (src/generators/webfinger.ts)
- RFC 7033 compliant JRD generation
- Static resource lookup from config
- Async content collection integration
- Template variable replacement: {slug}, {id}, {data.fieldName}, {siteURL}
- Optional rel filtering for link relations

### Route Handler (src/routes/webfinger.ts)
- Dynamic route at /.well-known/webfinger
- Required 'resource' query parameter validation
- Optional 'rel' parameter filtering (can be multiple)
- Proper RFC 7033 compliance:
  - CORS headers (Access-Control-Allow-Origin: *)
  - Media type: application/jrd+json
  - Error responses (400, 404, 500)
- Configurable caching (default: 1 hour)

### Integration Updates
- Added webfinger to DiscoveryConfig
- Route injection when enabled (prerender: false for dynamic queries)
- Build output notification: "/.well-known/webfinger (dynamic)"
- Caching config: webfinger: 3600 (1 hour)

## Features

**Static Resources Mode:**
Configure resources directly in astro.config.mjs for simple use cases.

**Content Collection Mode:**
Automatically expose content collections (team, authors, etc.) via WebFinger
with customizable template URIs and link builders.

**RFC 7033 Compliance:**
- HTTPS required (dev mode allows HTTP)
- Proper JRD format with subject, aliases, properties, links
- CORS support for cross-origin discovery
- Rel filtering for targeted link queries

Opt-in by default (enabled: false) - requires explicit configuration.
2025-11-03 09:05:17 -07:00
..