mirror of
https://github.com/direct-img/direct-img.link.git
synced 2026-03-17 03:01:01 +00:00
Feat: Serve limit.webp meme on rate limit instead of JSON
This commit is contained in:
@@ -4,7 +4,7 @@ export async function onRequest(context) {
|
|||||||
const path = params.path?.join("/") || "";
|
const path = params.path?.join("/") || "";
|
||||||
|
|
||||||
// Serve static assets for root or standard files
|
// Serve static assets for root or standard files
|
||||||
if (!path || path === "index.html" || path === "favicon.ico" || path === "robots.txt") {
|
if (!path || path === "index.html" || path === "favicon.ico" || path === "robots.txt" || path === "limit.webp") {
|
||||||
return env.ASSETS.fetch(request);
|
return env.ASSETS.fetch(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,9 +51,9 @@ export async function onRequest(context) {
|
|||||||
tags: "warning,no_entry",
|
tags: "warning,no_entry",
|
||||||
priority: 2
|
priority: 2
|
||||||
}));
|
}));
|
||||||
return jsonResponse(429, {
|
// Serve the limit meme image instead of JSON
|
||||||
error: "Daily search limit reached (25/day). Cached images remain available.",
|
const limitReq = new Request(new URL("/limit.webp", url.origin));
|
||||||
});
|
return env.ASSETS.fetch(limitReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify of a new search (Cache Miss)
|
// Notify of a new search (Cache Miss)
|
||||||
|
|||||||
Reference in New Issue
Block a user