mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-12-16 00:16:18 +00:00
Fixed Restricted Peer might still appear after restricted
This commit is contained in:
@@ -404,6 +404,7 @@ class WireguardConfiguration:
|
|||||||
try:
|
try:
|
||||||
if "[Peer]" not in content:
|
if "[Peer]" not in content:
|
||||||
current_app.logger.info(f"{self.Name} config has no [Peer] section")
|
current_app.logger.info(f"{self.Name} config has no [Peer] section")
|
||||||
|
self.Peers = []
|
||||||
return
|
return
|
||||||
|
|
||||||
peerStarts = content.index("[Peer]")
|
peerStarts = content.index("[Peer]")
|
||||||
@@ -477,6 +478,7 @@ class WireguardConfiguration:
|
|||||||
with self.engine.connect() as conn:
|
with self.engine.connect() as conn:
|
||||||
existingPeers = conn.execute(self.peersTable.select()).mappings().fetchall()
|
existingPeers = conn.execute(self.peersTable.select()).mappings().fetchall()
|
||||||
for i in existingPeers:
|
for i in existingPeers:
|
||||||
|
print(i)
|
||||||
tmpList.append(Peer(i, self))
|
tmpList.append(Peer(i, self))
|
||||||
self.Peers = tmpList
|
self.Peers = tmpList
|
||||||
|
|
||||||
@@ -665,9 +667,8 @@ class WireguardConfiguration:
|
|||||||
|
|
||||||
if not self.__wgSave():
|
if not self.__wgSave():
|
||||||
return False, "Failed to save configuration through WireGuard"
|
return False, "Failed to save configuration through WireGuard"
|
||||||
|
self.getRestrictedPeers()
|
||||||
self.getPeers()
|
self.getPeers()
|
||||||
|
|
||||||
if numOfRestrictedPeers == len(listOfPublicKeys):
|
if numOfRestrictedPeers == len(listOfPublicKeys):
|
||||||
return True, f"Restricted {numOfRestrictedPeers} peer(s)"
|
return True, f"Restricted {numOfRestrictedPeers} peer(s)"
|
||||||
return False, f"Restricted {numOfRestrictedPeers} peer(s) successfully. Failed to restrict {numOfFailedToRestrictPeers} peer(s)"
|
return False, f"Restricted {numOfRestrictedPeers} peer(s) successfully. Failed to restrict {numOfFailedToRestrictPeers} peer(s)"
|
||||||
|
|||||||
Reference in New Issue
Block a user