mirror of https://github.com/xwiki-labs/cryptpad
checkup: complain if public instance don't provide description & location
This commit is contained in:
parent
071c9706af
commit
c81525ffc4
|
@ -237,6 +237,7 @@ var serveConfig = makeRouteCache(function (host) {
|
|||
enableEmbedding: Env.enableEmbedding,
|
||||
fileHost: Env.fileHost,
|
||||
shouldUpdateNode: Env.shouldUpdateNode || undefined,
|
||||
listMyInstance: Env.listMyInstance,
|
||||
}, null, '\t'),
|
||||
'});'
|
||||
].join(';\n')
|
||||
|
|
|
@ -1385,6 +1385,36 @@ define([
|
|||
});
|
||||
});
|
||||
|
||||
assert(function (cb, msg) {
|
||||
if (!ApiConfig.listMyInstance) { return void cb(true); }
|
||||
msg.appendChild(h('span', [
|
||||
"The administrators of this instance have opted in to inclusion in ",
|
||||
link('https://cryptpad.org/instances/', 'the public instance directory'),
|
||||
' but have not configured at least one of the expected ',
|
||||
code('description'),
|
||||
' or ',
|
||||
code('location'),
|
||||
' text fields via the instance admin panel.',
|
||||
]));
|
||||
var expected = [
|
||||
'description',
|
||||
'location',
|
||||
//'name',
|
||||
// 'notice',
|
||||
];
|
||||
|
||||
var url = '/api/instance';
|
||||
require([
|
||||
`optional!${url}`,
|
||||
], function (Instance) {
|
||||
var good = expected.every(function (k) {
|
||||
var val = Instance[k];
|
||||
return (val && typeof(val) === 'object' && typeof(val.default) === 'string' && val.default.trim());
|
||||
});
|
||||
return void cb(good || Instance);
|
||||
});
|
||||
});
|
||||
|
||||
var serverToken;
|
||||
Tools.common_xhr('/', function (xhr) {
|
||||
serverToken = xhr.getResponseHeader('server');
|
||||
|
|
Loading…
Reference in New Issue