-
Notifications
You must be signed in to change notification settings - Fork 216
Open
Description
如果需要使用https://github.com/ljxi/GeoCN 项目自建api,替换原有http://app.netart.cn/network-panel/ip.ajax 接口
需要修改.env文件中
VITE_API_URL =
以及src\components目录下IPinfo.vue 121行 和162行
async function queryIp(ip: string) {
const rsp = await fetch(import.meta.env.VITE_API_URL + "?ip=" + ip, {
method: "GET",
mode: "cors",
redirect: "follow",
referrerPolicy: "no-referrer"
});
let resp = await rsp.json();
return resp; // 原代码为 return resp['data']
}
(async function watchLocalIp() {
if (props.isVisible) {
try {
const response = await fetch(import.meta.env.VITE_API_URL, { referrerPolicy: 'no-referrer' });
let resp = await response.json();
ipInfo.local = await handleIP(resp["ip"]); // 原代码为 resp["data"]["ip"]
} catch (error) {
console.log(error)
}
}
setTimeout(watchLocalIp, 60000)
})();
新API的ip在顶层,不需要通过data获取
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels