Browse Source

refactor!: separate source code

pull/930/head
cany748 2 years ago
parent
commit
27baedb109
  1. 7
      Dockerfile
  2. 8
      README.md
  3. 0
      backend/.eslintrc.json
  4. 0
      backend/.gitignore
  5. 0
      backend/config.js
  6. 2
      backend/lib/Server.js
  7. 0
      backend/lib/ServerError.js
  8. 0
      backend/lib/Util.js
  9. 0
      backend/lib/WireGuard.js
  10. 866
      backend/package-lock.json
  11. 11
      backend/package.json
  12. 0
      backend/server.js
  13. 0
      backend/services/Server.js
  14. 0
      backend/services/WireGuard.js
  15. 3
      docker-compose.dev.yml
  16. 1
      frontend/.gitignore
  17. 0
      frontend/css/app.css
  18. 0
      frontend/img/apple-touch-icon.png
  19. 0
      frontend/img/favicon.png
  20. 0
      frontend/img/logo.png
  21. 0
      frontend/index.html
  22. 0
      frontend/js/api.js
  23. 0
      frontend/js/app.js
  24. 0
      frontend/js/i18n.js
  25. 0
      frontend/js/vendor/apexcharts.min.js
  26. 0
      frontend/js/vendor/sha256.min.js
  27. 0
      frontend/js/vendor/timeago.full.min.js
  28. 0
      frontend/js/vendor/vue-apexcharts.min.js
  29. 0
      frontend/js/vendor/vue-i18n.min.js
  30. 0
      frontend/js/vendor/vue.min.js
  31. 0
      frontend/manifest.json
  32. 1380
      frontend/package-lock.json
  33. 8
      frontend/package.json
  34. 0
      frontend/src/css/app.css
  35. 2
      frontend/tailwind.config.js

7
Dockerfile

@ -4,8 +4,9 @@
FROM docker.io/library/node:18-alpine AS build_node_modules FROM docker.io/library/node:18-alpine AS build_node_modules
# Copy Web UI # Copy Web UI
COPY src/ /app/ COPY backend/ /app/backend/
WORKDIR /app COPY frontend/ /app/frontend/
WORKDIR /app/backend
RUN npm ci --omit=dev &&\ RUN npm ci --omit=dev &&\
mv node_modules /node_modules mv node_modules /node_modules
@ -50,5 +51,5 @@ EXPOSE 51821/tcp
ENV DEBUG=Server,WireGuard ENV DEBUG=Server,WireGuard
# Run Web UI # Run Web UI
WORKDIR /app WORKDIR /app/backend
CMD ["/usr/bin/dumb-init", "node", "server.js"] CMD ["/usr/bin/dumb-init", "node", "server.js"]

8
README.md

