pull/1155/head
parent
1c802ad5f5
commit
1dce2c1f7a
|
@ -18,7 +18,8 @@ export const authCode = async(req: http.IncomingMessage, res: http.ServerRespons
|
||||||
|
|
||||||
let ip = req.socket.remoteAddress
|
let ip = req.socket.remoteAddress
|
||||||
// console.log(req.headers)
|
// console.log(req.headers)
|
||||||
if (typeof req.headers.m == 'string' && ip && (requestIps.get(ip) ?? 0) < 10) {
|
if (typeof req.headers.m == 'string') {
|
||||||
|
if (ip && (requestIps.get(ip) ?? 0) < 10) {
|
||||||
if (req.headers.m) {
|
if (req.headers.m) {
|
||||||
label:
|
label:
|
||||||
if (req.headers.i) { // key验证
|
if (req.headers.i) { // key验证
|
||||||
|
@ -62,6 +63,10 @@ export const authCode = async(req: http.IncomingMessage, res: http.ServerRespons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
code = 403
|
||||||
|
msg = SYNC_CODE.msgBlockedIp
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res.writeHead(code)
|
res.writeHead(code)
|
||||||
res.end(msg)
|
res.end(msg)
|
||||||
|
|
|
@ -3,5 +3,6 @@ export const SYNC_CODE = {
|
||||||
idPrefix: 'OjppZDo6',
|
idPrefix: 'OjppZDo6',
|
||||||
authMsg: 'lx-music auth::',
|
authMsg: 'lx-music auth::',
|
||||||
msgAuthFailed: 'Auth failed',
|
msgAuthFailed: 'Auth failed',
|
||||||
|
msgBlockedIp: 'Blocked IP',
|
||||||
msgConnect: 'lx-music connect',
|
msgConnect: 'lx-music connect',
|
||||||
} as const
|
} as const
|
||||||
|
|
Loading…
Reference in New Issue