init
This commit is contained in:
commit
95d648aaa0
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
/src/node_modules
|
10
.env
Normal file
10
.env
Normal file
@ -0,0 +1,10 @@
|
||||
WG_HOST=🚨YOUR_SERVER_IP
|
||||
PASSWORD=password
|
||||
# (Supports: en, ru, tr, no, pl, fr, de, ca, es)
|
||||
LANGUAGE=ru
|
||||
PORT=51821
|
||||
WG_DEVICE=eth0
|
||||
WG_PORT=51820
|
||||
WG_DEFAULT_ADDRESS=10.8.0.x
|
||||
WG_DEFAULT_DNS=1.1.1.1
|
||||
WG_ALLOWED_IPS=0.0.0.0/0, ::/0
|
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/config
|
||||
/wg0.conf
|
||||
/wg0.json
|
||||
/src/node_modules
|
||||
.DS_Store
|
||||
*.swp
|
48
Dockerfile
Normal file
48
Dockerfile
Normal file
@ -0,0 +1,48 @@
|
||||
# As a workaround we have to build on nodejs 18
|
||||
# nodejs 20 hangs on build with armv6/armv7
|
||||
FROM docker.io/library/node:18-alpine AS build_node_modules
|
||||
|
||||
# Update npm to latest
|
||||
RUN npm install -g npm@latest
|
||||
|
||||
# Copy Web UI
|
||||
COPY src /app
|
||||
WORKDIR /app
|
||||
RUN npm ci --omit=dev &&\
|
||||
mv node_modules /node_modules
|
||||
|
||||
# Copy build result to a new image.
|
||||
# This saves a lot of disk space.
|
||||
FROM amneziavpn/amnezia-wg:latest
|
||||
HEALTHCHECK CMD /usr/bin/timeout 5s /bin/sh -c "/usr/bin/wg show | /bin/grep -q interface || exit 1" --interval=1m --timeout=5s --retries=3
|
||||
COPY --from=build_node_modules /app /app
|
||||
|
||||
# Install Node.js
|
||||
RUN apk add --no-cache \
|
||||
nodejs \
|
||||
npm
|
||||
|
||||
# Move node_modules one directory up, so during development
|
||||
# we don't have to mount it in a volume.
|
||||
# This results in much faster reloading!
|
||||
#
|
||||
# Also, some node_modules might be native, and
|
||||
# the architecture & OS of your development machine might differ
|
||||
# than what runs inside of docker.
|
||||
COPY --from=build_node_modules /node_modules /node_modules
|
||||
|
||||
# Install Linux packages
|
||||
RUN apk add --no-cache \
|
||||
dpkg \
|
||||
dumb-init \
|
||||
iptables
|
||||
|
||||
# Use iptables-legacy
|
||||
RUN update-alternatives --install /sbin/iptables iptables /sbin/iptables-legacy 10 --slave /sbin/iptables-restore iptables-restore /sbin/iptables-legacy-restore --slave /sbin/iptables-save iptables-save /sbin/iptables-legacy-save
|
||||
|
||||
# Set Environment
|
||||
ENV DEBUG=Server,WireGuard
|
||||
|
||||
# Run Web UI
|
||||
WORKDIR /app
|
||||
CMD ["/usr/bin/dumb-init", "node", "server.js"]
|
437
LICENSE
Normal file
437
LICENSE
Normal file
@ -0,0 +1,437 @@
|
||||
Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||
does not provide legal services or legal advice. Distribution of
|
||||
Creative Commons public licenses does not create a lawyer-client or
|
||||
other relationship. Creative Commons makes its licenses and related
|
||||
information available on an "as-is" basis. Creative Commons gives no
|
||||
warranties regarding its licenses, any material licensed under their
|
||||
terms and conditions, or any related information. Creative Commons
|
||||
disclaims all liability for damages resulting from their use to the
|
||||
fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and
|
||||
conditions that creators and other rights holders may use to share
|
||||
original works of authorship and other material subject to copyright
|
||||
and certain other rights specified in the public license below. The
|
||||
following considerations are for informational purposes only, are not
|
||||
exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are
|
||||
intended for use by those authorized to give the public
|
||||
permission to use material in ways otherwise restricted by
|
||||
copyright and certain other rights. Our licenses are
|
||||
irrevocable. Licensors should read and understand the terms
|
||||
and conditions of the license they choose before applying it.
|
||||
Licensors should also secure all rights necessary before
|
||||
applying our licenses so that the public can reuse the
|
||||
material as expected. Licensors should clearly mark any
|
||||
material not subject to the license. This includes other CC-
|
||||
licensed material, or material used under an exception or
|
||||
limitation to copyright. More considerations for licensors:
|
||||
wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public
|
||||
licenses, a licensor grants the public permission to use the
|
||||
licensed material under specified terms and conditions. If
|
||||
the licensor's permission is not necessary for any reason--for
|
||||
example, because of any applicable exception or limitation to
|
||||
copyright--then that use is not regulated by the license. Our
|
||||
licenses grant only permissions under copyright and certain
|
||||
other rights that a licensor has authority to grant. Use of
|
||||
the licensed material may still be restricted for other
|
||||
reasons, including because others have copyright or other
|
||||
rights in the material. A licensor may make special requests,
|
||||
such as asking that all changes be marked or described.
|
||||
Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations
|
||||
for the public:
|
||||
wiki.creativecommons.org/Considerations_for_licensees
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution-NonCommercial-ShareAlike 4.0 International Public License
|
||||
("Public License"). To the extent this Public License may be
|
||||
interpreted as a contract, You are granted the Licensed Rights in
|
||||
consideration of Your acceptance of these terms and conditions, and the
|
||||
Licensor grants You such rights in consideration of benefits the
|
||||
Licensor receives from making the Licensed Material available under
|
||||
these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. BY-NC-SA Compatible License means a license listed at
|
||||
creativecommons.org/compatiblelicenses, approved by Creative
|
||||
Commons as essentially the equivalent of this Public License.
|
||||
|
||||
d. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
e. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
g. License Elements means the license attributes listed in the name
|
||||
of a Creative Commons Public License. The License Elements of this
|
||||
Public License are Attribution, NonCommercial, and ShareAlike.
|
||||
|
||||
h. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
i. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
j. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
k. NonCommercial means not primarily intended for or directed towards
|
||||
commercial advantage or monetary compensation. For purposes of
|
||||
this Public License, the exchange of the Licensed Material for
|
||||
other material subject to Copyright and Similar Rights by digital
|
||||
file-sharing or similar means is NonCommercial provided there is
|
||||
no payment of monetary compensation in connection with the
|
||||
exchange.
|
||||
|
||||
l. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
m. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
n. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part, for NonCommercial purposes only; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material for
|
||||
NonCommercial purposes only.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. Additional offer from the Licensor -- Adapted Material.
|
||||
Every recipient of Adapted Material from You
|
||||
automatically receives an offer from the Licensor to
|
||||
exercise the Licensed Rights in the Adapted Material
|
||||
under the conditions of the Adapter's License You apply.
|
||||
|
||||
c. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties, including when
|
||||
the Licensed Material is used other than for NonCommercial
|
||||
purposes.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
b. ShareAlike.
|
||||
|
||||
In addition to the conditions in Section 3(a), if You Share
|
||||
Adapted Material You produce, the following conditions also apply.
|
||||
|
||||
1. The Adapter's License You apply must be a Creative Commons
|
||||
license with the same License Elements, this version or
|
||||
later, or a BY-NC-SA Compatible License.
|
||||
|
||||
2. You must include the text of, or the URI or hyperlink to, the
|
||||
Adapter's License You apply. You may satisfy this condition
|
||||
in any reasonable manner based on the medium, means, and
|
||||
context in which You Share Adapted Material.
|
||||
|
||||
3. You may not offer or impose any additional or different terms
|
||||
or conditions on, or apply any Effective Technological
|
||||
Measures to, Adapted Material that restrict exercise of the
|
||||
rights granted under the Adapter's License You apply.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database for NonCommercial purposes
|
||||
only;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material,
|
||||
including for purposes of Section 3(b); and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
144
README.md
Normal file
144
README.md
Normal file
@ -0,0 +1,144 @@
|
||||
# AmnewziaWG Easy
|
||||
|
||||
You have found the easiest way to install & manage AmneziaWG on any Linux host!
|
||||
|
||||
<p align="center">
|
||||
<img src="./assets/screenshot.png" width="802" />
|
||||
</p>
|
||||
|
||||
## Features
|
||||
|
||||
* All-in-one: AmneziaWG + Web UI.
|
||||
* Easy installation, simple to use.
|
||||
* List, create, edit, delete, enable & disable clients.
|
||||
* Download a client's configuration file.
|
||||
* Statistics for which clients are connected.
|
||||
* Tx/Rx charts for each connected client.
|
||||
* Gravatar support.
|
||||
* Automatic Light / Dark Mode
|
||||
* Multilanguage Support
|
||||
* UI_TRAFFIC_STATS (default off)
|
||||
|
||||
## Requirements
|
||||
|
||||
* A host with Docker installed.
|
||||
|
||||
## Versions
|
||||
|
||||
We provide more then 1 docker image to get, this will help you decide which one is best for you.
|
||||
|
||||
| tag | Branch | Example | Description |
|
||||
| - | - | - | - |
|
||||
| `latest` | production | `ghcr.io/wg-easy/wg-easy:latest` or `ghcr.io/wg-easy/wg-easy` | stable as possbile get bug fixes quickly when needed, deployed against `production`. |
|
||||
| `13` | production | `ghcr.io/wg-easy/wg-easy:13` | same as latest, stick to a version tag. |
|
||||
| `nightly` | master | `ghcr.io/wg-easy/wg-easy:nightly` | mostly unstable gets frequent package and code updates, deployed against `master`. |
|
||||
| `development` | pull requests | `ghcr.io/wg-easy/wg-easy:development` | used for development, testing code from PRs before landing into `master`. |
|
||||
|
||||
## Installation
|
||||
|
||||
### 1. Install Docker
|
||||
|
||||
If you haven't installed Docker yet, install it by running:
|
||||
|
||||
```bash
|
||||
curl -sSL https://get.docker.com | sh
|
||||
sudo usermod -aG docker $(whoami)
|
||||
exit
|
||||
```
|
||||
|
||||
And log in again.
|
||||
|
||||
### 2. Run AmneziaWG Easy
|
||||
|
||||
```
|
||||
docker run -d \
|
||||
--name=amnezia-wg-easy \
|
||||
-e LANGUAGE=en \
|
||||
-e WG_HOST=<🚨YOUR_SERVER_IP> \
|
||||
-e PASSWORD=<🚨YOUR_ADMIN_PASSWORD> \
|
||||
-e PORT=51821 \
|
||||
-e WG_PORT=51820 \
|
||||
-v ~/.amnezia-wg-easy:/etc/wireguard \
|
||||
-p 51820:51820/udp \
|
||||
-p 51821:51821/tcp \
|
||||
--cap-add=NET_ADMIN \
|
||||
--cap-add=SYS_MODULE \
|
||||
--sysctl="net.ipv4.conf.all.src_valid_mark=1" \
|
||||
--sysctl="net.ipv4.ip_forward=1" \
|
||||
--device=/dev/net/tun:/dev/net/tun \
|
||||
--restart unless-stopped \
|
||||
ghcr.io/spcfox/amnezia-wg-easy
|
||||
```
|
||||
|
||||
> 💡 Replace `YOUR_SERVER_IP` with your WAN IP, or a Dynamic DNS hostname.
|
||||
>
|
||||
> 💡 Replace `YOUR_ADMIN_PASSWORD` with a password to log in on the Web UI.
|
||||
|
||||
The Web UI will now be available on `http://0.0.0.0:51821`.
|
||||
|
||||
> 💡 Your configuration files will be saved in `~/.amnezia-wg-easy`
|
||||
|
||||
AmneziaWG Easy can be launched with Docker Compose as well - just download
|
||||
[`docker-compose.yml`](docker-compose.yml), make necessary adjustments and
|
||||
execute `docker compose up --detach`.
|
||||
|
||||
## Options
|
||||
|
||||
These options can be configured by setting environment variables using `-e KEY="VALUE"` in the `docker run` command.
|
||||
|
||||
| Env | Default | Example | Description |
|
||||
| - | - | - | - |
|
||||
| `LANGUAGE` | `en` | `de` | Web UI language (Supports: en, ru, tr, no, pl, fr, de, ca, es). |
|
||||
| `CHECK_UPDATE` | `true` | `false` | Check for a new version and display a notification about its availability |
|
||||
| `PORT` | `51821` | `6789` | TCP port for Web UI. |
|
||||
| `WEBUI_HOST` | `0.0.0.0` | `localhost` | IP address web UI binds to. |
|
||||
| `PASSWORD` | - | `foobar123` | When set, requires a password when logging in to the Web UI. |
|
||||
| `WG_HOST` | - | `vpn.myserver.com` | The public hostname of your VPN server. |
|
||||
| `WG_DEVICE` | `eth0` | `ens6f0` | Ethernet device the AmneziaWG traffic should be forwarded through. |
|
||||
| `WG_PORT` | `51820` | `12345` | The public UDP port of your VPN server. AmneziaWG will listen on that (othwise default) inside the Docker container. |
|
||||
| `WG_MTU` | `null` | `1420` | The MTU the clients will use. Server uses default WG MTU. |
|
||||
| `WG_PERSISTENT_KEEPALIVE` | `0` | `25` | Value in seconds to keep the "connection" open. If this value is 0, then connections won't be kept alive. |
|
||||
| `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. |
|
||||
| `WG_DEFAULT_DNS` | `1.1.1.1` | `8.8.8.8, 8.8.4.4` | DNS server clients will use. If set to blank value, clients will not use any DNS. |
|
||||
| `WG_ALLOWED_IPS` | `0.0.0.0/0, ::/0` | `192.168.15.0/24, 10.0.1.0/24` | Allowed IPs clients will use. |
|
||||
| `WG_PRE_UP` | `...` | - | See [config.js](/src/config.js#L21) for the default value. |
|
||||
| `WG_POST_UP` | `...` | `iptables ...` | See [config.js](/src/config.js#L22) for the default value. |
|
||||
| `WG_PRE_DOWN` | `...` | - | See [config.js](/src/config.js#L29) for the default value. |
|
||||
| `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](/src/config.js#L30) for the default value. |
|
||||
| `UI_TRAFFIC_STATS` | `false` | `true` | Enable detailed RX / TX client stats in Web UI |
|
||||
| `UI_CHART_TYPE` | `0` | `1` | UI_CHART_TYPE=0 # Charts disabled, UI_CHART_TYPE=1 # Line chart, UI_CHART_TYPE=2 # Area chart, UI_CHART_TYPE=3 # Bar chart |
|
||||
| `JC` | `random` | `5` | Junk packet count — number of packets with random data that are sent before the start of the session. |
|
||||
| `JMIN` | `50` | `25` | Junk packet minimum size — minimum packet size for Junk packet. That is, all randomly generated packets will have a size no smaller than Jmin. |
|
||||
| `JMAX` | `1000` | `250` | Junk packet maximum size — maximum size for Junk packets. |
|
||||
| `S1` | `random` | `75` | Init packet junk size — the size of random data that will be added to the init packet, the size of which is initially fixed. |
|
||||
| `S2` | `random` | `75` | Response packet junk size — the size of random data that will be added to the response packet, the size of which is initially fixed. |
|
||||
| `H1` | `random` | `1234567891` | Init packet magic header — the header of the first byte of the handshake. Must be < uint_max. |
|
||||
| `H2` | `random` | `1234567892` | Response packet magic header — header of the first byte of the handshake response. Must be < uint_max. |
|
||||
| `H3` | `random` | `1234567893` | Underload packet magic header — UnderLoad packet header. Must be < uint_max. |
|
||||
| `H4` | `random` | `1234567894` | Transport packet magic header — header of the packet of the data packet. Must be < uint_max. |
|
||||
|
||||
> If you change `WG_PORT`, make sure to also change the exposed port.
|
||||
|
||||
## Updating
|
||||
|
||||
To update to the latest version, simply run:
|
||||
|
||||
```bash
|
||||
docker stop amnezia-wg-easy
|
||||
docker rm amnezia-wg-easy
|
||||
docker pull ghcr.io/spcfox/amnezia-wg-easy
|
||||
```
|
||||
|
||||
And then run the `docker run -d \ ...` command above again.
|
||||
|
||||
With Docker Compose AmneziaWG Easy can be updated with a single command:
|
||||
`docker compose up --detach --pull always` (if an image tag is specified in the
|
||||
Compose file and it is not `latest`, make sure that it is changed to the desired
|
||||
one; by default it is omitted and
|
||||
[defaults to `latest`](https://docs.docker.com/engine/reference/run/#image-references)). \
|
||||
The WireGuared Easy container will be automatically recreated if a newer image
|
||||
was pulled.
|
||||
|
||||
## Thanks
|
||||
|
||||
Based on [wg-easy](https://github.com/wg-easy/wg-easy) by Emile Nijssen.
|
BIN
assets/screenshot.png
Normal file
BIN
assets/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
100
contributing.md
Normal file
100
contributing.md
Normal file
@ -0,0 +1,100 @@
|
||||
# Contributing to amnezia-wg-easy
|
||||
|
||||
First and foremost, thank you! We appreciate that you want to contribute to amnezia-wg-easy, your time is valuable, and your contributions mean a lot to us.
|
||||
|
||||
|
||||
## Important!
|
||||
|
||||
By contributing to this project, you:
|
||||
|
||||
* Agree that you have authored 100% of the content
|
||||
* Agree that you have the necessary rights to the content
|
||||
* Agree that you have received the necessary permissions from your employer to make the contributions (if applicable)
|
||||
* Agree that the content you contribute may be provided under the Project license(s)
|
||||
* Agree that, if you did not author 100% of the content, the appropriate licenses and copyrights have been added along with any other necessary attribution.
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
**What does "contributing" mean?**
|
||||
|
||||
Creating an issue is the simplest form of contributing to a project. But there are many ways to contribute, including the following:
|
||||
|
||||
- Updating or correcting documentation
|
||||
- Feature requests
|
||||
- Bug reports
|
||||
|
||||
|
||||
## Showing support for amnezia-wg-easy
|
||||
|
||||
Please keep in mind that open source software is built by people like you, who spend their free time creating things the rest the community can use.
|
||||
|
||||
Don't have time to contribute? No worries, here are some other ways to show your support for amnezia-wg-easy:
|
||||
|
||||
- star the [project](https://github.com/spcfox/amnezia-wg-easy)
|
||||
|
||||
|
||||
## Issues
|
||||
|
||||
Please only create issues for bug reports or feature requests. Issues discussing any other topics may be closed by the project's maintainers without further explanation.
|
||||
|
||||
Do not create issues about bumping dependencies unless a bug has been identified and you can demonstrate that it effects this library.
|
||||
|
||||
**Help us to help you**
|
||||
|
||||
Remember that we’re here to help, but not to make guesses about what you need help with:
|
||||
|
||||
- Whatever bug or issue you're experiencing, assume that it will not be as obvious to the maintainers as it is to you.
|
||||
- Spell it out completely. Keep in mind that maintainers need to think about _all potential use cases_ of a library. It's important that you explain how you're using a library so that maintainers can make that connection and solve the issue.
|
||||
|
||||
_It can't be understated how frustrating and draining it can be to maintainers to have to ask clarifying questions on the most basic things, before it's even possible to start debugging. Please try to make the best use of everyone's time involved, including yourself, by providing this information up front._
|
||||
|
||||
### Before creating an issue
|
||||
|
||||
Please try to determine if the issue is caused by an underlying library, and if so, create the issue there. Sometimes this is difficult to know. We only ask that you attempt to give a reasonable attempt to find out. Oftentimes the readme will have advice about where to go to create issues.
|
||||
|
||||
Try to follow these guidelines:
|
||||
|
||||
- **Avoid creating issues for implementation help** - It's much better for discoverability, SEO, and semantics - to keep the issue tracker focused on bugs and feature requests - to ask implementation-related questions on [stackoverflow.com][so]
|
||||
- **Investigate the issue** - Search for exising issues (open or closed) that address the issue, and might have even resolved it already.
|
||||
- **Check the readme** - oftentimes you will find notes about creating issues, and where to go depending on the type of issue.
|
||||
- Create the issue in the appropriate repository.
|
||||
|
||||
### Creating an issue
|
||||
|
||||
Please be as descriptive as possible when creating an issue. Give us the information we need to successfully answer your question or address your issue by answering the following in your issue:
|
||||
|
||||
- **description**: (required) What is the bug you're experiencing? How are you using this library/app?
|
||||
- **OS**: (required) what operating system are you on?
|
||||
- **version**: (required) please note the version of amnezia-wg-easy are you using
|
||||
- **error messages**: (required) please paste any error messages into the issue, or a [gist](https://gist.github.com/)
|
||||
- **extensions, plugins, helpers, etc** (if applicable): please list any extensions you're using
|
||||
|
||||
|
||||
### Closing issues
|
||||
|
||||
The original poster or the maintainers of amnezia-wg-easy may close an issue at any time. Typically, but not exclusively, issues are closed when:
|
||||
|
||||
- The issue is resolved
|
||||
- The project's maintainers have determined the issue is out of scope
|
||||
- An issue is clearly a duplicate of another issue, in which case the duplicate issue will be linked.
|
||||
- A discussion has clearly run its course
|
||||
|
||||
|
||||
## Next steps
|
||||
|
||||
**Tips for creating idiomatic issues**
|
||||
|
||||
Spending just a little extra time to review best practices and brush up on your contributing skills will, at minimum, make your issue easier to read, easier to resolve, and more likely to be found by others who have the same or similar issue in the future. At best, it will open up doors and potential career opportunities by helping you be at your best.
|
||||
|
||||
The following resources were hand-picked to help you be the most effective contributor you can be:
|
||||
|
||||
- The [Guide to Idiomatic Contributing](https://github.com/jonschlinkert/idiomatic-contributing) is a great place for newcomers to start, but there is also information for experienced contributors there.
|
||||
- Take some time to learn basic markdown. We can't stress this enough. Don't start pasting code into GitHub issues before you've taken a moment to review this [markdown cheatsheet](https://gist.github.com/jonschlinkert/5854601)
|
||||
- The GitHub guide to [basic markdown](https://help.github.com/articles/markdown-basics/) is another great markdown resource.
|
||||
- Learn about [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown/). And if you want to really go above and beyond, read [mastering markdown](https://guides.github.com/features/mastering-markdown/).
|
||||
|
||||
At the very least, please try to:
|
||||
|
||||
- Use backticks to wrap code. This ensures that it retains its formatting and isn't modified when it's rendered by GitHub, and makes the code more readable to others
|
||||
- When applicable, use syntax highlighting by adding the correct language name after the first "code fence"
|
23
docker-compose.yml
Normal file
23
docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
||||
volumes:
|
||||
etc_amneziawg:
|
||||
|
||||
services:
|
||||
amnezia-wg-easy:
|
||||
env_file:
|
||||
- .env
|
||||
image: ghcr.io/spcfox/amnezia-wg-easy
|
||||
container_name: amnezia-wg-easy
|
||||
volumes:
|
||||
- ~/.amnezia-wg-easy:/etc/wireguard
|
||||
ports:
|
||||
- "${WG_PORT}:51820/udp"
|
||||
- "${PORT}:${PORT}/tcp"
|
||||
restart: unless-stopped
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- SYS_MODULE
|
||||
sysctls:
|
||||
- net.ipv4.ip_forward=1
|
||||
- net.ipv4.conf.all.src_valid_mark=1
|
||||
devices:
|
||||
- /dev/net/tun:/dev/net/tun
|
4
docs/changelog.json
Normal file
4
docs/changelog.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"1": "Initial version. Enjoy!",
|
||||
"2": "UI_TRAFFIC_STATS, UI_CHART_TYPE, other upgrades from wg-easy and bugfixes."
|
||||
}
|
11
package-lock.json
generated
Normal file
11
package-lock.json
generated
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "amnezia-wg-easy",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
7
package.json
Normal file
7
package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "DOCKER_BUILDKIT=1 docker build --tag amnezia-wg-easy .",
|
||||
"start": "docker run --env WG_HOST=0.0.0.0 --name amnezia-wg-easy --device=/dev/net/tun:/dev/net/tun --cap-add=NET_ADMIN --cap-add=SYS_MODULE --sysctl=\"net.ipv4.conf.all.src_valid_mark=1\" --mount type=bind,source=\"$(pwd)\"/config,target=/etc/wireguard -p 51820:51820/udp -p 51821:51821/tcp amnezia-wg-easy"
|
||||
}
|
||||
}
|
11
src/.eslintrc.json
Normal file
11
src/.eslintrc.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "athom",
|
||||
"ignorePatterns": [
|
||||
"**/vendor/*.js"
|
||||
],
|
||||
"rules": {
|
||||
"consistent-return": "off",
|
||||
"no-shadow": "off",
|
||||
"max-len": "off"
|
||||
}
|
||||
}
|
53
src/config.js
Normal file
53
src/config.js
Normal file
@ -0,0 +1,53 @@
|
||||
'use strict';
|
||||
|
||||
const { release } = require('./package.json');
|
||||
|
||||
module.exports.CHECK_UPDATE = process.env.CHECK_UPDATE ? process.env.CHECK_UPDATE.toLowerCase() === 'true' : true;
|
||||
module.exports.RELEASE = release;
|
||||
module.exports.PORT = process.env.PORT || '51821';
|
||||
module.exports.WEBUI_HOST = process.env.WEBUI_HOST || '0.0.0.0';
|
||||
module.exports.PASSWORD = process.env.PASSWORD;
|
||||
module.exports.WG_PATH = process.env.WG_PATH || '/etc/wireguard/';
|
||||
module.exports.WG_DEVICE = process.env.WG_DEVICE || 'eth0';
|
||||
module.exports.WG_HOST = process.env.WG_HOST;
|
||||
module.exports.WG_PORT = process.env.WG_PORT || '51820';
|
||||
module.exports.WG_MTU = process.env.WG_MTU || null;
|
||||
module.exports.WG_PERSISTENT_KEEPALIVE = process.env.WG_PERSISTENT_KEEPALIVE || '0';
|
||||
module.exports.WG_DEFAULT_ADDRESS = process.env.WG_DEFAULT_ADDRESS || '10.8.0.x';
|
||||
module.exports.WG_DEFAULT_DNS = typeof process.env.WG_DEFAULT_DNS === 'string'
|
||||
? process.env.WG_DEFAULT_DNS
|
||||
: '1.1.1.1';
|
||||
module.exports.WG_ALLOWED_IPS = process.env.WG_ALLOWED_IPS || '0.0.0.0/0, ::/0';
|
||||
|
||||
module.exports.WG_PRE_UP = process.env.WG_PRE_UP || '';
|
||||
module.exports.WG_POST_UP = process.env.WG_POST_UP || `
|
||||
iptables -t nat -A POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE;
|
||||
iptables -A INPUT -p udp -m udp --dport ${module.exports.WG_PORT} -j ACCEPT;
|
||||
iptables -A FORWARD -i wg0 -j ACCEPT;
|
||||
iptables -A FORWARD -o wg0 -j ACCEPT;
|
||||
`.split('\n').join(' ');
|
||||
|
||||
module.exports.WG_PRE_DOWN = process.env.WG_PRE_DOWN || '';
|
||||
module.exports.WG_POST_DOWN = process.env.WG_POST_DOWN || `
|
||||
iptables -t nat -D POSTROUTING -s ${module.exports.WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ${module.exports.WG_DEVICE} -j MASQUERADE;
|
||||
iptables -D INPUT -p udp -m udp --dport ${module.exports.WG_PORT} -j ACCEPT;
|
||||
iptables -D FORWARD -i wg0 -j ACCEPT;
|
||||
iptables -D FORWARD -o wg0 -j ACCEPT;
|
||||
`.split('\n').join(' ');
|
||||
module.exports.LANG = process.env.LANGUAGE || 'en';
|
||||
module.exports.UI_TRAFFIC_STATS = process.env.UI_TRAFFIC_STATS || 'false';
|
||||
module.exports.UI_CHART_TYPE = process.env.UI_CHART_TYPE || 0;
|
||||
|
||||
const getRandomInt = (min, max) => min + Math.floor(Math.random() * (max - min));
|
||||
const getRandomJunkSize = () => getRandomInt(15, 150);
|
||||
const getRandomHeader = () => getRandomInt(1, 2_147_483_647);
|
||||
|
||||
module.exports.JC = process.env.JC || getRandomInt(3, 10);
|
||||
module.exports.JMIN = process.env.JMIN || 50;
|
||||
module.exports.JMAX = process.env.JMAX || 1000;
|
||||
module.exports.S1 = process.env.S1 || getRandomJunkSize();
|
||||
module.exports.S2 = process.env.S2 || getRandomJunkSize();
|
||||
module.exports.H1 = process.env.H1 || getRandomHeader();
|
||||
module.exports.H2 = process.env.H2 || getRandomHeader();
|
||||
module.exports.H3 = process.env.H3 || getRandomHeader();
|
||||
module.exports.H4 = process.env.H4 || getRandomHeader();
|
270
src/lib/Server.js
Normal file
270
src/lib/Server.js
Normal file
@ -0,0 +1,270 @@
|
||||
'use strict';
|
||||
|
||||
const crypto = require('node:crypto');
|
||||
const { createServer } = require('node:http');
|
||||
const { stat, readFile } = require('node:fs/promises');
|
||||
const { resolve, sep } = require('node:path');
|
||||
|
||||
const expressSession = require('express-session');
|
||||
const debug = require('debug')('Server');
|
||||
|
||||
const {
|
||||
createApp,
|
||||
createError,
|
||||
createRouter,
|
||||
defineEventHandler,
|
||||
fromNodeMiddleware,
|
||||
getRouterParam,
|
||||
toNodeListener,
|
||||
readBody,
|
||||
setHeader,
|
||||
serveStatic,
|
||||
} = require('h3');
|
||||
|
||||
const WireGuard = require('../services/WireGuard');
|
||||
|
||||
const {
|
||||
CHECK_UPDATE,
|
||||
PORT,
|
||||
WEBUI_HOST,
|
||||
RELEASE,
|
||||
PASSWORD,
|
||||
LANG,
|
||||
UI_TRAFFIC_STATS,
|
||||
UI_CHART_TYPE,
|
||||
} = require('../config');
|
||||
|
||||
module.exports = class Server {
|
||||
|
||||
constructor() {
|
||||
const app = createApp();
|
||||
this.app = app;
|
||||
|
||||
app.use(fromNodeMiddleware(expressSession({
|
||||
secret: crypto.randomBytes(256).toString('hex'),
|
||||
resave: true,
|
||||
saveUninitialized: true,
|
||||
})));
|
||||
|
||||
const router = createRouter();
|
||||
app.use(router);
|
||||
|
||||
router
|
||||
.get('/api/release', defineEventHandler((event) => {
|
||||
setHeader(event, 'Content-Type', 'application/json');
|
||||
return RELEASE;
|
||||
}))
|
||||
|
||||
.get('/api/check-update', defineEventHandler((event) => {
|
||||
setHeader(event, 'Content-Type', 'application/json');
|
||||
return CHECK_UPDATE;
|
||||
}))
|
||||
|
||||
.get('/api/lang', defineEventHandler((event) => {
|
||||
setHeader(event, 'Content-Type', 'application/json');
|
||||
return `"${LANG}"`;
|
||||
}))
|
||||
|
||||
.get('/api/ui-traffic-stats', defineEventHandler((event) => {
|
||||
setHeader(event, 'Content-Type', 'application/json');
|
||||
return UI_TRAFFIC_STATS;
|
||||
}))
|
||||
|
||||
.get('/api/ui-chart-type', defineEventHandler((event) => {
|
||||
setHeader(event, 'Content-Type', 'application/json');
|
||||
return `"${UI_CHART_TYPE}"`;
|
||||
}))
|
||||
|
||||
// Authentication
|
||||
.get('/api/session', defineEventHandler((event) => {
|
||||
const requiresPassword = !!process.env.PASSWORD;
|
||||
const authenticated = requiresPassword
|
||||
? !!(event.node.req.session && event.node.req.session.authenticated)
|
||||
: true;
|
||||
|
||||
return {
|
||||
requiresPassword,
|
||||
authenticated,
|
||||
};
|
||||
}))
|
||||
.post('/api/session', defineEventHandler(async (event) => {
|
||||
const { password } = await readBody(event);
|
||||
|
||||
if (typeof password !== 'string') {
|
||||
throw createError({
|
||||
status: 401,
|
||||
message: 'Missing: Password',
|
||||
});
|
||||
}
|
||||
|
||||
if (password !== PASSWORD) {
|
||||
throw createError({
|
||||
status: 401,
|
||||
message: 'Incorrect Password',
|
||||
});
|
||||
}
|
||||
|
||||
event.node.req.session.authenticated = true;
|
||||
event.node.req.session.save();
|
||||
|
||||
debug(`New Session: ${event.node.req.session.id}`);
|
||||
|
||||
return { succcess: true };
|
||||
}));
|
||||
|
||||
// WireGuard
|
||||
app.use(
|
||||
fromNodeMiddleware((req, res, next) => {
|
||||
if (!PASSWORD || !req.url.startsWith('/api/')) {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (req.session && req.session.authenticated) {
|
||||
return next();
|
||||
}
|
||||
|
||||
return res.status(401).json({
|
||||
error: 'Not Logged In',
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
const router2 = createRouter();
|
||||
app.use(router2);
|
||||
|
||||
router2
|
||||
.delete('/api/session', defineEventHandler((event) => {
|
||||
const sessionId = event.node.req.session.id;
|
||||
|
||||
event.node.req.session.destroy();
|
||||
|
||||
debug(`Deleted Session: ${sessionId}`);
|
||||
return { success: true };
|
||||
}))
|
||||
.get('/api/wireguard/client', defineEventHandler(() => {
|
||||
return WireGuard.getClients();
|
||||
}))
|
||||
.get('/api/wireguard/client/:clientId/qrcode.svg', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
const svg = await WireGuard.getClientQRCodeSVG({ clientId });
|
||||
setHeader(event, 'Content-Type', 'image/svg+xml');
|
||||
return svg;
|
||||
}))
|
||||
.get('/api/wireguard/client/:clientId/configuration', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
const client = await WireGuard.getClient({ clientId });
|
||||
const config = await WireGuard.getClientConfiguration({ clientId });
|
||||
const configName = client.name
|
||||
.replace(/[^a-zA-Z0-9_=+.-]/g, '-')
|
||||
.replace(/(-{2,}|-$)/g, '-')
|
||||
.replace(/-$/, '')
|
||||
.substring(0, 32);
|
||||
setHeader(event, 'Content-Disposition', `attachment; filename="${configName || clientId}.conf"`);
|
||||
setHeader(event, 'Content-Type', 'text/plain');
|
||||
return config;
|
||||
}))
|
||||
.post('/api/wireguard/client', defineEventHandler(async (event) => {
|
||||
const { name } = await readBody(event);
|
||||
await WireGuard.createClient({ name });
|
||||
return { success: true };
|
||||
}))
|
||||
.delete('/api/wireguard/client/:clientId', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
await WireGuard.deleteClient({ clientId });
|
||||
return { success: true };
|
||||
}))
|
||||
.post('/api/wireguard/client/:clientId/enable', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') {
|
||||
throw createError({ status: 403 });
|
||||
}
|
||||
await WireGuard.enableClient({ clientId });
|
||||
return { success: true };
|
||||
}))
|
||||
.post('/api/wireguard/client/:clientId/disable', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') {
|
||||
throw createError({ status: 403 });
|
||||
}
|
||||
await WireGuard.disableClient({ clientId });
|
||||
return { success: true };
|
||||
}))
|
||||
.put('/api/wireguard/client/:clientId/name', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') {
|
||||
throw createError({ status: 403 });
|
||||
}
|
||||
const { name } = await readBody(event);
|
||||
await WireGuard.updateClientName({ clientId, name });
|
||||
return { success: true };
|
||||
}))
|
||||
.put('/api/wireguard/client/:clientId/address', defineEventHandler(async (event) => {
|
||||
const clientId = getRouterParam(event, 'clientId');
|
||||
if (clientId === '__proto__' || clientId === 'constructor' || clientId === 'prototype') {
|
||||
throw createError({ status: 403 });
|
||||
}
|
||||
const { address } = await readBody(event);
|
||||
await WireGuard.updateClientAddress({ clientId, address });
|
||||
return { success: true };
|
||||
}));
|
||||
|
||||
const safePathJoin = (base, target) => {
|
||||
// Manage web root (edge case)
|
||||
if (target === '/') {
|
||||
return `${base}${sep}`;
|
||||
}
|
||||
|
||||
// Prepend './' to prevent absolute paths
|
||||
const targetPath = `.${sep}${target}`;
|
||||
|
||||
// Resolve the absolute path
|
||||
const resolvedPath = resolve(base, targetPath);
|
||||
|
||||
// Check if resolvedPath is a subpath of base
|
||||
if (resolvedPath.startsWith(`${base}${sep}`)) {
|
||||
return resolvedPath;
|
||||
}
|
||||
|
||||
throw createError({
|
||||
status: 400,
|
||||
message: 'Bad Request',
|
||||
});
|
||||
};
|
||||
|
||||
// Static assets
|
||||
const publicDir = '/app/www';
|
||||
app.use(
|
||||
defineEventHandler((event) => {
|
||||
return serveStatic(event, {
|
||||
getContents: (id) => {
|
||||
return readFile(safePathJoin(publicDir, id));
|
||||
},
|
||||
getMeta: async (id) => {
|
||||
const filePath = safePathJoin(publicDir, id);
|
||||
|
||||
const stats = await stat(filePath).catch(() => {});
|
||||
if (!stats || !stats.isFile()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (id.endsWith('.html')) setHeader(event, 'Content-Type', 'text/html');
|
||||
if (id.endsWith('.js')) setHeader(event, 'Content-Type', 'application/javascript');
|
||||
if (id.endsWith('.json')) setHeader(event, 'Content-Type', 'application/json');
|
||||
if (id.endsWith('.css')) setHeader(event, 'Content-Type', 'text/css');
|
||||
if (id.endsWith('.png')) setHeader(event, 'Content-Type', 'image/png');
|
||||
if (id.endsWith('.svg')) setHeader(event, 'Content-Type', 'image/svg+xml');
|
||||
|
||||
return {
|
||||
size: stats.size,
|
||||
mtime: stats.mtimeMs,
|
||||
};
|
||||
},
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
createServer(toNodeListener(app)).listen(PORT, WEBUI_HOST);
|
||||
debug(`Listening on http://${WEBUI_HOST}:${PORT}`);
|
||||
}
|
||||
|
||||
};
|
10
src/lib/ServerError.js
Normal file
10
src/lib/ServerError.js
Normal file
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = class ServerError extends Error {
|
||||
|
||||
constructor(message, statusCode = 500) {
|
||||
super(message);
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
};
|
80
src/lib/Util.js
Normal file
80
src/lib/Util.js
Normal file
@ -0,0 +1,80 @@
|
||||
'use strict';
|
||||
|
||||
const childProcess = require('child_process');
|
||||
|
||||
module.exports = class Util {
|
||||
|
||||
static isValidIPv4(str) {
|
||||
const blocks = str.split('.');
|
||||
if (blocks.length !== 4) return false;
|
||||
|
||||
for (let value of blocks) {
|
||||
value = parseInt(value, 10);
|
||||
if (Number.isNaN(value)) return false;
|
||||
if (value < 0 || value > 255) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static promisify(fn) {
|
||||
// eslint-disable-next-line func-names
|
||||
return function(req, res) {
|
||||
Promise.resolve().then(async () => fn(req, res))
|
||||
.then((result) => {
|
||||
if (res.headersSent) return;
|
||||
|
||||
if (typeof result === 'undefined') {
|
||||
return res
|
||||
.status(204)
|
||||
.end();
|
||||
}
|
||||
|
||||
return res
|
||||
.status(200)
|
||||
.json(result);
|
||||
})
|
||||
.catch((error) => {
|
||||
if (typeof error === 'string') {
|
||||
error = new Error(error);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
|
||||
return res
|
||||
.status(error.statusCode || 500)
|
||||
.json({
|
||||
error: error.message || error.toString(),
|
||||
stack: error.stack,
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
static async exec(cmd, {
|
||||
log = true,
|
||||
} = {}) {
|
||||
if (typeof log === 'string') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`$ ${log}`);
|
||||
} else if (log === true) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`$ ${cmd}`);
|
||||
}
|
||||
|
||||
if (process.platform !== 'linux') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
childProcess.exec(cmd, {
|
||||
shell: 'bash',
|
||||
}, (err, stdout) => {
|
||||
if (err) return reject(err);
|
||||
return resolve(String(stdout).trim());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
365
src/lib/WireGuard.js
Normal file
365
src/lib/WireGuard.js
Normal file
@ -0,0 +1,365 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('node:fs/promises');
|
||||
const path = require('path');
|
||||
const debug = require('debug')('WireGuard');
|
||||
const crypto = require('node:crypto');
|
||||
const QRCode = require('qrcode');
|
||||
|
||||
const Util = require('./Util');
|
||||
const ServerError = require('./ServerError');
|
||||
|
||||
const {
|
||||
WG_PATH,
|
||||
WG_HOST,
|
||||
WG_PORT,
|
||||
WG_MTU,
|
||||
WG_DEFAULT_DNS,
|
||||
WG_DEFAULT_ADDRESS,
|
||||
WG_PERSISTENT_KEEPALIVE,
|
||||
WG_ALLOWED_IPS,
|
||||
WG_PRE_UP,
|
||||
WG_POST_UP,
|
||||
WG_PRE_DOWN,
|
||||
WG_POST_DOWN,
|
||||
JC,
|
||||
JMIN,
|
||||
JMAX,
|
||||
S1,
|
||||
S2,
|
||||
H1,
|
||||
H2,
|
||||
H3,
|
||||
H4,
|
||||
} = require('../config');
|
||||
|
||||
module.exports = class WireGuard {
|
||||
|
||||
async getConfig() {
|
||||
if (!this.__configPromise) {
|
||||
this.__configPromise = Promise.resolve().then(async () => {
|
||||
if (!WG_HOST) {
|
||||
throw new Error('WG_HOST Environment Variable Not Set!');
|
||||
}
|
||||
|
||||
debug('Loading configuration...');
|
||||
let config;
|
||||
try {
|
||||
config = await fs.readFile(path.join(WG_PATH, 'wg0.json'), 'utf8');
|
||||
config = JSON.parse(config);
|
||||
debug('Configuration loaded.');
|
||||
} catch (err) {
|
||||
const privateKey = await Util.exec('wg genkey');
|
||||
const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`, {
|
||||
log: 'echo ***hidden*** | wg pubkey',
|
||||
});
|
||||
|
||||
const address = WG_DEFAULT_ADDRESS.replace('x', '1');
|
||||
|
||||
config = {
|
||||
server: {
|
||||
privateKey,
|
||||
publicKey,
|
||||
address,
|
||||
jc: JC,
|
||||
jmin: JMIN,
|
||||
jmax: JMAX,
|
||||
s1: S1,
|
||||
s2: S2,
|
||||
h1: H1,
|
||||
h2: H2,
|
||||
h3: H3,
|
||||
h4: H4,
|
||||
},
|
||||
clients: {},
|
||||
};
|
||||
|
||||
debug('Configuration generated.');
|
||||
}
|
||||
|
||||
await this.__saveConfig(config);
|
||||
await Util.exec('wg-quick down wg0').catch(() => { });
|
||||
await Util.exec('wg-quick up wg0').catch((err) => {
|
||||
if (err && err.message && err.message.includes('Cannot find device "wg0"')) {
|
||||
throw new Error('WireGuard exited with the error: Cannot find device "wg0"\nThis usually means that your host\'s kernel does not support WireGuard!');
|
||||
}
|
||||
|
||||
throw err;
|
||||
});
|
||||
// await Util.exec(`iptables -t nat -A POSTROUTING -s ${WG_DEFAULT_ADDRESS.replace('x', '0')}/24 -o ' + WG_DEVICE + ' -j MASQUERADE`);
|
||||
// await Util.exec('iptables -A INPUT -p udp -m udp --dport 51820 -j ACCEPT');
|
||||
// await Util.exec('iptables -A FORWARD -i wg0 -j ACCEPT');
|
||||
// await Util.exec('iptables -A FORWARD -o wg0 -j ACCEPT');
|
||||
await this.__syncConfig();
|
||||
|
||||
return config;
|
||||
});
|
||||
}
|
||||
|
||||
return this.__configPromise;
|
||||
}
|
||||
|
||||
async saveConfig() {
|
||||
const config = await this.getConfig();
|
||||
await this.__saveConfig(config);
|
||||
await this.__syncConfig();
|
||||
}
|
||||
|
||||
async __saveConfig(config) {
|
||||
let result = `
|
||||
# Note: Do not edit this file directly.
|
||||
# Your changes will be overwritten!
|
||||
|
||||
# Server
|
||||
[Interface]
|
||||
PrivateKey = ${config.server.privateKey}
|
||||
Address = ${config.server.address}/24
|
||||
ListenPort = ${WG_PORT}
|
||||
PreUp = ${WG_PRE_UP}
|
||||
PostUp = ${WG_POST_UP}
|
||||
PreDown = ${WG_PRE_DOWN}
|
||||
PostDown = ${WG_POST_DOWN}
|
||||
Jc = ${config.server.jc}
|
||||
Jmin = ${config.server.jmin}
|
||||
Jmax = ${config.server.jmax}
|
||||
S1 = ${config.server.s1}
|
||||
S2 = ${config.server.s2}
|
||||
H1 = ${config.server.h1}
|
||||
H2 = ${config.server.h2}
|
||||
H3 = ${config.server.h3}
|
||||
H4 = ${config.server.h4}
|
||||
Jc = ${config.server.jc}
|
||||
`;
|
||||
|
||||
for (const [clientId, client] of Object.entries(config.clients)) {
|
||||
if (!client.enabled) continue;
|
||||
|
||||
result += `
|
||||
|
||||
# Client: ${client.name} (${clientId})
|
||||
[Peer]
|
||||
PublicKey = ${client.publicKey}
|
||||
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : ''
|
||||
}AllowedIPs = ${client.address}/32`;
|
||||
}
|
||||
|
||||
debug('Config saving...');
|
||||
await fs.writeFile(path.join(WG_PATH, 'wg0.json'), JSON.stringify(config, false, 2), {
|
||||
mode: 0o660,
|
||||
});
|
||||
await fs.writeFile(path.join(WG_PATH, 'wg0.conf'), result, {
|
||||
mode: 0o600,
|
||||
});
|
||||
debug('Config saved.');
|
||||
}
|
||||
|
||||
async __syncConfig() {
|
||||
debug('Config syncing...');
|
||||
await Util.exec('wg syncconf wg0 <(wg-quick strip wg0)');
|
||||
debug('Config synced.');
|
||||
}
|
||||
|
||||
async getClients() {
|
||||
const config = await this.getConfig();
|
||||
const clients = Object.entries(config.clients).map(([clientId, client]) => ({
|
||||
id: clientId,
|
||||
name: client.name,
|
||||
enabled: client.enabled,
|
||||
address: client.address,
|
||||
publicKey: client.publicKey,
|
||||
createdAt: new Date(client.createdAt),
|
||||
updatedAt: new Date(client.updatedAt),
|
||||
allowedIPs: client.allowedIPs,
|
||||
downloadableConfig: 'privateKey' in client,
|
||||
persistentKeepalive: null,
|
||||
latestHandshakeAt: null,
|
||||
transferRx: null,
|
||||
transferTx: null,
|
||||
}));
|
||||
|
||||
// Loop WireGuard status
|
||||
const dump = await Util.exec('wg show wg0 dump', {
|
||||
log: false,
|
||||
});
|
||||
dump
|
||||
.trim()
|
||||
.split('\n')
|
||||
.slice(1)
|
||||
.forEach((line) => {
|
||||
const [
|
||||
publicKey,
|
||||
preSharedKey, // eslint-disable-line no-unused-vars
|
||||
endpoint, // eslint-disable-line no-unused-vars
|
||||
allowedIps, // eslint-disable-line no-unused-vars
|
||||
latestHandshakeAt,
|
||||
transferRx,
|
||||
transferTx,
|
||||
persistentKeepalive,
|
||||
] = line.split('\t');
|
||||
|
||||
const client = clients.find((client) => client.publicKey === publicKey);
|
||||
if (!client) return;
|
||||
|
||||
client.latestHandshakeAt = latestHandshakeAt === '0'
|
||||
? null
|
||||
: new Date(Number(`${latestHandshakeAt}000`));
|
||||
client.transferRx = Number(transferRx);
|
||||
client.transferTx = Number(transferTx);
|
||||
client.persistentKeepalive = persistentKeepalive;
|
||||
});
|
||||
|
||||
return clients;
|
||||
}
|
||||
|
||||
async getClient({ clientId }) {
|
||||
const config = await this.getConfig();
|
||||
const client = config.clients[clientId];
|
||||
if (!client) {
|
||||
throw new ServerError(`Client Not Found: ${clientId}`, 404);
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
async getClientConfiguration({ clientId }) {
|
||||
const config = await this.getConfig();
|
||||
const client = await this.getClient({ clientId });
|
||||
|
||||
return `
|
||||
[Interface]
|
||||
PrivateKey = ${client.privateKey ? `${client.privateKey}` : 'REPLACE_ME'}
|
||||
Address = ${client.address}
|
||||
${WG_DEFAULT_DNS ? `DNS = ${WG_DEFAULT_DNS}\n` : ''}\
|
||||
${WG_MTU ? `MTU = ${WG_MTU}\n` : ''}\
|
||||
Jc = ${config.server.jc}
|
||||
Jmin = ${config.server.jmin}
|
||||
Jmax = ${config.server.jmax}
|
||||
S1 = ${config.server.s1}
|
||||
S2 = ${config.server.s2}
|
||||
H1 = ${config.server.h1}
|
||||
H2 = ${config.server.h2}
|
||||
H3 = ${config.server.h3}
|
||||
H4 = ${config.server.h4}
|
||||
|
||||
[Peer]
|
||||
PublicKey = ${config.server.publicKey}
|
||||
${client.preSharedKey ? `PresharedKey = ${client.preSharedKey}\n` : ''
|
||||
}AllowedIPs = ${WG_ALLOWED_IPS}
|
||||
PersistentKeepalive = ${WG_PERSISTENT_KEEPALIVE}
|
||||
Endpoint = ${WG_HOST}:${WG_PORT}`;
|
||||
}
|
||||
|
||||
async getClientQRCodeSVG({ clientId }) {
|
||||
const config = await this.getClientConfiguration({ clientId });
|
||||
return QRCode.toString(config, {
|
||||
type: 'svg',
|
||||
width: 512,
|
||||
});
|
||||
}
|
||||
|
||||
async createClient({ name }) {
|
||||
if (!name) {
|
||||
throw new Error('Missing: Name');
|
||||
}
|
||||
|
||||
const config = await this.getConfig();
|
||||
|
||||
const privateKey = await Util.exec('wg genkey');
|
||||
const publicKey = await Util.exec(`echo ${privateKey} | wg pubkey`);
|
||||
const preSharedKey = await Util.exec('wg genpsk');
|
||||
|
||||
// Calculate next IP
|
||||
let address;
|
||||
for (let i = 2; i < 255; i++) {
|
||||
const client = Object.values(config.clients).find((client) => {
|
||||
return client.address === WG_DEFAULT_ADDRESS.replace('x', i);
|
||||
});
|
||||
|
||||
if (!client) {
|
||||
address = WG_DEFAULT_ADDRESS.replace('x', i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!address) {
|
||||
throw new Error('Maximum number of clients reached.');
|
||||
}
|
||||
|
||||
// Create Client
|
||||
const id = crypto.randomUUID();
|
||||
const client = {
|
||||
id,
|
||||
name,
|
||||
address,
|
||||
privateKey,
|
||||
publicKey,
|
||||
preSharedKey,
|
||||
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
|
||||
enabled: true,
|
||||
};
|
||||
|
||||
config.clients[id] = client;
|
||||
|
||||
await this.saveConfig();
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
async deleteClient({ clientId }) {
|
||||
const config = await this.getConfig();
|
||||
|
||||
if (config.clients[clientId]) {
|
||||
delete config.clients[clientId];
|
||||
await this.saveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
async enableClient({ clientId }) {
|
||||
const client = await this.getClient({ clientId });
|
||||
|
||||
client.enabled = true;
|
||||
client.updatedAt = new Date();
|
||||
|
||||
await this.saveConfig();
|
||||
}
|
||||
|
||||
async disableClient({ clientId }) {
|
||||
const client = await this.getClient({ clientId });
|
||||
|
||||
client.enabled = false;
|
||||
client.updatedAt = new Date();
|
||||
|
||||
await this.saveConfig();
|
||||
}
|
||||
|
||||
async updateClientName({ clientId, name }) {
|
||||
const client = await this.getClient({ clientId });
|
||||
|
||||
client.name = name;
|
||||
client.updatedAt = new Date();
|
||||
|
||||
await this.saveConfig();
|
||||
}
|
||||
|
||||
async updateClientAddress({ clientId, address }) {
|
||||
const client = await this.getClient({ clientId });
|
||||
|
||||
if (!Util.isValidIPv4(address)) {
|
||||
throw new ServerError(`Invalid Address: ${address}`, 400);
|
||||
}
|
||||
|
||||
client.address = address;
|
||||
client.updatedAt = new Date();
|
||||
|
||||
await this.saveConfig();
|
||||
}
|
||||
|
||||
// Shutdown wireguard
|
||||
async Shutdown() {
|
||||
await Util.exec('wg-quick down wg0').catch(() => { });
|
||||
}
|
||||
|
||||
};
|
5178
src/package-lock.json
generated
Normal file
5178
src/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
34
src/package.json
Normal file
34
src/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"release": "2",
|
||||
"name": "amnezia-wg-easy",
|
||||
"version": "1.0.0",
|
||||
"description": "The easiest way to run AmneziaWG VPN + Web-based Admin UI.",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
"serve": "DEBUG=Server,WireGuard npx nodemon server.js",
|
||||
"serve-with-password": "PASSWORD=wg npm run serve",
|
||||
"lint": "eslint .",
|
||||
"buildcss": "npx tailwindcss -i ./www/src/css/app.css -o ./www/css/app.css"
|
||||
},
|
||||
"author": "Viktor Yudov",
|
||||
"license": "GPL",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.6",
|
||||
"express-session": "^1.18.0",
|
||||
"h3": "^1.12.0",
|
||||
"qrcode": "^1.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint-config-athom": "^3.1.3",
|
||||
"nodemon": "^3.1.4",
|
||||
"tailwindcss": "^3.4.9"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"ignore": [
|
||||
"www/*"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
29
src/server.js
Normal file
29
src/server.js
Normal file
@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
require('./services/Server');
|
||||
|
||||
const WireGuard = require('./services/WireGuard');
|
||||
|
||||
WireGuard.getConfig()
|
||||
.catch((err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// Handle terminate signal
|
||||
process.on('SIGTERM', async () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('SIGTERM signal received.');
|
||||
await WireGuard.Shutdown();
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// Handle interrupt signal
|
||||
process.on('SIGINT', () => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('SIGINT signal received.');
|
||||
});
|
5
src/services/Server.js
Normal file
5
src/services/Server.js
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const Server = require('../lib/Server');
|
||||
|
||||
module.exports = new Server();
|
5
src/services/WireGuard.js
Normal file
5
src/services/WireGuard.js
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const WireGuard = require('../lib/WireGuard');
|
||||
|
||||
module.exports = new WireGuard();
|
30
src/tailwind.config.js
Normal file
30
src/tailwind.config.js
Normal file
@ -0,0 +1,30 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
darkMode: 'selector',
|
||||
content: ['./www/**/*.{html,js}'],
|
||||
theme: {
|
||||
screens: {
|
||||
xxs: '450px',
|
||||
xs: '576px',
|
||||
sm: '640px',
|
||||
md: '768px',
|
||||
lg: '1024px',
|
||||
xl: '1280px',
|
||||
'2xl': '1536px',
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
function addDisabledClass({ addUtilities }) {
|
||||
const newUtilities = {
|
||||
'.is-disabled': {
|
||||
opacity: '0.25',
|
||||
cursor: 'default',
|
||||
},
|
||||
};
|
||||
addUtilities(newUtilities);
|
||||
},
|
||||
],
|
||||
};
|
1896
src/www/css/app.css
Normal file
1896
src/www/css/app.css
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/www/img/apple-touch-icon.png
Normal file
BIN
src/www/img/apple-touch-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
src/www/img/favicon.ico
Normal file
BIN
src/www/img/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
33
src/www/img/logo.svg
Normal file
33
src/www/img/logo.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 28 KiB |
573
src/www/index.html
Normal file
573
src/www/index.html
Normal file
@ -0,0 +1,573 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>AmneziaWG</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link href="./css/app.css" rel="stylesheet">
|
||||
<link rel="manifest" href="./manifest.json">
|
||||
<link rel="icon" href="img/favicon.ico" sizes="any">
|
||||
<link rel="apple-touch-icon" href="./img/apple-touch-icon.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
</head>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body class="bg-gray-50 dark:bg-neutral-800">
|
||||
<div id="app">
|
||||
<div v-cloak class="container mx-auto max-w-3xl px-3 md:px-0 mt-4 xs:mt-6">
|
||||
<div v-if="authenticated === true">
|
||||
<div class="flex flex-col-reverse xxs:flex-row flex-auto items-center items-end gap-3">
|
||||
<h1 class="text-4xl dark:text-neutral-200 font-medium flex-grow self-start mb-4">
|
||||
<img src="./img/logo.svg" width="60" class="inline align-middle dark:bg mr-2" /><span class="align-middle">AmneziaWG</span>
|
||||
</h1>
|
||||
<div class="flex items-center grow-0 gap-3 items-end self-end xxs:self-center">
|
||||
<!-- Dark / light theme -->
|
||||
<button @click="toggleTheme"
|
||||
class="flex items-center justify-center w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 transition" :title="$t(`theme.${uiTheme}`)">
|
||||
<svg v-if="uiTheme === 'light'" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||
class="w-5 h-5">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z" />
|
||||
</svg>
|
||||
<svg v-else-if="uiTheme === 'dark'" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||
class="w-5 h-5 text-neutral-400">
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z" />
|
||||
</svg>
|
||||
<svg v-else xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"
|
||||
class="w-5 h-5 fill-gray-600 dark:fill-neutral-400">
|
||||
<path
|
||||
d="M12,2.2c-5.4,0-9.8,4.4-9.8,9.8s4.4,9.8,9.8,9.8s9.8-4.4,9.8-9.8S17.4,2.2,12,2.2z M3.8,12c0-4.5,3.7-8.2,8.2-8.2v16.5C7.5,20.2,3.8,16.5,3.8,12z" />
|
||||
</svg>
|
||||
<path stroke-linecap="round" stroke-linejoin="round"
|
||||
d="M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25" />
|
||||
</svg>
|
||||
</button>
|
||||
<!-- Show / hide charts -->
|
||||
<label v-if="uiChartType > 0" class="inline-flex items-center justify-center cursor-pointer w-8 h-8 rounded-full bg-gray-200 hover:bg-gray-300 dark:bg-neutral-700 dark:hover:bg-neutral-600 whitespace-nowrap transition group" :title="$t('toggleCharts')">
|
||||
<input type="checkbox" value="" class="sr-only peer" v-model="uiShowCharts" @change="toggleCharts">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" fill="currentColor"
|
||||
class="w-5 h-5 peer fill-gray-400 peer-checked:fill-gray-600 dark:fill-neutral-600 peer-checked:dark:fill-neutral-400 group-hover:dark:fill-neutral-500 transition">
|
||||
<path
|
||||
d="M18.375 2.25c-1.035 0-1.875.84-1.875 1.875v15.75c0 1.035.84 1.875 1.875 1.875h.75c1.035 0 1.875-.84 1.875-1.875V4.125c0-1.036-.84-1.875-1.875-1.875h-.75ZM9.75 8.625c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v11.25c0 1.035-.84 1.875-1.875 1.875h-.75a1.875 1.875 0 0 1-1.875-1.875V8.625ZM3 13.125c0-1.036.84-1.875 1.875-1.875h.75c1.036 0 1.875.84 1.875 1.875v6.75c0 1.035-.84 1.875-1.875 1.875h-.75A1.875 1.875 0 0 1 3 19.875v-6.75Z" />
|
||||
</svg>
|
||||
</label>
|
||||
<span v-if="requiresPassword"
|
||||
class="text-sm text-gray-400 dark:text-neutral-400 cursor-pointer hover:underline"
|
||||
@click="logout">
|
||||
{{$t("logout")}}
|
||||
<svg class="h-3 inline" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-sm text-gray-400 dark:text-neutral-400 mb-5"></div>
|
||||
<div v-if="latestRelease"
|
||||
class="bg-red-800 dark:bg-red-100 p-4 text-white dark:text-red-600 text-sm font-small mb-10 rounded-md shadow-lg"
|
||||
:title="`v${currentRelease} → v${latestRelease.version}`">
|
||||
<div class="container mx-auto flex flex-row flex-auto items-center">
|
||||
<div class="flex-grow">
|
||||
<p class="font-bold">{{$t("updateAvailable")}}</p>
|
||||
<p>{{latestRelease.changelog}}</p>
|
||||
</div>
|
||||
|
||||
<a href="https://github.com/spcfox/amnezia-wg-easy#updating" target="_blank"
|
||||
class="p-3 rounded-md bg-white dark:bg-red-100 float-right font-sm font-semibold text-red-800 dark:text-red-600 flex-shrink-0 border-2 border-red-800 dark:border-red-600 hover:border-white dark:hover:border-red-600 hover:text-white dark:hover:text-red-100 hover:bg-red-800 dark:hover:bg-red-600 transition-all">
|
||||
{{$t("update")}} →
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="shadow-md rounded-lg bg-white dark:bg-neutral-700 overflow-hidden">
|
||||
<div class="flex flex-row flex-auto items-center p-3 px-5 border-b-2 border-gray-100 dark:border-neutral-600">
|
||||
<div class="flex-grow">
|
||||
<p class="text-2xl font-medium dark:text-neutral-200">{{$t("clients")}}</p>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<button @click="clientCreate = true; clientCreateName = '';"
|
||||
class="hover:bg-red-800 hover:border-red-800 hover:text-white text-gray-700 dark:text-neutral-200 border-2 border-gray-100 dark:border-neutral-600 py-2 px-4 rounded inline-flex items-center transition">
|
||||
<svg class="w-4 mr-2" inline xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
||||
</svg>
|
||||
<span class="text-sm">{{$t("new")}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<!-- Client -->
|
||||
<div v-if="clients && clients.length > 0" v-for="client in clients" :key="client.id"
|
||||
class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid">
|
||||
|
||||
<!-- Chart -->
|
||||
<div v-if="uiChartType" class="absolute z-0 bottom-0 left-0 right-0 h-6" >
|
||||
<apexchart width="100%" height="100%" :options="chartOptionsTX" :series="client.transferTxSeries">
|
||||
</apexchart>
|
||||
</div>
|
||||
<div v-if="uiChartType" class="absolute z-0 top-0 left-0 right-0 h-6" >
|
||||
<apexchart width="100%" height="100%" :options="chartOptionsRX" :series="client.transferRxSeries"
|
||||
style="transform: scaleY(-1);">
|
||||
</apexchart>
|
||||
</div>
|
||||
|
||||
<div class="relative py-3 md:py-5 px-3 z-10 flex flex-col sm:flex-row justify-between gap-3">
|
||||
<div class="flex gap-3 md:gap-4 w-full items-center ">
|
||||
|
||||
<!-- Avatar -->
|
||||
<div class="h-10 w-10 mt-2 self-start rounded-full bg-gray-50 relative">
|
||||
<svg class="w-6 m-2 text-gray-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"
|
||||
fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
<img v-if="client.avatar" :src="client.avatar" class="w-10 rounded-full absolute top-0 left-0" />
|
||||
|
||||
<div
|
||||
v-if="client.latestHandshakeAt && ((new Date() - new Date(client.latestHandshakeAt) < 1000 * 60 * 10))">
|
||||
<div
|
||||
class="animate-ping w-4 h-4 p-1 bg-red-100 dark:bg-red-100 rounded-full absolute -bottom-1 -right-1">
|
||||
</div>
|
||||
<div class="w-2 h-2 bg-red-800 dark:bg-red-600 rounded-full absolute bottom-0 right-0"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Name & Info -->
|
||||
<div class="flex flex-col xxs:flex-row w-full gap-2">
|
||||
|
||||
<!-- Name -->
|
||||
<div class="flex flex-col flex-grow gap-1">
|
||||
<div class="text-gray-700 dark:text-neutral-200 group text-sm md:text-base"
|
||||
:title="$t('createdOn') + dateTime(new Date(client.createdAt))">
|
||||
|
||||
<!-- Show -->
|
||||
<input v-show="clientEditNameId === client.id" v-model="clientEditName"
|
||||
v-on:keyup.enter="updateClientName(client, clientEditName); clientEditName = null; clientEditNameId = null;"
|
||||
v-on:keyup.escape="clientEditName = null; clientEditNameId = null;"
|
||||
:ref="'client-' + client.id + '-name'"
|
||||
class="rounded px-1 border-2 dark:bg-neutral-700 border-gray-100 dark:border-neutral-600 focus:border-gray-200 dark:focus:border-neutral-500 dark:placeholder:text-neutral-500 outline-none w-30" />
|
||||
<span v-show="clientEditNameId !== client.id"
|
||||
class="border-t-2 border-b-2 border-transparent">{{client.name}}</span>
|
||||
|
||||
<!-- Edit -->
|
||||
<span v-show="clientEditNameId !== client.id"
|
||||
@click="clientEditName = client.name; clientEditNameId = client.id; setTimeout(() => $refs['client-' + client.id + '-name'][0].select(), 1);"
|
||||
class="cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4 inline align-middle opacity-25 hover:opacity-100" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Address -->
|
||||
<div class=" block md:inline-block pb-1 md:pb-0 text-gray-500 dark:text-neutral-400 text-xs">
|
||||
<span class="group">
|
||||
<!-- Show -->
|
||||
<input v-show="clientEditAddressId === client.id" v-model="clientEditAddress"
|
||||
v-on:keyup.enter="updateClientAddress(client, clientEditAddress); clientEditAddress = null; clientEditAddressId = null;"
|
||||
v-on:keyup.escape="clientEditAddress = null; clientEditAddressId = null;"
|
||||
:ref="'client-' + client.id + '-address'"
|
||||
class="rounded border-2 dark:bg-neutral-700 border-gray-100 dark:border-neutral-600 focus:border-gray-200 dark:focus:border-neutral-500 outline-none w-20 text-black dark:text-neutral-300 dark:placeholder:text-neutral-500" />
|
||||
<span v-show="clientEditAddressId !== client.id"
|
||||
class="inline-block ">{{client.address}}</span>
|
||||
|
||||
<!-- Edit -->
|
||||
<span v-show="clientEditAddressId !== client.id"
|
||||
@click="clientEditAddress = client.address; clientEditAddressId = client.id; setTimeout(() => $refs['client-' + client.id + '-address'][0].select(), 1);"
|
||||
class="cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
class="h-4 w-4 inline align-middle opacity-25 hover:opacity-100" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
<!-- Inline Transfer TX -->
|
||||
<span v-if="!uiTrafficStats && client.transferTx" class="whitespace-nowrap" :title="$t('totalDownload') + bytes(client.transferTx)">
|
||||
·
|
||||
<svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd"
|
||||
d="M16.707 10.293a1 1 0 010 1.414l-6 6a1 1 0 01-1.414 0l-6-6a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l4.293-4.293a1 1 0 011.414 0z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
{{client.transferTxCurrent | bytes}}/s
|
||||
</span>
|
||||
|
||||
<!-- Inline Transfer RX -->
|
||||
<span v-if="!uiTrafficStats && client.transferRx" class="whitespace-nowrap" :title="$t('totalUpload') + bytes(client.transferRx)">
|
||||
·
|
||||
<svg class="align-middle h-3 inline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd"
|
||||
d="M3.293 9.707a1 1 0 010-1.414l6-6a1 1 0 011.414 0l6 6a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L4.707 9.707a1 1 0 01-1.414 0z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
{{client.transferRxCurrent | bytes}}/s
|
||||
</span>
|
||||
<!-- Last seen -->
|
||||
<span class="text-gray-400 dark:text-neutral-500 whitespace-nowrap" v-if="client.latestHandshakeAt"
|
||||
:title="$t('lastSeen') + dateTime(new Date(client.latestHandshakeAt))">
|
||||
{{!uiTrafficStats ? " · " : ""}}{{new Date(client.latestHandshakeAt) | timeago}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Info -->
|
||||
<div v-if="uiTrafficStats"
|
||||
class="flex gap-2 items-center shrink-0 text-gray-400 dark:text-neutral-400 text-xs mt-px justify-end">
|
||||
|
||||
<!-- Transfer TX -->
|
||||
<div class="min-w-20 md:min-w-24" v-if="client.transferTx">
|
||||
<span class="flex gap-1" :title="$t('totalDownload') + bytes(client.transferTx)">
|
||||
<svg class="align-middle h-3 inline mt-0.5" xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd"
|
||||
d="M16.707 10.293a1 1 0 010 1.414l-6 6a1 1 0 01-1.414 0l-6-6a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l4.293-4.293a1 1 0 011.414 0z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
<div>
|
||||
<span class="text-gray-700 dark:text-neutral-200">{{client.transferTxCurrent |
|
||||
bytes}}/s</span>
|
||||
<!-- Total TX -->
|
||||
<br><span class="font-regular" style="font-size:0.85em">{{bytes(client.transferTx)}}</span>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Transfer RX -->
|
||||
<div class="min-w-20 md:min-w-24" v-if="client.transferRx">
|
||||
<span class="flex gap-1" :title="$t('totalUpload') + bytes(client.transferRx)">
|
||||
|
||||
<svg class="align-middle h-3 inline mt-0.5" xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd"
|
||||
d="M3.293 9.707a1 1 0 010-1.414l6-6a1 1 0 011.414 0l6 6a1 1 0 01-1.414 1.414L11 5.414V17a1 1 0 11-2 0V5.414L4.707 9.707a1 1 0 01-1.414 0z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
<div>
|
||||
<span class="text-gray-700 dark:text-neutral-200">{{client.transferRxCurrent |
|
||||
bytes}}/s</span>
|
||||
<!-- Total RX -->
|
||||
<br><span class="font-regular" style="font-size:0.85em">{{bytes(client.transferRx)}}</span>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> --> <!-- <div class="flex flex-grow items-center"> -->
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end">
|
||||
<div class="text-gray-400 dark:text-neutral-400 flex gap-1 items-center justify-between">
|
||||
|
||||
<!-- Enable/Disable -->
|
||||
<div @click="disableClient(client)" v-if="client.enabled === true" :title="$t('disableClient')"
|
||||
class="inline-block align-middle rounded-full w-10 h-6 mr-1 bg-red-800 cursor-pointer hover:bg-red-700 transition-all">
|
||||
<div class="rounded-full w-4 h-4 m-1 ml-5 bg-white"></div>
|
||||
</div>
|
||||
|
||||
<div @click="enableClient(client)" v-if="client.enabled === false" :title="$t('enableClient')"
|
||||
class="inline-block align-middle rounded-full w-10 h-6 mr-1 bg-gray-200 dark:bg-neutral-400 cursor-pointer hover:bg-gray-300 dark:hover:bg-neutral-500 transition-all">
|
||||
|
||||
<div class="rounded-full w-4 h-4 m-1 bg-white"></div>
|
||||
</div>
|
||||
|
||||
<!-- Download Config -->
|
||||
<a :disabled="!client.downloadableConfig"
|
||||
:href="'./api/wireguard/client/' + client.id + '/configuration'"
|
||||
:download="client.downloadableConfig ? 'configuration' : null"
|
||||
class="align-middle inline-block bg-gray-100 dark:bg-neutral-600 dark:text-neutral-300 p-2 rounded transition"
|
||||
:class="{
|
||||
'hover:bg-red-800 dark:hover:bg-red-800 hover:text-white dark:hover:text-white': client.downloadableConfig,
|
||||
'is-disabled': !client.downloadableConfig
|
||||
}"
|
||||
:title="!client.downloadableConfig ? $t('noPrivKey') : $t('downloadConfig')"
|
||||
@click="if(!client.downloadableConfig) { $event.preventDefault(); }">
|
||||
<svg class="w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<!-- Delete -->
|
||||
|
||||
<button
|
||||
class="align-middle bg-gray-100 dark:bg-neutral-600 dark:text-neutral-300 hover:bg-red-800 dark:hover:bg-red-800 hover:text-white dark:hover:text-white p-2 rounded transition"
|
||||
:title="$t('deleteClient')" @click="clientDelete = client">
|
||||
<svg class="w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd"
|
||||
d="M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z"
|
||||
clip-rule="evenodd" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="clients && clients.length === 0">
|
||||
<p class="text-center m-10 text-gray-400 dark:text-neutral-400 text-sm">
|
||||
{{$t("noClients")}}<br /><br />
|
||||
<button @click="clientCreate = true; clientCreateName = '';"
|
||||
class="bg-red-800 hover:bg-red-700 text-white border-2 border-none py-2 px-4 rounded inline-flex items-center transition">
|
||||
<svg class="w-4 mr-2" inline xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
||||
</svg>
|
||||
<span class="text-sm">{{$t("newClient")}}</span>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="clients === null" class="text-gray-200 dark:text-red-300 p-5">
|
||||
<svg class="w-5 animate-spin mx-auto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="currentColor">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
||||
</path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- QR Code-->
|
||||
<div v-if="qrcode">
|
||||
<div class="bg-black bg-opacity-50 fixed top-0 right-0 left-0 bottom-0 flex items-center justify-center z-20">
|
||||
<div class="bg-white rounded-md shadow-lg relative p-8">
|
||||
<button @click="qrcode = null"
|
||||
class="absolute right-4 top-4 text-gray-600 dark:text-neutral-500 hover:text-gray-800 dark:hover:text-neutral-700">
|
||||
<svg class="w-8" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
||||
</svg>
|
||||
</button>
|
||||
<img :src="qrcode" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Dialog -->
|
||||
<div v-if="clientCreate" class="fixed z-10 inset-0 overflow-y-auto">
|
||||
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
||||
<!--
|
||||
Background overlay, show/hide based on modal state.
|
||||
|
||||
Entering: "ease-out duration-300"
|
||||
From: "opacity-0"
|
||||
To: "opacity-100"
|
||||
Leaving: "ease-in duration-200"
|
||||
From: "opacity-100"
|
||||
To: "opacity-0"
|
||||
-->
|
||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||
<div class="absolute inset-0 bg-gray-500 dark:bg-black opacity-75 dark:opacity-50"></div>
|
||||
</div>
|
||||
|
||||
<!-- This element is to trick the browser into centering the modal contents. -->
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
||||
<!--
|
||||
Modal panel, show/hide based on modal state.
|
||||
|
||||
Entering: "ease-out duration-300"
|
||||
From: "opacity-0 tranneutral-y-4 sm:tranneutral-y-0 sm:scale-95"
|
||||
To: "opacity-100 tranneutral-y-0 sm:scale-100"
|
||||
Leaving: "ease-in duration-200"
|
||||
From: "opacity-100 tranneutral-y-0 sm:scale-100"
|
||||
To: "opacity-0 tranneutral-y-4 sm:tranneutral-y-0 sm:scale-95"
|
||||
-->
|
||||
<div
|
||||
class="inline-block align-bottom bg-white dark:bg-neutral-700 rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg w-full"
|
||||
role="dialog" aria-modal="true" aria-labelledby="modal-headline">
|
||||
<div class="bg-white dark:bg-neutral-700 px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div
|
||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-800 sm:mx-0 sm:h-10 sm:w-10">
|
||||
<svg class="h-6 w-6 text-white" inline xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="flex-grow mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-neutral-200" id="modal-headline">
|
||||
{{$t("newClient")}}
|
||||
</h3>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-gray-500">
|
||||
<input
|
||||
class="rounded p-2 border-2 dark:bg-neutral-700 dark:text-neutral-200 border-gray-100 dark:border-neutral-600 focus:border-gray-200 focus:dark:border-neutral-500 dark:placeholder:text-neutral-400 outline-none w-full"
|
||||
type="text" v-model.trim="clientCreateName" :placeholder="$t('name')" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-gray-50 dark:bg-neutral-700 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
||||
<button v-if="clientCreateName.length" type="button" @click="createClient(); clientCreate = null"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-800 text-base font-medium text-white hover:bg-red-700 focus:outline-none sm:ml-3 sm:w-auto sm:text-sm">
|
||||
{{$t("create")}}
|
||||
</button>
|
||||
<button v-else type="button"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-gray-200 dark:bg-neutral-400 text-base font-medium text-white dark:text-neutral-300 sm:ml-3 sm:w-auto sm:text-sm cursor-not-allowed">
|
||||
{{$t("create")}}
|
||||
</button>
|
||||
<button type="button" @click="clientCreate = null"
|
||||
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 dark:border-neutral-500 shadow-sm px-4 py-2 bg-white dark:bg-neutral-500 text-base font-medium text-gray-700 dark:text-neutral-50 hover:bg-gray-50 dark:hover:bg-neutral-600 dark:hover:border-neutral-600 focus:outline-none sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
||||
{{$t("cancel")}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete Dialog -->
|
||||
<div v-if="clientDelete" class="fixed z-10 inset-0 overflow-y-auto">
|
||||
<div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
||||
<!--
|
||||
Background overlay, show/hide based on modal state.
|
||||
|
||||
Entering: "ease-out duration-300"
|
||||
From: "opacity-0"
|
||||
To: "opacity-100"
|
||||
Leaving: "ease-in duration-200"
|
||||
From: "opacity-100"
|
||||
To: "opacity-0"
|
||||
-->
|
||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||
<div class="absolute inset-0 bg-gray-500 dark:bg-black opacity-75 dark:opacity-50"></div>
|
||||
</div>
|
||||
|
||||
<!-- This element is to trick the browser into centering the modal contents. -->
|
||||
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
||||
<!--
|
||||
Modal panel, show/hide based on modal state.
|
||||
|
||||
Entering: "ease-out duration-300"
|
||||
From: "opacity-0 tranneutral-y-4 sm:tranneutral-y-0 sm:scale-95"
|
||||
To: "opacity-100 tranneutral-y-0 sm:scale-100"
|
||||
Leaving: "ease-in duration-200"
|
||||
From: "opacity-100 tranneutral-y-0 sm:scale-100"
|
||||
To: "opacity-0 tranneutral-y-4 sm:tranneutral-y-0 sm:scale-95"
|
||||
-->
|
||||
<div
|
||||
class="inline-block align-bottom bg-white dark:bg-neutral-700 rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg w-full"
|
||||
role="dialog" aria-modal="true" aria-labelledby="modal-headline">
|
||||
<div class="bg-white dark:bg-neutral-700 px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||
<div class="sm:flex sm:items-start">
|
||||
<div
|
||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
|
||||
<!-- Heroicon name: outline/exclamation -->
|
||||
<svg class="h-6 w-6 text-red-600" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
|
||||
stroke="currentColor" aria-hidden="true">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
|
||||
</svg>
|
||||
</div>
|
||||
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-neutral-200" id="modal-headline">
|
||||
{{$t("deleteClient")}}
|
||||
</h3>
|
||||
<div class="mt-2">
|
||||
<p class="text-sm text-gray-500 dark:text-neutral-300">
|
||||
{{$t("deleteDialog1")}} <strong>{{clientDelete.name}}</strong>? {{$t("deleteDialog2")}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bg-gray-50 dark:bg-neutral-600 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
||||
<button type="button" @click="deleteClient(clientDelete); clientDelete = null"
|
||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 dark:bg-red-600 text-base font-medium text-white dark:text-white hover:bg-red-700 dark:hover:bg-red-700 focus:outline-none sm:ml-3 sm:w-auto sm:text-sm">
|
||||
{{$t("deleteClient")}}
|
||||
</button>
|
||||
<button type="button" @click="clientDelete = null"
|
||||
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 dark:border-neutral-500 shadow-sm px-4 py-2 bg-white dark:bg-neutral-500 text-base font-medium text-gray-700 dark:text-neutral-50 hover:bg-gray-50 dark:hover:bg-neutral-600 dark:hover:border-neutral-600 focus:outline-none sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
||||
{{$t("cancel")}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="authenticated === false">
|
||||
<h1 class="text-4xl font-medium my-16 text-gray-700 dark:text-neutral-200 text-center">
|
||||
<img src="./img/logo.svg" width="60" class="inline align-middle dark:bg" />
|
||||
<span class="align-middle">AmneziaWG</span>
|
||||
</h1>
|
||||
|
||||
<form @submit="login"
|
||||
class="shadow rounded-md bg-white dark:bg-neutral-700 mx-auto w-64 p-5 overflow-hidden mt-10">
|
||||
<!-- Avatar -->
|
||||
<div class="h-20 w-20 mb-10 mt-5 mx-auto rounded-full bg-red-800 dark:bg-red-800 relative overflow-hidden">
|
||||
<svg class="w-10 h-10 m-5 text-white dark:text-white" xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd" />
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<input type="password" name="password" :placeholder="$t('password')" v-model="password"
|
||||
class="px-3 py-2 text-sm dark:bg-neutral-700 text-gray-500 dark:text-gray-500 mb-5 border-2 border-gray-100 dark:border-neutral-800 rounded-lg w-full focus:border-red-800 dark:focus:border-red-800 dark:placeholder:text-neutral-400 outline-none" />
|
||||
|
||||
<button v-if="authenticating"
|
||||
class="bg-red-800 dark:bg-red-800 w-full rounded shadow py-2 text-sm text-white dark:text-white cursor-not-allowed">
|
||||
<svg class="w-5 animate-spin mx-auto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="currentColor">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
||||
</path>
|
||||
</svg>
|
||||
</button>
|
||||
<input v-if="!authenticating && password" type="submit"
|
||||
class="bg-red-800 dark:bg-red-800 w-full rounded shadow py-2 text-sm text-white dark:text-white hover:bg-red-700 dark:hover:bg-red-700 transition cursor-pointer"
|
||||
:value="$t('signIn')">
|
||||
<input v-if="!authenticating && !password" type="submit"
|
||||
class="bg-gray-200 dark:bg-neutral-800 w-full rounded shadow py-2 text-sm text-white dark:text-white cursor-not-allowed"
|
||||
:value="$t('signIn')">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div v-if="authenticated === null" class="text-gray-300 dark:text-red-300 pt-24 pb-12">
|
||||
|
||||
<svg class="w-5 animate-spin mx-auto" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
||||
fill="currentColor">
|
||||
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path class="opacity-75" fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
||||
</path>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="./js/vendor/vue.min.js"></script>
|
||||
<script src="./js/vendor/vue-i18n.min.js"></script>
|
||||
<script src="./js/vendor/apexcharts.min.js"></script>
|
||||
<script src="./js/vendor/vue-apexcharts.min.js"></script>
|
||||
<script src="./js/vendor/sha256.min.js"></script>
|
||||
<script src="./js/vendor/timeago.full.min.js"></script>
|
||||
<script src="./js/api.js"></script>
|
||||
<script src="./js/i18n.js"></script>
|
||||
<script src="./js/app.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
148
src/www/js/api.js
Normal file
148
src/www/js/api.js
Normal file
@ -0,0 +1,148 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
'use strict';
|
||||
|
||||
class API {
|
||||
|
||||
async call({ method, path, body }) {
|
||||
const res = await fetch(`./api${path}`, {
|
||||
method,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: body
|
||||
? JSON.stringify(body)
|
||||
: undefined,
|
||||
});
|
||||
|
||||
if (res.status === 204) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const json = await res.json();
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error(json.error || res.statusText);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
async getCheckUpdate() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/check-update',
|
||||
});
|
||||
}
|
||||
|
||||
async getRelease() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/release',
|
||||
});
|
||||
}
|
||||
|
||||
async getLang() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/lang',
|
||||
});
|
||||
}
|
||||
|
||||
async getuiTrafficStats() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/ui-traffic-stats',
|
||||
});
|
||||
}
|
||||
|
||||
async getChartType() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/ui-chart-type',
|
||||
});
|
||||
}
|
||||
|
||||
async getSession() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/session',
|
||||
});
|
||||
}
|
||||
|
||||
async createSession({ password }) {
|
||||
return this.call({
|
||||
method: 'post',
|
||||
path: '/session',
|
||||
body: { password },
|
||||
});
|
||||
}
|
||||
|
||||
async deleteSession() {
|
||||
return this.call({
|
||||
method: 'delete',
|
||||
path: '/session',
|
||||
});
|
||||
}
|
||||
|
||||
async getClients() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/wireguard/client',
|
||||
}).then((clients) => clients.map((client) => ({
|
||||
...client,
|
||||
createdAt: new Date(client.createdAt),
|
||||
updatedAt: new Date(client.updatedAt),
|
||||
latestHandshakeAt: client.latestHandshakeAt !== null
|
||||
? new Date(client.latestHandshakeAt)
|
||||
: null,
|
||||
})));
|
||||
}
|
||||
|
||||
async createClient({ name }) {
|
||||
return this.call({
|
||||
method: 'post',
|
||||
path: '/wireguard/client',
|
||||
body: { name },
|
||||
});
|
||||
}
|
||||
|
||||
async deleteClient({ clientId }) {
|
||||
return this.call({
|
||||
method: 'delete',
|
||||
path: `/wireguard/client/${clientId}`,
|
||||
});
|
||||
}
|
||||
|
||||
async enableClient({ clientId }) {
|
||||
return this.call({
|
||||
method: 'post',
|
||||
path: `/wireguard/client/${clientId}/enable`,
|
||||
});
|
||||
}
|
||||
|
||||
async disableClient({ clientId }) {
|
||||
return this.call({
|
||||
method: 'post',
|
||||
path: `/wireguard/client/${clientId}/disable`,
|
||||
});
|
||||
}
|
||||
|
||||
async updateClientName({ clientId, name }) {
|
||||
return this.call({
|
||||
method: 'put',
|
||||
path: `/wireguard/client/${clientId}/name/`,
|
||||
body: { name },
|
||||
});
|
||||
}
|
||||
|
||||
async updateClientAddress({ clientId, address }) {
|
||||
return this.call({
|
||||
method: 'put',
|
||||
path: `/wireguard/client/${clientId}/address/`,
|
||||
body: { address },
|
||||
});
|
||||
}
|
||||
|
||||
}
|
433
src/www/js/app.js
Normal file
433
src/www/js/app.js
Normal file
@ -0,0 +1,433 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable no-alert */
|
||||
/* eslint-disable no-undef */
|
||||
/* eslint-disable no-new */
|
||||
|
||||
'use strict';
|
||||
|
||||
const CHANGELOG_URL = 'https://raw.githubusercontent.com/spcfox/amnezia-wg-easy/production/docs/changelog.json';
|
||||
|
||||
function bytes(bytes, decimals, kib, maxunit) {
|
||||
kib = kib || false;
|
||||
if (bytes === 0) return '0 B';
|
||||
if (Number.isNaN(parseFloat(bytes)) && !Number.isFinite(bytes)) return 'NaN';
|
||||
const k = kib ? 1024 : 1000;
|
||||
const dm = decimals != null && !Number.isNaN(decimals) && decimals >= 0 ? decimals : 2;
|
||||
const sizes = kib
|
||||
? ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB', 'BiB']
|
||||
: ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB', 'BB'];
|
||||
let i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
if (maxunit !== undefined) {
|
||||
const index = sizes.indexOf(maxunit);
|
||||
if (index !== -1) i = index;
|
||||
}
|
||||
// eslint-disable-next-line no-restricted-properties
|
||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
||||
}
|
||||
|
||||
const i18n = new VueI18n({
|
||||
locale: localStorage.getItem('lang') || 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages,
|
||||
});
|
||||
|
||||
const UI_CHART_TYPES = [
|
||||
{ type: false, strokeWidth: 0 },
|
||||
{ type: 'line', strokeWidth: 3 },
|
||||
{ type: 'area', strokeWidth: 0 },
|
||||
{ type: 'bar', strokeWidth: 0 },
|
||||
];
|
||||
|
||||
const CHART_COLORS = {
|
||||
rx: { light: 'rgba(128,128,128,0.3)', dark: 'rgba(255,255,255,0.3)' },
|
||||
tx: { light: 'rgba(128,128,128,0.4)', dark: 'rgba(255,255,255,0.3)' },
|
||||
gradient: { light: ['rgba(0,0,0,1.0)', 'rgba(0,0,0,1.0)'], dark: ['rgba(128,128,128,0)', 'rgba(128,128,128,0)'] },
|
||||
};
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
components: {
|
||||
apexchart: VueApexCharts,
|
||||
},
|
||||
i18n,
|
||||
data: {
|
||||
authenticated: null,
|
||||
authenticating: false,
|
||||
password: null,
|
||||
requiresPassword: null,
|
||||
|
||||
clients: null,
|
||||
clientsPersist: {},
|
||||
clientDelete: null,
|
||||
clientCreate: null,
|
||||
clientCreateName: '',
|
||||
clientEditName: null,
|
||||
clientEditNameId: null,
|
||||
clientEditAddress: null,
|
||||
clientEditAddressId: null,
|
||||
qrcode: null,
|
||||
|
||||
currentRelease: null,
|
||||
latestRelease: null,
|
||||
|
||||
uiTrafficStats: false,
|
||||
|
||||
uiChartType: 0,
|
||||
uiShowCharts: localStorage.getItem('uiShowCharts') === '1',
|
||||
uiTheme: localStorage.theme || 'auto',
|
||||
prefersDarkScheme: window.matchMedia('(prefers-color-scheme: dark)'),
|
||||
|
||||
chartOptions: {
|
||||
chart: {
|
||||
background: 'transparent',
|
||||
stacked: false,
|
||||
toolbar: {
|
||||
show: false,
|
||||
},
|
||||
animations: {
|
||||
enabled: false,
|
||||
},
|
||||
parentHeightOffset: 0,
|
||||
sparkline: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
colors: [],
|
||||
stroke: {
|
||||
curve: 'smooth',
|
||||
},
|
||||
fill: {
|
||||
type: 'gradient',
|
||||
gradient: {
|
||||
shade: 'dark',
|
||||
type: 'vertical',
|
||||
shadeIntensity: 0,
|
||||
gradientToColors: CHART_COLORS.gradient[this.theme],
|
||||
inverseColors: false,
|
||||
opacityTo: 0,
|
||||
stops: [0, 100],
|
||||
},
|
||||
},
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
},
|
||||
plotOptions: {
|
||||
bar: {
|
||||
horizontal: false,
|
||||
},
|
||||
},
|
||||
xaxis: {
|
||||
labels: {
|
||||
show: false,
|
||||
},
|
||||
axisTicks: {
|
||||
show: false,
|
||||
},
|
||||
axisBorder: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
yaxis: {
|
||||
labels: {
|
||||
show: false,
|
||||
},
|
||||
min: 0,
|
||||
},
|
||||
tooltip: {
|
||||
enabled: false,
|
||||
},
|
||||
legend: {
|
||||
show: false,
|
||||
},
|
||||
grid: {
|
||||
show: false,
|
||||
padding: {
|
||||
left: -10,
|
||||
right: 0,
|
||||
bottom: -15,
|
||||
top: -15,
|
||||
},
|
||||
column: {
|
||||
opacity: 0,
|
||||
},
|
||||
xaxis: {
|
||||
lines: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
dateTime: (value) => {
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
}).format(value);
|
||||
},
|
||||
async refresh({
|
||||
updateCharts = false,
|
||||
} = {}) {
|
||||
if (!this.authenticated) return;
|
||||
|
||||
const clients = await this.api.getClients();
|
||||
this.clients = clients.map((client) => {
|
||||
if (client.name.includes('@') && client.name.includes('.')) {
|
||||
client.avatar = `https://gravatar.com/avatar/${sha256(client.name.toLowerCase().trim())}.jpg`;
|
||||
}
|
||||
|
||||
if (!this.clientsPersist[client.id]) {
|
||||
this.clientsPersist[client.id] = {};
|
||||
this.clientsPersist[client.id].transferRxHistory = Array(50).fill(0);
|
||||
this.clientsPersist[client.id].transferRxPrevious = client.transferRx;
|
||||
this.clientsPersist[client.id].transferTxHistory = Array(50).fill(0);
|
||||
this.clientsPersist[client.id].transferTxPrevious = client.transferTx;
|
||||
}
|
||||
|
||||
// Debug
|
||||
// client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000;
|
||||
// client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000;
|
||||
// client.latestHandshakeAt = new Date();
|
||||
// this.requiresPassword = true;
|
||||
|
||||
this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious;
|
||||
this.clientsPersist[client.id].transferRxPrevious = client.transferRx;
|
||||
this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious;
|
||||
this.clientsPersist[client.id].transferTxPrevious = client.transferTx;
|
||||
|
||||
if (updateCharts) {
|
||||
this.clientsPersist[client.id].transferRxHistory.push(this.clientsPersist[client.id].transferRxCurrent);
|
||||
this.clientsPersist[client.id].transferRxHistory.shift();
|
||||
|
||||
this.clientsPersist[client.id].transferTxHistory.push(this.clientsPersist[client.id].transferTxCurrent);
|
||||
this.clientsPersist[client.id].transferTxHistory.shift();
|
||||
|
||||
this.clientsPersist[client.id].transferTxSeries = [{
|
||||
name: 'Tx',
|
||||
data: this.clientsPersist[client.id].transferTxHistory,
|
||||
}];
|
||||
|
||||
this.clientsPersist[client.id].transferRxSeries = [{
|
||||
name: 'Rx',
|
||||
data: this.clientsPersist[client.id].transferRxHistory,
|
||||
}];
|
||||
|
||||
client.transferTxHistory = this.clientsPersist[client.id].transferTxHistory;
|
||||
client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory;
|
||||
client.transferMax = Math.max(...client.transferTxHistory, ...client.transferRxHistory);
|
||||
|
||||
client.transferTxSeries = this.clientsPersist[client.id].transferTxSeries;
|
||||
client.transferRxSeries = this.clientsPersist[client.id].transferRxSeries;
|
||||
}
|
||||
|
||||
client.transferTxCurrent = this.clientsPersist[client.id].transferTxCurrent;
|
||||
client.transferRxCurrent = this.clientsPersist[client.id].transferRxCurrent;
|
||||
|
||||
client.hoverTx = this.clientsPersist[client.id].hoverTx;
|
||||
client.hoverRx = this.clientsPersist[client.id].hoverRx;
|
||||
|
||||
return client;
|
||||
});
|
||||
},
|
||||
login(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if (!this.password) return;
|
||||
if (this.authenticating) return;
|
||||
|
||||
this.authenticating = true;
|
||||
this.api.createSession({
|
||||
password: this.password,
|
||||
})
|
||||
.then(async () => {
|
||||
const session = await this.api.getSession();
|
||||
this.authenticated = session.authenticated;
|
||||
this.requiresPassword = session.requiresPassword;
|
||||
return this.refresh();
|
||||
})
|
||||
.catch((err) => {
|
||||
alert(err.message || err.toString());
|
||||
})
|
||||
.finally(() => {
|
||||
this.authenticating = false;
|
||||
this.password = null;
|
||||
});
|
||||
},
|
||||
logout(e) {
|
||||
e.preventDefault();
|
||||
|
||||
this.api.deleteSession()
|
||||
.then(() => {
|
||||
this.authenticated = false;
|
||||
this.clients = null;
|
||||
})
|
||||
.catch((err) => {
|
||||
alert(err.message || err.toString());
|
||||
});
|
||||
},
|
||||
createClient() {
|
||||
const name = this.clientCreateName;
|
||||
if (!name) return;
|
||||
|
||||
this.api.createClient({ name })
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
deleteClient(client) {
|
||||
this.api.deleteClient({ clientId: client.id })
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
enableClient(client) {
|
||||
this.api.enableClient({ clientId: client.id })
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
disableClient(client) {
|
||||
this.api.disableClient({ clientId: client.id })
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
updateClientName(client, name) {
|
||||
this.api.updateClientName({ clientId: client.id, name })
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
updateClientAddress(client, address) {
|
||||
this.api.updateClientAddress({ clientId: client.id, address })
|
||||
.catch((err) => alert(err.message || err.toString()))
|
||||
.finally(() => this.refresh().catch(console.error));
|
||||
},
|
||||
toggleTheme() {
|
||||
const themes = ['light', 'dark', 'auto'];
|
||||
const currentIndex = themes.indexOf(this.uiTheme);
|
||||
const newIndex = (currentIndex + 1) % themes.length;
|
||||
this.uiTheme = themes[newIndex];
|
||||
localStorage.theme = this.uiTheme;
|
||||
this.setTheme(this.uiTheme);
|
||||
},
|
||||
setTheme(theme) {
|
||||
const { classList } = document.documentElement;
|
||||
const shouldAddDarkClass = theme === 'dark' || (theme === 'auto' && this.prefersDarkScheme.matches);
|
||||
classList.toggle('dark', shouldAddDarkClass);
|
||||
},
|
||||
handlePrefersChange(e) {
|
||||
if (localStorage.theme === 'auto') {
|
||||
this.setTheme(e.matches ? 'dark' : 'light');
|
||||
}
|
||||
},
|
||||
toggleCharts() {
|
||||
localStorage.setItem('uiShowCharts', this.uiShowCharts ? 1 : 0);
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
bytes,
|
||||
timeago: (value) => {
|
||||
return timeago.format(value, i18n.locale);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.prefersDarkScheme.addListener(this.handlePrefersChange);
|
||||
this.setTheme(this.uiTheme);
|
||||
|
||||
this.api = new API();
|
||||
this.api.getSession()
|
||||
.then((session) => {
|
||||
this.authenticated = session.authenticated;
|
||||
this.requiresPassword = session.requiresPassword;
|
||||
this.refresh({
|
||||
updateCharts: this.updateCharts,
|
||||
}).catch((err) => {
|
||||
alert(err.message || err.toString());
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
alert(err.message || err.toString());
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
this.refresh({
|
||||
updateCharts: this.updateCharts,
|
||||
}).catch(console.error);
|
||||
}, 1000);
|
||||
|
||||
this.api.getuiTrafficStats()
|
||||
.then((res) => {
|
||||
this.uiTrafficStats = res;
|
||||
})
|
||||
.catch(() => {
|
||||
this.uiTrafficStats = false;
|
||||
});
|
||||
|
||||
this.api.getChartType()
|
||||
.then((res) => {
|
||||
this.uiChartType = parseInt(res, 10);
|
||||
})
|
||||
.catch(() => {
|
||||
this.uiChartType = 0;
|
||||
});
|
||||
|
||||
Promise.resolve().then(async () => {
|
||||
const lang = await this.api.getLang();
|
||||
if (lang !== localStorage.getItem('lang') && i18n.availableLocales.includes(lang)) {
|
||||
localStorage.setItem('lang', lang);
|
||||
i18n.locale = lang;
|
||||
}
|
||||
|
||||
const checkUpdate = await this.api.getCheckUpdate();
|
||||
if (!checkUpdate) return;
|
||||
|
||||
const currentRelease = await this.api.getRelease();
|
||||
const latestRelease = await fetch(CHANGELOG_URL)
|
||||
.then((res) => res.json())
|
||||
.then((releases) => {
|
||||
const releasesArray = Object.entries(releases).map(([version, changelog]) => ({
|
||||
version: parseInt(version, 10),
|
||||
changelog,
|
||||
}));
|
||||
releasesArray.sort((a, b) => {
|
||||
return b.version - a.version;
|
||||
});
|
||||
|
||||
return releasesArray[0];
|
||||
});
|
||||
|
||||
if (currentRelease >= latestRelease.version) return;
|
||||
|
||||
this.currentRelease = currentRelease;
|
||||
this.latestRelease = latestRelease;
|
||||
}).catch((err) => console.error(err));
|
||||
},
|
||||
computed: {
|
||||
chartOptionsTX() {
|
||||
const opts = {
|
||||
...this.chartOptions,
|
||||
colors: [CHART_COLORS.tx[this.theme]],
|
||||
};
|
||||
opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false;
|
||||
opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth;
|
||||
return opts;
|
||||
},
|
||||
chartOptionsRX() {
|
||||
const opts = {
|
||||
...this.chartOptions,
|
||||
colors: [CHART_COLORS.rx[this.theme]],
|
||||
};
|
||||
opts.chart.type = UI_CHART_TYPES[this.uiChartType].type || false;
|
||||
opts.stroke.width = UI_CHART_TYPES[this.uiChartType].strokeWidth;
|
||||
return opts;
|
||||
},
|
||||
updateCharts() {
|
||||
return this.uiChartType > 0 && this.uiShowCharts;
|
||||
},
|
||||
theme() {
|
||||
if (this.uiTheme === 'auto') {
|
||||
return this.prefersDarkScheme.matches ? 'dark' : 'light';
|
||||
}
|
||||
return this.uiTheme;
|
||||
},
|
||||
},
|
||||
});
|
552
src/www/js/i18n.js
Normal file
552
src/www/js/i18n.js
Normal file
@ -0,0 +1,552 @@
|
||||
'use strict';
|
||||
|
||||
const messages = { // eslint-disable-line no-unused-vars
|
||||
en: {
|
||||
name: 'Name',
|
||||
password: 'Password',
|
||||
signIn: 'Sign In',
|
||||
logout: 'Logout',
|
||||
updateAvailable: 'There is an update available!',
|
||||
update: 'Update',
|
||||
clients: 'Clients',
|
||||
new: 'New',
|
||||
deleteClient: 'Delete Client',
|
||||
deleteDialog1: 'Are you sure you want to delete',
|
||||
deleteDialog2: 'This action cannot be undone.',
|
||||
cancel: 'Cancel',
|
||||
create: 'Create',
|
||||
createdOn: 'Created on ',
|
||||
lastSeen: 'Last seen on ',
|
||||
totalDownload: 'Total Download: ',
|
||||
totalUpload: 'Total Upload: ',
|
||||
newClient: 'New Client',
|
||||
disableClient: 'Disable Client',
|
||||
enableClient: 'Enable Client',
|
||||
noClients: 'There are no clients yet.',
|
||||
noPrivKey: 'This client has no known private key. Cannot create Configuration.',
|
||||
showQR: 'Show QR Code',
|
||||
downloadConfig: 'Download Configuration',
|
||||
madeBy: 'Made by',
|
||||
donate: 'Donate',
|
||||
toggleCharts: 'Show/hide Charts',
|
||||
theme: { dark: 'Dark theme', light: 'Light theme', auto: 'Auto theme' },
|
||||
},
|
||||
ua: {
|
||||
name: 'Ім`я',
|
||||
password: 'Пароль',
|
||||
signIn: 'Увійти',
|
||||
logout: 'Вихід',
|
||||
updateAvailable: 'Доступне оновлення!',
|
||||
update: 'Оновити',
|
||||
clients: 'Клієнти',
|
||||
new: 'Новий',
|
||||
deleteClient: 'Видалити клієнта',
|
||||
deleteDialog1: 'Ви впевнені, що бажаєте видалити',
|
||||
deleteDialog2: 'Цю дію неможливо скасувати.',
|
||||
cancel: 'Скасувати',
|
||||
create: 'Створити',
|
||||
createdOn: 'Створено ',
|
||||
lastSeen: 'Останнє підключення в ',
|
||||
totalDownload: 'Всього завантажено: ',
|
||||
totalUpload: 'Всього відправлено: ',
|
||||
newClient: 'Новий клієнт',
|
||||
disableClient: 'Вимкнути клієнта',
|
||||
enableClient: 'Увімкнути клієнта',
|
||||
noClients: 'Ще немає клієнтів.',
|
||||
showQR: 'Показати QR-код',
|
||||
downloadConfig: 'Завантажити конфігурацію',
|
||||
madeBy: 'Зроблено',
|
||||
donate: 'Пожертвувати',
|
||||
},
|
||||
ru: {
|
||||
name: 'Имя',
|
||||
password: 'Пароль',
|
||||
signIn: 'Войти',
|
||||
logout: 'Выйти',
|
||||
updateAvailable: 'Доступно обновление!',
|
||||
update: 'Обновить',
|
||||
clients: 'Клиенты',
|
||||
new: 'Создать',
|
||||
deleteClient: 'Удалить клиента',
|
||||
deleteDialog1: 'Вы уверены, что хотите удалить',
|
||||
deleteDialog2: 'Это действие невозможно отменить.',
|
||||
cancel: 'Закрыть',
|
||||
create: 'Создать',
|
||||
createdOn: 'Создано в ',
|
||||
lastSeen: 'Последнее подключение в ',
|
||||
totalDownload: 'Всего скачано: ',
|
||||
totalUpload: 'Всего загружено: ',
|
||||
newClient: 'Создать клиента',
|
||||
disableClient: 'Выключить клиента',
|
||||
enableClient: 'Включить клиента',
|
||||
noClients: 'Пока нет клиентов.',
|
||||
showQR: 'Показать QR-код',
|
||||
downloadConfig: 'Скачать конфигурацию',
|
||||
madeBy: 'Автор',
|
||||
donate: 'Поблагодарить',
|
||||
},
|
||||
tr: { // Müslüm Barış Korkmazer @babico
|
||||
name: 'İsim',
|
||||
password: 'Şifre',
|
||||
signIn: 'Giriş Yap',
|
||||
logout: 'Çıkış Yap',
|
||||
updateAvailable: 'Mevcut bir güncelleme var!',
|
||||
update: 'Güncelle',
|
||||
clients: 'Kullanıcılar',
|
||||
new: 'Yeni',
|
||||
deleteClient: 'Kullanıcı Sil',
|
||||
deleteDialog1: 'Silmek istediğine emin misin',
|
||||
deleteDialog2: 'Bu işlem geri alınamaz.',
|
||||
cancel: 'İptal',
|
||||
create: 'Oluştur',
|
||||
createdAt: 'Şu saatte oluşturuldu: ',
|
||||
lastSeen: 'Son görülme tarihi: ',
|
||||
totalDownload: 'Toplam İndirme: ',
|
||||
totalUpload: 'Toplam Yükleme: ',
|
||||
newClient: 'Yeni Kullanıcı',
|
||||
disableClient: 'İstemciyi Devre Dışı Bırak',
|
||||
enableClient: 'İstemciyi Etkinleştir',
|
||||
noClients: 'Henüz kullanıcı yok.',
|
||||
showQR: 'QR Kodunu Göster',
|
||||
downloadConfig: 'Yapılandırmayı İndir',
|
||||
madeBy: 'Yapan Kişi: ',
|
||||
donate: 'Bağış Yap',
|
||||
changeLang: 'Dil Değiştir',
|
||||
},
|
||||
no: { // github.com/digvalley
|
||||
name: 'Navn',
|
||||
password: 'Passord',
|
||||
signIn: 'Logg Inn',
|
||||
logout: 'Logg Ut',
|
||||
updateAvailable: 'En ny oppdatering er tilgjengelig!',
|
||||
update: 'Oppdater',
|
||||
clients: 'Klienter',
|
||||
new: 'Ny',
|
||||
deleteClient: 'Slett Klient',
|
||||
deleteDialog1: 'Er du sikker på at du vil slette?',
|
||||
deleteDialog2: 'Denne handlingen kan ikke angres',
|
||||
cancel: 'Avbryt',
|
||||
create: 'Opprett',
|
||||
createdOn: 'Opprettet ',
|
||||
lastSeen: 'Sist sett ',
|
||||
totalDownload: 'Total Nedlasting: ',
|
||||
totalUpload: 'Total Opplasting: ',
|
||||
newClient: 'Ny Klient',
|
||||
disableClient: 'Deaktiver Klient',
|
||||
enableClient: 'Aktiver Klient',
|
||||
noClients: 'Ingen klienter opprettet enda.',
|
||||
showQR: 'Vis QR Kode',
|
||||
downloadConfig: 'Last Ned Konfigurasjon',
|
||||
madeBy: 'Laget av',
|
||||
donate: 'Doner',
|
||||
},
|
||||
pl: { // github.com/archont94
|
||||
name: 'Nazwa',
|
||||
password: 'Hasło',
|
||||
signIn: 'Zaloguj się',
|
||||
logout: 'Wyloguj się',
|
||||
updateAvailable: 'Dostępna aktualizacja!',
|
||||
update: 'Aktualizuj',
|
||||
clients: 'Klienci',
|
||||
new: 'Stwórz klienta',
|
||||
deleteClient: 'Usuń klienta',
|
||||
deleteDialog1: 'Jesteś pewny że chcesz usunąć',
|
||||
deleteDialog2: 'Tej akcji nie da się cofnąć.',
|
||||
cancel: 'Anuluj',
|
||||
create: 'Stwórz',
|
||||
createdOn: 'Utworzono ',
|
||||
lastSeen: 'Ostatnio widziany ',
|
||||
totalDownload: 'Całkowite pobieranie: ',
|
||||
totalUpload: 'Całkowite wysyłanie: ',
|
||||
newClient: 'Nowy klient',
|
||||
disableClient: 'Wyłączenie klienta',
|
||||
enableClient: 'Włączenie klienta',
|
||||
noClients: 'Nie ma jeszcze klientów.',
|
||||
showQR: 'Pokaż kod QR',
|
||||
downloadConfig: 'Pobierz konfigurację',
|
||||
madeBy: 'Stworzone przez',
|
||||
donate: 'Wsparcie autora',
|
||||
},
|
||||
fr: { // github.com/clem3109
|
||||
name: 'Nom',
|
||||
password: 'Mot de passe',
|
||||
signIn: 'Se Connecter',
|
||||
logout: 'Se déconnecter',
|
||||
updateAvailable: 'Une mise à jour est disponible !',
|
||||
update: 'Mise à jour',
|
||||
clients: 'Clients',
|
||||
new: 'Nouveau',
|
||||
deleteClient: 'Supprimer ce client',
|
||||
deleteDialog1: 'Êtes-vous que vous voulez supprimer',
|
||||
deleteDialog2: 'Cette action ne peut pas être annulée.',
|
||||
cancel: 'Annuler',
|
||||
create: 'Créer',
|
||||
createdOn: 'Créé le ',
|
||||
lastSeen: 'Dernière connexion le ',
|
||||
totalDownload: 'Téléchargement total : ',
|
||||
totalUpload: 'Téléversement total : ',
|
||||
newClient: 'Nouveau client',
|
||||
disableClient: 'Désactiver ce client',
|
||||
enableClient: 'Activer ce client',
|
||||
noClients: 'Aucun client pour le moment.',
|
||||
showQR: 'Afficher le code à réponse rapide (QR Code)',
|
||||
downloadConfig: 'Télécharger la configuration',
|
||||
madeBy: 'Développé par',
|
||||
donate: 'Soutenir',
|
||||
},
|
||||
de: { // github.com/florian-asche
|
||||
name: 'Name',
|
||||
password: 'Passwort',
|
||||
signIn: 'Anmelden',
|
||||
logout: 'Abmelden',
|
||||
updateAvailable: 'Eine Aktualisierung steht zur Verfügung!',
|
||||
update: 'Aktualisieren',
|
||||
clients: 'Clients',
|
||||
new: 'Neu',
|
||||
deleteClient: 'Client löschen',
|
||||
deleteDialog1: 'Möchtest du wirklich löschen?',
|
||||
deleteDialog2: 'Diese Aktion kann nicht rückgängig gemacht werden.',
|
||||
cancel: 'Abbrechen',
|
||||
create: 'Erstellen',
|
||||
createdOn: 'Erstellt am ',
|
||||
lastSeen: 'Zuletzt Online ',
|
||||
totalDownload: 'Gesamt Download: ',
|
||||
totalUpload: 'Gesamt Upload: ',
|
||||
newClient: 'Neuer Client',
|
||||
disableClient: 'Client deaktivieren',
|
||||
enableClient: 'Client aktivieren',
|
||||
noClients: 'Es wurden noch keine Clients konfiguriert.',
|
||||
noPrivKey: 'Es ist kein Private Key für diesen Client bekannt. Eine Konfiguration kann nicht erstellt werden.',
|
||||
showQR: 'Zeige den QR Code',
|
||||
downloadConfig: 'Konfiguration herunterladen',
|
||||
madeBy: 'Erstellt von',
|
||||
donate: 'Spenden',
|
||||
},
|
||||
ca: { // github.com/guillembonet
|
||||
name: 'Nom',
|
||||
password: 'Contrasenya',
|
||||
signIn: 'Iniciar sessió',
|
||||
logout: 'Tanca sessió',
|
||||
updateAvailable: 'Hi ha una actualització disponible!',
|
||||
update: 'Actualitza',
|
||||
clients: 'Clients',
|
||||
new: 'Nou',
|
||||
deleteClient: 'Esborra client',
|
||||
deleteDialog1: 'Estàs segur que vols esborrar aquest client?',
|
||||
deleteDialog2: 'Aquesta acció no es pot desfer.',
|
||||
cancel: 'Cancel·la',
|
||||
create: 'Crea',
|
||||
createdOn: 'Creat el ',
|
||||
lastSeen: 'Última connexió el ',
|
||||
totalDownload: 'Baixada total: ',
|
||||
totalUpload: 'Pujada total: ',
|
||||
newClient: 'Nou client',
|
||||
disableClient: 'Desactiva client',
|
||||
enableClient: 'Activa client',
|
||||
noClients: 'Encara no hi ha cap client.',
|
||||
showQR: 'Mostra codi QR',
|
||||
downloadConfig: 'Descarrega configuració',
|
||||
madeBy: 'Fet per',
|
||||
donate: 'Donatiu',
|
||||
},
|
||||
es: { // github.com/amarqz
|
||||
name: 'Nombre',
|
||||
password: 'Contraseña',
|
||||
signIn: 'Iniciar sesión',
|
||||
logout: 'Cerrar sesión',
|
||||
updateAvailable: '¡Hay una actualización disponible!',
|
||||
update: 'Actualizar',
|
||||
clients: 'Clientes',
|
||||
new: 'Nuevo',
|
||||
deleteClient: 'Eliminar cliente',
|
||||
deleteDialog1: '¿Estás seguro de que quieres borrar este cliente?',
|
||||
deleteDialog2: 'Esta acción no podrá ser revertida.',
|
||||
cancel: 'Cancelar',
|
||||
create: 'Crear',
|
||||
createdOn: 'Creado el ',
|
||||
lastSeen: 'Última conexión el ',
|
||||
totalDownload: 'Total descargado: ',
|
||||
totalUpload: 'Total subido: ',
|
||||
newClient: 'Nuevo cliente',
|
||||
disableClient: 'Desactivar cliente',
|
||||
enableClient: 'Activar cliente',
|
||||
noClients: 'Aún no hay ningún cliente.',
|
||||
showQR: 'Mostrar código QR',
|
||||
downloadConfig: 'Descargar configuración',
|
||||
madeBy: 'Hecho por',
|
||||
donate: 'Donar',
|
||||
toggleCharts: 'Mostrar/Ocultar gráficos',
|
||||
theme: { dark: 'Modo oscuro', light: 'Modo claro', auto: 'Modo automático' },
|
||||
},
|
||||
ko: {
|
||||
name: '이름',
|
||||
password: '암호',
|
||||
signIn: '로그인',
|
||||
logout: '로그아웃',
|
||||
updateAvailable: '업데이트가 있습니다!',
|
||||
update: '업데이트',
|
||||
clients: '클라이언트',
|
||||
new: '추가',
|
||||
deleteClient: '클라이언트 삭제',
|
||||
deleteDialog1: '삭제 하시겠습니까?',
|
||||
deleteDialog2: '이 작업은 취소할 수 없습니다.',
|
||||
cancel: '취소',
|
||||
create: '생성',
|
||||
createdOn: '생성일: ',
|
||||
lastSeen: '마지막 사용 날짜: ',
|
||||
totalDownload: '총 다운로드: ',
|
||||
totalUpload: '총 업로드: ',
|
||||
newClient: '새로운 클라이언트',
|
||||
disableClient: '클라이언트 비활성화',
|
||||
enableClient: '클라이언트 활성화',
|
||||
noClients: '아직 클라이언트가 없습니다.',
|
||||
showQR: 'QR 코드 표시',
|
||||
downloadConfig: '구성 다운로드',
|
||||
madeBy: '만든 사람',
|
||||
donate: '기부',
|
||||
},
|
||||
vi: {
|
||||
name: 'Tên',
|
||||
password: 'Mật khẩu',
|
||||
signIn: 'Đăng nhập',
|
||||
logout: 'Đăng xuất',
|
||||
updateAvailable: 'Có bản cập nhật mới!',
|
||||
update: 'Cập nhật',
|
||||
clients: 'Danh sách người dùng',
|
||||
new: 'Mới',
|
||||
deleteClient: 'Xóa người dùng',
|
||||
deleteDialog1: 'Bạn có chắc chắn muốn xóa',
|
||||
deleteDialog2: 'Thao tác này không thể hoàn tác.',
|
||||
cancel: 'Huỷ',
|
||||
create: 'Tạo',
|
||||
createdOn: 'Được tạo lúc ',
|
||||
lastSeen: 'Lần xem cuối vào ',
|
||||
totalDownload: 'Tổng dung lượng tải xuống: ',
|
||||
totalUpload: 'Tổng dung lượng tải lên: ',
|
||||
newClient: 'Người dùng mới',
|
||||
disableClient: 'Vô hiệu hóa người dùng',
|
||||
enableClient: 'Kích hoạt người dùng',
|
||||
noClients: 'Hiện chưa có người dùng nào.',
|
||||
showQR: 'Hiển thị mã QR',
|
||||
downloadConfig: 'Tải xuống cấu hình',
|
||||
madeBy: 'Được tạo bởi',
|
||||
donate: 'Ủng hộ',
|
||||
},
|
||||
nl: {
|
||||
name: 'Naam',
|
||||
password: 'Wachtwoord',
|
||||
signIn: 'Inloggen',
|
||||
logout: 'Uitloggen',
|
||||
updateAvailable: 'Nieuw update beschikbaar!',
|
||||
update: 'update',
|
||||
clients: 'clients',
|
||||
new: 'Nieuw',
|
||||
deleteClient: 'client verwijderen',
|
||||
deleteDialog1: 'Weet je zeker dat je wilt verwijderen',
|
||||
deleteDialog2: 'Deze actie kan niet ongedaan worden gemaakt.',
|
||||
cancel: 'Annuleren',
|
||||
create: 'Creëren',
|
||||
createdOn: 'Gemaakt op ',
|
||||
lastSeen: 'Laatst gezien op ',
|
||||
totalDownload: 'Totaal Gedownload: ',
|
||||
totalUpload: 'Totaal Geupload: ',
|
||||
newClient: 'Nieuwe client',
|
||||
disableClient: 'client uitschakelen',
|
||||
enableClient: 'client inschakelen',
|
||||
noClients: 'Er zijn nog geen clients.',
|
||||
showQR: 'QR-code weergeven',
|
||||
downloadConfig: 'Configuratie downloaden',
|
||||
madeBy: 'Gemaakt door',
|
||||
donate: 'Doneren',
|
||||
},
|
||||
is: {
|
||||
name: 'Nafn',
|
||||
password: 'Lykilorð',
|
||||
signIn: 'Skrá inn',
|
||||
logout: 'Útskráning',
|
||||
updateAvailable: 'Það er uppfærsla í boði!',
|
||||
update: 'Uppfæra',
|
||||
clients: 'Viðskiptavinir',
|
||||
new: 'Nýtt',
|
||||
deleteClient: 'Eyða viðskiptavin',
|
||||
deleteDialog1: 'Ertu viss um að þú viljir eyða',
|
||||
deleteDialog2: 'Þessi aðgerð getur ekki verið afturkallað.',
|
||||
cancel: 'Hætta við',
|
||||
create: 'Búa til',
|
||||
createdOn: 'Búið til á ',
|
||||
lastSeen: 'Síðast séð á ',
|
||||
totalDownload: 'Samtals Niðurhlaða: ',
|
||||
totalUpload: 'Samtals Upphlaða: ',
|
||||
newClient: 'Nýr Viðskiptavinur',
|
||||
disableClient: 'Gera viðskiptavin óvirkan',
|
||||
enableClient: 'Gera viðskiptavin virkan',
|
||||
noClients: 'Engir viðskiptavinir ennþá.',
|
||||
showQR: 'Sýna QR-kóða',
|
||||
downloadConfig: 'Niðurhal Stillingar',
|
||||
madeBy: 'Gert af',
|
||||
donate: 'Gefa',
|
||||
},
|
||||
pt: {
|
||||
name: 'Nome',
|
||||
password: 'Palavra Chave',
|
||||
signIn: 'Entrar',
|
||||
logout: 'Sair',
|
||||
updateAvailable: 'Existe uma atualização disponível!',
|
||||
update: 'Atualizar',
|
||||
clients: 'Clientes',
|
||||
new: 'Novo',
|
||||
deleteClient: 'Apagar Clientes',
|
||||
deleteDialog1: 'Tem certeza que pretende apagar',
|
||||
deleteDialog2: 'Esta ação não pode ser revertida.',
|
||||
cancel: 'Cancelar',
|
||||
create: 'Criar',
|
||||
createdOn: 'Criado em ',
|
||||
lastSeen: 'Último acesso em ',
|
||||
totalDownload: 'Total Download: ',
|
||||
totalUpload: 'Total Upload: ',
|
||||
newClient: 'Novo Cliente',
|
||||
disableClient: 'Desativar Cliente',
|
||||
enableClient: 'Ativar Cliente',
|
||||
noClients: 'Não existem ainda clientes.',
|
||||
showQR: 'Apresentar o código QR',
|
||||
downloadConfig: 'Descarregar Configuração',
|
||||
madeBy: 'Feito por',
|
||||
donate: 'Doar',
|
||||
},
|
||||
chs: {
|
||||
name: '名称',
|
||||
password: '密码',
|
||||
signIn: '登录',
|
||||
logout: '退出',
|
||||
updateAvailable: '有新版本可用!',
|
||||
update: '更新',
|
||||
clients: '客户端',
|
||||
new: '新建',
|
||||
deleteClient: '删除客户端',
|
||||
deleteDialog1: '您确定要删除',
|
||||
deleteDialog2: '此操作无法撤销。',
|
||||
cancel: '取消',
|
||||
create: '创建',
|
||||
createdOn: '创建于 ',
|
||||
lastSeen: '最后访问于 ',
|
||||
totalDownload: '总下载: ',
|
||||
totalUpload: '总上传: ',
|
||||
newClient: '新建客户端',
|
||||
disableClient: '禁用客户端',
|
||||
enableClient: '启用客户端',
|
||||
noClients: '目前没有客户端。',
|
||||
showQR: '显示二维码',
|
||||
downloadConfig: '下载配置',
|
||||
madeBy: '由',
|
||||
donate: '捐赠',
|
||||
},
|
||||
cht: {
|
||||
name: '名字',
|
||||
password: '密碼',
|
||||
signIn: '登入',
|
||||
logout: '登出',
|
||||
updateAvailable: '有新版本可用!',
|
||||
update: '更新',
|
||||
clients: '客戶',
|
||||
new: '新建',
|
||||
deleteClient: '刪除客戶',
|
||||
deleteDialog1: '您確定要刪除',
|
||||
deleteDialog2: '此操作無法撤銷。',
|
||||
cancel: '取消',
|
||||
create: '建立',
|
||||
createdOn: '建立於 ',
|
||||
lastSeen: '最後訪問於 ',
|
||||
totalDownload: '總下載: ',
|
||||
totalUpload: '總上傳: ',
|
||||
newClient: '新客戶',
|
||||
disableClient: '禁用客戶',
|
||||
enableClient: '啟用客戶',
|
||||
noClients: '目前沒有客戶。',
|
||||
showQR: '顯示二維碼',
|
||||
downloadConfig: '下載配置',
|
||||
madeBy: '由',
|
||||
donate: '捐贈',
|
||||
},
|
||||
it: {
|
||||
name: 'Nome',
|
||||
password: 'Password',
|
||||
signIn: 'Accedi',
|
||||
logout: 'Esci',
|
||||
updateAvailable: 'È disponibile un aggiornamento!',
|
||||
update: 'Aggiorna',
|
||||
clients: 'Client',
|
||||
new: 'Nuovo',
|
||||
deleteClient: 'Elimina Client',
|
||||
deleteDialog1: 'Sei sicuro di voler eliminare',
|
||||
deleteDialog2: 'Questa azione non può essere annullata.',
|
||||
cancel: 'Annulla',
|
||||
create: 'Crea',
|
||||
createdOn: 'Creato il ',
|
||||
lastSeen: 'Visto l\'ultima volta il ',
|
||||
totalDownload: 'Totale Download: ',
|
||||
totalUpload: 'Totale Upload: ',
|
||||
newClient: 'Nuovo Client',
|
||||
disableClient: 'Disabilita Client',
|
||||
enableClient: 'Abilita Client',
|
||||
noClients: 'Non ci sono ancora client.',
|
||||
showQR: 'Mostra codice QR',
|
||||
downloadConfig: 'Scarica configurazione',
|
||||
madeBy: 'Realizzato da',
|
||||
donate: 'Donazione',
|
||||
},
|
||||
th: {
|
||||
name: 'ชื่อ',
|
||||
password: 'รหัสผ่าน',
|
||||
signIn: 'ลงชื่อเข้าใช้',
|
||||
logout: 'ออกจากระบบ',
|
||||
updateAvailable: 'มีอัปเดตพร้อมใช้งาน!',
|
||||
update: 'อัปเดต',
|
||||
clients: 'Clients',
|
||||
new: 'ใหม่',
|
||||
deleteClient: 'ลบ Client',
|
||||
deleteDialog1: 'คุณแน่ใจหรือไม่ว่าต้องการลบ',
|
||||
deleteDialog2: 'การกระทำนี้;ไม่สามารถยกเลิกได้',
|
||||
cancel: 'ยกเลิก',
|
||||
create: 'สร้าง',
|
||||
createdOn: 'สร้างเมื่อ ',
|
||||
lastSeen: 'เห็นครั้งสุดท้ายเมื่อ ',
|
||||
totalDownload: 'ดาวน์โหลดทั้งหมด: ',
|
||||
totalUpload: 'อัพโหลดทั้งหมด: ',
|
||||
newClient: 'Client ใหม่',
|
||||
disableClient: 'ปิดการใช้งาน Client',
|
||||
enableClient: 'เปิดการใช้งาน Client',
|
||||
noClients: 'ยังไม่มี Clients เลย',
|
||||
showQR: 'แสดงรหัส QR',
|
||||
downloadConfig: 'ดาวน์โหลดการตั้งค่า',
|
||||
madeBy: 'สร้างโดย',
|
||||
donate: 'บริจาค',
|
||||
},
|
||||
hi: { // github.com/rahilarious
|
||||
name: 'नाम',
|
||||
password: 'पासवर्ड',
|
||||
signIn: 'लॉगिन',
|
||||
logout: 'लॉगआउट',
|
||||
updateAvailable: 'अपडेट उपलब्ध है!',
|
||||
update: 'अपडेट',
|
||||
clients: 'उपयोगकर्ताये',
|
||||
new: 'नया',
|
||||
deleteClient: 'उपयोगकर्ता हटाएँ',
|
||||
deleteDialog1: 'क्या आपको पक्का हटाना है',
|
||||
deleteDialog2: 'यह निर्णय पलट नहीं सकता।',
|
||||
cancel: 'कुछ ना करें',
|
||||
create: 'बनाएं',
|
||||
createdOn: 'सर्जन तारीख ',
|
||||
lastSeen: 'पिछली बार देखे गए थे ',
|
||||
totalDownload: 'कुल डाउनलोड: ',
|
||||
totalUpload: 'कुल अपलोड: ',
|
||||
newClient: 'नया उपयोगकर्ता',
|
||||
disableClient: 'उपयोगकर्ता स्थगित कीजिये',
|
||||
enableClient: 'उपयोगकर्ता शुरू कीजिये',
|
||||
noClients: 'अभी तक कोई भी उपयोगकर्ता नहीं है।',
|
||||
noPrivKey: 'ये उपयोगकर्ता की कोई भी गुप्त चाबी नहीं हे। बना नहीं सकते।',
|
||||
showQR: 'क्यू आर कोड देखिये',
|
||||
downloadConfig: 'डाउनलोड कॉन्फीग्यूरेशन',
|
||||
madeBy: 'सर्जक',
|
||||
donate: 'दान करें',
|
||||
},
|
||||
};
|
14
src/www/js/vendor/apexcharts.min.js
vendored
Normal file
14
src/www/js/vendor/apexcharts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
src/www/js/vendor/sha256.min.js
vendored
Normal file
9
src/www/js/vendor/sha256.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
src/www/js/vendor/timeago.full.min.js
vendored
Normal file
1
src/www/js/vendor/timeago.full.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
src/www/js/vendor/vue-apexcharts.min.js
vendored
Normal file
7
src/www/js/vendor/vue-apexcharts.min.js
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Minified by jsDelivr using Terser v5.7.1.
|
||||
* Original file: /npm/vue-apexcharts@1.6.2/dist/vue-apexcharts.js
|
||||
*
|
||||
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
||||
*/
|
||||
!function (t, e) { "object" == typeof exports && "undefined" != typeof module ? module.exports = e(require("apexcharts/dist/apexcharts.min")) : "function" == typeof define && define.amd ? define(["apexcharts/dist/apexcharts.min"], e) : t.VueApexCharts = e(t.ApexCharts) }(this, (function (t) { "use strict"; function e(t) { return (e = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (t) { return typeof t } : function (t) { return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t })(t) } function n(t, e, n) { return e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t } t = t && t.hasOwnProperty("default") ? t.default : t; var i = { props: { options: { type: Object }, type: { type: String }, series: { type: Array, required: !0, default: function () { return [] } }, width: { default: "100%" }, height: { default: "auto" } }, data: function () { return { chart: null } }, beforeMount: function () { window.ApexCharts = t }, mounted: function () { this.init() }, created: function () { var t = this; this.$watch("options", (function (e) { !t.chart && e ? t.init() : t.chart.updateOptions(t.options) })), this.$watch("series", (function (e) { !t.chart && e ? t.init() : t.chart.updateSeries(t.series) }));["type", "width", "height"].forEach((function (e) { t.$watch(e, (function () { t.refresh() })) })) }, beforeDestroy: function () { this.chart && this.destroy() }, render: function (t) { return t("div") }, methods: { init: function () { var e = this, n = { chart: { type: this.type || this.options.chart.type || "line", height: this.height, width: this.width, events: {} }, series: this.series }; Object.keys(this.$listeners).forEach((function (t) { n.chart.events[t] = e.$listeners[t] })); var i = this.extend(this.options, n); return this.chart = new t(this.$el, i), this.chart.render() }, isObject: function (t) { return t && "object" === e(t) && !Array.isArray(t) && null != t }, extend: function (t, e) { var i = this; "function" != typeof Object.assign && (Object.assign = function (t) { if (null == t) throw new TypeError("Cannot convert undefined or null to object"); for (var e = Object(t), n = 1; n < arguments.length; n++) { var i = arguments[n]; if (null != i) for (var r in i) i.hasOwnProperty(r) && (e[r] = i[r]) } return e }); var r = Object.assign({}, t); return this.isObject(t) && this.isObject(e) && Object.keys(e).forEach((function (o) { i.isObject(e[o]) && o in t ? r[o] = i.extend(t[o], e[o]) : Object.assign(r, n({}, o, e[o])) })), r }, refresh: function () { return this.destroy(), this.init() }, destroy: function () { this.chart.destroy() }, updateSeries: function (t, e) { return this.chart.updateSeries(t, e) }, updateOptions: function (t, e, n, i) { return this.chart.updateOptions(t, e, n, i) }, toggleSeries: function (t) { return this.chart.toggleSeries(t) }, showSeries: function (t) { this.chart.showSeries(t) }, hideSeries: function (t) { this.chart.hideSeries(t) }, appendSeries: function (t, e) { return this.chart.appendSeries(t, e) }, resetSeries: function () { this.chart.resetSeries() }, zoomX: function (t, e) { this.chart.zoomX(t, e) }, toggleDataPointSelection: function (t, e) { this.chart.toggleDataPointSelection(t, e) }, appendData: function (t) { return this.chart.appendData(t) }, addText: function (t) { this.chart.addText(t) }, addImage: function (t) { this.chart.addImage(t) }, addShape: function (t) { this.chart.addShape(t) }, dataURI: function () { return this.chart.dataURI() }, setLocale: function (t) { return this.chart.setLocale(t) }, addXaxisAnnotation: function (t, e) { this.chart.addXaxisAnnotation(t, e) }, addYaxisAnnotation: function (t, e) { this.chart.addYaxisAnnotation(t, e) }, addPointAnnotation: function (t, e) { this.chart.addPointAnnotation(t, e) }, removeAnnotation: function (t, e) { this.chart.removeAnnotation(t, e) }, clearAnnotations: function () { this.chart.clearAnnotations() } } }; return window.ApexCharts = t, i.install = function (e) { e.ApexCharts = t, window.ApexCharts = t, Object.defineProperty(e.prototype, "$apexcharts", { get: function () { return t } }) }, i }));
|
6
src/www/js/vendor/vue-i18n.min.js
vendored
Normal file
6
src/www/js/vendor/vue-i18n.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
src/www/js/vendor/vue.min.js
vendored
Normal file
6
src/www/js/vendor/vue.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11
src/www/manifest.json
Normal file
11
src/www/manifest.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "AmneziaWG",
|
||||
"display": "standalone",
|
||||
"background_color": "#fff",
|
||||
"icons": [
|
||||
{
|
||||
"src": "img/favicon.ico",
|
||||
"type": "image/x-icon"
|
||||
}
|
||||
]
|
||||
}
|
3
src/www/src/css/app.css
Normal file
3
src/www/src/css/app.css
Normal file
@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
Loading…
x
Reference in New Issue
Block a user