1
0
Fork 0

Short circuit properly

This commit is contained in:
Sam Therapy 2023-10-10 00:40:27 +02:00
parent 4fe60f7c5d
commit caa491736e
Signed by: sam
GPG Key ID: 4D8B07C18F31ACBD
2 changed files with 8 additions and 4 deletions

View File

@ -28,7 +28,12 @@ export default async function Search(
c.header("content-type", ContentType(type))
const img = await fetch(imageURL, {headers: {"User-Agent": "waifurudorde/1.0.0 (+https://git.froth.zone/sam/waifurudor.de)"}})
const img = await fetch(imageURL, {
headers: {
"User-Agent":
"waifurudorde/1.0.0 (+https://git.froth.zone/sam/waifurudor.de)",
},
})
// Turn the image into an ArrayBuffer
.then((fetchRes) => {
return fetchRes?.arrayBuffer()

View File

@ -28,9 +28,8 @@ app.get("/robots.txt", (c) => c.text("User-agent: *\nDisallow: /"))
app.all("/", (c) => {
const query: SearchQuery = {
site: c.req.query("booru") ?? "safebooru",
tags: c.req.query("tags") ?? c.req.header("Host") === "rint.osaka"
? "tohsaka_rin"
: "",
tags: c.req.query("tags") ??
(c.req.header("Host") === "rint.osaka" ? "tohsaka_rin" : ""),
}
customLogger(`Host: ${c.req.header("Host")}`)