refactor: replace custom geo manager with Xray-core native geodata auto-update

Remove the panel-side custom geo download feature (service, controller,
/panel/api/custom-geo/* endpoints, CustomGeoResource model, UI tab) in
favor of Xray-core's native geodata section
(https://xtls.github.io/config/geodata.html).

- pass the top-level "geodata" key through xray.Config so it survives
  the template round-trip into the generated config
- add a Geodata Auto-Update section to the Xray Updates modal that
  edits geodata (cron schedule, download outbound, asset list) in the
  config template and restarts Xray on save
- previously downloaded geo files in the bin folder keep working in
  ext: routing rules; the orphaned custom_geo_resources table is left
  in place so existing source URLs stay recoverable
This commit is contained in:
MHSanaei committed 2026-06-10 18:27:12 +02:00
1 parent 4002be4ade
commit 3092326d9e
43 files changed
+416 -2875

No files matched your search

-305
View File
@@ -1219,49 +1219,6 @@
],
"type": "object"
},
"CustomGeoResource": {
"properties": {
"alias": {
"type": "string"
},
"createdAt": {
"type": "integer"
},
"id": {
"type": "integer"
},
"lastModified": {
"type": "string"
},
"lastUpdatedAt": {
"type": "integer"
},
"localPath": {
"type": "string"
},
"type": {
"type": "string"
},
"updatedAt": {
"type": "integer"
},
"url": {
"type": "string"
}
},
"required": [
"alias",
"createdAt",
"id",
"lastModified",
"lastUpdatedAt",
"localPath",
"type",
"updatedAt",
"url"
],
"type": "object"
},
"FallbackParentInfo": {
"description": "FallbackParentInfo carries everything the frontend needs to rewrite a\nchild inbound's client link: where to connect (the master's address\nand port) and which path matched on the master's fallbacks array.\nThe frontend already has the master inbound in its dbInbounds list,\nso we only ship identifiers + the match path here.",
"properties": {
@@ -1880,10 +1837,6 @@
"name": "Nodes",
"description": "Manage remote 3x-ui panels acting as nodes for a central panel. All endpoints under /panel/api/nodes."
},
{
"name": "Custom Geo",
"description": "Manage user-supplied GeoIP / GeoSite source files. All endpoints under /panel/api/custom-geo."
},
{
"name": "Backup",
"description": "Operations that interact with the configured Telegram bot."
@@ -6593,264 +6546,6 @@
}
}
},
"/panel/api/custom-geo/list": {
"get": {
"tags": [
"Custom Geo"
],
"summary": "List configured custom geo sources with their type, alias, URL, status, and last-download timestamp.",
"operationId": "get_panel_api_custom_geo_list",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/custom-geo/aliases": {
"get": {
"tags": [
"Custom Geo"
],
"summary": "List geo aliases currently usable in routing rules — both built-in defaults and the user-configured ones.",
"operationId": "get_panel_api_custom_geo_aliases",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/custom-geo/add": {
"post": {
"tags": [
"Custom Geo"
],
"summary": "Register a custom geo source. Alias is auto-normalised; URL must point to a .dat / .json blob.",
"operationId": "post_panel_api_custom_geo_add",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object"
},
"example": {
"type": "geoip",
"alias": "myips",
"url": "https://example.com/geo/my.dat"
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/custom-geo/update/{id}": {
"post": {
"tags": [
"Custom Geo"
],
"summary": "Replace a custom geo source. Same body shape as /add.",
"operationId": "post_panel_api_custom_geo_update_id",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Custom geo source ID.",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/custom-geo/delete/{id}": {
"post": {
"tags": [
"Custom Geo"
],
"summary": "Remove a custom geo source and its cached file.",
"operationId": "post_panel_api_custom_geo_delete_id",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Custom geo source ID.",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/custom-geo/download/{id}": {
"post": {
"tags": [
"Custom Geo"
],
"summary": "Re-download one custom geo source on demand.",
"operationId": "post_panel_api_custom_geo_download_id",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Custom geo source ID.",
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/custom-geo/update-all": {
"post": {
"tags": [
"Custom Geo"
],
"summary": "Re-download every configured custom geo source. Errors are reported per-source in the response.",
"operationId": "post_panel_api_custom_geo_update_all",
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"success": {
"type": "boolean"
},
"msg": {
"type": "string"
},
"obj": {}
}
}
}
}
}
}
}
},
"/panel/api/backuptotgbot": {
"post": {
"tags": [
-11
View File
@@ -250,17 +250,6 @@ export const EXAMPLES: Record<string, unknown> = {
"up": 1048576,
"uuid": "e18c9a96-71bf-48d4-933f-8b9a46d4290c"
},
"CustomGeoResource": {
"alias": "",
"createdAt": 0,
"id": 0,
"lastModified": "",
"lastUpdatedAt": 0,
"localPath": "",
"type": "",
"updatedAt": 0,
"url": ""
},
"FallbackParentInfo": {
"masterId": 0,
"path": ""
-43
View File
@@ -1193,49 +1193,6 @@ export const SCHEMAS: Record<string, unknown> = {
],
"type": "object"
},
"CustomGeoResource": {
"properties": {
"alias": {
"type": "string"
},
"createdAt": {
"type": "integer"
},
"id": {
"type": "integer"
},
"lastModified": {
"type": "string"
},
"lastUpdatedAt": {
"type": "integer"
},
"localPath": {
"type": "string"
},
"type": {
"type": "string"
},
"updatedAt": {
"type": "integer"
},
"url": {
"type": "string"
}
},
"required": [
"alias",
"createdAt",
"id",
"lastModified",
"lastUpdatedAt",
"localPath",
"type",
"updatedAt",
"url"
],
"type": "object"
},
"FallbackParentInfo": {
"description": "FallbackParentInfo carries everything the frontend needs to rewrite a\nchild inbound's client link: where to connect (the master's address\nand port) and which path matched on the master's fallbacks array.\nThe frontend already has the master inbound in its dbInbounds list,\nso we only ship identifiers + the match path here.",
"properties": {
Loaded 3 of 43 files, more files were not shown because too many files have changed in this diff. Show more