mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 07:10:09 +01:00
Update dashboard_new.py
Typo in `updatePeer`
This commit is contained in:
parent
769ca4e26d
commit
5a34f16dcf
@ -505,7 +505,7 @@ class Peer:
|
||||
if keepalive < 0:
|
||||
return ResponseObject(False, "Persistent Keepalive format is not correct.")
|
||||
if len(private_key) > 0:
|
||||
pubKey = _generatePrivateKey(private_key)
|
||||
pubKey = _generatePublicKey(private_key)
|
||||
if not pubKey[0] or pubKey[1] != self.id:
|
||||
return ResponseObject(False, "Private key does not match with the public key.")
|
||||
try:
|
||||
@ -772,7 +772,7 @@ def _checkDNS(dns):
|
||||
return True
|
||||
|
||||
|
||||
def _generatePublicKey(privateKey) -> [bool, str]:
|
||||
def _generatePublicKey(privateKey) -> [bool, str] | [bool, None]:
|
||||
try:
|
||||
publicKey = subprocess.check_output(f"wg pubkey", input=privateKey.encode(), shell=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
@ -790,9 +790,6 @@ def _generatePrivateKey() -> [bool, str]:
|
||||
return False, None
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def _getWireguardConfigurationAvailableIP(configName: str) -> tuple[bool, list[str]] | tuple[bool, None]:
|
||||
if configName not in WireguardConfigurations.keys():
|
||||
return False, None
|
||||
@ -1035,7 +1032,7 @@ def API_addPeers(configName):
|
||||
keyPairs = []
|
||||
for i in range(bulkAddAmount):
|
||||
key = _generatePrivateKey()[1]
|
||||
keyPairs.append([key, _generatePublicKey(key), _generatePrivateKey()[1]])
|
||||
keyPairs.append([key, _generatePublicKey(key)[1], _generatePrivateKey()[1]])
|
||||
if len(keyPairs) == 0:
|
||||
return ResponseObject(False, "Generating key pairs by bulk failed")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user