mirror of
https://github.com/donaldzou/WGDashboard
synced 2025-02-26 05:58:47 +00:00
Refactor CIDR parsing in configuration components and update dependencies
This commit is contained in:
parent
6979aef88c
commit
5d105eef56
7570
src/static/app/package-lock.json
generated
7570
src/static/app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,40 +4,40 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"buildcommitpush": "./build.sh",
|
"build:commit:push": "./build.sh",
|
||||||
"build electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && electron-builder --mac --win",
|
"build:electron": "vite build && vite build --mode electron && cd ../../../../WGDashboard-Desktop && electron-builder --mac --win",
|
||||||
|
"dev": "vite",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/language-server": "^2.1.10",
|
"@vuepic/vue-datepicker": "^11.0.1",
|
||||||
"@vuepic/vue-datepicker": "^9.0.1",
|
"@vueuse/core": "^12.7.0",
|
||||||
"@vueuse/core": "^10.9.0",
|
|
||||||
"@vueuse/shared": "^10.9.0",
|
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"bootstrap": "^5.3.2",
|
"bootstrap": "^5.3.3",
|
||||||
"bootstrap-icons": "^1.11.3",
|
"bootstrap-icons": "^1.11.3",
|
||||||
"cidr-tools": "^7.0.4",
|
"cidr-tools": "^11.0.3",
|
||||||
"dayjs": "^1.11.12",
|
"dayjs": "^1.11.13",
|
||||||
"electron-builder": "^24.13.3",
|
"fuse.js": "^7.1.0",
|
||||||
"fuse.js": "^7.0.0",
|
"is-cidr": "^5.1.1",
|
||||||
"i": "^0.3.7",
|
"ol": "^10.4.0",
|
||||||
"is-cidr": "^5.0.3",
|
"pinia": "^3.0.1",
|
||||||
"npm": "^10.5.0",
|
"qrcode": "^1.5.4",
|
||||||
"ol": "^10.2.1",
|
|
||||||
"pinia": "^2.1.7",
|
|
||||||
"qrcode": "^1.5.3",
|
|
||||||
"qrcodejs": "^1.0.0",
|
|
||||||
"simple-code-editor": "^2.0.9",
|
"simple-code-editor": "^2.0.9",
|
||||||
"socket.io-client": "^4.8.1",
|
"socket.io-client": "^4.8.1",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^11.1.0",
|
||||||
"vue": "^3.4.29",
|
"vue": "^3.5.13",
|
||||||
"vue-chartjs": "^5.3.0",
|
"vue-chartjs": "^5.3.2",
|
||||||
"vue-router": "^4.2.5"
|
"vue-router": "^4.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.0.0",
|
"@vitejs/plugin-vue": "^5.2.1",
|
||||||
"vite": "^5.0.10"
|
"@vue/language-server": "^2.2.4",
|
||||||
|
"electron-builder": "^25.1.8",
|
||||||
|
"vite": "^6.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0",
|
||||||
|
"npm": ">=10.5.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
import { computed, onMounted, reactive, ref, watch } from "vue";
|
import { computed, onMounted, reactive, ref, watch } from "vue";
|
||||||
import LocaleText from "@/components/text/localeText.vue";
|
import LocaleText from "@/components/text/localeText.vue";
|
||||||
import { WireguardConfigurationsStore } from "@/stores/WireguardConfigurationsStore.js";
|
import { WireguardConfigurationsStore } from "@/stores/WireguardConfigurationsStore.js";
|
||||||
import {parse} from "cidr-tools";
|
import { parseCidr } from "cidr-tools";
|
||||||
import { fetchPost } from "@/utilities/fetch.js";
|
import { fetchPost } from "@/utilities/fetch.js";
|
||||||
import { DashboardConfigurationStore } from "@/stores/DashboardConfigurationStore.js";
|
import { DashboardConfigurationStore } from "@/stores/DashboardConfigurationStore.js";
|
||||||
import { useRouter } from "vue-router";
|
import { useRouter } from "vue-router";
|
||||||
import ProtocolBadge from "@/components/protocolBadge.vue";
|
import ProtocolBadge from "@/components/protocolBadge.vue";
|
||||||
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
selectedConfigurationBackup: Object
|
selectedConfigurationBackup: Object
|
||||||
})
|
})
|
||||||
@ -63,7 +62,7 @@ const validateListenPort = computed(() => {
|
|||||||
|
|
||||||
const validateAddress = computed(() => {
|
const validateAddress = computed(() => {
|
||||||
try {
|
try {
|
||||||
parse(newConfiguration.Address)
|
parseCidr(newConfiguration.Address)
|
||||||
return true
|
return true
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
@ -92,7 +91,7 @@ onMounted(() => {
|
|||||||
const availableIPAddress = computed(() => {
|
const availableIPAddress = computed(() => {
|
||||||
let p;
|
let p;
|
||||||
try {
|
try {
|
||||||
p = parse(newConfiguration.Address);
|
p = parseCidr(newConfiguration.Address);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import {parse} from "cidr-tools";
|
import { parseCidr } from "cidr-tools";
|
||||||
import '@/utilities/wireguard.js'
|
import '@/utilities/wireguard.js'
|
||||||
import { WireguardConfigurationsStore } from "@/stores/WireguardConfigurationsStore.js";
|
import { WireguardConfigurationsStore } from "@/stores/WireguardConfigurationsStore.js";
|
||||||
import { fetchGet, fetchPost } from "@/utilities/fetch.js";
|
import { fetchGet, fetchPost } from "@/utilities/fetch.js";
|
||||||
@ -141,7 +141,7 @@ export default {
|
|||||||
if (newVal.trim().split("/").filter(x => x.length > 0).length !== 2) {
|
if (newVal.trim().split("/").filter(x => x.length > 0).length !== 2) {
|
||||||
throw Error()
|
throw Error()
|
||||||
}
|
}
|
||||||
let p = parse(newVal);
|
let p = parseCidr(newVal);
|
||||||
let i = p.end - p.start;
|
let i = p.end - p.start;
|
||||||
this.numberOfAvailableIPs = i.toLocaleString();
|
this.numberOfAvailableIPs = i.toLocaleString();
|
||||||
ele.classList.add("is-valid")
|
ele.classList.add("is-valid")
|
||||||
|
Loading…
Reference in New Issue
Block a user