mirror of
https://github.com/immich-app/immich.git
synced 2025-01-02 12:48:35 +02:00
fix(server): get remote ip (#3515)
This commit is contained in:
parent
ee49f470b7
commit
a336aeb007
@ -61,14 +61,14 @@ export const AuthUser = createParamDecorator((data, ctx: ExecutionContext): Auth
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const GetLoginDetails = createParamDecorator((data, ctx: ExecutionContext): LoginDetails => {
|
export const GetLoginDetails = createParamDecorator((data, ctx: ExecutionContext): LoginDetails => {
|
||||||
const req = ctx.switchToHttp().getRequest();
|
const req = ctx.switchToHttp().getRequest<Request>();
|
||||||
const userAgent = UAParser(req.headers['user-agent']);
|
const userAgent = UAParser(req.headers['user-agent']);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
clientIp: req.clientIp,
|
clientIp: req.ip,
|
||||||
isSecure: req.secure,
|
isSecure: req.secure,
|
||||||
deviceType: userAgent.browser.name || userAgent.device.type || req.headers.devicemodel || '',
|
deviceType: userAgent.browser.name || userAgent.device.type || (req.headers.devicemodel as string) || '',
|
||||||
deviceOS: userAgent.os.name || req.headers.devicetype || '',
|
deviceOS: userAgent.os.name || (req.headers.devicetype as string) || '',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user