comment out auth check & log firehose output

This commit is contained in:
dholms 2023-05-11 14:33:20 -05:00
parent eeeb0325fc
commit cacc046986
2 changed files with 17 additions and 7 deletions

View File

@ -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')

View File

@ -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) => {