Changeset 5e16b8a in Klonkt
- Timestamp:
- 08/15/2026 07:33:20 AM (4 weeks ago)
- Branches:
- main
- Children:
- e1da6a1
- Parents:
- 732272a
- Files:
-
- 1 added
- 3 edited
-
src/routes/activitypub.js (modified) (5 diffs)
-
src/services/ActivityPubService.js (modified) (1 diff)
-
src/services/music/index.js (modified) (4 diffs)
-
test/ap-collection-paging.test.js (added)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/activitypub.js
r732272a r5e16b8a 1115 1115 ORDER BY pinned DESC, COALESCE(published_at, created_at) ASC LIMIT 20` 1116 1116 ).all(site.id); 1117 AP.sendAP(res, AP.buildFeatured(baseUrl(req), site, posts ));1117 AP.sendAP(res, AP.buildFeatured(baseUrl(req), site, posts, { page: paginaNr(req) })); 1118 1118 }); 1119 1119 … … 1130 1130 const site = publicSite(req.params.slug); 1131 1131 if (!site) return res.status(404).end(); 1132 AP.sendAP(res, AP.listPlaylistsAP(baseUrl(req), site, wantsEnriched(req, res) ));1132 AP.sendAP(res, AP.listPlaylistsAP(baseUrl(req), site, wantsEnriched(req, res), { page: paginaNr(req) })); 1133 1133 }); 1134 1134 … … 1139 1139 const site = publicSite(req.params.slug); 1140 1140 if (!site) return res.status(404).end(); 1141 AP.sendAP(res, AP.buildTrackCollection(baseUrl(req), site, AP.siteOpenTracks(site.id, { alles: await magAlles(req, site.slug) }) ));1141 AP.sendAP(res, AP.buildTrackCollection(baseUrl(req), site, AP.siteOpenTracks(site.id, { alles: await magAlles(req, site.slug) }), { page: paginaNr(req) })); 1142 1142 }); 1143 1143 … … 1150 1150 // Openbaar, want alles erin is fedi_open. Er valt dus niets goed te keuren en de 1151 1151 // volgerslijst blijft leeg: wie ons volgt volgt de ACTOR, niet de bak. 1152 // 1153 // `?page=` MOET hier doorgegeven worden. Zonder dat adverteert de wortel een 1154 // `first` die op zichzelf uitkomt: de lezer volgt hem, krijgt weer een `Library` 1155 // in plaats van een pagina, en klapt eruit -- open.audio gaf op 15-8 een 500 op 1156 // precies deze URL. Dezelfde les als bij de outbox (shaer-sk4): een `first` 1157 // beloven is een pagina beloven. 1152 1158 router.get('/ap/users/:slug/library', (req, res) => { 1153 1159 const site = publicSite(req.params.slug); 1154 1160 if (!site) return res.status(404).end(); 1155 AP.sendAP(res, AP.buildLibrary(baseUrl(req), site, AP.siteOpenTracks(site.id) ));1161 AP.sendAP(res, AP.buildLibrary(baseUrl(req), site, AP.siteOpenTracks(site.id), { page: paginaNr(req) })); 1156 1162 }); 1157 1163 … … 1161 1167 const site = publicSite(req.params.slug); 1162 1168 if (!site) return res.status(404).end(); 1163 AP.sendAP(res, AP.pagedCollection(`${AP.libraryId(baseUrl(req), site)}/followers`, [] ));1169 AP.sendAP(res, AP.pagedCollection(`${AP.libraryId(baseUrl(req), site)}/followers`, [], { page: paginaNr(req) })); 1164 1170 }); 1165 1171 -
src/services/ActivityPubService.js
r732272a r5e16b8a 1200 1200 // these as the "Featured" tab (pinned to the profile). Posts come ordered by pin 1201 1201 // rank; embedded as full Notes so a remote server doesn't need extra fetches. 1202 export function buildFeatured(base, site, posts ) {1202 export function buildFeatured(base, site, posts, { page = false } = {}) { 1203 1203 const id = `${actorId(base, site.slug)}/featured`; 1204 1204 const items = (posts || []).map((p) => buildNote(base, site, p)); 1205 return pagedCollection(id, items );1205 return pagedCollection(id, items, { page }); 1206 1206 } 1207 1207 -
src/services/music/index.js
r732272a r5e16b8a 247 247 * ooit een besloten variant, dan hoort daar het Follow/Accept-werk bij. 248 248 */ 249 export function buildLibrary(base, site, rows ) {249 export function buildLibrary(base, site, rows, { page = false } = {}) { 250 250 const id = libraryId(base, site); 251 251 const hostPosts = site.id ? trackHostPosts(site.id) : null; 252 252 const items = (rows || []).map((r) => buildTrackAudio(base, site, r, { hostPosts })); 253 253 return pagedCollection(id, items, { 254 page, 254 255 extra: { 255 256 type: 'Library', … … 265 266 266 267 /** De collectie van alle open tracks van een site (shaer-0nh, stap 3). */ 267 export function buildTrackCollection(base, site, rows ) {268 export function buildTrackCollection(base, site, rows, { page = false } = {}) { 268 269 // Eén zoekopdracht voor alle rijen samen; zie trackHostPosts. 269 270 const posts = site.id ? trackHostPosts(site.id) : null; 270 271 const items = (rows || []).map((r) => buildTrackAudio(base, site, r, { hostPosts: posts })); 271 return pagedCollection(`${actorId(base, site.slug)}/tracks`, items, { extra: { attributedTo: actorId(base, site.slug) } });272 return pagedCollection(`${actorId(base, site.slug)}/tracks`, items, { page, extra: { attributedTo: actorId(base, site.slug) } }); 272 273 } 273 274 … … 314 315 // collectie zelf, want ook een lijst mag niet verklappen wat er achter de 315 316 // poort staat. 316 export function listPlaylistsAP(base, site, enriched ) {317 export function listPlaylistsAP(base, site, enriched, { page = false } = {}) { 317 318 const rows = db.prepare( 318 319 'SELECT id, title, artist, year, cover_url FROM playlists WHERE site_id = ? ORDER BY created_at, id' … … 327 328 return stub; 328 329 }); 329 return pagedCollection(colId, items, { extra: { attributedTo: actorId(base, site.slug) } });330 return pagedCollection(colId, items, { page, extra: { attributedTo: actorId(base, site.slug) } }); 330 331 } 331 332
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)