Write on the margins of the internet. Powered by the AT Protocol. margin.at
extension web atproto comments

fix annotations not working on extension

+8 -7
+5 -1
extension/src/entrypoints/content.ts
··· 200 200 submitBtn.textContent = 'Posting...'; 201 201 202 202 try { 203 - await sendMessage('createAnnotation', { 203 + const res = await sendMessage('createAnnotation', { 204 204 url: window.location.href, 205 205 title: document.title, 206 206 text, 207 207 selector: { type: 'TextQuoteSelector', exact: quoteText }, 208 208 }); 209 + 210 + if (!res.success) { 211 + throw new Error(res.error || 'Unknown error'); 212 + } 209 213 210 214 showToast('Annotation created!', 'success'); 211 215 composeModal?.remove();
+3 -6
extension/src/utils/api.ts
··· 132 132 const res = await apiRequest('/annotations', { 133 133 method: 'POST', 134 134 body: JSON.stringify({ 135 - target: { 136 - source: data.url, 137 - selector: data.selector, 138 - }, 139 - body: { type: 'TextualBody', value: data.text, format: 'text/plain' }, 140 - motivation: 'commenting', 135 + url: data.url, 136 + text: data.text, 141 137 title: data.title, 138 + selector: data.selector, 142 139 }), 143 140 }); 144 141