Skip to content

Commit 7badbe2

Browse files
committed
refactor: drop unreachable geo endpoints (ipapi.is, ipwho.is) — keep ipwhois.app + freeipapi chain
1 parent d8aac81 commit 7badbe2

1 file changed

Lines changed: 0 additions & 29 deletions

File tree

src/detect/collectors.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -385,21 +385,6 @@ export const collectLocaleFormattingInfo = () => {
385385
* 多源链式回退(均为免费无 key 的公益服务)
386386
*/
387387
const IP_GEO_ENDPOINTS = [
388-
{
389-
url: "https://api.ipapi.is/",
390-
normalize: (data) => {
391-
// 兼容扁平与嵌套 location 两种形状
392-
const loc = data?.location || data || {};
393-
return {
394-
ip: data?.ip || "",
395-
timezone: loc.timeZone || data?.timeZone || "N/A",
396-
country: loc.country || data?.country || "N/A",
397-
region: loc.region || data?.region || "",
398-
city: [loc.city, loc.locality].filter(Boolean).join(" / ") || data?.city || "",
399-
organization: data?.organization?.name || data?.organization || data?.org || "",
400-
};
401-
},
402-
},
403388
{
404389
url: "https://ipwhois.app/json/",
405390
normalize: (data) => {
@@ -425,20 +410,6 @@ const IP_GEO_ENDPOINTS = [
425410
organization: data?.asnOrganization || "",
426411
}),
427412
},
428-
{
429-
url: "https://ipwho.is/",
430-
normalize: (data) => {
431-
if (!data?.success) throw new Error(data?.message || "ipwho.is lookup failed");
432-
return {
433-
ip: data.ip || "",
434-
timezone: data.timezone?.id || "N/A",
435-
country: data.country || "N/A",
436-
region: data.region || "",
437-
city: data.city || "",
438-
organization: data.connection?.org || "",
439-
};
440-
},
441-
},
442413
];
443414

444415
export const collectIpTimezoneInfo = async () => {

0 commit comments

Comments
 (0)