-
Notifications
You must be signed in to change notification settings - Fork 122
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
MV3: Support CSL import from all .csl gitee pages #507
Conversation
let hosts = Zotero.Prefs.get('allowedCSLExtensionHosts'); | ||
if (Array.isArray(hosts) && hosts.includes(URI.hostname)) { | ||
if (Array.isArray(hosts) && hosts.some(host => new RegExp(host).test(url))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using regular expressions to test URLs is more compatible, but some variable names may need to be renamed
I'm not sure you understand entirely what we're doing with this code. For Firefox, Safari and Edge with the current Zotero Connector, all you need to do is go into the Zotero Connector Preferences -> Advanced -> Config Editor and change the MV3 stuff is only relevant with Chrome. We're going to add direct support for |
To my knowledge, MV3 is a new standard for Chrome extensions and has been specially treated in the Connector.
I do know that above settings will work, but as a styles distributor, I cannot guarantee that my users will be able to configure them properly. That's why I am trying to modify upstream code. |
I've added For MV3 (Chrome) support your changes are wrong and won't work. The DNR rule needs to redirect to a different URL (or the same url with a hash like |
Thank you for your prompt response. I manually add "gitee.com" to
After practical operation, I understand your meaning. We need to modify the URL in Connector to trigger confirmation window. I mistakenly thought that Zotero or the webpage had made such changes.
Does this mean that we will automatically add
I am not familiar enough with Connector's code, so I may not be able to handle it. |
If I install the default Zotero Connector into Firefox, add I have not tested with Edge. Note that if you are building Zotero Connector yourself and testing with Edge, you need to load the extension from the |
OK, I conducted some tests.
But as I mentioned earlier, Gitee's blob page and raw page have the same host, so import prompt is also shown on blob page, which is different from GitHub. Is this tolerable? |
It's not ideal but acceptable. If you want to modify this PR to make it work properly for MV3, we will accept it along with the regex changes for |
Yes, of course I hope that users in MV3 environment can also easily access styles on Gitee. I built the extension based on current PR and tested it on Edge (127.0.2651.105), Firefox (115.14.0esr), and Chrome (127.0.6533.120). It performed well on both Github and Gitee (Firefox refused to allow me to access Github through a proxy network, so it was not tested). If regular expressions are used to detect websites, then |
Merged. Thanks! We'll keep the |
Most East Asian style rely on CSL-M to achieve, and these styles are not allowed to be merged into CSL Syle's repository, though some are popular. We have maintained a large number of such styles and synchronized them to Gitee. In order to facilitate their distribution (as well as other styles that may be hosted on Gitee), I made this request.