dwhly-proj / droppdf

104 stars 18 forks source link

Fix direct linking to PDFs in DocDrop #69

Open dwhly opened 3 years ago

xolotl commented 3 years ago

URLs to the document and individual annotations provided in the Hypothesis sidebar lead to the statically hosted PDFs rather than the full DocDrop experience. For example, for this doc: https://docdrop.org/pdf/Student-Speak-2020-FINAL-aaXkf.pdf/ the URL offered in the sidebar to the page is: https://hyp.is/go?url=https%3A%2F%2Fdocdrop.org%2Fstatic%2Fdrop-pdf%2FStudent-Speak-2020-FINAL-aaXkf.pdf&group=__world__ and the URL offered for a specific annotation is like https://hyp.is/3ORkEB6-EeudCeP_WofpaA/docdrop.org/static/drop-pdf/Student-Speak-2020-FINAL-aaXkf.pdf

This means none of the usual Hypothesis sharing pathways work well in DocDrop.

image

genuineBuildMonkey commented 3 years ago

I've looked into this and tried to come up with a workaround. Still thinking about it.

I believe Hypothesis obtains the link (used for sharing) from the canonical url created by PDFJS. This is the link to the actual document (which is provided to PDFJS on creation). I don't see an explicit way to override that and resetting it after the fact unsurprisingly doesn't change the link picked up by Hypothesis.

This issue brings up another important point. With the new cloud storage scheme we must change the underlying document url provided to PDFJS from the S3 (cloud storage) one to an actual docdrop link as the cloud storage links remain valid for a limited time.

I'm not sure we will be able to force Hypothesis to recognize the share link as DocDrop links (unless we can find a workaround) but we do need to change the document source url.