feat(backend): report node platform, geo and build info

Agents and probes report OS, arch and build (version, tag, commit, time).
The backend looks up country and ISP of public addresses only, stores them
in node_meta (schema v5) and exposes display info via /api/public/nodes,
/api/public/about and /api/admin/build-info behind site.show_build.
This commit is contained in:
justme committed 2026-10-06 21:22:04 +08:00
1 parent 2e470607fa
commit 1e5c660d05
38 files changed
+1532 -15

No files matched your search

+335
View File
@@ -862,6 +862,68 @@
}
}
},
"/api/public/nodes": {
"get": {
"tags": [
"public-nodes"
],
"summary": "Display info of the visible agents and probes: system, architecture, country and ISP (never an address)",
"operationId": "nodes_list",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PageDtoOfNodeInfoDto"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
}
}
}
},
"/api/public/about": {
"get": {
"tags": [
"public-nodes"
],
"summary": "The backend's version, tag and build time, if the site shows build info",
"operationId": "about_get",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AboutDto"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
}
}
}
},
"/api/public/catalog/kinds": {
"get": {
"tags": [
@@ -3629,6 +3691,47 @@
}
}
},
"/api/admin/build-info": {
"get": {
"tags": [
"admin-build"
],
"summary": "Version, tag, commit and build time of the backend and every agent and probe",
"operationId": "build_info_get",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BuildInfoDto"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/problem+json": {
"schema": {
"$ref": "#/components/schemas/ProblemDto"
}
}
}
}
}
}
},
"/healthz": {
"get": {
"tags": [
@@ -3753,6 +3856,28 @@
},
"components": {
"schemas": {
"AboutDto": {
"required": [
"show_build",
"backend"
],
"type": "object",
"properties": {
"show_build": {
"type": "boolean"
},
"backend": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/BuildDto"
}
]
}
}
},
"AgentDto": {
"required": [
"id",
@@ -4039,6 +4164,56 @@
}
}
},
"BuildDto": {
"required": [
"version",
"tag",
"commit",
"built_at"
],
"type": "object",
"properties": {
"version": {
"type": "string"
},
"tag": {
"type": [
"null",
"string"
]
},
"commit": {
"type": [
"null",
"string"
]
},
"built_at": {
"type": [
"null",
"string"
]
}
}
},
"BuildInfoDto": {
"required": [
"backend",
"nodes"
],
"type": "object",
"properties": {
"backend": {
"$ref": "#/components/schemas/BuildDto"
},
"nodes": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NodeBuildDto"
}
}
}
},
"ChangePasswordRequest": {
"required": [
"password"
@@ -5332,6 +5507,139 @@
}
}
},
"NodeBuildDto": {
"required": [
"id",
"kind",
"os",
"os_name",
"arch",
"version",
"tag",
"commit",
"built_at"
],
"type": "object",
"properties": {
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"os": {
"type": [
"null",
"string"
]
},
"os_name": {
"type": [
"null",
"string"
]
},
"arch": {
"type": [
"null",
"string"
]
},
"version": {
"type": [
"null",
"string"
]
},
"tag": {
"type": [
"null",
"string"
]
},
"commit": {
"type": [
"null",
"string"
]
},
"built_at": {
"type": [
"null",
"string"
]
}
}
},
"NodeInfoDto": {
"required": [
"id",
"kind",
"os",
"os_name",
"arch",
"country",
"isp_key",
"isp_name"
],
"type": "object",
"properties": {
"id": {
"type": "string"
},
"kind": {
"type": "string"
},
"os": {
"type": [
"null",
"string"
]
},
"os_name": {
"type": [
"null",
"string"
]
},
"arch": {
"type": [
"null",
"string"
]
},
"country": {
"type": [
"null",
"string"
]
},
"isp_key": {
"type": [
"null",
"string"
]
},
"isp_name": {
"type": [
"null",
"string"
]
},
"version": {
"type": [
"null",
"string"
]
},
"tag": {
"type": [
"null",
"string"
]
}
}
},
"OverviewDto": {
"required": [
"range",
@@ -5604,6 +5912,27 @@
}
}
},
"PageDtoOfNodeInfoDto": {
"required": [
"items",
"next_cursor"
],
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NodeInfoDto"
}
},
"next_cursor": {
"type": [
"null",
"string"
]
}
}
},
"PageDtoOfPlanDto": {
"required": [
"items",
@@ -6814,6 +7143,9 @@
{
"name": "public"
},
{
"name": "public-nodes"
},
{
"name": "catalog"
},
@@ -6847,6 +7179,9 @@
{
"name": "admin-users"
},
{
"name": "admin-build"
},
{
"name": "ops"
},