mirror of
https://github.com/nextcloud/server.git
synced 2024-08-25 06:08:18 +02:00
![Lukas Reschke](/assets/img/avatar_default.png)
Calculating the URL is error-prone as it doesn't work when for example `public.php` is requested and might even be harmful as it could leak sensitive information. Since `oc.js` is even available when maintenance mode is available it is better to use the global `OC.webroot` that is not controlled by any user.
18 lines
487 B
JavaScript
18 lines
487 B
JavaScript
// Check every 20 seconds via status.php if maintenance is over
|
|
window.setInterval(checkStatus, 20000);
|
|
|
|
function checkStatus() {
|
|
var request = new XMLHttpRequest();
|
|
request.open("GET", OC.webroot+'/status.php', true);
|
|
request.onreadystatechange = function() {
|
|
if (request.readyState === 4) {
|
|
var response = request.responseText;
|
|
var responseobj = JSON.parse(response);
|
|
if (responseobj.maintenance === false) {
|
|
window.location.reload();
|
|
}
|
|
}
|
|
};
|
|
request.send();
|
|
}
|