mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-11-16 18:36:19 +00:00
Fixed duplicated data
This commit is contained in:
@@ -503,6 +503,15 @@ class WireguardConfiguration:
|
||||
if tempPeer.status == "running":
|
||||
endpoint = tempPeer.endpoint.rsplit(":", 1)
|
||||
if len(endpoint) == 2 and len(endpoint[0]) > 0:
|
||||
exist = conn.execute(
|
||||
self.peersHistoryEndpointTable.select().where(
|
||||
sqlalchemy.and_(
|
||||
self.peersHistoryEndpointTable.c.id == tempPeer.id,
|
||||
self.peersHistoryEndpointTable.c.endpoint == endpoint[0]
|
||||
)
|
||||
)
|
||||
).mappings().fetchone()
|
||||
if not exist:
|
||||
conn.execute(
|
||||
self.peersHistoryEndpointTable.insert().values({
|
||||
"id": tempPeer.id,
|
||||
|
||||
Reference in New Issue
Block a user