diff --git a/src/dashboard_new.py b/src/dashboard_new.py
index 7017956..171ea5b 100644
--- a/src/dashboard_new.py
+++ b/src/dashboard_new.py
@@ -16,6 +16,7 @@ from dataclasses import dataclass
from datetime import datetime, timedelta
from json import JSONEncoder
from operator import itemgetter
+from typing import Dict, Any
import flask
# PIP installed library
@@ -114,6 +115,8 @@ class WireguardConfiguration:
if self.PrivateKey:
self.PublicKey = self.__getPublicKey()
+ self.Status = self.__getStatus()
+
# Create tables in database
inspector = inspect(engine)
existingTable = inspector.get_table_names()
@@ -127,7 +130,11 @@ class WireguardConfiguration:
def __getPublicKey(self) -> str:
return subprocess.check_output(['wg', 'pubkey'], input=self.PrivateKey.encode()).decode().strip('\n')
+ def __getStatus(self) -> bool:
+ return self.Name in dict(ifcfg.interfaces().items()).keys()
+
def toJSON(self):
+ self.Status = self.__getStatus()
return self.__dict__
@@ -190,6 +197,14 @@ class DashboardConfig:
return True, self.__config[section][key]
+ def toJSON(self) -> dict[str, dict[Any, Any]]:
+ the_dict = {}
+ for section in self.__config.sections():
+ the_dict[section] = {}
+ for key, val in self.__config.items(section):
+ the_dict[section][key] = val
+ return the_dict
+
def ResponseObject(status=True, message=None, data=None) -> Flask.response_class:
response = Flask.make_response(app, {
@@ -340,12 +355,13 @@ def API_AuthenticateLogin():
@app.route('/api/getWireguardConfigurations', methods=["GET"])
def API_getWireguardConfigurations():
- pass
+ WireguardConfigurations = _getConfigurationList()
+ return ResponseObject(data=[wc.toJSON() for wc in WireguardConfigurations])
@app.route('/api/getDashboardConfiguration', methods=["GET"])
def API_getDashboardConfiguration():
- pass
+ return ResponseObject(data=DashboardConfig.toJSON())
if __name__ == "__main__":
diff --git a/src/requirements.txt b/src/requirements.txt
index 5d3b347..83dc31f 100644
--- a/src/requirements.txt
+++ b/src/requirements.txt
@@ -3,4 +3,5 @@ ifcfg
icmplib
flask-qrcode
gunicorn
-certbot
\ No newline at end of file
+certbot
+sqlalchemy
\ No newline at end of file
diff --git a/src/static/app/src/components/configurationList.vue b/src/static/app/src/components/configurationList.vue
new file mode 100644
index 0000000..be10e2f
--- /dev/null
+++ b/src/static/app/src/components/configurationList.vue
@@ -0,0 +1,51 @@
+
+
+
+
+
Wireguard Configurations
+
You don't have any WireGuard configurations yet. Please check the configuration folder or change it in "Settings". By default the folder is "/etc/wireguard".
+
+
+
+
+
+
+ CONFIGURATION
+
{{c.Name}}
+
+
+ STATUS
+
{{c.Status ? "Running":"Stopped"}}
+
+
+
+ PUBLIC KEY
+
{{c.PublicKey}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/static/app/src/components/navbar.vue b/src/static/app/src/components/navbar.vue
index ff978c4..3bb5312 100644
--- a/src/static/app/src/components/navbar.vue
+++ b/src/static/app/src/components/navbar.vue
@@ -1,34 +1,43 @@
-