mirror of
https://github.com/WGDashboard/WGDashboard.git
synced 2026-08-04 06:53:00 +00:00
New darkmode theme
This commit is contained in:
+18
-2
@@ -2,10 +2,15 @@ import ipaddress, subprocess, datetime, os, util
|
||||
from datetime import datetime, timedelta
|
||||
from flask import jsonify
|
||||
from util import *
|
||||
import configparser
|
||||
|
||||
notEnoughParameter = {"status": False, "reason": "Please provide all required parameters."}
|
||||
good = {"status": True, "reason": ""}
|
||||
|
||||
def ret(status=True, reason="", data=""):
|
||||
return {"status": status, "reason": reason, "data": data}
|
||||
|
||||
|
||||
|
||||
def togglePeerAccess(data, g):
|
||||
checkUnlock = g.cur.execute(f"SELECT * FROM {data['config']} WHERE id='{data['peerID']}'").fetchone()
|
||||
@@ -70,7 +75,7 @@ class managePeer:
|
||||
})
|
||||
return {"status": True, "reason": "", "data": chartData}
|
||||
|
||||
class addConfiguration:
|
||||
class manageConfiguration:
|
||||
def AddressCheck(self, data):
|
||||
address = data['address']
|
||||
address = address.replace(" ", "")
|
||||
@@ -165,4 +170,15 @@ class addConfiguration:
|
||||
except Exception as e:
|
||||
return {"status": False, "reason": "Can't delete peer", "data": str(e)}
|
||||
|
||||
return good
|
||||
return good
|
||||
|
||||
def getConfigurationInfo(self, configName, WG_CONF_PATH):
|
||||
conf = configparser.ConfigParser(strict=False)
|
||||
try:
|
||||
with open(f'{WG_CONF_PATH}/{configName}.conf', 'r'):
|
||||
conf.read(f'{WG_CONF_PATH}/{configName}.conf')
|
||||
if not conf.has_section("Interface"):
|
||||
return ret(status=False, reason="No [Interface] in configuration file")
|
||||
return ret(data=dict(conf['Interface']))
|
||||
except FileNotFoundError as err:
|
||||
return ret(status=False, reason=str(err))
|
||||
Reference in New Issue
Block a user