Skip to content

Commit

Permalink
Merge pull request #833 from catalyst/fix-connectivity-check
Browse files Browse the repository at this point in the history
feat: ignore cors during connectivity check
  • Loading branch information
Peterburnett authored Sep 9, 2024
2 parents 6f468e1 + 686d175 commit 3aa5842
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
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

0 comments on commit 3aa5842

Please sign in to comment.