-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tranform HTTP urls to HTTPS to honour the CSP #2
Conversation
Hello, Using HTTP urls results in an empty page, because the content cannot be loaded due to CSP violation. > Why are you using HTTP urls ? When using http://www.arxiv-sanity.com/ , the PDF link is in HTTP. > Then arXiv-sanity should upgrade to put HTTPS links That's what I thought. However, they are getting the URL straight from the arXiv API response, e.g. [this ling](https://export.arxiv.org/api/query?search_query=cat:cs.CV+OR+cat:cs.AI+OR+cat:cs.LG+OR+cat:cs.CL+OR+cat:cs.NE+OR+cat:stat.ML&sortBy=lastUpdatedDate&start=0&max_results=2) gives an XML where we can see they refer to the link in HTTP :( Also, the HTTP link doesn't result on malfunction on their end.
@cipri-tom Thank you for the fix! I'll upload this in the v1.5 Firefox release. btw, the Q&A style description is really informative. ;) |
Thanks for accepting the PR ! |
Just finished testing and updated the extension to v1.5! Your code is confirmed to be bug-free. ;)
The extension is now loaded and can be tested locally! (You should disable the store version arxiv-utils to avoid extension conflict) |
Awesome ! Thanks for the tip, I didn't know I can load an unpackaged extension. It works and my sanity is restored 😁 By the way, I have just noticed that you have you maintain two separate versions for Firefox and Chrome :( . They seem almost identical, so I'm curious why you opted to keep them separate. Cheers! |
Yes, maintaining the 2 separated versions are quite painful. However, this is necessary since Firefox has strict restrictions on PDF.js. The restriction disables any extension when viewing a PDF file, so arxiv-utils cannot directly modify the tab title of the browser-embedded file. My current hacky solution is to force redirect any PDF URLs into a custom extension page, which has an embedded PDF.js object in it, showing the content of the PDF file. This solution allows arxiv-utils to have the privilege to run any scripts on the page. So, if you are viewing a PDF in firefox with arxiv-utils installed, you'll see the URL be changed into something like |
Thank you for the explanation about the inner-workings ! I had suggested some time ago in a private email that this container method could be a more general workaround for firefox's disabling of extensions in PDF pages. Maybe at the same time you could revisit that idea :). Many thanks again ! |
Hello,
Using HTTP urls results in an empty page, because the content cannot be loaded due to CSP violation.
When using http://www.arxiv-sanity.com/ , the PDF link is in HTTP.
That's what I thought. However, they are getting the URL straight from the arXiv API response, e.g. this ling gives an XML where we can see they refer to the link in HTTP :(
Also, the HTTP link doesn't result on malfunction on their end.