-
-
-
+
diff --git a/WebfrontCore/wwwroot/css/src/profile.scss b/WebfrontCore/wwwroot/css/src/profile.scss
index defc867ae..ca3c89476 100644
--- a/WebfrontCore/wwwroot/css/src/profile.scss
+++ b/WebfrontCore/wwwroot/css/src/profile.scss
@@ -201,3 +201,11 @@
background-color: $dark;
color: $white !important;
}
+
+.ip-lookup-profile {
+ height: 2.5rem;
+ min-width: 3.0rem;
+ background-size: contain;
+ background-repeat: no-repeat;
+ background-position: center;
+}
diff --git a/WebfrontCore/wwwroot/js/profile.js b/WebfrontCore/wwwroot/js/profile.js
index ba442b0c4..3ec8ee536 100644
--- a/WebfrontCore/wwwroot/js/profile.js
+++ b/WebfrontCore/wwwroot/js/profile.js
@@ -12,9 +12,22 @@
const ipAddresses = $('.ip-lookup-profile');
$.each(ipAddresses, function (index, address) {
- $.get('http://ip-api.com/json/' + $(address).data('ip'), function (result) {
- const country = result['country'];
- $('#ip_lookup_country').text(country)
+ let ip = $(address).data('ip');
+ if (ip.length === 0) {
+ return;
+ }
+ $.get('https://ip2c.org/' + ip, function (result) {
+ const countryCode = result.split(';')[1].toLowerCase();
+ const country = result.split(';')[3];
+
+ if (country === 'Unknown') {
+ return;
+ }
+
+ $('#ip_lookup_country').text(country);
+ if (countryCode !== 'zz' && countryCode !== '') {
+ $(address).css('background-image', `url(https://www.countryflags.io/${countryCode}/flat/64.png)`);
+ }
});
});