matrixsynapse: Fix issues with showing certificate warning

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2019-02-13 15:40:05 -08:00
parent 3961ccf415
commit 781ac3d5dd
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 4 additions and 6 deletions

View File

@ -29,7 +29,6 @@ from ruamel.yaml.util import load_yaml_guess_indent
from plinth import service as service_module
from plinth import action_utils, actions, frontpage
from plinth.menu import main_menu
from plinth.utils import YAMLFile
from .manifest import backup, clients
@ -164,12 +163,11 @@ def get_public_registration_status():
def has_valid_certificate():
"""Return whether the configured domain name has a valid
Let's Encrypt certificate."""
"""Return whether the configured domain name has a valid certificate."""
domain_name = get_configured_domain_name()
status = actions.superuser_run('letsencrypt', ['get-status'])
status = json.loads(status)
if domain_name in status['domains']:
return status['domains'][domain_name][
'certificate_available'] == "true"
return status['domains'][domain_name]['certificate_available']
return False

View File

@ -80,6 +80,7 @@ class MatrixSynapseServiceView(ServiceView):
context['domain_name'] = matrixsynapse.get_configured_domain_name()
context['clients'] = matrixsynapse.clients
context['manual_page'] = matrixsynapse.manual_page
context['has_valid_certificate'] = has_valid_certificate()
return context
def get_initial(self):
@ -87,7 +88,6 @@ class MatrixSynapseServiceView(ServiceView):
initial = super().get_initial()
initial.update({
'enable_public_registration': get_public_registration_status(),
'has_valid_certificate': has_valid_certificate(),
})
return initial