From 559fd9778cad94a7d4b64fa3b4860444fb5b2d19 Mon Sep 17 00:00:00 2001 From: jason5ng32 Date: Fri, 9 Aug 2024 09:42:05 +0800 Subject: [PATCH 1/3] Improvements --- frontend/components/advanced-tools/GlobalLatencyTest.vue | 8 +++++++- frontend/components/advanced-tools/MtrTest.vue | 2 +- frontend/locales/en.json | 4 ++-- frontend/locales/fr.json | 4 ++-- frontend/locales/zh.json | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/components/advanced-tools/GlobalLatencyTest.vue b/frontend/components/advanced-tools/GlobalLatencyTest.vue index 3615ae73..2e67ec76 100644 --- a/frontend/components/advanced-tools/GlobalLatencyTest.vue +++ b/frontend/components/advanced-tools/GlobalLatencyTest.vue @@ -106,7 +106,7 @@ const isMobile = computed(() => store.isMobile); const lang = computed(() => store.lang); let allIPs = computed(() => { const _allIPs = store.Global_ipDataCards; - return _allIPs.filter(ip => ip && !ip.includes(' ') && !ip.includes(':')); + return _allIPs.filter(ip => ip && !ip.includes(' ')); }); const selectedIP = ref(''); @@ -118,6 +118,7 @@ const startPingCheck = () => { trackEvent('Section', 'StartClick', 'GlobalLatency'); // 清空上一次结果 pingResults.value = []; + cleanMap(); let tryCount = 0; // 子函数:发起 ping 请求 const sendPingRequest = async () => { @@ -280,6 +281,11 @@ const drawMap = () => { }); } +// 清除地图数据 +const cleanMap = () => { + document.getElementById('svgMap').innerHTML = ''; +}; + diff --git a/frontend/components/advanced-tools/MtrTest.vue b/frontend/components/advanced-tools/MtrTest.vue index 1728285e..011b9ecb 100644 --- a/frontend/components/advanced-tools/MtrTest.vue +++ b/frontend/components/advanced-tools/MtrTest.vue @@ -93,7 +93,7 @@ const isMobile = computed(() => store.isMobile); const lang = computed(() => store.lang); let allIPs = computed(() => { const _allIPs = store.Global_ipDataCards; - return _allIPs.filter(ip => ip && !ip.includes(' ') && !ip.includes(':')); + return _allIPs.filter(ip => ip && !ip.includes(' ')); }); const selectedIP = ref(''); diff --git a/frontend/locales/en.json b/frontend/locales/en.json index de97d2e8..b8fc8f06 100644 --- a/frontend/locales/en.json +++ b/frontend/locales/en.json @@ -323,7 +323,7 @@ "Title": "Global Latency Test", "Note": "Ping test is a network tool used to measure the round-trip time of data packets from your device to specific targets (in this case, our servers located in different continents and regions). It is a key metric for evaluating network performance.", "Note2": "In this process, IPCheck.ing sends small packets of data from servers around the world to your IP address and measures the time it takes for these packets to travel from the server to your device and back. Through these Ping tests from different geographical locations, you can gain a comprehensive view of the speed and stability of your device's connection to the global network.", - "Note3": "Currently only IPv4 addresses are supported. Please select your IP address for testing.", + "Note3": "Please select your IP address for testing.", "SelectIP": "Select an IP Address", "Region": "Region", "MinDelay": "Min Delay (ms)", @@ -341,7 +341,7 @@ "Title": "MTR Test", "Note": "The MTR (My Traceroute) test performs detailed route tracing of your IP address from servers located in different continents and regions around the world. MTR combines the functionality of traditional traceroute and ping commands to diagnose the quality and performance of network connections in real-time.", "Note2": "This process covers the complete path from various geographical locations to your network environment, providing information on latency and packet loss for each hop. Whether it's congestion in the routing path, latency issues at a specific node, or packet loss during transmission, the MTR test provides critical diagnostic information.", - "Note3": "Currently only IPv4 addresses are supported. Please select your IP address for testing.", + "Note3": "Please select your IP address for testing.", "SelectIP": "Select an IP Address", "Region": "Region", "Run": "Run Test", diff --git a/frontend/locales/fr.json b/frontend/locales/fr.json index befa0336..0190b82a 100644 --- a/frontend/locales/fr.json +++ b/frontend/locales/fr.json @@ -323,7 +323,7 @@ "Title": "Test de latence mondiale", "Note": "Le test de ping est un outil réseau utilisé pour mesurer le temps aller-retour des paquets de données de votre appareil vers des cibles spécifiques (dans ce cas, nos serveurs situés sur différents continents et régions). Il s'agit d'une mesure clé pour évaluer les performances du réseau.", "Note2": "Dans ce processus, IPCheck.ing envoie de petits paquets de données depuis des serveurs du monde entier vers votre adresse IP et mesure le temps qu'il faut à ces paquets pour voyager du serveur à votre appareil et vice versa. Grâce à ces tests de ping depuis différentes localisations géographiques, vous pouvez obtenir une vue complète de la vitesse et de la stabilité de la connexion de votre appareil au réseau mondial.", - "Note3": "Actuellement, seules les adresses IPv4 sont prises en charge. Veuillez sélectionner votre adresse IP pour le test.", + "Note3": "Veuillez sélectionner votre adresse IP pour le test.", "SelectIP": "Choisissez un IP", "Region": "Région", "MinDelay": "Délai minimum (ms)", @@ -341,7 +341,7 @@ "Title": "Test MTR", "Note": "Le test MTR (My Traceroute) effectue une traçabilité détaillée de votre adresse IP à partir de serveurs situés sur différents continents et régions du monde. Le test MTR combine les fonctionnalités des commandes de traceroute traditionnelles et de ping pour diagnostiquer la qualité et les performances des connexions réseau en temps réel.", "Note2": "Ce processus couvre le chemin complet depuis différentes localisations géographiques jusqu'à votre environnement réseau, fournissant des informations sur la latence et la perte de paquets pour chaque saut. Qu'il s'agisse de congestion dans le chemin de routage, de problèmes de latence à un nœud spécifique ou de perte de paquets pendant la transmission, le test MTR fournit des informations de diagnostic essentielles.", - "Note3": "Actuellement, seules les adresses IPv4 sont prises en charge. Veuillez sélectionner votre adresse IP pour le test.", + "Note3": "Veuillez sélectionner votre adresse IP pour le test.", "SelectIP": "Choisissez un IP", "Region": "Région", "Run": "Démarrez", diff --git a/frontend/locales/zh.json b/frontend/locales/zh.json index 5472ce27..dbc9e158 100644 --- a/frontend/locales/zh.json +++ b/frontend/locales/zh.json @@ -323,7 +323,7 @@ "Title": "全球延迟测试", "Note": "Ping 测试是一种网络工具,用于测量数据包从你的设备到特定目标(在这里是我们分布在全球各个大洲和地区的服务器)的往返时间。是评估网络性能的关键指标。", "Note2": "在这个过程中,IPCheck.ing 会从世界各地的服务器发送小数据包到你的 IP 地址,然后测量这些数据包从服务器发送到你的设备,再返回服务器所需的时间。通过这些不同地理位置的 Ping 测试,你可以获得一个全面的视图,了解你的设备与全球网络连接的速度和稳定性。", - "Note3": "目前仅支持 IPv4 地址,请选取你的 IP 地址进行测试:", + "Note3": "请选取你的 IP 地址进行测试:", "SelectIP": "选择一个 IP 地址", "Region": "地区", "MinDelay": "最小延迟(ms)", @@ -341,7 +341,7 @@ "Title": "MTR 测试", "Note": "MTR (My Traceroute) 测试会从遍布全球不同大洲和地区的服务器出发,对你的 IP 地址进行详细的路由跟踪。MTR 结合了传统 traceroute 和 ping 命令的功能,能够实时地诊断网络连接的质量和性能。", "Note2": "这个过程涵盖了从各个地理位置到你的网络环境的完整路径,提供关于每一跳的延迟和数据包丢失信息。无论是路由路径的拥堵、某个特定节点的延迟问题,还是数据包在传输过程中的丢失,MTR 测试都能提供关键的诊断信息。", - "Note3": "目前仅支持 IPv4 地址,请选取你的 IP 地址进行测试:", + "Note3": "请选取你的 IP 地址进行测试:", "SelectIP": "选择一个 IP 地址", "Region": "地区", "Run": "运行测试", From e4743116f625549b69d46986306ba4967d46ed5c Mon Sep 17 00:00:00 2001 From: jason5ng32 Date: Fri, 9 Aug 2024 17:53:24 +0800 Subject: [PATCH 2/3] Improvements --- frontend/components/IpInfos.vue | 2 +- frontend/components/WebRtcTest.vue | 2 +- frontend/components/advanced-tools/GlobalLatencyTest.vue | 2 +- frontend/components/advanced-tools/MtrTest.vue | 2 +- frontend/components/advanced-tools/RuleTest.vue | 2 +- frontend/store.js | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/components/IpInfos.vue b/frontend/components/IpInfos.vue index 66a23944..d4075a95 100644 --- a/frontend/components/IpInfos.vue +++ b/frontend/components/IpInfos.vue @@ -528,7 +528,7 @@ watch(() => userPreferences.value.ipGeoSource, (newVal, oldVal) => { watch(IPArray, () => { - store.updateGlobalIpDataCards(IPArray.value); + store.updateAllIPs(IPArray.value); }); onMounted(() => { diff --git a/frontend/components/WebRtcTest.vue b/frontend/components/WebRtcTest.vue index f4e7f499..21574496 100644 --- a/frontend/components/WebRtcTest.vue +++ b/frontend/components/WebRtcTest.vue @@ -175,7 +175,7 @@ onMounted(() => { }); watch(IPArray, () => { - store.updateGlobalIpDataCards(IPArray.value); + store.updateAllIPs(IPArray.value); }, { deep: true }); defineExpose({ diff --git a/frontend/components/advanced-tools/GlobalLatencyTest.vue b/frontend/components/advanced-tools/GlobalLatencyTest.vue index 2e67ec76..a0ac3f99 100644 --- a/frontend/components/advanced-tools/GlobalLatencyTest.vue +++ b/frontend/components/advanced-tools/GlobalLatencyTest.vue @@ -105,7 +105,7 @@ const isDarkMode = computed(() => store.isDarkMode); const isMobile = computed(() => store.isMobile); const lang = computed(() => store.lang); let allIPs = computed(() => { - const _allIPs = store.Global_ipDataCards; + const _allIPs = store.allIPs; return _allIPs.filter(ip => ip && !ip.includes(' ')); }); diff --git a/frontend/components/advanced-tools/MtrTest.vue b/frontend/components/advanced-tools/MtrTest.vue index 011b9ecb..20ce15a1 100644 --- a/frontend/components/advanced-tools/MtrTest.vue +++ b/frontend/components/advanced-tools/MtrTest.vue @@ -92,7 +92,7 @@ const isDarkMode = computed(() => store.isDarkMode); const isMobile = computed(() => store.isMobile); const lang = computed(() => store.lang); let allIPs = computed(() => { - const _allIPs = store.Global_ipDataCards; + const _allIPs = store.allIPs; return _allIPs.filter(ip => ip && !ip.includes(' ')); }); diff --git a/frontend/components/advanced-tools/RuleTest.vue b/frontend/components/advanced-tools/RuleTest.vue index e13e0ed0..ea05f5e3 100644 --- a/frontend/components/advanced-tools/RuleTest.vue +++ b/frontend/components/advanced-tools/RuleTest.vue @@ -139,7 +139,7 @@ onMounted(() => { }); watch(IPArray, () => { - store.updateGlobalIpDataCards(IPArray.value); + store.updateAllIPs(IPArray.value); }, { deep: true }); diff --git a/frontend/store.js b/frontend/store.js index 80efe67c..d4f3762c 100644 --- a/frontend/store.js +++ b/frontend/store.js @@ -22,7 +22,7 @@ export const useMainStore = defineStore('main', { isDarkMode: false, isMobile: false, shouldRefreshEveryThing: false, - Global_ipDataCards: [], + allIPs: [], configs: {}, userPreferences: {}, alert: { @@ -70,9 +70,9 @@ export const useMainStore = defineStore('main', { this.alert = { alertToShow, alertStyle, alertMessage, alertTitle }; }, // 从不同的组件收集合并 IP 数据 - updateGlobalIpDataCards(payload) { - const uniqueIPs = new Set([...this.Global_ipDataCards, ...payload]); - this.Global_ipDataCards = Array.from(uniqueIPs); + updateAllIPs(payload) { + const uniqueIPs = new Set([...this.allIPs, ...payload]); + this.allIPs = Array.from(uniqueIPs); }, // 设置移动模式 setIsMobile(payload) { From e24e3eb0daf6898ab4f57116564fb2fe3f4fcc3a Mon Sep 17 00:00:00 2001 From: jason5ng32 Date: Sat, 10 Aug 2024 13:29:48 +0800 Subject: [PATCH 3/3] Bug fix --- frontend/components/advanced-tools/CensorshipCheck.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/components/advanced-tools/CensorshipCheck.vue b/frontend/components/advanced-tools/CensorshipCheck.vue index e24633f3..e6222011 100644 --- a/frontend/components/advanced-tools/CensorshipCheck.vue +++ b/frontend/components/advanced-tools/CensorshipCheck.vue @@ -265,7 +265,8 @@ const startHttpCheck = () => { return await response.json(); } catch (error) { console.error("Error sending HTTP request:", error); - errorMsg.value = t('censorshipcheck.fetchError'); + censorshipCheckStatus.value = "error"; + errorMsg.value = t('censorshipcheck.invalidURL'); } }; @@ -295,6 +296,8 @@ const startHttpCheck = () => { } } catch (error) { console.error("Error fetching HTTP results:", error); + censorshipCheckStatus.value = "error"; + errorMsg.value = t('censorshipcheck.fetchError'); } };