diff --git a/services/appview/src/index.ts b/services/appview/src/index.ts index 64405ce..d4087e4 100644 --- a/services/appview/src/index.ts +++ b/services/appview/src/index.ts @@ -4,7 +4,6 @@ import { Hono } from 'hono' import { HTTPException } from 'hono/http-exception' import { logger } from 'hono/logger' import { pino } from 'pino' -import { optionalAuthMiddleware } from './auth/middleware.js' import { Database } from './db.js' import { env } from './env.js' import { createFeedRouter } from './feed/feed.js' @@ -68,10 +67,7 @@ export class Server { await next() }) - // Apply optional auth to getPosts - enables auth but doesn't require it - app.use('/xrpc/so.sprk.feed.getPosts', optionalAuthMiddleware) - - // Auth routes + // TODO: Remove this after getAuthorFeedRouter is properly implemented on frontend const feedRouter = createFeedRouter(ctx) app.route('/', feedRouter) @@ -93,7 +89,7 @@ export class Server { // Root route app.get('/', (c) => { return c.text( - '✧・゚: ✧・゚:. ݁₊ ⊹ . ݁˖ . ݁ 𝚂𝙿𝙰𝚁𝙺 𝙰𝙿𝙸 . ݁₊ ⊹ . ݁˖ . ݁ :・゚✧:・゚✧', + '✧・゚: ✧・゚:. ݁₊ ⊹ . ݁˖ . ݁ SPARK API . ݁₊ ⊹ . ݁˖ . ݁ :・゚✧:・゚✧', ) }) diff --git a/services/appview/src/routes/feed/getPosts.ts b/services/appview/src/routes/feed/getPosts.ts index 9f0859e..bc9ffd8 100644 --- a/services/appview/src/routes/feed/getPosts.ts +++ b/services/appview/src/routes/feed/getPosts.ts @@ -5,6 +5,7 @@ import { AppContext } from '../../index.js' import { transformPostToPostView } from '../../utils/post-transformer.js' import { Database } from '../../db.js' import type * as SoSprkFeedDefs from '../../lexicon/types/so/sprk/feed/defs.js' +import { optionalAuthMiddleware } from '../../auth/middleware.js' // Function to fetch posts by URIs async function getPosts( @@ -35,7 +36,9 @@ async function getPosts( export const createGetPostsRouter = (ctx: AppContext) => { const router = new Hono() - router.get('/xrpc/so.sprk.feed.getPosts', async (c) => { + router.get('/xrpc/so.sprk.feed.getPosts', + optionalAuthMiddleware, + async (c) => { const uris = c.req.queries('uris') const userDid = c.get('did') as string | undefined