parent
653f90f258
commit
b47fbfc03b
|
|
@ -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: {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue