source for getorbyt.com getorbyt.com/
client bsky orbytapp app orbyt bluesky getorbyt orbytvideo atproto video

Update Astro configuration and refactor color data fetching

- Enable platform proxy in Astro configuration for improved service integration.
- Remove deprecated wrangler.toml file to streamline project structure.
- Refactor color data fetching logic to utilize Service Binding, enhancing performance and error handling.

+35 -44
+4
astro.config.mjs
··· 4 4 export default defineConfig({ 5 5 adapter: cloudflare({ 6 6 imageService: 'cloudflare', 7 + platformProxy: { 8 + enabled: true, 9 + configPath: 'wrangler.jsonc', 10 + }, 7 11 routes: { 8 12 extend: { 9 13 include: [
+5 -3
src/pages/@[handle].astro
··· 25 25 const videoPosts = videoFeed.posts; 26 26 const nextCursor = videoFeed.cursor; 27 27 28 - // Fetch profile colors via Service Binding (direct Worker-to-Worker, no public internet) 29 - const orbytApi = Astro.locals.runtime?.env?.ORBYT_API; 30 - const colorData = profileData.did ? await getColor(profileData.did, orbytApi) : null; 28 + // Fetch profile colors via Service Binding (direct Worker-to-Worker) 29 + const { env } = Astro.locals.runtime; 30 + const colorData = profileData.did && env.ORBYT_API 31 + ? await getColor(profileData.did, env.ORBYT_API) 32 + : null; 31 33 32 34 // Extract metadata with fallbacks 33 35 const displayName = profileData?.displayName || handle || 'Profile';
+6 -25
src/utils/orbyt-api.ts
··· 11 11 } 12 12 13 13 /** 14 - * Get color data for a single DID 15 - * Uses Service Binding for direct Worker-to-Worker communication (no public internet) 16 - * Falls back to HTTP if binding unavailable (local dev) 14 + * Get color data for a single DID via Service Binding 17 15 */ 18 16 export async function getColor( 19 17 did: string, 20 - binding?: OrbytApiBinding 18 + binding: OrbytApiBinding 21 19 ): Promise<ColorData | null> { 22 20 try { 23 - const endpoint = `/v1/colors/${encodeURIComponent(did)}`; 24 - 25 - let response: Response; 26 - 27 - if (binding) { 28 - // Service Binding: direct Worker-to-Worker call 29 - response = await binding.fetch(new Request(`https://internal${endpoint}`)); 30 - } else { 31 - // Fallback for local dev 32 - response = await fetch(`https://api.getorbyt.com${endpoint}`); 33 - } 34 - 35 - if (response.status === 404) { 36 - return null; 37 - } 38 - 39 - if (!response.ok) { 40 - throw new Error(`API error: ${response.status}`); 41 - } 42 - 21 + const response = await binding.fetch(`https://orbyt-api/v1/colors/${encodeURIComponent(did)}`); 22 + if (response.status === 404) return null; 23 + if (!response.ok) throw new Error(`API error: ${response.status}`); 43 24 return response.json(); 44 25 } catch (error) { 45 - console.warn('Failed to fetch color data:', error); 26 + console.error('Failed to fetch color data:', error); 46 27 return null; 47 28 } 48 29 }
+20
wrangler.jsonc
··· 1 + { 2 + "$schema": "./node_modules/wrangler/config-schema.json", 3 + "name": "orbyt-site", 4 + "main": "./dist/_worker.js/index.js", 5 + "compatibility_date": "2026-01-29", 6 + "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"], 7 + "assets": { 8 + "binding": "ASSETS", 9 + "directory": "./dist" 10 + }, 11 + "services": [ 12 + { 13 + "binding": "ORBYT_API", 14 + "service": "orbyt-api" 15 + } 16 + ], 17 + "observability": { 18 + "enabled": true 19 + } 20 + }
-16
wrangler.toml
··· 1 - name = "orbyt-site" 2 - main = "./dist/_worker.js/index.js" 3 - compatibility_date = "2026-01-29" 4 - compatibility_flags = ["nodejs_compat"] 5 - 6 - [assets] 7 - binding = "ASSETS" 8 - directory = "./dist" 9 - 10 - # Service Binding: direct Worker-to-Worker calls (no public internet) 11 - [[services]] 12 - binding = "ORBYT_API" 13 - service = "orbyt-api" 14 - 15 - [observability] 16 - enabled = true