Skip to content
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

Allow configuring the MathJax URL #1160

Open
daniil-berg opened this issue Apr 4, 2024 · 2 comments
Open

Allow configuring the MathJax URL #1160

daniil-berg opened this issue Apr 4, 2024 · 2 comments
Assignees
Milestone

Comments

@daniil-berg
Copy link
Contributor

This was mentioned in #992, specifically in this comment, so I want to focus on this specific issue.

Right now the MathJax URL is hard-coded to point to cdn.jsdelivr.net:

/*
* Gets the URL used for MathJax, might be VLE local.
*/
function stack_get_mathjax_url(): string {
// TODO: figure out how to support VLE local with CORS.
return 'https://cdn.jsdelivr.net/npm/mathjax@2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
}

I realize that a specific CORS Header is required to make this work, but it would still be nice, if we could change the URL without having to create our own fork and branch of this repository.

In fact, simply pointing to the filter_mathjaxloader | httpsurl Moodle setting should be fine. You could add some documentation to the plugin that explains that changing that setting without ensuring the correct CORS header will affect this.

Alternatively, a separate config option just for this plugin would also be fine. There you could add the info about the CORS issue right next to the setting.

In any case, a hard-coded URL is not ideal. We have a strict CSP for our Moodle instance that blocks almost all other domains and we use our own installation of MathJax that we point filter_mathjaxloader | httpsurl to.

@sangwinc
Copy link
Member

sangwinc commented Apr 8, 2024

Agreed, a hard-coded URL is not sensible! Let's fix this.

@sangwinc sangwinc added this to the 4.7.0 milestone Apr 8, 2024
@MuellerAle
Copy link

MuellerAle commented May 6, 2024

May I suggest we:

  1. use filter_mathjaxloader | httpsurl that is already a core part of moodle.
  2. add other cdn files locally to the plugin (if any).
    Optional: add qtype settings with fields to enter the cdn when users want to use cdn instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants