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

feat: ignore cors during connectivity check #833

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion amd/build/connectivity_test.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/connectivity_test.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions amd/src/connectivity_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@
*/

export const init = (checkTarget, redirURL) => {
const http = new XMLHttpRequest();
http.open('HEAD', checkTarget);
http.addEventListener('load', () => {
// We need to use no-cors to ignore cors, however,
// this means we are returned an opaque response.
// But an opaque response is info to say if the site is accessible or not.
fetch(checkTarget, { mode: 'no-cors', method: 'HEAD' })
.then(() => {
window.location = redirURL;
});
http.send();
})
// Do nothing with error, we don't care about it.
.catch(() => {});
};
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024082000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 2024082000; // Match release exactly to version.
$plugin->version = 2024090900; // The current plugin version (Date: YYYYMMDDXX).
$plugin->release = 2024090900; // Match release exactly to version.
$plugin->requires = 2017051509; // Requires PHP 7, 2017051509 = T12. M3.3
// Strictly we require either Moodle 3.5 OR
// we require Totara 3.3, but the version number
Expand Down
Loading