mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-04 15:00:23 +01:00
Update
This commit is contained in:
parent
fe7b9730d3
commit
0fa4759c3a
72
README.md
72
README.md
@ -16,20 +16,40 @@
|
||||
|
||||
## 📣 What's New: Version 2.0
|
||||
|
||||
### ⚠️ **Update from v1.x.x**
|
||||
|
||||
1. Stop the dashboard if it is running.
|
||||
2. You can use `git pull https://github.com/donaldzou/Wireguard-Dashboard.git v2.0` to get the new update inside `Wireguard-Dashboard` directory.
|
||||
3. Proceed **Step 2 & 3** in the Install step down below.
|
||||
|
||||
<hr>
|
||||
|
||||
- Added login function to dashboard
|
||||
|
||||
- ***I'm not using the most ideal way to store the username and password, feel free to provide a better way to do this if you any good idea!***
|
||||
|
||||
- Added a config file to the dashboard
|
||||
|
||||
- Dashboard config can be change within the **Setting** tab on the side bar
|
||||
|
||||
- Adjusted UI
|
||||
|
||||
- And much more!
|
||||
|
||||
|
||||
|
||||
## 💡 Features
|
||||
|
||||
- Add peers for each WireGuard configuration
|
||||
|
||||
- Manage peer
|
||||
|
||||
- Delete peers
|
||||
|
||||
- And many more coming up! Welcome to contribute to this project!
|
||||
|
||||
|
||||
|
||||
## 📝 Requirement
|
||||
|
||||
- Ubuntu or Debian based OS, other might work, but haven't test yet. Tested on the following OS:
|
||||
@ -45,12 +65,14 @@
|
||||
$ sudo apt-get install python3 python3-pip
|
||||
```
|
||||
|
||||
|
||||
|
||||
## 🛠 Install
|
||||
|
||||
1. Download Wireguard Dashboard
|
||||
|
||||
```
|
||||
$ git clone https://github.com/donaldzou/Wireguard-Dashboard.git
|
||||
$ git clone -b v2.0 https://github.com/donaldzou/Wireguard-Dashboard.git
|
||||
```
|
||||
|
||||
**2. Install Python Dependencies**
|
||||
@ -68,6 +90,8 @@ $ sudo sh wgd.sh start
|
||||
|
||||
Access your server with port `10086` ! e.g (http://your_server_ip:10086), continue to read to on how to change port and ip that dashboard is running with.
|
||||
|
||||
|
||||
|
||||
## 🪜 Usage
|
||||
|
||||
**1. Start/Stop/Restart Wireguard Dashboard**
|
||||
@ -81,39 +105,37 @@ $ sudo sh wgd.sh restart # Restart the dasboard
|
||||
$ sudo sh wgd.sh update # Update the dashboard
|
||||
```
|
||||
|
||||
⚠️ **For first time user please also read the next section.**
|
||||
⚠️ **For first time user please also read the next section.**
|
||||
|
||||
|
||||
|
||||
## ✂️ Dashboard Configuration
|
||||
|
||||
Since version 2.0, Wireguard Dashboard will be using a configuration file called `wg-dashboard.ini`, (It will generate automatically after first time running the dashboard). More options will include in future versions, and for now it included the following config:
|
||||
|
||||
- `[Account]`
|
||||
- `username` - Username (Default: `admin`)
|
||||
- `password` - Password, will be hash with SHA256 (Default: `admin`).
|
||||
- `[Server]`
|
||||
- `app_ip` - IP address the flask will run with (Default: `0.0.0.0`)
|
||||
- `app_port` - Port the flask will run with (Default: `10086`)
|
||||
- `auth_req` - Does the dashboard need authentication (Default: `true`)
|
||||
- If `auth_req = false` , user will not be access the **Setting** tab due to security consideration. **Can only changing the file directly in system**.
|
||||
- `version` - Dashboard Version
|
||||
### `[Account]`
|
||||
|
||||
All these settings***** will be able to configure within the dashboard in **Settings** on the sidebar, without changing the actual file.
|
||||
`username` - Username (Default: `admin`)
|
||||
|
||||
- Example
|
||||
`password` - Password, will be hash with SHA256 (Default: `admin`).
|
||||
|
||||
```
|
||||
[Account]
|
||||
username = admin
|
||||
password = 8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
|
||||
### `[Server]`
|
||||
|
||||
`wg_conf_path` - The path of all the Wireguard configurations (Default: `/etc/wireguard`)
|
||||
|
||||
`app_ip` - IP address the flask will run with (Default: `0.0.0.0`)
|
||||
|
||||
`app_port` - Port the flask will run with (Default: `10086`)
|
||||
|
||||
`auth_req` - Does the dashboard need authentication (Default: `true`)
|
||||
|
||||
- If `auth_req = false` , user will not be access the **Setting** tab due to security consideration. **User can only change the file directly in system**.
|
||||
|
||||
`version` - Dashboard Version
|
||||
|
||||
All these settings will be able to configure within the dashboard in **Settings** on the sidebar, without changing the actual file. **Except `version` and `auth_req` due to security consideration.**
|
||||
|
||||
[Server]
|
||||
app_ip = 0.0.0.0
|
||||
app_port = 10086
|
||||
auth_req = true
|
||||
version = v2.0
|
||||
```
|
||||
|
||||
**: Except `version` and `auth_req` due to security consideration.*
|
||||
|
||||
## ❓ How to update the dashboard?
|
||||
|
||||
@ -125,7 +147,7 @@ $ sudo sh wgd.sh start # Start dashboard
|
||||
|
||||
|
||||
|
||||
## 🔍 Example
|
||||
## 🔍 Screenshot
|
||||
|
||||
![Index Image](https://github.com/donaldzou/Wireguard-Dashboard/raw/main/src/static/index.png)
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
dashboard_version = 'v2.0'
|
||||
|
||||
|
||||
# Python Built-in Library
|
||||
import os
|
||||
from flask import Flask, request, render_template, redirect, url_for, session, abort
|
||||
@ -11,10 +14,8 @@ import configparser
|
||||
# PIP installed library
|
||||
import ifcfg
|
||||
from tinydb import TinyDB, Query
|
||||
dashboard_version = 'v2.0'
|
||||
dashboard_conf = 'wg-dashboard.ini'
|
||||
update = ""
|
||||
|
||||
app = Flask("Wireguard Dashboard")
|
||||
app.secret_key = secrets.token_urlsafe(16)
|
||||
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||
@ -254,8 +255,8 @@ def auth_req():
|
||||
request.endpoint != "signout" and \
|
||||
request.endpoint != "auth" and \
|
||||
"username" not in session:
|
||||
print(request.path)
|
||||
print("not loggedin")
|
||||
session['message'] = "You need to sign in first!"
|
||||
return redirect(url_for("signin"))
|
||||
else:
|
||||
if request.endpoint in ['signin', 'signout', 'auth', 'settings', 'update_acct', 'update_pwd', 'update_app_ip_port', 'update_wg_conf_path']:
|
||||
|
@ -8,7 +8,7 @@
|
||||
<li class="nav-item"><a class="nav-link sb-settings-url" href="/settings">Settings</a></li>
|
||||
{% endif %}
|
||||
{% if session['update'] == "true" %}
|
||||
<li class="nav-item sb-update-li"><a class="nav-link sb-update-url" href="/">New Update Available!<span class="dot dot-running"></span></a></li>
|
||||
<li class="nav-item sb-update-li"><a class="nav-link sb-update-url" href="https://github.com/donaldzou/wireguard-dashboard/#-how-to-update-the-dashboard">New Update Available!<span class="dot dot-running"></span></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<hr>
|
||||
|
36
src/wgd.sh
36
src/wgd.sh
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
app_name="dashboard.py"
|
||||
|
||||
dashes='------------------------------------------------------------'
|
||||
help () {
|
||||
printf "<Wireguard Dashboard> by Donald Zou - https://github.com/donaldzou \n"
|
||||
printf "Usage: sh wg-dashboard.sh <option>"
|
||||
@ -44,14 +44,34 @@ start_wgd_debug() {
|
||||
}
|
||||
|
||||
update_wgd() {
|
||||
git pull
|
||||
if check_wgd_status; then
|
||||
stop_wgd
|
||||
sleep 2
|
||||
printf "Wireguard Dashboard is stopped. \n"
|
||||
start_wgd_debug
|
||||
|
||||
new_ver=$(python3 -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/wireguard-dashboard/releases').read(); output = json.loads(data);print(output[0]['tag_name'])")
|
||||
printf "%s\n" "$dashes"
|
||||
printf "Are you sure you want to update to the %s? (Y/N): " "$new_ver"
|
||||
read up
|
||||
if [ "$up" = "Y" ]; then
|
||||
printf "%s\n" "$dashes"
|
||||
printf "| Shutting down Wireguard Dashboard... |\n"
|
||||
printf "%s\n" "$dashes"
|
||||
printf "| Downloading %s from GitHub... |\n" "$new_ver"
|
||||
printf "%s\n" "$dashes"
|
||||
git pull https://github.com/donaldzou/wireguard-dashboard.git $new_ver > /dev/null 2>&1
|
||||
printf "| Update Successfully! |\n"
|
||||
printf "%s\n" "$dashes"
|
||||
printf "| Now you can start the dashboard with >> sh wgd.sh start |\n"
|
||||
printf "%s\n" "$dashes"
|
||||
# if check_wgd_status; then
|
||||
# stop_wgd
|
||||
# sleep 2
|
||||
# printf "Wireguard Dashboard is stopped. \n"
|
||||
# start_wgd_debug
|
||||
# else
|
||||
# start_wgd_debug
|
||||
# fi
|
||||
else
|
||||
start_wgd_debug
|
||||
printf "%s\n" "$dashes"
|
||||
printf "Cancel update. \n"
|
||||
printf "%s\n" "$dashes"
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user