Changeset 3d7312a in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 06/24/2026 12:44:21 PM (3 months ago)
- Branches:
- main
- Children:
- 594cc50
- Parents:
- 82079ad
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r82079ad r3d7312a 477 477 } 478 478 479 // Resolve a remote post URL (any fediverse/Klonkt post) into a reply target. 480 // Returns a parent-shaped object usable by deliverReply(), or null. 481 export async function resolveRemoteNote(url) { 482 if (!/^https?:\/\//i.test(String(url || ''))) return null; 483 const note = await fetchActor(url).catch(() => null); // AP GET (content-negotiates) 484 if (!note || !note.id) return null; 485 const att = note.attributedTo; 486 const actorUri = typeof att === 'string' ? att : (att && att.id); 487 if (!actorUri) return null; 488 const actor = await fetchActor(actorUri).catch(() => null); 489 const ai = actorInfo(actor, actorUri); 490 return { 491 object_uri: note.id, 492 actor_uri: actorUri, 493 actor_url: ai.url, 494 actor_handle: ai.handle, 495 actor_name: ai.name, 496 actor_icon: ai.icon, 497 preview: HtmlSanitizerService.toPlainText(note.content || '').slice(0, 240), 498 }; 499 } 500 479 501 export default { 480 502 getOrCreateKeys, apWants, sendAP, actorId, noteId, 481 503 buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, 482 504 followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, 483 getInteractions, getInteractionById, buildReplyNote, getOutboxNote, deliverReply, 505 getInteractions, getInteractionById, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote, 484 506 };
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)