Compare commits

...

23 Commits

Author SHA1 Message Date
Donald Zou
af71176296 Merge pull request #133 from donaldzou/v3.0.3-pr
v3.0.3
2022-01-23 19:34:06 -05:00
Donald Cheng Hong Zou
69737177ef Changed version number to v3.0.3 2022-01-23 19:30:43 -05:00
Donald Cheng Hong Zou
efae1222c1 Update dashboard.py 2022-01-23 19:25:12 -05:00
Donald Cheng Hong Zou
3caea1a903 Update README.md 2022-01-23 19:21:43 -05:00
Donald Cheng Hong Zou
a43478d627 Fixed no init_dashboard() for debug mode the first time 2022-01-23 19:19:38 -05:00
Donald Cheng Hong Zou
ed2c3f43c7 Added tracking loading time 2022-01-19 10:43:39 -05:00
Donald Cheng Hong Zou
fcfd816cec Remove pylint 2022-01-19 09:25:27 -05:00
Donald Cheng Hong Zou
2e3977e59c commit 2022-01-19 09:18:03 -05:00
Donald Cheng Hong Zou
3c68430336 Update pylint.yml 2022-01-19 09:12:57 -05:00
Donald Cheng Hong Zou
43afb86fa8 Update pylint.yml 2022-01-19 09:10:59 -05:00
Donald Cheng Hong Zou
194ccbdbb4 Update pylint.yml 2022-01-19 09:10:07 -05:00
Donald Cheng Hong Zou
7139e230cf Commit 2022-01-19 09:08:27 -05:00
Donald Zou
120d3b9f54 Update pylint.yml 2022-01-19 09:05:39 -05:00
Donald Zou
712460a040 Update pylint.yml 2022-01-19 09:03:35 -05:00
Donald Zou
be5594f1c9 Create pylint.yml 2022-01-19 09:01:35 -05:00
Donald Cheng Hong Zou
0a885117db Update README.md 2022-01-18 13:04:00 -05:00
Donald Zou
5b73654544 Update README.md 2022-01-18 12:43:37 -05:00
Donald Cheng Hong Zou
1485b78b7b Merge branch 'main' of https://github.com/donaldzou/WGDashboard 2022-01-18 12:43:20 -05:00
Donald Cheng Hong Zou
bfec57172a Update README.md 2022-01-18 12:43:11 -05:00
Donald Zou
9f8559c12d Update README.md 2022-01-18 12:34:40 -05:00
Donald Zou
83dde12ca9 Merge pull request #126 from donaldzou/Migrate-to-SQLite
Production branch for v3.0
2022-01-18 12:33:34 -05:00
Donald Cheng Hong Zou
d17888db4e Update README.md 2022-01-18 12:33:21 -05:00
Donald Cheng Hong Zou
096529af96 Experimental Functions 2022-01-18 12:16:10 -05:00
7 changed files with 54 additions and 21 deletions

View File

