Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
yflory 4 years ago
commit 712a78dbca

@ -1,7 +1,6 @@
@import (reference) "../include/colortheme-all.less";
@import (reference) "../include/font.less";
//@import (reference) "../include/forms.less";
@import (reference) "../include/alertify.less";
@import (reference) "../../customize/src/less2/include/colortheme-all.less";
@import (reference) "../../customize/src/less2/include/font.less";
@import (reference) "../../customize/src/less2/include/alertify.less";
html, body {
.font_main();
@ -55,9 +54,16 @@ html, body {
word-break: break-word;
padding: 5px;
//font-size: 16px;
border: 1px solid red;
&.cp-danger {
border: 1px solid @cp_alerts-danger-bg;
background-color: @cp_alerts-danger-bg;
color: @cp_alerts-danger-text;
}
&.cp-warning {
border: 1px solid @cp_alerts-warning-bg;
background-color: @cp_alerts-warning-bg;
color: @cp_alerts-warning-text;
}
code {
word-break: keep-all;
font-style: italic;

@ -15,7 +15,7 @@ define([
'/bower_components/tweetnacl/nacl-fast.min.js',
'css!/bower_components/components-font-awesome/css/font-awesome.min.css',
'less!/customize/src/less2/pages/page-checkup.less',
'less!/checkup/app-checkup.less',
], function ($, ApiConfig, Assertions, h, Messages, DomReady,
nThen, SFCommonO, Login, Hash, Util, Pinpad,
NetConfig) {
@ -26,7 +26,7 @@ define([
};
var assert = function (f, msg) {
Assert(f, msg || h('span.advisory-text'));
Assert(f, msg || h('span.advisory-text.cp-danger'));
};
var CONFIG_PATH = function () {
@ -412,10 +412,7 @@ define([
dataType: 'text',
complete: function (xhr) {
var allHeaders = xhr.getAllResponseHeaders();
console.error(allHeaders);
var headers = {};
var duplicated = allHeaders.split('\n').some(function (header) {
var duplicate;
header.replace(/([^:]+):(.*)/, function (all, type, value) {
@ -428,8 +425,6 @@ define([
return duplicate;
});
if (duplicated) { return void cb(false); }
var expect = {
'cross-origin-resource-policy': 'cross-origin',
};
@ -440,7 +435,8 @@ define([
}
});
cb(!incorrect);
if (duplicated || incorrect) { console.error(allHeaders); }
cb(!duplicated && !incorrect);
},
});
};
@ -459,6 +455,59 @@ define([
checkAPIHeaders(url, cb);
});
var setWarningClass = function (msg) {
$(msg).removeClass('cp-danger').addClass('cp-warning');
};
assert(function (cb, msg) {
var email = ApiConfig.adminEmail;
if (typeof(email) === 'string' && email && email !== 'i.did.not.read.my.config@cryptpad.fr') {
return void cb(true);
}
setWarningClass(msg);
msg.appendChild(h('span', [
'This instance does not provide a valid ',
h('code', 'adminEmail'),
' which can make it difficult to contact its adminstrator to report vulnerabilities or abusive content.',
' This can be configured in ', CONFIG_PATH(), '. ',
RESTART_WARNING(),
]));
cb(email);
});
assert(function (cb, msg) {
var support = ApiConfig.supportMailbox;
setWarningClass(msg);
msg.appendChild(h('span', [
"This instance's encrypted support ticket functionality has not been enabled. This can make it difficult for its users to safely report issues that concern sensitive information. ",
"This can be configured via the ",
h('code', 'supportMailbox'),
" attribute in ",
CONFIG_PATH(),
". ",
RESTART_WARNING(),
]));
cb(support && typeof(support) === 'string' && support.length === 44);
});
assert(function (cb, msg) {
var adminKeys = ApiConfig.adminKeys;
if (Array.isArray(adminKeys) && adminKeys.length >= 1 && typeof(adminKeys[0]) === 'string' && adminKeys[0].length === 44) {
return void cb(true);
}
setWarningClass(msg);
msg.appendChild(h('span', [
"This instance has not been configured to support web administration. This can be enabled by adding a registered user's public signing key to the ",
h('code', 'adminKeys'),
' array in ',
CONFIG_PATH(),
'. ',
RESTART_WARNING(),
]));
cb(false);
});
var row = function (cells) {
return h('tr', cells.map(function (cell) {
return h('td', cell);

Loading…
Cancel
Save