mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-04 08:16:17 +00:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a62c54b4ed | ||
|
41df7c04c3 | ||
|
9b783a8322 | ||
|
57db4df618 | ||
|
9d1081bd56 | ||
|
07a04dc507 | ||
|
cd1329ec67 | ||
|
48a58b2b69 | ||
|
9b64aba8bf | ||
|
cae8264d98 | ||
|
95d8985336 |
@@ -1,5 +1,10 @@
|
||||
> [!TIP]
|
||||
> 🎉 I'm excited to announce that WGDashboard is officially listed on DigitalOcean's Marketplace! For more information, please visit [Host WGDashboard & WireGuard with DigitalOcean](https://donaldzou.dev/WGDashboard-Documentation/host-wgdashboard-wireguard-with-digitalocean.html) for more information!
|
||||
|
||||
> [!NOTE]
|
||||
> **Help Wanted 🎉**: Localizing WGDashboard to other languages! If you're willing to help, please visit https://github.com/donaldzou/WGDashboard/issues/397. Many thanks!
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
<p align="center">
|
||||
|
@@ -27,7 +27,7 @@ import threading
|
||||
|
||||
from flask.json.provider import DefaultJSONProvider
|
||||
|
||||
DASHBOARD_VERSION = 'v4.1.3'
|
||||
DASHBOARD_VERSION = 'v4.1.4'
|
||||
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
|
||||
DB_PATH = os.path.join(CONFIGURATION_PATH, 'db')
|
||||
if not os.path.isdir(DB_PATH):
|
||||
@@ -351,15 +351,13 @@ class PeerJobs:
|
||||
f"Peer {fp.id} from {c.Name} failed {job.Action}ed."
|
||||
)
|
||||
else:
|
||||
JobLogger.log(job.JobID, s["status"],
|
||||
JobLogger.log(job.JobID,False,
|
||||
f"Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed."
|
||||
)
|
||||
# needToDelete.append(job)
|
||||
else:
|
||||
JobLogger.log(job.JobID, s["status"],
|
||||
JobLogger.log(job.JobID, False,
|
||||
f"Somehow can't find this peer {job.Peer} from {job.Configuration} failed {job.Action}ed."
|
||||
)
|
||||
# needToDelete.append(job)
|
||||
for j in needToDelete:
|
||||
self.deleteJob(j)
|
||||
|
||||
@@ -796,7 +794,7 @@ class WireguardConfiguration:
|
||||
for i in listOfPublicKeys:
|
||||
p = sqlSelect("SELECT * FROM '%s_restrict_access' WHERE id = ?" % self.Name, (i,)).fetchone()
|
||||
if p is not None:
|
||||
sqlUpdate("INSERT INTO '%s' SELECT * FROM %s_restrict_access WHERE id = ?"
|
||||
sqlUpdate("INSERT INTO '%s' SELECT * FROM '%s_restrict_access' WHERE id = ?"
|
||||
% (self.Name, self.Name,), (p['id'],))
|
||||
sqlUpdate("DELETE FROM '%s_restrict_access' WHERE id = ?"
|
||||
% self.Name, (p['id'],))
|
||||
@@ -830,7 +828,7 @@ class WireguardConfiguration:
|
||||
try:
|
||||
subprocess.check_output(f"wg set {self.Name} peer {pf.id} remove",
|
||||
shell=True, stderr=subprocess.STDOUT)
|
||||
sqlUpdate("INSERT INTO '%s_restrict_access' SELECT * FROM %s WHERE id = ?" %
|
||||
sqlUpdate("INSERT INTO '%s_restrict_access' SELECT * FROM '%s' WHERE id = ?" %
|
||||
(self.Name, self.Name,), (pf.id,))
|
||||
sqlUpdate("UPDATE '%s_restrict_access' SET status = 'stopped' WHERE id = ?" %
|
||||
(self.Name,), (pf.id,))
|
||||
@@ -1647,7 +1645,7 @@ def sqlSelect(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
|
||||
try:
|
||||
cursor = sqldb.cursor()
|
||||
return cursor.execute(statement, paramters)
|
||||
except Exception as e:
|
||||
except Exception as error:
|
||||
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
|
||||
return []
|
||||
|
||||
@@ -1661,7 +1659,7 @@ def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
|
||||
s = f'BEGIN TRANSACTION;{statement};END TRANSACTION;'
|
||||
cursor.execute(statement, paramters)
|
||||
sqldb.commit()
|
||||
except Exception as e:
|
||||
except Exception as error:
|
||||
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
|
||||
return []
|
||||
|
||||
@@ -2286,10 +2284,10 @@ def API_getDashboardVersion():
|
||||
@app.post(f'{APP_PREFIX}/api/savePeerScheduleJob/')
|
||||
def API_savePeerScheduleJob():
|
||||
data = request.json
|
||||
if "Job" not in data.keys() not in WireguardConfigurations.keys():
|
||||
if "Job" not in data.keys():
|
||||
return ResponseObject(False, "Please specify job")
|
||||
job: dict = data['Job']
|
||||
if "Peer" not in job.keys() or "Configuration" not in job.keys():
|
||||
if "Peer" not in job.keys() or "Configuration" not in job.keys() or job['Configuration'] not in WireguardConfigurations.keys():
|
||||
return ResponseObject(False, "Please specify peer and configuration")
|
||||
configuration = WireguardConfigurations.get(job['Configuration'])
|
||||
f, fp = configuration.searchPeer(job['Peer'])
|
||||
@@ -2306,10 +2304,10 @@ def API_savePeerScheduleJob():
|
||||
@app.post(f'{APP_PREFIX}/api/deletePeerScheduleJob/')
|
||||
def API_deletePeerScheduleJob():
|
||||
data = request.json
|
||||
if "Job" not in data.keys() not in WireguardConfigurations.keys():
|
||||
if "Job" not in data.keys():
|
||||
return ResponseObject(False, "Please specify job")
|
||||
job: dict = data['Job']
|
||||
if "Peer" not in job.keys() or "Configuration" not in job.keys():
|
||||
if "Peer" not in job.keys() or "Configuration" not in job.keys() or job['Configuration'] not in WireguardConfigurations.keys():
|
||||
return ResponseObject(False, "Please specify peer and configuration")
|
||||
configuration = WireguardConfigurations.get(job['Configuration'])
|
||||
f, fp = configuration.searchPeer(job['Peer'])
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "app",
|
||||
"version": "4.1.3",
|
||||
"version": "4.1.4",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
@@ -308,5 +308,5 @@
|
||||
"By adding peers by bulk, each peer's name will be auto generated, and Allowed IP will be assign to the next available IP\\.": "Při hromadném importu bude jméno každého peera vygenerované automaticky, a povolená IP adresa bude nastavena na další v pořadí",
|
||||
"How many peers you want to add\\?": "Kolik peerů chcete přidat?",
|
||||
"Adding\\.\\.\\.": "Přidávám...",
|
||||
"Dashboard IP Address \\& Listen Port": ""
|
||||
"Dashboard IP Address \\& Listen Port": "Dashboard IP adresa a otevřený port"
|
||||
}
|
Reference in New Issue
Block a user