Update WireguardConfiguration.py

pull/1138/head
mahemium 2026-02-18 15:24:23 +00:00 committed by GitHub
parent a6be4eab93
commit 20f28afc60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -704,8 +704,8 @@ class WireguardConfiguration:
AllPeerShareLinks.updateLinkExpireDate(shareLink.ShareID, datetime.now())
if found:
try:
subprocess.check_output(f"{self.Protocol} set {self.Name} peer {pf.id} remove",
shell=True, stderr=subprocess.STDOUT)
command = [self.Protocol, "set", self.Name, "peer", pf.id, "remove"]
subprocess.check_output(command, stderr=subprocess.STDOUT)
conn.execute(
self.peersTable.delete().where(
self.peersTable.columns.id == pf.id
@ -747,7 +747,7 @@ class WireguardConfiguration:
self.toggleConfiguration()
try:
command = [self.Protocol, "show", self.Name, "latest-handshakes"]
latestHandshake = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
latestHandshake = subprocess.check_output(command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError:
return "stopped"
latestHandshake = latestHandshake.decode("UTF-8").split()
@ -845,7 +845,7 @@ class WireguardConfiguration:
self.toggleConfiguration()
try:
command = [self.Protocol, "show", self.Name, "endpoints"]
data_usage = subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT)
data_usage = subprocess.check_output(command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError:
return "stopped"
data_usage = data_usage.decode("UTF-8").split()
@ -1312,4 +1312,4 @@ class WireguardConfiguration:
conn.execute(sqlalchemy.text('VACUUM;'))
except Exception as e:
return False
return True
return True