[优化] 添加访问日志地区解析功能,更新相关数据结构和前端展示

This commit is contained in:
ryan
2026-03-15 15:21:00 +08:00
parent 640dd6c82c
commit 7c89ad8c7b
14 changed files with 278 additions and 34 deletions
@@ -69,7 +69,7 @@ export function AccessLogsPage() {
<div className="space-y-6">
<PageHeader
title="日志"
description="查看最近时间窗口内的访问记录,包含来源 IP、访问域名、路径、命中节点与响应状态码。"
description="查看最近时间窗口内的访问记录,包含来源 IP、归属地、访问域名、路径、命中节点与响应状态码。"
action={
<Link
href="/node"
@@ -185,7 +185,14 @@ export function AccessLogsPage() {
</div>
</td>
<td className="px-3 py-4 font-medium text-[var(--foreground-primary)]">
{item.remote_addr || '—'}
<div>{item.remote_addr || '—'}</div>
{item.region ? (
<div className="mt-2">
<span className="inline-flex rounded-full border border-[var(--border-default)] bg-[var(--surface-elevated)] px-2.5 py-1 text-[11px] font-medium text-[var(--foreground-secondary)]">
{item.region}
</span>
</div>
) : null}
</td>
<td className="px-3 py-4 text-[var(--foreground-secondary)]">
{item.host || '—'}
@@ -4,6 +4,7 @@ export interface AccessLogItem {
node_name: string;
logged_at: string;
remote_addr: string;
region: string;
host: string;
path: string;
status_code: number;
@@ -1054,14 +1054,15 @@ export function SettingsPage() {
IP 归属方式
</p>
<p className="text-sm text-[var(--foreground-muted)]">
控制世界地图等场景使用的 IP 归属解析来源。选择 MaxMind
时会按需下载本地 mmdb 数据库。
控制节点地图等场景使用的 IP
归属解析来源。访客访问记录归属地入库固定使用 MaxMind
mmdb。
</p>
</div>
<div className="mt-4">
<ResourceField
label="归属方式"
hint="disabled 关闭解析;mmdb 使用本地数据库;其余选项调用外部 GeoIP 服务。"
hint="disabled 关闭节点归属解析;mmdb 使用本地数据库;其余选项调用外部 GeoIP 服务。"
>
<ResourceSelect
value={operationFields.GeoIPProvider}
@@ -1082,9 +1083,7 @@ export function SettingsPage() {
</div>
<div className="mt-5 rounded-2xl border border-[var(--border-default)] bg-[var(--surface-elevated)] p-5">
<div className="flex flex-col gap-3 lg:flex-row lg:items-end">
<ResourceField
label="测试 IP"
>
<ResourceField label="测试 IP">
<ResourceInput
value={geoIPTestIP}
onChange={(event) =>