@@ -18,17 +18,18 @@
- 🎉 **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**.
- **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.
- **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.
- **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.
- **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.
- **Added Some [🥘 Experimental Functions](#-experimental-functions)**
- 🪚 **Bug Fixed**
- [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]
- [Add IPv6 #91](https://github.com/donaldzou/WGDashboard/pull/91) [❤️ @ pgalonza]
- [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]
- [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:
- **🧐 Other Changes**
@@ -40,7 +41,9 @@
*And many other small changes for performance and bug fixes! :laughing:*
> 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>
@@ -57,6 +60,7 @@
- [Dashboard Configuration file](#dashboard-configuration-file)
- [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)
- [🥘 Experimental Functions](#-experimental-functions)
- [🔍 Screenshot](#-screenshot)
- [⏰ Changelog](#--changelog)
- [🛒 Dependencies](#-dependencies)
@@ -111,7 +115,7 @@
1. Download WGDashboard
```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
@@ -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_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** |
| `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_sort` | How configuration is sorting | `status` | Yes |
| | | | |
@@ -345,18 +349,34 @@ Endpoint = 0.0.0.0:51820
<hr>
1. Change your directory to `wgdashboard`
```shell
cd wgdashboard
```
2. Update the dashboard
```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)
## 🥘 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
![Sign In Page](img/SignIn.png)

BIN
img/PWA.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 MiB

View File

@@ -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
# Dashboard Version
DASHBOARD_VERSION = 'v3.0'
DASHBOARD_VERSION = 'v3.0.3'
# WireGuard's configuration path
WG_CONF_PATH = None
# Dashboard Config Name
@@ -66,9 +66,9 @@ def get_dashboard_conf():
Get dashboard configuration
@return: configparser.ConfigParser
"""
config = configparser.ConfigParser(strict=False)
config.read(DASHBOARD_CONF)
return config
r_config = configparser.ConfigParser(strict=False)
r_config.read(DASHBOARD_CONF)
return r_config
def set_dashboard_conf(config):
@@ -190,7 +190,7 @@ def read_conf_file(config_name):
conf_peer_data["Peers"].append({})
elif peer > -1:
if len(i) > 0:
tmp = re.split('\s*=\s*', i, 1)
tmp = re.split(r'\s*=\s*', i, 1)
if len(tmp) == 2:
conf_peer_data["Peers"][peer][tmp[0]] = tmp[1]
@@ -224,10 +224,10 @@ def get_latest_handshake(config_name):
status = "stopped"
if int(data_usage[count + 1]) > 0:
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:
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
@@ -901,7 +901,8 @@ def update_app_ip_port():
config.set("Server", "app_port", request.form['app_port'])
set_dashboard_conf(config)
config.clear()
os.system('./wgd.sh restart')
subprocess.Popen('bash wgd.sh restart', shell=True)
return ""
# Update WireGuard configuration file path
@@ -918,7 +919,7 @@ def update_wg_conf_path():
config.clear()
session['message'] = "WireGuard Configuration Path Update Successfully!"
session['message_status'] = "success"
os.system('./wgd.sh restart')
subprocess.Popen('bash wgd.sh restart', shell=True)
@app.route('/update_dashboard_sort', methods=['POST'])
@@ -1704,6 +1705,7 @@ def get_host_bind():
if __name__ == "__main__":
init_dashboard()
UPDATE = check_update()
config = configparser.ConfigParser(strict=False)
config.read('wg-dashboard.ini')

View File

@@ -338,8 +338,12 @@
* Load Peers from server to configuration page
* @param searchString
*/
let d1 = new Date();
let time = 0;
let count = 0;
function loadPeers(searchString){
startProgressBar();
d1 = new Date();
$.ajax({
method: "GET",
url: `/get_config/${conf_name}?search=${encodeURIComponent(searchString)}`,
@@ -354,6 +358,12 @@
$(".dot.dot-stopped").attr("title","Peer Disconnected").tooltip();
$("i[data-toggle='tooltip']").tooltip();
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(){
noResponding();
});

File diff suppressed because one or more lines are too long

View File

@@ -11,7 +11,6 @@
</div>
</div>
{% include "navbar.html" %}
<div class="container-fluid" id="right_body">
{% include "sidebar.html" %}
<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 class="row peer_list"></div>
<small id="peer_loading_time" class="text-muted"></small>
</main>
</div>
</div>

View File

@@ -33,6 +33,7 @@ help () {
}
_check_and_set_venv(){
# This function will not be using in v3.0
# deb/ubuntu users: might need a 'apt install python3.8-venv'
# set up the local environment
APP_ROOT=`pwd`
@@ -192,7 +193,7 @@ if [ "$#" != 1 ];
printf "%s\n" "$dashes"
stop_wgd
printf "| WGDashboard is stopped. |\n"
sleep 2
sleep 4
start_wgd
else
start_wgd