A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
fix: Add ratelimiting to bookmark recrawl and summarization
Mohamed Bassem21076b83d82c
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.tsindex b6acadd6..9aa9ec1e 100644--- a/packages/trpc/routers/bookmarks.ts+++ b/packages/trpc/routers/bookmarks.ts@@ -55,7 +55,7 @@ import {import { normalizeTagName } from "@karakeep/shared/utils/tag";import type { AuthedContext, Context } from "../index";-import { authedProcedure, router } from "../index";+import { authedProcedure, createRateLimitMiddleware, router } from "../index";import { mapDBAssetTypeToUserType } from "../lib/attachments";import { getBookmarkIdsFromMatcher } from "../lib/search";import { Bookmark } from "../models/bookmarks";@@ -709,6 +709,13 @@ export const bookmarksAppRouter = router({}}),recrawlBookmark: authedProcedure+ .use(+ createRateLimitMiddleware({+ name: "bookmarks.recrawlBookmark",+ windowMs: 30 * 60 * 1000,+ maxRequests: 200,+ }),+ ).input(z.object({bookmarkId: z.string(),@@ -1053,6 +1060,13 @@ export const bookmarksAppRouter = router({};}),summarizeBookmark: authedProcedure+ .use(+ createRateLimitMiddleware({+ name: "bookmarks.summarizeBookmark",+ windowMs: 30 * 60 * 1000,+ maxRequests: 100,+ }),+ ).input(z.object({bookmarkId: z.string(),