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') { if (params.feed !== 'did:example:alice/app.bsky.feed.generator/whats-alf') {
throw new InvalidRequestError('algorithm unsupported') throw new InvalidRequestError('algorithm unsupported')
} }
// example of how to check auth /**
// feel free to remove if requesterDid is not used * Example of how to check auth if giving user-specific results:
const requesterDid = await validateAuth( *
req, * const requesterDid = await validateAuth(
ctx.cfg.serviceDid, * req,
ctx.didResolver, * ctx.cfg.serviceDid,
) * ctx.didResolver,
* )
*/
let builder = ctx.db let builder = ctx.db
.selectFrom('post') .selectFrom('post')

View File

@ -8,6 +8,14 @@ export class FirehoseSubscription extends FirehoseSubscriptionBase {
async handleEvent(evt: RepoEvent) { async handleEvent(evt: RepoEvent) {
if (!isCommit(evt)) return if (!isCommit(evt)) return
const ops = await getOpsByType(evt) 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 postsToDelete = ops.posts.deletes.map((del) => del.uri)
const postsToCreate = ops.posts.creates const postsToCreate = ops.posts.creates
.filter((create) => { .filter((create) => {