diff --git a/templates/wireguard/wireguard_status.html b/templates/wireguard/wireguard_status.html index d141e4a..c16f912 100644 --- a/templates/wireguard/wireguard_status.html +++ b/templates/wireguard/wireguard_status.html @@ -1,5 +1,28 @@ {% extends "base.html" %} {% block content %} -this page is just a placeholder for the moment + +
{{command_output}}
+
+ + This is just a placeholder for the WireGuard status page. It will be updated with more information in the near future. +
+ {% endblock %} diff --git a/wireguard/views.py b/wireguard/views.py index fadec58..79964b9 100644 --- a/wireguard/views.py +++ b/wireguard/views.py @@ -75,7 +75,15 @@ def view_welcome(request): @login_required def view_wireguard_status(request): page_title = 'WireGuard Status' - context = {'page_title': page_title} + bash_command = ['bash', '-c', 'wg show'] + try: + command_output = subprocess.check_output(bash_command, stderr=subprocess.STDOUT).decode('utf-8') + command_success = True + except subprocess.CalledProcessError as e: + command_output = e.output.decode('utf-8') + command_success = False + + context = {'page_title': page_title, 'command_output': command_output, 'command_success': command_success} return render(request, 'wireguard/wireguard_status.html', context)