Use local files rather than the CDN for this
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user