checkup: complain if public instance don't provide description & location

master
ansuz 3 years ago
parent 071c9706af
commit c81525ffc4

@ -237,6 +237,7 @@ var serveConfig = makeRouteCache(function (host) {
enableEmbedding: Env.enableEmbedding, enableEmbedding: Env.enableEmbedding,
fileHost: Env.fileHost, fileHost: Env.fileHost,
shouldUpdateNode: Env.shouldUpdateNode || undefined, shouldUpdateNode: Env.shouldUpdateNode || undefined,
listMyInstance: Env.listMyInstance,
}, null, '\t'), }, null, '\t'),
'});' '});'
].join(';\n') ].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; var serverToken;
Tools.common_xhr('/', function (xhr) { Tools.common_xhr('/', function (xhr) {
serverToken = xhr.getResponseHeader('server'); serverToken = xhr.getResponseHeader('server');

Loading…
Cancel
Save