Skip to content

Commit 3aa5842

Browse files
authored
Merge pull request #833 from catalyst/fix-connectivity-check
feat: ignore cors during connectivity check
2 parents 6f468e1 + 686d175 commit 3aa5842

4 files changed

+12
-9
lines changed

amd/build/connectivity_test.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/connectivity_test.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/src/connectivity_test.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@
2323
*/
2424

2525
export const init = (checkTarget, redirURL) => {
26-
const http = new XMLHttpRequest();
27-
http.open('HEAD', checkTarget);
28-
http.addEventListener('load', () => {
26+
// We need to use no-cors to ignore cors, however,
27+
// this means we are returned an opaque response.
28+
// But an opaque response is info to say if the site is accessible or not.
29+
fetch(checkTarget, { mode: 'no-cors', method: 'HEAD' })
30+
.then(() => {
2931
window.location = redirURL;
30-
});
31-
http.send();
32+
})
33+
// Do nothing with error, we don't care about it.
34+
.catch(() => {});
3235
};

version.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

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

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

0 commit comments

Comments
 (0)