mirror of
https://github.com/pheralb/svgl.git
synced 2025-12-29 08:01:36 +08:00
🛠️ (api) Rename query parameter from "raw" to "no-optimize" in SVG retrieval endpoint
This commit is contained in:
@@ -170,7 +170,7 @@ app.get("/svg/:filename", async (c) => {
|
|||||||
const svgLibrary = "https://svgl.app/library/";
|
const svgLibrary = "https://svgl.app/library/";
|
||||||
|
|
||||||
const ratelimit = c.get("ratelimit");
|
const ratelimit = c.get("ratelimit");
|
||||||
const returnRaw = c.req.query("raw");
|
const returnNoOptimized = c.req.query("no-optimize");
|
||||||
const ip = c.req.raw.headers.get("CF-Connecting-IP");
|
const ip = c.req.raw.headers.get("CF-Connecting-IP");
|
||||||
const { success } = await ratelimit.limit(ip ?? "anonymous");
|
const { success } = await ratelimit.limit(ip ?? "anonymous");
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ app.get("/svg/:filename", async (c) => {
|
|||||||
return res.text();
|
return res.text();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (returnRaw) {
|
if (returnNoOptimized) {
|
||||||
return c.body(svg, 200, {
|
return c.body(svg, 200, {
|
||||||
"Content-Type": "image/svg+xml; charset=utf-8",
|
"Content-Type": "image/svg+xml; charset=utf-8",
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user