(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.

routing stuff

+23 -7
+11 -1
web/src/components/common/Card.tsx
··· 305 305 .replace(" day", "d") 306 306 : ""; 307 307 308 - const detailUrl = `/${item.author?.handle || item.author?.did}/${type}/${(item.uri || "").split("/").pop()}`; 308 + const uriCollection = item.uri?.split("/")[3] ?? ""; 309 + const urlSegment = uriCollection.includes("at.margin.note") 310 + ? "note" 311 + : uriCollection.includes("at.margin.highlight") 312 + ? "highlight" 313 + : uriCollection.includes("at.margin.bookmark") 314 + ? "bookmark" 315 + : uriCollection.includes("at.margin.annotation") 316 + ? "annotation" 317 + : type; 318 + const detailUrl = `/${item.author?.handle || item.author?.did}/${urlSegment}/${(item.uri || "").split("/").pop()}`; 309 319 310 320 const pageTitle = 311 321 item.target?.title ||
+5 -4
web/src/pages/[...appPath].astro
··· 19 19 if (segments.length === 2 && segments[0] === 'annotation' && segments[1]) { 20 20 uri = decodeURIComponent(segments[1]); 21 21 } else if (segments.length === 3 && segments[0] === 'at') { 22 - uri = `at://${segments[1]}/at.margin.annotation/${segments[2]}`; 22 + uri = `at://${segments[1]}/at.margin.note/${segments[2]}`; 23 23 } else if (segments.length === 3) { 24 24 const [handle, type, rkey] = segments; 25 - const contentTypes = ['annotation', 'highlight', 'bookmark', 'collection']; 25 + const contentTypes = ['note', 'annotation', 'highlight', 'bookmark', 'collection']; 26 26 if (contentTypes.includes(type) && rkey) { 27 27 let did = handle; 28 28 if (!handle.startsWith('did:')) { ··· 35 35 } 36 36 } 37 37 const collectionMap: Record<string, string> = { 38 + note: 'at.margin.note', 38 39 annotation: 'at.margin.annotation', 39 40 highlight: 'at.margin.highlight', 40 41 bookmark: 'at.margin.bookmark', ··· 73 74 } else { 74 75 title = bodyText 75 76 ? `${bodyText.slice(0, 100)} — @${handle}` 76 - : `Annotation by @${handle}`; 77 + : `Note by @${handle}`; 77 78 description = selectorText 78 79 ? `"${selectorText.slice(0, 200)}"` 79 - : targetTitle || 'An annotation on Margin'; 80 + : targetTitle || 'A note on Margin'; 80 81 } 81 82 82 83 image = `${BASE_URL}/og-image?uri=${encodeURIComponent(uri)}`;
+4
web/src/views/AppShell.tsx
··· 256 256 element={<CollectionDetailRoute />} 257 257 /> 258 258 <Route 259 + path="/:handle/note/:rkey" 260 + element={<AnnotationDetailRoute />} 261 + /> 262 + <Route 259 263 path="/:handle/annotation/:rkey" 260 264 element={<AnnotationDetailRoute />} 261 265 />
+3 -2
web/src/views/content/AnnotationDetail.tsx
··· 74 74 } 75 75 76 76 if (handle && rkey) { 77 - let collection = "at.margin.annotation"; 77 + let collection = "at.margin.note"; 78 + if (type === "annotation") collection = "at.margin.annotation"; 78 79 if (type === "highlight") collection = "at.margin.highlight"; 79 80 if (type === "bookmark") collection = "at.margin.bookmark"; 80 81 ··· 93 94 setLoading(false); 94 95 } 95 96 } else if (did && rkey) { 96 - setTargetUri(`at://${did}/at.margin.annotation/${rkey}`); 97 + setTargetUri(`at://${did}/at.margin.note/${rkey}`); 97 98 } 98 99 } 99 100 resolve();