Compare commits

..

11 Commits

Author SHA1 Message Date
Donald Zou
a62c54b4ed Merge pull request #576 from petrsimunek/patch-1
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Update cs.json
2025-01-19 21:07:40 +08:00
Donald Zou
41df7c04c3 Merge pull request #585 from donaldzou/fix-#581
Ready for update
2025-01-19 21:03:38 +08:00
Donald Zou
9b783a8322 Ready for update 2025-01-19 21:03:08 +08:00
Donald Zou
57db4df618 Merge pull request #584 from donaldzou/fix-#581
Fixed Job Logger Bug, Restrict Peers with Configuration include special characters
2025-01-19 20:57:04 +08:00
Donald Zou
9d1081bd56 Update dashboard.py
- Fixed #581 issue.
2025-01-19 20:54:19 +08:00
Donald Zou
07a04dc507 Update dashboard.py 2025-01-19 13:20:04 +08:00
Donald Zou
cd1329ec67 Update README.md
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
2025-01-13 01:41:25 +08:00
petrsimunek
48a58b2b69 Update cs.json
Added translation for dashboard IP and port settings
2025-01-11 16:23:29 +01:00
Donald Zou
9b64aba8bf Merge pull request #575 from mahdiMGF2/main
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Fixed some syntax error in Peer Jobs
2025-01-09 17:21:22 +08:00
Donald Zou
cae8264d98 Update dashboard.py 2025-01-09 17:13:32 +08:00
Mahdi
95d8985336 Bug fixed
Bug Fixed deletePeerScheduleJob endpoint
2025-01-09 11:38:45 +03:30
4 changed files with 20 additions and 17 deletions

View File

@@ -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] > [!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! > **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> <hr>
<p align="center"> <p align="center">

View File

@@ -27,7 +27,7 @@ import threading
from flask.json.provider import DefaultJSONProvider from flask.json.provider import DefaultJSONProvider
DASHBOARD_VERSION = 'v4.1.3' DASHBOARD_VERSION = 'v4.1.4'
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.') CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
DB_PATH = os.path.join(CONFIGURATION_PATH, 'db') DB_PATH = os.path.join(CONFIGURATION_PATH, 'db')
if not os.path.isdir(DB_PATH): if not os.path.isdir(DB_PATH):
@@ -351,15 +351,13 @@ class PeerJobs:
f"Peer {fp.id} from {c.Name} failed {job.Action}ed." f"Peer {fp.id} from {c.Name} failed {job.Action}ed."
) )
else: 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." f"Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed."
) )
# needToDelete.append(job)
else: 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." f"Somehow can't find this peer {job.Peer} from {job.Configuration} failed {job.Action}ed."
) )
# needToDelete.append(job)
for j in needToDelete: for j in needToDelete:
self.deleteJob(j) self.deleteJob(j)
@@ -796,7 +794,7 @@ class WireguardConfiguration:
for i in listOfPublicKeys: for i in listOfPublicKeys:
p = sqlSelect("SELECT * FROM '%s_restrict_access' WHERE id = ?" % self.Name, (i,)).fetchone() p = sqlSelect("SELECT * FROM '%s_restrict_access' WHERE id = ?" % self.Name, (i,)).fetchone()
if p is not None: 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'],)) % (self.Name, self.Name,), (p['id'],))
sqlUpdate("DELETE FROM '%s_restrict_access' WHERE id = ?" sqlUpdate("DELETE FROM '%s_restrict_access' WHERE id = ?"
% self.Name, (p['id'],)) % self.Name, (p['id'],))
@@ -830,7 +828,7 @@ class WireguardConfiguration:
try: try:
subprocess.check_output(f"wg set {self.Name} peer {pf.id} remove", subprocess.check_output(f"wg set {self.Name} peer {pf.id} remove",
shell=True, stderr=subprocess.STDOUT) 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,)) (self.Name, self.Name,), (pf.id,))
sqlUpdate("UPDATE '%s_restrict_access' SET status = 'stopped' WHERE id = ?" % sqlUpdate("UPDATE '%s_restrict_access' SET status = 'stopped' WHERE id = ?" %
(self.Name,), (pf.id,)) (self.Name,), (pf.id,))
@@ -1647,7 +1645,7 @@ def sqlSelect(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
try: try:
cursor = sqldb.cursor() cursor = sqldb.cursor()
return cursor.execute(statement, paramters) return cursor.execute(statement, paramters)
except Exception as e: except Exception as error:
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement) print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
return [] return []
@@ -1661,7 +1659,7 @@ def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
s = f'BEGIN TRANSACTION;{statement};END TRANSACTION;' s = f'BEGIN TRANSACTION;{statement};END TRANSACTION;'
cursor.execute(statement, paramters) cursor.execute(statement, paramters)
sqldb.commit() sqldb.commit()
except Exception as e: except Exception as error:
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement) print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
return [] return []
@@ -2286,10 +2284,10 @@ def API_getDashboardVersion():
@app.post(f'{APP_PREFIX}/api/savePeerScheduleJob/') @app.post(f'{APP_PREFIX}/api/savePeerScheduleJob/')
def API_savePeerScheduleJob(): def API_savePeerScheduleJob():
data = request.json 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") return ResponseObject(False, "Please specify job")
job: dict = data['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") return ResponseObject(False, "Please specify peer and configuration")
configuration = WireguardConfigurations.get(job['Configuration']) configuration = WireguardConfigurations.get(job['Configuration'])
f, fp = configuration.searchPeer(job['Peer']) f, fp = configuration.searchPeer(job['Peer'])
@@ -2306,10 +2304,10 @@ def API_savePeerScheduleJob():
@app.post(f'{APP_PREFIX}/api/deletePeerScheduleJob/') @app.post(f'{APP_PREFIX}/api/deletePeerScheduleJob/')
def API_deletePeerScheduleJob(): def API_deletePeerScheduleJob():
data = request.json 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") return ResponseObject(False, "Please specify job")
job: dict = data['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") return ResponseObject(False, "Please specify peer and configuration")
configuration = WireguardConfigurations.get(job['Configuration']) configuration = WireguardConfigurations.get(job['Configuration'])
f, fp = configuration.searchPeer(job['Peer']) f, fp = configuration.searchPeer(job['Peer'])
@@ -2619,4 +2617,4 @@ def startThreads():
if __name__ == "__main__": if __name__ == "__main__":
startThreads() startThreads()
app.run(host=app_ip, debug=False, port=app_port) app.run(host=app_ip, debug=False, port=app_port)

View File

@@ -1,6 +1,6 @@
{ {
"name": "app", "name": "app",
"version": "4.1.3", "version": "4.1.4",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {

View File

@@ -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í", "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?", "How many peers you want to add\\?": "Kolik peerů chcete přidat?",
"Adding\\.\\.\\.": "Přidávám...", "Adding\\.\\.\\.": "Přidávám...",
"Dashboard IP Address \\& Listen Port": "" "Dashboard IP Address \\& Listen Port": "Dashboard IP adresa a otevřený port"
} }