Use local files rather than the CDN for this
BIN
src/assets/berrydash/icons/bird_-1.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/berrydash/icons/bird_-2.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/berrydash/icons/bird_-3.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/assets/berrydash/icons/bird_-4.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
src/assets/berrydash/icons/bird_1.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/assets/berrydash/icons/bird_2.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/berrydash/icons/bird_3.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/berrydash/icons/bird_4.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/berrydash/icons/bird_5.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/berrydash/icons/bird_6.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/berrydash/icons/bird_7.png
Normal file
|
After Width: | Height: | Size: 1015 B |
BIN
src/assets/berrydash/icons/bird_8.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/berrydash/overlays/overlay_1.png
Normal file
|
After Width: | Height: | Size: 461 B |
BIN
src/assets/berrydash/overlays/overlay_10.png
Normal file
|
After Width: | Height: | Size: 476 B |
BIN
src/assets/berrydash/overlays/overlay_11.png
Normal file
|
After Width: | Height: | Size: 460 B |
BIN
src/assets/berrydash/overlays/overlay_12.png
Normal file
|
After Width: | Height: | Size: 452 B |
BIN
src/assets/berrydash/overlays/overlay_13.png
Normal file
|
After Width: | Height: | Size: 451 B |
BIN
src/assets/berrydash/overlays/overlay_14.png
Normal file
|
After Width: | Height: | Size: 523 B |
BIN
src/assets/berrydash/overlays/overlay_2.png
Normal file
|
After Width: | Height: | Size: 418 B |
BIN
src/assets/berrydash/overlays/overlay_3.png
Normal file
|
After Width: | Height: | Size: 395 B |
BIN
src/assets/berrydash/overlays/overlay_4.png
Normal file
|
After Width: | Height: | Size: 474 B |
BIN
src/assets/berrydash/overlays/overlay_5.png
Normal file
|
After Width: | Height: | Size: 429 B |
BIN
src/assets/berrydash/overlays/overlay_6.png
Normal file
|
After Width: | Height: | Size: 450 B |
BIN
src/assets/berrydash/overlays/overlay_7.png
Normal file
|
After Width: | Height: | Size: 464 B |
BIN
src/assets/berrydash/overlays/overlay_8.png
Normal file
|
After Width: | Height: | Size: 419 B |
BIN
src/assets/berrydash/overlays/overlay_9.png
Normal file
|
After Width: | Height: | Size: 475 B |
@@ -1,6 +1,7 @@
|
|||||||
import { Context } from 'elysia'
|
import { Context } from 'elysia'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import sharp from 'sharp'
|
import sharp from 'sharp'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
const parseIntParam = (value: string): number | null => {
|
const parseIntParam = (value: string): number | null => {
|
||||||
const parsed = Number(value)
|
const parsed = Number(value)
|
||||||
@@ -53,27 +54,17 @@ export const handler = async (context: Context) => {
|
|||||||
clamp(parseIntParam(context.query.overlayB) ?? 255)
|
clamp(parseIntParam(context.query.overlayB) ?? 255)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let iconImg: Buffer = fs.readFileSync(
|
||||||
|
`src/assets/berrydash/icons/bird_${icon}.png`
|
||||||
|
)
|
||||||
let overlayImg: Buffer | null = null
|
let overlayImg: Buffer | null = null
|
||||||
let iconImg: Buffer | null = null
|
|
||||||
if (overlay !== 0) {
|
if (overlay !== 0) {
|
||||||
try {
|
try {
|
||||||
const result = await axios.get(
|
overlayImg = fs.readFileSync(
|
||||||
`https://games-r2.lncvrt.xyz/game-assets/berrydash/overlays/overlay_${overlay}.png`,
|
`src/assets/berrydash/overlays/overlay_${overlay}.png`
|
||||||
{ responseType: 'arraybuffer' }
|
|
||||||
)
|
)
|
||||||
overlayImg = Buffer.from(result.data)
|
|
||||||
} catch {}
|
} 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)
|
let result = await recolor(iconImg, birdColor)
|
||||||
|
|
||||||
|
|||||||