diff --git a/public/content.js b/public/content.js index 12a5289..c1fa13d 100644 --- a/public/content.js +++ b/public/content.js @@ -69,14 +69,13 @@ async function onDidReceiveMessage(event) { if (event.data.type && (event.data.type === 'QUERY_PUBLISHER')) { try { const response = await fetch(event.data.url); - console.log(response); + // console.log(response); if (response.status !== 200) { throw new Error(response); } try { const result = await response.json(); - console.log(result); + // console.log(result); window.postMessage({ type: 'QUERY_PUBLISHER_RESPONSE', result }, '*'); } catch (error) { - console.log(error); console.log(error); throw new Error('Response body is empty.') } diff --git a/src/Components/Reader.js b/src/Components/Reader.js index d1df7be..f303207 100644 --- a/src/Components/Reader.js +++ b/src/Components/Reader.js @@ -17,15 +17,16 @@ const Reader = ({ setPage }) => { useEffect(() => { (async () => { const { tweetId, tweetAuthor } = getTweetData() - const annotationCIDs = await getAnnotationCIDsByReference({ reference: tweetId }); + // const annotationCIDs = await getAnnotationCIDsByReference({ reference: tweetId }); + // const annotations = []; + // for (const annotationCID of annotationCIDs) { + // annotations.push(new Annotation({ payload: await getAnnotationData(annotationCID) })); + // } const annotations = []; - for (const annotationCID of annotationCIDs) { - annotations.push(new Annotation({ payload: await getAnnotationData(annotationCID) })); + const annotationsFromPublisher = await getAnnotationsByReference({ reference: tweetId }); + for (const annotation of annotationsFromPublisher) { + annotations.push(new Annotation({ payload: annotation })); } - // combine perisisted and pending annotations - // const annotationsFromPublisher = await getAnnotationsByReference({ reference: tweetId }); - // console.log(annotations); - // console.log(annotationsFromPublisher); setTweetAnnotations(annotations); })(); }, []) diff --git a/src/services/publisher.js b/src/services/publisher.js index 16a5720..076e594 100644 --- a/src/services/publisher.js +++ b/src/services/publisher.js @@ -1,5 +1,6 @@ // const PUBLISHER_URL = 'https://pan.network/annotation/v1'; -const PUBLISHER_URL = 'https://134.122.90.29:8000'; +// const PUBLISHER_URL = 'https://134.122.90.29:8000'; +const PUBLISHER_URL = 'https://annotations.network/annotations'; async function get(params) {