Skip to content

Commit

Permalink
Merge pull request #206 from jason5ng32/dev
Browse files Browse the repository at this point in the history
Improvements
jason5ng32 authored May 14, 2024
2 parents 18b2842 + 4e6a40e commit 296fefb
Showing 54 changed files with 419 additions and 344 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -26,4 +26,4 @@ dist-ssr
.vscode/extensions.json

package-lock.json
res
localtest
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🧰 MyIP - A Better IP Toolbox

![IPCheck.ing Banner](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/gh_banner.png)
![IPCheck.ing Banner](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/gh_banner.png)

![GitHub Repo stars](https://img.shields.io/github/stars/jason5ng32/MyIP)
![GitHub forks](https://img.shields.io/github/forks/jason5ng32/myip)
@@ -23,8 +23,8 @@

Notes: You can use my demo for free, and you can also deploy it yourself.

[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)

## 👀 Main Features

6 changes: 3 additions & 3 deletions README_FR.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🧰 MyIP - Une meilleure boîte à outils IP

![IPCheck.ing Banner](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/gh_banner.png)
![IPCheck.ing Banner](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/gh_banner.png)

![GitHub Repo stars](https://img.shields.io/github/stars/jason5ng32/MyIP)
![GitHub forks](https://img.shields.io/github/forks/jason5ng32/myip)
@@ -23,8 +23,8 @@

Notes: Vous pouvez utiliser ma démo gratuitement et vous pouvez également la déployer vous-même.

[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)

## 👀 Principales fonctionnalités

6 changes: 3 additions & 3 deletions README_ZH.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🧰 IP 工具箱

![IPCheck.ing Banner](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/gh_banner.png)
![IPCheck.ing Banner](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/gh_banner.png)

![GitHub Repo stars](https://img.shields.io/github/stars/jason5ng32/MyIP)
![GitHub forks](https://img.shields.io/github/forks/jason5ng32/myip)
@@ -23,8 +23,8 @@

备注:你可以直接用我已经搭建好的服务,也可以自行搭建。

[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)
[![Deploy with Vercel](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/Vercel.svg)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fjason5ng32%2FMyIP&project-name=MyIP&repository-name=MyIP)
[![Deploy with Docker](https://raw.githubusercontent.com/jason5ng32/MyIP/main/public/github/Docker.svg)](https://hub.docker.com/r/jason5ng32/myip)

这是我第一次用 Vue.js 练手的项目。我……只是一个普通的产品经理。

30 changes: 28 additions & 2 deletions api/cfradar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import { refererCheck } from '../lib/referer-check.js';
import { parse } from 'dotenv';
import { refererCheck } from '../common/referer-check.js';

// 创建一个用于设置 headers 的通用函数
function createFetchOptions() {
@@ -91,6 +92,30 @@ function isValidASN(asn) {
return /^[0-9]+$/.test(asn);
};


// 格式化输出

function formatData(data) {
const { asnName, asnOrgName, estimatedUsers, IPv4_Pct, IPv6_Pct, HTTP_Pct, HTTPS_Pct, Desktop_Pct, Mobile_Pct, Bot_Pct, Human_Pct } = data;
const formattedData = {
asnName,
asnOrgName,
estimatedUsers: parseFloat(estimatedUsers).toLocaleString(),
IPv4_Pct: `${parseFloat(IPv4_Pct).toFixed(2)}%`,
IPv6_Pct: `${parseFloat(IPv6_Pct).toFixed(2)}%`,
HTTP_Pct: `${parseFloat(HTTP_Pct).toFixed(2)}%`,
HTTPS_Pct: `${parseFloat(HTTPS_Pct).toFixed(2)}%`,
Desktop_Pct: `${parseFloat(Desktop_Pct).toFixed(2)}%`,
Mobile_Pct: `${parseFloat(Mobile_Pct).toFixed(2)}%`,
Bot_Pct: `${parseFloat(Bot_Pct).toFixed(2)}%`,
Human_Pct: `${parseFloat(Human_Pct).toFixed(2)}%`
};

return formattedData;

}


// 导出函数
export default async (req, res) => {

@@ -140,8 +165,9 @@ export default async (req, res) => {
}

const cleanedResponse = cleanUpResponseData(response);
const finalResponse = formatData(cleanedResponse);

res.json(cleanedResponse);
res.json(finalResponse);
} catch (error) {
console.error(error);
res.status(500).json({ error: 'Internal server error' });
2 changes: 1 addition & 1 deletion api/configs.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { refererCheck } from '../lib/referer-check.js';
import { refererCheck } from '../common/referer-check.js';

// 验证环境变量是否存在,以进行前端功能的开启和关闭
export default (req, res) => {
2 changes: 1 addition & 1 deletion api/dnsresolver.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// api/dnsresolver.js
import { Resolver } from 'dns';
import { promisify } from 'util';
import { refererCheck } from '../lib/referer-check.js';
import { refererCheck } from '../common/referer-check.js';

// 普通 DNS 服务器列表
const dnsServers = {
2 changes: 1 addition & 1 deletion api/invisibilitytest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { get } from 'https';
import { refererCheck } from '../lib/referer-check.js';
import { refererCheck } from '../common/referer-check.js';

// 如果长度不等于 28 且不是字母与数字的组合,则返回 false
function isValidUserID(userID) {
4 changes: 2 additions & 2 deletions api/ipapicom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from 'http';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

export default (req, res) => {
// 限制只能从指定域名访问
4 changes: 2 additions & 2 deletions api/ipapiis.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from 'https';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

export default (req, res) => {
// 限制只能从指定域名访问
4 changes: 2 additions & 2 deletions api/ipchecking.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from 'https';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

export default (req, res) => {

4 changes: 2 additions & 2 deletions api/ipinfo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from 'https';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

// 国家代码
async function loadCountryCodes() {
15 changes: 4 additions & 11 deletions api/ipsb.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { get } from 'https';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

export default (req, res) => {

// 限制只能从指定域名访问
const allowedDomains = ['localhost', ...(process.env.ALLOWED_DOMAINS || '').split(',')];
const referer = req.headers.referer;

if (referer) {
const domain = new URL(referer).hostname;
if (!allowedDomains.includes(domain)) {
return res.status(403).json({ error: 'Access denied' });
}
} else {
return res.status(403).json({ error: 'What are you doing?' });
if (!refererCheck(referer)) {
return res.status(403).json({ error: referer ? 'Access denied' : 'What are you doing?' });
}

const ipAddress = req.query.ip;
4 changes: 2 additions & 2 deletions api/keycdn.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from 'https';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

export default (req, res) => {
// 限制只能从指定域名访问
2 changes: 1 addition & 1 deletion api/map.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { get } from 'https';
import { refererCheck } from '../lib/referer-check.js';
import { refererCheck } from '../common/referer-check.js';

// 验证请求合法性

4 changes: 2 additions & 2 deletions api/whois.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import whoiser from 'whoiser';
import { isValidIP } from '../lib/valid-ip.js';
import { refererCheck } from '../lib/referer-check.js';
import { isValidIP } from '../common/valid-ip.js';
import { refererCheck } from '../common/referer-check.js';

function isValidDomain(domain) {
const domainPattern = /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i;
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/App.vue
Original file line number Diff line number Diff line change
@@ -312,7 +312,7 @@ const ShortcutKeys = (isOriginalSite) => {
}
const card = IPCheckRef.value.ipDataCards[num - 1];
scrollToElement("IPInfo-" + num, 171);
IPCheckRef.value.refreshCard(card);
IPCheckRef.value.refreshCard(card, num - 1);
trackEvent('ShortCut', 'ShortCut', 'IPCheck');
},
description: t('shortcutKeys.RefreshIPCard'),
353 changes: 71 additions & 282 deletions frontend/components/IpInfos.vue

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions frontend/components/advanced-tools/InvisibilityTest.vue
Original file line number Diff line number Diff line change
@@ -278,6 +278,7 @@ const errorMsg = ref('');
const testResults = ref({});
const userID = ref('');
const isAgreed = ref(false);
const retryCount = ref(0);
// 生成28位字符串
const generate28DigitString = () => {
@@ -320,12 +321,12 @@ const onSubmit = () => {
loadScript();
setTimeout(() => {
getResult(userID.value, 0);
getResult();
}, 6000);
};
// 获取测试结果
const getResult = async (retryCount = 0) => {
const getResult = async () => {
try {
const response = await fetch(`/api/invisibility?id=${userID.value}`);
if (!response.ok) {
@@ -334,20 +335,19 @@ const getResult = async (retryCount = 0) => {
const data = await response.json();
// 检查并重试
if (data.message === "Data not found" && retryCount < 3) {
console.log(`Data not found, retrying... (${retryCount + 1})`);
if (data.message === "Data not found" && retryCount.value < 3) {
setTimeout(() => {
getResult(retryCount + 1);
}, 4000);
getResult();
}, 4000, retryCount.value++ );
return;
}
testResults.value = data;
} catch (error) {
console.error('Error fetching InvisibilityTest results:', error);
if (retryCount < 3) {
if (retryCount.value < 3) {
setTimeout(() => {
getResult(retryCount + 1);
}, 4000);
getResult();
}, 4000, retryCount.value + 1);
return;
} else {
errorMsg.value = t('invisibilitytest.fetchError');
@@ -356,6 +356,7 @@ const getResult = async (retryCount = 0) => {
removeScript();
}
checkingStatus.value = 'idle';
retryCount.value = 0;
};
</script>
6 changes: 3 additions & 3 deletions frontend/i18n.js → frontend/locales/i18n.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createI18n } from 'vue-i18n';


import en from './locales/en.json';
import zh from './locales/zh.json';
import fr from './locales/fr.json';
import en from './en.json';
import zh from './zh.json';
import fr from './fr.json';


const messages = { en, zh, fr };
4 changes: 2 additions & 2 deletions frontend/main.js
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@ import { createApp } from 'vue'
import { createPinia } from 'pinia';
import { useMainStore } from './store';
import App from './App.vue'
import i18n from './i18n';
import i18n from './locales/i18n';
import router from './router';
import { analytics } from './utils/use-analytics';

import { Tooltip } from 'bootstrap';
import { detectOS } from './utils/system-detect';
import './style.css'
import './style/style.css'

const app = createApp(App);
const pinia = createPinia();
2 changes: 1 addition & 1 deletion frontend/style.css → frontend/style/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import 'bootstrap/dist/css/bootstrap.min.css';
@import 'bootstrap-icons/font/bootstrap-icons.css';
@import 'bootstrap-icons/font/bootstrap-icons.min.css';
@import 'flag-icons/css/flag-icons.min.css';

.jn-title {
23 changes: 23 additions & 0 deletions frontend/utils/getips/cloudflare-cn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 从 Cloudflare 中国获取 IP 地址
const getIPFromCloudflare_CN = async () => {
try {
const response = await fetch("https://cf-ns.com/cdn-cgi/trace");
const data = await response.text();
const lines = data.split("\n");
const ipLine = lines.find((line) => line.startsWith("ip="));
let ip = "";
if (ipLine) {
ip = ipLine.split("=")[1];
}
const source = "CF-CN";
return { ip: ip, source: source };
} catch (error) {
console.error("Error fetching IP from Cloudflare:", error);
return {
ip: null,
source: "CF-CN"
};
}
};

export { getIPFromCloudflare_CN };
23 changes: 23 additions & 0 deletions frontend/utils/getips/cloudflare-v4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 从 Cloudflare 获取 IPv4 地址
const getIPFromCloudflare_V4 = async () => {
try {
const response = await fetch("https://1.0.0.1/cdn-cgi/trace");
const data = await response.text();
const lines = data.split("\n");
const ipLine = lines.find((line) => line.startsWith("ip="));
let ip = "";
if (ipLine) {
ip = ipLine.split("=")[1];
}
const source = "Cloudflare IPv4";
return { ip: ip, source: source };
} catch (error) {
console.error("Error fetching IP from Cloudflare:", error);
return {
ip: null,
source: "Cloudflare IPv4"
};
}
};

export { getIPFromCloudflare_V4 };
22 changes: 22 additions & 0 deletions frontend/utils/getips/cloudflare-v6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 从 Cloudflare 获取 IPv6 地址
const getIPFromCloudflare_V6 = async () => {
try {
const response = await fetch("https://[2606:4700:4700::1111]/cdn-cgi/trace");
const data = await response.text();
const lines = data.split("\n");
const ipLine = lines.find((line) => line.startsWith("ip="));
let ip = "";
if (ipLine) {
ip = ipLine.split("=")[1];
}
const source = "Cloudflare IPv6";
return { ip: ip, source: source };
} catch (error) {
return {
ip: null,
source: "Cloudflare IPv6"
};
}
};

export { getIPFromCloudflare_V6 };
11 changes: 11 additions & 0 deletions frontend/utils/getips/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { getIPFromIPIP } from "./ipipnet";
import { getIPFromQQ } from "./qqvideo";
import { getIPFromUpai } from "./upai";
import { getIPFromCloudflare_CN } from "./cloudflare-cn";
import { getIPFromCloudflare_V4 } from "./cloudflare-v4";
import { getIPFromCloudflare_V6 } from "./cloudflare-v6";
import { getIPFromGCR } from "./ipchecking";
import { getIPFromIpify_V4 } from "./ipify-v4";
import { getIPFromIpify_V6 } from "./ipify-v6";

export { getIPFromIPIP, getIPFromQQ, getIPFromUpai, getIPFromCloudflare_CN, getIPFromCloudflare_V4, getIPFromCloudflare_V6, getIPFromGCR, getIPFromIpify_V4, getIPFromIpify_V6};
30 changes: 30 additions & 0 deletions frontend/utils/getips/ipchecking.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { getIPFromCloudflare_CN } from "./cloudflare-cn";

// 从 GCR 获取 IP 地址
const getIPFromGCR = async () => {
try {
const url = `https://getipfromgoogle.ipcheck.ing/`;
const response = await fetch(url);
if (!response.ok) {
throw new Error("Network response was not ok");
}

const data = await response.json();
const fullIp = data.ip;
const ip = fullIp.includes(',') ? fullIp.split(',')[0] : fullIp;
const source = "IPCheck.ing";
return {
ip: ip,
source: source
};
} catch (error) {
console.error("Error fetching IP from IPCheck.ing:", error);
let { ip , source } = await getIPFromCloudflare_CN();
return {
ip: ip,
source: source
};
}
};

export { getIPFromGCR };
22 changes: 22 additions & 0 deletions frontend/utils/getips/ipify-v4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// 从 IPify 获取 IPv4 地址
const getIPFromIpify_V4 = async () => {
try {
const response = await fetch("https://api4.ipify.org?format=json");
if (!response.ok) {
throw new Error("Network response was not ok");
}

const data = await response.json();
const ip = data.ip;
const source = "IPify IPv4";
return { ip: ip, source: source };
} catch (error) {
console.error("Error fetching IPv4 address from ipify:", error);
return {
ip: null,
source: "IPify IPv4"
};
}
};

export { getIPFromIpify_V4 };
25 changes: 25 additions & 0 deletions frontend/utils/getips/ipify-v6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// 从 IPify 获取 IPv6 地址
const getIPFromIpify_V6 = async () => {
try {
const response = await fetch("https://api6.ipify.org?format=json");
if (!response.ok) {
throw new Error("Network response was not ok");
}

const data = await response.json();
const ip = data.ip;
const source = "IPify IPv6";
return {
ip: ip,
source: source
};
} catch (error) {
console.error("Error fetching IPv6 address from ipify:", error);
return {
ip: null,
source: "IPify IPv6"
};
}
};

export { getIPFromIpify_V6 };
28 changes: 28 additions & 0 deletions frontend/utils/getips/ipipnet.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { getIPFromQQ } from "./qqvideo";

// 从 IPIP.net 获取 IP 地址
const getIPFromIPIP = async () => {
let ip = "";
let source = "";
try {
const response = await fetch("https://myip.ipip.net/json");
const data = await response.json();
ip = data.data.ip;
source = "IPIP.net";
return {
ip: ip,
source: source
};
} catch (error) {
console.error("Error fetching IP from IPIP.net:", error);
// 故障时尝试从 QQ Video 获取 IP 地址
let { ip , source } = await getIPFromQQ();
return {
ip: ip,
source: source
};
}
};


export { getIPFromIPIP };
45 changes: 45 additions & 0 deletions frontend/utils/getips/qqvideo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 从 QQ Video 获取 IP 地址
const getIPFromQQ = () => {
return new Promise((resolve, reject) => {
// 动态创建 script 标签发起 JSONP 请求
let script = document.createElement("script");
script.src = "https://vv.video.qq.com/checktime?otype=json&callback=ipCallback";
document.head.appendChild(script);

// 设置超时拒绝 Promise,以防万一请求挂起
const timeoutId = setTimeout(() => {
console.error("Request to QQ timed out");
document.head.removeChild(script);
delete window.ipCallback;
reject(new Error("Request to QQ timed out"));
}, 2000);

// 设置成功获取数据的回调
window.ipCallback = (data) => {
clearTimeout(timeoutId); // 取消超时定时器
try {
let ip = data.ip;
let source = "QQ.com";
document.head.removeChild(script);
delete window.ipCallback;
resolve({ ip, source });
} catch (error) {
console.error("Error processing IP data from QQ:", error);
document.head.removeChild(script);
delete window.ipCallback;
resolve({ ip: null, source: "QQ.com"});
}
};

// 设置加载错误处理
script.onerror = () => {
clearTimeout(timeoutId); // 取消超时定时器
console.error("Error loading script for IP data from QQ");
document.head.removeChild(script);
delete window.ipCallback;
resolve({ ip: null, source: "QQ.com"});
};
});
};

export { getIPFromQQ };
27 changes: 27 additions & 0 deletions frontend/utils/getips/upai.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { getIPFromCloudflare_CN } from "./cloudflare-cn";

// 从 Upai 获取 IP 地址
const getIPFromUpai = async () => {
try {
const unixTime = Date.now();
const url = `https://pubstatic.b0.upaiyun.com/?_upnode&t=${unixTime}`;
const response = await fetch(url);
if (!response.ok) {
throw new Error("Network response was not ok");
}

const data = await response.json();
const ip = data.remote_addr;
const source = "Upai";
return { ip: ip, source: source };
} catch (error) {
console.error("Error fetching IP from Upai:", error);
let { ip , source } = await getIPFromCloudflare_CN();
return {
ip: ip,
source: source
};
}
};

export { getIPFromUpai };
4 changes: 2 additions & 2 deletions frontend/utils/masked-info.js
Original file line number Diff line number Diff line change
@@ -14,8 +14,8 @@ function maskedInfo(t) {
fakecard.isp = "Google LLC";
fakecard.asn = "AS15169";
fakecard.asnlink = "https://radar.cloudflare.com/AS15169",
fakecard.mapUrl = '/defaultMap.webp';
fakecard.mapUrl_dark = '/defaultMap_dark.webp';
fakecard.mapUrl = '/res/defaultMap.webp';
fakecard.mapUrl_dark = '/res/defaultMap_dark.webp';
fakecard.showASNInfo = false;
fakecard.isProxy = t('ipInfos.proxyDetect.no');
fakecard.type = t('ipInfos.proxyDetect.type.Business');
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -11,9 +11,10 @@
<meta name="theme-color" content="#f8f9fa">
<meta name="background-color" content="#ffffff">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="/ios-logo-512.png">
<link rel="apple-touch-icon" href="logos/ios-logo-512.png">
<title>IPCheck.ing - Check My IP Address and Geolocation - Check WebRTC Connection IP - DNS Leak Test - Speed Test - Ping/MTR Test - Jason Ng Open Source </title>
<link rel="icon" href="logo.svg">
<link rel="icon" href="logos/logo.svg">
<link rel="icon" type="image/svg+xml" href="favicon.svg">

<style>
.jn-spinner {
Binary file modified public/favicon.ico
100644 → 100755
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added public/logos/favicon.ico
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions public/logos/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -36,18 +36,18 @@ export default defineConfig({
description: 'All in one IP Toolbox',
icons: [
{
src: '/logo-192.webp',
src: '/logos/logo-192.webp',
sizes: '192x192',
type: 'image/webp',
purpose: 'maskable'
},
{
src: '/ios-logo-192.png',
src: '/logos/ios-logo-192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: '/ios-logo-512.png',
src: '/logos/ios-logo-512.png',
sizes: '512x512',
type: 'image/png',
},

0 comments on commit 296fefb

Please sign in to comment.