tangled
alpha
login
or
join now
zzstoatzz.io
/
pds.js
forked from
chadtmiller.com/pds.js
0
fork
atom
A zero-dependency AT Protocol Personal Data Server written in JavaScript
0
fork
atom
overview
issues
pulls
pipelines
add spam labeler check to handleInboxSend
zzstoatzz.io
2 months ago
2698d853
308443fb
+16
1 changed file
expand all
collapse all
unified
split
src
pds.js
+16
src/pds.js
···
3333
3333
return errorResponse('Forbidden', 'blocked', 403);
3334
3334
}
3335
3335
3336
3336
+
// Check if sender is labeled as spam by the labeler
3337
3337
+
try {
3338
3338
+
const labelerRes = await fetch(
3339
3339
+
`https://spam-labeler.nate-8fe.workers.dev/xrpc/xyz.fake.labeler.hasSpam?did=${encodeURIComponent(senderDid)}`
3340
3340
+
);
3341
3341
+
if (labelerRes.ok) {
3342
3342
+
const { spam } = await labelerRes.json();
3343
3343
+
if (spam) {
3344
3344
+
return Response.json({ status: 'spam' });
3345
3345
+
}
3346
3346
+
}
3347
3347
+
} catch (e) {
3348
3348
+
// If labeler is unavailable, continue without spam check
3349
3349
+
console.error('Labeler check failed:', e.message);
3350
3350
+
}
3351
3351
+
3336
3352
// Check if accepted
3337
3353
const accepted = this.sql
3338
3354
.exec('SELECT did FROM inbox_accepted WHERE did = ?', senderDid)