Fix: Get IP API
没获取 Query 里面的 IP
This commit is contained in:
@@ -23,7 +23,7 @@ export default Api(
|
|||||||
// 增加使用数量
|
// 增加使用数量
|
||||||
await client.incr("api-next:stat:ip");
|
await client.incr("api-next:stat:ip");
|
||||||
|
|
||||||
const ip = ctx.headers["x-forwarded-for"] || ctx.request.ip.replace(/::\S+:/, "") || "127.0.0.1";
|
const ip = ctx.query.ip || ctx.headers["x-forwarded-for"] || ctx.request.ip.replace(/::\S+:/, "") || "127.0.0.1";
|
||||||
|
|
||||||
const response = await fetch(`http://ip-api.com/json/${ip}?lang=zh-CN`, {
|
const response = await fetch(`http://ip-api.com/json/${ip}?lang=zh-CN`, {
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user