From 174d97c442d5400d512dfccc478fd9fbd6fa075c Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 22 Sep 2022 14:11:22 +0530 Subject: [PATCH] test whether registration is open on public instances --- www/checkup/main.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/www/checkup/main.js b/www/checkup/main.js index 0afd0323d..e259355ef 100644 --- a/www/checkup/main.js +++ b/www/checkup/main.js @@ -1469,6 +1469,26 @@ define([ }); }); + assert(function (cb, msg) { + // public instances are expected to be open for registration + // if this is not a public instance, pass this test immediately + if (!ApiConfig.listMyInstance) { return cb(true); } + // if it's public but registration is not registricted, that's also a pass + if (!ApiConfig.restrictRegistration) { return void cb(true); } + + setWarningClass(msg); + 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 disabled registration, which is expected to be open.', + h('br'), + h('br'), + " Registration can be reopened using the instance's admin panel.", + ])); + + cb(false); + }); + var serverToken; Tools.common_xhr('/', function (xhr) { serverToken = xhr.getResponseHeader('server');