diff --git a/modules/web_viewer/templates/admin_config.html b/modules/web_viewer/templates/admin_config.html new file mode 100644 index 0000000..eae5064 --- /dev/null +++ b/modules/web_viewer/templates/admin_config.html @@ -0,0 +1,113 @@ +{% extends "base.html" %} + +{% block title %}Raw Config — MeshCore Bot{% endblock %} + +{% block extra_css %} + +{% endblock %} + +{% block content %} +
+
+
+ +

+ Raw Config +

+

+ Effective values loaded by the bot (sensitive keys are redacted). This view is read-only. +

+

+ {{ config_path }} +

+ + {% for section_name, options in sections.items() %} +
+
+

[{{ section_name }}]

+
+
+ {% if options %} +
+ + + + + + + + + {% for key, val in options.items() %} + + + + + {% endfor %} + +
KeyValue
{{ key }}{{ val }}
+
+ {% else %} +

No keys in this section.

+ {% endif %} +
+
+ {% endfor %} + + {% if not sections %} +

No configuration sections to display.

+ {% endif %} +
+
+
+{% endblock %} diff --git a/tests/test_web_viewer_app.py b/tests/test_web_viewer_app.py index eb91575..74e9a59 100644 --- a/tests/test_web_viewer_app.py +++ b/tests/test_web_viewer_app.py @@ -811,6 +811,25 @@ class TestApiExplorer: assert 'curl-btn' in body +# --------------------------------------------------------------------------- +# admin_config (resolved config.ini viewer) +# --------------------------------------------------------------------------- + + +class TestAdminConfig: + def test_page_loads(self, mock_viewer): + with mock_viewer.app.test_client() as client: + response = client.get('/admin/config') + assert response.status_code == 200 + + def test_redacts_password_like_keys(self, mock_viewer): + with mock_viewer.app.test_client() as client: + response = client.get('/admin/config') + body = response.data.decode() + assert 'web_viewer_password' in body + assert '●●●●●●' in body + + # --------------------------------------------------------------------------- # error_handler # ---------------------------------------------------------------------------