Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/services/ActivityPubService.js

    r5e16b8a rdc802b4  
    3434// De muziekkant woont in music/ (shaer-drc). Doorgeven wat hier altijd
    3535// vandaan kwam, zodat elke bestaande aanroep blijft werken.
    36 import { luisteraars } from './music/index.js';
    3736import { TRACK_KOLOMMEN,
    3837  playlistOpenTracks, siteOpenTracks, openTrack, trackHostPosts,
     
    4039  buildPlaylistCollection, listPlaylistsAP, playlistLinkTags,
    4140  buildPostTrackCollection, uitgavePost,
    42   buildLibrary, libraryId,
    4341  licentieUri, channelCategory,
    4442} from './music/index.js';
     
    4846  buildPlaylistCollection, listPlaylistsAP, playlistLinkTags, licentieUri,
    4947  buildPostTrackCollection, uitgavePost,
    50   buildLibrary, libraryId,
    5148};
    5249
     
    357354  const pagina = pickLink(o.url, () => true);
    358355  return { html: HtmlSanitizerService.sanitize(o.content || ''), atts, url: pagina ? pagina.href : null };
    359 }
    360 
    361 /**
    362  * De site achter een library-uri, of null. Zelfde strengheid als localSlugOf:
    363  * de uri moet met ONZE basis beginnen en de site moet bestaan -- anders levert
    364  * andermans /library met dezelfde padstaart hier een volger op onze naam op.
    365  */
    366 function libraryOwnerSlug(uri) {
    367   const u = String(uri || '');
    368   if (!u.endsWith('/library')) return null;
    369   return localSlugOf(u.slice(0, -'/library'.length));
    370356}
    371357
     
    12001186// these as the "Featured" tab (pinned to the profile). Posts come ordered by pin
    12011187// rank; embedded as full Notes so a remote server doesn't need extra fetches.
    1202 export function buildFeatured(base, site, posts, { page = false } = {}) {
     1188export function buildFeatured(base, site, posts) {
    12031189  const id = `${actorId(base, site.slug)}/featured`;
    12041190  const items = (posts || []).map((p) => buildNote(base, site, p));
    1205   return pagedCollection(id, items, { page });
     1191  return pagedCollection(id, items);
    12061192}
    12071193
     
    23682354  if (type === 'Follow') {
    23692355    const who = typeof act.actor === 'string' ? act.actor : (act.actor && act.actor.id);
    2370     // EERST: volgt iemand onze BIBLIOTHEEK in plaats van onze actor? (shaer-0nh)
    2371     //
    2372     // Een luisteraar krijgt de muziek en NIET de gewone posts -- wie zich
    2373     // abonneert op een platenkast heeft niet om de Krant gevraagd. Vandaar een
    2374     // eigen tabel: zolang ze daar staan kan een postbezorging ze niet per
    2375     // ongeluk meenemen.
    2376     //
    2377     // De bibliotheek is openbaar (alles erin is fedi_open), dus dit accepteert
    2378     // meteen. Er valt niets goed te keuren, en dan is wachten oneerlijk.
    2379     const libSlug = libraryOwnerSlug(typeof act.object === 'string' ? act.object : (act.object && act.object.id));
    2380     if (who && libSlug) {
    2381       const remote = await fetchActor(who);
    2382       if (!remote || !remote.inbox) return 202;
    2383       const fi = actorInfo(remote, who);
    2384       luisteraars.voegToe(libSlug, {
    2385         actorUri: who, inbox: remote.inbox,
    2386         sharedInbox: (remote.endpoints && remote.endpoints.sharedInbox) || null,
    2387         name: fi.name, handle: fi.handle, icon: fi.icon,
    2388       });
    2389       const keys = getOrCreateKeys(libSlug);
    2390       const accept = {
    2391         '@context': AP_CONTEXT,
    2392         id: `${actorId(base, libSlug)}#accept-library-${Date.now()}-${rid()}`,
    2393         type: 'Accept', actor: actorId(base, libSlug), object: act,
    2394       };
    2395       deliver(remote.inbox, accept, `${actorId(base, libSlug)}#main-key`, keys.privatePem)
    2396         .catch(() => { /* de volger staat er; een mislukte Accept mag dat niet omgooien */ });
    2397       console.log('[AP] library follow from', who, '->', libSlug);
    2398       return 202;
    2399     }
    24002356    // slugParam is de eigenaar van een per-actor inbox; op de GEDEELDE inbox is
    24012357    // die er niet en werd de slug uit act.object geraden. Zonder hostcontrole
     
    24812437    return 202;
    24822438  }
    2483   // Een luisteraar die weggaat, hoort meteen weg te zijn.
    2484   if (type === 'Undo' && act.object && act.object.type === 'Follow') {
    2485     const doel = typeof act.object.object === 'string' ? act.object.object : (act.object.object && act.object.object.id);
    2486     const libSlug = libraryOwnerSlug(doel);
    2487     const wie = typeof act.actor === 'string' ? act.actor : (act.actor && act.actor.id);
    2488     if (libSlug && wie && luisteraars.verwijder(libSlug, wie)) {
    2489       console.log('[AP] library unfollow from', wie, '->', libSlug);
    2490       return 202;
    2491     }
    2492   }
    2493 
    24942439  if (type === 'Undo' && act.object) {
    24952440    const who = typeof act.actor === 'string' ? act.actor : (act.actor && act.actor.id);
     
    68646809  buildPlaylistCollection, playlistOpenTracks, listPlaylistsAP, playlistLinkTags,
    68656810  buildPostTrackCollection, uitgavePost,
    6866   buildLibrary, libraryId,
    68676811  followerCount, deliver, fetchActor, verifyRequest, handleInbox, deliverCreate, deliverDelete, deliverUpdate, deliverActorUpdate, resyncFeaturedPins,
    68686812  feedCursor, feedChangesSince, waitForFeedChange,
Note: See TracChangeset for help on using the changeset viewer.