4 Commits

Author SHA1 Message Date
typist
b5a811e5ee 0.0.14
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m0s
2025-10-29 07:28:46 +08:00
typist
b3adfe5c8f refactor: update IP query API and response handling
- Switched from ip-api.com to ipinfo.io for IP information retrieval, ensuring more reliable service.
- Simplified response handling by directly using the data returned from ipinfo.io, eliminating unnecessary data transformation.
- Adjusted risk level determination logic to utilize the 'org' field for identifying potential hosting or datacenter IPs.
2025-10-29 07:28:21 +08:00
typist
8eda2eae99 0.0.13
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m1s
2025-10-29 07:18:09 +08:00
typist
99673913a6 chore: comment out cache settings in build workflow
- Temporarily disabled cache-from and cache-to settings in the build workflow to prevent potential issues with the build process.
- Retained platform specification for compatibility.
2025-10-29 07:18:02 +08:00
3 changed files with 18 additions and 34 deletions

View File

@@ -43,8 +43,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ secrets.REGISTRY_ENDPOINT }}/${{ github.repository_owner }}/litek:buildcache
cache-to: type=registry,ref=${{ secrets.REGISTRY_ENDPOINT }}/${{ github.repository_owner }}/litek:buildcache,mode=max
# cache-from: type=registry,ref=${{ secrets.REGISTRY_ENDPOINT }}/${{ github.repository_owner }}/litek:buildcache
# cache-to: type=registry,ref=${{ secrets.REGISTRY_ENDPOINT }}/${{ github.repository_owner }}/litek:buildcache,mode=max
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64

View File

@@ -1,7 +1,7 @@
{
"name": "litek",
"private": true,
"version": "0.0.12",
"version": "0.0.14",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -91,8 +91,8 @@ const Tool: FC = () => {
const startTime = performance.now();
try {
// 使用 ip-api.com (免费,功能较全)
const response = await fetch(`http://ip-api.com/json/${encodeURIComponent(ip.trim())}?fields=status,message,country,countryCode,region,city,lat,lon,timezone,isp,org,as,proxy,hosting,query`);
// 使用 ipinfo.io (免费,稳定可靠)
const response = await fetch(`https://ipinfo.io/${encodeURIComponent(ip.trim())}/json`);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
@@ -103,28 +103,8 @@ const Tool: FC = () => {
setQueryTime(endTime - startTime);
if (data.status === "fail") {
toast.error(data.message || "Query failed");
return;
}
// 转换为统一格式
const ipData: IPInfo = {
ip: data.query,
city: data.city,
region: data.region,
country: data.country,
countryCode: data.countryCode,
loc: data.lat && data.lon ? `${data.lat},${data.lon}` : undefined,
timezone: data.timezone,
isp: data.isp,
org: data.org,
as: data.as,
proxy: data.proxy,
hosting: data.hosting,
};
setIpInfo(ipData);
// ipinfo.io 返回格式已经符合 IPInfo 接口
setIpInfo(data);
toast.success("Query successful");
} catch (error) {
if (error instanceof Error) {
@@ -146,14 +126,18 @@ const Tool: FC = () => {
const getRiskLevel = () => {
if (!ipInfo) return null;
if (ipInfo.proxy || ipInfo.hosting) {
// ipinfo.io 通过 org 字段可以简单判断是否为托管IP
const orgLower = ipInfo.org?.toLowerCase() || "";
const isHosting = orgLower.includes("hosting") ||
orgLower.includes("datacenter") ||
orgLower.includes("cloud") ||
orgLower.includes("server");
if (isHosting) {
return {
level: "High",
color: "text-red-500",
reasons: [
ipInfo.proxy && "Proxy/VPN detected",
ipInfo.hosting && "Hosting/Datacenter IP",
].filter(Boolean),
level: "Medium",
color: "text-yellow-500",
reasons: ["Possible Hosting/Datacenter IP"],
};
}