mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-04 08:16:17 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3caea1a903 | ||
|
a43478d627 | ||
|
ed2c3f43c7 | ||
|
fcfd816cec | ||
|
2e3977e59c | ||
|
3c68430336 | ||
|
43afb86fa8 | ||
|
194ccbdbb4 | ||
|
7139e230cf | ||
|
120d3b9f54 | ||
|
712460a040 | ||
|
be5594f1c9 | ||
|
0a885117db | ||
|
5b73654544 | ||
|
1485b78b7b | ||
|
bfec57172a | ||
|
9f8559c12d | ||
|
83dde12ca9 | ||
|
d17888db4e | ||
|
096529af96 | ||
|
8a56b22635 | ||
|
dcdd353981 |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,12 +1,11 @@
|
|||||||
.vscode/sftp.json
|
.vscode/sftp.json
|
||||||
src/.vscode/sftp.json
|
src/.vscode/sftp.json
|
||||||
.DS_Store
|
.DS_Store
|
||||||
wg.db
|
|
||||||
*.json
|
|
||||||
.idea
|
.idea
|
||||||
src/test.py
|
src/db
|
||||||
tmp
|
|
||||||
__pycache__
|
__pycache__
|
||||||
|
src/test.py
|
||||||
|
*.db
|
||||||
src/wg-dashboard.ini
|
src/wg-dashboard.ini
|
||||||
src/static/pic.xd
|
src/static/pic.xd
|
||||||
*.conf
|
*.conf
|
||||||
@@ -15,6 +14,5 @@ public_key.txt
|
|||||||
venv/**
|
venv/**
|
||||||
log/**
|
log/**
|
||||||
release/*
|
release/*
|
||||||
*.db
|
|
||||||
src/db/wgdashboard.db
|
src/db/wgdashboard.db
|
||||||
.jshintrc
|
.jshintrc
|
35
README.md
35
README.md
@@ -18,17 +18,18 @@
|
|||||||
|
|
||||||
- 🎉 **New Features**
|
- 🎉 **New Features**
|
||||||
- **Moved from TinyDB to SQLite**: SQLite provide a better performance and loading speed when getting peers! Also avoided crashing the database due to **race condition**.
|
- **Moved from TinyDB to SQLite**: SQLite provide a better performance and loading speed when getting peers! Also avoided crashing the database due to **race condition**.
|
||||||
- **Added Gunicorn WSGI Server**: This could provide more stable on handling HTTP request, and more flexibility in the future (such as HTTPS support). **BIG THANKS to @pgalonza :heart: **
|
- **Added Gunicorn WSGI Server**: This could provide more stable on handling HTTP request, and more flexibility in the future (such as HTTPS support). **BIG THANKS to @pgalonza :heart:**
|
||||||
- **Add Peers by Bulk: ** User can add peers by bulk, just simply set the amount and click add.
|
- **Add Peers by Bulk:** User can add peers by bulk, just simply set the amount and click add.
|
||||||
- **Delete Peers by Bulk**: User can delete peers by bulk, without deleting peers one by one.
|
- **Delete Peers by Bulk**: User can delete peers by bulk, without deleting peers one by one.
|
||||||
- **Download Peers in Zip**: User can download all *downloadable* peers in a zip.
|
- **Download Peers in Zip**: User can download all *downloadable* peers in a zip.
|
||||||
- **Added Pre-shared Key to peers:** Now each peer can add with a pre-shared key to enhance security. Previously added peers can add the pre-shared key through the peer setting button.
|
- **Added Pre-shared Key to peers:** Now each peer can add with a pre-shared key to enhance security. Previously added peers can add the pre-shared key through the peer setting button.
|
||||||
- **Redirect Back to Previous Page:** The dashboard will now redirect you back to your previous page if the current session got timed out and you need to sign in again.
|
- **Redirect Back to Previous Page:** The dashboard will now redirect you back to your previous page if the current session got timed out and you need to sign in again.
|
||||||
|
- **Added Some [🥘 Experimental Functions](#-experimental-functions)**
|
||||||
|
|
||||||
- 🪚 **Bug Fixed**
|
- 🪚 **Bug Fixed**
|
||||||
- [IP Sorting range issues #99](https://github.com/donaldzou/WGDashboard/issues/99) [❤️ @barryboom]
|
- [IP Sorting range issues #99](https://github.com/donaldzou/WGDashboard/issues/99) [❤️ @barryboom]
|
||||||
- [INvalid character written to tunnel json file #108](https://github.com/donaldzou/WGDashboard/issues/108) [❤️ @ ikidd]
|
- [INvalid character written to tunnel json file #108](https://github.com/donaldzou/WGDashboard/issues/108) [❤️ @ikidd]
|
||||||
- [Add IPv6 #91](https://github.com/donaldzou/WGDashboard/pull/91) [❤️ @ pgalonza]
|
- [Add IPv6 #91](https://github.com/donaldzou/WGDashboard/pull/91) [❤️ @pgalonza]
|
||||||
- [Added MTU and PersistentKeepalive to QR code and download files #112](https://github.com/donaldzou/WGDashboard/pull/112) [:heart: @reafian]
|
- [Added MTU and PersistentKeepalive to QR code and download files #112](https://github.com/donaldzou/WGDashboard/pull/112) [:heart: @reafian]
|
||||||
- **And many other bugs provided by our beloved users** :heart:
|
- **And many other bugs provided by our beloved users** :heart:
|
||||||
- **🧐 Other Changes**
|
- **🧐 Other Changes**
|
||||||
@@ -42,6 +43,8 @@
|
|||||||
|
|
||||||
> If you have any other brilliant ideas for this project, please shout it in here [#129](https://github.com/donaldzou/WGDashboard/issues/129) :heart:
|
> If you have any other brilliant ideas for this project, please shout it in here [#129](https://github.com/donaldzou/WGDashboard/issues/129) :heart:
|
||||||
|
|
||||||
|
**For users who is using `v2.x.x` please be sure to read [this](#please-note-for-user-who-is-using-v231-or-below) before updating WGDashboard ;)**
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
## Table of Content
|
## Table of Content
|
||||||
@@ -57,6 +60,7 @@
|
|||||||
- [Dashboard Configuration file](#dashboard-configuration-file)
|
- [Dashboard Configuration file](#dashboard-configuration-file)
|
||||||
- [Generating QR code and peer configuration file (.conf)](#generating-qr-code-and-peer-configuration-file-conf)
|
- [Generating QR code and peer configuration file (.conf)](#generating-qr-code-and-peer-configuration-file-conf)
|
||||||
- [❓ How to update the dashboard?](#-how-to-update-the-dashboard)
|
- [❓ How to update the dashboard?](#-how-to-update-the-dashboard)
|
||||||
|
- [🥘 Experimental Functions](#-experimental-functions)
|
||||||
- [🔍 Screenshot](#-screenshot)
|
- [🔍 Screenshot](#-screenshot)
|
||||||
- [⏰ Changelog](#--changelog)
|
- [⏰ Changelog](#--changelog)
|
||||||
- [🛒 Dependencies](#-dependencies)
|
- [🛒 Dependencies](#-dependencies)
|
||||||
@@ -111,7 +115,7 @@
|
|||||||
1. Download WGDashboard
|
1. Download WGDashboard
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone -b v3.0 https://github.com/donaldzou/WGDashboard.git wgdashboard
|
git clone -b v3.0.1 https://github.com/donaldzou/WGDashboard.git wgdashboard
|
||||||
|
|
||||||
2. Open the WGDashboard folder
|
2. Open the WGDashboard folder
|
||||||
|
|
||||||
@@ -297,7 +301,7 @@ Since version 2.0, WGDashboard will be using a configuration file called `wg-das
|
|||||||
| `app_ip` | IP address the dashboard will run with | `0.0.0.0` | Yes |
|
| `app_ip` | IP address the dashboard will run with | `0.0.0.0` | Yes |
|
||||||
| `app_port` | Port the the dashboard will run with | `10086` | Yes |
|
| `app_port` | Port the the dashboard will run with | `10086` | Yes |
|
||||||
| `auth_req` | Does the dashboard need authentication to access, if `auth_req = false` , user will not be access the **Setting** tab due to security consideration. **User can only edit the file directly in system**. | `true` | **No** |
|
| `auth_req` | Does the dashboard need authentication to access, if `auth_req = false` , user will not be access the **Setting** tab due to security consideration. **User can only edit the file directly in system**. | `true` | **No** |
|
||||||
| `version` | Dashboard Version | `v3.0` | **No** |
|
| `version` | Dashboard Version | `v3.0.1` | **No** |
|
||||||
| `dashboard_refresh_interval` | How frequent the dashboard will refresh on the configuration page | `60000ms` | Yes |
|
| `dashboard_refresh_interval` | How frequent the dashboard will refresh on the configuration page | `60000ms` | Yes |
|
||||||
| `dashboard_sort` | How configuration is sorting | `status` | Yes |
|
| `dashboard_sort` | How configuration is sorting | `status` | Yes |
|
||||||
| | | | |
|
| | | | |
|
||||||
@@ -352,11 +356,27 @@ Endpoint = 0.0.0.0:51820
|
|||||||
|
|
||||||
2. Update the dashboard
|
2. Update the dashboard
|
||||||
```shell
|
```shell
|
||||||
git pull https://github.com/donaldzou/WGDashboard.git v3.0 --force
|
git pull https://github.com/donaldzou/WGDashboard.git v3.0.1 --force
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Install
|
||||||
|
|
||||||
|
```shell
|
||||||
|
./wgd.sh install
|
||||||
```
|
```
|
||||||
|
|
||||||
Starting with `v3.0`, you can simply do `./wgd.sh update` !! (I hope, lol)
|
Starting with `v3.0`, you can simply do `./wgd.sh update` !! (I hope, lol)
|
||||||
|
|
||||||
|
## 🥘 Experimental Functions
|
||||||
|
|
||||||
|
#### Progressive Web App (PWA) for WGDashboard
|
||||||
|
|
||||||
|
- With `v3.0`, I've added a `manifest.json` into the dashboard, so user could add their dashboard as a PWA to their browser or mobile device.
|
||||||
|
|
||||||
|
<img src="img/PWA.gif"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 🔍 Screenshot
|
## 🔍 Screenshot
|
||||||
|
|
||||||

|

|
||||||
@@ -464,7 +484,6 @@ Bug Fixed:
|
|||||||
- [jQuery](https://jquery.com) `v3.5.1`
|
- [jQuery](https://jquery.com) `v3.5.1`
|
||||||
- Python
|
- Python
|
||||||
- [Flask](https://pypi.org/project/Flask/) `v2.0.1`
|
- [Flask](https://pypi.org/project/Flask/) `v2.0.1`
|
||||||
- [TinyDB](https://pypi.org/project/tinydb/) `v4.3.0`
|
|
||||||
- [ifcfg](https://pypi.org/project/ifcfg/) `v0.21`
|
- [ifcfg](https://pypi.org/project/ifcfg/) `v0.21`
|
||||||
- [icmplib](https://pypi.org/project/icmplib/) `v2.1.1`
|
- [icmplib](https://pypi.org/project/icmplib/) `v2.1.1`
|
||||||
- [flask-qrcode](https://pypi.org/project/Flask-QRcode/) `v3.0.0`
|
- [flask-qrcode](https://pypi.org/project/Flask-QRcode/) `v3.0.0`
|
||||||
|
BIN
img/PWA.gif
Normal file
BIN
img/PWA.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 MiB |
@@ -66,9 +66,9 @@ def get_dashboard_conf():
|
|||||||
Get dashboard configuration
|
Get dashboard configuration
|
||||||
@return: configparser.ConfigParser
|
@return: configparser.ConfigParser
|
||||||
"""
|
"""
|
||||||
config = configparser.ConfigParser(strict=False)
|
r_config = configparser.ConfigParser(strict=False)
|
||||||
config.read(DASHBOARD_CONF)
|
r_config.read(DASHBOARD_CONF)
|
||||||
return config
|
return r_config
|
||||||
|
|
||||||
|
|
||||||
def set_dashboard_conf(config):
|
def set_dashboard_conf(config):
|
||||||
@@ -190,7 +190,7 @@ def read_conf_file(config_name):
|
|||||||
conf_peer_data["Peers"].append({})
|
conf_peer_data["Peers"].append({})
|
||||||
elif peer > -1:
|
elif peer > -1:
|
||||||
if len(i) > 0:
|
if len(i) > 0:
|
||||||
tmp = re.split('\s*=\s*', i, 1)
|
tmp = re.split(r'\s*=\s*', i, 1)
|
||||||
if len(tmp) == 2:
|
if len(tmp) == 2:
|
||||||
conf_peer_data["Peers"][peer][tmp[0]] = tmp[1]
|
conf_peer_data["Peers"][peer][tmp[0]] = tmp[1]
|
||||||
|
|
||||||
@@ -901,7 +901,8 @@ def update_app_ip_port():
|
|||||||
config.set("Server", "app_port", request.form['app_port'])
|
config.set("Server", "app_port", request.form['app_port'])
|
||||||
set_dashboard_conf(config)
|
set_dashboard_conf(config)
|
||||||
config.clear()
|
config.clear()
|
||||||
os.system('./wgd.sh restart')
|
subprocess.Popen('bash wgd.sh restart', shell=True)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# Update WireGuard configuration file path
|
# Update WireGuard configuration file path
|
||||||
@@ -918,7 +919,7 @@ def update_wg_conf_path():
|
|||||||
config.clear()
|
config.clear()
|
||||||
session['message'] = "WireGuard Configuration Path Update Successfully!"
|
session['message'] = "WireGuard Configuration Path Update Successfully!"
|
||||||
session['message_status'] = "success"
|
session['message_status'] = "success"
|
||||||
os.system('./wgd.sh restart')
|
subprocess.Popen('bash wgd.sh restart', shell=True)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/update_dashboard_sort', methods=['POST'])
|
@app.route('/update_dashboard_sort', methods=['POST'])
|
||||||
@@ -1704,6 +1705,7 @@ def get_host_bind():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
init_dashboard()
|
||||||
UPDATE = check_update()
|
UPDATE = check_update()
|
||||||
config = configparser.ConfigParser(strict=False)
|
config = configparser.ConfigParser(strict=False)
|
||||||
config.read('wg-dashboard.ini')
|
config.read('wg-dashboard.ini')
|
||||||
|
@@ -1,26 +0,0 @@
|
|||||||
[Interface]
|
|
||||||
Address = 10.200.100.1/24
|
|
||||||
PostUp = iptables -A FORWARD -i wg1 -j ACCEPT; iptables -A FORWARD -o wg1 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE;tc qdisc add dev wg1 root tbf rate 50000kbit buffer 1600 limit 50000
|
|
||||||
PreDown = tc qdisc del dev wg1 root
|
|
||||||
PostDown = iptables -D FORWARD -i wg1 -j ACCEPT; iptables -D FORWARD -o wg1 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE;
|
|
||||||
ListenPort = 60945
|
|
||||||
PrivateKey = 8DsSMli3okgUx5frKbFQ0fMW5ZMyqyxOdOW7+g21L18=
|
|
||||||
|
|
||||||
[Peer]
|
|
||||||
PublicKey = aXsYmR73LEuwVOJeqUjlsWbWPyvJPm3lg3zh7WkruWg=
|
|
||||||
PresharedKey = GISQ6z6GMLocJQgdYOfi2XX7NQWkZBPPFiueRYLqnJE=
|
|
||||||
AllowedIPs = 10.200.100.2/32
|
|
||||||
|
|
||||||
[Peer]
|
|
||||||
PublicKey = FxXXNXoKZcBNyZbq0nFsmBC5YM+7up3a4bYGU6q900w=
|
|
||||||
PresharedKey = dqp44vullLVZQhIYE2VaY6WFQNfahnHum5kq3sWPsSc=
|
|
||||||
AllowedIPs = 10.200.100.3/32
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Peer]
|
|
||||||
PublicKey = FxXXNXoKZcBNyZbq0nFsmBC5YM+7up3a4bYGU6q900w=
|
|
||||||
PresharedKey = dqp44vullLVZQhIYE2VaY6WFQNfahnHum5kq3sWPsSc=
|
|
||||||
AllowedIPs = 10.200.100.3/32
|
|
@@ -338,8 +338,12 @@
|
|||||||
* Load Peers from server to configuration page
|
* Load Peers from server to configuration page
|
||||||
* @param searchString
|
* @param searchString
|
||||||
*/
|
*/
|
||||||
|
let d1 = new Date();
|
||||||
|
let time = 0;
|
||||||
|
let count = 0;
|
||||||
function loadPeers(searchString){
|
function loadPeers(searchString){
|
||||||
startProgressBar();
|
startProgressBar();
|
||||||
|
d1 = new Date();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
url: `/get_config/${conf_name}?search=${encodeURIComponent(searchString)}`,
|
url: `/get_config/${conf_name}?search=${encodeURIComponent(searchString)}`,
|
||||||
@@ -354,6 +358,12 @@
|
|||||||
$(".dot.dot-stopped").attr("title","Peer Disconnected").tooltip();
|
$(".dot.dot-stopped").attr("title","Peer Disconnected").tooltip();
|
||||||
$("i[data-toggle='tooltip']").tooltip();
|
$("i[data-toggle='tooltip']").tooltip();
|
||||||
endProgressBar();
|
endProgressBar();
|
||||||
|
let d2 = new Date();
|
||||||
|
let seconds = (d2 - d1);
|
||||||
|
time += seconds;
|
||||||
|
count += 1;
|
||||||
|
console.log(`Average ${time/count}ms`);
|
||||||
|
$("#peer_loading_time").html(`Peer Loading Time: ${seconds}ms`);
|
||||||
}).fail(function(){
|
}).fail(function(){
|
||||||
noResponding();
|
noResponding();
|
||||||
});
|
});
|
||||||
|
2
src/static/js/configuration.min.js
vendored
2
src/static/js/configuration.min.js
vendored
File diff suppressed because one or more lines are too long
31
src/static/json/manifest.json
Normal file
31
src/static/json/manifest.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"theme_color": "#343a40",
|
||||||
|
"background_color": "#343a40",
|
||||||
|
"display": "fullscreen",
|
||||||
|
"scope": "/",
|
||||||
|
"start_url": "/",
|
||||||
|
"name": "WGDashboard",
|
||||||
|
"short_name": "WGDashboard",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/static/img/icon-192x192.png",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/static/img/icon-256x256.png",
|
||||||
|
"sizes": "256x256",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/static/img/icon-384x384.png",
|
||||||
|
"sizes": "384x384",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/static/img/icon-512x512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@@ -11,7 +11,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% include "navbar.html" %}
|
{% include "navbar.html" %}
|
||||||
|
|
||||||
<div class="container-fluid" id="right_body">
|
<div class="container-fluid" id="right_body">
|
||||||
{% include "sidebar.html" %}
|
{% include "sidebar.html" %}
|
||||||
<div class="col-md-9 ml-sm-auto col-lg-10 px-md-4 mt-4 mb-4">
|
<div class="col-md-9 ml-sm-auto col-lg-10 px-md-4 mt-4 mb-4">
|
||||||
@@ -120,6 +119,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row peer_list"></div>
|
<div class="row peer_list"></div>
|
||||||
|
<small id="peer_loading_time" class="text-muted"></small>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -33,6 +33,7 @@ help () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_check_and_set_venv(){
|
_check_and_set_venv(){
|
||||||
|
# This function will not be using in v3.0
|
||||||
# deb/ubuntu users: might need a 'apt install python3.8-venv'
|
# deb/ubuntu users: might need a 'apt install python3.8-venv'
|
||||||
# set up the local environment
|
# set up the local environment
|
||||||
APP_ROOT=`pwd`
|
APP_ROOT=`pwd`
|
||||||
@@ -62,7 +63,7 @@ install_wgd(){
|
|||||||
printf "| Installing latest Python dependencies |\n"
|
printf "| Installing latest Python dependencies |\n"
|
||||||
python3 -m pip install -U -r requirements.txt > /dev/null 2>&1
|
python3 -m pip install -U -r requirements.txt > /dev/null 2>&1
|
||||||
printf "| WGDashboard installed successfully! |\n"
|
printf "| WGDashboard installed successfully! |\n"
|
||||||
printf "| Enter ./wgd start to start the dashboard |\n"
|
printf "| Enter ./wgd.sh start to start the dashboard |\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,7 +193,7 @@ if [ "$#" != 1 ];
|
|||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
stop_wgd
|
stop_wgd
|
||||||
printf "| WGDashboard is stopped. |\n"
|
printf "| WGDashboard is stopped. |\n"
|
||||||
sleep 2
|
sleep 4
|
||||||
start_wgd
|
start_wgd
|
||||||
else
|
else
|
||||||
start_wgd
|
start_wgd
|
||||||
|
Reference in New Issue
Block a user