mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2024-11-21 23:57:30 +00:00
Allow viewing webp files
This commit is contained in:
parent
3700b3a9ac
commit
09b33ef3fa
@ -52,7 +52,7 @@ module.exports = [
|
|||||||
route: "/imageproxy", methods: ["GET"], code: async (input) => {
|
route: "/imageproxy", methods: ["GET"], code: async (input) => {
|
||||||
const verifyResult = verifyURL(input.url)
|
const verifyResult = verifyURL(input.url)
|
||||||
if (verifyResult.status !== "ok") return verifyResult.value
|
if (verifyResult.status !== "ok") return verifyResult.value
|
||||||
if (!["png", "jpg"].some(ext => verifyResult.url.pathname.endsWith(ext))) return [400, "URL extension is not allowed"]
|
if (!["png", "jpg", "webp"].some(ext => verifyResult.url.pathname.endsWith(ext))) return [400, "URL extension is not allowed"]
|
||||||
const params = input.url.searchParams
|
const params = input.url.searchParams
|
||||||
const width = +params.get("width")
|
const width = +params.get("width")
|
||||||
if (typeof width === "number" && !isNaN(width) && width > 0) {
|
if (typeof width === "number" && !isNaN(width) && width > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user