Spaces:
Paused
Paused
muxi feng commited on
Commit ·
a874265
1
Parent(s): cf45ad1
获取真实ip
Browse files- app/api/auth.ts +1 -1
- app/api/lemur/route.ts +1 -0
- app/api/user/code/route.ts +5 -1
- app/api/user/findpwd/route.ts +5 -1
- app/api/user/info/route.ts +3 -2
- app/api/user/kami/route.ts +3 -2
- app/api/user/login/route.ts +3 -1
- app/api/user/logout/route.ts +3 -2
- app/api/user/mail/route.ts +5 -1
- app/api/user/register/route.ts +3 -1
- app/api/user/restmail/route.ts +5 -1
- app/api/user/set/route.ts +3 -2
- app/api/user/sig/route.ts +3 -2
- app/api/user/updatePass/route.ts +3 -2
- app/api/user/vip/route.ts +4 -2
- app/api/user/wallet/route.ts +3 -2
app/api/auth.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ACCESS_CODE_PREFIX } from "../constant";
|
|
| 5 |
|
| 6 |
const serverConfig = getServerSideConfig();
|
| 7 |
|
| 8 |
-
function getIP(req: NextRequest) {
|
| 9 |
let ip = req.ip ?? req.headers.get("x-real-ip");
|
| 10 |
const forwardedFor = req.headers.get("x-forwarded-for");
|
| 11 |
|
|
|
|
| 5 |
|
| 6 |
const serverConfig = getServerSideConfig();
|
| 7 |
|
| 8 |
+
export function getIP(req: NextRequest) {
|
| 9 |
let ip = req.ip ?? req.headers.get("x-real-ip");
|
| 10 |
const forwardedFor = req.headers.get("x-forwarded-for");
|
| 11 |
|
app/api/lemur/route.ts
CHANGED
|
@@ -96,6 +96,7 @@ async function createStream(res: Response) {
|
|
| 96 |
function onParse(event: any) {
|
| 97 |
if (event.type === "event") {
|
| 98 |
const data = event.data;
|
|
|
|
| 99 |
if (event.id == "1") {
|
| 100 |
let text1 = data.slice(data.indexOf("content"));
|
| 101 |
const text = text1.slice(12, text1.indexOf("index") - 6);
|
|
|
|
| 96 |
function onParse(event: any) {
|
| 97 |
if (event.type === "event") {
|
| 98 |
const data = event.data;
|
| 99 |
+
// console.log(data)
|
| 100 |
if (event.id == "1") {
|
| 101 |
let text1 = data.slice(data.indexOf("content"));
|
| 102 |
const text = text1.slice(12, text1.indexOf("index") - 6);
|
app/api/user/code/route.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
import { NextRequest } from "next/server";
|
|
|
|
| 2 |
|
| 3 |
export async function POST(req: NextRequest) {
|
| 4 |
try {
|
| 5 |
let res=await fetch("https://eladmin.dwzynj.top/auth/code", {
|
| 6 |
-
method: "GET"
|
|
|
|
|
|
|
|
|
|
| 7 |
})
|
| 8 |
let msg=await res.json()
|
| 9 |
// console.log(msg)
|
|
|
|
| 1 |
import { NextRequest } from "next/server";
|
| 2 |
+
import { getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
| 6 |
let res=await fetch("https://eladmin.dwzynj.top/auth/code", {
|
| 7 |
+
method: "GET",
|
| 8 |
+
headers:{
|
| 9 |
+
"UserIp": String(getIP(req))
|
| 10 |
+
}
|
| 11 |
})
|
| 12 |
let msg=await res.json()
|
| 13 |
// console.log(msg)
|
app/api/user/findpwd/route.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
import { NextRequest } from "next/server";
|
|
|
|
| 2 |
|
| 3 |
export async function POST(req: NextRequest) {
|
| 4 |
try {
|
| 5 |
const mail=req.nextUrl.searchParams.get("mail")
|
| 6 |
const code=req.nextUrl.searchParams.get("code")
|
| 7 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/restPwd?mail="+mail+"&code="+code, {
|
| 8 |
-
method: "POST"
|
|
|
|
|
|
|
|
|
|
| 9 |
})
|
| 10 |
let msg=await res.json()
|
| 11 |
// console.log(msg)
|
|
|
|
| 1 |
import { NextRequest } from "next/server";
|
| 2 |
+
import { getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
| 6 |
const mail=req.nextUrl.searchParams.get("mail")
|
| 7 |
const code=req.nextUrl.searchParams.get("code")
|
| 8 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/restPwd?mail="+mail+"&code="+code, {
|
| 9 |
+
method: "POST",
|
| 10 |
+
headers:{
|
| 11 |
+
"UserIp": String(getIP(req))
|
| 12 |
+
}
|
| 13 |
})
|
| 14 |
let msg=await res.json()
|
| 15 |
// console.log(msg)
|
app/api/user/info/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -13,7 +13,8 @@ export async function POST(req: NextRequest) {
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/getInfo", {
|
| 14 |
method: "GET",
|
| 15 |
headers:{
|
| 16 |
-
"Authorization":token
|
|
|
|
| 17 |
}
|
| 18 |
})
|
| 19 |
if(res.status==401){
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/getInfo", {
|
| 14 |
method: "GET",
|
| 15 |
headers:{
|
| 16 |
+
"Authorization":token,
|
| 17 |
+
"UserIp": String(getIP(req))
|
| 18 |
}
|
| 19 |
})
|
| 20 |
if(res.status==401){
|
app/api/user/kami/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -14,7 +14,8 @@ export async function POST(req: NextRequest) {
|
|
| 14 |
let res=await fetch("https://eladmin.dwzynj.top/api/userKami/exchangeKaMi?kaMi="+code, {
|
| 15 |
method: "GET",
|
| 16 |
headers:{
|
| 17 |
-
"Authorization":token
|
|
|
|
| 18 |
},
|
| 19 |
})
|
| 20 |
if(res.status==401){
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 14 |
let res=await fetch("https://eladmin.dwzynj.top/api/userKami/exchangeKaMi?kaMi="+code, {
|
| 15 |
method: "GET",
|
| 16 |
headers:{
|
| 17 |
+
"Authorization":token,
|
| 18 |
+
"UserIp": String(getIP(req))
|
| 19 |
},
|
| 20 |
})
|
| 21 |
if(res.status==401){
|
app/api/user/login/route.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import { NextRequest } from "next/server";
|
|
|
|
| 2 |
|
| 3 |
export async function POST(req: NextRequest) {
|
| 4 |
try {
|
|
@@ -17,7 +18,8 @@ export async function POST(req: NextRequest) {
|
|
| 17 |
let res=await fetch("https://eladmin.dwzynj.top/auth/loginWeb", {
|
| 18 |
method: "POST",
|
| 19 |
headers:{
|
| 20 |
-
"Content-Type":'application/json'
|
|
|
|
| 21 |
},
|
| 22 |
body:JSON.stringify(await req.json())
|
| 23 |
})
|
|
|
|
| 1 |
import { NextRequest } from "next/server";
|
| 2 |
+
import { getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 18 |
let res=await fetch("https://eladmin.dwzynj.top/auth/loginWeb", {
|
| 19 |
method: "POST",
|
| 20 |
headers:{
|
| 21 |
+
"Content-Type":'application/json',
|
| 22 |
+
"UserIp": String(getIP(req))
|
| 23 |
},
|
| 24 |
body:JSON.stringify(await req.json())
|
| 25 |
})
|
app/api/user/logout/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -13,7 +13,8 @@ export async function POST(req: NextRequest) {
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/auth/logout", {
|
| 14 |
method: "DELETE",
|
| 15 |
headers:{
|
| 16 |
-
"Authorization":token
|
|
|
|
| 17 |
}
|
| 18 |
})
|
| 19 |
if(res.status==401){
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/auth/logout", {
|
| 14 |
method: "DELETE",
|
| 15 |
headers:{
|
| 16 |
+
"Authorization":token,
|
| 17 |
+
"UserIp": String(getIP(req))
|
| 18 |
}
|
| 19 |
})
|
| 20 |
if(res.status==401){
|
app/api/user/mail/route.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import { NextRequest } from "next/server";
|
|
|
|
| 2 |
|
| 3 |
export async function POST(req: NextRequest) {
|
| 4 |
try {
|
| 5 |
const mail=req.nextUrl.searchParams.get("mail")
|
| 6 |
let res=await fetch("https://eladmin.dwzynj.top/api/code/registerEmail?email="+mail, {
|
| 7 |
-
method: "POST"
|
|
|
|
|
|
|
|
|
|
| 8 |
})
|
| 9 |
let msg=await res.json()
|
| 10 |
// console.log(res.status)
|
|
|
|
| 1 |
import { NextRequest } from "next/server";
|
| 2 |
+
import { getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
| 6 |
const mail=req.nextUrl.searchParams.get("mail")
|
| 7 |
let res=await fetch("https://eladmin.dwzynj.top/api/code/registerEmail?email="+mail, {
|
| 8 |
+
method: "POST",
|
| 9 |
+
headers:{
|
| 10 |
+
"UserIp": String(getIP(req))
|
| 11 |
+
}
|
| 12 |
})
|
| 13 |
let msg=await res.json()
|
| 14 |
// console.log(res.status)
|
app/api/user/register/route.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import { NextRequest } from "next/server";
|
|
|
|
| 2 |
|
| 3 |
export async function POST(req: NextRequest) {
|
| 4 |
try {
|
|
@@ -32,7 +33,8 @@ export async function POST(req: NextRequest) {
|
|
| 32 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/registerUser/"+code, {
|
| 33 |
method: "POST",
|
| 34 |
headers:{
|
| 35 |
-
"Content-Type":'application/json'
|
|
|
|
| 36 |
},
|
| 37 |
body:JSON.stringify(body)
|
| 38 |
})
|
|
|
|
| 1 |
import { NextRequest } from "next/server";
|
| 2 |
+
import { getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 33 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/registerUser/"+code, {
|
| 34 |
method: "POST",
|
| 35 |
headers:{
|
| 36 |
+
"Content-Type":'application/json',
|
| 37 |
+
"UserIp": String(getIP(req))
|
| 38 |
},
|
| 39 |
body:JSON.stringify(body)
|
| 40 |
})
|
app/api/user/restmail/route.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import { NextRequest } from "next/server";
|
|
|
|
| 2 |
|
| 3 |
export async function POST(req: NextRequest) {
|
| 4 |
try {
|
| 5 |
const mail=req.nextUrl.searchParams.get("mail")
|
| 6 |
let res=await fetch("https://eladmin.dwzynj.top/api/code/email/resetPass?email="+mail, {
|
| 7 |
-
method: "POST"
|
|
|
|
|
|
|
|
|
|
| 8 |
})
|
| 9 |
let msg=await res.json()
|
| 10 |
// console.log(res.status)
|
|
|
|
| 1 |
import { NextRequest } from "next/server";
|
| 2 |
+
import { getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
| 6 |
const mail=req.nextUrl.searchParams.get("mail")
|
| 7 |
let res=await fetch("https://eladmin.dwzynj.top/api/code/email/resetPass?email="+mail, {
|
| 8 |
+
method: "POST",
|
| 9 |
+
headers:{
|
| 10 |
+
"UserIp": String(getIP(req))
|
| 11 |
+
}
|
| 12 |
})
|
| 13 |
let msg=await res.json()
|
| 14 |
// console.log(res.status)
|
app/api/user/set/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -18,7 +18,8 @@ export async function POST(req: NextRequest) {
|
|
| 18 |
method: "PUT",
|
| 19 |
headers:{
|
| 20 |
"Content-Type":'application/json;charset=utf-8',
|
| 21 |
-
"Authorization":token
|
|
|
|
| 22 |
},
|
| 23 |
body:JSON.stringify(body)
|
| 24 |
})
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 18 |
method: "PUT",
|
| 19 |
headers:{
|
| 20 |
"Content-Type":'application/json;charset=utf-8',
|
| 21 |
+
"Authorization":token,
|
| 22 |
+
"UserIp": String(getIP(req))
|
| 23 |
},
|
| 24 |
body:JSON.stringify(body)
|
| 25 |
})
|
app/api/user/sig/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -13,7 +13,8 @@ export async function POST(req: NextRequest) {
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/sig", {
|
| 14 |
method: "GET",
|
| 15 |
headers:{
|
| 16 |
-
"Authorization":token
|
|
|
|
| 17 |
}
|
| 18 |
})
|
| 19 |
if(res.status==401){
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/sig", {
|
| 14 |
method: "GET",
|
| 15 |
headers:{
|
| 16 |
+
"Authorization":token,
|
| 17 |
+
"UserIp": String(getIP(req))
|
| 18 |
}
|
| 19 |
})
|
| 20 |
if(res.status==401){
|
app/api/user/updatePass/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -14,7 +14,8 @@ export async function POST(req: NextRequest) {
|
|
| 14 |
method: "POST",
|
| 15 |
headers:{
|
| 16 |
"Content-Type":'application/json;charset=utf-8',
|
| 17 |
-
"Authorization":token
|
|
|
|
| 18 |
},
|
| 19 |
body:JSON.stringify(await req.json())
|
| 20 |
})
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 14 |
method: "POST",
|
| 15 |
headers:{
|
| 16 |
"Content-Type":'application/json;charset=utf-8',
|
| 17 |
+
"Authorization":token,
|
| 18 |
+
"UserIp": String(getIP(req))
|
| 19 |
},
|
| 20 |
body:JSON.stringify(await req.json())
|
| 21 |
})
|
app/api/user/vip/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -13,9 +13,11 @@ export async function POST(req: NextRequest) {
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/isVip", {
|
| 14 |
method: "GET",
|
| 15 |
headers:{
|
| 16 |
-
"Authorization":token
|
|
|
|
| 17 |
}
|
| 18 |
})
|
|
|
|
| 19 |
if(res.status==401){
|
| 20 |
let msg={
|
| 21 |
flag:false,
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 13 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/isVip", {
|
| 14 |
method: "GET",
|
| 15 |
headers:{
|
| 16 |
+
"Authorization":token,
|
| 17 |
+
"UserIp": String(getIP(req))
|
| 18 |
}
|
| 19 |
})
|
| 20 |
+
// console.log(req.headers)
|
| 21 |
if(res.status==401){
|
| 22 |
let msg={
|
| 23 |
flag:false,
|
app/api/user/wallet/route.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
-
import { auth } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
@@ -14,7 +14,8 @@ export async function POST(req: NextRequest) {
|
|
| 14 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/setWallet?number="+wallet, {
|
| 15 |
method: "GET",
|
| 16 |
headers:{
|
| 17 |
-
"Authorization":token
|
|
|
|
| 18 |
},
|
| 19 |
})
|
| 20 |
if(res.status==401){
|
|
|
|
| 1 |
import { NextRequest, NextResponse } from "next/server";
|
| 2 |
+
import { auth, getIP } from "../../auth";
|
| 3 |
|
| 4 |
export async function POST(req: NextRequest) {
|
| 5 |
try {
|
|
|
|
| 14 |
let res=await fetch("https://eladmin.dwzynj.top/api/users/setWallet?number="+wallet, {
|
| 15 |
method: "GET",
|
| 16 |
headers:{
|
| 17 |
+
"Authorization":token,
|
| 18 |
+
"UserIp": String(getIP(req))
|
| 19 |
},
|
| 20 |
})
|
| 21 |
if(res.status==401){
|