diff --git a/lib/api_log.php b/lib/api_log.php index 6d21c6b..ce8b22a 100644 --- a/lib/api_log.php +++ b/lib/api_log.php @@ -305,7 +305,12 @@ function qdb_api_log_finish(): void function qdb_api_log_client_ip(): string { - foreach (['HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'REMOTE_ADDR'] as $key) { + foreach ([ + 'HTTP_CF_CONNECTING_IP', + 'HTTP_X_FORWARDED_FOR', + 'HTTP_X_REAL_IP', + 'REMOTE_ADDR', + ] as $key) { $v = trim((string)($_SERVER[$key] ?? '')); if ($v === '') { continue; @@ -313,7 +318,9 @@ function qdb_api_log_client_ip(): string if ($key === 'HTTP_X_FORWARDED_FOR') { $v = trim(explode(',', $v)[0]); } - return $v; + if (filter_var($v, FILTER_VALIDATE_IP)) { + return $v; + } } return ''; } diff --git a/website/css/style.css b/website/css/style.css index 41ec9fb..60bd1de 100644 --- a/website/css/style.css +++ b/website/css/style.css @@ -343,6 +343,14 @@ code { font-size: 0.85rem; vertical-align: top; } +.activity-log-ip { + font-size: 0.8rem; + white-space: nowrap; + vertical-align: top; +} +.activity-log-ip code { + font-size: 0.78rem; +} .activity-log-subject strong, .activity-log-actor strong { color: var(--text); diff --git a/website/js/pages/dev.js b/website/js/pages/dev.js index fa9c6c0..a2625d2 100644 --- a/website/js/pages/dev.js +++ b/website/js/pages/dev.js @@ -89,6 +89,7 @@ export function devPage() {
${escHtml(e.method || '')}${escHtml(e.route || '')}${escHtml(ip)}