Новые изменения в проект

This commit is contained in:
Web-serfer 2026-04-28 02:09:18 +05:00
parent 38bf5d7dcf
commit c369cd30bd
2 changed files with 13 additions and 2 deletions

View file

@ -10,7 +10,13 @@ function getClientIp(request: Request): string {
if (forwarded) {
return forwarded.split(',')[0].trim();
}
return request.headers.get('x-real-ip') || 'unknown';
const realIp = request.headers.get('x-real-ip');
if (realIp) {
return realIp;
}
// Для localhost использовать заголовок Host или default
const host = request.headers.get('host') || 'localhost';
return host.includes('localhost') || host.includes('127.0.0.1') ? 'localhost' : 'unknown';
}
function generateVisitorHash(ip: string, userAgent: string): string {