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
|
||||
// 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) {
|
||||
label:
|
||||
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.end(msg)
|
||||
|
|
|
@ -3,5 +3,6 @@ export const SYNC_CODE = {
|
|||
idPrefix: 'OjppZDo6',
|
||||
authMsg: 'lx-music auth::',
|
||||
msgAuthFailed: 'Auth failed',
|
||||
msgBlockedIp: 'Blocked IP',
|
||||
msgConnect: 'lx-music connect',
|
||||
} as const
|
||||
|
|
Loading…
Reference in New Issue