From 94bf1c24845263046ab3facde1ed9b705fafd96a Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Thu, 19 Sep 2024 22:32:15 +0800 Subject: [PATCH] Finished translating most of the UI. Left with notifications --- src/dashboard.py | 7 ++- src/static/app/package.json | 2 +- .../newPeersComponents/allowedIPsInput.vue | 38 +++++++++---- .../newPeersComponents/bulkAdd.vue | 19 +++++-- .../newPeersComponents/dnsInput.vue | 6 ++- .../newPeersComponents/endpointAllowedIps.vue | 8 ++- .../newPeersComponents/mtuInput.vue | 7 ++- .../newPeersComponents/nameInput.vue | 7 ++- .../persistentKeepAliveInput.vue | 7 ++- .../newPeersComponents/presharedKeyInput.vue | 7 ++- .../privatePublicKeyInput.vue | 18 +++++-- .../configurationComponents/peerCreate.vue | 16 ++++-- .../configurationComponents/peerList.vue | 12 +++-- .../peerSettingsDropdown.vue | 19 ++++--- .../configurationCard.vue | 20 +++++-- .../messageCentreComponent/message.vue | 7 ++- src/static/app/src/components/navbar.vue | 10 ++-- .../src/components/setupComponent/totp.vue | 35 +++++++----- .../app/src/components/signIn/signInTOTP.vue | 4 +- src/static/app/src/views/setup.vue | 52 +++++++++++++----- src/static/app/src/views/share.vue | 25 ++++++--- src/static/locale/zh-CN.json | 54 +++++++++++++++++-- 22 files changed, 290 insertions(+), 90 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index b4a5a5f..18b246d 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -1983,7 +1983,10 @@ def API_ping_getAllPeersIpAddress(): allowed_ip = p.allowed_ip.replace(" ", "").split(",") parsed = [] for x in allowed_ip: - ip = ipaddress.ip_network(x, strict=False) + try: + ip = ipaddress.ip_network(x, strict=False) + except ValueError as e: + print(f"{p.id} - {c.Name}") if len(list(ip.hosts())) == 1: parsed.append(str(ip.hosts()[0])) endpoint = p.endpoint.replace(" ", "").replace("(none)", "") @@ -2073,7 +2076,7 @@ def API_getDashboardUpdate(): htmlUrl = data.get('html_url') if tagName is not None and htmlUrl is not None: if tagName != DASHBOARD_VERSION: - return ResponseObject(message=f"{tagName} is now avaible for update!", data=htmlUrl) + return ResponseObject(message=f"{tagName} is now available for update!", data=htmlUrl) else: return ResponseObject(message="You're on the latest version") return ResponseObject(False) diff --git a/src/static/app/package.json b/src/static/app/package.json index f6eaf0f..95e0531 100644 --- a/src/static/app/package.json +++ b/src/static/app/package.json @@ -1,6 +1,6 @@ { "name": "app", - "version": "4.0.2", + "version": "4.1.0", "private": true, "type": "module", "scripts": { diff --git a/src/static/app/src/components/configurationComponents/newPeersComponents/allowedIPsInput.vue b/src/static/app/src/components/configurationComponents/newPeersComponents/allowedIPsInput.vue index e1ac51e..39675d0 100644 --- a/src/static/app/src/components/configurationComponents/newPeersComponents/allowedIPsInput.vue +++ b/src/static/app/src/components/configurationComponents/newPeersComponents/allowedIPsInput.vue @@ -2,9 +2,12 @@ import {fetchGet} from "@/utilities/fetch.js"; import {WireguardConfigurationsStore} from "@/stores/WireguardConfigurationsStore.js"; import {DashboardConfigurationStore} from "@/stores/DashboardConfigurationStore.js"; +import LocaleText from "@/components/text/localeText.vue"; +import {GetLocale} from "@/utilities/locale.js"; export default { name: "allowedIPsInput", + components: {LocaleText}, props: { data: Object, saving: Boolean, @@ -30,6 +33,9 @@ export default { this.availableIp.filter(x => x.includes(this.availableIpSearchString) && !this.data.allowed_ips.includes(x)) : this.availableIp.filter(x => !this.data.allowed_ips.includes(x)) + }, + inputGetLocale(){ + return GetLocale("Enter IP Address/CIDR") } }, methods: { @@ -40,7 +46,7 @@ export default { return true; } this.allowedIpFormatError = true; - this.dashboardStore.newMessage('WGDashboard', 'Allowed IP is invalid', 'danger') + this.dashboardStore.newMessage('WGDashboard', 'Allowed IPs is invalid', 'danger') return false; } }, @@ -63,7 +69,11 @@ export default {