Skip to content

Commit

Permalink
Merge pull request #248 from jason5ng32/dev
Browse files Browse the repository at this point in the history
Improvements
  • Loading branch information
jason5ng32 authored Oct 23, 2024
2 parents a054f09 + c1de9cd commit ea78ada
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
5 changes: 4 additions & 1 deletion frontend/components/WebRtcTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ const fetchCountryCode = async (ip) => {
if (ipData) {
let country_code = ipData.country_code.toLowerCase();
let country = getCountryName(ipData.country_code, lang.value);
let country = ipData.country_code || 'N/A';
if (country !== 'N/A') {
country = getCountryName(ipData.country_code, lang.value);
}
return [country_code, country];
}
} catch (error) {
Expand Down
14 changes: 8 additions & 6 deletions frontend/components/advanced-tools/RuleTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@
<span :class="{ 'jn-ip-font': test.ip.length > 32 }">{{ test.ip }}</span>
</p>
<div class="alert" :class="{
'alert-info': test.country_code === t('ruletest.StatusWait'),
'alert-success': test.country_code !== t('ruletest.StatusWait'),
'alert-info': test.country === t('ruletest.StatusWait'),
'alert-danger': test.country === t('ruletest.StatusError'),
'alert-success': test.country !== t('ruletest.StatusWait') && test.country !== t('ruletest.StatusError'),
}" :data-bs-theme="isDarkMode ? 'dark' : ''">
<i class="bi"
:class="[test.ip === t('ruletest.StatusWait') || test.ip === t('ruletest.StatusError') ? 'bi-hourglass-split' : 'bi-geo-alt-fill']"></i>
{{ t('ruletest.Country') }}: <strong>{{ test.country }}&nbsp;</strong>
<span v-if="test.country_code !== t('ruletest.StatusWait')"
<span v-show="test.country_code"
:class="'jn-fl fi fi-' + test.country_code.toLowerCase()"></span>
</div>
</div>
Expand Down Expand Up @@ -76,7 +77,7 @@ const lang = computed(() => store.lang);
const createDefaultCard = () => ({
name: t('ruletest.Name'),
ip: t('ruletest.StatusWait'),
country_code: t('ruletest.StatusWait'),
country_code: '',
country: t('ruletest.StatusWait'),
});
Expand Down Expand Up @@ -109,7 +110,7 @@ const fetchTrace = async (id, url) => {
}
} catch (error) {
ruleTests.value[id].ip = t('ruletest.StatusError');
ruleTests.value[id].country_code = t('ruletest.StatusError');
ruleTests.value[id].country_code = '';
ruleTests.value[id].country = t('ruletest.StatusError');
console.error("Error fetching Data:", error);
}
Expand All @@ -121,7 +122,8 @@ const checkAllRuleTest = async (refresh = false) => {
if (refresh) {
ruleTests.value.forEach((test) => {
test.ip = t('ruletest.StatusWait');
test.country_code = t('ruletest.StatusWait');
test.country = t('ruletest.StatusWait');
test.country_code = '';
});
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/utils/transform-ip-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function transformDataFromIPapi(data, ipGeoSource, t, bingMapLanguage) {

const baseData = {
country_name: data.country_name || "",
country_code: data.country || "",
country_code: data.country === 'N/A' ? '' : data.country,
region: data.region || "",
city: data.city || "",
latitude: data.latitude || "",
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"dependencies": {
"@analytics/google-analytics": "^1.0.7",
"@cloudflare/speedtest": "^1.3.0",
"@khmyznikov/pwa-install": "^0.4.5",
"@khmyznikov/pwa-install": "^0.4.8",
"@thumbmarkjs/thumbmarkjs": "^0.16.0",
"analytics": "^0.8.14",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"code-inspector-plugin": "^0.16.1",
"code-inspector-plugin": "^0.17.3",
"concurrently": "^9.0.1",
"country-code-lookup": "^0.1.3",
"detect-gpu": "^5.0.51",
"detect-gpu": "^5.0.53",
"dotenv": "^16.4.5",
"express": "^4.21.0",
"express": "^4.21.1",
"express-rate-limit": "^7.4.1",
"express-slow-down": "^2.0.3",
"flag-icons": "^7.2.3",
Expand All @@ -34,14 +34,14 @@
"pinia": "^2.2.4",
"svgmap": "^2.11.1",
"ua-parser-js": "^1.0.39",
"vue": "^3.5.11",
"vue": "^3.5.12",
"vue-i18n": "^10.0.4",
"vue-router": "^4.4.5",
"whoiser": "^1.18.0"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.1.4",
"vite": "^5.4.8",
"vite": "^5.4.10",
"vite-plugin-pwa": "^0.20.5"
}
}

0 comments on commit ea78ada

Please sign in to comment.