mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
matrixsynapse: Fix issues with showing certificate warning
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
3961ccf415
commit
781ac3d5dd
@ -29,7 +29,6 @@ from ruamel.yaml.util import load_yaml_guess_indent
|
|||||||
from plinth import service as service_module
|
from plinth import service as service_module
|
||||||
from plinth import action_utils, actions, frontpage
|
from plinth import action_utils, actions, frontpage
|
||||||
from plinth.menu import main_menu
|
from plinth.menu import main_menu
|
||||||
from plinth.utils import YAMLFile
|
|
||||||
|
|
||||||
from .manifest import backup, clients
|
from .manifest import backup, clients
|
||||||
|
|
||||||
@ -164,12 +163,11 @@ def get_public_registration_status():
|
|||||||
|
|
||||||
|
|
||||||
def has_valid_certificate():
|
def has_valid_certificate():
|
||||||
"""Return whether the configured domain name has a valid
|
"""Return whether the configured domain name has a valid certificate."""
|
||||||
Let's Encrypt certificate."""
|
|
||||||
domain_name = get_configured_domain_name()
|
domain_name = get_configured_domain_name()
|
||||||
status = actions.superuser_run('letsencrypt', ['get-status'])
|
status = actions.superuser_run('letsencrypt', ['get-status'])
|
||||||
status = json.loads(status)
|
status = json.loads(status)
|
||||||
if domain_name in status['domains']:
|
if domain_name in status['domains']:
|
||||||
return status['domains'][domain_name][
|
return status['domains'][domain_name]['certificate_available']
|
||||||
'certificate_available'] == "true"
|
|
||||||
return False
|
return False
|
||||||
|
|||||||
@ -80,6 +80,7 @@ class MatrixSynapseServiceView(ServiceView):
|
|||||||
context['domain_name'] = matrixsynapse.get_configured_domain_name()
|
context['domain_name'] = matrixsynapse.get_configured_domain_name()
|
||||||
context['clients'] = matrixsynapse.clients
|
context['clients'] = matrixsynapse.clients
|
||||||
context['manual_page'] = matrixsynapse.manual_page
|
context['manual_page'] = matrixsynapse.manual_page
|
||||||
|
context['has_valid_certificate'] = has_valid_certificate()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
@ -87,7 +88,6 @@ class MatrixSynapseServiceView(ServiceView):
|
|||||||
initial = super().get_initial()
|
initial = super().get_initial()
|
||||||
initial.update({
|
initial.update({
|
||||||
'enable_public_registration': get_public_registration_status(),
|
'enable_public_registration': get_public_registration_status(),
|
||||||
'has_valid_certificate': has_valid_certificate(),
|
|
||||||
})
|
})
|
||||||
return initial
|
return initial
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user