(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol. margin.at
extension web atproto comments
99
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix highlight and bookmark pages

scanash00 c8d7c372 6ed68983

+30 -27
+30 -27
web/src/api/client.js
··· 283 283 284 284 if (item.type === "Annotation") { 285 285 return { 286 - uri: item.id, 287 - author: item.creator, 288 - url: item.target?.source, 289 - title: item.target?.title, 290 - text: item.body?.value, 291 - selector: item.target?.selector, 286 + type: item.type, 287 + uri: item.uri || item.id, 288 + author: item.author || item.creator, 289 + url: item.url || item.target?.source, 290 + title: item.title || item.target?.title, 291 + text: item.text || item.body?.value, 292 + selector: item.selector || item.target?.selector, 292 293 motivation: item.motivation, 293 294 tags: item.tags || [], 294 - createdAt: item.created, 295 + createdAt: item.createdAt || item.created, 295 296 cid: item.cid || item.CID, 296 297 }; 297 298 } 298 299 299 300 if (item.type === "Bookmark") { 300 301 return { 301 - uri: item.id, 302 - author: item.creator, 303 - url: item.source, 302 + type: item.type, 303 + uri: item.uri || item.id, 304 + author: item.author || item.creator, 305 + url: item.url || item.source, 304 306 title: item.title, 305 307 description: item.description, 306 308 tags: item.tags || [], 307 - createdAt: item.created, 309 + createdAt: item.createdAt || item.created, 308 310 cid: item.cid || item.CID, 309 311 }; 310 312 } 311 313 312 314 if (item.type === "Highlight") { 313 315 return { 314 - uri: item.id, 315 - author: item.creator, 316 - url: item.target?.source, 317 - title: item.target?.title, 318 - selector: item.target?.selector, 316 + type: item.type, 317 + uri: item.uri || item.id, 318 + author: item.author || item.creator, 319 + url: item.url || item.target?.source, 320 + title: item.title || item.target?.title, 321 + selector: item.selector || item.target?.selector, 319 322 color: item.color, 320 323 tags: item.tags || [], 321 - createdAt: item.created, 324 + createdAt: item.createdAt || item.created, 322 325 cid: item.cid || item.CID, 323 326 }; 324 327 } ··· 340 343 341 344 export function normalizeHighlight(highlight) { 342 345 return { 343 - uri: highlight.id, 344 - author: highlight.creator, 345 - url: highlight.target?.source, 346 - title: highlight.target?.title, 347 - selector: highlight.target?.selector, 346 + uri: highlight.uri || highlight.id, 347 + author: highlight.author || highlight.creator, 348 + url: highlight.url || highlight.target?.source, 349 + title: highlight.title || highlight.target?.title, 350 + selector: highlight.selector || highlight.target?.selector, 348 351 color: highlight.color, 349 352 tags: highlight.tags || [], 350 - createdAt: highlight.created, 353 + createdAt: highlight.createdAt || highlight.created, 351 354 }; 352 355 } 353 356 354 357 export function normalizeBookmark(bookmark) { 355 358 return { 356 - uri: bookmark.id, 357 - author: bookmark.creator, 358 - url: bookmark.source, 359 + uri: bookmark.uri || bookmark.id, 360 + author: bookmark.author || bookmark.creator, 361 + url: bookmark.url || bookmark.source, 359 362 title: bookmark.title, 360 363 description: bookmark.description, 361 364 tags: bookmark.tags || [], 362 - createdAt: bookmark.created, 365 + createdAt: bookmark.createdAt || bookmark.created, 363 366 }; 364 367 } 365 368