diff --git a/docs/assets/images/My-IP.jpg b/docs/assets/images/My-IP.jpg index f194e597a..757f2c597 100644 Binary files a/docs/assets/images/My-IP.jpg and b/docs/assets/images/My-IP.jpg differ diff --git a/docs/assets/images/Panel.jpg b/docs/assets/images/Panel.jpg index a03e28edf..53bdf1106 100644 Binary files a/docs/assets/images/Panel.jpg and b/docs/assets/images/Panel.jpg differ diff --git a/src/pages/home.js b/src/pages/home.js index 2538e891b..018e954f3 100644 --- a/src/pages/home.js +++ b/src/pages/home.js @@ -860,21 +860,18 @@ export async function renderHomePage (request, env, proxySettings, isPassSet) { IP Country City - ISP Cloudflare CDN - ${request.headers.get('cf-connecting-ip') || '-'} - ${cfCountry || '-'} - ${request.cf.city || '-'} - ${request.cf.asOrganization.toUpperCase() || '-'} + + + Others - @@ -1015,22 +1012,26 @@ export async function renderHomePage (request, env, proxySettings, isPassSet) { }); const fetchIPInfo = async () => { - const updateUI = (ip = '-', country = '-', country_code = '-', city = '-', isp = '-') => { - const flag = String.fromCodePoint(...[...country_code].map(c => 0x1F1E6 + c.charCodeAt(0) - 65)); - document.getElementById('ip').textContent = ip; - document.getElementById('country').textContent = country + ' ' + flag; - document.getElementById('city').textContent = city; - document.getElementById('isp').textContent = isp.toUpperCase(); + const updateUI = (ip = '-', country = '-', country_code = '-', city = '-', cfIP) => { + const flag = country_code !== '-' ? String.fromCodePoint(...[...country_code].map(c => 0x1F1E6 + c.charCodeAt(0) - 65)) : ''; + document.getElementById(cfIP ? 'cf-ip' : 'ip').textContent = ip; + document.getElementById(cfIP ? 'cf-country' : 'country').textContent = country + ' ' + flag; + document.getElementById(cfIP ? 'cf-city' : 'city').textContent = city; }; - try { - const response = await fetch('https://ipwho.is/'); - const { ip, country, country_code, city, connection } = await response.json(); - updateUI(ip, country, country_code, city, connection.isp); - } catch (error) { - console.error('Error fetching IP address:', error); - updateUI(); + const fetchIPApi = async (cfIP) => { + try { + const response = await fetch('https://ipwho.is/' + cfIP + '?nocache=' + Date.now(), { cache: "no-store" }); + const { ip, country, country_code, city } = await response.json(); + updateUI(ip, country, country_code, city, cfIP); + } catch (error) { + console.error('Error fetching IP address:', error); + updateUI(); + } } + + await fetchIPApi(''); + await fetchIPApi('${request.headers.get('cf-connecting-ip') || '-'}'); } const getWarpConfigs = async () => {