mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-25 17:08:35 +03:00
add userCounter mocks and rearrange webhook path
This commit is contained in:
@@ -3,6 +3,9 @@ import { Request } from "express";
|
||||
import { IPAddress } from "../types/segments.model";
|
||||
|
||||
export function getIP(req: Request): IPAddress {
|
||||
// if in testing mode, return immediately
|
||||
if (config.mode === "test") return "127.0.0.1" as IPAddress;
|
||||
|
||||
if (config.behindProxy === true || config.behindProxy === "true") {
|
||||
config.behindProxy = "X-Forwarded-For";
|
||||
}
|
||||
@@ -15,6 +18,6 @@ export function getIP(req: Request): IPAddress {
|
||||
case "X-Real-IP":
|
||||
return req.headers["x-real-ip"] as IPAddress;
|
||||
default:
|
||||
return (req.connection?.remoteAddress || req.socket?.remoteAddress) as IPAddress;
|
||||
return req.socket?.remoteAddress as IPAddress;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user