diff --git a/docs/changelog/index.md b/docs/changelog/index.md
index 9c6aa068..6d4fbb06 100644
--- a/docs/changelog/index.md
+++ b/docs/changelog/index.md
@@ -17,6 +17,11 @@ sidebar: false
## [Unreleased]
+### 优化
+
+- 节点管理页新增服务端分页及名称、节点标识、IP、状态和类型筛选,仅加载当前页的节点与最新下发记录;详情页改为单节点查询,减少大规模节点列表的轮询和渲染开销,并保留旧列表接口兼容现有集成。搜索保留 Unicode 原始字符匹配,切页等待时保持已加载数据并禁用旧节点操作,避免页面跳动及错误操作。搜索框按接口的 UTF-8 字节上限校验输入,超限时显示可翻译提示并阻止发送无效查询。
+
+
### 🛠 修复
- 修复 Agent 自动注册响应凭证字段不一致导致节点不断重复创建的问题;新增持久化注册重试凭证与退避,响应丢失、并发重试或配置写入失败后仍复用原节点,且不会覆盖管理员修改或恢复已更换的节点凭证。支持目录刷盘的平台会确认原子替换后的目录持久化,失败时阻止使用未确认的注册凭证;接口文档同步列出两种兼容凭证字段。
diff --git a/docs/design/agent-design.md b/docs/design/agent-design.md
index 310bcfe9..baef3936 100644
--- a/docs/design/agent-design.md
+++ b/docs/design/agent-design.md
@@ -32,6 +32,16 @@ Agent 主要由以下核心子模块组成,共同配合完成其完整的生
---
+## 节点列表与详情查询
+
+节点管理页使用管理员接口 `GET /api/v1/d/nodes/page`,返回 `data: {total, results, page, page_size}`。默认每页 20 条,最大 100 条;按数据库 ID 降序排列,可通过 `search`(名称、节点标识或 IP 的字面子串,最多 256 字节)、`status` 和 `node_type` 进行服务端筛选。`pending` 表示尚未上报心跳,最近 60 秒内上报的节点为 `online`,其余为 `offline`;筛选和返回状态使用同一时间基准。未设置类型的旧节点按 `edge_node` 处理。搜索保留原始 Unicode 字符的字面匹配,同时兼容 ASCII 大小写折叠;SQLite 不保证完整的 Unicode 大小写不敏感匹配。前端使用相同的 256 字节 UTF-8 上限校验去除首尾空白后的搜索词,超限时保留上次有效查询并显示提示,缩短输入后恢复搜索。
+
+配置下发记录仅为当前页节点批量加载;详情页通过 `GET /api/v1/d/nodes/{id}` 获取单个节点及相同的下发元数据。列表与详情每 15 秒刷新,在后台、离线或请求出错时暂停定时刷新,可通过窗口聚焦、网络恢复或手动刷新重试。筛选或每页数量变化后回到第一页,删除末页最后一条记录后自动回到有效页。同一筛选条件下切页时保留已加载的表格与总数,页码仍显示已加载页,等待响应期间禁用节点编辑、删除和详情入口;改变筛选条件时不会显示上一筛选的节点,请求失败时可手动重试。
+
+为兼容现有集成和节点选择器,原 `GET /api/v1/d/nodes` 仍返回完整数组,未改变含义;选择器尚未迁移为分页搜索。仪表盘仍为全局统计和地图加载全部节点,并使用现有缓存;本次没有截断全局总数或地图数据。分页计数和当前页是独立查询,节点并发增删时可能短暂不一致,下一次刷新会更新。普通列表和类型筛选利用主键及类型索引,状态筛选可使用心跳时间索引;字面子串搜索仍可能扫描匹配候选,未宣称 B-tree 索引能加速任意子串。
+
+---
+
## 与 Server 的交互链路
Agent 在生命周期中主要通过 **基于 Token 的自动注册** 和 **心跳/WebSocket 双通道** 与控制面通信。
diff --git a/docs/docs.go b/docs/docs.go
index 9a68de80..07afd15f 100644
--- a/docs/docs.go
+++ b/docs/docs.go
@@ -7953,6 +7953,169 @@ const docTemplate = `{
}
}
},
+ "/api/v1/d/nodes/page": {
+ "get": {
+ "security": [
+ {
+ "SessionCookie": []
+ }
+ ],
+ "description": "返回分页节点和筛选后的总数;旧版 /nodes 列表接口保持兼容,需要管理员权限",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "openflare-node"
+ ],
+ "summary": "获取分页节点列表",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "页码(默认 1)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "每页数量(默认 20,最大 100)",
+ "name": "page_size",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "名称、节点标识或 IP 的字面子串(最多 256 字节)",
+ "name": "search",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "pending、online 或 offline",
+ "name": "status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "edge_node、tunnel_relay 或 tunnel_client",
+ "name": "node_type",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "节点分页",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Any"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/node.ListResult"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "400": {
+ "description": "参数错误",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "401": {
+ "description": "未登录",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "404": {
+ "description": "无权限",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "500": {
+ "description": "查询失败",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/d/nodes/{id}": {
+ "get": {
+ "security": [
+ {
+ "SessionCookie": []
+ }
+ ],
+ "description": "返回指定节点及最新配置下发记录,需要管理员权限",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "openflare-node"
+ ],
+ "summary": "获取节点详情",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "节点 ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "节点详情",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Any"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/node.View"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "400": {
+ "description": "参数错误",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "401": {
+ "description": "未登录",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "404": {
+ "description": "无权限或不存在",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "500": {
+ "description": "查询失败",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ }
+ }
+ }
+ },
"/api/v1/d/nodes/{id}/agent-release": {
"get": {
"security": [
@@ -17755,6 +17918,26 @@ const docTemplate = `{
}
}
},
+ "node.ListResult": {
+ "type": "object",
+ "properties": {
+ "page": {
+ "type": "integer"
+ },
+ "page_size": {
+ "type": "integer"
+ },
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/node.View"
+ }
+ },
+ "total": {
+ "type": "integer"
+ }
+ }
+ },
"node.ObservabilityView": {
"type": "object",
"properties": {
diff --git a/docs/swagger.json b/docs/swagger.json
index 7c3f0c5a..f71ba6e3 100644
--- a/docs/swagger.json
+++ b/docs/swagger.json
@@ -7946,6 +7946,169 @@
}
}
},
+ "/api/v1/d/nodes/page": {
+ "get": {
+ "security": [
+ {
+ "SessionCookie": []
+ }
+ ],
+ "description": "返回分页节点和筛选后的总数;旧版 /nodes 列表接口保持兼容,需要管理员权限",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "openflare-node"
+ ],
+ "summary": "获取分页节点列表",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "页码(默认 1)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "每页数量(默认 20,最大 100)",
+ "name": "page_size",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "名称、节点标识或 IP 的字面子串(最多 256 字节)",
+ "name": "search",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "pending、online 或 offline",
+ "name": "status",
+ "in": "query"
+ },
+ {
+ "type": "string",
+ "description": "edge_node、tunnel_relay 或 tunnel_client",
+ "name": "node_type",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "节点分页",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Any"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/node.ListResult"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "400": {
+ "description": "参数错误",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "401": {
+ "description": "未登录",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "404": {
+ "description": "无权限",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "500": {
+ "description": "查询失败",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ }
+ }
+ }
+ },
+ "/api/v1/d/nodes/{id}": {
+ "get": {
+ "security": [
+ {
+ "SessionCookie": []
+ }
+ ],
+ "description": "返回指定节点及最新配置下发记录,需要管理员权限",
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "openflare-node"
+ ],
+ "summary": "获取节点详情",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "节点 ID",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "节点详情",
+ "schema": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/response.Any"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "data": {
+ "$ref": "#/definitions/node.View"
+ }
+ }
+ }
+ ]
+ }
+ },
+ "400": {
+ "description": "参数错误",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "401": {
+ "description": "未登录",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "404": {
+ "description": "无权限或不存在",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ },
+ "500": {
+ "description": "查询失败",
+ "schema": {
+ "$ref": "#/definitions/response.Any"
+ }
+ }
+ }
+ }
+ },
"/api/v1/d/nodes/{id}/agent-release": {
"get": {
"security": [
@@ -17748,6 +17911,26 @@
}
}
},
+ "node.ListResult": {
+ "type": "object",
+ "properties": {
+ "page": {
+ "type": "integer"
+ },
+ "page_size": {
+ "type": "integer"
+ },
+ "results": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/node.View"
+ }
+ },
+ "total": {
+ "type": "integer"
+ }
+ }
+ },
"node.ObservabilityView": {
"type": "object",
"properties": {
diff --git a/docs/swagger.yaml b/docs/swagger.yaml
index 20b3adc8..f034875d 100644
--- a/docs/swagger.yaml
+++ b/docs/swagger.yaml
@@ -1931,6 +1931,19 @@ definitions:
relay_web_server_enabled:
type: boolean
type: object
+ node.ListResult:
+ properties:
+ page:
+ type: integer
+ page_size:
+ type: integer
+ results:
+ items:
+ $ref: '#/definitions/node.View'
+ type: array
+ total:
+ type: integer
+ type: object
node.ObservabilityView:
properties:
analytics:
@@ -9119,6 +9132,48 @@ paths:
summary: 创建节点
tags:
- openflare-node
+ /api/v1/d/nodes/{id}:
+ get:
+ description: 返回指定节点及最新配置下发记录,需要管理员权限
+ parameters:
+ - description: 节点 ID
+ in: path
+ name: id
+ required: true
+ type: integer
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 节点详情
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Any'
+ - properties:
+ data:
+ $ref: '#/definitions/node.View'
+ type: object
+ "400":
+ description: 参数错误
+ schema:
+ $ref: '#/definitions/response.Any'
+ "401":
+ description: 未登录
+ schema:
+ $ref: '#/definitions/response.Any'
+ "404":
+ description: 无权限或不存在
+ schema:
+ $ref: '#/definitions/response.Any'
+ "500":
+ description: 查询失败
+ schema:
+ $ref: '#/definitions/response.Any'
+ security:
+ - SessionCookie: []
+ summary: 获取节点详情
+ tags:
+ - openflare-node
/api/v1/d/nodes/{id}/agent-release:
get:
description: 返回指定节点可用的最新 Agent 版本信息,需要管理员权限
@@ -9506,6 +9561,63 @@ paths:
summary: 轮换引导令牌
tags:
- openflare-node
+ /api/v1/d/nodes/page:
+ get:
+ description: 返回分页节点和筛选后的总数;旧版 /nodes 列表接口保持兼容,需要管理员权限
+ parameters:
+ - description: 页码(默认 1)
+ in: query
+ name: page
+ type: integer
+ - description: 每页数量(默认 20,最大 100)
+ in: query
+ name: page_size
+ type: integer
+ - description: 名称、节点标识或 IP 的字面子串(最多 256 字节)
+ in: query
+ name: search
+ type: string
+ - description: pending、online 或 offline
+ in: query
+ name: status
+ type: string
+ - description: edge_node、tunnel_relay 或 tunnel_client
+ in: query
+ name: node_type
+ type: string
+ produces:
+ - application/json
+ responses:
+ "200":
+ description: 节点分页
+ schema:
+ allOf:
+ - $ref: '#/definitions/response.Any'
+ - properties:
+ data:
+ $ref: '#/definitions/node.ListResult'
+ type: object
+ "400":
+ description: 参数错误
+ schema:
+ $ref: '#/definitions/response.Any'
+ "401":
+ description: 未登录
+ schema:
+ $ref: '#/definitions/response.Any'
+ "404":
+ description: 无权限
+ schema:
+ $ref: '#/definitions/response.Any'
+ "500":
+ description: 查询失败
+ schema:
+ $ref: '#/definitions/response.Any'
+ security:
+ - SessionCookie: []
+ summary: 获取分页节点列表
+ tags:
+ - openflare-node
/api/v1/d/option:
get:
description: 返回全部非敏感 OpenFlare 配置项,需要管理员权限
diff --git a/frontend/app/(main)/nodes/components/node-list-controls.tsx b/frontend/app/(main)/nodes/components/node-list-controls.tsx
new file mode 100644
index 00000000..ca83ab86
--- /dev/null
+++ b/frontend/app/(main)/nodes/components/node-list-controls.tsx
@@ -0,0 +1,148 @@
+import { useTranslations } from 'next-intl';
+
+import { Button } from '@/components/ui/button';
+import {
+ Field,
+ FieldError,
+ FieldGroup,
+ FieldLabel,
+} from '@/components/ui/field';
+import { Input } from '@/components/ui/input';
+import {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@/components/ui/select';
+import type { NodeStatus } from '@/lib/services/openflare';
+
+export function NodeListControls({
+ search,
+ searchTooLong,
+ onSearchChange,
+ status,
+ onStatusChange,
+ page,
+ pageSize,
+ onPageSizeChange,
+ total,
+ totalPages,
+ loading,
+ hasData,
+ onPageChange,
+}: {
+ search: string;
+ searchTooLong: boolean;
+ onSearchChange: (value: string) => void;
+ status: NodeStatus | '';
+ onStatusChange: (value: NodeStatus | '') => void;
+ page: number;
+ pageSize: number;
+ onPageSizeChange: (value: number) => void;
+ total: number;
+ totalPages: number;
+ loading: boolean;
+ hasData: boolean;
+ onPageChange: (value: number) => void;
+}) {
+ const t = useTranslations('nodes');
+ return (
+
+
+
+
+ {t('pagination.search')}
+
+ onSearchChange(event.target.value)}
+ placeholder={t('pagination.searchPlaceholder')}
+ maxLength={256}
+ aria-invalid={searchTooLong || undefined}
+ aria-describedby={searchTooLong ? 'node-search-error' : undefined}
+ />
+ {searchTooLong && (
+
+ {t('pagination.searchTooLong')}
+
+ )}
+
+
+ {t('table.status')}
+
+
+
+
+ {t('pagination.pageSize')}
+
+
+
+
+
+ {hasData && (
+
+ {t('pagination.summary', { page, totalPages, total })}
+
+ )}
+
+
+
+ );
+}
diff --git a/frontend/app/(main)/nodes/components/nodes-table.tsx b/frontend/app/(main)/nodes/components/nodes-table.tsx
index b57b9ac2..8e5e64ee 100644
--- a/frontend/app/(main)/nodes/components/nodes-table.tsx
+++ b/frontend/app/(main)/nodes/components/nodes-table.tsx
@@ -37,15 +37,20 @@ export function NodesTable({
deletingId,
onEdit,
onDelete,
+ actionsDisabled = false,
}: {
nodes: NodeItem[];
deletingId: number | null;
+ actionsDisabled?: boolean;
onEdit: (node: NodeItem) => void;
onDelete: (node: NodeItem) => void;
}) {
const t = useTranslations('nodes');
return (
-
+
@@ -144,16 +149,22 @@ export function NodesTable({
variant='outline'
size='sm'
className='h-7 text-xs'
- asChild
+ asChild={!actionsDisabled}
+ disabled={actionsDisabled}
>
-
- {t('detail')}
-
+ {actionsDisabled ? (
+ t('detail')
+ ) : (
+
+ {t('detail')}
+
+ )}