@ -15,7 +15,7 @@ define([
'/bower_components/tweetnacl/nacl-fast.min.js' ,
'css!/bower_components/components-font-awesome/css/font-awesome.min.css' ,
'less!/c ustomize/src/less2/pages/page -checkup.less',
'less!/c heckup/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 ) ;