mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 07:50:13 +01:00
A new update to the dev branch
This commit is contained in:
parent
e06cc1bd2d
commit
f07508073f
557
src/WGDashboard_donald.zou.egg-info/PKG-INFO
Normal file
557
src/WGDashboard_donald.zou.egg-info/PKG-INFO
Normal file
@ -0,0 +1,557 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: WGDashboard-donald.zou
|
||||
Version: 3.1
|
||||
Summary: Simplest dashboard for WireGuard VPN written in Python w/ Flask
|
||||
Home-page: https://github.com/donaldzou/WGDashboard
|
||||
Author: Donald Cheng Hong Zou
|
||||
Author-email: donaldzou@live.hk
|
||||
License: UNKNOWN
|
||||
Project-URL: Bug Tracker, https://github.com/donaldzou/WGDashboard/issues
|
||||
Platform: UNKNOWN
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: License :: OSI Approved :: Apache License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=3.7
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
|
||||
<p align="center">
|
||||
<img alt="WGDashboard" src="img/logo.png" width="128">
|
||||
</p>
|
||||
<h1 align="center">WGDashboard</h1>
|
||||
|
||||
|
||||
<p align="center">
|
||||
<img src="http://ForTheBadge.com/images/badges/made-with-python.svg">
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/donaldzou/wireguard-dashboard/releases/latest"><img src="https://img.shields.io/github/v/release/donaldzou/wireguard-dashboard"></a>
|
||||
<a href="https://wakatime.com/badge/user/45f53c7c-9da9-4cb0-85d6-17bd38cc748b/project/5334ae20-e9a6-4c55-9fea-52d4eb9dfba6"><img src="https://wakatime.com/badge/user/45f53c7c-9da9-4cb0-85d6-17bd38cc748b/project/5334ae20-e9a6-4c55-9fea-52d4eb9dfba6.svg" alt="wakatime"></a>
|
||||
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fdonaldzou%2FWGDashboard&count_bg=%2379C83D&title_bg=%23555555&icon=github.svg&icon_color=%23E7E7E7&title=Visitor&edge_flat=false"/></a>
|
||||
</p>
|
||||
<p align="center">Monitoring WireGuard is not convinient, need to login into server and type <code>wg show</code>. That's why this platform is being created, to view all configurations and manage them in a easier way.</p>
|
||||
<p align="center"><small>Note: This project is not affiliate to the official WireGuard Project ;)</small></p>
|
||||
|
||||
## 📣 What's New: v3.0
|
||||
|
||||
- 🎉 **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.
|
||||
- **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]
|
||||
- [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**
|
||||
- **Key generating moved to front-end**: No longer need to use the server's WireGuard to generate keys, thanks to the `wireguard.js` from the [official repository](https://git.zx2c4.com/wireguard-tools/tree/contrib/keygen-html/wireguard.js)!
|
||||
- **Peer transfer calculation**: each peer will now show all transfer amount (previously was only showing transfer amount from the last configuration start-up).
|
||||
- **UI adjustment on running peers**: peers will have a new style indicating that it is running.
|
||||
- **`wgd.sh` finally can update itself**: So now user could update the whole dashboard from `wgd.sh`, with the `update` command.
|
||||
- **Minified JS and CSS files**: Although only a small changes on the file size, but I think is still a good practice to save a bit of bandwidth ;)
|
||||
|
||||
*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:
|
||||
|
||||
**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>
|
||||
|
||||
## Table of Content
|
||||
|
||||
|
||||
- [💡 Features](#-features)
|
||||
- [📝 Requirement](#-requirement)
|
||||
- [🛠 Install](#-install)
|
||||
- [🪜 Usage](#-usage)
|
||||
- [Start/Stop/Restart WGDashboard](#startstoprestart-wgdashboard)
|
||||
- [Autostart WGDashboard on boot](#autostart-wgdashboard-on-boot--v22)
|
||||
- [✂️ Dashboard Configuration](#%EF%B8%8F-dashboard-configuration)
|
||||
- [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)
|
||||
- [✨ Contributors](#-contributors)
|
||||
|
||||
## 💡 Features
|
||||
|
||||
- **No need to re-configure existing WireGuard configuration! It can search for existed configuration files.**
|
||||
- Easy to use interface, provided username and password protection to the dashboard
|
||||
- Add peers and edit (Allowed IPs, DNS, Private Key...)
|
||||
- View peers and configuration real time details (Data Usage, Latest Handshakes...)
|
||||
- Share your peer configuration with QR code or file download
|
||||
- Testing tool: Ping and Traceroute to your peer's ip
|
||||
- **And more functions are coming up!**
|
||||
|
||||
|
||||
## 📝 Requirement
|
||||
|
||||
- Recommend the following OS, tested by our beloved users:
|
||||
- [x] Ubuntu 18.04.1 LTS - 20.04.1 LTS [@Me]
|
||||
- [x] Debian GNU/Linux 10 (buster) [❤️ @[robchez](https://github.com/robchez)]
|
||||
- [x] AlmaLinux 8.4 (Electric Cheetah) [❤️ @[barry-smithjr](https://github.com/)]
|
||||
- [x] CentOS 7 [❤️ @[PrzemekSkw](https://github.com/PrzemekSkw)]
|
||||
|
||||
> **If you have tested on other OS and it works perfectly please provide it to me in [#31](https://github.com/donaldzou/wireguard-dashboard/issues/31). Thank you!**
|
||||
|
||||
- **WireGuard** and **WireGuard-Tools (`wg-quick`)** are installed.
|
||||
|
||||
> Don't know how? Check this <a href="https://www.wireguard.com/install/">official documentation</a>
|
||||
|
||||
- Configuration files under **`/etc/wireguard`**, but please note the following sample
|
||||
|
||||
```ini
|
||||
[Interface]
|
||||
...
|
||||
SaveConfig = true
|
||||
# Need to include this line to allow WireGuard Tool to save your configuration,
|
||||
# or if you just want it to monitor your WireGuard Interface and don't need to
|
||||
# make any changes with the dashboard, you can set it to false.
|
||||
|
||||
[Peer]
|
||||
PublicKey = abcd1234
|
||||
AllowedIPs = 1.2.3.4/32
|
||||
# Must have for each peer
|
||||
```
|
||||
|
||||
- Python 3.7+ & Pip3
|
||||
|
||||
- Browser support CSS3 and ES6
|
||||
|
||||
## 🛠 Install
|
||||
1. Download WGDashboard
|
||||
|
||||
```shell
|
||||
git clone -b v3.0.5 https://github.com/donaldzou/WGDashboard.git wgdashboard
|
||||
|
||||
2. Open the WGDashboard folder
|
||||
|
||||
```shell
|
||||
cd wgdashboard/src
|
||||
```
|
||||
|
||||
3. Install WGDashboard
|
||||
|
||||
```shell
|
||||
sudo chmod u+x wgd.sh
|
||||
sudo ./wgd.sh install
|
||||
```
|
||||
|
||||
4. Give read and execute permission to root of the WireGuard configuration folder, you can change the path if your configuration files are not stored in `/etc/wireguard`
|
||||
|
||||
```shell
|
||||
sudo chmod -R 755 /etc/wireguard
|
||||
```
|
||||
|
||||
5. Run WGDashboard
|
||||
|
||||
```shell
|
||||
./wgd.sh start
|
||||
```
|
||||
|
||||
**Note**:
|
||||
|
||||
> For [`pivpn`](https://github.com/pivpn/pivpn) user, please use `sudo ./wgd.sh start` to run if your current account does not have the permission to run `wg show` and `wg-quick`.
|
||||
|
||||
6. Access dashboard
|
||||
|
||||
Access your server with port `10086` (e.g. http://your_server_ip:10086), using username `admin` and password `admin`. See below how to change port and ip that the dashboard is running with.
|
||||
|
||||
## 🪜 Usage
|
||||
|
||||
#### Start/Stop/Restart WGDashboard
|
||||
|
||||
|
||||
```shell
|
||||
cd wgdashboard/src
|
||||
-----------------------------
|
||||
./wgd.sh start # Start the dashboard in background
|
||||
-----------------------------
|
||||
./wgd.sh debug # Start the dashboard in foreground (debug mode)
|
||||
-----------------------------
|
||||
./wgd.sh stop # Stop the dashboard
|
||||
-----------------------------
|
||||
./wgd.sh restart # Restart the dasboard
|
||||
```
|
||||
|
||||
#### Autostart WGDashboard on boot (>= v2.2)
|
||||
|
||||
In the `src` folder, it contained a file called `wg-dashboard.service`, we can use this file to let our system to autostart the dashboard after reboot. The following guide has tested on **Ubuntu**, most **Debian** based OS might be the same, but some might not. Please don't hesitate to provide your system if you have tested the autostart on another system.
|
||||
|
||||
1. Changing the directory to the dashboard's directory
|
||||
|
||||
```shell
|
||||
cd wgdashboard/src
|
||||
```
|
||||
|
||||
2. Get the full path of the dashboard's directory
|
||||
|
||||
```shell
|
||||
pwd
|
||||
#Output: /root/wgdashboard/src
|
||||
```
|
||||
|
||||
For this example, the output is `/root/wireguard-dashboard/src`, your path might be different since it depends on where you downloaded the dashboard in the first place. **Copy the the output to somewhere, we will need this in the next step.**
|
||||
|
||||
3. Edit the service file, the service file is located in `wireguard-dashboard/src`, you can use other editor you like, here will be using `nano`
|
||||
|
||||
```shell
|
||||
nano wg-dashboard.service
|
||||
```
|
||||
|
||||
You will see something like this:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
After=network.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=<your dashboard directory full path here>
|
||||
ExecStart=/usr/bin/python3 <your dashboard directory full path here>/dashboard.py
|
||||
Restart=always
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
Now, we need to replace both `<your dashboard directory full path here>` to the one you just copied from step 2. After doing this, the file will become something like this, your file might be different:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
After=netword.service
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/root/wgdashboard/src
|
||||
ExecStart=/usr/bin/python3 /root/wgdashboard/src/dashboard.py
|
||||
Restart=always
|
||||
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
```
|
||||
|
||||
**Be aware that after the value of `WorkingDirectory`, it does not have a `/` (slash).** And then save the file after you edited it
|
||||
|
||||
4. Copy the service file to systemd folder
|
||||
|
||||
```bash
|
||||
$ cp wg-dashboard.service /etc/systemd/system/wg-dashboard.service
|
||||
```
|
||||
|
||||
To make sure you copy the file successfully, you can use this command `cat /etc/systemd/system/wg-dashboard.service` to see if it will output the file you just edited.
|
||||
|
||||
5. Enable the service
|
||||
|
||||
```bash
|
||||
$ sudo chmod 664 /etc/systemd/system/wg-dashboard.service
|
||||
$ sudo systemctl daemon-reload
|
||||
$ sudo systemctl enable wg-dashboard.service
|
||||
$ sudo systemctl start wg-dashboard.service # <-- To start the service
|
||||
```
|
||||
|
||||
6. Check if the service run correctly
|
||||
|
||||
```bash
|
||||
$ sudo systemctl status wg-dashboard.service
|
||||
```
|
||||
|
||||
And you should see something like this
|
||||
|
||||
```shell
|
||||
● wg-dashboard.service
|
||||
Loaded: loaded (/etc/systemd/system/wg-dashboard.service; enabled; vendor preset: enabled)
|
||||
Active: active (running) since Tue 2021-08-03 22:31:26 UTC; 4s ago
|
||||
Main PID: 6602 (python3)
|
||||
Tasks: 1 (limit: 453)
|
||||
Memory: 26.1M
|
||||
CGroup: /system.slice/wg-dashboard.service
|
||||
└─6602 /usr/bin/python3 /root/wgdashboard/src/dashboard.py
|
||||
|
||||
Aug 03 22:31:26 ubuntu-wg systemd[1]: Started wg-dashboard.service.
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Serving Flask app "WGDashboard" (lazy loading)
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Environment: production
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: WARNING: This is a development server. Do not use it in a production deployment.
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: Use a production WSGI server instead.
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Debug mode: off
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Running on all addresses.
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: WARNING: This is a development server. Do not use it in a production deployment.
|
||||
Aug 03 22:31:27 ubuntu-wg python3[6602]: * Running on http://0.0.0.0:10086/ (Press CTRL+C to quit)
|
||||
```
|
||||
|
||||
If you see `Active:` followed by `active (running) since...` then it means it run correctly.
|
||||
|
||||
7. Stop/Start/Restart the service
|
||||
|
||||
```bash
|
||||
sudo systemctl stop wg-dashboard.service # <-- To stop the service
|
||||
sudo systemctl start wg-dashboard.service # <-- To start the service
|
||||
sudo systemctl restart wg-dashboard.service # <-- To restart the service
|
||||
```
|
||||
|
||||
8. **And now you can reboot your system, and use the command at step 6 to see if it will auto start after the reboot, or just simply access the dashboard through your browser. If you have any questions or problem, please report it in the issue page.**
|
||||
|
||||
## ✂️ Dashboard Configuration
|
||||
|
||||
#### Dashboard Configuration file
|
||||
|
||||
Since version 2.0, WGDashboard 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 configurations:
|
||||
|
||||
| | Description | Default | Edit Available |
|
||||
| ---------------------------- | ------------------------------------------------------------ | ---------------------------------------------------- | -------------- |
|
||||
| **`[Account]`** | *Configuration on account* | | |
|
||||
| `username` | Dashboard login username | `admin` | Yes |
|
||||
| `password` | Password, will be hash with SHA256 | `admin` hashed in SHA256 | Yes |
|
||||
| | | | |
|
||||
| **`[Server]`** | *Configuration on dashboard* | | |
|
||||
| `wg_conf_path` | The path of all the Wireguard configurations | `/etc/wireguard` | 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 |
|
||||
| `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.5` | **No** |
|
||||
| `dashboard_refresh_interval` | How frequent the dashboard will refresh on the configuration page | `60000ms` | Yes |
|
||||
| `dashboard_sort` | How configuration is sorting | `status` | Yes |
|
||||
| | | | |
|
||||
| **`[Peers]`** | *Default Settings on a new peer* | | |
|
||||
| `peer_global_dns` | DNS Server | `1.1.1.1` | Yes |
|
||||
| `peer_endpoint_allowed_ip` | Endpoint Allowed IP | `0.0.0.0/0` | Yes |
|
||||
| `peer_display_mode` | How peer will display | `grid` | Yes |
|
||||
| `remote_endpoint` | Remote Endpoint (i.e where your peers will connect to) | *depends on your server's default network interface* | Yes |
|
||||
| `peer_mtu` | Maximum Transmit Unit | `1420` | |
|
||||
| `peer_keep_alive` | Keep Alive | `21` | Yes |
|
||||
|
||||
#### Generating QR code and peer configuration file (.conf)
|
||||
|
||||
Starting version 2.2, dashboard can now generate QR code and configuration file for each peer. Here is a template of what each QR code encoded with and the same content will be inside the file:
|
||||
|
||||
```ini
|
||||
[Interface]
|
||||
PrivateKey = QWERTYUIOPO234567890YUSDAKFH10E1B12JE129U21=
|
||||
Address = 0.0.0.0/32
|
||||
DNS = 1.1.1.1
|
||||
|
||||
[Peer]
|
||||
PublicKey = QWERTYUIOPO234567890YUSDAKFH10E1B12JE129U21=
|
||||
AllowedIPs = 0.0.0.0/0
|
||||
Endpoint = 0.0.0.0:51820
|
||||
```
|
||||
|
||||
| | Description | Default Value | Available in Peer setting |
|
||||
| ----------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------- |
|
||||
| **`[Interface]`** | | | |
|
||||
| `PrivateKey` | The private key of this peer | Private key generated by WireGuard (`wg genkey`) or provided by user | Yes |
|
||||
| `Address` | The `allowed_ips` of your peer | N/A | Yes |
|
||||
| `DNS` | The DNS server your peer will use | `1.1.1.1` - Cloud flare DNS, you can change it when you adding the peer or in the peer setting. | Yes |
|
||||
| **`[Peer]`** | | | |
|
||||
| `PublicKey` | The public key of your server | N/A | No |
|
||||
| `AllowedIPs` | IP ranges for which a peer will route traffic | `0.0.0.0/0` - Indicated a default route to send all internet and VPN traffic through that peer. | Yes |
|
||||
| `Endpoint` | Your wireguard server ip and port, the dashboard will search for your server's default interface's ip. | `<your server default interface ip>:<listen port>` | Yes |
|
||||
|
||||
## ❓ How to update the dashboard?
|
||||
|
||||
#### **Please note for user who is using `v2.3.1` or below**
|
||||
|
||||
- For user who is using `v2.3.1` or below, please notice that all data that stored in the current database will **not** transfer to the new database. This is hard decision to move from TinyDB to SQLite. But SQLite does provide a thread-safe access and TinyDB doesn't. I couldn't find a safe way to transfer the data, so you need to do them manually... Sorry about that :pensive: . But I guess this would be a great start for future development :sunglasses:.
|
||||
|
||||
<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`
|
||||
|
||||
```shell
|
||||
cd wgdashboard/src
|
||||
```
|
||||
|
||||
2. Update the dashboard
|
||||
```shell
|
||||
git pull https://github.com/donaldzou/WGDashboard.git v3.0.5 --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)
|
||||
|
||||
![Index Image](img/HomePage.png)
|
||||
|
||||
![Configuration](img/Configuration.png)
|
||||
|
||||
![Add Peer](img/AddPeer.png)
|
||||
|
||||
![Edit Peer](img/EditPeer.png)
|
||||
|
||||
![Delete Peer](img/DeleteBulk.png)
|
||||
|
||||
![Dashboard Setting](img/DashboardSetting.png)
|
||||
|
||||
![Ping](img/Ping.png)
|
||||
|
||||
![Traceroute](img/Traceroute.png)
|
||||
|
||||
## ⏰ Changelog
|
||||
|
||||
#### v2.3.1 - Sep 8, 2021
|
||||
|
||||
- Updated dashboard's name to **WGDashboard**!!
|
||||
|
||||
#### v2.3 - Sep 8, 2021
|
||||
|
||||
- 🎉 **New Features**
|
||||
- **Update directly from `wgd.sh`:** Now you can update WGDashboard directly from the bash script.
|
||||
- **Displaying Peers:** You can switch the display mode between list and table in the configuration page.
|
||||
- 🪚 **Bug Fixed**
|
||||
- [Peer DNS Validation Fails #67](issues/67): Added DNS format check. [❤️ @realfian]
|
||||
- [configparser.NoSectionError: No section: 'Interface' #66](issues/66): Changed permission requirement for `etc/wireguard` from `744` to `755`. [❤️ @ramalmaty]
|
||||
- [Feature request: Interface not loading when information missing #73](issues/73): Fixed when Configuration Address and Listen Port is missing will crash the dashboard. [❤️ @js32]
|
||||
- [Remote Peer, MTU and PersistentKeepalives added #70](pull/70): Added MTU, remote peer and Persistent Keepalive. [❤️ @realfian]
|
||||
- [Fixes DNS check to support search domain #65](pull/65): Added allow input domain into DNS. [❤️@davejlong]
|
||||
- **🧐 Other Changes**
|
||||
- Moved Add Peer Button into the right bottom corner.
|
||||
|
||||
#### v2.2.1 - Aug 16, 2021
|
||||
|
||||
Bug Fixed:
|
||||
- Added support for full subnet on Allowed IP
|
||||
- Peer setting Save button
|
||||
|
||||
#### v2.2 - Aug 14, 2021
|
||||
|
||||
- 🎉 **New Features**
|
||||
- **Add new peers**: Now you can add peers directly on dashboard, it will generate a pair of private key and public key. You can also set its DNS, endpoint allowed IPs. Both can set a default value in the setting page. [❤️ in [#44](https://github.com/donaldzou/wireguard-dashboard/issues/44)]
|
||||
- **QR Code:** You can add the private key in peer setting of your existed peer to create a QR code. Or just create a new one, dashboard will now be able to auto generate a private key and public key ;) Don't worry, all keys will be generated on your machine, and **will delete all key files after they got generated**. [❤️ in [#29](https://github.com/donaldzou/wireguard-dashboard/issues/29)]
|
||||
- **Peer configuration file download:** Same as QR code, you now can download the peer configuration file, so you don't need to manually input all the details on the peer machine! [❤️ in [#40](https://github.com/donaldzou/wireguard-dashboard/issues/40)]
|
||||
- **Search peers**: You can now search peers by their name.
|
||||
- **Autostart on boot:** Added a tutorial on how to start the dashboard to on boot! Please read the [tutorial below](#autostart-wireguard-dashboard-on-boot). [❤️ in [#29](https://github.com/donaldzou/wireguard-dashboard/issues/29)]
|
||||
- **Click to copy**: You can now click and copy all peer's public key and configuration's public key.
|
||||
- ....
|
||||
- 🪚 **Bug Fixed**
|
||||
- When there are comments in the wireguard config file, will cause the dashboard to crash.
|
||||
- Used regex to search for config files.
|
||||
- **🧐 Other Changes**
|
||||
- Moved all external CSS and JavaScript file to local hosting (Except Bootstrap Icon, due to large amount of SVG files).
|
||||
- Updated Python dependencies
|
||||
- Flask: `v1.1.2 => v2.0.1`
|
||||
- Jinja: `v2.10.1 => v3.0.1`
|
||||
- icmplib: `v2.1.1 => v3.0.1`
|
||||
- Updated CSS/JS dependencies
|
||||
- Bootstrap: `v4.5.3 => v4.6.0`
|
||||
- UI adjustment
|
||||
- Adjusted how peers will display in larger screens, used to be 1 row per peer, now is 3 peers in 1 row.
|
||||
|
||||
#### v2.1 - Jul 2, 2021
|
||||
|
||||
- Added **Ping** and **Traceroute** tools!
|
||||
- Adjusted the calculation of data usage on each peers
|
||||
- Added refresh interval of the dashboard
|
||||
- Bug fixed when no configuration on fresh install ([#23](https://github.com/donaldzou/wireguard-dashboard/issues/23))
|
||||
- Fixed crash when too many peers ([#22](https://github.com/donaldzou/wireguard-dashboard/issues/22))
|
||||
|
||||
#### v2.0 - May 5, 2021
|
||||
|
||||
- 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!
|
||||
|
||||
#### v1.1.2 - Apr 3, 2021
|
||||
|
||||
- Resolved issue [#3](https://github.com/donaldzou/wireguard-dashboard/issues/3).
|
||||
|
||||
#### v1.1.1 - Apr 2, 2021
|
||||
|
||||
- Able to add a friendly name to each peer. Thanks [#2](https://github.com/donaldzou/wireguard-dashboard/issues/2) !
|
||||
|
||||
#### v1.0 - Dec 27, 2020
|
||||
|
||||
- Added the function to remove peers
|
||||
|
||||
## 🛒 Dependencies
|
||||
|
||||
- CSS/JS
|
||||
- [Bootstrap](https://getbootstrap.com/docs/4.6/getting-started/introduction/) `v4.6.0`
|
||||
- [Bootstrap Icon](https://icons.getbootstrap.com) `v1.4.0`
|
||||
- [jQuery](https://jquery.com) `v3.5.1`
|
||||
- Python
|
||||
- [Flask](https://pypi.org/project/Flask/) `v2.0.1`
|
||||
- [ifcfg](https://pypi.org/project/ifcfg/) `v0.21`
|
||||
- [icmplib](https://pypi.org/project/icmplib/) `v2.1.1`
|
||||
- [flask-qrcode](https://pypi.org/project/Flask-QRcode/) `v3.0.0`
|
||||
|
||||
## ✨ Contributors
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/antonioag95"><img src="https://avatars.githubusercontent.com/u/30556866?v=4?s=100" width="100px;" alt=""/><br /><sub><b>antonioag95</b></sub></a><br /><a href="https://github.com/donaldzou/WGDashboard/commits?author=antonioag95" title="Tests">⚠️</a> <a href="https://github.com/donaldzou/WGDashboard/commits?author=antonioag95" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/tonjo"><img src="https://avatars.githubusercontent.com/u/4726289?v=4?s=100" width="100px;" alt=""/><br /><sub><b>tonjo</b></sub></a><br /><a href="https://github.com/donaldzou/WGDashboard/commits?author=tonjo" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/reafian"><img src="https://avatars.githubusercontent.com/u/11992416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Newton</b></sub></a><br /><a href="https://github.com/donaldzou/WGDashboard/commits?author=reafian" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://www.davejlong.com"><img src="https://avatars.githubusercontent.com/u/175317?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David Long</b></sub></a><br /><a href="https://github.com/donaldzou/WGDashboard/commits?author=davejlong" title="Code">💻</a></td>
|
||||
<td align="center"><a href="http://www.std-soft.com"><img src="https://avatars.githubusercontent.com/u/5978293?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Markus Neubauer</b></sub></a><br /><a href="https://github.com/donaldzou/WGDashboard/commits?author=marneu" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
8
src/WGDashboard_donald.zou.egg-info/SOURCES.txt
Normal file
8
src/WGDashboard_donald.zou.egg-info/SOURCES.txt
Normal file
@ -0,0 +1,8 @@
|
||||
LICENSE
|
||||
README.md
|
||||
pyproject.toml
|
||||
setup.cfg
|
||||
src/WGDashboard_donald.zou.egg-info/PKG-INFO
|
||||
src/WGDashboard_donald.zou.egg-info/SOURCES.txt
|
||||
src/WGDashboard_donald.zou.egg-info/dependency_links.txt
|
||||
src/WGDashboard_donald.zou.egg-info/top_level.txt
|
1
src/WGDashboard_donald.zou.egg-info/dependency_links.txt
Normal file
1
src/WGDashboard_donald.zou.egg-info/dependency_links.txt
Normal file
@ -0,0 +1 @@
|
||||
|
1
src/WGDashboard_donald.zou.egg-info/top_level.txt
Normal file
1
src/WGDashboard_donald.zou.egg-info/top_level.txt
Normal file
@ -0,0 +1 @@
|
||||
|
52
src/api.py
52
src/api.py
@ -173,7 +173,8 @@ class manageConfiguration:
|
||||
return good
|
||||
|
||||
def getConfigurationInfo(self, configName, WG_CONF_PATH):
|
||||
conf = configparser.ConfigParser(strict=False)
|
||||
conf = configparser.RawConfigParser(strict=False)
|
||||
conf.optionxform = str
|
||||
try:
|
||||
with open(f'{WG_CONF_PATH}/{configName}.conf', 'r'):
|
||||
conf.read(f'{WG_CONF_PATH}/{configName}.conf')
|
||||
@ -182,6 +183,55 @@ class manageConfiguration:
|
||||
return ret(data=dict(conf['Interface']))
|
||||
except FileNotFoundError as err:
|
||||
return ret(status=False, reason=str(err))
|
||||
|
||||
def saveConfiguration(self, data, WG_CONF_PATH, configs):
|
||||
conf = configparser.RawConfigParser(strict=False)
|
||||
conf.optionxform = str
|
||||
configName = data['configurationName']
|
||||
pc = manageConfiguration.PortCheck(self, {'port': data['ListenPort']}, configs)
|
||||
if pc['status']:
|
||||
try:
|
||||
newData = []
|
||||
with open(f'{WG_CONF_PATH}/{configName}.conf', 'r') as f:
|
||||
conf.read(f'{WG_CONF_PATH}/{configName}.conf')
|
||||
if not conf.has_section("Interface"):
|
||||
return ret(status=False, reason="No [Interface] in configuration file")
|
||||
l = ['ListenPort', 'PostUp', 'PostDown', 'PreUp', 'PreDown']
|
||||
for i in l:
|
||||
conf.set("Interface", i, data[i])
|
||||
conf.remove_section("Peer")
|
||||
newData = list(map(lambda x : f"{x[0]} = {x[1]}\n", list(conf.items("Interface"))))
|
||||
originalData = f.readlines()
|
||||
for i in range(len(originalData)):
|
||||
if originalData[i] == "[Peer]\n":
|
||||
originalData = originalData[i:]
|
||||
break
|
||||
newData.insert(0, "[Interface]\n")
|
||||
newData.append("\n")
|
||||
newData = newData + originalData
|
||||
conf.clear()
|
||||
|
||||
|
||||
try:
|
||||
check = subprocess.check_output("wg-quick down " + configName,
|
||||
shell=True, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
pass
|
||||
with open(f'{WG_CONF_PATH}/{configName}.conf', 'w') as f:
|
||||
for i in newData:
|
||||
f.write(i)
|
||||
try:
|
||||
check = subprocess.check_output("wg-quick up " + configName,
|
||||
shell=True, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
pass
|
||||
return ret()
|
||||
except FileNotFoundError as err:
|
||||
return ret(status=False, reason=str(err))
|
||||
else:
|
||||
return pc
|
||||
|
||||
|
||||
|
||||
|
||||
class settings:
|
||||
|
@ -1659,6 +1659,14 @@ def addConfiguration():
|
||||
returnData = api.manageConfiguration.addConfiguration(api.manageConfiguration, data, config, WG_CONF_PATH)
|
||||
return jsonify(returnData)
|
||||
|
||||
@app.route('/api/saveConfiguration', methods=["POST"])
|
||||
def saveConfiguration():
|
||||
data = request.get_json()
|
||||
required = ['configurationName', 'ListenPort']
|
||||
if not checkJSONAllParameter(required, data):
|
||||
return jsonify(api.notEnoughParameter)
|
||||
return api.manageConfiguration.saveConfiguration(api.manageConfiguration, data, WG_CONF_PATH, get_conf_list())
|
||||
|
||||
@app.route('/api/deleteConfiguration', methods=['POST'])
|
||||
def deleteConfiguration():
|
||||
data = request.get_json()
|
||||
|
@ -764,9 +764,14 @@ pre.index-alert {
|
||||
}
|
||||
}
|
||||
|
||||
.toastContainer{
|
||||
z-index: 99999 !important;
|
||||
}
|
||||
|
||||
.toast{
|
||||
min-width: 300px;
|
||||
background-color: rgba(255,255,255,1);
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.toast-header{
|
||||
|
2
src/static/css/dashboard.min.css
vendored
2
src/static/css/dashboard.min.css
vendored
File diff suppressed because one or more lines are too long
@ -10,6 +10,10 @@ body {
|
||||
color: hsl(0deg, 0%, 80%);
|
||||
}
|
||||
|
||||
a.text-primary:focus, a.text-primary:hover {
|
||||
color: hsl(235deg, 60%, 50%) !important;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: hsl(0deg, 0%, 90%) !important;
|
||||
border-color: hsl(235deg, 60%, 60%) !important;
|
||||
@ -332,9 +336,15 @@ div.toast div.toast-body {
|
||||
background-color: #383838 !important;
|
||||
color: hsl(0deg, 0%, 80%) !important;
|
||||
}
|
||||
div.toast div.toast-body.text-danger {
|
||||
color: hsl(0deg, 60%, 60%) !important;
|
||||
}
|
||||
div.toast div.toast-progressbar {
|
||||
background-color: hsl(235deg, 60%, 60%) !important;
|
||||
}
|
||||
div.toast div.toast-progressbar.bg-danger {
|
||||
background-color: hsl(0deg, 60%, 60%) !important;
|
||||
}
|
||||
|
||||
.bs-popover-auto[x-placement^=right] > .arrow::after,
|
||||
.bs-popover-right > .arrow::after {
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["dark.scss"],"names":[],"mappings":"AAgCA;EACE;EACA;EACA;EACA;;;AAGF;EACE,YAvCS;EAwCT,OAdS;;;AAkBX;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE,kBAtFS;EAuFT,cAvFS;EAwFT;;AAEA;EACE,kBAxFO;EAyFP,cAzFO;EA0FP;;;AAMJ;EACE,kBAxFQ;;AAyFR;EACE,kBA3FM;;;AAiGN;EACE,kBAjGI;EAkGJ,QAlGI;;AAoGJ;EACE,kBAtGE;EAuGF,QAvGE;;;AA+GN;EACE,kBA5GK;EA6GL,QA7GK;;AA+GL;EACE,kBAjHG;EAkHH,QAlHG;;;AAwHX;EACE,kBAxHS;;AAyHT;EACE,kBA3HO;;;AA+HX;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAKF;EACE;;AACA;EACE;;AAIJ;EACE;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAKN;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAIA;EACE,OAhQO;;AAkQT;EACE,cAnQO;;;AAuQX;AAAA;EAEE,OAhQS;;AAkQT;AAAA;EACE,YA7RO;;;AAiSX;AAAA;AAAA;EAGE;EACA;;;AAGF;EACE,YAvSS;;;AA0SX;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE,cAzUU;;;AA4UZ;EACE;;;AAEF;EACE;EACA;;;AAGF;AAAA;EAEE;;;AAGF;EACE,cAjWS;;;AAoWX;EACE,kBAzWS;;;AA4WX;AAAA;EAEE,kBA/WS;EAgXT,cA3WS;;;AA8WX;EACE,OA5VY;;;AA+Vd;EACE,OA7VS;EA8VT;;AAEA;EACE,OAhWO;;;AAoWX;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;;AAIJ;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;AAEA;AAAA;EAEE;;;AAKJ;EACE;;;AAIA;EACE;;AAIA;EACE,OAraK;;AAyaT;EACE;;AAGF;EACE;;;AAKJ;EACE,OA/bS","file":"dark.css"}
|
||||
{"version":3,"sourceRoot":"","sources":["dark.scss"],"names":[],"mappings":"AAgCA;EACE;EACA;EACA;EACA;;;AAGF;EACE,YAvCS;EAwCT,OAdS;;;AAiBX;EACE;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE,kBAzFS;EA0FT,cA1FS;EA2FT;;AAEA;EACE,kBA3FO;EA4FP,cA5FO;EA6FP;;;AAMJ;EACE,kBA3FQ;;AA4FR;EACE,kBA9FM;;;AAoGN;EACE,kBApGI;EAqGJ,QArGI;;AAuGJ;EACE,kBAzGE;EA0GF,QA1GE;;;AAkHN;EACE,kBA/GK;EAgHL,QAhHK;;AAkHL;EACE,kBApHG;EAqHH,QArHG;;;AA2HX;EACE,kBA3HS;;AA4HT;EACE,kBA9HO;;;AAkIX;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;;AAEA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAKF;EACE;;AACA;EACE;;AAIJ;EACE;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAKN;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAIA;EACE,OAnQO;;AAqQT;EACE,cAtQO;;;AA0QX;AAAA;EAEE,OAnQS;;AAqQT;AAAA;EACE,YAhSO;;;AAoSX;AAAA;AAAA;EAGE;EACA;;;AAGF;EACE,YA1SS;;;AA6SX;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE,cA5UU;;;AA+UZ;EACE;;;AAEF;EACE;EACA;;;AAGF;AAAA;EAEE;;;AAGF;EACE,cApWS;;;AAuWX;EACE,kBA5WS;;;AA+WX;AAAA;EAEE,kBAlXS;EAmXT,cA9WS;;;AAiXX;EACE,OA/VY;;;AAkWd;EACE,OAhWS;EAiWT;;AAEA;EACE,OAnWO;;;AAuWX;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;;;AAIJ;AAAA;EAEE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;AAEA;AAAA;EAEE;;;AAKJ;EACE;;;AAIA;EACE;;AAIA;EACE,OAhbK;;AAobT;EACE;;AAGF;EACE;;;AAKJ;EACE,OA1cS","file":"dark.css"}
|
2
src/static/css/theme/dark.min.css
vendored
2
src/static/css/theme/dark.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
{"version":3,"sourceRoot":"","sources":["dark.scss"],"names":[],"mappings":"AAgCA,MACE,0CACA,yCACA,sCACA,4CAGF,KACE,WAvCS,KAwCT,MAdS,KAkBX,aACE,yBACA,gCACA,8BAEA,mBACE,oCACA,gCAIJ,qBACE,yBACA,gCACA,oCAEA,uDAEE,yBAGF,4BACE,oCACA,gCAGF,2BACE,oCACA,gCAIJ,aACE,yBACA,gCACA,8BAEA,mBACE,oCACA,gCAIJ,iBACE,iBAtFS,QAuFT,aAvFS,QAwFT,WAEA,uBACE,iBAxFO,KAyFP,aAzFO,KA0FP,WAMJ,qCACE,iBAxFQ,QAyFR,2CACE,iBA3FM,KAiGN,wCACE,iBAjGI,QAkGJ,OAlGI,QAoGJ,8CACE,iBAtGE,KAuGF,OAvGE,KA+GN,yCACE,iBA5GK,QA6GL,OA7GK,QA+GL,+CACE,iBAjHG,QAkHH,OAlHG,QAwHX,kCACE,iBAxHS,QAyHT,wCACE,iBA3HO,QA+HX,qBACE,yBACA,gCACA,oCAEA,uDAEE,yBAGF,4BACE,oCACA,gCAGF,2BACE,oCACA,gCAIJ,YACE,yBACA,gCACA,8BAEA,kBACE,iCACA,6BAIJ,oBACE,yBACA,gCACA,oCAEA,qDAEE,yBAGF,2BACE,oCACA,gCAGF,0BACE,iCACA,6BAIJ,eACE,yBACA,gCACA,8BAEA,qBACE,oCACA,gCAIJ,uBACE,yBACA,gCACA,oCAEA,2DAEE,yBAGF,8BACE,oCACA,gCAGF,6BACE,oCACA,gCAKF,gCACE,yBACA,sCACE,sBAIJ,mBACE,0CAEA,uCACE,yBAGF,uCACE,yBAGF,sCACE,sBAGF,yCACE,yBAKN,cACE,oCACA,sCACA,sBAGF,uBACE,sBAGF,oBACE,8BAIA,aACE,MAhQO,QAkQT,iBACE,aAnQO,QAuQX,iDAEE,MAhQS,KAkQT,6DACE,WA7RO,KAiSX,8FAGE,oCACA,8BAGF,MACE,WAvSS,QA0SX,YACE,sBAGF,aACE,yBAGF,cACE,yBAGF,cACE,yBAGF,WACE,yBAGF,0CAEE,yBAGF,wCAEE,sBAGF,oCAEE,yBAGF,aACE,oCAGF,cACE,aAzUU,QA4UZ,6CACE,oCAEF,qCACE,oCACA,gCAGF,+DAEE,yBAGF,GACE,aAjWS,QAoWX,eACE,iBAzWS,KA4WX,4BAEE,iBA/WS,QAgXT,aA3WS,QA8WX,KACE,MA5VY,QA+Vd,OACE,MA7VS,KA8VT,iBAEA,aACE,MAhWO,QAoWX,2BACE,iCAGF,SACE,iCACA,uBAGF,cACE,sBAGF,UACE,oCAEA,2BACE,iCACA,sBACA,uCAGF,yBACE,oCACA,sBAGF,gCACE,oCAIJ,mFAEE,mCAGF,oCACE,oCAGF,0BACE,iCAGF,OACE,sBAEA,oBAEE,6BAKJ,4FACE,wDAIA,WACE,oCAIA,4BACE,MAraK,KAyaT,mCACE,yBAGF,mBACE,oCAKJ,WACE,MA/bS","file":"dark.min.css"}
|
||||
{"version":3,"sourceRoot":"","sources":["dark.scss"],"names":[],"mappings":"AAgCA,MACE,0CACA,yCACA,sCACA,4CAGF,KACE,WAvCS,KAwCT,MAdS,KAiBX,0CACE,yBAGF,aACE,yBACA,gCACA,8BAEA,mBACE,oCACA,gCAIJ,qBACE,yBACA,gCACA,oCAEA,uDAEE,yBAGF,4BACE,oCACA,gCAGF,2BACE,oCACA,gCAIJ,aACE,yBACA,gCACA,8BAEA,mBACE,oCACA,gCAIJ,iBACE,iBAzFS,QA0FT,aA1FS,QA2FT,WAEA,uBACE,iBA3FO,KA4FP,aA5FO,KA6FP,WAMJ,qCACE,iBA3FQ,QA4FR,2CACE,iBA9FM,KAoGN,wCACE,iBApGI,QAqGJ,OArGI,QAuGJ,8CACE,iBAzGE,KA0GF,OA1GE,KAkHN,yCACE,iBA/GK,QAgHL,OAhHK,QAkHL,+CACE,iBApHG,QAqHH,OArHG,QA2HX,kCACE,iBA3HS,QA4HT,wCACE,iBA9HO,QAkIX,qBACE,yBACA,gCACA,oCAEA,uDAEE,yBAGF,4BACE,oCACA,gCAGF,2BACE,oCACA,gCAIJ,YACE,yBACA,gCACA,8BAEA,kBACE,iCACA,6BAIJ,oBACE,yBACA,gCACA,oCAEA,qDAEE,yBAGF,2BACE,oCACA,gCAGF,0BACE,iCACA,6BAIJ,eACE,yBACA,gCACA,8BAEA,qBACE,oCACA,gCAIJ,uBACE,yBACA,gCACA,oCAEA,2DAEE,yBAGF,8BACE,oCACA,gCAGF,6BACE,oCACA,gCAKF,gCACE,yBACA,sCACE,sBAIJ,mBACE,0CAEA,uCACE,yBAGF,uCACE,yBAGF,sCACE,sBAGF,yCACE,yBAKN,cACE,oCACA,sCACA,sBAGF,uBACE,sBAGF,oBACE,8BAIA,aACE,MAnQO,QAqQT,iBACE,aAtQO,QA0QX,iDAEE,MAnQS,KAqQT,6DACE,WAhSO,KAoSX,8FAGE,oCACA,8BAGF,MACE,WA1SS,QA6SX,YACE,sBAGF,aACE,yBAGF,cACE,yBAGF,cACE,yBAGF,WACE,yBAGF,0CAEE,yBAGF,wCAEE,sBAGF,oCAEE,yBAGF,aACE,oCAGF,cACE,aA5UU,QA+UZ,6CACE,oCAEF,qCACE,oCACA,gCAGF,+DAEE,yBAGF,GACE,aApWS,QAuWX,eACE,iBA5WS,KA+WX,4BAEE,iBAlXS,QAmXT,aA9WS,QAiXX,KACE,MA/VY,QAkWd,OACE,MAhWS,KAiWT,iBAEA,aACE,MAnWO,QAuWX,2BACE,iCAGF,SACE,iCACA,uBAGF,cACE,sBAGF,UACE,oCAEA,2BACE,iCACA,sBACA,uCAGF,yBACE,oCACA,sBAGF,qCACE,yBAGF,gCACE,oCAGF,0CACE,oCAIJ,mFAEE,mCAGF,oCACE,oCAGF,0BACE,iCAGF,OACE,sBAEA,oBAEE,6BAKJ,4FACE,wDAIA,WACE,oCAIA,4BACE,MAhbK,KAobT,mCACE,yBAGF,mBACE,oCAKJ,WACE,MA1cS","file":"dark.min.css"}
|
1
src/static/css/theme/dark.min.min.css
vendored
Normal file
1
src/static/css/theme/dark.min.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -42,6 +42,9 @@ body {
|
||||
color: $text-200;
|
||||
}
|
||||
|
||||
a.text-primary:focus, a.text-primary:hover{
|
||||
color: $blue-400 !important;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: $text-100 !important;
|
||||
@ -409,9 +412,17 @@ div.toast {
|
||||
color: $text-200 !important;
|
||||
}
|
||||
|
||||
div.toast-body.text-danger{
|
||||
color: $red-500 !important;
|
||||
}
|
||||
|
||||
div.toast-progressbar {
|
||||
background-color: $blue-500 !important;
|
||||
}
|
||||
|
||||
div.toast-progressbar.bg-danger {
|
||||
background-color: $red-500 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.bs-popover-auto[x-placement^="right"] > .arrow::after,
|
||||
|
7045
src/static/js/bootstrap.bundle.js
vendored
7045
src/static/js/bootstrap.bundle.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
7
src/static/js/bootstrap.bundle.min.js
vendored
7
src/static/js/bootstrap.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -618,7 +618,7 @@ let peers = [];
|
||||
$("#add_peer_form").trigger("reset");
|
||||
$add_peer.removeAttribute("disabled");
|
||||
$add_peer.innerHTML = "Save";
|
||||
configurations.showToast($new_add_amount.val() + " peers added successful!");
|
||||
showToast($new_add_amount.val() + " peers added successful!");
|
||||
configurations.addModal().toggle();
|
||||
}
|
||||
}
|
||||
@ -671,7 +671,7 @@ let peers = [];
|
||||
configurations.deleteBulkModal().toggle();
|
||||
}
|
||||
configurations.loadPeers($('#search_peer_textbox').val());
|
||||
configurations.showToast(`Deleted ${peer_ids.length} peers`)
|
||||
showToast(`Deleted ${peer_ids.length} peers`)
|
||||
$("#delete_peer").removeAttr("disabled").html("Delete");
|
||||
}
|
||||
}
|
||||
@ -847,30 +847,6 @@ let peers = [];
|
||||
document.querySelector("#enable_preshare_key").value = keys.presharedKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show toast
|
||||
* @param msg
|
||||
*/
|
||||
let numberToast = 0;
|
||||
function showToast(msg) {
|
||||
$(".toastContainer").append(
|
||||
`<div id="${numberToast}-toast" class="toast hide" role="alert" data-delay="5000">
|
||||
<div class="toast-header">
|
||||
<strong class="mr-auto">WGDashboard</strong>
|
||||
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body">${msg}</div>
|
||||
<div class="toast-progressbar"></div>
|
||||
</div>` )
|
||||
$(`#${numberToast}-toast`).toast('show');
|
||||
$(`#${numberToast}-toast .toast-body`).html(msg);
|
||||
$(`#${numberToast}-toast .toast-progressbar`).css("transition", `width ${$(`#${numberToast}-toast .toast-progressbar`).parent().data('delay')}ms cubic-bezier(0, 0, 0, 0)`);
|
||||
$(`#${numberToast}-toast .toast-progressbar`).css("width", "0px");
|
||||
numberToast++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update peer's refresh interval
|
||||
* @param res
|
||||
@ -980,7 +956,23 @@ let peers = [];
|
||||
|
||||
function getConfigurationDetails() {
|
||||
function done(res){
|
||||
console.log(res);
|
||||
console.log(res.data);
|
||||
$("#editConfigurationName").text(configuration_name);
|
||||
$("#editConfigurationAddress").text(res.data.Address);
|
||||
$("#editConfigurationPrivateKey").text(res.data.PrivateKey);
|
||||
$("#editConfigurationListenPort").val(res.data.ListenPort);
|
||||
if (res.data.PostUp){
|
||||
$("#editConfigurationPostUp").val(res.data.PostUp)
|
||||
}
|
||||
if (res.data.PostDown){
|
||||
$("#editConfigurationPostDown").val(res.data.PostDown)
|
||||
}
|
||||
if (res.data.PreUp){
|
||||
$("#editConfigurationPreUp").val(res.data.PreUp)
|
||||
}
|
||||
if (res.data.PreDown){
|
||||
$("#editConfigurationPreDown").val(res.data.PreDown)
|
||||
}
|
||||
}
|
||||
ajaxGetJSON(`/api/getConfigurationInfo?configName=${configuration_name}`, done)
|
||||
}
|
||||
|
50
src/static/js/configuration.min.js
vendored
50
src/static/js/configuration.min.js
vendored
File diff suppressed because one or more lines are too long
@ -122,6 +122,35 @@ $editConfiguration.on("click", function(){
|
||||
configurations.configurationEditModal().toggle();
|
||||
});
|
||||
|
||||
$saveConfiguration = $("#editConfigurationBtn");
|
||||
$saveConfiguration.on("click", function(){
|
||||
$(this).html("Saving...")
|
||||
$(this).siblings().hide();
|
||||
$(this).attr("disabled", "disabled");
|
||||
|
||||
let data = {
|
||||
"configurationName": configurations.getConfigurationName(),
|
||||
"ListenPort": $("#editConfigurationListenPort").val(),
|
||||
"PostUp": $("#editConfigurationPostUp").val(),
|
||||
"PostDown": $("#editConfigurationPostDown").val(),
|
||||
"PreDown": $("#editConfigurationPreDown").val(),
|
||||
"PreUp": $("#editConfigurationPreUp").val(),
|
||||
}
|
||||
function done(res){
|
||||
console.log(res);
|
||||
$saveConfiguration.removeAttr("disabled");
|
||||
if (res.status){
|
||||
configurations.configurationEditModal().toggle();
|
||||
configurations.loadPeers("");
|
||||
showToast("Configuration saved");
|
||||
}else{
|
||||
showToast(res.reason);
|
||||
}
|
||||
$saveConfiguration.html("Save");
|
||||
$saveConfiguration.siblings().show();
|
||||
}
|
||||
ajaxPostJSON("/api/saveConfiguration", data, done);
|
||||
})
|
||||
|
||||
/**
|
||||
* ==========
|
||||
@ -150,9 +179,9 @@ $(".toggle--switch").on("change", function(){
|
||||
}).done(function(res){
|
||||
if (res.status){
|
||||
if (status){
|
||||
configurations.showToast(`${id} is running.`)
|
||||
showToast(`${id} is running.`)
|
||||
}else{
|
||||
configurations.showToast(`${id} is stopped.`)
|
||||
showToast(`${id} is stopped.`)
|
||||
}
|
||||
}else{
|
||||
if (status){
|
||||
@ -160,7 +189,7 @@ $(".toggle--switch").on("change", function(){
|
||||
}else{
|
||||
ele.prop("checked", true)
|
||||
}
|
||||
configurations.showToast(res.reason);
|
||||
showToast(res.reason, true);
|
||||
$(".index-alert").removeClass("d-none").text(`Configuration toggle failed. Please check the following error message:\n${res.message}`);
|
||||
}
|
||||
ele.removeClass("waiting");
|
||||
@ -283,7 +312,7 @@ $add_peer.addEventListener("click", function() {
|
||||
$("#add_peer_form").trigger("reset");
|
||||
$add_peer.removeAttribute("disabled");
|
||||
$add_peer.innerHTML = "Save";
|
||||
configurations.showToast("Add peer successful!");
|
||||
showToast("Add peer successful!");
|
||||
configurations.addModal().toggle();
|
||||
}
|
||||
}
|
||||
@ -447,12 +476,12 @@ $body.on("click", ".btn-lock-peer", function() {
|
||||
configurations.toggleAccess($(this).data('peer-id'), configurations.getConfigurationName());
|
||||
if ($(this).hasClass("lock")) {
|
||||
console.log($(this).data("peer-name"))
|
||||
configurations.showToast(`Enabled ${$(this).children().data("peer-name")}`)
|
||||
showToast(`Enabled ${$(this).children().data("peer-name")}`)
|
||||
$(this).removeClass("lock")
|
||||
$(this).children().tooltip('hide').attr('data-original-title', 'Peer enabled. Click to disable peer.').tooltip('show');
|
||||
} else {
|
||||
// Currently unlocked
|
||||
configurations.showToast(`Disabled ${$(this).children().data("peer-name")}`)
|
||||
showToast(`Disabled ${$(this).children().data("peer-name")}`)
|
||||
$(this).addClass("lock");
|
||||
$(this).children().tooltip('hide').attr('data-original-title', 'Peer disabled. Click to enable peer.').tooltip('show');
|
||||
}
|
||||
@ -706,12 +735,12 @@ $body.on("click", ".display_mode", function() {
|
||||
Array($(".peer_list").children()).forEach(function(child) {
|
||||
$(child).removeClass().addClass("col-12");
|
||||
});
|
||||
configurations.showToast("Displaying as List");
|
||||
showToast("Displaying as List");
|
||||
} else {
|
||||
Array($(".peer_list").children()).forEach(function(child) {
|
||||
$(child).removeClass().addClass("col-sm-6 col-lg-4");
|
||||
});
|
||||
configurations.showToast("Displaying as Grids");
|
||||
showToast("Displaying as Grids");
|
||||
}
|
||||
});
|
||||
|
||||
@ -891,9 +920,9 @@ $("#download_all_peers").on("click", function() {
|
||||
success: function(res) {
|
||||
if (res.peers.length > 0) {
|
||||
window.wireguard.generateZipFiles(res);
|
||||
configurations.showToast("Peers' zip file download successful!");
|
||||
showToast("Peers' zip file download successful!");
|
||||
} else {
|
||||
configurations.showToast("Oops! There are no peer can be download.");
|
||||
showToast("Oops! There are no peer can be download.");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
1
src/static/js/configurationTool.min.js
vendored
Normal file
1
src/static/js/configurationTool.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,3 @@
|
||||
let numberToast = 0;
|
||||
let emptyInputFeedback = "Can't leave empty";
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
let $add_configuration = $("#add_configuration");
|
||||
@ -19,25 +18,6 @@ addConfigurationModal.on("hidden.bs.modal", function(){
|
||||
$(".addConfigurationAvailableIPs").text("N/A");
|
||||
});
|
||||
|
||||
function showToast(msg){
|
||||
$(".toastContainer").append(
|
||||
`<div id="${numberToast}-toast" class="toast hide" role="alert" data-delay="5000">
|
||||
<div class="toast-header">
|
||||
<strong class="mr-auto">WGDashboard</strong>
|
||||
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body">${msg}</div>
|
||||
<div class="toast-progressbar"></div>
|
||||
</div>` );
|
||||
$(`#${numberToast}-toast`).toast('show');
|
||||
$(`#${numberToast}-toast .toast-body`).html(msg);
|
||||
$(`#${numberToast}-toast .toast-progressbar`).css("transition", `width ${$(`#${numberToast}-toast .toast-progressbar`).parent().data('delay')}ms cubic-bezier(0, 0, 0, 0)`);
|
||||
$(`#${numberToast}-toast .toast-progressbar`).css("width", "0px");
|
||||
numberToast++;
|
||||
}
|
||||
|
||||
$(".toggle--switch").on("change", function(){
|
||||
$(this).addClass("waiting").attr("disabled", "disabled");
|
||||
let id = $(this).data("conf-id");
|
||||
@ -59,6 +39,7 @@ $(".toggle--switch").on("change", function(){
|
||||
}
|
||||
}else{
|
||||
ele.parents().children(".card-message").html(`<pre class="index-alert">Configuration toggle failed. Please check the following error message:<br><code>${res.message}</code></pre>`)
|
||||
showToast(`${id} toggled failed.`, true);
|
||||
if (status){
|
||||
ele.prop("checked", false)
|
||||
}else{
|
||||
@ -70,8 +51,18 @@ $(".toggle--switch").on("change", function(){
|
||||
});
|
||||
|
||||
$(".sb-home-url").addClass("active");
|
||||
|
||||
$(".card-body").on("click", function(handle){
|
||||
if ($(handle.target).attr("class") !== "toggleLabel" && $(handle.target).attr("class") !== "toggle--switch") {
|
||||
let c = $(".card");
|
||||
for (let i of c){
|
||||
if (i != $(this).parent()[0]){
|
||||
$(i).css("transition", "ease-in-out 0.3s").css("opacity", "0.5")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
window.open($(this).find("a").attr("href"), "_self");
|
||||
}
|
||||
});
|
||||
|
11
src/static/js/index.min.js
vendored
11
src/static/js/index.min.js
vendored
File diff suppressed because one or more lines are too long
2
src/static/js/jquery.min.js
vendored
2
src/static/js/jquery.min.js
vendored
File diff suppressed because one or more lines are too long
60
src/static/js/settings.js
Normal file
60
src/static/js/settings.js
Normal file
@ -0,0 +1,60 @@
|
||||
$(".sb-settings-url").addClass("active")
|
||||
$(".confirm_modal").click(function () {
|
||||
$(".app_new_ip").html($("#app_ip")[0].value)
|
||||
$(".app_new_port").html($("#app_port")[0].value)
|
||||
})
|
||||
|
||||
$(".confirm_restart").click(function () {
|
||||
$(".cancel_restart").remove()
|
||||
countdown = 7;
|
||||
$.post('/update_app_ip_port', $('.update_app_ip_port').serialize())
|
||||
url = $("#app_ip")[0].value + ":" + $("#app_port")[0].value;
|
||||
$(".confirm_restart").attr("disabled", "disabled")
|
||||
setInterval(function () {
|
||||
if (countdown === 0) {
|
||||
window.location.replace("http://" + url);
|
||||
}
|
||||
$(".confirm_restart").html("Redirecting you in " + countdown + " seconds.")
|
||||
countdown--;
|
||||
}, 1000)
|
||||
});
|
||||
|
||||
$(".change_path").click(function () {
|
||||
$(this).attr("disabled", "disabled");
|
||||
countdown = 5;
|
||||
setInterval(function () {
|
||||
if (countdown === 0) {
|
||||
location.reload()
|
||||
}
|
||||
$(".change_path").html("Redirecting you in " + countdown + " seconds.")
|
||||
countdown--;
|
||||
}, 1000)
|
||||
$.post('/update_wg_conf_path', $('.update_wg_conf_path').serialize())
|
||||
});
|
||||
|
||||
$(".bottomNavSettings").addClass("active");
|
||||
|
||||
|
||||
$(".theme-switch-btn").on("click", function(){
|
||||
if (!$(this).hasClass("active")){
|
||||
let theme = $(this).data("theme");
|
||||
$(".theme-switch-btn").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "/api/settings/setTheme",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
data: JSON.stringify({"theme": theme})
|
||||
}).done(function(res){
|
||||
if (res.status == true){
|
||||
if (theme == "light"){
|
||||
$("#darkThemeCSS").remove();
|
||||
showToast("Switched to light theme");
|
||||
}else{
|
||||
$("head").append('<link rel="stylesheet" type="text/css" href="/static/css/theme/dark.min.css" id="darkThemeCSS">');
|
||||
showToast("Switched to dark theme");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
1
src/static/js/settings.min.js
vendored
Normal file
1
src/static/js/settings.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
$(".sb-settings-url").addClass("active");$(".confirm_modal").click(function(){$(".app_new_ip").html($("#app_ip")[0].value);$(".app_new_port").html($("#app_port")[0].value)});$(".confirm_restart").click(function(){$(".cancel_restart").remove();countdown=7;$.post("/update_app_ip_port",$(".update_app_ip_port").serialize());url=$("#app_ip")[0].value+":"+$("#app_port")[0].value;$(".confirm_restart").attr("disabled","disabled");setInterval(function(){if(countdown===0){window.location.replace("http://"+url)}$(".confirm_restart").html("Redirecting you in "+countdown+" seconds.");countdown--},1e3)});$(".change_path").click(function(){$(this).attr("disabled","disabled");countdown=5;setInterval(function(){if(countdown===0){location.reload()}$(".change_path").html("Redirecting you in "+countdown+" seconds.");countdown--},1e3);$.post("/update_wg_conf_path",$(".update_wg_conf_path").serialize())});$(".bottomNavSettings").addClass("active");$(".theme-switch-btn").on("click",function(){if(!$(this).hasClass("active")){let theme=$(this).data("theme");$(".theme-switch-btn").removeClass("active");$(this).addClass("active");$.ajax({method:"POST",url:"/api/settings/setTheme",headers:{"Content-Type":"application/json"},data:JSON.stringify({theme:theme})}).done(function(res){if(res.status==true){if(theme=="light"){$("#darkThemeCSS").remove();showToast("Switched to light theme")}else{$("head").append('<link rel="stylesheet" type="text/css" href="/static/css/theme/dark.min.css" id="darkThemeCSS">');showToast("Switched to dark theme")}}})}});
|
@ -64,4 +64,27 @@ $(".send_traceroute").on("click", function (){
|
||||
$("#traceroute_modal .form-control").removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
let numberToast = 0;
|
||||
function showToast(msg, isDanger = false) {
|
||||
$(".toastContainer").append(
|
||||
`<div id="${numberToast}-toast" class="toast hide animate__animated animate__fadeInUp" role="alert" data-delay="5000">
|
||||
<div class="toast-header">
|
||||
<strong class="mr-auto">WGDashboard</strong>
|
||||
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body ${isDanger ? 'text-danger':''}">${msg}</div>
|
||||
<div class="toast-progressbar ${isDanger ? 'bg-danger':''}"></div>
|
||||
</div>` )
|
||||
$(`#${numberToast}-toast`).toast('show');
|
||||
$(`#${numberToast}-toast .toast-body`).html(msg);
|
||||
$(`#${numberToast}-toast .toast-progressbar`).css("transition", `width ${$(`#${numberToast}-toast .toast-progressbar`).parent().data('delay')}ms cubic-bezier(0, 0, 0, 0)`);
|
||||
$(`#${numberToast}-toast .toast-progressbar`).css("width", "0px");
|
||||
let i = numberToast;
|
||||
setTimeout(function(){
|
||||
$(`#${i}-toast`).removeClass("animate__fadeInUp").addClass("animate__fadeOutRight")
|
||||
}, 4500)
|
||||
numberToast++;
|
||||
}
|
11
src/static/js/tools.min.js
vendored
11
src/static/js/tools.min.js
vendored
@ -1 +1,10 @@
|
||||
$(".ip_dropdown").on("change",function(){$(".modal.show .btn").removeAttr("disabled")});$(".conf_dropdown").on("change",function(){$(".modal.show .ip_dropdown").html('<option value="none" selected="selected" disabled>Loading...');$.ajax({url:"/get_ping_ip",method:"POST",data:"config="+$(this).children("option:selected").val(),success:function(res){$(".modal.show .ip_dropdown").html("");$(".modal.show .ip_dropdown").append('<option value="none" selected="selected" disabled>Choose an IP');$(".modal.show .ip_dropdown").append(res)}})});$(".send_ping").on("click",function(){$(this).attr("disabled","disabled");$(this).html("Pinging...");$("#ping_modal .form-control").attr("disabled","disabled");$.ajax({method:"POST",data:"ip="+$(":selected",$("#ping_modal .ip_dropdown")).val()+"&count="+$("#ping_modal .ping_count").val(),url:"/ping_ip",success:function(res){$(".ping_result tbody").html("");let html='<tr><th scope="row">Address</th><td>'+res.address+"</td></tr>"+'<tr><th scope="row">Is Alive</th><td>'+res.is_alive+"</td></tr>"+'<tr><th scope="row">Min RTT</th><td>'+res.min_rtt+"ms</td></tr>"+'<tr><th scope="row">Average RTT </th><td>'+res.avg_rtt+"ms</td></tr>"+'<tr><th scope="row">Max RTT</th><td>'+res.max_rtt+"ms</td></tr>"+'<tr><th scope="row">Package Sent</th><td>'+res.package_sent+"</td></tr>"+'<tr><th scope="row">Package Received</th><td>'+res.package_received+"</td></tr>"+'<tr><th scope="row">Package Loss</th><td>'+res.package_loss+"</td></tr>";$(".ping_result tbody").html(html);$(".send_ping").removeAttr("disabled");$(".send_ping").html("Ping");$("#ping_modal .form-control").removeAttr("disabled")}})});$(".send_traceroute").on("click",function(){$(this).attr("disabled","disabled");$(this).html("Tracing...");$("#traceroute_modal .form-control").attr("disabled","disabled");$.ajax({url:"/traceroute_ip",method:"POST",data:"ip="+$(":selected",$("#traceroute_modal .ip_dropdown")).val(),success:function(res){$(".traceroute_result tbody").html("");res.forEach(ele=>$(".traceroute_result tbody").append('<tr><th scope="row">'+ele.hop+"</th><td>"+ele.ip+"</td><td>"+ele.avg_rtt+"</td><td>"+ele.min_rtt+"</td><td>"+ele.max_rtt+"</td></tr>"));$(".send_traceroute").removeAttr("disabled").html("Traceroute");$("#traceroute_modal .form-control").removeAttr("disabled")}})});
|
||||
$(".ip_dropdown").on("change",function(){$(".modal.show .btn").removeAttr("disabled")});$(".conf_dropdown").on("change",function(){$(".modal.show .ip_dropdown").html('<option value="none" selected="selected" disabled>Loading...');$.ajax({url:"/get_ping_ip",method:"POST",data:"config="+$(this).children("option:selected").val(),success:function(res){$(".modal.show .ip_dropdown").html("");$(".modal.show .ip_dropdown").append('<option value="none" selected="selected" disabled>Choose an IP');$(".modal.show .ip_dropdown").append(res)}})});$(".send_ping").on("click",function(){$(this).attr("disabled","disabled");$(this).html("Pinging...");$("#ping_modal .form-control").attr("disabled","disabled");$.ajax({method:"POST",data:"ip="+$(":selected",$("#ping_modal .ip_dropdown")).val()+"&count="+$("#ping_modal .ping_count").val(),url:"/ping_ip",success:function(res){$(".ping_result tbody").html("");let html='<tr><th scope="row">Address</th><td>'+res.address+"</td></tr>"+'<tr><th scope="row">Is Alive</th><td>'+res.is_alive+"</td></tr>"+'<tr><th scope="row">Min RTT</th><td>'+res.min_rtt+"ms</td></tr>"+'<tr><th scope="row">Average RTT </th><td>'+res.avg_rtt+"ms</td></tr>"+'<tr><th scope="row">Max RTT</th><td>'+res.max_rtt+"ms</td></tr>"+'<tr><th scope="row">Package Sent</th><td>'+res.package_sent+"</td></tr>"+'<tr><th scope="row">Package Received</th><td>'+res.package_received+"</td></tr>"+'<tr><th scope="row">Package Loss</th><td>'+res.package_loss+"</td></tr>";$(".ping_result tbody").html(html);$(".send_ping").removeAttr("disabled");$(".send_ping").html("Ping");$("#ping_modal .form-control").removeAttr("disabled")}})});$(".send_traceroute").on("click",function(){$(this).attr("disabled","disabled");$(this).html("Tracing...");$("#traceroute_modal .form-control").attr("disabled","disabled");$.ajax({url:"/traceroute_ip",method:"POST",data:"ip="+$(":selected",$("#traceroute_modal .ip_dropdown")).val(),success:function(res){$(".traceroute_result tbody").html("");res.forEach(ele=>$(".traceroute_result tbody").append('<tr><th scope="row">'+ele.hop+"</th><td>"+ele.ip+"</td><td>"+ele.avg_rtt+"</td><td>"+ele.min_rtt+"</td><td>"+ele.max_rtt+"</td></tr>"));$(".send_traceroute").removeAttr("disabled").html("Traceroute");$("#traceroute_modal .form-control").removeAttr("disabled")}})});let numberToast=0;function showToast(msg,isDanger=false){$(".toastContainer").append(`<div id="${numberToast}-toast" class="toast hide animate__animated animate__fadeInUp" role="alert" data-delay="5000">
|
||||
<div class="toast-header">
|
||||
<strong class="mr-auto">WGDashboard</strong>
|
||||
<button type="button" class="ml-2 mb-1 close" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body ${isDanger?"text-danger":""}">${msg}</div>
|
||||
<div class="toast-progressbar ${isDanger?"bg-danger":""}"></div>
|
||||
</div>`);$(`#${numberToast}-toast`).toast("show");$(`#${numberToast}-toast .toast-body`).html(msg);$(`#${numberToast}-toast .toast-progressbar`).css("transition",`width ${$(`#${numberToast}-toast .toast-progressbar`).parent().data("delay")}ms cubic-bezier(0, 0, 0, 0)`);$(`#${numberToast}-toast .toast-progressbar`).css("width","0px");let i=numberToast;setTimeout(function(){$(`#${i}-toast`).removeClass("animate__fadeInUp").addClass("animate__fadeOutRight")},4500);numberToast++}
|
1
src/static/js/wireguard.min.js
vendored
1
src/static/js/wireguard.min.js
vendored
File diff suppressed because one or more lines are too long
@ -184,7 +184,6 @@
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include "modal.html" %}
|
||||
<div class="position-fixed top-0 right-0 p-3 toastContainer" style="z-index: 5; right: 0; top: 50px;"></div>
|
||||
{% include "tools.html" %}
|
||||
@ -192,7 +191,7 @@
|
||||
{% include "footer.html" %}
|
||||
<script src="{{ url_for('static',filename='js/configuration.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/configurationTool.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/wireguard.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/wireguard.js') }}"></script>
|
||||
<script>
|
||||
configurations.setConfigurationName("{{ conf_data['name'] }}");
|
||||
configurations.setActiveConfigurationName();
|
||||
|
@ -1,4 +1,4 @@
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>
|
||||
<script src="{{ url_for('static',filename='js/tools.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/tools.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/pwa.js') }}"></script>
|
@ -156,10 +156,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include "tools.html" %}
|
||||
{% include "tools.html" %}
|
||||
</body>
|
||||
{% include "footer.html" %}
|
||||
<script src="{{ url_for('static',filename='js/wireguard.min.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/wireguard.js') }}"></script>
|
||||
<script src="{{ url_for('static',filename='js/index.js') }}"></script>
|
||||
|
||||
</html>
|
@ -371,58 +371,32 @@
|
||||
</div>
|
||||
<pre id="addCconfigurationAlertMessage" class="index-alert d-none"></pre>
|
||||
<form id="add_configuration_form">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationName">Configuration Name</label>
|
||||
<p id="editConfigurationName"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationAddress">Address</label>
|
||||
<p class="codeFont" id="editConfigurationAddress"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div>
|
||||
<label for="editConfigurationPrivateKey">Private Key <code>*</code></label>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control codeFont" id="editConfigurationPrivateKey"
|
||||
name="editConfigurationPrivateKey" required>
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-danger" id="reGeneratePrivateKey"
|
||||
data-toggle="tooltip" data-placement="top" title="Regenerate Key"><i
|
||||
class="bi bi-arrow-repeat"></i></button>
|
||||
</div>
|
||||
<div id="editConfigurationPrivateKeyFeedback" class="input-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationName">Configuration Name <code>*</code></label>
|
||||
<input type="text" class="form-control" id="editConfigurationName"
|
||||
name="editConfigurationName" required>
|
||||
<div id="editConfigurationNameFeedback" class="input-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationListenPort">Listen Port <code>*</code></label>
|
||||
<input type="number" class="form-control codeFont" id="editConfigurationListenPort"
|
||||
name="editConfigurationListenPort" required>
|
||||
<div id="editConfigurationListenPortFeedback" class="input-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationAddress">Address <code>*</code>
|
||||
|
||||
</label>
|
||||
<input type="text" class="form-control codeFont" id="editConfigurationAddress"
|
||||
placeholder="Ex: 192.168.0.1/24" name="editConfigurationAddress" required>
|
||||
<div id="editConfigurationAddressFeedback" class="input-feedback"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="form-group">
|
||||
<label for=""># of available IPs</label>
|
||||
<p class="editConfigurationAvailableIPs">N/A</p>
|
||||
</div>
|
||||
</div>
|
||||
<label for="editConfigurationPrivateKey">Private Key</label>
|
||||
<p class="codeFont" id="editConfigurationPrivateKey"></p>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationListenPort">Listen Port <code>*</code></label>
|
||||
<input type="number" class="form-control codeFont" id="editConfigurationListenPort"
|
||||
name="editConfigurationListenPort" required>
|
||||
<div id="editConfigurationListenPortFeedback" class="input-feedback"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="editConfigurationPreUp">PreUp</label>
|
||||
<input type="text" class="form-control codeFont" id="editConfigurationPreUp"
|
||||
@ -447,15 +421,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="editConfigurationBtn">Add</button>
|
||||
<div class="text-primary editConfigurationStatus editConfigurationAddStatus d-none">
|
||||
<div class="spinner-border spinner-border-sm" role="status"><span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
Editing Configuration
|
||||
</div>
|
||||
<div class="text-primary editConfigurationStatus editConfigurationToggleStatus d-none waiting">
|
||||
<i class="bi bi-circle"></i> Toggle Configuration
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" id="editConfigurationBtn">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -181,69 +181,9 @@
|
||||
</div>
|
||||
</div>
|
||||
{% include "tools.html" %}
|
||||
<div class="position-fixed top-0 right-0 p-3 toastContainer" style="z-index: 5; right: 0; top: 50px;"></div>
|
||||
</body>
|
||||
|
||||
{% include "footer.html" %}
|
||||
<script>
|
||||
$(".sb-settings-url").addClass("active")
|
||||
$(".confirm_modal").click(function () {
|
||||
$(".app_new_ip").html($("#app_ip")[0].value)
|
||||
$(".app_new_port").html($("#app_port")[0].value)
|
||||
})
|
||||
<script src="{{ url_for('static',filename='js/settings.js') }}"></script>
|
||||
|
||||
$(".confirm_restart").click(function () {
|
||||
$(".cancel_restart").remove()
|
||||
countdown = 7;
|
||||
$.post('/update_app_ip_port', $('.update_app_ip_port').serialize())
|
||||
url = $("#app_ip")[0].value + ":" + $("#app_port")[0].value;
|
||||
$(".confirm_restart").attr("disabled", "disabled")
|
||||
setInterval(function () {
|
||||
if (countdown === 0) {
|
||||
window.location.replace("http://" + url);
|
||||
}
|
||||
$(".confirm_restart").html("Redirecting you in " + countdown + " seconds.")
|
||||
countdown--;
|
||||
}, 1000)
|
||||
});
|
||||
|
||||
$(".change_path").click(function () {
|
||||
$(this).attr("disabled", "disabled");
|
||||
countdown = 5;
|
||||
setInterval(function () {
|
||||
if (countdown === 0) {
|
||||
location.reload()
|
||||
}
|
||||
$(".change_path").html("Redirecting you in " + countdown + " seconds.")
|
||||
countdown--;
|
||||
}, 1000)
|
||||
$.post('/update_wg_conf_path', $('.update_wg_conf_path').serialize())
|
||||
});
|
||||
|
||||
$(".bottomNavSettings").addClass("active");
|
||||
|
||||
|
||||
$(".theme-switch-btn").on("click", function(){
|
||||
if (!$(this).hasClass("active")){
|
||||
let theme = $(this).data("theme");
|
||||
$(".theme-switch-btn").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "/api/settings/setTheme",
|
||||
headers: {"Content-Type": "application/json"},
|
||||
data: JSON.stringify({"theme": theme})
|
||||
}).done(function(res){
|
||||
if (res.status == true){
|
||||
if (theme == "light"){
|
||||
$("#darkThemeCSS").remove();
|
||||
}else{
|
||||
$("head").append('<link rel="stylesheet" type="text/css" href="/static/css/theme/dark.min.css" id="darkThemeCSS">');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user