A zero-dependency AT Protocol Personal Data Server written in JavaScript

add spam labeler check to handleInboxSend

+16
+16
src/pds.js
··· 3333 3333 return errorResponse('Forbidden', 'blocked', 403); 3334 3334 } 3335 3335 3336 + // Check if sender is labeled as spam by the labeler 3337 + try { 3338 + const labelerRes = await fetch( 3339 + `https://spam-labeler.nate-8fe.workers.dev/xrpc/xyz.fake.labeler.hasSpam?did=${encodeURIComponent(senderDid)}` 3340 + ); 3341 + if (labelerRes.ok) { 3342 + const { spam } = await labelerRes.json(); 3343 + if (spam) { 3344 + return Response.json({ status: 'spam' }); 3345 + } 3346 + } 3347 + } catch (e) { 3348 + // If labeler is unavailable, continue without spam check 3349 + console.error('Labeler check failed:', e.message); 3350 + } 3351 + 3336 3352 // Check if accepted 3337 3353 const accepted = this.sql 3338 3354 .exec('SELECT did FROM inbox_accepted WHERE did = ?', senderDid)