Merge branch 'master' into feat-h3
This commit is contained in:
commit
c107920df2
|
@ -25,6 +25,7 @@ services:
|
||||||
# - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt
|
# - WG_PRE_DOWN=echo "Pre Down" > /etc/wireguard/pre-down.txt
|
||||||
# - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt
|
# - WG_POST_DOWN=echo "Post Down" > /etc/wireguard/post-down.txt
|
||||||
# - UI_TRAFFIC_STATS=true
|
# - UI_TRAFFIC_STATS=true
|
||||||
|
# - UI_CHART_TYPE=0 (0 # Charts disabled, 1 # Line chart, 2 # Area chart, 3 # Bar chart)
|
||||||
|
|
||||||
image: ghcr.io/wg-easy/wg-easy
|
image: ghcr.io/wg-easy/wg-easy
|
||||||
container_name: wg-easy
|
container_name: wg-easy
|
||||||
|
|
|
@ -35,3 +35,4 @@ iptables -D FORWARD -o wg0 -j ACCEPT;
|
||||||
`.split('\n').join(' ');
|
`.split('\n').join(' ');
|
||||||
module.exports.LANG = process.env.LANG || 'en';
|
module.exports.LANG = process.env.LANG || 'en';
|
||||||
module.exports.UI_TRAFFIC_STATS = process.env.UI_TRAFFIC_STATS || 'false';
|
module.exports.UI_TRAFFIC_STATS = process.env.UI_TRAFFIC_STATS || 'false';
|
||||||
|
module.exports.UI_CHART_TYPE = process.env.UI_CHART_TYPE || 0;
|
||||||
|
|
|
@ -31,6 +31,7 @@ const {
|
||||||
PASSWORD,
|
PASSWORD,
|
||||||
LANG,
|
LANG,
|
||||||
UI_TRAFFIC_STATS,
|
UI_TRAFFIC_STATS,
|
||||||
|
UI_CHART_TYPE,
|
||||||
} = require('../config');
|
} = require('../config');
|
||||||
|
|
||||||
module.exports = class Server {
|
module.exports = class Server {
|
||||||
|
@ -57,13 +58,15 @@ module.exports = class Server {
|
||||||
|
|
||||||
.get('/api/lang', defineEventHandler((event) => {
|
.get('/api/lang', defineEventHandler((event) => {
|
||||||
setHeader(event, 'Content-Type', 'application/json');
|
setHeader(event, 'Content-Type', 'application/json');
|
||||||
|
|
||||||
return `"${LANG}"`;
|
return `"${LANG}"`;
|
||||||
}))
|
}))
|
||||||
.get('/api/ui-traffic-stats', defineEventHandler((event) => {
|
.get('/api/ui-traffic-stats', defineEventHandler((event) => {
|
||||||
setHeader(event, 'Content-Type', 'application/json');
|
setHeader(event, 'Content-Type', 'application/json');
|
||||||
return `"${UI_TRAFFIC_STATS}"`;
|
return `"${UI_TRAFFIC_STATS}"`;
|
||||||
}))
|
}))
|
||||||
|
.get('/api/ui-chart-type', defineEventHandler((event) => {
|
||||||
|
setHeader(event, 'Content-Type', 'application/json');
|
||||||
|
return `"${UI_CHART_TYPE}"`;
|
||||||
|
|
||||||
// Authentication
|
// Authentication
|
||||||
.get('/api/session', defineEventHandler((event) => {
|
.get('/api/session', defineEventHandler((event) => {
|
||||||
|
|
|
@ -67,15 +67,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/highlight": {
|
"node_modules/@babel/highlight": {
|
||||||
"version": "7.23.4",
|
"version": "7.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
|
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.1.tgz",
|
||||||
"integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==",
|
"integrity": "sha512-EPmDPxidWe/Ex+HTFINpvXdPHRmgSF3T8hGvzondYjmgzTQ/0EbLpSxyt+w3zzlYSk9cNBQNF9k0dT5Z2NiBjw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-validator-identifier": "^7.22.20",
|
"@babel/helper-validator-identifier": "^7.22.20",
|
||||||
"chalk": "^2.4.2",
|
"chalk": "^2.4.2",
|
||||||
"js-tokens": "^4.0.0"
|
"js-tokens": "^4.0.0",
|
||||||
|
"picocolors": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.9.0"
|
"node": ">=6.9.0"
|
||||||
|
@ -832,25 +833,6 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/array.prototype.filter": {
|
|
||||||
"version": "1.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/array.prototype.filter/-/array.prototype.filter-1.0.3.tgz",
|
|
||||||
"integrity": "sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"call-bind": "^1.0.2",
|
|
||||||
"define-properties": "^1.2.0",
|
|
||||||
"es-abstract": "^1.22.1",
|
|
||||||
"es-array-method-boxes-properly": "^1.0.0",
|
|
||||||
"is-string": "^1.0.7"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/array.prototype.findlastindex": {
|
"node_modules/array.prototype.findlastindex": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.4.tgz",
|
||||||
|
@ -1195,6 +1177,57 @@
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/data-view-buffer": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind": "^1.0.6",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"is-data-view": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/data-view-byte-length": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-4J7wRJD3ABAzr8wP+OcIcqq2dlUKp4DVflx++hs5h5ZKydWMI6/D/fAot+yh6g2tHh8fLFTvNOaVN357NvSrOQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind": "^1.0.7",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"is-data-view": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/data-view-byte-offset": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind": "^1.0.6",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"is-data-view": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
||||||
|
@ -1351,17 +1384,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/es-abstract": {
|
"node_modules/es-abstract": {
|
||||||
"version": "1.22.5",
|
"version": "1.23.2",
|
||||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.5.tgz",
|
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.2.tgz",
|
||||||
"integrity": "sha512-oW69R+4q2wG+Hc3KZePPZxOiisRIqfKBVo/HLx94QcJeWGU/8sZhCvc829rd1kS366vlJbzBfXf9yWwf0+Ko7w==",
|
"integrity": "sha512-60s3Xv2T2p1ICykc7c+DNDPLDMm9t4QxCOUU0K9JxiLjM3C1zB9YVdN7tjxrFd4+AkZ8CdX1ovUga4P2+1e+/w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array-buffer-byte-length": "^1.0.1",
|
"array-buffer-byte-length": "^1.0.1",
|
||||||
"arraybuffer.prototype.slice": "^1.0.3",
|
"arraybuffer.prototype.slice": "^1.0.3",
|
||||||
"available-typed-arrays": "^1.0.7",
|
"available-typed-arrays": "^1.0.7",
|
||||||
"call-bind": "^1.0.7",
|
"call-bind": "^1.0.7",
|
||||||
|
"data-view-buffer": "^1.0.1",
|
||||||
|
"data-view-byte-length": "^1.0.1",
|
||||||
|
"data-view-byte-offset": "^1.0.0",
|
||||||
"es-define-property": "^1.0.0",
|
"es-define-property": "^1.0.0",
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
|
"es-object-atoms": "^1.0.0",
|
||||||
"es-set-tostringtag": "^2.0.3",
|
"es-set-tostringtag": "^2.0.3",
|
||||||
"es-to-primitive": "^1.2.1",
|
"es-to-primitive": "^1.2.1",
|
||||||
"function.prototype.name": "^1.1.6",
|
"function.prototype.name": "^1.1.6",
|
||||||
|
@ -1372,10 +1409,11 @@
|
||||||
"has-property-descriptors": "^1.0.2",
|
"has-property-descriptors": "^1.0.2",
|
||||||
"has-proto": "^1.0.3",
|
"has-proto": "^1.0.3",
|
||||||
"has-symbols": "^1.0.3",
|
"has-symbols": "^1.0.3",
|
||||||
"hasown": "^2.0.1",
|
"hasown": "^2.0.2",
|
||||||
"internal-slot": "^1.0.7",
|
"internal-slot": "^1.0.7",
|
||||||
"is-array-buffer": "^3.0.4",
|
"is-array-buffer": "^3.0.4",
|
||||||
"is-callable": "^1.2.7",
|
"is-callable": "^1.2.7",
|
||||||
|
"is-data-view": "^1.0.1",
|
||||||
"is-negative-zero": "^2.0.3",
|
"is-negative-zero": "^2.0.3",
|
||||||
"is-regex": "^1.1.4",
|
"is-regex": "^1.1.4",
|
||||||
"is-shared-array-buffer": "^1.0.3",
|
"is-shared-array-buffer": "^1.0.3",
|
||||||
|
@ -1386,17 +1424,17 @@
|
||||||
"object-keys": "^1.1.1",
|
"object-keys": "^1.1.1",
|
||||||
"object.assign": "^4.1.5",
|
"object.assign": "^4.1.5",
|
||||||
"regexp.prototype.flags": "^1.5.2",
|
"regexp.prototype.flags": "^1.5.2",
|
||||||
"safe-array-concat": "^1.1.0",
|
"safe-array-concat": "^1.1.2",
|
||||||
"safe-regex-test": "^1.0.3",
|
"safe-regex-test": "^1.0.3",
|
||||||
"string.prototype.trim": "^1.2.8",
|
"string.prototype.trim": "^1.2.9",
|
||||||
"string.prototype.trimend": "^1.0.7",
|
"string.prototype.trimend": "^1.0.8",
|
||||||
"string.prototype.trimstart": "^1.0.7",
|
"string.prototype.trimstart": "^1.0.7",
|
||||||
"typed-array-buffer": "^1.0.2",
|
"typed-array-buffer": "^1.0.2",
|
||||||
"typed-array-byte-length": "^1.0.1",
|
"typed-array-byte-length": "^1.0.1",
|
||||||
"typed-array-byte-offset": "^1.0.2",
|
"typed-array-byte-offset": "^1.0.2",
|
||||||
"typed-array-length": "^1.0.5",
|
"typed-array-length": "^1.0.5",
|
||||||
"unbox-primitive": "^1.0.2",
|
"unbox-primitive": "^1.0.2",
|
||||||
"which-typed-array": "^1.1.14"
|
"which-typed-array": "^1.1.15"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
|
@ -1405,12 +1443,6 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/es-array-method-boxes-properly": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/es-define-property": {
|
"node_modules/es-define-property": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
||||||
|
@ -1432,6 +1464,18 @@
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/es-object-atoms": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/es-set-tostringtag": {
|
"node_modules/es-set-tostringtag": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz",
|
||||||
|
@ -2696,6 +2740,21 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-data-view": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-AHkaJrsUVW6wq6JS8y3JnM/GJF/9cf+k20+iDzlSaJrinEo5+7vRiteOSwBhHRiAyQATN1AmY4hwzxJKPmYf+w==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"is-typed-array": "^1.1.13"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-date-object": {
|
"node_modules/is-date-object": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz",
|
||||||
|
@ -3197,28 +3256,29 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/object.entries": {
|
"node_modules/object.entries": {
|
||||||
"version": "1.1.7",
|
"version": "1.1.8",
|
||||||
"resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz",
|
||||||
"integrity": "sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA==",
|
"integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.2",
|
"call-bind": "^1.0.7",
|
||||||
"define-properties": "^1.2.0",
|
"define-properties": "^1.2.1",
|
||||||
"es-abstract": "^1.22.1"
|
"es-object-atoms": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/object.fromentries": {
|
"node_modules/object.fromentries": {
|
||||||
"version": "2.0.7",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz",
|
||||||
"integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==",
|
"integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.2",
|
"call-bind": "^1.0.7",
|
||||||
"define-properties": "^1.2.0",
|
"define-properties": "^1.2.1",
|
||||||
"es-abstract": "^1.22.1"
|
"es-abstract": "^1.23.2",
|
||||||
|
"es-object-atoms": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
|
@ -3228,27 +3288,28 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/object.groupby": {
|
"node_modules/object.groupby": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz",
|
||||||
"integrity": "sha512-bzBq58S+x+uo0VjurFT0UktpKHOZmv4/xePiOA1nbB9pMqpGK7rUPNgf+1YC+7mE+0HzhTMqNUuCqvKhj6FnBw==",
|
"integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"array.prototype.filter": "^1.0.3",
|
"call-bind": "^1.0.7",
|
||||||
"call-bind": "^1.0.5",
|
|
||||||
"define-properties": "^1.2.1",
|
"define-properties": "^1.2.1",
|
||||||
"es-abstract": "^1.22.3",
|
"es-abstract": "^1.23.2"
|
||||||
"es-errors": "^1.0.0"
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/object.values": {
|
"node_modules/object.values": {
|
||||||
"version": "1.1.7",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz",
|
||||||
"integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==",
|
"integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.2",
|
"call-bind": "^1.0.7",
|
||||||
"define-properties": "^1.2.0",
|
"define-properties": "^1.2.1",
|
||||||
"es-abstract": "^1.22.1"
|
"es-object-atoms": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
|
@ -3478,9 +3539,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss": {
|
"node_modules/postcss": {
|
||||||
"version": "8.4.35",
|
"version": "8.4.36",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.36.tgz",
|
||||||
"integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==",
|
"integrity": "sha512-/n7eumA6ZjFHAsbX30yhHup/IMkOmlmvtEi7P+6RMYf+bGJSUHc3geH4a0NSZxAz/RJfiS9tooCTs9LAVYUZKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
|
@ -3499,7 +3560,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.7",
|
"nanoid": "^3.3.7",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"source-map-js": "^1.0.2"
|
"source-map-js": "^1.1.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^10 || ^12 || >=14"
|
"node": "^10 || ^12 || >=14"
|
||||||
|
@ -4047,9 +4108,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map-js": {
|
"node_modules/source-map-js": {
|
||||||
"version": "1.0.2",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.1.0.tgz",
|
||||||
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
|
"integrity": "sha512-9vC2SfsJzlej6MAaMPLu8HiBSHGdRAJ9hVFYN1ibZoNkeanmDmLUcIrj6G9DGL7XMJ54AKg/G75akXl1/izTOw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
|
@ -4091,14 +4152,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string.prototype.trim": {
|
"node_modules/string.prototype.trim": {
|
||||||
"version": "1.2.8",
|
"version": "1.2.9",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz",
|
||||||
"integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==",
|
"integrity": "sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.2",
|
"call-bind": "^1.0.7",
|
||||||
"define-properties": "^1.2.0",
|
"define-properties": "^1.2.1",
|
||||||
"es-abstract": "^1.22.1"
|
"es-abstract": "^1.23.0",
|
||||||
|
"es-object-atoms": "^1.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
|
@ -4108,14 +4170,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/string.prototype.trimend": {
|
"node_modules/string.prototype.trimend": {
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.8.tgz",
|
||||||
"integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==",
|
"integrity": "sha512-p73uL5VCHCO2BZZ6krwwQE3kCzM7NKmis8S//xEC6fQonchbum4eP6kR4DLEjQFO3Wnj3Fuo8NM0kOSjVdHjZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.2",
|
"call-bind": "^1.0.7",
|
||||||
"define-properties": "^1.2.0",
|
"define-properties": "^1.2.1",
|
||||||
"es-abstract": "^1.22.1"
|
"es-object-atoms": "^1.0.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
|
|
@ -1141,11 +1141,6 @@ video {
|
||||||
padding-bottom: 0.75rem;
|
padding-bottom: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.py-5 {
|
|
||||||
padding-top: 1.25rem;
|
|
||||||
padding-bottom: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pb-1 {
|
.pb-1 {
|
||||||
padding-bottom: 0.25rem;
|
padding-bottom: 0.25rem;
|
||||||
}
|
}
|
||||||
|
@ -1597,6 +1592,11 @@ video {
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.md\:py-5 {
|
||||||
|
padding-top: 1.25rem;
|
||||||
|
padding-bottom: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.md\:pb-0 {
|
.md\:pb-0 {
|
||||||
padding-bottom: 0px;
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,17 +78,17 @@
|
||||||
class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid">
|
class="relative overflow-hidden border-b last:border-b-0 border-gray-100 dark:border-neutral-600 border-solid">
|
||||||
|
|
||||||
<!-- Chart -->
|
<!-- Chart -->
|
||||||
<div class="absolute z-0 bottom-0 left-0 right-0" style="top: 60%;">
|
<div v-if="uiChartType" class="absolute z-0 bottom-0 left-0 right-0 h-6" >
|
||||||
<apexchart width="100%" height="100%" :options="client.chartOptions" :series="client.transferTxSeries">
|
<apexchart width="100%" height="100%" :options="chartOptionsTX" :series="client.transferTxSeries">
|
||||||
</apexchart>
|
</apexchart>
|
||||||
</div>
|
</div>
|
||||||
<div class="absolute z-0 top-0 left-0 right-0" style="bottom: 60%;">
|
<div v-if="uiChartType" class="absolute z-0 top-0 left-0 right-0 h-6" >
|
||||||
<apexchart width="100%" height="100%" :options="client.chartOptions" :series="client.transferRxSeries"
|
<apexchart width="100%" height="100%" :options="chartOptionsRX" :series="client.transferRxSeries"
|
||||||
style="transform: scaleY(-1);">
|
style="transform: scaleY(-1);">
|
||||||
</apexchart>
|
</apexchart>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative py-5 px-3 z-10 flex flex-col sm:flex-row justify-between gap-3">
|
<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 ">
|
<div class="flex gap-3 md:gap-4 w-full items-center ">
|
||||||
|
|
||||||
<!-- Avatar -->
|
<!-- Avatar -->
|
||||||
|
|
|
@ -50,6 +50,13 @@ class API {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getChartType() {
|
||||||
|
return this.call({
|
||||||
|
method: 'get',
|
||||||
|
path: '/ui-chart-type',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async getSession() {
|
async getSession() {
|
||||||
return this.call({
|
return this.call({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
|
|
@ -23,14 +23,33 @@ function bytes(bytes, decimals, kib, maxunit) {
|
||||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
const theme = darkModeMediaQuery.matches ? 'dark' : 'light';
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
const i18n = new VueI18n({
|
||||||
locale: localStorage.getItem('lang') || 'en',
|
locale: localStorage.getItem('lang') || 'en',
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
messages,
|
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(0,0,0,0.2)', dark: 'rgba(255,255,255,0.3)' },
|
||||||
|
tx: { light: 'rgba(0,0,0,0.3)', dark: 'rgba(255,255,255,0.5)' },
|
||||||
|
gradient: { light: ['rgba(0,0,0,0.1)', 'rgba(0,0,0,0)'], dark: ['rgba(255,255,255,0.1)', 'rgba(255,255,255,0)'] },
|
||||||
|
};
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
|
components: {
|
||||||
|
apexchart: VueApexCharts,
|
||||||
|
},
|
||||||
i18n,
|
i18n,
|
||||||
data: {
|
data: {
|
||||||
authenticated: null,
|
authenticated: null,
|
||||||
|
@ -55,10 +74,11 @@ new Vue({
|
||||||
isDark: null,
|
isDark: null,
|
||||||
uiTrafficStats: false,
|
uiTrafficStats: false,
|
||||||
|
|
||||||
|
uiChartType: 0,
|
||||||
|
|
||||||
chartOptions: {
|
chartOptions: {
|
||||||
chart: {
|
chart: {
|
||||||
background: 'transparent',
|
background: 'transparent',
|
||||||
type: 'bar',
|
|
||||||
stacked: false,
|
stacked: false,
|
||||||
toolbar: {
|
toolbar: {
|
||||||
show: false,
|
show: false,
|
||||||
|
@ -66,11 +86,28 @@ new Vue({
|
||||||
animations: {
|
animations: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
parentHeightOffset: 0,
|
||||||
|
sparkline: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
colors: [],
|
||||||
|
stroke: {
|
||||||
|
curve: 'smooth',
|
||||||
|
},
|
||||||
|
fill: {
|
||||||
|
type: 'gradient',
|
||||||
|
gradient: {
|
||||||
|
shade: 'dark',
|
||||||
|
type: 'vertical',
|
||||||
|
shadeIntensity: 1,
|
||||||
|
gradientToColors: CHART_COLORS.gradient[theme],
|
||||||
|
inverseColors: true,
|
||||||
|
opacityFrom: 1,
|
||||||
|
opacityTo: 1,
|
||||||
|
stops: [0, 100],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
colors: [
|
|
||||||
'#DDDDDD', // rx
|
|
||||||
'#EEEEEE', // tx
|
|
||||||
],
|
|
||||||
dataLabels: {
|
dataLabels: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
@ -84,10 +121,10 @@ new Vue({
|
||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
axisTicks: {
|
axisTicks: {
|
||||||
show: true,
|
show: false,
|
||||||
},
|
},
|
||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
|
@ -153,27 +190,41 @@ new Vue({
|
||||||
// Debug
|
// Debug
|
||||||
// client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000;
|
// client.transferRx = this.clientsPersist[client.id].transferRxPrevious + Math.random() * 1000;
|
||||||
// client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000;
|
// client.transferTx = this.clientsPersist[client.id].transferTxPrevious + Math.random() * 1000;
|
||||||
|
// client.latestHandshakeAt = new Date();
|
||||||
|
|
||||||
if (updateCharts) {
|
|
||||||
this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious;
|
this.clientsPersist[client.id].transferRxCurrent = client.transferRx - this.clientsPersist[client.id].transferRxPrevious;
|
||||||
this.clientsPersist[client.id].transferRxPrevious = client.transferRx;
|
this.clientsPersist[client.id].transferRxPrevious = client.transferRx;
|
||||||
this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious;
|
this.clientsPersist[client.id].transferTxCurrent = client.transferTx - this.clientsPersist[client.id].transferTxPrevious;
|
||||||
this.clientsPersist[client.id].transferTxPrevious = client.transferTx;
|
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.push(this.clientsPersist[client.id].transferRxCurrent);
|
||||||
this.clientsPersist[client.id].transferRxHistory.shift();
|
this.clientsPersist[client.id].transferRxHistory.shift();
|
||||||
|
|
||||||
this.clientsPersist[client.id].transferTxHistory.push(this.clientsPersist[client.id].transferTxCurrent);
|
this.clientsPersist[client.id].transferTxHistory.push(this.clientsPersist[client.id].transferTxCurrent);
|
||||||
this.clientsPersist[client.id].transferTxHistory.shift();
|
this.clientsPersist[client.id].transferTxHistory.shift();
|
||||||
}
|
|
||||||
|
|
||||||
client.transferTxCurrent = this.clientsPersist[client.id].transferTxCurrent;
|
this.clientsPersist[client.id].transferTxSeries = [{
|
||||||
client.transferRxCurrent = this.clientsPersist[client.id].transferRxCurrent;
|
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.transferTxHistory = this.clientsPersist[client.id].transferTxHistory;
|
||||||
client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory;
|
client.transferRxHistory = this.clientsPersist[client.id].transferRxHistory;
|
||||||
client.transferMax = Math.max(...client.transferTxHistory, ...client.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.hoverTx = this.clientsPersist[client.id].hoverTx;
|
||||||
client.hoverRx = this.clientsPersist[client.id].hoverRx;
|
client.hoverRx = this.clientsPersist[client.id].hoverRx;
|
||||||
|
|
||||||
|
@ -278,7 +329,7 @@ new Vue({
|
||||||
this.authenticated = session.authenticated;
|
this.authenticated = session.authenticated;
|
||||||
this.requiresPassword = session.requiresPassword;
|
this.requiresPassword = session.requiresPassword;
|
||||||
this.refresh({
|
this.refresh({
|
||||||
updateCharts: true,
|
updateCharts: this.updateCharts,
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
alert(err.message || err.toString());
|
alert(err.message || err.toString());
|
||||||
});
|
});
|
||||||
|
@ -289,7 +340,7 @@ new Vue({
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
this.refresh({
|
this.refresh({
|
||||||
updateCharts: true,
|
updateCharts: this.updateCharts,
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
|
@ -298,10 +349,17 @@ new Vue({
|
||||||
this.uiTrafficStats = res;
|
this.uiTrafficStats = res;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log('Failed to get ui-traffic-stats');
|
|
||||||
this.uiTrafficStats = false;
|
this.uiTrafficStats = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.api.getChartType()
|
||||||
|
.then((res) => {
|
||||||
|
this.uiChartType = parseInt(res, 10);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.uiChartType = 0;
|
||||||
|
});
|
||||||
|
|
||||||
Promise.resolve().then(async () => {
|
Promise.resolve().then(async () => {
|
||||||
const lang = await this.api.getLang();
|
const lang = await this.api.getLang();
|
||||||
if (lang !== localStorage.getItem('lang') && i18n.availableLocales.includes(lang)) {
|
if (lang !== localStorage.getItem('lang') && i18n.availableLocales.includes(lang)) {
|
||||||
|
@ -333,4 +391,27 @@ new Vue({
|
||||||
this.latestRelease = latestRelease;
|
this.latestRelease = latestRelease;
|
||||||
}).catch((err) => console.error(err));
|
}).catch((err) => console.error(err));
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
chartOptionsTX() {
|
||||||
|
const opts = {
|
||||||
|
...this.chartOptions,
|
||||||
|
colors: [CHART_COLORS.tx[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[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;
|
||||||
|
},
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue