Changeset aed0092 in Klonkt for src/services/ActivityPubService.js
- Timestamp:
- 08/11/2026 06:35:19 PM (4 weeks ago)
- Branches:
- main
- Children:
- 960f015
- Parents:
- cb3001e
- File:
-
- 1 edited
-
src/services/ActivityPubService.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
rcb3001e raed0092 29 29 import Blocklist from './BlocklistService.js'; 30 30 import * as Guardianship from './guardianship/index.js'; 31 import { PUBLIC, AP_CONTEXT, safeUrl, actorId, noteId, guessMediaType, normalizeTags, tagParts, hashtagTags, buildHashtagList } from './ap-core.js';31 import { PUBLIC, AP_CONTEXT, safeUrl, actorId, noteId, guessMediaType, normalizeTags, tagParts, hashtagTags, buildHashtagList, pagedCollection } from './ap-core.js'; 32 32 // Doorgeven wat hier altijd vandaan kwam, zodat elke bestaande aanroep blijft werken. 33 33 export { AP_CONTEXT, actorId, noteId, guessMediaType }; … … 1043 1043 // wie hem vandaag leest hoort er morgen niet voor te hoeven pagineren. Er is 1044 1044 // precies een pagina, dus first en last wijzen naar dezelfde. 1045 const eerste = `${id}?page=1`; 1046 if (page) { 1047 return { 1048 '@context': AP_CONTEXT, 1049 id: eerste, 1050 type: 'OrderedCollectionPage', 1051 partOf: id, 1052 totalItems: items.length, 1053 orderedItems: items, 1054 }; 1055 } 1056 return { 1057 '@context': AP_CONTEXT, 1058 id, 1059 type: 'OrderedCollection', 1060 totalItems: items.length, 1061 first: eerste, 1062 last: eerste, 1063 orderedItems: items, 1064 }; 1045 return pagedCollection(id, items, { page }); 1065 1046 } 1066 1047 … … 1070 1051 export function buildFollowers(base, site, count, items = null) { 1071 1052 const id = `${actorId(base, site.slug)}/followers`; 1072 return { 1073 '@context': AP_CONTEXT, 1074 id, 1075 type: 'OrderedCollection', 1076 totalItems: items ? items.length : (count || 0), 1077 orderedItems: items || [], // count-only for the public; full for the owner 1078 }; 1053 // count-only for the public; full for the owner 1054 return pagedCollection(id, items || [], { totalItems: items ? items.length : (count || 0) }); 1079 1055 } 1080 1056 … … 1083 1059 export function buildFollowing(base, site, count, items = null) { 1084 1060 const id = `${actorId(base, site.slug)}/following`; 1085 return { 1086 '@context': AP_CONTEXT, 1087 id, 1088 type: 'OrderedCollection', 1089 totalItems: items ? items.length : (count || 0), 1090 orderedItems: items || [], // count-only for the public; full for the owner 1091 }; 1061 // count-only for the public; full for the owner 1062 return pagedCollection(id, items || [], { totalItems: items ? items.length : (count || 0) }); 1092 1063 } 1093 1064 … … 1098 1069 const id = `${actorId(base, site.slug)}/featured`; 1099 1070 const items = (posts || []).map((p) => buildNote(base, site, p)); 1100 return { 1101 '@context': AP_CONTEXT, 1102 id, 1103 type: 'OrderedCollection', 1104 totalItems: items.length, 1105 orderedItems: items, 1106 }; 1071 return pagedCollection(id, items); 1107 1072 } 1108 1073 … … 6555 6520 6556 6521 export default { 6557 AP_CONTEXT, getOrCreateKeys, apWants, sendAP, actorId, noteId, stripLeadingMentions, 6522 AP_CONTEXT, getOrCreateKeys, apWants, sendAP, actorId, noteId, stripLeadingMentions, pagedCollection, 6558 6523 buildActor, buildNote, buildCreate, buildOutbox, buildFollowers, buildFollowing, buildFeatured, 6559 6524 channelUrls, channelCategory, timelineFields, guessMediaType,
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)