export interface WeatherData { code: number; temperature: number; } export interface LocationData { latitude: number; longitude: number; } /** Metadata encoded in the image alt text as JSON */ export interface WalkMetadata { weather?: WeatherData; location?: LocationData; capturedAt: string; } /** A walk post stored as app.bsky.feed.post */ export interface WalkPost { $type: "app.bsky.feed.post"; text: string; // emoji only (enforced client-side) createdAt: string; embed?: { $type: "app.bsky.embed.images"; images: Array<{ alt: string; // JSON-encoded WalkMetadata image: BlobRef; aspectRatio?: { width: number; height: number }; }>; }; } export interface BlobRef { $type: "blob"; ref: { $link: string }; mimeType: string; size: number; } export interface WalkEntry { uri: string; cid: string; value: WalkPost; /** CDN URL for the image thumbnail (from hydrated feed view) */ imageUrl?: string; } /** * Parse walk metadata from an image's alt text. * Returns null if the alt text isn't valid walk metadata. */ export function parseWalkMetadata(alt: string): WalkMetadata | null { try { const parsed = JSON.parse(alt); if (parsed && typeof parsed.capturedAt === "string") { return parsed as WalkMetadata; } return null; } catch { return null; } }