mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-06-28 09:16:55 +00:00
Doing a final check
This commit is contained in:
parent
bd47179ea4
commit
6f036876c8
@ -432,6 +432,20 @@ class WireguardConfiguration:
|
|||||||
original = [l.rstrip("\n") for l in f.readlines()]
|
original = [l.rstrip("\n") for l in f.readlines()]
|
||||||
try:
|
try:
|
||||||
start = original.index("[Interface]")
|
start = original.index("[Interface]")
|
||||||
|
# Clean
|
||||||
|
for i in range(start, len(original)):
|
||||||
|
if original[i] == "[Peer]":
|
||||||
|
break
|
||||||
|
split = re.split(r'\s*=\s*', original[i], 1)
|
||||||
|
if len(split) == 2:
|
||||||
|
key = split[0]
|
||||||
|
if key in dir(self):
|
||||||
|
if isinstance(getattr(self, key), bool):
|
||||||
|
setattr(self, key, False)
|
||||||
|
else:
|
||||||
|
setattr(self, key, "")
|
||||||
|
|
||||||
|
# Set
|
||||||
for i in range(start, len(original)):
|
for i in range(start, len(original)):
|
||||||
if original[i] == "[Peer]":
|
if original[i] == "[Peer]":
|
||||||
break
|
break
|
||||||
@ -1197,15 +1211,15 @@ AmneziaWG Configuration
|
|||||||
"""
|
"""
|
||||||
class AmneziaWireguardConfiguration(WireguardConfiguration):
|
class AmneziaWireguardConfiguration(WireguardConfiguration):
|
||||||
def __init__(self, name: str = None, data: dict = None, backup: dict = None, startup: bool = False):
|
def __init__(self, name: str = None, data: dict = None, backup: dict = None, startup: bool = False):
|
||||||
self.Jc = "0"
|
self.Jc = ""
|
||||||
self.Jmin = "0"
|
self.Jmin = ""
|
||||||
self.Jmax = "0"
|
self.Jmax = ""
|
||||||
self.S1 = "0"
|
self.S1 = ""
|
||||||
self.S2 = "0"
|
self.S2 = ""
|
||||||
self.H1 = "1"
|
self.H1 = ""
|
||||||
self.H2 = "2"
|
self.H2 = ""
|
||||||
self.H3 = "3"
|
self.H3 = ""
|
||||||
self.H4 = "4"
|
self.H4 = ""
|
||||||
|
|
||||||
super().__init__(name, data, backup, startup, wg=False)
|
super().__init__(name, data, backup, startup, wg=False)
|
||||||
|
|
||||||
@ -1230,6 +1244,7 @@ class AmneziaWireguardConfiguration(WireguardConfiguration):
|
|||||||
},
|
},
|
||||||
"ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))),
|
"ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))),
|
||||||
"TotalPeers": len(self.Peers),
|
"TotalPeers": len(self.Peers),
|
||||||
|
"Table": self.Table,
|
||||||
"Protocol": self.Protocol,
|
"Protocol": self.Protocol,
|
||||||
"Jc": self.Jc,
|
"Jc": self.Jc,
|
||||||
"Jmin": self.Jmin,
|
"Jmin": self.Jmin,
|
||||||
|
@ -36,7 +36,7 @@ const resetForm = () => {
|
|||||||
dataChanged.value = false;
|
dataChanged.value = false;
|
||||||
Object.assign(data, JSON.parse(JSON.stringify(props.configurationInfo)))
|
Object.assign(data, JSON.parse(JSON.stringify(props.configurationInfo)))
|
||||||
}
|
}
|
||||||
const emit = defineEmits(["changed", "close", "refresh"])
|
const emit = defineEmits(["changed", "close", "refresh", "dataChanged"])
|
||||||
const saveForm = () => {
|
const saveForm = () => {
|
||||||
saving.value = true
|
saving.value = true
|
||||||
fetchPost("/api/updateWireguardConfiguration", data, (res) => {
|
fetchPost("/api/updateWireguardConfiguration", data, (res) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user