⚙️ Update `too many request` message

This commit is contained in:
pheralb 2024-08-22 17:45:01 +01:00
parent d43c572311
commit 51bb3462fc

View File

@ -74,7 +74,7 @@ app.get('/', async (c) => {
const { success } = await ratelimit.limit(ip ?? 'anonymous'); const { success } = await ratelimit.limit(ip ?? 'anonymous');
if (!success) { if (!success) {
return c.json({ error: 'Too many request' }, 429); return c.json({ error: '🛑 Too many request' }, 429);
} }
if (limit) { if (limit) {
@ -104,7 +104,7 @@ app.get('/categories', async (c) => {
const { success } = await ratelimit.limit(ip ?? 'anonymous'); const { success } = await ratelimit.limit(ip ?? 'anonymous');
if (!success) { if (!success) {
return c.json({ error: 'Too many request' }, 429); return c.json({ error: '🛑 Too many request' }, 429);
} }
const categoryTotals: Record<string, number> = {}; const categoryTotals: Record<string, number> = {};
@ -127,7 +127,7 @@ app.get('/categories', async (c) => {
return c.json(categories); return c.json(categories);
}); });
// 🌱 GET: "/category/:category - Return an list of svgs by specific category: // 🌱 GET: /category/:category - Return an list of svgs by specific category:
app.get('/category/:category', async (c) => { app.get('/category/:category', async (c) => {
const category = c.req.param('category') as string; const category = c.req.param('category') as string;
const targetCategory = category.charAt(0).toUpperCase() + category.slice(1); const targetCategory = category.charAt(0).toUpperCase() + category.slice(1);
@ -136,7 +136,7 @@ app.get('/category/:category', async (c) => {
const { success } = await ratelimit.limit(ip ?? 'anonymous'); const { success } = await ratelimit.limit(ip ?? 'anonymous');
if (!success) { if (!success) {
return c.json({ error: 'Too many request' }, 429); return c.json({ error: '🛑 Too many request' }, 429);
} }
const categorySvgs = fullRouteSvgsData.filter((svg) => { const categorySvgs = fullRouteSvgsData.filter((svg) => {