@ -99,10 +99,10 @@ These options can be configured by setting environment variables using `-e KEY="
| `WG_DEFAULT_ADDRESS` | `10.8.0.x` | `10.6.0.x` | Clients IP address range. | | `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_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_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](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L19) for the default value. | | `WG_PRE_UP` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/backend/config.js#L19) for the default value. |
| `WG_POST_UP` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L20) for the default value. | | `WG_POST_UP` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/backend/config.js#L20) for the default value. |
| `WG_PRE_DOWN` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L27) for the default value. | | `WG_PRE_DOWN` | `...` | - | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/backend/config.js#L27) for the default value. |
| `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/src/config.js#L28) for the default value. | | `WG_POST_DOWN` | `...` | `iptables ...` | See [config.js](https://github.com/wg-easy/wg-easy/blob/master/backend/config.js#L28) for the default value. |
| `LANG` | `en` | `de` | Web UI language (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th, hi). | | `LANG` | `en` | `de` | Web UI language (Supports: en, ua, ru, tr, no, pl, fr, de, ca, es, ko, vi, nl, is, pt, chs, cht, it, th, hi). |
| `UI_TRAFFIC_STATS` | `false` | `true` | Enable detailed RX / TX client stats in Web UI | | `UI_TRAFFIC_STATS` | `false` | `true` | Enable detailed RX / TX client stats in Web UI |

0
src/.eslintrc.json → backend/.eslintrc.json

0
src/.gitignore → backend/.gitignore

0
src/config.js → backend/config.js

2
src/lib/Server.js → backend/lib/Server.js

@ -213,7 +213,7 @@ module.exports = class Server {
})); }));
// Static assets // Static assets
const publicDir = 'www'; const publicDir = join(__dirname, '../../frontend');
app.use( app.use(
defineEventHandler((event) => { defineEventHandler((event) => {
return serveStatic(event, { return serveStatic(event, {

0
src/lib/ServerError.js → backend/lib/ServerError.js

0
src/lib/Util.js → backend/lib/Util.js

0
src/lib/WireGuard.js → backend/lib/WireGuard.js

866
src/package-lock.json → backend/package-lock.json

File diff suppressed because it is too large

11
src/package.json → backend/package.json

@ -7,8 +7,7 @@
"scripts": { "scripts": {
"serve": "DEBUG=Server,WireGuard nodemon server.js", "serve": "DEBUG=Server,WireGuard nodemon server.js",
"serve-with-password": "PASSWORD=wg npm run serve", "serve-with-password": "PASSWORD=wg npm run serve",
"lint": "eslint .", "lint": "eslint ."
"buildcss": "npx tailwindcss -i ./www/src/css/app.css -o ./www/css/app.css"
}, },
"author": "Emile Nijssen", "author": "Emile Nijssen",
"license": "GPL", "license": "GPL",
@ -21,13 +20,7 @@
"uuid": "^9.0.1" "uuid": "^9.0.1"
}, },
"devDependencies": { "devDependencies": {
"eslint-config-athom": "^3.1.3", "eslint-config-athom": "^3.1.3"
"tailwindcss": "^3.4.1"
},
"nodemonConfig": {
"ignore": [
"www/*"
]
}, },
"engines": { "engines": {
"node": "18" "node": "18"

0
src/server.js → backend/server.js

0
src/services/Server.js → backend/services/Server.js

0
src/services/WireGuard.js → backend/services/WireGuard.js

3
docker-compose.dev.yml

@ -4,7 +4,8 @@ services:
image: wg-easy image: wg-easy
command: npm run serve command: npm run serve
volumes: volumes:
- ./src/:/app/ - ./frontend/:/app/frontend/
- ./backend/:/app/backend/
environment: environment:
# - PASSWORD=p # - PASSWORD=p
- WG_HOST=192.168.1.233 - WG_HOST=192.168.1.233

1
frontend/.gitignore

@ -0,0 +1 @@
/node_modules

0
src/www/css/app.css → frontend/css/app.css

0
src/www/img/apple-touch-icon.png → frontend/img/apple-touch-icon.png

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

0
src/www/img/favicon.png → frontend/img/favicon.png

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

0
src/www/img/logo.png → frontend/img/logo.png

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

0
src/www/index.html → frontend/index.html

0
src/www/js/api.js → frontend/js/api.js

0
src/www/js/app.js → frontend/js/app.js

0
src/www/js/i18n.js → frontend/js/i18n.js

0
src/www/js/vendor/apexcharts.min.js → frontend/js/vendor/apexcharts.min.js

0
src/www/js/vendor/sha256.min.js → frontend/js/vendor/sha256.min.js

0
src/www/js/vendor/timeago.full.min.js → frontend/js/vendor/timeago.full.min.js

0
src/www/js/vendor/vue-apexcharts.min.js → frontend/js/vendor/vue-apexcharts.min.js

0
src/www/js/vendor/vue-i18n.min.js → frontend/js/vendor/vue-i18n.min.js

0
src/www/js/vendor/vue.min.js → frontend/js/vendor/vue.min.js

0
src/www/manifest.json → frontend/manifest.json

1380
frontend/package-lock.json

File diff suppressed because it is too large

8
frontend/package.json

@ -0,0 +1,8 @@
{
"scripts": {
"buildcss": "npx tailwindcss -i ./src/css/app.css -o ./css/app.css"
},
"devDependencies": {
"tailwindcss": "^3.4.1"
}
}

0
src/www/src/css/app.css → frontend/src/css/app.css

2
src/tailwind.config.js → frontend/tailwind.config.js

@ -4,7 +4,7 @@
module.exports = { module.exports = {
darkMode: 'selector', darkMode: 'selector',
content: ['./www/**/*.{html,js}'], content: ['./index.html'],
theme: { theme: {
screens: { screens: {
xxs: '450px', xxs: '450px',
Loading…
Cancel
Save