mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-04 00:06:18 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
99fb07c6b3 | ||
|
eaad971c0a | ||
|
377abd87fd | ||
|
af71176296 | ||
|
69737177ef | ||
|
efae1222c1 | ||
|
3caea1a903 | ||
|
a43478d627 | ||
|
ed2c3f43c7 | ||
|
fcfd816cec | ||
|
2e3977e59c | ||
|
3c68430336 | ||
|
43afb86fa8 | ||
|
194ccbdbb4 | ||
|
7139e230cf | ||
|
120d3b9f54 | ||
|
712460a040 | ||
|
be5594f1c9 | ||
|
0a885117db | ||
|
5b73654544 | ||
|
1485b78b7b | ||
|
bfec57172a |
43
README.md
43
README.md
@@ -19,7 +19,7 @@
|
|||||||
- 🎉 **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.
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
- 🪚 **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**
|
||||||
@@ -115,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.3 https://github.com/donaldzou/WGDashboard.git wgdashboard
|
||||||
|
|
||||||
2. Open the WGDashboard folder
|
2. Open the WGDashboard folder
|
||||||
|
|
||||||
@@ -301,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.3` | **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 |
|
||||||
| | | | |
|
| | | | |
|
||||||
@@ -348,17 +348,44 @@ Endpoint = 0.0.0.0:51820
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
#### Update Method 1 (For `v3.0` or above)
|
||||||
|
|
||||||
|
1. Change your directory to `wgdashboard/src`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd wgdashboard/src
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Update the dashboard with the following
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./wgd.sh update
|
||||||
|
```
|
||||||
|
|
||||||
|
> If this doesn't work, please use the method below. Sorry about that :(
|
||||||
|
|
||||||
|
#### Update Method 2
|
||||||
|
|
||||||
|
|
||||||
1. Change your directory to `wgdashboard`
|
1. Change your directory to `wgdashboard`
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
cd wgdashboard
|
cd wgdashboard/src
|
||||||
```
|
```
|
||||||
|
|
||||||
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.3 --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
|
## 🥘 Experimental Functions
|
||||||
|
@@ -31,7 +31,7 @@ from util import regex_match, check_DNS, check_Allowed_IPs, check_remote_endpoin
|
|||||||
check_IP_with_range, clean_IP_with_range
|
check_IP_with_range, clean_IP_with_range
|
||||||
|
|
||||||
# Dashboard Version
|
# Dashboard Version
|
||||||
DASHBOARD_VERSION = 'v3.0'
|
DASHBOARD_VERSION = 'v3.0.3'
|
||||||
# WireGuard's configuration path
|
# WireGuard's configuration path
|
||||||
WG_CONF_PATH = None
|
WG_CONF_PATH = None
|
||||||
# Dashboard Config Name
|
# Dashboard Config Name
|
||||||
@@ -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]
|
||||||
|
|
||||||
@@ -224,10 +224,10 @@ def get_latest_handshake(config_name):
|
|||||||
status = "stopped"
|
status = "stopped"
|
||||||
if int(data_usage[count + 1]) > 0:
|
if int(data_usage[count + 1]) > 0:
|
||||||
g.cur.execute("UPDATE %s SET latest_handshake = '%s', status = '%s' WHERE id='%s'"
|
g.cur.execute("UPDATE %s SET latest_handshake = '%s', status = '%s' WHERE id='%s'"
|
||||||
% (config_name, str(minus).split(".", maxsplit=1)[0], status, data_usage[count]))
|
% (config_name, str(minus).split(".", maxsplit=1)[0], status, data_usage[count]))
|
||||||
else:
|
else:
|
||||||
g.cur.execute("UPDATE %s SET latest_handshake = '(None)', status = '%s' WHERE id='%s'"
|
g.cur.execute("UPDATE %s SET latest_handshake = '(None)', status = '%s' WHERE id='%s'"
|
||||||
% (config_name, status, data_usage[count]))
|
% (config_name, status, data_usage[count]))
|
||||||
count += 2
|
count += 2
|
||||||
|
|
||||||
|
|
||||||
@@ -1705,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')
|
||||||
|
@@ -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
@@ -171,6 +171,17 @@
|
|||||||
return String.fromCharCode.apply(null, base64);
|
return String.fromCharCode.apply(null, base64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function base64ToKey(base64) {
|
||||||
|
let binary_string = window.atob(base64);
|
||||||
|
let len = binary_string.length;
|
||||||
|
let bytes = new Uint8Array(len);
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
bytes[i] = binary_string.charCodeAt(i);
|
||||||
|
}
|
||||||
|
let uint8 = new Uint8Array(bytes.buffer);
|
||||||
|
return uint8;
|
||||||
|
}
|
||||||
|
|
||||||
function putU32(b, n)
|
function putU32(b, n)
|
||||||
{
|
{
|
||||||
b.push(n & 0xff, (n >>> 8) & 0xff, (n >>> 16) & 0xff, (n >>> 24) & 0xff);
|
b.push(n & 0xff, (n >>> 8) & 0xff, (n >>> 16) & 0xff, (n >>> 24) & 0xff);
|
||||||
@@ -282,7 +293,8 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
generatePublicKey: function (privateKey){
|
generatePublicKey: function (privateKey){
|
||||||
return keyToBase64(generatePublicKey(privateKey))
|
privateKey = base64ToKey(privateKey);
|
||||||
|
return keyToBase64(generatePublicKey(privateKey));
|
||||||
},
|
},
|
||||||
|
|
||||||
generateZipFiles: function(res){
|
generateZipFiles: function(res){
|
||||||
|
2
src/static/js/wireguard.min.js
vendored
2
src/static/js/wireguard.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -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>
|
||||||
|
@@ -37,18 +37,20 @@
|
|||||||
{% include "footer.html" %}
|
{% include "footer.html" %}
|
||||||
<script>
|
<script>
|
||||||
$("button").on("click", function(e){
|
$("button").on("click", function(e){
|
||||||
let req = $("input[required]");
|
e.preventDefault();
|
||||||
|
let $password = $("#password");
|
||||||
|
let $username = $("#username");
|
||||||
|
let req = [$password, $username];
|
||||||
let check = true
|
let check = true
|
||||||
for (let i = 0; i < req.length; i++){
|
for (let i = 0; i < req.length; i++){
|
||||||
if ($(req[i]).val().length === 0){
|
if ($(req[i]).val().length === 0){
|
||||||
$("button").html("Sign In");
|
$("button").html("Sign In");
|
||||||
check = false;
|
check = false;
|
||||||
$("input[required]").addClass("is-invalid");
|
$(req[i]).addClass("is-invalid");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (check){
|
if (check){
|
||||||
e.preventDefault();
|
|
||||||
$(this).html("Signing In...").attr("disabled", "disabled");
|
$(this).html("Signing In...").attr("disabled", "disabled");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/auth",
|
url: "/auth",
|
||||||
|
@@ -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`
|
||||||
|
Reference in New Issue
Block a user