Changeset af5b79b in Klonkt
- Timestamp:
- 07/25/2026 08:37:24 AM (7 weeks ago)
- Branches:
- main
- Children:
- 2b4252c
- Parents:
- 8f520e0
- Files:
-
- 1 added
- 4 edited
-
src/config/database.js (modified) (1 diff)
-
src/services/ActivityPubService.js (modified) (5 diffs)
-
src/services/guardianship/index.js (modified) (1 diff)
-
src/services/guardianship/notes.js (modified) (2 diffs)
-
test/has-guardians.test.js (added)
Legend:
- Unmodified
- Added
- Removed
-
src/config/database.js
r8f520e0 raf5b79b 563 563 ensureColumn('ap_outbox', 'wave', 'INTEGER'); // FEP-633c shaer:wave (guardian -> ward nudge) 564 564 ensureColumn('ap_mentions', 'wave', 'INTEGER'); // inbound guardian wave 565 // FEP-633c §2.2: object hint that the author is a ward. Register-only for now; 566 // used later at reddings-boei / escalation routing. 567 ensureColumn('ap_timeline', 'has_guardians', 'INTEGER'); 568 ensureColumn('ap_mentions', 'has_guardians', 'INTEGER'); 565 569 ensureColumn('ap_followers', 'name', 'TEXT'); // cached display name (shaer-aa3) 566 570 ensureColumn('ap_followers', 'handle', 'TEXT'); // @user@host -
src/services/ActivityPubService.js
r8f520e0 raf5b79b 278 278 ...Guardianship.helpRequestProps(post), 279 279 ...Guardianship.waveProps(post), 280 // FEP-633c §2.2: object hint that the author is a ward. 281 ...Guardianship.hasGuardiansProps(site.slug), 280 282 tag: [ 281 283 ...mentionTags(post.content), … … 312 314 tag: [...hashtagTags(base, post.content)], 313 315 replies: `${id}/replies`, 316 ...Guardianship.hasGuardiansProps(site.slug), 314 317 }; 315 318 } … … 488 491 sensitive: !!post.nsfw, 489 492 }; 493 // FEP-633c §2.2: object hint that the author is a ward (safely ignorable). 494 Object.assign(note, Guardianship.hasGuardiansProps(site.slug)); 490 495 if (post.nsfw) note.summary = post.content_warning || 'Gevoelige inhoud'; 491 496 if (attachment.length) note.attachment = attachment; … … 1504 1509 for (const s of subs) { 1505 1510 tlStmts().ins.run(o.id, s.slug, actorUri, ai.name, ai.handle, ai.icon, ai.url, html, o.url || null, o.published || null, media, o.sensitive ? 1 : 0, o.summary || null); 1511 // FEP-633c §2.2: register the ward hint on the stored object (no action yet). 1512 if (Guardianship.objectHasGuardians(o)) { try { db.prepare('UPDATE ap_timeline SET has_guardians = 1 WHERE id = ? AND slug = ?').run(o.id, s.slug); } catch { /* ignore */ } } 1506 1513 if (poll) { try { db.prepare('UPDATE ap_timeline SET poll_json = ? WHERE id = ? AND slug = ?').run(JSON.stringify(poll), o.id, s.slug); } catch { /* ignore */ } } 1507 1514 } … … 1522 1529 const help = Guardianship.isHelpRequest(o); 1523 1530 const wave = Guardianship.isWave(o); 1531 const hasG = Guardianship.objectHasGuardians(o); // §2.2 hint, register-only 1524 1532 for (const slug of slugs) { 1525 1533 try { 1526 const r = db.prepare('INSERT OR IGNORE INTO ap_mentions (slug, object_uri, note_url, actor_uri, actor_name, actor_handle, actor_icon, actor_url, content, published, help_request, wave, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)')1527 .run(slug, o.id, safeUrl(o.url) || null, actorUri, ai.name, ai.handle, ai.icon, ai.url, html, o.published || null, help ? 1 : 0, wave ? 1 : 0 );1534 const r = db.prepare('INSERT OR IGNORE INTO ap_mentions (slug, object_uri, note_url, actor_uri, actor_name, actor_handle, actor_icon, actor_url, content, published, help_request, wave, has_guardians, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)') 1535 .run(slug, o.id, safeUrl(o.url) || null, actorUri, ai.name, ai.handle, ai.icon, ai.url, html, o.published || null, help ? 1 : 0, wave ? 1 : 0, hasG ? 1 : 0); 1528 1536 if (r.changes) { 1529 1537 console.log('[AP] mention', actorUri, '→', slug, help ? '(help request)' : ''); -
src/services/guardianship/index.js
r8f520e0 raf5b79b 16 16 */ 17 17 export { SHAER_CONTEXT, GUARDIAN_RELATIONSHIP, GUARDIAN_RELATIONSHIP_COMPACT, isGuardianRelationship } from './context.js'; 18 export { helpRequestProps, isHelpRequest, waveProps, isWave } from './notes.js';18 export { helpRequestProps, isHelpRequest, waveProps, isWave, hasGuardiansProps, objectHasGuardians } from './notes.js'; 19 19 export { wireDelivery, c2sVisibility, deliverDirectNote } from './delivery.js'; 20 20 export { wireHandshake, handleOutbox as handleGuardianshipOutbox, handleInbox as handleGuardianshipInbox, parseRelationship } from './handshake.js'; -
src/services/guardianship/notes.js
r8f520e0 raf5b79b 5 5 * on direct notes. Everyone who does not speak shaer can ignore it. 6 6 */ 7 import { listGuardians } from './relations.js'; 8 9 /** 10 * shaer:hasGuardians (§2.2): an advisory OBJECT hint that the author is a ward, 11 * so a remote server can route interactions to the guardians WITHOUT fetching 12 * the actor. Stamped on every object a ward publishes; MUST be safely ignorable. 13 */ 14 export function hasGuardiansProps(slug) { 15 try { return (slug && listGuardians(slug).length) ? { 'shaer:hasGuardians': true } : {}; } 16 catch { return {}; } 17 } 18 19 /** True when an incoming object carries the ward hint (§2.2). Register-only for 20 * now; acted on later at reddings-boei / escalation routing. */ 21 export function objectHasGuardians(o) { 22 return !!o && (o['shaer:hasGuardians'] === true || o.hasGuardians === true); 23 } 7 24 8 25 /** Extra JSON-LD properties for an outgoing note built from an ap_outbox row. */ … … 31 48 } 32 49 33 export default { helpRequestProps, isHelpRequest, waveProps, isWave };50 export default { helpRequestProps, isHelpRequest, waveProps, isWave, hasGuardiansProps, objectHasGuardians };
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)