Changeset 8ad1784 in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 06/25/2026 09:08:20 PM (3 months ago)
- Branches:
- main
- Children:
- 7c62efb
- Parents:
- 4c12783
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r4c12783 r8ad1784 1025 1025 const base = (process.env.PUBLIC_BASE_URL || '').replace(/\/+$/, ''); 1026 1026 if (!base || !site || !site.slug) return { error: 'config' }; 1027 const actorUrl = await webfingerResolve(handle); 1027 // Accept either an @user@host handle (WebFinger) or a profile/actor URL directly 1028 // (the authorize_interaction Follow flow passes a URL). 1029 const s = String(handle || '').trim(); 1030 const actorUrl = /^https?:\/\//i.test(s) ? (safeUrl(s) || null) : await webfingerResolve(s); 1028 1031 if (!actorUrl) return { error: 'not_found' }; 1029 1032 const actor = await fetchActor(actorUrl).catch(() => null); … … 1039 1042 console.log('[AP] follow', site.slug, '→', actor.id); 1040 1043 return { ok: true, name: ai.name, handle: ai.handle }; 1044 } 1045 1046 // Resolve a profile URL or @handle to a followable remote actor (for the 1047 // authorize_interaction "Follow" flow). Returns display fields + inbox, or null 1048 // when it isn't a reachable actor (e.g. the input was a post, not a profile). 1049 export async function resolveRemoteActor(input) { 1050 const s = String(input || '').trim(); 1051 const actorUrl = /^https?:\/\//i.test(s) ? (safeUrl(s) || null) : await webfingerResolve(s); 1052 if (!actorUrl) return null; 1053 const actor = await fetchActor(actorUrl).catch(() => null); 1054 if (!actor || !actor.id || !actor.inbox) return null; 1055 const ai = actorInfo(actor, actor.id); 1056 return { actor_uri: actor.id, actor_name: ai.name, actor_handle: ai.handle, actor_url: ai.url, actor_icon: ai.icon, inbox: actor.inbox }; 1041 1057 } 1042 1058 … … 1162 1178 getInteractions, getInteractionById, buildReplyNote, getOutboxNote, deliverReply, resolveRemoteNote, 1163 1179 listOutbox, deliverOutboxDelete, 1164 webfingerResolve, followActor, unfollowActor, listFollowing, getTimeline, sendInteraction,1180 webfingerResolve, followActor, resolveRemoteActor, unfollowActor, listFollowing, getTimeline, sendInteraction, 1165 1181 getNotifications, listBlocks, isBlockedAny, blockTarget, unblock, 1166 1182 deliverWithRetry, enqueueDelivery, processDeliveryQueue, startDeliveryWorker,
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)