Skip to content

Commit

Permalink
Merge pull request #232 from jason5ng32/dev
Browse files Browse the repository at this point in the history
Improvements
  • Loading branch information
jason5ng32 authored Aug 14, 2024
2 parents 4299044 + e24e3eb commit 266d916
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion frontend/components/IpInfos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ watch(() => userPreferences.value.ipGeoSource, (newVal, oldVal) => {
watch(IPArray, () => {
store.updateGlobalIpDataCards(IPArray.value);
store.updateAllIPs(IPArray.value);
});
onMounted(() => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/WebRtcTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ onMounted(() => {
});
watch(IPArray, () => {
store.updateGlobalIpDataCards(IPArray.value);
store.updateAllIPs(IPArray.value);
}, { deep: true });
defineExpose({
Expand Down
5 changes: 4 additions & 1 deletion frontend/components/advanced-tools/CensorshipCheck.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
};
Expand Down Expand Up @@ -295,6 +296,8 @@ const startHttpCheck = () => {
}
} catch (error) {
console.error("Error fetching HTTP results:", error);
censorshipCheckStatus.value = "error";
errorMsg.value = t('censorshipcheck.fetchError');
}
};
Expand Down
10 changes: 8 additions & 2 deletions frontend/components/advanced-tools/GlobalLatencyTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ const isDarkMode = computed(() => store.isDarkMode);
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(':'));
const _allIPs = store.allIPs;
return _allIPs.filter(ip => ip && !ip.includes(' '));
});
const selectedIP = ref('');
Expand All @@ -118,6 +118,7 @@ const startPingCheck = () => {
trackEvent('Section', 'StartClick', 'GlobalLatency');
// 清空上一次结果
pingResults.value = [];
cleanMap();
let tryCount = 0;
// 子函数:发起 ping 请求
const sendPingRequest = async () => {
Expand Down Expand Up @@ -280,6 +281,11 @@ const drawMap = () => {
});
}
// 清除地图数据
const cleanMap = () => {
document.getElementById('svgMap').innerHTML = '';
};
</script>

<style scoped></style>
4 changes: 2 additions & 2 deletions frontend/components/advanced-tools/MtrTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const isDarkMode = computed(() => store.isDarkMode);
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(':'));
const _allIPs = store.allIPs;
return _allIPs.filter(ip => ip && !ip.includes(' '));
});
const selectedIP = ref('');
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/advanced-tools/RuleTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ onMounted(() => {
});
watch(IPArray, () => {
store.updateGlobalIpDataCards(IPArray.value);
store.updateAllIPs(IPArray.value);
}, { deep: true });
</script>

Expand Down
4 changes: 2 additions & 2 deletions frontend/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions frontend/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions frontend/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
"Title": "全球延迟测试",
"Note": "Ping 测试是一种网络工具,用于测量数据包从你的设备到特定目标(在这里是我们分布在全球各个大洲和地区的服务器)的往返时间。是评估网络性能的关键指标。",
"Note2": "在这个过程中,IPCheck.ing 会从世界各地的服务器发送小数据包到你的 IP 地址,然后测量这些数据包从服务器发送到你的设备,再返回服务器所需的时间。通过这些不同地理位置的 Ping 测试,你可以获得一个全面的视图,了解你的设备与全球网络连接的速度和稳定性。",
"Note3": "目前仅支持 IPv4 地址,请选取你的 IP 地址进行测试:",
"Note3": "请选取你的 IP 地址进行测试:",
"SelectIP": "选择一个 IP 地址",
"Region": "地区",
"MinDelay": "最小延迟(ms)",
Expand All @@ -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": "运行测试",
Expand Down
8 changes: 4 additions & 4 deletions frontend/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useMainStore = defineStore('main', {
isDarkMode: false,
isMobile: false,
shouldRefreshEveryThing: false,
Global_ipDataCards: [],
allIPs: [],
configs: {},
userPreferences: {},
alert: {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 266d916

Please sign in to comment.