Merge pull request #12899 from nextcloud/feature/run-setupcheck-on-overwie
Run setupchecks when #security-warnings is present
This commit is contained in:
commit
8f7839ef3e
|
@ -244,67 +244,73 @@ $(document).ready(function(){
|
||||||
$("#selectExcludedGroups").toggleClass('hidden', !this.checked);
|
$("#selectExcludedGroups").toggleClass('hidden', !this.checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
// run setup checks then gather error messages
|
var setupChecks = function () {
|
||||||
$.when(
|
// run setup checks then gather error messages
|
||||||
OC.SetupChecks.checkWebDAV(),
|
$.when(
|
||||||
OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]),
|
OC.SetupChecks.checkWebDAV(),
|
||||||
OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
OC.SetupChecks.checkWellKnownUrl('/.well-known/webfinger', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true && !!oc_appconfig.core.public_webfinger, [200, 501]),
|
||||||
OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
OC.SetupChecks.checkWellKnownUrl('/.well-known/caldav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
||||||
OC.SetupChecks.checkSetup(),
|
OC.SetupChecks.checkWellKnownUrl('/.well-known/carddav', oc_defaults.docPlaceholderUrl, $('#postsetupchecks').data('check-wellknown') === true),
|
||||||
OC.SetupChecks.checkGeneric(),
|
OC.SetupChecks.checkSetup(),
|
||||||
OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl),
|
OC.SetupChecks.checkGeneric(),
|
||||||
OC.SetupChecks.checkDataProtected()
|
OC.SetupChecks.checkWOFF2Loading(OC.filePath('core', '', 'fonts/Nunito-Regular.woff2'), oc_defaults.docPlaceholderUrl),
|
||||||
).then(function(check1, check2, check3, check4, check5, check6, check7, check8) {
|
OC.SetupChecks.checkDataProtected()
|
||||||
var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8);
|
).then(function (check1, check2, check3, check4, check5, check6, check7, check8) {
|
||||||
var $el = $('#postsetupchecks');
|
var messages = [].concat(check1, check2, check3, check4, check5, check6, check7, check8);
|
||||||
$('#security-warning-state-loading').addClass('hidden');
|
var $el = $('#postsetupchecks');
|
||||||
|
$('#security-warning-state-loading').addClass('hidden');
|
||||||
|
|
||||||
var hasMessages = false;
|
var hasMessages = false;
|
||||||
var $errorsEl = $el.find('.errors');
|
var $errorsEl = $el.find('.errors');
|
||||||
var $warningsEl = $el.find('.warnings');
|
var $warningsEl = $el.find('.warnings');
|
||||||
var $infoEl = $el.find('.info');
|
var $infoEl = $el.find('.info');
|
||||||
|
|
||||||
for (var i = 0; i < messages.length; i++ ) {
|
for (var i = 0; i < messages.length; i++) {
|
||||||
switch(messages[i].type) {
|
switch (messages[i].type) {
|
||||||
case OC.SetupChecks.MESSAGE_TYPE_INFO:
|
case OC.SetupChecks.MESSAGE_TYPE_INFO:
|
||||||
$infoEl.append('<li>' + messages[i].msg + '</li>');
|
$infoEl.append('<li>' + messages[i].msg + '</li>');
|
||||||
break;
|
break;
|
||||||
case OC.SetupChecks.MESSAGE_TYPE_WARNING:
|
case OC.SetupChecks.MESSAGE_TYPE_WARNING:
|
||||||
$warningsEl.append('<li>' + messages[i].msg + '</li>');
|
$warningsEl.append('<li>' + messages[i].msg + '</li>');
|
||||||
break;
|
break;
|
||||||
case OC.SetupChecks.MESSAGE_TYPE_ERROR:
|
case OC.SetupChecks.MESSAGE_TYPE_ERROR:
|
||||||
default:
|
default:
|
||||||
$errorsEl.append('<li>' + messages[i].msg + '</li>');
|
$errorsEl.append('<li>' + messages[i].msg + '</li>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($errorsEl.find('li').length > 0) {
|
|
||||||
$errorsEl.removeClass('hidden');
|
|
||||||
hasMessages = true;
|
|
||||||
}
|
|
||||||
if ($warningsEl.find('li').length > 0) {
|
|
||||||
$warningsEl.removeClass('hidden');
|
|
||||||
hasMessages = true;
|
|
||||||
}
|
|
||||||
if ($infoEl.find('li').length > 0) {
|
|
||||||
$infoEl.removeClass('hidden');
|
|
||||||
hasMessages = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasMessages) {
|
|
||||||
$('#postsetupchecks-hint').removeClass('hidden');
|
|
||||||
if ($errorsEl.find('li').length > 0) {
|
if ($errorsEl.find('li').length > 0) {
|
||||||
$('#security-warning-state-failure').removeClass('hidden');
|
$errorsEl.removeClass('hidden');
|
||||||
} else {
|
hasMessages = true;
|
||||||
$('#security-warning-state-warning').removeClass('hidden');
|
|
||||||
}
|
}
|
||||||
} else {
|
if ($warningsEl.find('li').length > 0) {
|
||||||
var securityWarning = $('#security-warning');
|
$warningsEl.removeClass('hidden');
|
||||||
if (securityWarning.children('ul').children().length === 0) {
|
hasMessages = true;
|
||||||
$('#security-warning-state-ok').removeClass('hidden');
|
|
||||||
} else {
|
|
||||||
$('#security-warning-state-failure').removeClass('hidden');
|
|
||||||
}
|
}
|
||||||
}
|
if ($infoEl.find('li').length > 0) {
|
||||||
});
|
$infoEl.removeClass('hidden');
|
||||||
|
hasMessages = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasMessages) {
|
||||||
|
$('#postsetupchecks-hint').removeClass('hidden');
|
||||||
|
if ($errorsEl.find('li').length > 0) {
|
||||||
|
$('#security-warning-state-failure').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
$('#security-warning-state-warning').removeClass('hidden');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var securityWarning = $('#security-warning');
|
||||||
|
if (securityWarning.children('ul').children().length === 0) {
|
||||||
|
$('#security-warning-state-ok').removeClass('hidden');
|
||||||
|
} else {
|
||||||
|
$('#security-warning-state-failure').removeClass('hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (document.getElementById('security-warning') !== null) {
|
||||||
|
setupChecks();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue