Use local files rather than the CDN for this

This commit is contained in:
2026-02-17 18:39:09 -07:00
parent 83decaf6fb
commit 345499ba64
27 changed files with 6 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
import { Context } from 'elysia'
import axios from 'axios'
import sharp from 'sharp'
import fs from 'fs'
const parseIntParam = (value: string): number | null => {
const parsed = Number(value)
@@ -53,27 +54,17 @@ export const handler = async (context: Context) => {
clamp(parseIntParam(context.query.overlayB) ?? 255)
]
let iconImg: Buffer = fs.readFileSync(
`src/assets/berrydash/icons/bird_${icon}.png`
)
let overlayImg: Buffer | null = null
let iconImg: Buffer | null = null
if (overlay !== 0) {
try {
const result = await axios.get(
`https://games-r2.lncvrt.xyz/game-assets/berrydash/overlays/overlay_${overlay}.png`,
{ responseType: 'arraybuffer' }
overlayImg = fs.readFileSync(
`src/assets/berrydash/overlays/overlay_${overlay}.png`
)
overlayImg = Buffer.from(result.data)
} catch {}
}
try {
const result = await axios.get(
`https://games-r2.lncvrt.xyz/game-assets/berrydash/icons/bird_${icon}.png`,
{ responseType: 'arraybuffer' }
)
iconImg = Buffer.from(result.data)
} catch {}
if (!iconImg) {
return new Response(null, { status: 400 })
}
let result = await recolor(iconImg, birdColor)