From 9695bba2e993b48ae333da622fa459dbaacb9349 Mon Sep 17 00:00:00 2001 From: Mohamed Bassem Date: Sat, 31 May 2025 18:46:04 +0100 Subject: feat: Generate RSS feeds from lists (#1507) * refactor: Move bookmark utils from shared-react to shared * Expose RSS feeds for lists * Add e2e tests * Slightly improve the look of the share dialog * allow specifying a limit in the rss endpoint --- packages/api/middlewares/auth.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'packages/api/middlewares/auth.ts') diff --git a/packages/api/middlewares/auth.ts b/packages/api/middlewares/auth.ts index 7f39a6f9..42bca6c8 100644 --- a/packages/api/middlewares/auth.ts +++ b/packages/api/middlewares/auth.ts @@ -1,11 +1,26 @@ import { createMiddleware } from "hono/factory"; import { HTTPException } from "hono/http-exception"; -import { AuthedContext, createCallerFactory } from "@karakeep/trpc"; +import { AuthedContext, Context, createCallerFactory } from "@karakeep/trpc"; import { appRouter } from "@karakeep/trpc/routers/_app"; const createCaller = createCallerFactory(appRouter); +export const unauthedMiddleware = createMiddleware<{ + Variables: { + ctx: Context; + api: ReturnType; + }; +}>(async (c, next) => { + if (!c.var.ctx) { + throw new HTTPException(401, { + message: "Unauthorized", + }); + } + c.set("api", createCaller(c.get("ctx"))); + await next(); +}); + export const authMiddleware = createMiddleware<{ Variables: { ctx: AuthedContext; -- cgit v1.2.3-70-g09d2