-
Notifications
You must be signed in to change notification settings - Fork 2
feat: point assets API at assets.codersoft.xyz with hamburger fallback #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| export const ASSETS_API_BASE_URL = 'https://assets.codersoft.xyz'; | ||
| export const ASSETS_API_FALLBACK_BASE_URL = 'https://hamburger-api.powernplant101-c6b.workers.dev'; | ||
|
|
||
| const ASSETS_API_BASE_URLS = [ASSETS_API_BASE_URL, ASSETS_API_FALLBACK_BASE_URL]; | ||
|
|
||
| export async function fetchFromAssetsApi(path: string, init?: RequestInit): Promise<Response> { | ||
| let lastError: unknown; | ||
|
|
||
| for (const base of ASSETS_API_BASE_URLS) { | ||
| try { | ||
| const response = await fetch(`${base}${path}`, init); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '1,35p' src/lib/assetsApi.ts
sed -n '55,105p' src/components/profile/FontPicker.tsxRepository: creatorcluster/renderdragon.org Length of output: 3373 Give each Move the per-attempt timeout into 🤖 Prompt for AI Agents |
||
| if (response.ok) return response; | ||
| lastError = new Error(`Assets API error ${response.status} ${response.statusText} for ${base}${path}`); | ||
| console.error(`Assets API error ${response.status} ${response.statusText} for ${base}${path}`); | ||
| } catch (error) { | ||
| lastError = error; | ||
| console.error(`Assets API fetch failed for ${base}${path}:`, error); | ||
| } | ||
| } | ||
|
|
||
| throw lastError instanceof Error ? lastError : new Error('Assets API unavailable'); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: creatorcluster/renderdragon.org
Length of output: 8390
🏁 Script executed:
Repository: creatorcluster/renderdragon.org
Length of output: 5721
Bound each
/mciconsexport attempt.exportResources()runs at module entry and awaitsfetchMcicons(). The firstfetch()has no timeout, so a stalled primary can keep the export pending indefinitely. The loop cannot try the fallback, and the resource files are not written.This gives each base URL its own bounded attempt. The existing
catchthen continues to the fallback after a timeout.🤖 Prompt for AI Agents