131 lines
3.6 KiB
JSON
131 lines
3.6 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://pyxray.local/schemas/assets.schema.json",
|
|
"title": "pyxray assets schema",
|
|
"$defs": {
|
|
"FileStatus": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["exists", "path", "size"],
|
|
"properties": {
|
|
"exists": { "type": "boolean" },
|
|
"path": { "type": "string" },
|
|
"size": {
|
|
"type": ["integer", "null"],
|
|
"minimum": 0
|
|
}
|
|
}
|
|
},
|
|
"AssetsStatus": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["installed", "executable_path", "version", "healthy", "geoip", "geosite"],
|
|
"properties": {
|
|
"installed": { "type": "boolean" },
|
|
"executable_path": { "type": "string" },
|
|
"version": { "type": "string" },
|
|
"healthy": { "type": "boolean" },
|
|
"geoip": { "$ref": "#/$defs/FileStatus" },
|
|
"geosite": { "$ref": "#/$defs/FileStatus" }
|
|
}
|
|
},
|
|
"DownloadKind": {
|
|
"type": "string",
|
|
"enum": ["xray", "geo", "geoip", "geosite"]
|
|
},
|
|
"DownloadState": {
|
|
"type": "string",
|
|
"enum": ["idle", "running", "completed", "canceled", "failed"]
|
|
},
|
|
"DownloadTaskStatus": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"state",
|
|
"kind",
|
|
"url",
|
|
"target",
|
|
"total_bytes",
|
|
"downloaded_bytes",
|
|
"progress",
|
|
"error"
|
|
],
|
|
"properties": {
|
|
"state": { "$ref": "#/$defs/DownloadState" },
|
|
"kind": {
|
|
"anyOf": [
|
|
{ "$ref": "#/$defs/DownloadKind" },
|
|
{ "type": "null" }
|
|
]
|
|
},
|
|
"url": { "type": "string" },
|
|
"target": { "type": "string" },
|
|
"total_bytes": {
|
|
"type": ["integer", "null"],
|
|
"minimum": 0
|
|
},
|
|
"downloaded_bytes": {
|
|
"type": "integer",
|
|
"minimum": 0
|
|
},
|
|
"progress": {
|
|
"type": ["number", "null"],
|
|
"minimum": 0,
|
|
"maximum": 1
|
|
},
|
|
"error": { "type": "string" }
|
|
}
|
|
},
|
|
"CoreConfigText": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["path", "content"],
|
|
"properties": {
|
|
"path": { "type": "string" },
|
|
"content": { "type": "string" }
|
|
}
|
|
},
|
|
"AssetsDownloadRequest": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"xray_url": { "type": "string", "default": "" },
|
|
"geo_url": { "type": "string", "default": "" },
|
|
"geoip_url": { "type": "string", "default": "" },
|
|
"geosite_url": { "type": "string", "default": "" },
|
|
"force": { "type": "boolean", "default": false },
|
|
"proxy_url": { "type": "string", "default": "" }
|
|
}
|
|
},
|
|
"AssetsUpdateRequest": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"force": { "type": "boolean", "default": false },
|
|
"proxy_url": { "type": "string", "default": "" }
|
|
}
|
|
},
|
|
"AssetsTaskStartResponse": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["task_id", "state", "items"],
|
|
"properties": {
|
|
"task_id": { "type": "string" },
|
|
"state": { "$ref": "#/$defs/DownloadState" },
|
|
"items": {
|
|
"type": "array",
|
|
"items": { "$ref": "#/$defs/DownloadKind" }
|
|
}
|
|
}
|
|
},
|
|
"ErrorResponse": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["error"],
|
|
"properties": {
|
|
"error": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
}
|