diff --git a/src/feed-generation.ts b/src/feed-generation.ts index c6d064a..9649046 100644 --- a/src/feed-generation.ts +++ b/src/feed-generation.ts @@ -8,13 +8,15 @@ export default function (server: Server, ctx: AppContext) { if (params.feed !== 'did:example:alice/app.bsky.feed.generator/whats-alf') { throw new InvalidRequestError('algorithm unsupported') } - // example of how to check auth - // feel free to remove if requesterDid is not used - const requesterDid = await validateAuth( - req, - ctx.cfg.serviceDid, - ctx.didResolver, - ) + /** + * Example of how to check auth if giving user-specific results: + * + * const requesterDid = await validateAuth( + * req, + * ctx.cfg.serviceDid, + * ctx.didResolver, + * ) + */ let builder = ctx.db .selectFrom('post') diff --git a/src/subscription.ts b/src/subscription.ts index 649f7ed..b3a141e 100644 --- a/src/subscription.ts +++ b/src/subscription.ts @@ -8,6 +8,14 @@ export class FirehoseSubscription extends FirehoseSubscriptionBase { async handleEvent(evt: RepoEvent) { if (!isCommit(evt)) return const ops = await getOpsByType(evt) + + // This logs the text of every post off the firehose. + // Just for fun :) + // Delete before actually using + for (const post of ops.posts.creates) { + console.log(post.record.text) + } + const postsToDelete = ops.posts.deletes.map((del) => del.uri) const postsToCreate = ops.posts.creates .filter((create) => {