diff --git a/frontend/api-docs.html b/frontend/api-docs.html deleted file mode 100644 index e2113b94..00000000 --- a/frontend/api-docs.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - API Docs - - -
-
- - - diff --git a/frontend/clients.html b/frontend/clients.html deleted file mode 100644 index 67c76866..00000000 --- a/frontend/clients.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Clients - - -
-
- - - diff --git a/frontend/inbounds.html b/frontend/inbounds.html deleted file mode 100644 index 52bb49c0..00000000 --- a/frontend/inbounds.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Inbounds - - -
-
- - - diff --git a/frontend/index.html b/frontend/index.html index 196cea68..3ec1b86a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -3,11 +3,11 @@ - Overview + 3X-UI
- + diff --git a/frontend/nodes.html b/frontend/nodes.html deleted file mode 100644 index 908ae240..00000000 --- a/frontend/nodes.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Nodes - - -
-
- - - diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ab11d1d5..ef3736c9 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,6 +11,8 @@ "@ant-design/icons": "^6.2.3", "@codemirror/lang-json": "^6.0.2", "@codemirror/theme-one-dark": "^6.1.3", + "@tanstack/react-query": "^5.100.14", + "@tanstack/react-query-devtools": "^5.100.14", "antd": "^6.4.3", "axios": "^1.16.1", "codemirror": "^6.0.2", @@ -21,12 +23,15 @@ "qs": "^6.15.2", "react": "^19.2.6", "react-dom": "^19.2.6", - "react-i18next": "^17.0.8" + "react-i18next": "^17.0.8", + "react-router-dom": "^7.15.1", + "swagger-ui-react": "^5.32.6" }, "devDependencies": { "@eslint/js": "^10.0.1", "@types/react": "^19.2.15", "@types/react-dom": "^19.2.3", + "@types/swagger-ui-react": "^5.18.0", "@vitejs/plugin-react": "^6.0.2", "eslint": "^10.4.0", "eslint-plugin-react-hooks": "^7.1.1", @@ -334,6 +339,18 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/runtime-corejs3": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.29.2.tgz", + "integrity": "sha512-Lc94FOD5+0aXhdb0Tdg3RUtqT6yWbI/BbFWvlaSJ3gAb9Ks+99nHRDKADVqC37er4eCB0fHyWT+y+K3QOvJKbw==", + "license": "MIT", + "dependencies": { + "core-js-pure": "^3.48.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "7.28.6", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", @@ -1836,6 +1853,725 @@ "dev": true, "license": "MIT" }, + "node_modules/@scarf/scarf": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz", + "integrity": "sha512-xxeapPiUXdZAE3che6f3xogoJPeZgig6omHEy1rIY5WVsB3H2BHNnZH+gHG6x91SCWyQCzWGsuL2Hh3ClO5/qQ==", + "hasInstallScript": true, + "license": "Apache-2.0" + }, + "node_modules/@swagger-api/apidom-ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ast/-/apidom-ast-1.11.1.tgz", + "integrity": "sha512-5vcFzXltmIpCsjQouVKzjj7pPPUxYmwIARHuenim96GDnmqqVTtAoBXpIX++cD5RcJA72EBEqepQ+VSAA12RPA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-error": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "unraw": "^3.0.0" + } + }, + "node_modules/@swagger-api/apidom-core": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-core/-/apidom-core-1.11.1.tgz", + "integrity": "sha512-KsN0dZBsutUGWtbsqBMvQ+3pJUjq/wRRABCNIG2Ys/1Ctq8FaQaA0MoICPuYgDZCUNsZuJYbw6Swm6e0GaHWtA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-ast": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@types/ramda": "~0.30.0", + "minim": "~0.23.8", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "short-unique-id": "^5.3.2", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-error/-/apidom-error-1.11.1.tgz", + "integrity": "sha512-7KV2Ac4BOcrv4yJz7T5DbZiTdqbnVUT+g68Hjhabl5zhD28mfEEn9V8Zq2D6rtjlCYkqWAMFb8Y6Y+9ssH5wgA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.20.7" + } + }, + "node_modules/@swagger-api/apidom-json-pointer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-json-pointer/-/apidom-json-pointer-1.11.1.tgz", + "integrity": "sha512-c8QSUgQxDolTO+rP2bvX4CrZOrnTMTAMh0xGq8LaYvzVzs0bQT7ZApsbcA/4bzWlwcg6wy2Uuw+qMadl1FNR3w==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swaggerexpert/json-pointer": "^2.10.1" + } + }, + "node_modules/@swagger-api/apidom-ns-api-design-systems": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-api-design-systems/-/apidom-ns-api-design-systems-1.11.1.tgz", + "integrity": "sha512-2K3Ix+nRHDkuixkZ4FAMWY5MAJHipzpFvZrRtneZ7hsx7nObw9HYEXZw/yXuYrvnhC8jsE4z91Gwuvvz7ZjfPw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-1": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-arazzo-1": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-arazzo-1/-/apidom-ns-arazzo-1-1.11.1.tgz", + "integrity": "sha512-rnICw0uXnKeNHUaS+Ip7lxtVXqH1iA3zFlX446e4XAamJd6yU28sujIsGiZ71qPQ217teidkfK7Bx7MktHdiEw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-2020-12": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-asyncapi-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-asyncapi-2/-/apidom-ns-asyncapi-2-1.11.1.tgz", + "integrity": "sha512-syABiWLeWRfKoonUhPriPVwDDeEOlN5RD20Dj/MS9DT5r1BJUrAB1BfRRRHsVhzaXVdUcKKH99iC9C842J9kvA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-draft-7": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-asyncapi-3": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-asyncapi-3/-/apidom-ns-asyncapi-3-1.11.1.tgz", + "integrity": "sha512-y4syE8jOEGuSirc3YaeI0dh3rEvHfc/pERQOTj3KofS2IABpBXTmtg+oDfG2zte1/Cyc/eJ6qecVAns5mhBpow==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-asyncapi-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-json-schema-2019-09": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-2019-09/-/apidom-ns-json-schema-2019-09-1.11.1.tgz", + "integrity": "sha512-1SNXikZN2uQ1YZ3A4dzWBoMN6wTkba1qZdy/NOkweFtoLuBb63KKN/gD1e6chQV8+ikqGn8TTUZnYvX6SVBZ6g==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-draft-7": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.4" + } + }, + "node_modules/@swagger-api/apidom-ns-json-schema-2020-12": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-2020-12/-/apidom-ns-json-schema-2020-12-1.11.1.tgz", + "integrity": "sha512-oyvTkjDXI9k3G8oVHOvpL/t1MfZmx8d7rgeNqsm6j/vK6WlOXIOHdN9LTYRo8YdACaWq/JV5B30grkio/HRMKQ==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-2019-09": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.4" + } + }, + "node_modules/@swagger-api/apidom-ns-json-schema-draft-4": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-draft-4/-/apidom-ns-json-schema-draft-4-1.11.1.tgz", + "integrity": "sha512-Ha23zkVSItmFZbAoSKMI7hwYJT7yTMWO+EcNzDBEClsqRrkcCtvF2YsiQZcyUt5SrEwV8rW0TWE0CVG+WEs2zg==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-ast": "^1.11.1", + "@swagger-api/apidom-core": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.4" + } + }, + "node_modules/@swagger-api/apidom-ns-json-schema-draft-6": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-draft-6/-/apidom-ns-json-schema-draft-6-1.11.1.tgz", + "integrity": "sha512-Gm4ULCg4yulfjZiMIbH1XiiKHI/BqK0zc1GexViiLShXS35/2dc27GmpI0YgV7S+DqvivNrwAkqojeN7ho9/NA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-draft-4": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.4" + } + }, + "node_modules/@swagger-api/apidom-ns-json-schema-draft-7": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-json-schema-draft-7/-/apidom-ns-json-schema-draft-7-1.11.1.tgz", + "integrity": "sha512-OHW4Qb0BqbHJ3QoQcGREE5bobMeBkZzSQe/0RFGayhI1HJZqrmwtot2nLAuie9sQJoj/xeUprOsA/he06NVFEw==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-draft-6": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.4" + } + }, + "node_modules/@swagger-api/apidom-ns-openapi-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-2/-/apidom-ns-openapi-2-1.11.1.tgz", + "integrity": "sha512-yXHJmyN+NyF2xBD6KlFmGuMrf1hKqK9pm/FwStepIUqvn6bfTGgEdUi5BivQuErRrN6NtQczFF21Jlu6jjg86Q==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-draft-4": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-openapi-3-0": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-1.11.1.tgz", + "integrity": "sha512-R2zHd33OiVT5eTlYKS1FyVDP0G76ymdP2EIrBPbM1FDKam1kRIRdgZA2StCd9PY4oNp/LqQKMnfe9wdLWZS3AA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-draft-4": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-openapi-3-1": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-1.11.1.tgz", + "integrity": "sha512-FtoW4wkFO1VSHu6G+wUZ71hQhIOuastJPyWEePbfySE4Uiz+01t/X/ODnl2OHRGVUYFoJa7kJi5/xqcsprdxtA==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-ast": "^1.11.1", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-json-pointer": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-2020-12": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-0": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-ns-openapi-3-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-2/-/apidom-ns-openapi-3-2-1.11.1.tgz", + "integrity": "sha512-ILJAgp6mHwoV8rRuKYD3QuvPdcRcmK9YmAfrsjgC7fJM7irqzC+nBOKhrWVpTAee7r3b+B3HpV5MG8aKGd9qNQ==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-ast": "^1.11.1", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-json-pointer": "^1.11.1", + "@swagger-api/apidom-ns-json-schema-2020-12": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-0": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-1": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "ts-mixer": "^6.0.3" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-api-design-systems-json": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-api-design-systems-json/-/apidom-parser-adapter-api-design-systems-json-1.11.1.tgz", + "integrity": "sha512-bCt1/7NPfCznhq2D3Y1UcZowdxMtr6wGCISMSPf3ziaCcOQhy7sG/nWEzS/rwcKCVNefVft833Ab3jaCWGivJw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-api-design-systems": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-api-design-systems-yaml": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-api-design-systems-yaml/-/apidom-parser-adapter-api-design-systems-yaml-1.11.1.tgz", + "integrity": "sha512-hUcshr5ydn/L4VsgP5nyrFDp4QqIADrx5nQnFddw/OWCNi1Al19ccPxuBh1Qlf421AAmk1oUiybeGyduvRsVPQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-api-design-systems": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-arazzo-json-1": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-arazzo-json-1/-/apidom-parser-adapter-arazzo-json-1-1.11.1.tgz", + "integrity": "sha512-8ydiEnlSJ7DPhFqg9Z11u4Vda16yaOuIGLablI0mOnYoAMTlqnteGk5CDPlVb970VBTYvsNlgW+164XfHAU/6w==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-arazzo-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-arazzo-yaml-1": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-arazzo-yaml-1/-/apidom-parser-adapter-arazzo-yaml-1-1.11.1.tgz", + "integrity": "sha512-G4++rZDMKokEfq78EJ2aE7pgd1Xo70XIn1/ikSiT5awfuhPJzNcV99ZdzQI2xVVU/pbKIL2Vc/b5SP1IRlfCwA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-arazzo-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-asyncapi-json-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-asyncapi-json-2/-/apidom-parser-adapter-asyncapi-json-2-1.11.1.tgz", + "integrity": "sha512-7Npn4LkG4q95b2VimG3SV0lqgG3xPeF5Srq+sVbG7iFd4yDubvEVy5zzqx5QH4tOtATdarhv6glA9j3hTfWBdQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-asyncapi-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-asyncapi-json-3": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-asyncapi-json-3/-/apidom-parser-adapter-asyncapi-json-3-1.11.1.tgz", + "integrity": "sha512-/C1CzsnUW2ZMBg4kWYrhrfqmyjb4aGo9+YaySQwdArLfM8l2HCOQqDEteGIivedVEsmTpVdhC60gdb6N2VzSaQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-asyncapi-3": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-asyncapi-yaml-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-asyncapi-yaml-2/-/apidom-parser-adapter-asyncapi-yaml-2-1.11.1.tgz", + "integrity": "sha512-0Xfu8PLM787el0R7lwjFfQYe0Bpv3Jz0YlkEiQqAVvftVb0oNi8tg9FhDTR8ju/N94gpNXIfaH/5Ahgz5G+NKg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-asyncapi-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-asyncapi-yaml-3": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-asyncapi-yaml-3/-/apidom-parser-adapter-asyncapi-yaml-3-1.11.1.tgz", + "integrity": "sha512-DqoR43NsFBmiJW1h2Xg3n2V6NQx+95qJ3ziA9rIbKJHGCidHtjNJgi4I7sWGnaIApIHijYY2bW22MKXaT0a0cQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-asyncapi-3": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-json": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-json/-/apidom-parser-adapter-json-1.11.1.tgz", + "integrity": "sha512-L8XFzTbEknHDhD40M/pSoDlimjlYaXXWZS4AmyD3i+XRfiDWWVhEWHPE9OTNk6UL8R6DOBm3RSDxAd5xpLoPjg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-ast": "^1.11.1", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "tree-sitter": "=0.21.1", + "tree-sitter-json": "=0.24.8", + "web-tree-sitter": "=0.24.5" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-json-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-json-2/-/apidom-parser-adapter-openapi-json-2-1.11.1.tgz", + "integrity": "sha512-s9xZa/h4Yiz+Qc304s+9JSTPFsToYtSWQCeyA9jkHOWy/Oq8ZjD9wg34IjENS3yBqM1YLz6Dk+PX06DcyAOnnw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-json-3-0": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-json-3-0/-/apidom-parser-adapter-openapi-json-3-0-1.11.1.tgz", + "integrity": "sha512-dLGaVn24N+YZRB0vzQMC4R+aiSNfD81Xcp5TwdEbE+jOeOnoOe5NqzqCWjaDpSMChDsK/NdaSDjQj4uiYfWpug==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-0": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-json-3-1": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-json-3-1/-/apidom-parser-adapter-openapi-json-3-1-1.11.1.tgz", + "integrity": "sha512-EnYF3rzPZoiCYDnp4ChB6K15RUV4rE6QfEh7fTEwIlkWMUKv4oVwZd8aqz2i9laRZiBH6S2uUoED8YNtCNbeIg==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-json-3-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-json-3-2/-/apidom-parser-adapter-openapi-json-3-2-1.11.1.tgz", + "integrity": "sha512-digw37g+k/rg87HHMUHuSZVWH1Kh8OjC8SmQflIh1Oot9fGhmnZWddsws+sKWSVy6/HveuZPykL8bxtSV3Nc/A==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-yaml-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-yaml-2/-/apidom-parser-adapter-openapi-yaml-2-1.11.1.tgz", + "integrity": "sha512-b38GFur/NjjLFBCVR/wo7DRF6EW5h8B5jBe7C17EVaJvg9eRzknnr9/KMnxYeTtjQVO8W/JeY7LlLad1/j0pcA==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-yaml-3-0": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-yaml-3-0/-/apidom-parser-adapter-openapi-yaml-3-0-1.11.1.tgz", + "integrity": "sha512-dza6Bwe5kLL+4jANuaScxvYh3o7RxESp6Riz6M09cXRysyRrHFQ7UYuUhxepSD4jSiSxJQS8nu0i547i6Z7W7Q==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-0": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-yaml-3-1/-/apidom-parser-adapter-openapi-yaml-3-1-1.11.1.tgz", + "integrity": "sha512-PgmolQN1PYdROSo/cHNyXINVD+aLmW6VqfwT7potNo08c4aWj+QQ/a0Az+mldfJ+G98WjNRvEKr8dhEw8zfqmw==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-openapi-yaml-3-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-openapi-yaml-3-2/-/apidom-parser-adapter-openapi-yaml-3-2-1.11.1.tgz", + "integrity": "sha512-+nmtJ3/wPLBBN6d8xI8rD0mOz80V4iSRe6rYYOQ/skel673N1SY4B58Ufnc7KnMNV4cOce/a52ASQ1Qd1csLvQ==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-yaml-1-2": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-parser-adapter-yaml-1-2/-/apidom-parser-adapter-yaml-1-2-1.11.1.tgz", + "integrity": "sha512-KEgk5PoSmmLC7ZvH0+RF4FPyWAj0NyrPFbTr04DmNPznfr2qpGqvt3ZBmAJm82jrWoI1dc8EH1ugT1YX69N8ww==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-ast": "^1.11.1", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@tree-sitter-grammars/tree-sitter-yaml": "=0.7.1", + "@types/ramda": "~0.30.0", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0", + "tree-sitter": "=0.22.4", + "web-tree-sitter": "=0.24.5" + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-yaml-1-2/node_modules/@tree-sitter-grammars/tree-sitter-yaml": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@tree-sitter-grammars/tree-sitter-yaml/-/tree-sitter-yaml-0.7.1.tgz", + "integrity": "sha512-AynBwkIoQCTgjDR33bDUp9Mqq+YTco0is3n5hRApMqG9of/6A4eQsfC1/uSEeHSUyMQSYawcAWamsexnVpIP4Q==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-addon-api": "^8.3.1", + "node-gyp-build": "^4.8.4" + }, + "peerDependencies": { + "tree-sitter": "^0.22.4" + }, + "peerDependenciesMeta": { + "tree-sitter": { + "optional": true + } + } + }, + "node_modules/@swagger-api/apidom-parser-adapter-yaml-1-2/node_modules/tree-sitter": { + "version": "0.22.4", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.22.4.tgz", + "integrity": "sha512-usbHZP9/oxNsUY65MQUsduGRqDHQOou1cagUSwjhoSYAmSahjQDAVsh9s+SlZkn8X8+O1FULRGwHu7AFP3kjzg==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-addon-api": "^8.3.0", + "node-gyp-build": "^4.8.4" + } + }, + "node_modules/@swagger-api/apidom-reference": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-1.11.1.tgz", + "integrity": "sha512-wxsRo12YVc2Q4o81K9EGzX5oM1htNDkeCIRkLyg1wPvzFQUH4khd6aOWYaX/0V0L+7yqwwmeW/t80xV8qLEGAQ==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.26.10", + "@swagger-api/apidom-core": "^1.11.1", + "@swagger-api/apidom-error": "^1.11.1", + "@types/ramda": "~0.30.0", + "axios": "^1.16.0", + "minimatch": "^10.2.1", + "ramda": "~0.30.0", + "ramda-adjunct": "^5.0.0" + }, + "optionalDependencies": { + "@swagger-api/apidom-json-pointer": "^1.11.1", + "@swagger-api/apidom-ns-arazzo-1": "^1.11.1", + "@swagger-api/apidom-ns-asyncapi-2": "^1.11.1", + "@swagger-api/apidom-ns-openapi-2": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-0": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-1": "^1.11.1", + "@swagger-api/apidom-ns-openapi-3-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-api-design-systems-json": "^1.11.1", + "@swagger-api/apidom-parser-adapter-api-design-systems-yaml": "^1.11.1", + "@swagger-api/apidom-parser-adapter-arazzo-json-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-arazzo-yaml-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-asyncapi-json-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-asyncapi-json-3": "^1.11.1", + "@swagger-api/apidom-parser-adapter-asyncapi-yaml-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-asyncapi-yaml-3": "^1.11.1", + "@swagger-api/apidom-parser-adapter-json": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-json-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-json-3-0": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-json-3-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-json-3-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-yaml-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-0": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": "^1.11.1", + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-2": "^1.11.1", + "@swagger-api/apidom-parser-adapter-yaml-1-2": "^1.11.1" + } + }, + "node_modules/@swaggerexpert/cookie": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@swaggerexpert/cookie/-/cookie-2.0.2.tgz", + "integrity": "sha512-DPI8YJ0Vznk4CT+ekn3rcFNq1uQwvUHZhH6WvTSPD0YKBIlMS9ur2RYKghXuxxOiqOam/i4lHJH4xTIiTgs3Mg==", + "license": "Apache-2.0", + "dependencies": { + "apg-lite": "^1.0.3" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/@swaggerexpert/json-pointer": { + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@swaggerexpert/json-pointer/-/json-pointer-2.10.2.tgz", + "integrity": "sha512-qMx1nOrzoB+PF+pzb26Q4Tc2sOlrx9Ba2UBNX9hB31Omrq+QoZ2Gly0KLrQWw4Of1AQ4J9lnD+XOdwOdcdXqqw==", + "license": "Apache-2.0", + "dependencies": { + "apg-lite": "^1.0.4" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/@tanstack/query-core": { + "version": "5.100.14", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.100.14.tgz", + "integrity": "sha512-5X41dGpxgeaHISCRW2oYwcSycZeULZzAunaudXT9ov1KOTj9xwt0CH6hbwqP1/z74ZWF7rYFnDpyYH07XFcZew==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/query-devtools": { + "version": "5.100.14", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.100.14.tgz", + "integrity": "sha512-g96SmSSQecYTYcyuAMRXr895GplJv01UGt7qttQWPOUyZ5EGz5tbRc589bMc2m5BsPFD6O0PCEAHdbDYNP6UBw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@tanstack/react-query": { + "version": "5.100.14", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.100.14.tgz", + "integrity": "sha512-oOr6aRdSFEwWhzxEkD/9ZcItM3+LjBSkeVmadWKwUssAHTsqd/7bOjWrX4AbvEkoEhgAxzN0Xk6H/aYzXiYBAw==", + "license": "MIT", + "dependencies": { + "@tanstack/query-core": "5.100.14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^18 || ^19" + } + }, + "node_modules/@tanstack/react-query-devtools": { + "version": "5.100.14", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.100.14.tgz", + "integrity": "sha512-JkP5VDgKOw3t/QSA1OABRHEqx8BuNs5MfvZRooNqdvN57SzTuGq3fKR1a2IH5rqa5HDLUm+FOXUEnB9ueHiLzg==", + "license": "MIT", + "dependencies": { + "@tanstack/query-devtools": "5.100.14" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "@tanstack/react-query": "^5.100.14", + "react": "^18 || ^19" + } + }, "node_modules/@tybys/wasm-util": { "version": "0.10.2", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", @@ -1861,6 +2597,15 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -1868,11 +2613,26 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/prismjs": { + "version": "1.26.6", + "resolved": "https://registry.npmjs.org/@types/prismjs/-/prismjs-1.26.6.tgz", + "integrity": "sha512-vqlvI7qlMvcCBbVe0AKAb4f97//Hy0EBTaiW8AalRnG/xAN5zOiWWyrNqNXeq8+KAuvRewjCVY1+IPxk4RdNYw==", + "license": "MIT" + }, + "node_modules/@types/ramda": { + "version": "0.30.2", + "resolved": "https://registry.npmjs.org/@types/ramda/-/ramda-0.30.2.tgz", + "integrity": "sha512-PyzHvjCalm2BRYjAU6nIB3TprYwMNOUY/7P/N8bSzp9W/yM2YrtGtAnnVtaCNSeOZ8DzKyFDvaqQs7LnWwwmBA==", + "license": "MIT", + "dependencies": { + "types-ramda": "^0.30.1" + } + }, "node_modules/@types/react": { "version": "19.2.15", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.15.tgz", "integrity": "sha512-eRwcGNHve+E8qtEQSSRl6urh+rFop4v8gm6O8rGv25CodbvFdLjA1vVQ1KkiFE0w0UPOnb8tDiFKL5lp0rtY5Q==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "csstype": "^3.2.2" @@ -1888,6 +2648,35 @@ "@types/react": "^19.2.0" } }, + "node_modules/@types/swagger-ui-react": { + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/@types/swagger-ui-react/-/swagger-ui-react-5.18.0.tgz", + "integrity": "sha512-c2M9adVG7t28t1pq19K9Jt20VLQf0P/fwJwnfcmsVVsdkwCWhRmbKDu+tIs0/NGwJ/7GY8lBx+iKZxuDI5gDbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/react": "*" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.59.4", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.4.tgz", @@ -2272,12 +3061,48 @@ "react-dom": ">=18.0.0" } }, + "node_modules/apg-lite": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/apg-lite/-/apg-lite-1.0.5.tgz", + "integrity": "sha512-SlI+nLMQDzCZfS39ihzjGp3JNBQfJXyMi6cg9tkLOCPVErgFsUIAEdO9IezR7kbP5Xd0ozcPNQBkf9TO5cHgWw==", + "license": "BSD-2-Clause" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "license": "MIT" }, + "node_modules/autolinker": { + "version": "3.16.2", + "resolved": "https://registry.npmjs.org/autolinker/-/autolinker-3.16.2.tgz", + "integrity": "sha512-JiYl7j2Z19F9NdTmirENSUUIIL/9MytEWtmzhfmsKPCp9E+G35Y0UNCMoM9tFigxT59qSc8Ml2dlZXOCVTYwuA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.3.0" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/axios": { "version": "1.16.1", "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.1.tgz", @@ -2294,12 +3119,31 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", - "dev": true, "license": "MIT", "engines": { "node": "18 || 20 || >=22" } }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/baseline-browser-mapping": { "version": "2.10.31", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.31.tgz", @@ -2317,7 +3161,6 @@ "version": "5.0.6", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", - "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -2360,6 +3203,48 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/call-bind": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", + "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "get-intrinsic": "^1.3.0", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/call-bind-apply-helpers": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", @@ -2410,6 +3295,42 @@ ], "license": "CC-BY-4.0" }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/classnames": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", + "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", + "license": "MIT" + }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -2446,6 +3367,16 @@ "node": ">= 0.8" } }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/compute-scroll-into-view": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/compute-scroll-into-view/-/compute-scroll-into-view-3.1.1.tgz", @@ -2459,6 +3390,39 @@ "dev": true, "license": "MIT" }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/copy-to-clipboard": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz", + "integrity": "sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==", + "license": "MIT", + "dependencies": { + "toggle-selection": "^1.0.6" + } + }, + "node_modules/core-js-pure": { + "version": "3.49.0", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.49.0.tgz", + "integrity": "sha512-XM4RFka59xATyJv/cS3O3Kml72hQXUeGRuuTmMYFxwzc9/7C8OYTaIR/Ji+Yt8DXzsFLNhat15cE/JP15HrCgw==", + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/crelt": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", @@ -2480,6 +3444,12 @@ "node": ">= 8" } }, + "node_modules/css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "license": "MIT" + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -2509,6 +3479,28 @@ } } }, + "node_modules/decode-named-character-reference": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", + "integrity": "sha512-GtpQYB283KrPp6nRw50q3U9/VfOutZOe103qlN7BPP6Ad27xYnOIWv4lPzo8HCAL+mMZofJ9KEy30fq6MfaK6Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -2516,6 +3508,32 @@ "dev": true, "license": "MIT" }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2535,6 +3553,24 @@ "node": ">=8" } }, + "node_modules/dompurify": { + "version": "3.4.5", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.5.tgz", + "integrity": "sha512-OrwIBKsdNSVEeubdJ1HBv/wNENRM9ytAVCv7YXt//A3vPdVMNuACRqK9mXCGCBW2ln7BT/A4X0jXHo2Gu89miA==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, + "node_modules/drange": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -2803,6 +3839,12 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-json-patch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", + "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", + "license": "MIT" + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2817,6 +3859,19 @@ "dev": true, "license": "MIT" }, + "node_modules/fault": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz", + "integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==", + "license": "MIT", + "dependencies": { + "format": "^0.2.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -2906,6 +3961,21 @@ } } }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/form-data": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", @@ -2922,6 +3992,14 @@ "node": ">= 6" } }, + "node_modules/format": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz", + "integrity": "sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww==", + "engines": { + "node": ">=0.4.x" + } + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -3031,6 +4109,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", @@ -3070,6 +4160,36 @@ "node": ">= 0.4" } }, + "node_modules/hast-util-parse-selector": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", + "integrity": "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hastscript": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-9.0.1.tgz", + "integrity": "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^4.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hermes-estree": { "version": "0.25.1", "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", @@ -3087,6 +4207,21 @@ "hermes-estree": "0.25.1" } }, + "node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/highlightjs-vue": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/highlightjs-vue/-/highlightjs-vue-1.0.0.tgz", + "integrity": "sha512-PDEfEF102G23vHmPhLyPboFCD+BkMGu+GuJe2d9/eH4FsCwvgBpnc9n0pGE+ffKdph38s6foEZiEjdgHdzp+IA==", + "license": "CC0-1.0" + }, "node_modules/html-parse-stringify": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz", @@ -3137,6 +4272,26 @@ } } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -3147,6 +4302,15 @@ "node": ">= 4" } }, + "node_modules/immutable": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-3.8.3.tgz", + "integrity": "sha512-AUY/VyX0E5XlibOmWt10uabJzam1zlYjwiEgQSDc5+UIkFNaF9WM0JxXKaNMGf+F/ffUF+7kRKXM9A7C0xXqMg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -3157,6 +4321,67 @@ "node": ">=0.8.19" } }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -3180,12 +4405,43 @@ "node": ">=0.10.0" } }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/is-mobile": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/is-mobile/-/is-mobile-5.0.0.tgz", "integrity": "sha512-Tz/yndySvLAEXh+Uk8liFCxOwVH6YutuR74utvOcu7I9Di+DwM0mtdPVZNaVvvBUM2OXxne/NhOs1zAO7riusQ==", "license": "MIT" }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "license": "MIT" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -3193,13 +4449,30 @@ "dev": true, "license": "ISC" }, + "node_modules/js-file-download": { + "version": "0.4.12", + "resolved": "https://registry.npmjs.org/js-file-download/-/js-file-download-0.4.12.tgz", + "integrity": "sha512-rML+NkoD08p5Dllpjo0ffy4jRHeY6Zsapvr/W86N7E0yuzAO6qa5X9+xog6zQNlH102J7IXljNY2FtS6Lj3ucg==", + "license": "MIT" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, "license": "MIT" }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -3569,6 +4842,44 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz", + "integrity": "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==", + "license": "MIT" + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lowlight": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/lowlight/-/lowlight-1.20.0.tgz", + "integrity": "sha512-8Ktj+prEb1RoCPkEOrPMYUN/nCggB7qAWe3a7OpMjWQkh3l2RD5wKRQ+o8Q8YuI9RG/xs95waaI/E6ym/7NsTw==", + "license": "MIT", + "dependencies": { + "fault": "^1.0.0", + "highlight.js": "~10.7.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -3609,11 +4920,22 @@ "node": ">= 0.6" } }, + "node_modules/minim": { + "version": "0.23.8", + "resolved": "https://registry.npmjs.org/minim/-/minim-0.23.8.tgz", + "integrity": "sha512-bjdr2xW1dBCMsMGGsUeqM4eFI60m94+szhxWys+B1ztIt6gWSfeGBdSVCIawezeHYLYn0j6zrsXdQS/JllBzww==", + "license": "MIT", + "dependencies": { + "lodash": "^4.15.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/minimatch": { "version": "10.2.5", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", - "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "brace-expansion": "^5.0.5" @@ -3657,6 +4979,43 @@ "dev": true, "license": "MIT" }, + "node_modules/neotraverse": { + "version": "0.6.18", + "resolved": "https://registry.npmjs.org/neotraverse/-/neotraverse-0.6.18.tgz", + "integrity": "sha512-Z4SmBUweYa09+o6pG+eASabEpP6QkQ70yHj351pQoEXIs8uHbaU2DWVmzBANKgflPa47A50PtB2+NgRpQvr7vA==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/node-abort-controller": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/node-abort-controller/-/node-abort-controller-3.1.1.tgz", + "integrity": "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ==", + "license": "MIT" + }, + "node_modules/node-addon-api": { + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.8.0.tgz", + "integrity": "sha512-c5Ko1fZJIJmzhFIkhRN76WTq+fC6tWnGy9CXA0fA+XygsWZmEwG8vmbkNqxMyoaa0Tin4djul49NzdVcJJcjeA==", + "license": "MIT", + "optional": true, + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "optional": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-releases": { "version": "2.0.46", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.46.tgz", @@ -3667,6 +5026,15 @@ "node": ">=18" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -3679,6 +5047,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/openapi-path-templating": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/openapi-path-templating/-/openapi-path-templating-2.2.1.tgz", + "integrity": "sha512-eN14VrDvl/YyGxxrkGOHkVkWEoPyhyeydOUrbvjoz8K5eIGgELASwN1eqFOJ2CTQMGCy2EntOK1KdtJ8ZMekcg==", + "license": "Apache-2.0", + "dependencies": { + "apg-lite": "^1.0.4" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/openapi-server-url-templating": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/openapi-server-url-templating/-/openapi-server-url-templating-1.3.0.tgz", + "integrity": "sha512-DPlCms3KKEbjVQb0spV6Awfn6UWNheuG/+folQPzh/wUaKwuqvj8zt5gagD7qoyxtE03cIiKPgLFS3Q8Bz00uQ==", + "license": "Apache-2.0", + "dependencies": { + "apg-lite": "^1.0.4" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -3741,6 +5133,31 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3790,6 +5207,15 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/postcss": { "version": "8.5.15", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", @@ -3829,6 +5255,42 @@ "node": ">= 0.8.0" } }, + "node_modules/prismjs": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", + "integrity": "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "license": "MIT" + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/proxy-from-env": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", @@ -3863,6 +5325,60 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/querystringify": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", + "license": "MIT" + }, + "node_modules/ramda": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.30.1.tgz", + "integrity": "sha512-tEF5I22zJnuclswcZMc8bDIrwRHRzf+NqVEmqg50ShAZMP7MWeR/RGDthfM/p+BlqvF2fXAzpn8i+SJcYD3alw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ramda" + } + }, + "node_modules/ramda-adjunct": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ramda-adjunct/-/ramda-adjunct-5.1.0.tgz", + "integrity": "sha512-8qCpl2vZBXEJyNbi4zqcgdfHtcdsWjOGbiNSEnEBrM6Y0OKOT8UxJbIVGm1TIcjaSu2MxaWcgtsNlKlCk7o7qg==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/ramda-adjunct" + }, + "peerDependencies": { + "ramda": ">= 0.30.0" + } + }, + "node_modules/randexp": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.5.3.tgz", + "integrity": "sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w==", + "license": "MIT", + "dependencies": { + "drange": "^1.0.2", + "ret": "^0.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/react": { "version": "19.2.6", "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", @@ -3911,12 +5427,202 @@ } } }, + "node_modules/react-immutable-proptypes": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/react-immutable-proptypes/-/react-immutable-proptypes-2.2.0.tgz", + "integrity": "sha512-Vf4gBsePlwdGvSZoLSBfd4HAP93HDauMY4fDjXhreg/vg6F3Fj/MXDNyTbltPC/xZKmZc+cjLu3598DdYK6sgQ==", + "license": "MIT", + "dependencies": { + "invariant": "^2.2.2" + }, + "peerDependencies": { + "immutable": ">=3.6.2" + } + }, + "node_modules/react-immutable-pure-component": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/react-immutable-pure-component/-/react-immutable-pure-component-2.2.2.tgz", + "integrity": "sha512-vkgoMJUDqHZfXXnjVlG3keCxSO/U6WeDQ5/Sl0GK2cH8TOxEzQ5jXqDXHEL/jqk6fsNxV05oH5kD7VNMUE2k+A==", + "license": "MIT", + "peerDependencies": { + "immutable": ">= 2 || >= 4.0.0-rc", + "react": ">= 16.6", + "react-dom": ">= 16.6" + } + }, "node_modules/react-is": { "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "license": "MIT" }, + "node_modules/react-redux": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.3.0.tgz", + "integrity": "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==", + "license": "MIT", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-router": { + "version": "7.15.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.15.1.tgz", + "integrity": "sha512-R8rl9HhgikFYoPJymnUtPXWbnDb3oget6lQnfIoupbt61aT9aOhRkDsY2XRhZRyX1Z/8a5sL74fXmFNm3NRK5A==", + "license": "MIT", + "dependencies": { + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } + } + }, + "node_modules/react-router-dom": { + "version": "7.15.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.15.1.tgz", + "integrity": "sha512-AzF62gjY6U9rkMq4RfP/r2EVtQ7DMfNMjyOp/flLTCrtRylLiK4wT4pSq6O8rOXZ2eXdZYJPEYe+ifomiv+Igg==", + "license": "MIT", + "dependencies": { + "react-router": "7.15.1" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "react": ">=18", + "react-dom": ">=18" + } + }, + "node_modules/react-syntax-highlighter": { + "version": "16.1.1", + "resolved": "https://registry.npmjs.org/react-syntax-highlighter/-/react-syntax-highlighter-16.1.1.tgz", + "integrity": "sha512-PjVawBGy80C6YbC5DDZJeUjBmC7skaoEUdvfFQediQHgCL7aKyVHe57SaJGfQsloGDac+gCpTfRdtxzWWKmCXA==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.28.4", + "highlight.js": "^10.4.1", + "highlightjs-vue": "^1.0.0", + "lowlight": "^1.17.0", + "prismjs": "^1.30.0", + "refractor": "^5.0.0" + }, + "engines": { + "node": ">= 16.20.2" + }, + "peerDependencies": { + "react": ">= 0.14.0" + } + }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-immutable": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/redux-immutable/-/redux-immutable-4.0.0.tgz", + "integrity": "sha512-SchSn/DWfGb3oAejd+1hhHx01xUoxY+V7TeK0BKqpkLKiQPVFf7DYzEaKmrEVxsWxielKfSK9/Xq66YyxgR1cg==", + "license": "BSD-3-Clause", + "peerDependencies": { + "immutable": "^3.8.1 || ^4.0.0-rc.1" + } + }, + "node_modules/refractor": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/refractor/-/refractor-5.0.0.tgz", + "integrity": "sha512-QXOrHQF5jOpjjLfiNk5GFnWhRXvxjUVnlFxkeDmewR5sXkr3iM46Zo+CnRR8B+MDVqkULW4EcLVcRBNOPXHosw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/prismjs": "^1.0.0", + "hastscript": "^9.0.0", + "parse-entities": "^4.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/remarkable": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/remarkable/-/remarkable-2.0.1.tgz", + "integrity": "sha512-YJyMcOH5lrR+kZdmB0aJJ4+93bEojRZ1HGDn9Eagu6ibg7aVZhc3OWbbShRid+Q5eAfsEqWxpe+g5W5nYNfNiA==", + "license": "MIT", + "dependencies": { + "argparse": "^1.0.10", + "autolinker": "^3.11.0" + }, + "bin": { + "remarkable": "bin/remarkable.js" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/remarkable/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "license": "MIT" + }, + "node_modules/reselect": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.2.0.tgz", + "integrity": "sha512-AgZ3UOZm3YndfrJ4OYjgrT7bmCm/1iqkjvEfH/oYjzh6PD2qw4QuT3jjnXIrpdt4MTpMXclMT3lXbmRY+XRakw==", + "license": "MIT" + }, + "node_modules/ret": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/rolldown": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.1.tgz", @@ -3951,6 +5657,26 @@ "@rolldown/binding-win32-x64-msvc": "1.0.1" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/scheduler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", @@ -3976,6 +5702,64 @@ "semver": "bin/semver.js" } }, + "node_modules/serialize-error": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz", + "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/set-cookie-parser": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.2.tgz", + "integrity": "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw==", + "license": "MIT" + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sha.js": { + "version": "2.4.12", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", + "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" + }, + "bin": { + "sha.js": "bin.js" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -3999,6 +5783,16 @@ "node": ">=8" } }, + "node_modules/short-unique-id": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/short-unique-id/-/short-unique-id-5.3.2.tgz", + "integrity": "sha512-KRT/hufMSxXKEDSQujfVE0Faa/kZ51ihUcZQAcmP04t00DvPj7Ox5anHke1sJYUtzSuiT/Y5uyzg/W7bBEGhCg==", + "license": "Apache-2.0", + "bin": { + "short-unique-id": "bin/short-unique-id", + "suid": "bin/short-unique-id" + } + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -4081,6 +5875,22 @@ "node": ">=0.10.0" } }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "license": "BSD-3-Clause" + }, "node_modules/string-convert": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/string-convert/-/string-convert-0.2.1.tgz", @@ -4099,6 +5909,116 @@ "integrity": "sha512-5Z9ZpRzfuH6l/UAvCPAPUo3665Nk2wLaZU3x+TLHKVzIz33+sbJqbtrYoC3KD4/uVOr2Zp+L0LySezP9OHV9yA==", "license": "MIT" }, + "node_modules/swagger-client": { + "version": "3.37.4", + "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.37.4.tgz", + "integrity": "sha512-3xxqc9s99Vsf47ket2j7D4Tw6b6T7ObNvTqSP009yBeoAo0fy0yprqOVxFISTrvRxN7jgfrEi8GXMhsjzb1M0g==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.22.15", + "@scarf/scarf": "=1.4.0", + "@swagger-api/apidom-core": "^1.11.0", + "@swagger-api/apidom-error": "^1.11.0", + "@swagger-api/apidom-json-pointer": "^1.11.0", + "@swagger-api/apidom-ns-openapi-3-1": "^1.11.0", + "@swagger-api/apidom-ns-openapi-3-2": "^1.11.0", + "@swagger-api/apidom-reference": "^1.11.0", + "@swaggerexpert/cookie": "^2.0.2", + "deepmerge": "~4.3.0", + "fast-json-patch": "^3.0.0-1", + "js-yaml": "^4.1.0", + "neotraverse": "=0.6.18", + "node-abort-controller": "^3.1.1", + "openapi-path-templating": "^2.2.1", + "openapi-server-url-templating": "^1.3.0", + "ramda": "^0.30.1", + "ramda-adjunct": "^5.1.0" + }, + "engines": { + "node": ">=22" + } + }, + "node_modules/swagger-ui-react": { + "version": "5.32.6", + "resolved": "https://registry.npmjs.org/swagger-ui-react/-/swagger-ui-react-5.32.6.tgz", + "integrity": "sha512-2q2kXd6eDR+syyWV5HE2CkWANyr2MHPkNezG4M7fC0FPlBUZEsNgyA/2dcb9dIwgE5xd995dO42h89fNMF5/ng==", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.27.1", + "@scarf/scarf": "=1.4.0", + "base64-js": "^1.5.1", + "buffer": "^6.0.3", + "classnames": "^2.5.1", + "css.escape": "1.5.1", + "deep-extend": "0.6.0", + "dompurify": "^3.4.0", + "ieee754": "^1.2.1", + "immutable": "^3.x.x", + "js-file-download": "^0.4.12", + "js-yaml": "=4.1.1", + "lodash": "^4.18.1", + "prop-types": "^15.8.1", + "randexp": "^0.5.3", + "randombytes": "^2.1.0", + "react-copy-to-clipboard": "5.1.0", + "react-debounce-input": "=3.3.0", + "react-immutable-proptypes": "2.2.0", + "react-immutable-pure-component": "^2.2.0", + "react-inspector": "^6.0.1", + "react-redux": "^9.2.0", + "react-syntax-highlighter": "^16.0.0", + "redux": "^5.0.1", + "redux-immutable": "^4.0.0", + "remarkable": "^2.0.1", + "reselect": "^5.1.1", + "serialize-error": "^8.1.0", + "sha.js": "^2.4.12", + "swagger-client": "^3.37.4", + "url-parse": "^1.5.10", + "xml": "=1.0.1", + "xml-but-prettier": "^1.0.1", + "zenscroll": "^4.0.2" + }, + "peerDependencies": { + "react": ">=16.8.0 <20", + "react-dom": ">=16.8.0 <20" + } + }, + "node_modules/swagger-ui-react/node_modules/react-copy-to-clipboard": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/react-copy-to-clipboard/-/react-copy-to-clipboard-5.1.0.tgz", + "integrity": "sha512-k61RsNgAayIJNoy9yDsYzDe/yAZAzEbEgcz3DZMhF686LEyukcE1hzurxe85JandPUG+yTfGVFzuEw3xt8WP/A==", + "license": "MIT", + "dependencies": { + "copy-to-clipboard": "^3.3.1", + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "react": "^15.3.0 || 16 || 17 || 18" + } + }, + "node_modules/swagger-ui-react/node_modules/react-debounce-input": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/react-debounce-input/-/react-debounce-input-3.3.0.tgz", + "integrity": "sha512-VEqkvs8JvY/IIZvh71Z0TC+mdbxERvYF33RcebnodlsUZ8RSgyKe2VWaHXv4+/8aoOgXLxWrdsYs2hDhcwbUgA==", + "license": "MIT", + "dependencies": { + "lodash.debounce": "^4", + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "react": "^15.3.0 || 16 || 17 || 18" + } + }, + "node_modules/swagger-ui-react/node_modules/react-inspector": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/react-inspector/-/react-inspector-6.0.2.tgz", + "integrity": "sha512-x+b7LxhmHXjHoU/VrFAzw5iutsILRoYyDq97EDYdFpPLcvqtEzk4ZSZSQjnFPbr5T57tLXnHcqFYoN1pI6u8uQ==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.4 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/throttle-debounce": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-5.0.2.tgz", @@ -4125,6 +6045,58 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/to-buffer": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", + "integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==", + "license": "MIT", + "dependencies": { + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/toggle-selection": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/toggle-selection/-/toggle-selection-1.0.6.tgz", + "integrity": "sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==", + "license": "MIT" + }, + "node_modules/tree-sitter": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.21.1.tgz", + "integrity": "sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-addon-api": "^8.0.0", + "node-gyp-build": "^4.8.0" + } + }, + "node_modules/tree-sitter-json": { + "version": "0.24.8", + "resolved": "https://registry.npmjs.org/tree-sitter-json/-/tree-sitter-json-0.24.8.tgz", + "integrity": "sha512-Tc9ZZYwHyWZ3Tt1VEw7Pa2scu1YO7/d2BCBbKTx5hXwig3UfdQjsOPkPyLpDJOn/m1UBEWYAtSdGAwCSyagBqQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-addon-api": "^8.2.2", + "node-gyp-build": "^4.8.2" + }, + "peerDependencies": { + "tree-sitter": "^0.21.1" + }, + "peerDependenciesMeta": { + "tree-sitter": { + "optional": true + } + } + }, "node_modules/ts-api-utils": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", @@ -4138,13 +6110,23 @@ "typescript": ">=4.8.4" } }, + "node_modules/ts-mixer": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz", + "integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA==", + "license": "MIT" + }, + "node_modules/ts-toolbelt": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/ts-toolbelt/-/ts-toolbelt-9.6.0.tgz", + "integrity": "sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==", + "license": "Apache-2.0" + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, - "license": "0BSD", - "optional": true + "license": "0BSD" }, "node_modules/type-check": { "version": "0.4.0", @@ -4159,6 +6141,41 @@ "node": ">= 0.8.0" } }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/types-ramda": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/types-ramda/-/types-ramda-0.30.1.tgz", + "integrity": "sha512-1HTsf5/QVRmLzcGfldPFvkVsAdi1db1BBKzi7iW3KBUlOICg/nKnFS+jGqDJS3YD8VsWbAh7JiHeBvbsw8RPxA==", + "license": "MIT", + "dependencies": { + "ts-toolbelt": "^9.6.0" + } + }, "node_modules/typescript": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", @@ -4197,6 +6214,12 @@ "typescript": ">=4.8.4 <6.1.0" } }, + "node_modules/unraw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unraw/-/unraw-3.0.0.tgz", + "integrity": "sha512-08/DA66UF65OlpUDIQtbJyrqTR0jTAlJ+jsnkQ4jxR7+K5g5YG1APZKQSMCE1vqqmD+2pv6+IdEjmopFatacvg==", + "license": "MIT" + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -4238,6 +6261,16 @@ "punycode": "^2.1.0" } }, + "node_modules/url-parse": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, "node_modules/use-sync-external-store": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", @@ -4340,6 +6373,13 @@ "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", "license": "MIT" }, + "node_modules/web-tree-sitter": { + "version": "0.24.5", + "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.24.5.tgz", + "integrity": "sha512-+J/2VSHN8J47gQUAvF8KDadrfz6uFYVjxoxbKWDoXVsH2u7yLdarCnIURnrMA6uSRkgX3SdmqM5BOoQjPdSh5w==", + "license": "MIT", + "optional": true + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4356,6 +6396,27 @@ "node": ">= 8" } }, + "node_modules/which-typed-array": { + "version": "1.1.20", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.20.tgz", + "integrity": "sha512-LYfpUkmqwl0h9A2HL09Mms427Q1RZWuOHsukfVcKRq9q95iQxdw0ix1JQrqbcDR9PH1QDwf5Qo8OZb5lksZ8Xg==", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -4366,6 +6427,21 @@ "node": ">=0.10.0" } }, + "node_modules/xml": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", + "integrity": "sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==", + "license": "MIT" + }, + "node_modules/xml-but-prettier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xml-but-prettier/-/xml-but-prettier-1.0.1.tgz", + "integrity": "sha512-C2CJaadHrZTqESlH03WOyw0oZTtoy2uEg6dSDF6YRg+9GnYNub53RRemLpnvtbHDFelxMx4LajiFsYeR6XJHgQ==", + "license": "MIT", + "dependencies": { + "repeat-string": "^1.5.2" + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", @@ -4386,6 +6462,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zenscroll": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zenscroll/-/zenscroll-4.0.2.tgz", + "integrity": "sha512-jEA1znR7b4C/NnaycInCU6h/d15ZzCd1jmsruqOKnZP6WXQSMH3W2GL+OXbkruslU4h+Tzuos0HdswzRUk/Vgg==", + "license": "Unlicense" + }, "node_modules/zod": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", diff --git a/frontend/package.json b/frontend/package.json index c36aa065..a62b16f5 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,15 +10,18 @@ }, "scripts": { "dev": "vite", - "build": "vite build", + "build": "npm run gen:api && vite build", "preview": "vite preview", "lint": "eslint src", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit", + "gen:api": "node scripts/build-openapi.mjs" }, "dependencies": { "@ant-design/icons": "^6.2.3", "@codemirror/lang-json": "^6.0.2", "@codemirror/theme-one-dark": "^6.1.3", + "@tanstack/react-query": "^5.100.14", + "@tanstack/react-query-devtools": "^5.100.14", "antd": "^6.4.3", "axios": "^1.16.1", "codemirror": "^6.0.2", @@ -29,12 +32,15 @@ "qs": "^6.15.2", "react": "^19.2.6", "react-dom": "^19.2.6", - "react-i18next": "^17.0.8" + "react-i18next": "^17.0.8", + "react-router-dom": "^7.15.1", + "swagger-ui-react": "^5.32.6" }, "devDependencies": { "@eslint/js": "^10.0.1", "@types/react": "^19.2.15", "@types/react-dom": "^19.2.3", + "@types/swagger-ui-react": "^5.18.0", "@vitejs/plugin-react": "^6.0.2", "eslint": "^10.4.0", "eslint-plugin-react-hooks": "^7.1.1", diff --git a/frontend/public/openapi.json b/frontend/public/openapi.json new file mode 100644 index 00000000..fedcded9 --- /dev/null +++ b/frontend/public/openapi.json @@ -0,0 +1,4944 @@ +{ + "openapi": "3.0.3", + "info": { + "title": "3X-UI Panel API", + "version": "3.x", + "description": "Programmatic interface to a 3X-UI panel. Authenticate either by logging in (cookie) or with an API token from Settings → Security → API Token (Bearer). All endpoints under /panel/api/* honour both modes." + }, + "servers": [ + { + "url": "/", + "description": "Current panel (basePath aware)" + } + ], + "components": { + "securitySchemes": { + "bearerAuth": { + "type": "http", + "scheme": "bearer", + "description": "API token from Settings → Security → API Token. Send as `Authorization: Bearer `." + }, + "cookieAuth": { + "type": "apiKey", + "in": "cookie", + "name": "3x-ui", + "description": "Session cookie set by POST /login. Browser-only." + } + } + }, + "security": [ + { + "bearerAuth": [] + }, + { + "cookieAuth": [] + } + ], + "tags": [ + { + "name": "Authentication", + "description": "Two authentication modes are supported. UI sessions use a cookie set by the login endpoint. Programmatic clients (bots, scripts, remote panels) authenticate with a Bearer token taken from Settings → Security → API Token. Both work for every endpoint under /panel/api/*." + }, + { + "name": "Inbounds", + "description": "Manage inbound configurations and their clients. All endpoints live under /panel/api/inbounds and require a logged-in session or Bearer token. Link-generating endpoints honour forwarded headers only when the request comes from a configured trusted proxy." + }, + { + "name": "Server", + "description": "System status, log retrieval, certificate generators, Xray binary management, and backup/restore. All under /panel/api/server." + }, + { + "name": "Clients", + "description": "Manage clients as first-class entities that can be attached to one or more inbounds. A single client row drives the settings.clients entry in every inbound it belongs to. Endpoints live under /panel/api/clients." + }, + { + "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." + }, + { + "name": "Settings", + "description": "Panel configuration and user credentials. All endpoints live under /panel/setting and require a logged-in session or Bearer token." + }, + { + "name": "API Tokens", + "description": "Manage Bearer tokens used for programmatic auth (bots, central panels acting on this node, CI). Each token has a unique name and an enabled flag — disable to revoke without deleting, delete to revoke permanently. Tokens are stored plaintext so the SPA can show them on demand. Send one as Authorization: Bearer <token> on any /panel/api/* request." + }, + { + "name": "Xray Settings", + "description": "Xray configuration template, outbound management, Warp/Nord integration, and config testing. All endpoints under /panel/xray." + }, + { + "name": "Subscription Server", + "description": "A separate HTTP/HTTPS server that serves proxy subscription links (standard, JSON, and Clash) to clients. The server listens on its own port (default 10882) and is configured in Settings → Subscription. Paths are configurable; defaults are shown below. All subscription endpoints set response headers for client apps to read traffic/expiry info." + }, + { + "name": "WebSocket", + "description": "Real-time status updates via WebSocket. Connect once at ws:///ws to receive a stream of JSON messages without polling. Requires an authenticated session cookie (Bearer token auth is not supported). Each message has a type field that identifies the payload shape." + } + ], + "paths": { + "/login": { + "post": { + "tags": [ + "Authentication" + ], + "summary": "Authenticate with username + password and receive a session cookie. Required before any cookie-based API call.", + "operationId": "post_login", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string", + "description": "Panel admin username." + }, + "password": { + "type": "string", + "description": "Panel admin password." + }, + "twoFactorCode": { + "type": "string", + "description": "OTP code when 2FA is enabled. Omit otherwise." + } + }, + "required": [ + "username", + "password", + "twoFactorCode" + ] + }, + "example": { + "username": "admin", + "password": "admin", + "twoFactorCode": "123456" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "msg": "Logged in successfully" + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + } + } + }, + "example": { + "success": false, + "msg": "Wrong username or password" + } + } + } + } + } + } + }, + "/logout": { + "post": { + "tags": [ + "Authentication" + ], + "summary": "Clear the session cookie. Requires the CSRF header for browser sessions.", + "operationId": "post_logout", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true + } + } + } + } + } + } + }, + "/csrf-token": { + "get": { + "tags": [ + "Authentication" + ], + "summary": "Mint a CSRF token for the current session. The SPA replays it in the X-CSRF-Token header on unsafe requests. Bearer-token callers can skip this — the middleware short-circuits CSRF for authenticated API requests.", + "operationId": "get_csrf_token", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": "csrf-token-string" + } + } + } + } + } + } + }, + "/getTwoFactorEnable": { + "post": { + "tags": [ + "Authentication" + ], + "summary": "Returns whether 2FA is enabled on the panel — used by the login page to decide whether to show the OTP field.", + "operationId": "post_getTwoFactorEnable", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": false + } + } + } + } + } + } + }, + "/panel/api/inbounds/list": { + "get": { + "tags": [ + "Inbounds" + ], + "summary": "List every inbound owned by the authenticated user, including each inbound’s clientStats traffic counters. settings, streamSettings, and sniffing are returned as nested JSON objects (no escaped strings); legacy callers that send them back as JSON-encoded strings are still accepted on write.", + "operationId": "get_panel_api_inbounds_list", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "userId": 1, + "up": 0, + "down": 0, + "total": 0, + "remark": "VLESS-443", + "enable": true, + "expiryTime": 0, + "listen": "", + "port": 443, + "protocol": "vless", + "settings": { + "clients": [], + "decryption": "none" + }, + "streamSettings": { + "network": "tcp", + "security": "reality", + "realitySettings": { + "show": false, + "dest": "..." + } + }, + "tag": "inbound-443", + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ] + }, + "clientStats": [] + } + ] + } + } + } + } + } + } + }, + "/panel/api/inbounds/list/slim": { + "get": { + "tags": [ + "Inbounds" + ], + "summary": "Same shape as /list but with settings.clients[] stripped down to {email, enable, comment} and ClientStats not enriched with UUID/SubId. Use this for list pages; fetch /get/:id when you need the full per-client payload (uuid, password, flow, ...).", + "operationId": "get_panel_api_inbounds_list_slim", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "userId": 1, + "remark": "VLESS-443", + "settings": { + "clients": [ + { + "email": "alice", + "enable": true + } + ], + "decryption": "none" + }, + "clientStats": [] + } + ] + } + } + } + } + } + } + }, + "/panel/api/inbounds/options": { + "get": { + "tags": [ + "Inbounds" + ], + "summary": "Lightweight picker projection of the authenticated user’s inbounds. Returns only id, remark, protocol, port, and a server-computed tlsFlowCapable flag (true for VLESS / port-fallback on TCP with tls or reality). Use this for dropdowns and attach pickers — it skips settings, streamSettings, and clientStats so the payload stays small even on panels with thousands of clients.", + "operationId": "get_panel_api_inbounds_options", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "remark": "VLESS-443", + "protocol": "vless", + "port": 443, + "tlsFlowCapable": true + } + ] + } + } + } + } + } + } + }, + "/panel/api/inbounds/get/{id}": { + "get": { + "tags": [ + "Inbounds" + ], + "summary": "Fetch a single inbound by numeric ID.", + "operationId": "get_panel_api_inbounds_get_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Inbound 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/inbounds/add": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Create a new inbound. Send the full inbound payload (protocol, port, settings, streamSettings, sniffing, remark, expiryTime, total, enable). settings, streamSettings, and sniffing may be sent as nested JSON objects (preferred) or as JSON-encoded strings (legacy).", + "operationId": "post_panel_api_inbounds_add", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "enable": true, + "remark": "VLESS-443", + "listen": "", + "port": 443, + "protocol": "vless", + "expiryTime": 0, + "total": 0, + "settings": { + "clients": [ + { + "id": "...", + "email": "user1" + } + ], + "decryption": "none", + "fallbacks": [] + }, + "streamSettings": { + "network": "tcp", + "security": "reality", + "realitySettings": { + "show": false, + "dest": "..." + } + }, + "sniffing": { + "enabled": true, + "destOverride": [ + "http", + "tls" + ] + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + } + } + }, + "example": { + "success": false, + "msg": "Port 443 is already in use" + } + } + } + } + } + } + }, + "/panel/api/inbounds/del/{id}": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Delete an inbound by ID. Also removes its associated client stats rows.", + "operationId": "post_panel_api_inbounds_del_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Inbound 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/inbounds/update/{id}": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Replace an inbound’s configuration. Body shape mirrors /add. Heavy on inbounds with thousands of clients — prefer /setEnable for enable-only flips.", + "operationId": "post_panel_api_inbounds_update_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Inbound 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/inbounds/setEnable/{id}": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Toggle only the enable flag without serialising the whole settings JSON. Recommended for UI switches on large inbounds.", + "operationId": "post_panel_api_inbounds_setEnable_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Inbound ID.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "enable": false + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/inbounds/{id}/resetTraffic": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Zero out upload + download counters for a single inbound. Does not touch per-client counters.", + "operationId": "post_panel_api_inbounds_id_resetTraffic", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Inbound 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/inbounds/resetAllTraffics": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Reset upload + download counters on every inbound. Destructive — accounting history is lost.", + "operationId": "post_panel_api_inbounds_resetAllTraffics", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/inbounds/import": { + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Bulk-import an inbound from a JSON blob (e.g. one exported via the UI). The body uses form encoding with a single \"data\" field.", + "operationId": "post_panel_api_inbounds_import", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/inbounds/{id}/fallbacks": { + "get": { + "tags": [ + "Inbounds" + ], + "summary": "List the fallback rules attached to a master VLESS/Trojan TCP-TLS inbound. Each rule links one child inbound (the dest) to optional SNI/ALPN/path/xver match criteria.", + "operationId": "get_panel_api_inbounds_id_fallbacks", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Master inbound ID.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "masterId": 10, + "childId": 11, + "name": "", + "alpn": "", + "path": "/vlws", + "xver": 2, + "sortOrder": 0 + } + ] + } + } + } + } + } + }, + "post": { + "tags": [ + "Inbounds" + ], + "summary": "Replace the entire fallback list for a master inbound. Body is JSON. Triggers an Xray restart.", + "operationId": "post_panel_api_inbounds_id_fallbacks", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Master inbound ID.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "fallbacks": [ + { + "childId": 11, + "path": "/vlws", + "xver": 2 + }, + { + "childId": 12, + "alpn": "h2" + } + ] + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "msg": "Inbound updated" + } + } + } + } + } + } + }, + "/panel/api/server/status": { + "get": { + "tags": [ + "Server" + ], + "summary": "Real-time machine snapshot: CPU, memory, swap, disk, network IO, load averages, open connections, Xray state. Cached and refreshed every 2 seconds in the background.", + "operationId": "get_panel_api_server_status", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "cpu": 12.5, + "mem": { + "current": 2147483648, + "total": 8589934592 + }, + "swap": { + "current": 0, + "total": 4294967296 + }, + "disk": { + "current": 53687091200, + "total": 268435456000 + }, + "netIO": { + "up": 1073741824, + "down": 2147483648 + }, + "xray": { + "state": "running", + "version": "v25.10.31" + }, + "tcpCount": 42, + "load": { + "load1": 0.5, + "load5": 0.3, + "load15": 0.2 + } + } + } + } + } + } + } + } + }, + "/panel/api/server/cpuHistory/{bucket}": { + "get": { + "tags": [ + "Server" + ], + "summary": "Legacy: aggregated CPU history. Use /history/cpu/:bucket instead — same data with a uniform {t, v} shape.", + "operationId": "get_panel_api_server_cpuHistory_bucket", + "parameters": [ + { + "name": "bucket", + "in": "path", + "required": true, + "description": "Bucket size in seconds. Allowed: 2, 30, 60, 120, 180, 300.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/history/{metric}/{bucket}": { + "get": { + "tags": [ + "Server" + ], + "summary": "Aggregated time-series for one metric. Returns an array of {t, v} samples covering the last ~6 hours.", + "operationId": "get_panel_api_server_history_metric_bucket", + "parameters": [ + { + "name": "metric", + "in": "path", + "required": true, + "description": "cpu | mem | netUp | netDown | online | load1 | load5 | load15.", + "schema": { + "type": "string" + } + }, + { + "name": "bucket", + "in": "path", + "required": true, + "description": "Bucket size in seconds. Allowed: 2, 30, 60, 120, 180, 300.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "t": 1700000000, + "v": 12.5 + }, + { + "t": 1700000002, + "v": 13.1 + } + ] + } + } + } + } + } + } + }, + "/panel/api/server/xrayMetricsState": { + "get": { + "tags": [ + "Server" + ], + "summary": "Xray runtime metrics state — whether the xray config has a `metrics` block, which expvar keys are flowing, and the current snapshot values for each. Returns an empty state when metrics are not configured.", + "operationId": "get_panel_api_server_xrayMetricsState", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/xrayMetricsHistory/{metric}/{bucket}": { + "get": { + "tags": [ + "Server" + ], + "summary": "Time-series history for one Xray runtime metric over the last ~6 hours. Same {t, v} shape as /history/:metric/:bucket.", + "operationId": "get_panel_api_server_xrayMetricsHistory_metric_bucket", + "parameters": [ + { + "name": "metric", + "in": "path", + "required": true, + "description": "xrAlloc | xrSys | xrHeapObjects | xrNumGC | xrPauseNs.", + "schema": { + "type": "string" + } + }, + { + "name": "bucket", + "in": "path", + "required": true, + "description": "Bucket size in seconds. Allowed: 2, 30, 60, 120, 180, 300.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/xrayObservatory": { + "get": { + "tags": [ + "Server" + ], + "summary": "Latest snapshot from the Xray observatory — per-outbound latency, health status, and last-probe time. Only populated when the Xray config has an observatory configured.", + "operationId": "get_panel_api_server_xrayObservatory", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/xrayObservatoryHistory/{tag}/{bucket}": { + "get": { + "tags": [ + "Server" + ], + "summary": "Time-series of observatory probe results for one outbound tag. Same {t, v} shape as the other history endpoints.", + "operationId": "get_panel_api_server_xrayObservatoryHistory_tag_bucket", + "parameters": [ + { + "name": "tag", + "in": "path", + "required": true, + "description": "Outbound tag from the observatory config.", + "schema": { + "type": "string" + } + }, + { + "name": "bucket", + "in": "path", + "required": true, + "description": "Bucket size in seconds. Allowed: 2, 30, 60, 120, 180, 300.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/getXrayVersion": { + "get": { + "tags": [ + "Server" + ], + "summary": "List Xray binary versions available for install on this host.", + "operationId": "get_panel_api_server_getXrayVersion", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + "v25.10.31", + "v25.9.15", + "v25.8.1" + ] + } + } + } + } + } + } + }, + "/panel/api/server/getPanelUpdateInfo": { + "get": { + "tags": [ + "Server" + ], + "summary": "Check whether a newer 3x-ui release is available on GitHub.", + "operationId": "get_panel_api_server_getPanelUpdateInfo", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/getConfigJson": { + "get": { + "tags": [ + "Server" + ], + "summary": "Return the assembled Xray config that’s currently running on this host.", + "operationId": "get_panel_api_server_getConfigJson", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/getDb": { + "get": { + "tags": [ + "Server" + ], + "summary": "Stream the SQLite database file as an attachment. Use as a manual backup.", + "operationId": "get_panel_api_server_getDb", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/getNewUUID": { + "get": { + "tags": [ + "Server" + ], + "summary": "Generate a fresh UUID v4. Convenience helper for client IDs.", + "operationId": "get_panel_api_server_getNewUUID", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": "550e8400-e29b-41d4-a716-446655440000" + } + } + } + } + } + } + }, + "/panel/api/server/getNewX25519Cert": { + "get": { + "tags": [ + "Server" + ], + "summary": "Generate a new X25519 keypair for Reality.", + "operationId": "get_panel_api_server_getNewX25519Cert", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "privateKey": "uN9qLfV3zH8w...", + "publicKey": "5v8xPqR2sM7k..." + } + } + } + } + } + } + } + }, + "/panel/api/server/getNewmldsa65": { + "get": { + "tags": [ + "Server" + ], + "summary": "Generate a new ML-DSA-65 keypair (post-quantum signature). Returns {privateKey, publicKey, seed}.", + "operationId": "get_panel_api_server_getNewmldsa65", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "privateKey": "mdsa65priv...", + "publicKey": "mdsa65pub...", + "seed": "random-seed..." + } + } + } + } + } + } + } + }, + "/panel/api/server/getNewmlkem768": { + "get": { + "tags": [ + "Server" + ], + "summary": "Generate a new ML-KEM-768 keypair (post-quantum KEM). Returns {clientKey, serverKey}.", + "operationId": "get_panel_api_server_getNewmlkem768", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "clientKey": "mlkem768-client...", + "serverKey": "mlkem768-server..." + } + } + } + } + } + } + } + }, + "/panel/api/server/getNewVlessEnc": { + "get": { + "tags": [ + "Server" + ], + "summary": "Generate VLESS encryption auth options. Returns an auths array each with id, label, encryption, and decryption fields.", + "operationId": "get_panel_api_server_getNewVlessEnc", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "auths": [ + { + "id": 0, + "label": "Auth #0", + "encryption": "aes-256-gcm", + "decryption": "" + } + ] + } + } + } + } + } + } + } + }, + "/panel/api/server/stopXrayService": { + "post": { + "tags": [ + "Server" + ], + "summary": "Stop the Xray binary. All proxies go offline immediately.", + "operationId": "post_panel_api_server_stopXrayService", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + } + } + }, + "example": { + "success": false, + "msg": "Xray is not running" + } + } + } + } + } + } + }, + "/panel/api/server/restartXrayService": { + "post": { + "tags": [ + "Server" + ], + "summary": "Reload Xray with the current config. Typically required after structural inbound or routing changes.", + "operationId": "post_panel_api_server_restartXrayService", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + } + } + }, + "example": { + "success": false, + "msg": "Xray config is invalid: ..." + } + } + } + } + } + } + }, + "/panel/api/server/installXray/{version}": { + "post": { + "tags": [ + "Server" + ], + "summary": "Download and install the specified Xray version. Pass \"latest\" for the newest release.", + "operationId": "post_panel_api_server_installXray_version", + "parameters": [ + { + "name": "version", + "in": "path", + "required": true, + "description": "Xray tag (e.g. v25.10.31) or \"latest\".", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/updatePanel": { + "post": { + "tags": [ + "Server" + ], + "summary": "Self-update the panel to the latest version. The server restarts on success.", + "operationId": "post_panel_api_server_updatePanel", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/updateGeofile": { + "post": { + "tags": [ + "Server" + ], + "summary": "Refresh the default GeoIP / GeoSite data files. Body can include a fileName, or use the /:fileName variant.", + "operationId": "post_panel_api_server_updateGeofile", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/updateGeofile/{fileName}": { + "post": { + "tags": [ + "Server" + ], + "summary": "Refresh a single Geo file by filename (e.g. geoip.dat, geosite.dat).", + "operationId": "post_panel_api_server_updateGeofile_fileName", + "parameters": [ + { + "name": "fileName", + "in": "path", + "required": true, + "description": "Filename of the data file to refresh.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/logs/{count}": { + "post": { + "tags": [ + "Server" + ], + "summary": "Return the last N lines of the panel’s own log.", + "operationId": "post_panel_api_server_logs_count", + "parameters": [ + { + "name": "count", + "in": "path", + "required": true, + "description": "Number of trailing log lines.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "level": "info", + "syslog": false + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": "2025/01/01 12:00:00 [INFO] Server started\n2025/01/01 12:00:01 [INFO] Xray is running" + } + } + } + } + } + } + }, + "/panel/api/server/xraylogs/{count}": { + "post": { + "tags": [ + "Server" + ], + "summary": "Return the last N lines of the Xray process log.", + "operationId": "post_panel_api_server_xraylogs_count", + "parameters": [ + { + "name": "count", + "in": "path", + "required": true, + "description": "Number of trailing log lines.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": "2025/01/01 12:00:00 rejected vless proxy example.com reason: no valid user\n2025/01/01 12:00:01 direct freedom ok" + } + } + } + } + } + } + }, + "/panel/api/server/importDB": { + "post": { + "tags": [ + "Server" + ], + "summary": "Restore the panel DB from an uploaded SQLite file (multipart form, field name \"db\"). The panel restarts after restore. Destructive.", + "operationId": "post_panel_api_server_importDB", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/server/getNewEchCert": { + "post": { + "tags": [ + "Server" + ], + "summary": "Generate a new ECH (Encrypted Client Hello) keypair and config list for the given SNI.", + "operationId": "post_panel_api_server_getNewEchCert", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/clients/list": { + "get": { + "tags": [ + "Clients" + ], + "summary": "List every client with its attached inbound IDs and traffic record. The reverse field, if set, is returned as a nested JSON object (legacy JSON-encoded-string form is still accepted on write).", + "operationId": "get_panel_api_clients_list", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "email": "alice@example.com", + "subId": "abcd1234", + "uuid": "...", + "totalGB": 53687091200, + "expiryTime": 1735689600000, + "enable": true, + "reverse": null, + "inboundIds": [ + 3, + 5 + ], + "traffic": { + "up": 1024, + "down": 4096, + "enable": true + } + } + ] + } + } + } + } + } + } + }, + "/panel/api/clients/list/paged": { + "get": { + "tags": [ + "Clients" + ], + "summary": "Filter, sort, and paginate clients on the server. Each item is a slim row (no uuid/password/auth/flow/security/reverse/tgId) so the clients page can ship 25-ish rows in a few KB instead of the full table. The response also includes a summary computed across the full DB row set so dashboard counters stay stable as the user paginates or filters. Page size capped at 200; fetch /get/:email to obtain the full per-client payload for an edit/info modal.", + "operationId": "get_panel_api_clients_list_paged", + "parameters": [ + { + "name": "page", + "in": "query", + "required": true, + "description": "1-indexed page number. Defaults to 1.", + "schema": { + "type": "integer" + } + }, + { + "name": "pageSize", + "in": "query", + "required": true, + "description": "Rows per page. Defaults to 25, capped at 200.", + "schema": { + "type": "integer" + } + }, + { + "name": "search", + "in": "query", + "required": true, + "description": "Case-insensitive substring match on email / subId / comment.", + "schema": { + "type": "string" + } + }, + { + "name": "filter", + "in": "query", + "required": true, + "description": "Status bucket: online | active | deactive | depleted | expiring.", + "schema": { + "type": "string" + } + }, + { + "name": "protocol", + "in": "query", + "required": true, + "description": "Match clients attached to at least one inbound of this protocol (vless, vmess, trojan, shadowsocks, ...).", + "schema": { + "type": "string" + } + }, + { + "name": "sort", + "in": "query", + "required": true, + "description": "Sort key: enable | email | inboundIds | traffic | remaining | expiryTime.", + "schema": { + "type": "string" + } + }, + { + "name": "order", + "in": "query", + "required": true, + "description": "ascend or descend.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "items": [ + { + "email": "alice@example.com", + "subId": "abcd1234", + "enable": true, + "totalGB": 53687091200, + "expiryTime": 1735689600000, + "limitIp": 0, + "reset": 0, + "inboundIds": [ + 3, + 5 + ], + "traffic": { + "up": 1024, + "down": 4096, + "enable": true + }, + "createdAt": 1735000000000, + "updatedAt": 1735100000000 + } + ], + "total": 2000, + "filtered": 47, + "page": 1, + "pageSize": 25, + "summary": { + "total": 2000, + "active": 1850, + "online": [ + "alice@example.com" + ], + "depleted": [], + "expiring": [], + "deactive": [] + } + } + } + } + } + } + } + } + }, + "/panel/api/clients/get/{email}": { + "get": { + "tags": [ + "Clients" + ], + "summary": "Fetch one client by email, including the inbound IDs it is attached to.", + "operationId": "get_panel_api_clients_get_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email (unique identifier).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/clients/add": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Create a new client and attach it to one or more inbounds in a single call. Body is JSON. Per-protocol secrets (UUID for VLESS/VMess, password for Trojan/Shadowsocks, auth for Hysteria) are generated server-side when omitted, so callers can send only the universal fields.", + "operationId": "post_panel_api_clients_add", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "client": { + "email": "alice@example.com", + "totalGB": 53687091200, + "expiryTime": 1735689600000, + "tgId": 0, + "limitIp": 0, + "enable": true + }, + "inboundIds": [ + 3, + 5 + ] + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "msg": "Client added" + } + } + } + } + } + } + }, + "/panel/api/clients/update/{email}": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Update an existing client by email. Changes propagate to every attached inbound. Body is the JSON client payload — supply the full set of fields you want to keep (the server replaces the row, it does not patch).", + "operationId": "post_panel_api_clients_update_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Current client email (unique identifier).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "email": "alice@example.com", + "totalGB": 107374182400, + "expiryTime": 1767225600000, + "tgId": 123456789, + "enable": true + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "msg": "Client updated" + } + } + } + } + } + } + }, + "/panel/api/clients/del/{email}": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Delete a client by email. Removes it from every attached inbound and drops its traffic record unless keepTraffic=1 is passed.", + "operationId": "post_panel_api_clients_del_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email (unique identifier).", + "schema": { + "type": "string" + } + }, + { + "name": "keepTraffic", + "in": "query", + "required": true, + "description": "Pass 1 to retain the xray_client_traffic row after deletion.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "msg": "Client deleted" + } + } + } + } + } + } + }, + "/panel/api/clients/{email}/attach": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Attach an existing client to one or more additional inbounds. Body is JSON.", + "operationId": "post_panel_api_clients_email_attach", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email (unique identifier).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "inboundIds": [ + 7, + 9 + ] + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true + } + } + } + } + } + } + }, + "/panel/api/clients/{email}/detach": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Detach a client from one or more inbounds without deleting the client.", + "operationId": "post_panel_api_clients_email_detach", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email (unique identifier).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "inboundIds": [ + 5 + ] + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true + } + } + } + } + } + } + }, + "/panel/api/clients/resetAllTraffics": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Reset the up/down counters for every client globally. Quotas and expiry are not affected. Triggers an Xray restart if any counter actually moved.", + "operationId": "post_panel_api_clients_resetAllTraffics", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true + } + } + } + } + } + } + }, + "/panel/api/clients/delDepleted": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Delete every client whose traffic quota is exhausted (used >= total, when reset is disabled) or whose expiry has passed. Returns the deleted count and triggers an Xray restart when any client was on a running inbound.", + "operationId": "post_panel_api_clients_delDepleted", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "deleted": 0 + } + } + } + } + } + } + } + }, + "/panel/api/clients/bulkAdjust": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Shift expiry and/or traffic quota for many clients in one call. addDays/addBytes may be negative. Clients with unlimited expiry (expiryTime=0) or unlimited traffic (totalGB=0) are skipped for the corresponding field — bulk extend never converts unlimited to limited. Returns the adjusted count and per-email skip reasons.", + "operationId": "post_panel_api_clients_bulkAdjust", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "emails": [ + "alice", + "bob" + ], + "addDays": 30, + "addBytes": 53687091200 + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "adjusted": 2, + "skipped": [ + { + "email": "carol", + "reason": "unlimited expiry" + } + ] + } + } + } + } + } + } + } + }, + "/panel/api/clients/resetTraffic/{email}": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Zero out a single client’s up/down counters. Re-enables the client across every attached inbound and pushes the change to Xray (or the remote node) so depleted users can connect again immediately.", + "operationId": "post_panel_api_clients_resetTraffic_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/clients/updateTraffic/{email}": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Manually adjust a client’s upload + download counters. Useful for migrations from external accounting systems.", + "operationId": "post_panel_api_clients_updateTraffic_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "upload": 1073741824, + "download": 5368709120 + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/clients/ips/{email}": { + "post": { + "tags": [ + "Clients" + ], + "summary": "List source IPs that have connected with the given client’s credentials. Returns an array of \"ip (timestamp)\" strings.", + "operationId": "post_panel_api_clients_ips_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/clients/clearIps/{email}": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Reset the recorded IP list for a client.", + "operationId": "post_panel_api_clients_clearIps_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/clients/onlines": { + "post": { + "tags": [ + "Clients" + ], + "summary": "List the emails of currently connected clients (last seen within the heartbeat window).", + "operationId": "post_panel_api_clients_onlines", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + "user1", + "user2" + ] + } + } + } + } + } + } + }, + "/panel/api/clients/lastOnline": { + "post": { + "tags": [ + "Clients" + ], + "summary": "Map of client email → last-seen unix timestamp.", + "operationId": "post_panel_api_clients_lastOnline", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "user1": 1700000000, + "user2": 1699999000 + } + } + } + } + } + } + } + }, + "/panel/api/clients/traffic/{email}": { + "get": { + "tags": [ + "Clients" + ], + "summary": "Traffic counters for a client identified by email.", + "operationId": "get_panel_api_clients_traffic_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email (unique across the panel).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "email": "user1", + "up": 1048576, + "down": 2097152, + "total": 10737418240, + "expiryTime": 1735689600000 + } + } + } + } + } + } + } + }, + "/panel/api/clients/subLinks/{subId}": { + "get": { + "tags": [ + "Clients" + ], + "summary": "Return every protocol URL (vless://, vmess://, trojan://, ss://, hysteria://, hy2://) for clients matching the subscription ID. Same result set as /sub/, but as a JSON array — no base64. When an inbound has streamSettings.externalProxy set, one URL is emitted per external proxy. Empty array when the subId has no enabled clients.", + "operationId": "get_panel_api_clients_subLinks_subId", + "parameters": [ + { + "name": "subId", + "in": "path", + "required": true, + "description": "Subscription ID, taken from the client's subId field.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + "vless://uuid@host:443?security=reality&...#user1", + "vmess://eyJ2IjoyLC..." + ] + } + } + } + } + } + } + }, + "/panel/api/clients/links/{email}": { + "get": { + "tags": [ + "Clients" + ], + "summary": "Return every URL for one client across all attached inbounds — the same strings the Copy URL button copies in the panel UI. Supported protocols: vmess, vless, trojan, shadowsocks, hysteria, hysteria2. If streamSettings.externalProxy is set, returns one URL per external proxy. Protocols without a URL form (socks, http, mixed, wireguard, dokodemo, tunnel) contribute nothing.", + "operationId": "get_panel_api_clients_links_email", + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "description": "Client email (unique identifier).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + "vless://uuid@host:443?...#user1" + ] + } + } + } + } + } + } + }, + "/panel/api/nodes/list": { + "get": { + "tags": [ + "Nodes" + ], + "summary": "List every configured node with its connection details, health, and last heartbeat patch.", + "operationId": "get_panel_api_nodes_list", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "name": "de-fra-1", + "remark": "", + "scheme": "https", + "address": "node1.example.com", + "port": 2053, + "basePath": "/", + "apiToken": "abcdef...", + "enable": true, + "allowPrivateAddress": false, + "status": "online", + "lastHeartbeat": 1700000000, + "latencyMs": 42, + "xrayVersion": "25.x.x", + "panelVersion": "v3.x.x", + "cpuPct": 23.5, + "memPct": 45.1, + "uptimeSecs": 86400, + "lastError": "", + "inboundCount": 5, + "clientCount": 27, + "onlineCount": 3, + "depletedCount": 1, + "createdAt": 1700000000, + "updatedAt": 1700000000 + } + ] + } + } + } + } + } + } + }, + "/panel/api/nodes/get/{id}": { + "get": { + "tags": [ + "Nodes" + ], + "summary": "Fetch a single node by ID.", + "operationId": "get_panel_api_nodes_get_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Node 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/nodes/add": { + "post": { + "tags": [ + "Nodes" + ], + "summary": "Register a new remote node. Provide its URL, apiToken, and optional remark / allowPrivateAddress flag.", + "operationId": "post_panel_api_nodes_add", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "name": "de-fra-1", + "remark": "", + "scheme": "https", + "address": "node1.example.com", + "port": 2053, + "basePath": "/", + "apiToken": "abcdef...", + "enable": true, + "allowPrivateAddress": false + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/nodes/update/{id}": { + "post": { + "tags": [ + "Nodes" + ], + "summary": "Replace a node’s connection details. Same body shape as /add.", + "operationId": "post_panel_api_nodes_update_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Node ID.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "name": "de-fra-1", + "remark": "", + "scheme": "https", + "address": "node1.example.com", + "port": 2053, + "basePath": "/", + "apiToken": "abcdef...", + "enable": true, + "allowPrivateAddress": false + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/nodes/del/{id}": { + "post": { + "tags": [ + "Nodes" + ], + "summary": "Delete a node. Inbounds bound to it are not auto-migrated.", + "operationId": "post_panel_api_nodes_del_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Node 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/nodes/setEnable/{id}": { + "post": { + "tags": [ + "Nodes" + ], + "summary": "Pause or resume traffic sync with this node.", + "operationId": "post_panel_api_nodes_setEnable_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Node ID.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "enable": true + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/api/nodes/test": { + "post": { + "tags": [ + "Nodes" + ], + "summary": "Probe a node without saving it. Uses the body as connection details and returns the same heartbeat snapshot a registered node would have.", + "operationId": "post_panel_api_nodes_test", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + }, + "example": { + "scheme": "https", + "address": "node1.example.com", + "port": 2053, + "basePath": "/", + "apiToken": "abcdef..." + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "status": "online", + "latencyMs": 42, + "xrayVersion": "25.x.x", + "panelVersion": "v3.x.x", + "cpuPct": 12.5, + "memPct": 45.2, + "uptimeSecs": 86400, + "error": "" + } + } + } + } + } + } + } + }, + "/panel/api/nodes/probe/{id}": { + "post": { + "tags": [ + "Nodes" + ], + "summary": "Probe an existing node, updating its cached health state.", + "operationId": "post_panel_api_nodes_probe_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Node 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/nodes/history/{id}/{metric}/{bucket}": { + "get": { + "tags": [ + "Nodes" + ], + "summary": "Aggregated metric history for a node — same shape as /server/history, scoped to one node.", + "operationId": "get_panel_api_nodes_history_id_metric_bucket", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Node ID.", + "schema": { + "type": "integer" + } + }, + { + "name": "metric", + "in": "path", + "required": true, + "description": "cpu | mem.", + "schema": { + "type": "string" + } + }, + { + "name": "bucket", + "in": "path", + "required": true, + "description": "Bucket size in seconds. Allowed: 2, 30, 60, 120, 180, 300.", + "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/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": [ + "Backup" + ], + "summary": "Send a fresh DB backup to every Telegram chat configured as an admin recipient. No body, no params.", + "operationId": "post_panel_api_backuptotgbot", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/all": { + "post": { + "tags": [ + "Settings" + ], + "summary": "Return every panel setting: web server, Telegram bot, subscription, security, LDAP. The full JSON blob that the Settings page edits.", + "operationId": "post_panel_setting_all", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/defaultSettings": { + "post": { + "tags": [ + "Settings" + ], + "summary": "Return the computed default settings based on the request host. Useful to preview what a fresh install would use.", + "operationId": "post_panel_setting_defaultSettings", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/update": { + "post": { + "tags": [ + "Settings" + ], + "summary": "Persist every setting at once. The body mirrors the shape returned by /all. Invalid values (bad ports, missing cert pairs, etc.) are rejected before write.", + "operationId": "post_panel_setting_update", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/updateUser": { + "post": { + "tags": [ + "Settings" + ], + "summary": "Change the panel admin username and password. Requires the current credentials for verification. The session is refreshed with the new values on success.", + "operationId": "post_panel_setting_updateUser", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "oldUsername": { + "type": "string", + "description": "Current admin username." + }, + "oldPassword": { + "type": "string", + "description": "Current admin password." + }, + "newUsername": { + "type": "string", + "description": "Desired new username." + }, + "newPassword": { + "type": "string", + "description": "Desired new password." + } + }, + "required": [ + "oldUsername", + "oldPassword", + "newUsername", + "newPassword" + ] + }, + "example": { + "oldUsername": "admin", + "oldPassword": "admin", + "newUsername": "newadmin", + "newPassword": "newpass" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/restartPanel": { + "post": { + "tags": [ + "Settings" + ], + "summary": "Restart the entire 3x-ui process after a 3-second grace period. The connection drops immediately; the panel comes back online ~5-10 seconds later.", + "operationId": "post_panel_setting_restartPanel", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/getDefaultJsonConfig": { + "get": { + "tags": [ + "Settings" + ], + "summary": "Return the built-in default Xray JSON config template that ships with this panel version.", + "operationId": "get_panel_setting_getDefaultJsonConfig", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/setting/apiTokens": { + "get": { + "tags": [ + "API Tokens" + ], + "summary": "List every API token, enabled or not.", + "operationId": "get_panel_setting_apiTokens", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": [ + { + "id": 1, + "name": "default", + "token": "abcdef-12345-...", + "enabled": true, + "createdAt": 1736000000 + } + ] + } + } + } + } + } + } + }, + "/panel/setting/apiTokens/create": { + "post": { + "tags": [ + "API Tokens" + ], + "summary": "Mint a new API token. Name must be unique and 1-64 characters; the token string is server-generated.", + "operationId": "post_panel_setting_apiTokens_create", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Human-readable label, e.g. \"central-panel-a\"." + } + }, + "required": [ + "name" + ] + }, + "example": { + "name": "central-panel-a" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "id": 2, + "name": "central-panel-a", + "token": "new-token-string", + "enabled": true, + "createdAt": 1736000000 + } + } + } + } + }, + "400": { + "description": "Error response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + } + } + }, + "example": { + "success": false, + "msg": "a token with that name already exists" + } + } + } + } + } + } + }, + "/panel/setting/apiTokens/delete/{id}": { + "post": { + "tags": [ + "API Tokens" + ], + "summary": "Permanently delete a token. Any caller using it stops authenticating immediately.", + "operationId": "post_panel_setting_apiTokens_delete_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Token row ID.", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true + } + } + } + } + } + } + }, + "/panel/setting/apiTokens/setEnabled/{id}": { + "post": { + "tags": [ + "API Tokens" + ], + "summary": "Toggle a token enabled/disabled without deleting it. Disabled tokens are rejected by checkAPIAuth on the next request.", + "operationId": "post_panel_setting_apiTokens_setEnabled_id", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "Token row ID.", + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "description": "New enabled state." + } + }, + "required": [ + "enabled" + ] + }, + "example": { + "enabled": false + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true + } + } + } + } + } + } + }, + "/panel/xray/": { + "post": { + "tags": [ + "Xray Settings" + ], + "summary": "Return the Xray config template (JSON string), available inbound tags, client reverse tags, and the configured outbound test URL in one response.", + "operationId": "post_panel_xray", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "success": true, + "obj": { + "xraySetting": "{...raw xray config...}", + "inboundTags": "[\"inbound-443\"]", + "clientReverseTags": "[]", + "outboundTestUrl": "https://www.google.com/generate_204" + } + } + } + } + } + } + } + }, + "/panel/xray/getDefaultJsonConfig": { + "get": { + "tags": [ + "Xray Settings" + ], + "summary": "Return the built-in default Xray config shipped with the panel (identical to /panel/setting/getDefaultJsonConfig).", + "operationId": "get_panel_xray_getDefaultJsonConfig", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/getOutboundsTraffic": { + "get": { + "tags": [ + "Xray Settings" + ], + "summary": "Return traffic statistics for every outbound. Each outbound shows up/down/total counters.", + "operationId": "get_panel_xray_getOutboundsTraffic", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/getXrayResult": { + "get": { + "tags": [ + "Xray Settings" + ], + "summary": "Return the most recent Xray process stdout/stderr output. Useful to check for startup errors or runtime warnings.", + "operationId": "get_panel_xray_getXrayResult", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/update": { + "post": { + "tags": [ + "Xray Settings" + ], + "summary": "Save the Xray JSON config template and optionally the outbound test URL. Both are sent as form fields.", + "operationId": "post_panel_xray_update", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/warp/{action}": { + "post": { + "tags": [ + "Xray Settings" + ], + "summary": "Manage Cloudflare Warp integration. The action parameter selects the operation.", + "operationId": "post_panel_xray_warp_action", + "parameters": [ + { + "name": "action", + "in": "path", + "required": true, + "description": "data — return Warp stats (quota, remaining). del — delete Warp data. config — return current Warp config. reg — register a new Warp endpoint (sends privateKey, publicKey). license — set a Warp+ license key (sends license).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/nord/{action}": { + "post": { + "tags": [ + "Xray Settings" + ], + "summary": "Manage NordVPN integration. The action parameter selects the operation.", + "operationId": "post_panel_xray_nord_action", + "parameters": [ + { + "name": "action", + "in": "path", + "required": true, + "description": "countries — list available countries. servers — list servers in a country (sends countryId). reg — get NordVPN credentials (sends token). setKey — store NordVPN API key (sends key). data — return current NordVPN connection data. del — delete NordVPN data.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/resetOutboundsTraffic": { + "post": { + "tags": [ + "Xray Settings" + ], + "summary": "Reset traffic counters for a specific outbound by tag.", + "operationId": "post_panel_xray_resetOutboundsTraffic", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/panel/xray/testOutbound": { + "post": { + "tags": [ + "Xray Settings" + ], + "summary": "Test an outbound configuration. Sends the outbound JSON (required), optionally all outbounds (to resolve sockopt.dialerProxy dependencies), and a mode flag.", + "operationId": "post_panel_xray_testOutbound", + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/{subPath}{subid}": { + "get": { + "tags": [ + "Subscription Server" + ], + "summary": "Return base64-encoded subscription links for all enabled clients matching the subscription ID. When the request has an Accept: text/html header or ?html=1, renders a styled info page instead. Default path: /sub/:subid.", + "operationId": "get_subPath_subid", + "parameters": [ + { + "name": "subid", + "in": "path", + "required": true, + "description": "Client subscription ID.", + "schema": { + "type": "string" + } + }, + { + "name": "subPath", + "in": "path", + "required": true, + "description": "", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/{jsonPath}{subid}": { + "get": { + "tags": [ + "Subscription Server" + ], + "summary": "Return subscription as a JSON array of proxy configs (one per enabled client). Only when JSON subscription is enabled in settings. Default path: /json/:subid.", + "operationId": "get_jsonPath_subid", + "parameters": [ + { + "name": "subid", + "in": "path", + "required": true, + "description": "Client subscription ID.", + "schema": { + "type": "string" + } + }, + { + "name": "jsonPath", + "in": "path", + "required": true, + "description": "", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/{clashPath}{subid}": { + "get": { + "tags": [ + "Subscription Server" + ], + "summary": "Return subscription as a Clash/Mihomo-compatible YAML config. Only when Clash subscription is enabled in settings. Default path: /clash/:subid.", + "operationId": "get_clashPath_subid", + "parameters": [ + { + "name": "subid", + "in": "path", + "required": true, + "description": "Client subscription ID.", + "schema": { + "type": "string" + } + }, + { + "name": "clashPath", + "in": "path", + "required": true, + "description": "", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "/ws": { + "get": { + "tags": [ + "WebSocket" + ], + "summary": "Upgrade an HTTP connection to a WebSocket. Requires an authenticated session cookie (Bearer token auth is not supported here). Returns 101 Switching Protocols on success. The server then pushes JSON messages described below.", + "operationId": "get_ws", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + } + } + } + } + } + } + }, + "→ type: status": { + "ws": { + "tags": [ + "WebSocket" + ], + "summary": "Server health snapshot pushed every 2 seconds. Contains CPU, memory, swap, disk, network IO, load, and Xray state — same shape as GET /panel/api/server/status.", + "operationId": "ws_type_status", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "type": "status", + "data": { + "cpu": 12.5, + "mem": { + "current": 2147483648, + "total": 8589934592 + }, + "xray": { + "state": "running" + } + } + } + } + } + } + } + } + }, + "→ type: xrayState": { + "ws": { + "tags": [ + "WebSocket" + ], + "summary": "Xray process state change. Fired when Xray starts, stops, or encounters an error.", + "operationId": "ws_type_xrayState", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "type": "xrayState", + "data": "running" + } + } + } + } + } + } + }, + "→ type: notification": { + "ws": { + "tags": [ + "WebSocket" + ], + "summary": "In-panel toast notification. Fired on Xray stop/restart, DB import, panel restart, etc.", + "operationId": "ws_type_notification", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "type": "notification", + "title": "Xray service restarted", + "body": "Xray has been restarted successfully", + "severity": "success" + } + } + } + } + } + } + }, + "→ type: invalidate": { + "ws": { + "tags": [ + "WebSocket" + ], + "summary": "Instructs the UI to re-fetch a resource. Fired when another admin session modifies data (e.g. toggling inbound enable).", + "operationId": "ws_type_invalidate", + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "msg": { + "type": "string" + }, + "obj": {} + } + }, + "example": { + "type": "invalidate", + "resource": "inbounds" + } + } + } + } + } + } + } + } +} diff --git a/frontend/scripts/build-openapi.mjs b/frontend/scripts/build-openapi.mjs new file mode 100644 index 00000000..de64b86e --- /dev/null +++ b/frontend/scripts/build-openapi.mjs @@ -0,0 +1,218 @@ +#!/usr/bin/env node +import { writeFileSync } from 'node:fs'; +import { join, dirname } from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; + +import { sections } from '../src/pages/api-docs/endpoints.js'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const outPath = join(__dirname, '..', 'public', 'openapi.json'); + +const PANEL_VERSION = process.env.X_UI_VERSION || '3.x'; + +const SECURITY_SCHEMES = { + bearerAuth: { + type: 'http', + scheme: 'bearer', + description: 'API token from Settings → Security → API Token. Send as `Authorization: Bearer `.', + }, + cookieAuth: { + type: 'apiKey', + in: 'cookie', + name: '3x-ui', + description: 'Session cookie set by POST /login. Browser-only.', + }, +}; + +function ginPathToOpenApi(path) { + return path.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, '{$1}'); +} + +function extractPathParams(openApiPath) { + const params = []; + const re = /\{([A-Za-z_][A-Za-z0-9_]*)\}/g; + let m; + while ((m = re.exec(openApiPath)) !== null) params.push(m[1]); + return params; +} + +function mapType(t) { + const v = String(t || '').toLowerCase(); + if (v === 'number' || v === 'integer' || v === 'int') return 'integer'; + if (v === 'float' || v === 'double') return 'number'; + if (v === 'boolean' || v === 'bool') return 'boolean'; + if (v === 'array') return 'array'; + if (v === 'object') return 'object'; + return 'string'; +} + +function tryParseJson(raw) { + if (typeof raw !== 'string') return undefined; + try { + return JSON.parse(raw); + } catch { + return undefined; + } +} + +function paramToOpenApi(p) { + const out = { + name: p.name, + in: p.in, + required: p.in === 'path' ? true : !p.optional, + description: p.desc || '', + schema: { type: mapType(p.type) }, + }; + if (p.defaultValue !== undefined) out.schema.default = p.defaultValue; + return out; +} + +function buildOperation(ep, tag) { + const op = { + tags: [tag], + summary: ep.summary || '', + operationId: `${ep.method.toLowerCase()}_${ep.path.replace(/[^A-Za-z0-9]+/g, '_').replace(/^_|_$/g, '')}`, + }; + if (ep.description) op.description = ep.description; + if (ep.deprecated) op.deprecated = true; + + const params = []; + const bodyParams = []; + for (const p of ep.params || []) { + if (p.in === 'body') { + bodyParams.push(p); + } else if (p.in === 'path' || p.in === 'query' || p.in === 'header') { + params.push(paramToOpenApi(p)); + } + } + + const openApiPath = ginPathToOpenApi(ep.path); + const declared = new Set(params.filter((x) => x.in === 'path').map((x) => x.name)); + for (const name of extractPathParams(openApiPath)) { + if (declared.has(name)) continue; + params.push({ + name, + in: 'path', + required: true, + description: '', + schema: { type: 'string' }, + }); + } + + if (params.length > 0) op.parameters = params; + + if (ep.body || bodyParams.length > 0) { + const example = tryParseJson(ep.body); + const properties = {}; + const required = []; + for (const bp of bodyParams) { + properties[bp.name] = { + type: mapType(bp.type), + description: bp.desc || '', + }; + if (!bp.optional) required.push(bp.name); + } + const schema = bodyParams.length > 0 + ? { type: 'object', properties, ...(required.length > 0 ? { required } : {}) } + : { type: 'object' }; + + op.requestBody = { + required: required.length > 0 || bodyParams.length === 0, + content: { + 'application/json': { + schema, + ...(example !== undefined ? { example } : {}), + }, + }, + }; + } + + const responses = {}; + const successExample = tryParseJson(ep.response); + responses['200'] = { + description: 'Successful response', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + success: { type: 'boolean' }, + msg: { type: 'string' }, + obj: {}, + }, + }, + ...(successExample !== undefined ? { example: successExample } : {}), + }, + }, + }; + + const errExample = tryParseJson(ep.errorResponse); + if (errExample !== undefined || ep.errorStatus) { + const code = String(ep.errorStatus || 400); + responses[code] = { + description: 'Error response', + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + success: { type: 'boolean' }, + msg: { type: 'string' }, + }, + }, + ...(errExample !== undefined ? { example: errExample } : {}), + }, + }, + }; + } + + op.responses = responses; + return op; +} + +function buildSpec() { + const paths = {}; + for (const section of sections) { + const tag = section.title; + for (const ep of section.endpoints) { + const openApiPath = ginPathToOpenApi(ep.path); + if (!paths[openApiPath]) paths[openApiPath] = {}; + paths[openApiPath][ep.method.toLowerCase()] = buildOperation(ep, tag); + } + } + + const tags = sections.map((s) => ({ + name: s.title, + description: s.description || '', + })); + + return { + openapi: '3.0.3', + info: { + title: '3X-UI Panel API', + version: PANEL_VERSION, + description: + 'Programmatic interface to a 3X-UI panel. Authenticate either by logging in (cookie) or with an API token from Settings → Security → API Token (Bearer). All endpoints under /panel/api/* honour both modes.', + }, + servers: [ + { url: '/', description: 'Current panel (basePath aware)' }, + ], + components: { + securitySchemes: SECURITY_SCHEMES, + }, + security: [{ bearerAuth: [] }, { cookieAuth: [] }], + tags, + paths, + }; +} + +const spec = buildSpec(); +writeFileSync(outPath, JSON.stringify(spec, null, 2) + '\n'); + +const pathCount = Object.keys(spec.paths).length; +let opCount = 0; +for (const ops of Object.values(spec.paths)) opCount += Object.keys(ops).length; +console.log(`[openapi] wrote ${outPath}`); +console.log(`[openapi] paths: ${pathCount}, operations: ${opCount}, tags: ${spec.tags.length}`); + +void pathToFileURL; diff --git a/frontend/settings.html b/frontend/settings.html deleted file mode 100644 index e753ffe1..00000000 --- a/frontend/settings.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Settings - - -
-
- - - diff --git a/frontend/src/api/QueryProvider.tsx b/frontend/src/api/QueryProvider.tsx new file mode 100644 index 00000000..71fdc56f --- /dev/null +++ b/frontend/src/api/QueryProvider.tsx @@ -0,0 +1,16 @@ +import type { ReactNode } from 'react'; +import { QueryClientProvider } from '@tanstack/react-query'; +import { ReactQueryDevtools } from '@tanstack/react-query-devtools'; + +import { queryClient } from '@/queryClient'; + +export function QueryProvider({ children }: { children: ReactNode }) { + return ( + + {children} + {import.meta.env.DEV && ( + + )} + + ); +} diff --git a/frontend/src/api/queries/useAllSettings.ts b/frontend/src/api/queries/useAllSettings.ts new file mode 100644 index 00000000..cd2566d9 --- /dev/null +++ b/frontend/src/api/queries/useAllSettings.ts @@ -0,0 +1,67 @@ +import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; + +import { HttpUtil } from '@/utils'; +import { AllSetting } from '@/models/setting'; +import { keys } from '@/api/queryKeys'; + +interface ApiMsg { + success?: boolean; + obj?: T; + msg?: string; +} + +async function fetchAllSetting(): Promise { + const msg = await HttpUtil.post('/panel/setting/all', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch settings'); + return msg.obj; +} + +export function useAllSettings() { + const queryClient = useQueryClient(); + const [draft, setDraft] = useState(() => new AllSetting()); + const [extraSpinning, setExtraSpinning] = useState(false); + + const query = useQuery({ + queryKey: keys.settings.all(), + queryFn: fetchAllSetting, + staleTime: Infinity, + }); + + const server = useMemo(() => new AllSetting(query.data), [query.data]); + + useEffect(() => { + if (query.data !== undefined) { + setDraft(new AllSetting(query.data)); + } + }, [query.data]); + + const updateSetting = useCallback((patch: Partial) => { + setDraft((prev) => { + const next = new AllSetting(prev); + Object.assign(next, patch); + return next; + }); + }, []); + + const saveMut = useMutation({ + mutationFn: async (next: AllSetting) => + HttpUtil.post('/panel/setting/update', next) as Promise, + onSuccess: (msg) => { + if (msg?.success) queryClient.invalidateQueries({ queryKey: keys.settings.all() }); + }, + }); + + const saveAll = useCallback(() => saveMut.mutateAsync(draft), [saveMut, draft]); + const saveDisabled = useMemo(() => server.equals(draft), [server, draft]); + + return { + allSetting: draft, + updateSetting, + fetched: query.data !== undefined, + spinning: extraSpinning || saveMut.isPending, + setSpinning: setExtraSpinning, + saveDisabled, + saveAll, + }; +} diff --git a/frontend/src/api/queries/useNodeMutations.ts b/frontend/src/api/queries/useNodeMutations.ts new file mode 100644 index 00000000..2b9f707e --- /dev/null +++ b/frontend/src/api/queries/useNodeMutations.ts @@ -0,0 +1,63 @@ +import { useMutation, useQueryClient } from '@tanstack/react-query'; + +import { HttpUtil } from '@/utils'; +import { keys } from '@/api/queryKeys'; +import type { NodeRecord } from '@/api/queries/useNodesQuery'; + +interface ApiMsg { + success?: boolean; + msg?: string; + obj?: T; +} + +export interface ProbeResult { + status: string; + latencyMs?: number; + xrayVersion?: string; + error?: string; +} + +export function useNodeMutations() { + const queryClient = useQueryClient(); + const invalidate = () => queryClient.invalidateQueries({ queryKey: keys.nodes.root() }); + + const createMut = useMutation({ + mutationFn: (payload: Partial) => + HttpUtil.post('/panel/api/nodes/add', payload) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidate(); }, + }); + + const updateMut = useMutation({ + mutationFn: ({ id, payload }: { id: number; payload: Partial }) => + HttpUtil.post(`/panel/api/nodes/update/${id}`, payload) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidate(); }, + }); + + const removeMut = useMutation({ + mutationFn: (id: number) => + HttpUtil.post(`/panel/api/nodes/del/${id}`) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidate(); }, + }); + + const setEnableMut = useMutation({ + mutationFn: ({ id, enable }: { id: number; enable: boolean }) => + HttpUtil.post(`/panel/api/nodes/setEnable/${id}`, { enable }) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidate(); }, + }); + + const probeMut = useMutation({ + mutationFn: (id: number) => + HttpUtil.post(`/panel/api/nodes/probe/${id}`) as Promise>, + onSuccess: (msg) => { if (msg?.success) invalidate(); }, + }); + + return { + create: (payload: Partial) => createMut.mutateAsync(payload), + update: (id: number, payload: Partial) => updateMut.mutateAsync({ id, payload }), + remove: (id: number) => removeMut.mutateAsync(id), + setEnable: (id: number, enable: boolean) => setEnableMut.mutateAsync({ id, enable }), + probe: (id: number) => probeMut.mutateAsync(id), + testConnection: (payload: Partial) => + HttpUtil.post('/panel/api/nodes/test', payload) as Promise>, + }; +} diff --git a/frontend/src/api/queries/useNodesQuery.ts b/frontend/src/api/queries/useNodesQuery.ts new file mode 100644 index 00000000..5c7c6b07 --- /dev/null +++ b/frontend/src/api/queries/useNodesQuery.ts @@ -0,0 +1,108 @@ +import { useQuery } from '@tanstack/react-query'; +import { useMemo } from 'react'; + +import { HttpUtil } from '@/utils'; +import { keys } from '@/api/queryKeys'; + +export interface NodeRecord { + id: number; + name?: string; + remark?: string; + scheme?: string; + address?: string; + port?: number; + basePath?: string; + apiToken?: string; + enable?: boolean; + status?: 'online' | 'offline' | string; + latencyMs?: number; + cpuPct?: number; + memPct?: number; + xrayVersion?: string; + panelVersion?: string; + uptimeSecs?: number; + inboundCount?: number; + clientCount?: number; + onlineCount?: number; + depletedCount?: number; + lastHeartbeat?: number; + lastError?: string; + allowPrivateAddress?: boolean; + [key: string]: unknown; +} + +export interface NodeTotals { + total: number; + online: number; + offline: number; + avgLatency: number; + inbounds: number; + clients: number; + onlineClients: number; + depleted: number; +} + +interface ApiMsg { + success?: boolean; + msg?: string; + obj?: T; +} + +async function fetchNodes(): Promise { + const msg = await HttpUtil.get('/panel/api/nodes/list', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch nodes'); + return Array.isArray(msg.obj) ? msg.obj : []; +} + +export function useNodesQuery() { + const query = useQuery({ + queryKey: keys.nodes.list(), + queryFn: fetchNodes, + }); + + const nodes = useMemo(() => query.data ?? [], [query.data]); + + const totals = useMemo(() => { + let online = 0; + let offline = 0; + let latencySum = 0; + let latencyCount = 0; + let inbounds = 0; + let clients = 0; + let onlineClients = 0; + let depleted = 0; + for (const n of nodes) { + inbounds += n.inboundCount || 0; + clients += n.clientCount || 0; + onlineClients += n.onlineCount || 0; + depleted += n.depletedCount || 0; + if (!n.enable) continue; + if (n.status === 'online') { + online += 1; + if (n.latencyMs && n.latencyMs > 0) { + latencySum += n.latencyMs; + latencyCount += 1; + } + } else if (n.status === 'offline') { + offline += 1; + } + } + return { + total: nodes.length, + online, + offline, + avgLatency: latencyCount > 0 ? Math.round(latencySum / latencyCount) : 0, + inbounds, + clients, + onlineClients, + depleted, + }; + }, [nodes]); + + return { + nodes, + totals, + loading: query.isFetching, + fetched: query.data !== undefined, + }; +} diff --git a/frontend/src/api/queries/useStatusQuery.ts b/frontend/src/api/queries/useStatusQuery.ts new file mode 100644 index 00000000..bb33eb50 --- /dev/null +++ b/frontend/src/api/queries/useStatusQuery.ts @@ -0,0 +1,33 @@ +import { useQuery } from '@tanstack/react-query'; +import { useMemo } from 'react'; + +import { HttpUtil } from '@/utils'; +import { Status } from '@/models/status'; +import { keys } from '@/api/queryKeys'; + +const POLL_INTERVAL_MS = 2000; + +async function fetchStatus(): Promise { + const msg = await HttpUtil.get('/panel/api/server/status', undefined, { silent: true }); + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch status'); + return new Status(msg.obj); +} + +export function useStatusQuery() { + const query = useQuery({ + queryKey: keys.server.status(), + queryFn: fetchStatus, + refetchInterval: POLL_INTERVAL_MS, + refetchIntervalInBackground: false, + staleTime: 0, + }); + + const status = useMemo(() => query.data ?? new Status(), [query.data]); + const refresh = async () => { await query.refetch(); }; + + return { + status, + fetched: query.data !== undefined, + refresh, + }; +} diff --git a/frontend/src/api/queryKeys.ts b/frontend/src/api/queryKeys.ts new file mode 100644 index 00000000..e1fe0980 --- /dev/null +++ b/frontend/src/api/queryKeys.ts @@ -0,0 +1,30 @@ +export const keys = { + server: { + status: () => ['server', 'status'] as const, + }, + nodes: { + root: () => ['nodes'] as const, + list: () => ['nodes', 'list'] as const, + }, + settings: { + root: () => ['settings'] as const, + all: () => ['settings', 'all'] as const, + defaults: () => ['settings', 'defaults'] as const, + }, + inbounds: { + root: () => ['inbounds'] as const, + slim: () => ['inbounds', 'slim'] as const, + options: () => ['inbounds', 'options'] as const, + }, + clients: { + root: () => ['clients'] as const, + list: (params: unknown) => ['clients', 'list', params] as const, + onlines: () => ['clients', 'onlines'] as const, + lastOnline: () => ['clients', 'lastOnline'] as const, + }, + xray: { + root: () => ['xray'] as const, + config: () => ['xray', 'config'] as const, + outboundsTraffic: () => ['xray', 'outboundsTraffic'] as const, + }, +} as const; diff --git a/frontend/src/api/websocketBridge.ts b/frontend/src/api/websocketBridge.ts new file mode 100644 index 00000000..114e74d2 --- /dev/null +++ b/frontend/src/api/websocketBridge.ts @@ -0,0 +1,77 @@ +import { useEffect } from 'react'; +import { useQueryClient } from '@tanstack/react-query'; + +import { WebSocketClient } from '@/api/websocket.js'; +import { keys } from '@/api/queryKeys'; + +type Handler = (payload: unknown) => void; + +interface SharedClient { + connect(): void; + on(event: string, fn: Handler): void; + off(event: string, fn: Handler): void; +} + +let sharedClient: SharedClient | null = null; + +function getSharedClient(): SharedClient { + if (sharedClient) return sharedClient; + const basePath = (typeof window !== 'undefined' && window.X_UI_BASE_PATH) || ''; + sharedClient = new WebSocketClient(basePath) as SharedClient; + return sharedClient; +} + +let invalidateTimer: number | null = null; + +export function useWebSocketBridge() { + const queryClient = useQueryClient(); + + useEffect(() => { + const client = getSharedClient(); + + const onInvalidate: Handler = (payload) => { + const p = payload as { type?: string } | undefined; + if (!p || (p.type !== 'inbounds' && p.type !== 'clients')) return; + if (invalidateTimer != null) clearTimeout(invalidateTimer); + invalidateTimer = window.setTimeout(() => { + invalidateTimer = null; + if (p.type === 'inbounds') { + queryClient.invalidateQueries({ queryKey: ['inbounds'] }); + } else { + queryClient.invalidateQueries({ queryKey: ['clients'] }); + } + }, 200); + }; + + const onOutbounds: Handler = (payload) => { + queryClient.setQueryData(keys.xray.outboundsTraffic(), payload); + }; + + const onNodes: Handler = (payload) => { + if (!Array.isArray(payload)) return; + queryClient.setQueryData(keys.nodes.list(), payload); + }; + + const onInbounds: Handler = (payload) => { + if (!Array.isArray(payload)) return; + queryClient.setQueryData(keys.inbounds.slim(), payload); + }; + + client.on('invalidate', onInvalidate); + client.on('outbounds', onOutbounds); + client.on('nodes', onNodes); + client.on('inbounds', onInbounds); + client.connect(); + + return () => { + client.off('invalidate', onInvalidate); + client.off('outbounds', onOutbounds); + client.off('nodes', onNodes); + client.off('inbounds', onInbounds); + if (invalidateTimer != null) { + clearTimeout(invalidateTimer); + invalidateTimer = null; + } + }; + }, [queryClient]); +} diff --git a/frontend/src/components/AppSidebar.tsx b/frontend/src/components/AppSidebar.tsx index 27dc0571..0c19b773 100644 --- a/frontend/src/components/AppSidebar.tsx +++ b/frontend/src/components/AppSidebar.tsx @@ -1,5 +1,6 @@ import { useCallback, useMemo, useState } from 'react'; import type { ComponentType } from 'react'; +import { useLocation, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Drawer, Layout, Menu } from 'antd'; import type { MenuProps } from 'antd'; @@ -23,11 +24,7 @@ import './AppSidebar.css'; const SIDEBAR_COLLAPSED_KEY = 'isSidebarCollapsed'; const DONATE_URL = 'https://donate.sanaei.dev/'; - -interface AppSidebarProps { - basePath?: string; - requestUri?: string; -} +const LOGOUT_KEY = '__logout__'; type IconName = 'dashboard' | 'user' | 'team' | 'setting' | 'tool' | 'cluster' | 'logout' | 'apidocs'; @@ -100,31 +97,34 @@ function ThemeCycleButton({ id, isDark, isUltra, onCycle, ariaLabel }: { ); } -export default function AppSidebar({ basePath = '', requestUri = '' }: AppSidebarProps) { +export default function AppSidebar() { const { t } = useTranslation(); const { isDark, isUltra, toggleTheme, toggleUltra } = useTheme(); + const navigate = useNavigate(); + const { pathname } = useLocation(); const [collapsed, setCollapsed] = useState(() => readCollapsed()); const [drawerOpen, setDrawerOpen] = useState(false); - const prefix = basePath.startsWith('/') ? basePath : `/${basePath || ''}`; const currentTheme: 'light' | 'dark' = isDark ? 'dark' : 'light'; const panelVersion = window.X_UI_CUR_VER || ''; const tabs = useMemo<{ key: string; icon: IconName; title: string }[]>(() => [ - { key: `${prefix}panel/`, icon: 'dashboard', title: t('menu.dashboard') }, - { key: `${prefix}panel/inbounds`, icon: 'user', title: t('menu.inbounds') }, - { key: `${prefix}panel/clients`, icon: 'team', title: t('menu.clients') }, - { key: `${prefix}panel/nodes`, icon: 'cluster', title: t('menu.nodes') }, - { key: `${prefix}panel/settings`, icon: 'setting', title: t('menu.settings') }, - { key: `${prefix}panel/xray`, icon: 'tool', title: t('menu.xray') }, - { key: `${prefix}panel/api-docs`, icon: 'apidocs', title: t('menu.apiDocs') }, - { key: 'logout', icon: 'logout', title: t('logout') }, - ], [prefix, t]); + { key: '/', icon: 'dashboard', title: t('menu.dashboard') }, + { key: '/inbounds', icon: 'user', title: t('menu.inbounds') }, + { key: '/clients', icon: 'team', title: t('menu.clients') }, + { key: '/nodes', icon: 'cluster', title: t('menu.nodes') }, + { key: '/settings', icon: 'setting', title: t('menu.settings') }, + { key: '/xray', icon: 'tool', title: t('menu.xray') }, + { key: '/api-docs', icon: 'apidocs', title: t('menu.apiDocs') }, + { key: LOGOUT_KEY, icon: 'logout', title: t('logout') }, + ], [t]); const navItems = useMemo(() => tabs.filter((tab) => tab.icon !== 'logout'), [tabs]); const utilItems = useMemo(() => tabs.filter((tab) => tab.icon === 'logout'), [tabs]); + const selectedKey = pathname === '' ? '/' : pathname; + const toMenuItems = useCallback((items: typeof tabs): MenuProps['items'] => items.map((tab) => { const Icon = iconByName[tab.icon]; @@ -137,17 +137,13 @@ export default function AppSidebar({ basePath = '', requestUri = '' }: AppSideba []); const openLink = useCallback(async (key: string) => { - if (key === 'logout') { + if (key === LOGOUT_KEY) { await HttpUtil.post('/logout'); - window.location.href = basePath || '/'; + window.location.href = window.X_UI_BASE_PATH || '/'; return; } - if (key.startsWith('http')) { - window.open(key); - } else { - window.location.href = key; - } - }, [basePath]); + navigate(key); + }, [navigate]); const onMenuClick = useCallback>(({ key }) => { openLink(String(key)); @@ -205,7 +201,7 @@ export default function AppSidebar({ basePath = '', requestUri = '' }: AppSideba { onMenuClick(info); setDrawerOpen(false); }} @@ -268,7 +264,7 @@ export default function AppSidebar({ basePath = '', requestUri = '' }: AppSideba { onMenuClick(info); setDrawerOpen(false); }} diff --git a/frontend/src/entries/clients.tsx b/frontend/src/entries/clients.tsx deleted file mode 100644 index a6834e3f..00000000 --- a/frontend/src/entries/clients.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createRoot } from 'react-dom/client'; -import { message } from 'antd'; -import 'antd/dist/reset.css'; - -import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; -import { readyI18n } from '@/i18n/react'; -import { ThemeProvider } from '@/hooks/useTheme'; -import ClientsPage from '@/pages/clients/ClientsPage'; - -setupAxios(); -applyDocumentTitle(); - -const messageContainer = document.getElementById('message'); -if (messageContainer) { - message.config({ getContainer: () => messageContainer }); -} - -readyI18n().then(() => { - const root = document.getElementById('app'); - if (root) { - createRoot(root).render( - - - , - ); - } -}); diff --git a/frontend/src/entries/inbounds.tsx b/frontend/src/entries/inbounds.tsx deleted file mode 100644 index f59a16e9..00000000 --- a/frontend/src/entries/inbounds.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createRoot } from 'react-dom/client'; -import { message } from 'antd'; -import 'antd/dist/reset.css'; - -import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; -import { readyI18n } from '@/i18n/react'; -import { ThemeProvider } from '@/hooks/useTheme'; -import InboundsPage from '@/pages/inbounds/InboundsPage'; - -setupAxios(); -applyDocumentTitle(); - -const messageContainer = document.getElementById('message'); -if (messageContainer) { - message.config({ getContainer: () => messageContainer }); -} - -readyI18n().then(() => { - const root = document.getElementById('app'); - if (root) { - createRoot(root).render( - - - , - ); - } -}); diff --git a/frontend/src/entries/index.tsx b/frontend/src/entries/index.tsx deleted file mode 100644 index c3620cae..00000000 --- a/frontend/src/entries/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createRoot } from 'react-dom/client'; -import { message } from 'antd'; -import 'antd/dist/reset.css'; - -import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; -import { readyI18n } from '@/i18n/react'; -import { ThemeProvider } from '@/hooks/useTheme'; -import IndexPage from '@/pages/index/IndexPage'; - -setupAxios(); -applyDocumentTitle(); - -const messageContainer = document.getElementById('message'); -if (messageContainer) { - message.config({ getContainer: () => messageContainer }); -} - -readyI18n().then(() => { - const root = document.getElementById('app'); - if (root) { - createRoot(root).render( - - - , - ); - } -}); diff --git a/frontend/src/entries/login.tsx b/frontend/src/entries/login.tsx index 66fc4f1a..eecec4bd 100644 --- a/frontend/src/entries/login.tsx +++ b/frontend/src/entries/login.tsx @@ -6,6 +6,7 @@ import { setupAxios } from '@/api/axios-init.js'; import { applyDocumentTitle } from '@/utils'; import { readyI18n } from '@/i18n/react'; import { ThemeProvider } from '@/hooks/useTheme'; +import { QueryProvider } from '@/api/QueryProvider'; import LoginPage from '@/pages/login/LoginPage'; setupAxios(); @@ -21,7 +22,9 @@ readyI18n().then(() => { if (root) { createRoot(root).render( - + + + , ); } diff --git a/frontend/src/entries/nodes.tsx b/frontend/src/entries/nodes.tsx deleted file mode 100644 index 75761eba..00000000 --- a/frontend/src/entries/nodes.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createRoot } from 'react-dom/client'; -import { message } from 'antd'; -import 'antd/dist/reset.css'; - -import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; -import { readyI18n } from '@/i18n/react'; -import { ThemeProvider } from '@/hooks/useTheme'; -import NodesPage from '@/pages/nodes/NodesPage'; - -setupAxios(); -applyDocumentTitle(); - -const messageContainer = document.getElementById('message'); -if (messageContainer) { - message.config({ getContainer: () => messageContainer }); -} - -readyI18n().then(() => { - const root = document.getElementById('app'); - if (root) { - createRoot(root).render( - - - , - ); - } -}); diff --git a/frontend/src/entries/settings.tsx b/frontend/src/entries/settings.tsx deleted file mode 100644 index b6397963..00000000 --- a/frontend/src/entries/settings.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createRoot } from 'react-dom/client'; -import { message } from 'antd'; -import 'antd/dist/reset.css'; - -import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; -import { readyI18n } from '@/i18n/react'; -import { ThemeProvider } from '@/hooks/useTheme'; -import SettingsPage from '@/pages/settings/SettingsPage'; - -setupAxios(); -applyDocumentTitle(); - -const messageContainer = document.getElementById('message'); -if (messageContainer) { - message.config({ getContainer: () => messageContainer }); -} - -readyI18n().then(() => { - const root = document.getElementById('app'); - if (root) { - createRoot(root).render( - - - , - ); - } -}); diff --git a/frontend/src/entries/subpage.tsx b/frontend/src/entries/subpage.tsx index fbe6ea75..baaa0e89 100644 --- a/frontend/src/entries/subpage.tsx +++ b/frontend/src/entries/subpage.tsx @@ -4,6 +4,7 @@ import 'antd/dist/reset.css'; import { readyI18n } from '@/i18n/react'; import { ThemeProvider } from '@/hooks/useTheme'; +import { QueryProvider } from '@/api/QueryProvider'; import SubPage from '@/pages/sub/SubPage'; const messageContainer = document.getElementById('message'); @@ -16,7 +17,9 @@ readyI18n().then(() => { if (root) { createRoot(root).render( - + + + , ); } diff --git a/frontend/src/entries/xray.tsx b/frontend/src/entries/xray.tsx deleted file mode 100644 index 3b579254..00000000 --- a/frontend/src/entries/xray.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createRoot } from 'react-dom/client'; -import { message } from 'antd'; -import 'antd/dist/reset.css'; - -import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; -import { readyI18n } from '@/i18n/react'; -import { ThemeProvider } from '@/hooks/useTheme'; -import XrayPage from '@/pages/xray/XrayPage'; - -setupAxios(); -applyDocumentTitle(); - -const messageContainer = document.getElementById('message'); -if (messageContainer) { - message.config({ getContainer: () => messageContainer }); -} - -readyI18n().then(() => { - const root = document.getElementById('app'); - if (root) { - createRoot(root).render( - - - , - ); - } -}); diff --git a/frontend/src/hooks/useAllSetting.ts b/frontend/src/hooks/useAllSetting.ts deleted file mode 100644 index 5775f554..00000000 --- a/frontend/src/hooks/useAllSetting.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { HttpUtil } from '@/utils'; -import { AllSetting } from '@/models/setting'; - -interface ApiMsg { - success?: boolean; - obj?: T; -} - -export function useAllSetting() { - const [allSetting, setAllSetting] = useState(() => new AllSetting()); - const [oldAllSetting, setOldAllSetting] = useState(() => new AllSetting()); - const [fetched, setFetched] = useState(false); - const [spinning, setSpinning] = useState(false); - const fetchedRef = useRef(false); - - const applyServerState = useCallback((obj: unknown) => { - setAllSetting(new AllSetting(obj)); - setOldAllSetting(new AllSetting(obj)); - }, []); - - const fetchAll = useCallback(async () => { - const msg = await HttpUtil.post('/panel/setting/all') as ApiMsg; - if (msg?.success) { - applyServerState(msg.obj); - fetchedRef.current = true; - setFetched(true); - } - }, [applyServerState]); - - const saveAll = useCallback(async () => { - setSpinning(true); - try { - const msg = await HttpUtil.post('/panel/setting/update', allSetting) as ApiMsg; - if (msg?.success) await fetchAll(); - } finally { - setSpinning(false); - } - }, [allSetting, fetchAll]); - - const updateSetting = useCallback((patch: Partial) => { - setAllSetting((prev) => { - const next = new AllSetting(prev); - Object.assign(next, patch); - return next; - }); - }, []); - - const saveDisabled = useMemo( - () => allSetting.equals(oldAllSetting), - [allSetting, oldAllSetting], - ); - - useEffect(() => { - - fetchAll(); - }, [fetchAll]); - - return { - allSetting, - updateSetting, - fetched, - spinning, - setSpinning, - saveDisabled, - fetchAll, - saveAll, - }; -} diff --git a/frontend/src/hooks/useClients.ts b/frontend/src/hooks/useClients.ts index 665fb75e..4d9b1dfb 100644 --- a/frontend/src/hooks/useClients.ts +++ b/frontend/src/hooks/useClients.ts @@ -1,5 +1,8 @@ -import { useCallback, useEffect, useRef, useState } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { keepPreviousData, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; + import { HttpUtil } from '@/utils'; +import { keys } from '@/api/queryKeys'; const JSON_HEADERS = { headers: { 'Content-Type': 'application/json' } } as const; @@ -84,22 +87,49 @@ interface ClientPageResponse { } const DEFAULT_QUERY: ClientQueryParams = { page: 1, pageSize: 25 }; +const DEFAULT_SUMMARY: ClientsSummary = { + total: 0, active: 0, online: [], depleted: [], expiring: [], deactive: [], +}; + +function buildQS(p: ClientQueryParams): string { + const sp = new URLSearchParams(); + sp.set('page', String(p.page || 1)); + sp.set('pageSize', String(p.pageSize || DEFAULT_QUERY.pageSize)); + if (p.search) sp.set('search', p.search); + if (p.filter) sp.set('filter', p.filter); + if (p.protocol) sp.set('protocol', p.protocol); + if (p.inbound && p.inbound > 0) sp.set('inbound', String(p.inbound)); + if (p.sort) sp.set('sort', p.sort); + if (p.order) sp.set('order', p.order); + return sp.toString(); +} + +async function fetchClientPage(params: ClientQueryParams): Promise { + const qs = buildQS(params); + const msg = await HttpUtil.get(`/panel/api/clients/list/paged?${qs}`, undefined, { silent: true }) as ApiMsg; + if (!msg?.success || !msg.obj) throw new Error(msg?.msg || 'Failed to fetch clients'); + return msg.obj; +} + +async function fetchInboundOptions(): Promise { + const msg = await HttpUtil.get('/panel/api/inbounds/options', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch inbound options'); + return Array.isArray(msg.obj) ? msg.obj : []; +} + +async function fetchDefaults(): Promise> { + const msg = await HttpUtil.post('/panel/setting/defaultSettings', undefined, { silent: true }) as ApiMsg>; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch defaults'); + return msg.obj || {}; +} export function useClients() { - const [clients, setClients] = useState([]); - const [total, setTotal] = useState(0); - const [filtered, setFiltered] = useState(0); - const [summary, setSummary] = useState({ - total: 0, active: 0, online: [], depleted: [], expiring: [], deactive: [], - }); - const [inbounds, setInbounds] = useState([]); - const [onlines, setOnlines] = useState([]); - const [loading, setLoading] = useState(false); - const [fetched, setFetched] = useState(false); + const queryClient = useQueryClient(); + const [query, setQueryState] = useState(DEFAULT_QUERY); - // Shallow-compare against the previous query so callers can pass a fresh - // object on every render (the common React pattern) without triggering a - // re-fetch when nothing actually changed. + // setQuery shallow-compares so callers can pass a fresh object every render + // (the common React pattern) without triggering a re-fetch when nothing + // actually changed. const setQuery = useCallback((next: ClientQueryParams) => { setQueryState((prev) => { if ( @@ -115,86 +145,69 @@ export function useClients() { return next; }); }, []); - const [subSettings, setSubSettings] = useState({ - enable: false, subURI: '', subJsonURI: '', subJsonEnable: false, + + const listQuery = useQuery({ + queryKey: keys.clients.list(query), + queryFn: () => fetchClientPage(query), + staleTime: Infinity, + placeholderData: keepPreviousData, }); - const [ipLimitEnable, setIpLimitEnable] = useState(false); - const [tgBotEnable, setTgBotEnable] = useState(false); - const [expireDiff, setExpireDiff] = useState(0); - const [trafficDiff, setTrafficDiff] = useState(0); - const [pageSize, setPageSize] = useState(0); - const clientsRef = useRef([]); - const queryRef = useRef(query); - const invalidateTimerRef = useRef(null); + const inboundOptionsQuery = useQuery({ + queryKey: keys.inbounds.options(), + queryFn: fetchInboundOptions, + staleTime: Infinity, + }); - useEffect(() => { clientsRef.current = clients; }, [clients]); - useEffect(() => { queryRef.current = query; }, [query]); + const defaultsQuery = useQuery({ + queryKey: keys.settings.defaults(), + queryFn: fetchDefaults, + staleTime: Infinity, + }); - const buildQS = (p: ClientQueryParams) => { - const sp = new URLSearchParams(); - sp.set('page', String(p.page || 1)); - sp.set('pageSize', String(p.pageSize || DEFAULT_QUERY.pageSize)); - if (p.search) sp.set('search', p.search); - if (p.filter) sp.set('filter', p.filter); - if (p.protocol) sp.set('protocol', p.protocol); - if (p.inbound && p.inbound > 0) sp.set('inbound', String(p.inbound)); - if (p.sort) sp.set('sort', p.sort); - if (p.order) sp.set('order', p.order); - return sp.toString(); - }; + const onlinesQuery = useQuery({ + queryKey: keys.clients.onlines(), + queryFn: async () => { + const msg = await HttpUtil.post('/panel/api/clients/onlines', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch onlines'); + return Array.isArray(msg.obj) ? msg.obj : []; + }, + staleTime: Infinity, + }); - const refresh = useCallback(async (override?: ClientQueryParams) => { - setLoading(true); - try { - const params = override ?? queryRef.current; - const qs = buildQS(params); - const msg = await HttpUtil.get(`/panel/api/clients/list/paged?${qs}`) as ApiMsg; - if (msg?.success && msg.obj) { - setClients(Array.isArray(msg.obj.items) ? msg.obj.items : []); - setTotal(msg.obj.total ?? 0); - setFiltered(msg.obj.filtered ?? 0); - if (msg.obj.summary) setSummary(msg.obj.summary); - } - setFetched(true); - } finally { - setLoading(false); - } - }, []); + const clients = listQuery.data?.items ?? []; + const total = listQuery.data?.total ?? 0; + const filtered = listQuery.data?.filtered ?? 0; + const summary = listQuery.data?.summary ?? DEFAULT_SUMMARY; + const fetched = listQuery.data !== undefined; + const loading = listQuery.isFetching; - // Inbound options are picker-shaped and don't depend on the clients query — - // fetch them once on mount instead of every refresh. - useEffect(() => { - let cancelled = false; - (async () => { - const msg = await HttpUtil.get('/panel/api/inbounds/options') as ApiMsg; - if (cancelled) return; - if (msg?.success) setInbounds(Array.isArray(msg.obj) ? msg.obj : []); - })(); - return () => { cancelled = true; }; - }, []); + const inbounds = inboundOptionsQuery.data ?? []; + const onlines = onlinesQuery.data ?? []; - const fetchSubSettings = useCallback(async () => { - const msg = await HttpUtil.post('/panel/setting/defaultSettings') as ApiMsg>; - if (!msg?.success) return; - const s = msg.obj || {}; - setSubSettings({ - enable: !!s.subEnable, - subURI: (s.subURI as string) || '', - subJsonURI: (s.subJsonURI as string) || '', - subJsonEnable: !!s.subJsonEnable, - }); - setIpLimitEnable(!!s.ipLimitEnable); - setTgBotEnable(!!s.tgBotEnable); - setExpireDiff(((s.expireDiff as number) ?? 0) * 86400000); - setTrafficDiff(((s.trafficDiff as number) ?? 0) * 1073741824); - setPageSize((s.pageSize as number) ?? 0); - }, []); + const defaults = defaultsQuery.data ?? {}; + const subSettings: SubSettings = useMemo(() => ({ + enable: !!defaults.subEnable, + subURI: (defaults.subURI as string) || '', + subJsonURI: (defaults.subJsonURI as string) || '', + subJsonEnable: !!defaults.subJsonEnable, + }), [defaults.subEnable, defaults.subURI, defaults.subJsonURI, defaults.subJsonEnable]); + + const ipLimitEnable = !!defaults.ipLimitEnable; + const tgBotEnable = !!defaults.tgBotEnable; + const expireDiff = ((defaults.expireDiff as number) ?? 0) * 86400000; + const trafficDiff = ((defaults.trafficDiff as number) ?? 0) * 1073741824; + const pageSize = (defaults.pageSize as number) ?? 0; + + const invalidateAll = useCallback( + () => queryClient.invalidateQueries({ queryKey: keys.clients.root() }), + [queryClient], + ); + + const refresh = useCallback(async () => { + await invalidateAll(); + }, [invalidateAll]); - // hydrate fetches the full client record (uuid, password, flow, ...) for a - // single email. The paged list endpoint omits these to keep the row payload - // tiny; edit / info / qr / link modals call this to get a complete record - // before opening. const hydrate = useCallback(async (email: string): Promise<{ client: ClientRecord; inboundIds: number[] } | null> => { if (!email) return null; const msg = await HttpUtil.get(`/panel/api/clients/get/${encodeURIComponent(email)}`) as ApiMsg<{ client: ClientRecord; inboundIds: number[] }>; @@ -202,88 +215,109 @@ export function useClients() { return msg.obj; }, []); - const create = useCallback(async (payload: unknown) => { - const msg = await HttpUtil.post('/panel/api/clients/add', payload, JSON_HEADERS) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const createMut = useMutation({ + mutationFn: (payload: unknown) => + HttpUtil.post('/panel/api/clients/add', payload, JSON_HEADERS) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const update = useCallback(async (email: string, client: unknown) => { - if (!email) return null; - const encoded = encodeURIComponent(email); - const msg = await HttpUtil.post(`/panel/api/clients/update/${encoded}`, client, JSON_HEADERS) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const updateMut = useMutation({ + mutationFn: ({ email, client }: { email: string; client: unknown }) => + HttpUtil.post(`/panel/api/clients/update/${encodeURIComponent(email)}`, client, JSON_HEADERS) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const remove = useCallback(async (email: string, keepTraffic = false) => { - if (!email) return null; - const encoded = encodeURIComponent(email); - const url = keepTraffic - ? `/panel/api/clients/del/${encoded}?keepTraffic=1` - : `/panel/api/clients/del/${encoded}`; - const msg = await HttpUtil.post(url) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const removeMut = useMutation({ + mutationFn: ({ email, keepTraffic }: { email: string; keepTraffic?: boolean }) => { + const url = keepTraffic + ? `/panel/api/clients/del/${encodeURIComponent(email)}?keepTraffic=1` + : `/panel/api/clients/del/${encodeURIComponent(email)}`; + return HttpUtil.post(url) as Promise; + }, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const removeMany = useCallback(async (emails: string[], keepTraffic = false) => { - if (!Array.isArray(emails) || emails.length === 0) return []; - const suffix = keepTraffic ? '?keepTraffic=1' : ''; - const results = await Promise.all(emails.map((email) => { - const url = `/panel/api/clients/del/${encodeURIComponent(email)}${suffix}`; - return HttpUtil.post(url, undefined, { silent: true }) as Promise; - })); - await refresh(); - return results; - }, [refresh]); + const removeManyMut = useMutation({ + mutationFn: async ({ emails, keepTraffic }: { emails: string[]; keepTraffic?: boolean }) => { + const suffix = keepTraffic ? '?keepTraffic=1' : ''; + const results = await Promise.all(emails.map((email) => { + const url = `/panel/api/clients/del/${encodeURIComponent(email)}${suffix}`; + return HttpUtil.post(url, undefined, { silent: true }) as Promise; + })); + return results; + }, + onSuccess: () => invalidateAll(), + }); - const bulkAdjust = useCallback(async (emails: string[], addDays: number, addBytes: number) => { - if (!Array.isArray(emails) || emails.length === 0) return null; - const msg = await HttpUtil.post( - '/panel/api/clients/bulkAdjust', - { emails, addDays, addBytes }, - JSON_HEADERS, - ) as ApiMsg<{ adjusted: number; skipped?: { email: string; reason: string }[] }>; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const bulkAdjustMut = useMutation({ + mutationFn: (payload: { emails: string[]; addDays: number; addBytes: number }) => + HttpUtil.post( + '/panel/api/clients/bulkAdjust', + payload, + JSON_HEADERS, + ) as Promise>, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const attach = useCallback(async (email: string, inboundIds: number[]) => { - if (!email) return null; - const encoded = encodeURIComponent(email); - const msg = await HttpUtil.post(`/panel/api/clients/${encoded}/attach`, { inboundIds }, JSON_HEADERS) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const attachMut = useMutation({ + mutationFn: ({ email, inboundIds }: { email: string; inboundIds: number[] }) => + HttpUtil.post(`/panel/api/clients/${encodeURIComponent(email)}/attach`, { inboundIds }, JSON_HEADERS) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const detach = useCallback(async (email: string, inboundIds: number[]) => { - if (!email) return null; - const encoded = encodeURIComponent(email); - const msg = await HttpUtil.post(`/panel/api/clients/${encoded}/detach`, { inboundIds }, JSON_HEADERS) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const detachMut = useMutation({ + mutationFn: ({ email, inboundIds }: { email: string; inboundIds: number[] }) => + HttpUtil.post(`/panel/api/clients/${encodeURIComponent(email)}/detach`, { inboundIds }, JSON_HEADERS) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const resetTraffic = useCallback(async (client: ClientRecord) => { - if (!client?.email) return null; - const url = `/panel/api/clients/resetTraffic/${encodeURIComponent(client.email)}`; - const msg = await HttpUtil.post(url) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const resetTrafficMut = useMutation({ + mutationFn: (email: string) => + HttpUtil.post(`/panel/api/clients/resetTraffic/${encodeURIComponent(email)}`) as Promise, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const resetAllTraffics = useCallback(async () => { - const msg = await HttpUtil.post('/panel/api/clients/resetAllTraffics') as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const resetAllTrafficsMut = useMutation({ + mutationFn: () => HttpUtil.post('/panel/api/clients/resetAllTraffics') as Promise, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); - const delDepleted = useCallback(async () => { - const msg = await HttpUtil.post('/panel/api/clients/delDepleted') as ApiMsg<{ deleted?: number }>; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); + const delDepletedMut = useMutation({ + mutationFn: () => HttpUtil.post('/panel/api/clients/delDepleted') as Promise>, + onSuccess: (msg) => { if (msg?.success) invalidateAll(); }, + }); + + const create = useCallback((payload: unknown) => createMut.mutateAsync(payload), [createMut]); + const update = useCallback((email: string, client: unknown) => { + if (!email) return Promise.resolve(null as unknown as ApiMsg); + return updateMut.mutateAsync({ email, client }); + }, [updateMut]); + const remove = useCallback((email: string, keepTraffic = false) => { + if (!email) return Promise.resolve(null as unknown as ApiMsg); + return removeMut.mutateAsync({ email, keepTraffic }); + }, [removeMut]); + const removeMany = useCallback((emails: string[], keepTraffic = false) => { + if (!Array.isArray(emails) || emails.length === 0) return Promise.resolve([] as ApiMsg[]); + return removeManyMut.mutateAsync({ emails, keepTraffic }); + }, [removeManyMut]); + const bulkAdjust = useCallback((emails: string[], addDays: number, addBytes: number) => { + if (!Array.isArray(emails) || emails.length === 0) return Promise.resolve(null); + return bulkAdjustMut.mutateAsync({ emails, addDays, addBytes }); + }, [bulkAdjustMut]); + const attach = useCallback((email: string, inboundIds: number[]) => { + if (!email) return Promise.resolve(null as unknown as ApiMsg); + return attachMut.mutateAsync({ email, inboundIds }); + }, [attachMut]); + const detach = useCallback((email: string, inboundIds: number[]) => { + if (!email) return Promise.resolve(null as unknown as ApiMsg); + return detachMut.mutateAsync({ email, inboundIds }); + }, [detachMut]); + const resetTraffic = useCallback((client: ClientRecord) => { + if (!client?.email) return Promise.resolve(null as unknown as ApiMsg); + return resetTrafficMut.mutateAsync(client.email); + }, [resetTrafficMut]); + const resetAllTraffics = useCallback(() => resetAllTrafficsMut.mutateAsync(), [resetAllTrafficsMut]); + const delDepleted = useCallback(() => delDepletedMut.mutateAsync(), [delDepletedMut]); const setEnable = useCallback(async (client: ClientRecord, enable: boolean) => { if (!client?.email) return null; @@ -302,57 +336,53 @@ export function useClients() { return update(client.email, payload); }, [update]); + // WS-driven in-place merges. Page wires these via useWebSocket; the bridge + // covers coarse 'invalidate' and 'inbounds' events centrally. + const queryRef = useRef(query); + queryRef.current = query; + const applyTrafficEvent = useCallback((payload: unknown) => { if (!payload || typeof payload !== 'object') return; const p = payload as { onlineClients?: string[] }; if (Array.isArray(p.onlineClients)) { - setOnlines(p.onlineClients); + queryClient.setQueryData(keys.clients.onlines(), p.onlineClients); } - }, []); + }, [queryClient]); const applyClientStatsEvent = useCallback((payload: unknown) => { if (!payload || typeof payload !== 'object') return; - const p = payload as { clients?: ClientTraffic[] & { email?: string }[] }; + const p = payload as { clients?: (ClientTraffic & { email?: string })[] }; if (!Array.isArray(p.clients) || p.clients.length === 0) return; const byEmail = new Map(); - for (const row of p.clients as (ClientTraffic & { email?: string })[]) { + for (const row of p.clients) { if (row && row.email) byEmail.set(row.email, row); } - const cur = clientsRef.current || []; - let touched = false; - const next = cur.slice(); - for (let i = 0; i < next.length; i++) { - const row = next[i]; - const upd = byEmail.get(row?.email); - if (!upd) continue; - const merged: ClientTraffic = { ...(row.traffic || {}) }; - if (typeof upd.up === 'number') merged.up = upd.up; - if (typeof upd.down === 'number') merged.down = upd.down; - if (typeof upd.total === 'number') merged.total = upd.total; - if (typeof upd.expiryTime === 'number') merged.expiryTime = upd.expiryTime; - if (typeof upd.enable === 'boolean') merged.enable = upd.enable; - if (typeof upd.lastOnline === 'number') merged.lastOnline = upd.lastOnline; - next[i] = { ...row, traffic: merged }; - touched = true; - } - if (touched) setClients(next); - }, []); - - const applyInvalidate = useCallback((payload: unknown) => { - if (!payload || typeof payload !== 'object') return; - const p = payload as { type?: string }; - if (p.type !== 'inbounds' && p.type !== 'clients') return; - if (invalidateTimerRef.current != null) clearTimeout(invalidateTimerRef.current); - invalidateTimerRef.current = window.setTimeout(() => { - invalidateTimerRef.current = null; - refresh(); - }, 200); - }, [refresh]); + queryClient.setQueryData(keys.clients.list(queryRef.current), (prev) => { + if (!prev) return prev; + let touched = false; + const next = prev.items.slice(); + for (let i = 0; i < next.length; i++) { + const row = next[i]; + const upd = byEmail.get(row?.email); + if (!upd) continue; + const merged: ClientTraffic = { ...(row.traffic || {}) }; + if (typeof upd.up === 'number') merged.up = upd.up; + if (typeof upd.down === 'number') merged.down = upd.down; + if (typeof upd.total === 'number') merged.total = upd.total; + if (typeof upd.expiryTime === 'number') merged.expiryTime = upd.expiryTime; + if (typeof upd.enable === 'boolean') merged.enable = upd.enable; + if (typeof upd.lastOnline === 'number') merged.lastOnline = upd.lastOnline; + next[i] = { ...row, traffic: merged }; + touched = true; + } + if (!touched) return prev; + return { ...prev, items: next }; + }); + }, [queryClient]); useEffect(() => { - Promise.all([refresh(query), fetchSubSettings()]); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [query, fetchSubSettings]); + queryRef.current = query; + }, [query]); return { clients, @@ -386,6 +416,5 @@ export function useClients() { setEnable, applyTrafficEvent, applyClientStatsEvent, - applyInvalidate, }; } diff --git a/frontend/src/hooks/useNodes.ts b/frontend/src/hooks/useNodes.ts deleted file mode 100644 index 3f316263..00000000 --- a/frontend/src/hooks/useNodes.ts +++ /dev/null @@ -1,177 +0,0 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { HttpUtil } from '@/utils'; - -export interface NodeRecord { - id: number; - name?: string; - remark?: string; - scheme?: string; - address?: string; - port?: number; - basePath?: string; - apiToken?: string; - enable?: boolean; - status?: 'online' | 'offline' | string; - latencyMs?: number; - cpuPct?: number; - memPct?: number; - xrayVersion?: string; - panelVersion?: string; - uptimeSecs?: number; - inboundCount?: number; - clientCount?: number; - onlineCount?: number; - depletedCount?: number; - lastHeartbeat?: number; - lastError?: string; - allowPrivateAddress?: boolean; - [key: string]: unknown; -} - -interface ApiMsg { - success?: boolean; - msg?: string; - obj?: T; -} - -interface NodeTotals { - total: number; - online: number; - offline: number; - avgLatency: number; - inbounds: number; - clients: number; - onlineClients: number; - depleted: number; -} - -export function useNodes() { - const [nodes, setNodes] = useState([]); - const [loading, setLoading] = useState(false); - const [fetched, setFetched] = useState(false); - const fetchedRef = useRef(false); - - const refresh = useCallback(async () => { - setLoading(true); - try { - const msg = await HttpUtil.get('/panel/api/nodes/list') as ApiMsg; - if (msg?.success) { - setNodes(Array.isArray(msg.obj) ? msg.obj : []); - } - fetchedRef.current = true; - setFetched(true); - } finally { - setLoading(false); - } - }, []); - - const applyNodesEvent = useCallback((payload: unknown) => { - if (Array.isArray(payload)) { - setNodes(payload as NodeRecord[]); - if (!fetchedRef.current) { - fetchedRef.current = true; - setFetched(true); - } - } - }, []); - - const create = useCallback(async (payload: Partial) => { - const msg = await HttpUtil.post('/panel/api/nodes/add', payload) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); - - const update = useCallback(async (id: number, payload: Partial) => { - const msg = await HttpUtil.post(`/panel/api/nodes/update/${id}`, payload) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); - - const remove = useCallback(async (id: number) => { - const msg = await HttpUtil.post(`/panel/api/nodes/del/${id}`) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); - - const setEnable = useCallback(async (id: number, enable: boolean) => { - const msg = await HttpUtil.post(`/panel/api/nodes/setEnable/${id}`, { enable }) as ApiMsg; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); - - const testConnection = useCallback(async (payload: Partial) => { - return await HttpUtil.post('/panel/api/nodes/test', payload) as ApiMsg<{ - status: string; - latencyMs?: number; - xrayVersion?: string; - error?: string; - }>; - }, []); - - const probe = useCallback(async (id: number) => { - const msg = await HttpUtil.post(`/panel/api/nodes/probe/${id}`) as ApiMsg<{ - status: string; - latencyMs?: number; - error?: string; - }>; - if (msg?.success) await refresh(); - return msg; - }, [refresh]); - - const totals = useMemo(() => { - let online = 0; - let offline = 0; - let latencySum = 0; - let latencyCount = 0; - let inbounds = 0; - let clients = 0; - let onlineClients = 0; - let depleted = 0; - for (const n of nodes) { - inbounds += n.inboundCount || 0; - clients += n.clientCount || 0; - onlineClients += n.onlineCount || 0; - depleted += n.depletedCount || 0; - if (!n.enable) continue; - if (n.status === 'online') { - online += 1; - if (n.latencyMs && n.latencyMs > 0) { - latencySum += n.latencyMs; - latencyCount += 1; - } - } else if (n.status === 'offline') { - offline += 1; - } - } - return { - total: nodes.length, - online, - offline, - avgLatency: latencyCount > 0 ? Math.round(latencySum / latencyCount) : 0, - inbounds, - clients, - onlineClients, - depleted, - }; - }, [nodes]); - - useEffect(() => { - - refresh(); - }, [refresh]); - - return { - nodes, - loading, - fetched, - totals, - refresh, - applyNodesEvent, - create, - update, - remove, - setEnable, - testConnection, - probe, - }; -} diff --git a/frontend/src/hooks/usePageTitle.ts b/frontend/src/hooks/usePageTitle.ts new file mode 100644 index 00000000..0ff64660 --- /dev/null +++ b/frontend/src/hooks/usePageTitle.ts @@ -0,0 +1,22 @@ +import { useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; + +const TITLES: Record = { + '/': 'Overview', + '/inbounds': 'Inbounds', + '/clients': 'Clients', + '/nodes': 'Nodes', + '/settings': 'Settings', + '/xray': 'Xray Config', + '/api-docs': 'API Docs', +}; + +export function usePageTitle() { + const { pathname } = useLocation(); + + useEffect(() => { + const title = TITLES[pathname] || '3X-UI'; + const host = window.location.hostname; + document.title = host ? `${host} - ${title}` : title; + }, [pathname]); +} diff --git a/frontend/src/hooks/useStatus.ts b/frontend/src/hooks/useStatus.ts deleted file mode 100644 index 1b9799e5..00000000 --- a/frontend/src/hooks/useStatus.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { useCallback, useEffect, useRef, useState } from 'react'; - -import { HttpUtil } from '@/utils'; -import { Status } from '@/models/status'; - -const POLL_INTERVAL_MS = 2000; - -export function useStatus() { - const [status, setStatus] = useState(() => new Status()); - const [fetched, setFetched] = useState(false); - const fetchedRef = useRef(false); - - const refresh = useCallback(async () => { - try { - const msg = await HttpUtil.get('/panel/api/server/status'); - if (msg?.success) { - setStatus(new Status(msg.obj)); - if (!fetchedRef.current) { - fetchedRef.current = true; - setFetched(true); - } - } - } catch (e) { - console.error('Failed to get status:', e); - } - }, []); - - useEffect(() => { - refresh(); - const timer = window.setInterval(refresh, POLL_INTERVAL_MS); - return () => window.clearInterval(timer); - }, [refresh]); - - return { status, fetched, refresh }; -} diff --git a/frontend/src/hooks/useXraySetting.ts b/frontend/src/hooks/useXraySetting.ts index c195a2e4..6ae8bd5e 100644 --- a/frontend/src/hooks/useXraySetting.ts +++ b/frontend/src/hooks/useXraySetting.ts @@ -1,8 +1,11 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { HttpUtil, PromiseUtil } from '@/utils'; +import { keys } from '@/api/queryKeys'; const DIRTY_POLL_MS = 1000; +const DEFAULT_TEST_URL = 'https://www.google.com/generate_204'; export interface OutboundTrafficRow { tag: string; @@ -70,7 +73,6 @@ export interface UseXraySettingResult { fetchAll: () => Promise; fetchOutboundsTraffic: () => Promise; resetOutboundsTraffic: (tag: string) => Promise; - applyOutboundsEvent: (payload: unknown) => void; testOutbound: ( index: number, outbound: unknown, @@ -82,18 +84,59 @@ export interface UseXraySettingResult { restartXray: () => Promise; } +interface ApiMsg { + success?: boolean; + obj?: T; + msg?: string; +} + +interface XrayConfigPayload { + xraySetting: XraySettingsValue; + inboundTags?: string[]; + clientReverseTags?: string[]; + outboundTestUrl?: string; +} + +async function fetchXrayConfig(): Promise { + const msg = await HttpUtil.post('/panel/xray/', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to load xray config'); + if (typeof msg.obj !== 'string') throw new Error('Malformed xray config response: expected string'); + try { + return JSON.parse(msg.obj) as XrayConfigPayload; + } catch (e) { + const err = e as Error; + throw new Error(`Malformed xray config response: ${err.message}`, { cause: e }); + } +} + +async function fetchOutboundsTraffic(): Promise { + const msg = await HttpUtil.get('/panel/xray/getOutboundsTraffic', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch outbounds traffic'); + return Array.isArray(msg.obj) ? msg.obj : []; +} + export function useXraySetting(): UseXraySettingResult { - const [fetched, setFetched] = useState(false); - const [spinning, setSpinning] = useState(false); + const queryClient = useQueryClient(); + + const configQuery = useQuery({ + queryKey: keys.xray.config(), + queryFn: fetchXrayConfig, + staleTime: Infinity, + }); + + const trafficQuery = useQuery({ + queryKey: keys.xray.outboundsTraffic(), + queryFn: fetchOutboundsTraffic, + staleTime: Infinity, + }); + const [saveDisabled, setSaveDisabled] = useState(true); - const [fetchError, setFetchError] = useState(''); const [xraySetting, setXraySettingState] = useState(''); const [templateSettings, setTemplateSettingsState] = useState(null); - const [outboundTestUrl, setOutboundTestUrlState] = useState('https://www.google.com/generate_204'); + const [outboundTestUrl, setOutboundTestUrlState] = useState(DEFAULT_TEST_URL); const [inboundTags, setInboundTags] = useState([]); const [clientReverseTags, setClientReverseTags] = useState([]); const [restartResult, setRestartResult] = useState(''); - const [outboundsTraffic, setOutboundsTraffic] = useState([]); const [outboundTestStates, setOutboundTestStates] = useState>({}); const [testingAll, setTestingAll] = useState(false); @@ -108,6 +151,28 @@ export function useXraySetting(): UseXraySettingResult { outboundTestUrlRef.current = outboundTestUrl; templateSettingsRef.current = templateSettings; + // Seed local editor state from the config query. Runs on first fetch and + // every time the query refetches (e.g. after a successful save). + useEffect(() => { + if (!configQuery.data) return; + const obj = configQuery.data; + const pretty = JSON.stringify(obj.xraySetting, null, 2); + syncingRef.current = true; + setXraySettingState(pretty); + setTemplateSettingsState(obj.xraySetting); + oldXraySettingRef.current = pretty; + syncingRef.current = false; + setInboundTags(obj.inboundTags || []); + setClientReverseTags(obj.clientReverseTags || []); + const nextUrl = obj.outboundTestUrl || DEFAULT_TEST_URL; + setOutboundTestUrlState(nextUrl); + oldOutboundTestUrlRef.current = nextUrl; + setSaveDisabled(true); + }, [configQuery.data]); + + const fetched = configQuery.data !== undefined || configQuery.isError; + const fetchError = configQuery.error ? (configQuery.error as Error).message : ''; + const setXraySetting = useCallback((next: string) => { setXraySettingState(next); if (syncingRef.current) return; @@ -142,63 +207,59 @@ export function useXraySetting(): UseXraySettingResult { }, []); const fetchAll = useCallback(async () => { - setFetchError(''); - const msg = await HttpUtil.post('/panel/xray/'); - if (!msg?.success) { - setFetchError(msg?.msg || 'Failed to load xray config'); - setFetched(true); - return; - } - let obj; - try { - obj = JSON.parse(msg.obj); - } catch (e) { - const err = e as Error; - setFetchError(`Malformed xray config response: ${err?.message || String(err)}`); - setFetched(true); - return; - } - const pretty = JSON.stringify(obj.xraySetting, null, 2); - syncingRef.current = true; - setXraySettingState(pretty); - setTemplateSettingsState(obj.xraySetting); - oldXraySettingRef.current = pretty; - syncingRef.current = false; - setInboundTags(obj.inboundTags || []); - setClientReverseTags(obj.clientReverseTags || []); - const nextUrl = obj.outboundTestUrl || 'https://www.google.com/generate_204'; - setOutboundTestUrlState(nextUrl); - oldOutboundTestUrlRef.current = nextUrl; - setFetched(true); - setSaveDisabled(true); - }, []); + await queryClient.invalidateQueries({ queryKey: keys.xray.config() }); + }, [queryClient]); - const saveAll = useCallback(async () => { - setSpinning(true); - try { - const msg = await HttpUtil.post('/panel/xray/update', { + const fetchOutboundsTrafficCb = useCallback(async () => { + await queryClient.invalidateQueries({ queryKey: keys.xray.outboundsTraffic() }); + }, [queryClient]); + + const saveMut = useMutation({ + mutationFn: async () => + HttpUtil.post('/panel/xray/update', { xraySetting: xraySettingRef.current, - outboundTestUrl: outboundTestUrlRef.current || 'https://www.google.com/generate_204', - }); - if (msg?.success) await fetchAll(); - } finally { - setSpinning(false); - } - }, [fetchAll]); + outboundTestUrl: outboundTestUrlRef.current || DEFAULT_TEST_URL, + }) as Promise, + onSuccess: (msg) => { + if (msg?.success) queryClient.invalidateQueries({ queryKey: keys.xray.config() }); + }, + }); - const fetchOutboundsTraffic = useCallback(async () => { - const msg = await HttpUtil.get('/panel/xray/getOutboundsTraffic'); - if (msg?.success) setOutboundsTraffic(msg.obj || []); - }, []); + const resetTrafficMut = useMutation({ + mutationFn: (tag: string) => + HttpUtil.post('/panel/xray/resetOutboundsTraffic', { tag }) as Promise, + onSuccess: (msg) => { + if (msg?.success) queryClient.invalidateQueries({ queryKey: keys.xray.outboundsTraffic() }); + }, + }); - const resetOutboundsTraffic = useCallback(async (tag: string) => { - const msg = await HttpUtil.post('/panel/xray/resetOutboundsTraffic', { tag }); - if (msg?.success) await fetchOutboundsTraffic(); - }, [fetchOutboundsTraffic]); + const restartMut = useMutation({ + mutationFn: async () => { + const msg = await HttpUtil.post('/panel/api/server/restartXrayService') as ApiMsg; + if (!msg?.success) return msg; + await PromiseUtil.sleep(500); + const r = await HttpUtil.get('/panel/xray/getXrayResult') as ApiMsg; + if (r?.success) setRestartResult(r.obj || ''); + return msg; + }, + }); - const applyOutboundsEvent = useCallback((payload: unknown) => { - if (Array.isArray(payload)) setOutboundsTraffic(payload as OutboundTrafficRow[]); - }, []); + const resetDefaultMut = useMutation({ + mutationFn: async () => HttpUtil.get('/panel/setting/getDefaultJsonConfig') as Promise>, + onSuccess: (msg) => { + if (msg?.success && msg.obj) { + const cloned = JSON.parse(JSON.stringify(msg.obj)); + setTemplateSettings(cloned); + } + }, + }); + + const saveAll = useCallback(async () => { await saveMut.mutateAsync(); }, [saveMut]); + const resetOutboundsTraffic = useCallback(async (tag: string) => { await resetTrafficMut.mutateAsync(tag); }, [resetTrafficMut]); + const restartXray = useCallback(async () => { await restartMut.mutateAsync(); }, [restartMut]); + const resetToDefault = useCallback(async () => { await resetDefaultMut.mutateAsync(); }, [resetDefaultMut]); + + const spinning = saveMut.isPending || restartMut.isPending || resetDefaultMut.isPending; const testOutbound = useCallback( async (index: number, outbound: unknown, mode = 'tcp'): Promise => { @@ -212,11 +273,11 @@ export function useXraySetting(): UseXraySettingResult { outbound: JSON.stringify(outbound), allOutbounds: JSON.stringify(templateSettingsRef.current?.outbounds || []), mode, - }); - if (msg?.success) { + }) as ApiMsg; + if (msg?.success && msg.obj) { setOutboundTestStates((prev) => ({ ...prev, - [index]: { testing: false, result: msg.obj }, + [index]: { testing: false, result: msg.obj as OutboundTestResult }, })); return msg.obj; } @@ -273,43 +334,16 @@ export function useXraySetting(): UseXraySettingResult { } }, [testingAll, testOutbound]); - const resetToDefault = useCallback(async () => { - setSpinning(true); - try { - const msg = await HttpUtil.get('/panel/setting/getDefaultJsonConfig'); - if (msg?.success) { - const cloned = JSON.parse(JSON.stringify(msg.obj)); - setTemplateSettings(cloned); - } - } finally { - setSpinning(false); - } - }, [setTemplateSettings]); - - const restartXray = useCallback(async () => { - setSpinning(true); - try { - const msg = await HttpUtil.post('/panel/api/server/restartXrayService'); - if (msg?.success) { - await PromiseUtil.sleep(500); - const r = await HttpUtil.get('/panel/xray/getXrayResult'); - if (r?.success) setRestartResult(r.obj || ''); - } - } finally { - setSpinning(false); - } - }, []); - useEffect(() => { - fetchAll(); - fetchOutboundsTraffic(); const timer = window.setInterval(() => { const dirtyXray = oldXraySettingRef.current !== xraySettingRef.current; const dirtyUrl = oldOutboundTestUrlRef.current !== outboundTestUrlRef.current; setSaveDisabled(!(dirtyXray || dirtyUrl)); }, DIRTY_POLL_MS); return () => window.clearInterval(timer); - }, [fetchAll, fetchOutboundsTraffic]); + }, []); + + const outboundsTraffic = useMemo(() => trafficQuery.data ?? [], [trafficQuery.data]); return useMemo( () => ({ @@ -330,9 +364,8 @@ export function useXraySetting(): UseXraySettingResult { outboundTestStates, testingAll, fetchAll, - fetchOutboundsTraffic, + fetchOutboundsTraffic: fetchOutboundsTrafficCb, resetOutboundsTraffic, - applyOutboundsEvent, testOutbound, testAllOutbounds, saveAll, @@ -357,9 +390,8 @@ export function useXraySetting(): UseXraySettingResult { outboundTestStates, testingAll, fetchAll, - fetchOutboundsTraffic, + fetchOutboundsTrafficCb, resetOutboundsTraffic, - applyOutboundsEvent, testOutbound, testAllOutbounds, saveAll, diff --git a/frontend/src/layouts/PanelLayout.tsx b/frontend/src/layouts/PanelLayout.tsx new file mode 100644 index 00000000..bbecf636 --- /dev/null +++ b/frontend/src/layouts/PanelLayout.tsx @@ -0,0 +1,10 @@ +import { Outlet } from 'react-router-dom'; + +import { useWebSocketBridge } from '@/api/websocketBridge'; +import { usePageTitle } from '@/hooks/usePageTitle'; + +export default function PanelLayout() { + useWebSocketBridge(); + usePageTitle(); + return ; +} diff --git a/frontend/src/entries/api-docs.tsx b/frontend/src/main.tsx similarity index 71% rename from frontend/src/entries/api-docs.tsx rename to frontend/src/main.tsx index 9a32c5cd..a4da5109 100644 --- a/frontend/src/entries/api-docs.tsx +++ b/frontend/src/main.tsx @@ -1,15 +1,15 @@ import { createRoot } from 'react-dom/client'; +import { RouterProvider } from 'react-router-dom'; import { message } from 'antd'; import 'antd/dist/reset.css'; import { setupAxios } from '@/api/axios-init.js'; -import { applyDocumentTitle } from '@/utils'; import { readyI18n } from '@/i18n/react'; import { ThemeProvider } from '@/hooks/useTheme'; -import ApiDocsPage from '@/pages/api-docs/ApiDocsPage'; +import { QueryProvider } from '@/api/QueryProvider'; +import { router } from '@/routes'; setupAxios(); -applyDocumentTitle(); const messageContainer = document.getElementById('message'); if (messageContainer) { @@ -21,7 +21,9 @@ readyI18n().then(() => { if (root) { createRoot(root).render( - + + + , ); } diff --git a/frontend/src/pages/api-docs/ApiDocsPage.css b/frontend/src/pages/api-docs/ApiDocsPage.css index 5bc3365d..f6ac4f7b 100644 --- a/frontend/src/pages/api-docs/ApiDocsPage.css +++ b/frontend/src/pages/api-docs/ApiDocsPage.css @@ -8,11 +8,28 @@ .api-docs-page.is-dark { --bg-page: #1a1b1f; --bg-card: #23252b; + --sw-bg: #1f2026; + --sw-bg-soft: #25272e; + --sw-bg-input: #15161a; + --sw-bg-code: #0d0e12; + --sw-border: rgba(255, 255, 255, 0.08); + --sw-border-strong: rgba(255, 255, 255, 0.15); + --sw-text: rgba(255, 255, 255, 0.88); + --sw-text-muted: rgba(255, 255, 255, 0.6); + --sw-text-dim: rgba(255, 255, 255, 0.45); + --sw-accent: #58a6ff; + color-scheme: dark; } .api-docs-page.is-dark.is-ultra { --bg-page: #000; --bg-card: #101013; + --sw-bg: #0a0a0d; + --sw-bg-soft: #131316; + --sw-bg-input: #050507; + --sw-bg-code: #000; + --sw-border: rgba(255, 255, 255, 0.06); + --sw-border-strong: rgba(255, 255, 255, 0.12); } .api-docs-page .content-shell { @@ -20,273 +37,396 @@ } .api-docs-page .content-area { - padding: 24px; + padding: 16px; max-width: 100%; } @media (max-width: 768px) { .api-docs-page .content-area { - padding: 16px 12px 12px; - padding-top: 64px; + padding: 8px; + padding-top: 56px; } } -.docs-wrapper { - max-width: 1100px; - margin: 0 auto; -} - -.docs-header { - margin-bottom: 20px; - padding: 24px; +.api-docs-page .docs-wrapper { background: var(--bg-card); - border: 1px solid rgba(128, 128, 128, 0.12); - border-radius: 10px; -} - -.docs-title { - font-size: 28px; - font-weight: 800; - margin: 0 0 8px; - color: rgba(0, 0, 0, 0.88); - letter-spacing: -0.3px; -} - -.docs-lead { - margin: 0; - color: rgba(0, 0, 0, 0.65); - line-height: 1.65; - font-size: 14px; -} - -.docs-lead code, -.token-hint code { - background: rgba(128, 128, 128, 0.12); - padding: 1px 6px; - border-radius: 4px; - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 12.5px; -} - -.token-card, -.curl-card { - margin-bottom: 16px; -} - -.token-card-head { - display: flex; - align-items: center; - justify-content: space-between; - gap: 12px; - flex-wrap: wrap; - margin-bottom: 10px; - min-height: 32px; -} - -.token-card-title { - display: inline-flex; - align-items: center; - gap: 8px; - font-weight: 600; - font-size: 14px; -} - -.token-hint { - margin: 10px 0 0; - color: rgba(0, 0, 0, 0.55); - font-size: 12.5px; - line-height: 1.55; -} - -.toolbar { - display: flex; - align-items: center; - gap: 12px; - flex-wrap: wrap; - margin-bottom: 16px; -} - -.search-bar { - flex: 1; - min-width: 200px; - max-width: 480px; -} - -.match-count { - font-size: 12px; - color: rgba(0, 0, 0, 0.5); - white-space: nowrap; -} - -.toc-nav { - display: flex; - flex-wrap: wrap; - align-items: flex-start; - gap: 8px 12px; - padding: 12px 16px; - background: var(--bg-card); - border: 1px solid rgba(128, 128, 128, 0.12); border-radius: 8px; - margin-bottom: 16px; + border: 1px solid rgba(128, 128, 128, 0.12); + overflow: hidden; } -.toc-label { - font-size: 11px; - font-weight: 600; - text-transform: uppercase; - letter-spacing: 0.6px; - color: rgba(0, 0, 0, 0.5); - padding-top: 3px; - flex-shrink: 0; +.api-docs-page .swagger-ui { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; } -.toc-links { - display: flex; - flex-wrap: wrap; - gap: 6px; +/* ────────────────────────────────────────────────────────────────── + Dark mode — Swagger UI does not ship a dark theme, so every visual + surface needs an explicit override. Method-color chips (GET / POST / + …) are left untouched because they carry meaning at a glance. + ────────────────────────────────────────────────────────────────── */ + +.api-docs-page.is-dark .swagger-ui, +.api-docs-page.is-dark .swagger-ui .info .title, +.api-docs-page.is-dark .swagger-ui .info .title small pre, +.api-docs-page.is-dark .swagger-ui .info p, +.api-docs-page.is-dark .swagger-ui .info li, +.api-docs-page.is-dark .swagger-ui .info table, +.api-docs-page.is-dark .swagger-ui .opblock-tag, +.api-docs-page.is-dark .swagger-ui .opblock-tag small, +.api-docs-page.is-dark .swagger-ui .opblock .opblock-summary-path, +.api-docs-page.is-dark .swagger-ui .opblock .opblock-summary-path__deprecated, +.api-docs-page.is-dark .swagger-ui .opblock .opblock-summary-description, +.api-docs-page.is-dark .swagger-ui .opblock-description-wrapper p, +.api-docs-page.is-dark .swagger-ui .opblock-external-docs-wrapper p, +.api-docs-page.is-dark .swagger-ui .opblock-title_normal p, +.api-docs-page.is-dark .swagger-ui table thead tr td, +.api-docs-page.is-dark .swagger-ui table thead tr th, +.api-docs-page.is-dark .swagger-ui table tbody tr td, +.api-docs-page.is-dark .swagger-ui .parameter__name, +.api-docs-page.is-dark .swagger-ui .parameter__type, +.api-docs-page.is-dark .swagger-ui .parameter__in, +.api-docs-page.is-dark .swagger-ui .parameter__extension, +.api-docs-page.is-dark .swagger-ui .response-col_status, +.api-docs-page.is-dark .swagger-ui .response-col_description, +.api-docs-page.is-dark .swagger-ui .response-col_links, +.api-docs-page.is-dark .swagger-ui .responses-inner h4, +.api-docs-page.is-dark .swagger-ui .responses-inner h5, +.api-docs-page.is-dark .swagger-ui label, +.api-docs-page.is-dark .swagger-ui .tab li, +.api-docs-page.is-dark .swagger-ui .tab li button, +.api-docs-page.is-dark .swagger-ui .markdown, +.api-docs-page.is-dark .swagger-ui .markdown p, +.api-docs-page.is-dark .swagger-ui .markdown li, +.api-docs-page.is-dark .swagger-ui .renderedmarkdown p, +.api-docs-page.is-dark .swagger-ui .renderedmarkdown li, +.api-docs-page.is-dark .swagger-ui .model-title, +.api-docs-page.is-dark .swagger-ui .model, +.api-docs-page.is-dark .swagger-ui .model-toggle:after, +.api-docs-page.is-dark .swagger-ui section.models h4, +.api-docs-page.is-dark .swagger-ui section.models h5, +.api-docs-page.is-dark .swagger-ui .auth-container h4, +.api-docs-page.is-dark .swagger-ui .auth-container h6, +.api-docs-page.is-dark .swagger-ui .scopes h2, +.api-docs-page.is-dark .swagger-ui .dialog-ux .modal-ux-header h3, +.api-docs-page.is-dark .swagger-ui .dialog-ux .modal-ux-content h4, +.api-docs-page.is-dark .swagger-ui .dialog-ux .modal-ux-content p, +.api-docs-page.is-dark .swagger-ui .servers-title { + color: var(--sw-text); } -.toc-link { - display: inline-flex; - align-items: center; - gap: 5px; - padding: 4px 10px; - border-radius: 20px; - font-size: 12.5px; - color: rgba(0, 0, 0, 0.65); - background: rgba(128, 128, 128, 0.06); - border: 1px solid transparent; - text-decoration: none; - cursor: pointer; - transition: all 0.2s; - white-space: nowrap; +.api-docs-page.is-dark .swagger-ui .opblock-tag small, +.api-docs-page.is-dark .swagger-ui .opblock-summary-description, +.api-docs-page.is-dark .swagger-ui .parameter__in, +.api-docs-page.is-dark .swagger-ui .parameter__type, +.api-docs-page.is-dark .swagger-ui .parameter__extension, +.api-docs-page.is-dark .swagger-ui .opblock-title_normal small, +.api-docs-page.is-dark .swagger-ui .servers > label, +.api-docs-page.is-dark .swagger-ui .servers > label span, +.api-docs-page.is-dark .swagger-ui .response-control-media-type__accept-message { + color: var(--sw-text-muted); } -.toc-link:hover { - background: rgba(22, 119, 255, 0.08); - color: #1677ff; - border-color: rgba(22, 119, 255, 0.2); +.api-docs-page.is-dark .swagger-ui .opblock-tag { + border-bottom-color: var(--sw-border); } -.toc-link.active { - background: rgba(22, 119, 255, 0.12); - color: #1677ff; - border-color: rgba(22, 119, 255, 0.3); - font-weight: 600; +.api-docs-page.is-dark .swagger-ui .opblock { + background: var(--sw-bg-soft); + border-color: var(--sw-border); + box-shadow: none; } -.toc-icon { - font-size: 13px; - opacity: 0.8; +.api-docs-page.is-dark .swagger-ui .opblock .opblock-section-header { + background: rgba(255, 255, 255, 0.03); + box-shadow: inset 0 -1px 0 var(--sw-border); } -.toc-text { - font-size: 12.5px; +.api-docs-page.is-dark .swagger-ui .opblock .opblock-section-header h4, +.api-docs-page.is-dark .swagger-ui .opblock .opblock-section-header label { + color: var(--sw-text); } -.toc-badge { - display: inline-flex; - align-items: center; - justify-content: center; - min-width: 18px; - height: 18px; - padding: 0 5px; - border-radius: 9px; - font-size: 10.5px; - font-weight: 700; - background: rgba(22, 119, 255, 0.12); - color: #1677ff; - line-height: 1; +.api-docs-page.is-dark .swagger-ui .opblock .opblock-summary { + border-bottom-color: var(--sw-border); } -.toc-link.active .toc-badge { - background: #1677ff; - color: #fff; -} - -body.dark .docs-title { +.api-docs-page.is-dark .swagger-ui .opblock-body pre.microlight, +.api-docs-page.is-dark .swagger-ui .highlight-code, +.api-docs-page.is-dark .swagger-ui .microlight, +.api-docs-page.is-dark .swagger-ui pre.example, +.api-docs-page.is-dark .swagger-ui code { + background: var(--sw-bg-code); color: rgba(255, 255, 255, 0.92); } -html[data-theme='ultra-dark'] .docs-title { - color: rgba(255, 255, 255, 0.95); -} - -body.dark .docs-header { - background: #252526; - border-color: rgba(255, 255, 255, 0.08); -} - -html[data-theme='ultra-dark'] .docs-header { - background: #0a0a0a; - border-color: rgba(255, 255, 255, 0.06); -} - -body.dark .docs-lead, -body.dark .token-hint { - color: rgba(255, 255, 255, 0.7); -} - -html[data-theme='ultra-dark'] .docs-lead, -html[data-theme='ultra-dark'] .token-hint { - color: rgba(255, 255, 255, 0.75); -} - -body.dark .docs-lead code, -body.dark .token-hint code { - background: rgba(255, 255, 255, 0.1); -} - -html[data-theme='ultra-dark'] .docs-lead code, -html[data-theme='ultra-dark'] .token-hint code { - background: rgba(255, 255, 255, 0.12); -} - -body.dark .toc-nav { - background: #252526; - border-color: rgba(255, 255, 255, 0.08); -} - -html[data-theme='ultra-dark'] .toc-nav { - background: #0a0a0a; - border-color: rgba(255, 255, 255, 0.06); -} - -body.dark .toc-label { - color: rgba(255, 255, 255, 0.55); -} - -html[data-theme='ultra-dark'] .toc-label { - color: rgba(255, 255, 255, 0.6); -} - -body.dark .toc-link { - color: rgba(255, 255, 255, 0.65); +.api-docs-page.is-dark .swagger-ui .highlight-code .copy-to-clipboard { background: rgba(255, 255, 255, 0.06); } -html[data-theme='ultra-dark'] .toc-link { +.api-docs-page.is-dark .swagger-ui input[type=text], +.api-docs-page.is-dark .swagger-ui input[type=password], +.api-docs-page.is-dark .swagger-ui input[type=search], +.api-docs-page.is-dark .swagger-ui input[type=email], +.api-docs-page.is-dark .swagger-ui input[type=file], +.api-docs-page.is-dark .swagger-ui textarea { + background: var(--sw-bg-input); + color: var(--sw-text); + border-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui select { + background-color: var(--sw-bg-input); + background-image: url("data:image/svg+xml;charset=utf-8,"); + background-position: right 10px center; + background-repeat: no-repeat; + background-size: 20px; + color: var(--sw-text); + border-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui select option { + background-color: var(--sw-bg-input); + color: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui textarea { + font-family: ui-monospace, SFMono-Regular, Menlo, monospace; +} + +.api-docs-page.is-dark .swagger-ui input::placeholder, +.api-docs-page.is-dark .swagger-ui textarea::placeholder { + color: var(--sw-text-dim); +} + +.api-docs-page.is-dark .swagger-ui .scheme-container { + background: var(--sw-bg-soft); + box-shadow: inset 0 -1px 0 var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui .auth-wrapper .authorize { + color: var(--sw-text); + border-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui .auth-wrapper .authorize svg { + fill: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui .model-box, +.api-docs-page.is-dark .swagger-ui section.models { + background: var(--sw-bg-soft); + border-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui section.models.is-open h4 { + border-bottom-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui section.models .model-container { + background: rgba(255, 255, 255, 0.02); + border-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui section.models .model-container:hover { background: rgba(255, 255, 255, 0.04); } -body.dark .toc-link:hover { - background: rgba(88, 166, 255, 0.12); - color: #58a6ff; - border-color: rgba(88, 166, 255, 0.25); +.api-docs-page.is-dark .swagger-ui .prop-type, +.api-docs-page.is-dark .swagger-ui .prop-format { + color: var(--sw-accent); } -body.dark .toc-link.active { - background: rgba(88, 166, 255, 0.15); - color: #58a6ff; - border-color: rgba(88, 166, 255, 0.35); +.api-docs-page.is-dark .swagger-ui .property.primitive { + color: var(--sw-text-muted); } -body.dark .toc-badge { - background: rgba(88, 166, 255, 0.15); - color: #58a6ff; +.api-docs-page.is-dark .swagger-ui .opblock-title_normal h4 { + color: var(--sw-text); + border-bottom-color: var(--sw-border); } -body.dark .toc-link.active .toc-badge { - background: #58a6ff; +.api-docs-page.is-dark .swagger-ui table.parameters, +.api-docs-page.is-dark .swagger-ui table.responses-table, +.api-docs-page.is-dark .swagger-ui table thead tr { + border-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui table tbody tr td { + border-bottom-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui table thead tr { + border-bottom-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui .response-col_status { + font-weight: 600; +} + +.api-docs-page.is-dark .swagger-ui .btn { + background: rgba(255, 255, 255, 0.06); + color: var(--sw-text); + border-color: var(--sw-border-strong); + box-shadow: none; +} + +.api-docs-page.is-dark .swagger-ui .btn:hover { + background: rgba(255, 255, 255, 0.1); +} + +.api-docs-page.is-dark .swagger-ui .btn.execute { + background: var(--sw-accent); color: #0d1117; + border-color: var(--sw-accent); +} + +.api-docs-page.is-dark .swagger-ui .btn.execute:hover { + background: #79b9ff; +} + +.api-docs-page.is-dark .swagger-ui .btn.authorize { + color: #52c41a; + border-color: rgba(82, 196, 26, 0.4); + background: rgba(82, 196, 26, 0.08); +} + +.api-docs-page.is-dark .swagger-ui .btn.authorize svg { + fill: #52c41a; +} + +.api-docs-page.is-dark .swagger-ui .authorization__btn svg, +.api-docs-page.is-dark .swagger-ui .expand-operation svg, +.api-docs-page.is-dark .swagger-ui .opblock-control-arrow svg { + fill: var(--sw-text); + opacity: 1; +} + +.api-docs-page.is-dark .swagger-ui .authorization__btn .locked, +.api-docs-page.is-dark .swagger-ui .authorization__btn .unlocked { + opacity: 1; +} + +.api-docs-page.is-dark .swagger-ui .btn.cancel { + color: #ff7875; + border-color: rgba(255, 120, 117, 0.4); + background: rgba(255, 120, 117, 0.08); +} + +.api-docs-page.is-dark .swagger-ui .btn.btn-clear, +.api-docs-page.is-dark .swagger-ui .btn-clear, +.api-docs-page.is-dark .swagger-ui .try-out__btn { + color: var(--sw-text); + background: rgba(255, 255, 255, 0.06); + border-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui .btn.btn-clear:hover, +.api-docs-page.is-dark .swagger-ui .btn-clear:hover, +.api-docs-page.is-dark .swagger-ui .try-out__btn:hover { + background: rgba(255, 255, 255, 0.1); +} + +.api-docs-page.is-dark .swagger-ui .filter .operation-filter-input { + background: var(--sw-bg-input); + border-color: var(--sw-border-strong); + color: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui .dialog-ux .modal-ux { + background: var(--sw-bg); + border-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui .dialog-ux .modal-ux-header { + border-bottom-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui .dialog-ux .modal-ux-content { + color: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui .arrow, +.api-docs-page.is-dark .swagger-ui svg.arrow { + fill: var(--sw-text-muted); +} + +.api-docs-page.is-dark .swagger-ui .opblock-summary-control:focus { + outline-color: var(--sw-accent); +} + +.api-docs-page.is-dark .swagger-ui a, +.api-docs-page.is-dark .swagger-ui .info a, +.api-docs-page.is-dark .swagger-ui .info hgroup.main a, +.api-docs-page.is-dark .swagger-ui .info .base-url, +.api-docs-page.is-dark .swagger-ui .info__contact a, +.api-docs-page.is-dark .swagger-ui .info__license a, +.api-docs-page.is-dark .swagger-ui .info__tos a { + color: var(--sw-accent); +} + +.api-docs-page.is-dark .swagger-ui a:hover { + color: #79b9ff; +} + +.api-docs-page.is-dark .swagger-ui .info .title small { + background: rgba(255, 255, 255, 0.08); + color: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui .info .title small pre { + color: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui .response-control-media-type--accept-controller select { + border-color: rgba(82, 196, 26, 0.5); +} + +.api-docs-page.is-dark .swagger-ui .loading-container .loading:before { + border-color: var(--sw-accent) transparent transparent; +} + +.api-docs-page.is-dark .swagger-ui .json-schema-form-item input, +.api-docs-page.is-dark .swagger-ui .json-schema-form-item select { + background: var(--sw-bg-input); + color: var(--sw-text); + border-color: var(--sw-border-strong); +} + +.api-docs-page.is-dark .swagger-ui .topbar { + background: var(--sw-bg); +} + +.api-docs-page.is-dark .swagger-ui .information-container { + background: transparent; +} + +.api-docs-page.is-dark .swagger-ui .opblock-summary-method { + text-shadow: none; +} + +.api-docs-page.is-dark .swagger-ui .auth-btn-wrapper { + border-top-color: var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui .servers .computed-url, +.api-docs-page.is-dark .swagger-ui .computed-url { + background: var(--sw-bg-code); + color: var(--sw-text); + border: 1px solid var(--sw-border); +} + +.api-docs-page.is-dark .swagger-ui .computed-url code, +.api-docs-page.is-dark .swagger-ui .servers .computed-url code { + background: transparent; + color: var(--sw-text); +} + +.api-docs-page.is-dark .swagger-ui .errors-wrapper { + background: rgba(255, 77, 79, 0.08); + border-color: rgba(255, 77, 79, 0.3); +} + +.api-docs-page.is-dark .swagger-ui .errors-wrapper .errors h4, +.api-docs-page.is-dark .swagger-ui .errors-wrapper .errors small { + color: var(--sw-text); } diff --git a/frontend/src/pages/api-docs/ApiDocsPage.tsx b/frontend/src/pages/api-docs/ApiDocsPage.tsx index 4d82c1a3..e708b45c 100644 --- a/frontend/src/pages/api-docs/ApiDocsPage.tsx +++ b/frontend/src/pages/api-docs/ApiDocsPage.tsx @@ -1,143 +1,19 @@ -import { useCallback, useEffect, useMemo, useState } from 'react'; -import type { ComponentType, MouseEvent } from 'react'; -import { Button, Card, ConfigProvider, Input, Layout, Space } from 'antd'; -import { - ApiOutlined, - CloudServerOutlined, - ClusterOutlined, - CompressOutlined, - ExpandOutlined, - GlobalOutlined, - KeyOutlined, - LinkOutlined, - NodeIndexOutlined, - SafetyCertificateOutlined, - SaveOutlined, - SearchOutlined, - SettingOutlined, - WifiOutlined, -} from '@ant-design/icons'; +import { useMemo } from 'react'; +import { ConfigProvider, Layout } from 'antd'; +import SwaggerUI from 'swagger-ui-react'; +import 'swagger-ui-react/swagger-ui.css'; import { useTheme } from '@/hooks/useTheme'; import AppSidebar from '@/components/AppSidebar'; -import { sections as allSections } from './endpoints.js'; -import EndpointSection from './EndpointSection'; -import type { Section } from './EndpointSection'; -import CodeBlock from './CodeBlock'; import '@/styles/page-cards.css'; import './ApiDocsPage.css'; -const sectionIcons: Record> = { - authentication: SafetyCertificateOutlined, - inbounds: NodeIndexOutlined, - server: CloudServerOutlined, - nodes: ClusterOutlined, - 'custom-geo': GlobalOutlined, - backup: SaveOutlined, - settings: SettingOutlined, - 'api-tokens': KeyOutlined, - 'xray-settings': WifiOutlined, - subscription: LinkOutlined, - websocket: ApiOutlined, -}; - -const curlExample = `curl -X GET \\ - -H "Authorization: Bearer YOUR_API_TOKEN" \\ - -H "Accept: application/json" \\ - https://your-panel.example.com/panel/api/inbounds/list`; - const basePath = window.X_UI_BASE_PATH || ''; -const requestUri = window.location.pathname; -const settingsHref = `${basePath}panel/settings#security`; - -const endpointCount = (allSections as Section[]).reduce( - (sum, s) => sum + s.endpoints.length, - 0, -); +const openApiUrl = `${basePath}panel/api/openapi.json`; export default function ApiDocsPage() { const { isDark, isUltra, antdThemeConfig } = useTheme(); - const [searchQuery, setSearchQuery] = useState(''); - const [collapsedSections, setCollapsedSections] = useState>(() => new Set()); - const [activeSection, setActiveSection] = useState(''); - - const sections = useMemo(() => { - const q = searchQuery.toLowerCase().trim(); - if (!q) return allSections as Section[]; - return (allSections as Section[]) - .map((s) => ({ - ...s, - endpoints: s.endpoints.filter((e) => - e.path.toLowerCase().includes(q) - || e.summary?.toLowerCase().includes(q) - || e.method.toLowerCase().includes(q), - ), - })) - .filter((s) => s.endpoints.length > 0); - }, [searchQuery]); - - const visibleEndpoints = useMemo( - () => sections.reduce((sum, s) => sum + s.endpoints.length, 0), - [sections], - ); - - const toggleSection = useCallback((id: string) => { - setCollapsedSections((prev) => { - const next = new Set(prev); - if (next.has(id)) next.delete(id); else next.add(id); - return next; - }); - }, []); - - const expandAll = useCallback(() => setCollapsedSections(new Set()), []); - const collapseAll = useCallback( - () => setCollapsedSections(new Set((allSections as Section[]).map((s) => s.id))), - [], - ); - - const scrollToSection = useCallback((id: string) => (e: MouseEvent) => { - e.preventDefault(); - const el = document.getElementById(id); - if (!el) return; - el.scrollIntoView({ behavior: 'smooth', block: 'start' }); - if (window.location.hash !== `#${id}`) { - history.replaceState(null, '', `#${id}`); - } - }, []); - - useEffect(() => { - const onHashChange = () => { - const id = window.location.hash.slice(1); - if (!id) return; - const el = document.getElementById(id); - if (el) el.scrollIntoView({ behavior: 'auto', block: 'start' }); - }; - requestAnimationFrame(onHashChange); - window.addEventListener('hashchange', onHashChange); - return () => window.removeEventListener('hashchange', onHashChange); - }, []); - - useEffect(() => { - const onScroll = () => { - const toc = document.querySelector('.toc-nav'); - const tocHeight = toc instanceof HTMLElement ? toc.offsetHeight : 56; - let current = ''; - for (const s of sections) { - const el = document.getElementById(s.id); - if (!el) continue; - const rect = el.getBoundingClientRect(); - if (rect.top <= tocHeight + 20) { - current = s.id; - } - } - setActiveSection(current); - }; - window.addEventListener('scroll', onScroll, { passive: true }); - requestAnimationFrame(onScroll); - return () => window.removeEventListener('scroll', onScroll); - }, [sections]); - const pageClass = useMemo(() => { const classes = ['api-docs-page']; if (isDark) classes.push('is-dark'); @@ -148,96 +24,17 @@ export default function ApiDocsPage() { return ( - +
-
-

API Documentation

-

- The 3x-ui panel exposes a REST API under /panel/api/. Authenticate with the panel session - cookie, or with the Authorization: Bearer <token> header below. Every endpoint - returns a uniform {'{ success, msg, obj }'} envelope unless otherwise noted. -

-
- - -
-
- - API Tokens -
- -
-

- Create, enable, or revoke named Bearer tokens in{' '} - Settings → Security. Send each request as{' '} - Authorization: Bearer <token>. Token-authenticated callers skip CSRF and don't - need a session cookie. Deleting a token revokes it immediately — running bots will need a new one. -

-
- - - - - -
- } - placeholder="Search endpoints by path, method, or description…" - allowClear - value={searchQuery} - onChange={(e) => setSearchQuery(e.target.value)} - /> - {searchQuery && ( - - {visibleEndpoints} / {endpointCount} endpoints - - )} - - - - -
- - - - {sections.map((s) => ( - toggleSection(s.id)} - /> - ))} +
diff --git a/frontend/src/pages/api-docs/CodeBlock.css b/frontend/src/pages/api-docs/CodeBlock.css deleted file mode 100644 index 5cf64ceb..00000000 --- a/frontend/src/pages/api-docs/CodeBlock.css +++ /dev/null @@ -1,107 +0,0 @@ -.code-block-wrapper { - position: relative; - border-radius: 6px; - overflow: hidden; - border: 1px solid rgba(128, 128, 128, 0.15); -} - -.code-toolbar { - display: flex; - align-items: center; - justify-content: space-between; - padding: 4px 8px; - background: rgba(128, 128, 128, 0.06); - border-bottom: 1px solid rgba(128, 128, 128, 0.1); -} - -.lang-badge { - font-size: 10px; - font-weight: 700; - letter-spacing: 0.5px; - color: rgba(0, 0, 0, 0.4); - text-transform: uppercase; - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; -} - -.copy-btn { - display: inline-flex; - align-items: center; - justify-content: center; - width: 26px; - height: 26px; - border: 1px solid rgba(128, 128, 128, 0.15); - border-radius: 4px; - background: rgba(255, 255, 255, 0.7); - color: rgba(0, 0, 0, 0.45); - cursor: pointer; - font-size: 12px; - transition: all 0.15s; -} - -.copy-btn:hover { - background: #fff; - color: #1677ff; - border-color: #1677ff; -} - -.copy-btn.copied { - background: #52c41a; - color: #fff; - border-color: #52c41a; -} - -.code-block { - background: rgba(128, 128, 128, 0.04); - padding: 10px 12px; - margin: 0; - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 12.5px; - line-height: 1.6; - white-space: pre-wrap; - word-break: break-word; - overflow-x: auto; - border: none; - border-radius: 0; -} - -.json-key { color: #0550ae; } -.json-string { color: #116329; } -.json-number { color: #9a6700; } -.json-boolean { color: #cf222e; } -.json-null { color: #8250df; } - -body.dark .code-block-wrapper { - border-color: rgba(255, 255, 255, 0.1); -} - -body.dark .code-toolbar { - background: rgba(255, 255, 255, 0.03); - border-color: rgba(255, 255, 255, 0.06); -} - -body.dark .lang-badge { - color: rgba(255, 255, 255, 0.4); -} - -body.dark .code-block { - background: rgba(255, 255, 255, 0.03); - color: rgba(255, 255, 255, 0.88); -} - -body.dark .json-key { color: #79c0ff; } -body.dark .json-string { color: #7ee787; } -body.dark .json-number { color: #d29922; } -body.dark .json-boolean { color: #ff7b72; } -body.dark .json-null { color: #d2a8ff; } - -body.dark .copy-btn { - background: rgba(255, 255, 255, 0.06); - color: rgba(255, 255, 255, 0.45); - border-color: rgba(255, 255, 255, 0.12); -} - -body.dark .copy-btn:hover { - background: rgba(255, 255, 255, 0.1); - color: #58a6ff; - border-color: #58a6ff; -} diff --git a/frontend/src/pages/api-docs/CodeBlock.tsx b/frontend/src/pages/api-docs/CodeBlock.tsx deleted file mode 100644 index 805d1378..00000000 --- a/frontend/src/pages/api-docs/CodeBlock.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { useMemo, useState } from 'react'; -import { message } from 'antd'; -import { CheckOutlined, CopyOutlined } from '@ant-design/icons'; -import { ClipboardManager } from '@/utils'; -import './CodeBlock.css'; - -interface CodeBlockProps { - code?: string; - lang?: string; -} - -function escapeHtml(str: string): string { - return str.replace(/&/g, '&').replace(//g, '>'); -} - -function highlightJson(str: string): string { - const escaped = escapeHtml(str); - return escaped.replace( - /("(?:[^"\\]|\\.)*")\s*(:)|("(?:[^"\\]|\\.)*")|(-?\d+\.?\d*(?:[eE][+-]?\d+)?)\b|(true|false)|(null)|([{}[\]])/g, - (_m, key, colon, string, number, bool, nil) => { - if (colon) return `${key}${colon}`; - if (string) return `${string}`; - if (number) return `${number}`; - if (bool) return `${bool}`; - if (nil) return `${nil}`; - return _m; - }, - ); -} - -export default function CodeBlock({ code = '', lang = 'json' }: CodeBlockProps) { - const [copied, setCopied] = useState(false); - const [messageApi, messageContextHolder] = message.useMessage(); - - const highlighted = useMemo( - () => (lang === 'json' ? highlightJson(code) : escapeHtml(code)), - [code, lang], - ); - - async function copyCode() { - const ok = await ClipboardManager.copyText(code); - if (ok) { - setCopied(true); - messageApi.success('Copied'); - window.setTimeout(() => setCopied(false), 2000); - } else { - messageApi.error('Copy failed'); - } - } - - return ( -
- {messageContextHolder} -
- {lang.toUpperCase()} - -
-
-        
-      
-
- ); -} diff --git a/frontend/src/pages/api-docs/EndpointRow.css b/frontend/src/pages/api-docs/EndpointRow.css deleted file mode 100644 index 43cd8c3f..00000000 --- a/frontend/src/pages/api-docs/EndpointRow.css +++ /dev/null @@ -1,93 +0,0 @@ -.endpoint-row { - padding: 14px 8px; - margin: 0 -8px; - transition: background 0.15s; - border-radius: 6px; -} - -.endpoint-row:hover { - background: rgba(128, 128, 128, 0.03); -} - -.endpoint-row + .endpoint-row { - border-top: 1px solid rgba(128, 128, 128, 0.1); -} - -.endpoint-header { - display: flex; - align-items: center; - gap: 10px; - flex-wrap: wrap; -} - -.method-tag { - font-weight: 700; - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 11px; - letter-spacing: 0.5px; - min-width: 56px; - text-align: center; - text-transform: uppercase; - border-radius: 4px; - padding: 2px 8px; - line-height: 1.6; -} - -.endpoint-path { - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 13.5px; - word-break: break-all; - color: rgba(0, 0, 0, 0.8); - background: rgba(128, 128, 128, 0.06); - padding: 2px 8px; - border-radius: 4px; -} - -.endpoint-summary { - margin: 8px 0 0; - color: rgba(0, 0, 0, 0.6); - line-height: 1.6; - font-size: 13.5px; -} - -.endpoint-block { - margin-top: 14px; -} - -.block-label { - font-size: 11px; - font-weight: 600; - text-transform: uppercase; - letter-spacing: 0.6px; - color: rgba(0, 0, 0, 0.45); - margin-bottom: 6px; -} - -.error-label { - color: #cf222e; -} - -body.dark .endpoint-row:hover { - background: rgba(255, 255, 255, 0.02); -} - -body.dark .endpoint-row + .endpoint-row { - border-top-color: rgba(255, 255, 255, 0.08); -} - -body.dark .endpoint-path { - color: rgba(255, 255, 255, 0.82); - background: rgba(255, 255, 255, 0.05); -} - -body.dark .endpoint-summary { - color: rgba(255, 255, 255, 0.65); -} - -body.dark .block-label { - color: rgba(255, 255, 255, 0.45); -} - -body.dark .error-label { - color: #ff7b72; -} diff --git a/frontend/src/pages/api-docs/EndpointRow.tsx b/frontend/src/pages/api-docs/EndpointRow.tsx deleted file mode 100644 index d7fd7ad2..00000000 --- a/frontend/src/pages/api-docs/EndpointRow.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { Table, Tag } from 'antd'; -import type { ColumnsType } from 'antd/es/table'; -import { methodColors, safeInlineHtml } from './endpoints.js'; -import CodeBlock from './CodeBlock'; -import './EndpointRow.css'; - -interface Param { - name: string; - in?: string; - type?: string; - desc?: string; -} - -export interface Endpoint { - method: string; - path: string; - summary?: string; - params?: Param[]; - body?: string; - response?: string; - errorResponse?: string; -} - -const paramColumns: ColumnsType = [ - { title: 'Name', dataIndex: 'name', key: 'name', width: 180 }, - { title: 'In', dataIndex: 'in', key: 'in', width: 100 }, - { title: 'Type', dataIndex: 'type', key: 'type', width: 120 }, - { title: 'Description', dataIndex: 'desc', key: 'desc' }, -]; - -export default function EndpointRow({ endpoint }: { endpoint: Endpoint }) { - const tagColor = (methodColors as Record)[endpoint.method] || 'default'; - const hasParams = Array.isArray(endpoint.params) && endpoint.params.length > 0; - - return ( -
-
- {endpoint.method} - {endpoint.path} -
- - {endpoint.summary && ( -

- )} - - {hasParams && ( -

-
Parameters
- - - )} - - {endpoint.body && ( -
-
Request body
- -
- )} - - {endpoint.response && ( -
-
Response
- -
- )} - - {endpoint.errorResponse && ( -
-
Error response
- -
- )} - - ); -} diff --git a/frontend/src/pages/api-docs/EndpointSection.css b/frontend/src/pages/api-docs/EndpointSection.css deleted file mode 100644 index f6a54568..00000000 --- a/frontend/src/pages/api-docs/EndpointSection.css +++ /dev/null @@ -1,129 +0,0 @@ -.api-section { - background: #fff; - border: 1px solid rgba(128, 128, 128, 0.12); - border-radius: 8px; - padding: 20px 24px; - margin-bottom: 16px; - transition: box-shadow 0.2s, border-color 0.2s; -} - -.api-section:hover { - box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); -} - -.section-header { - display: flex; - align-items: center; - justify-content: space-between; - cursor: pointer; - user-select: none; -} - -.section-header:hover .collapse-icon, -.section-header:hover .section-icon { - color: #1677ff; -} - -.section-header-left { - display: flex; - align-items: center; - gap: 10px; -} - -.collapse-icon { - font-size: 12px; - color: rgba(0, 0, 0, 0.4); - transition: color 0.2s; -} - -.section-icon { - font-size: 18px; - color: rgba(0, 0, 0, 0.45); - transition: color 0.2s; -} - -.section-title { - font-size: 20px; - font-weight: 700; - margin: 0; - color: rgba(0, 0, 0, 0.88); -} - -.endpoint-count { - font-size: 11px; - font-weight: 600; - color: rgba(0, 0, 0, 0.45); - white-space: nowrap; - background: rgba(128, 128, 128, 0.08); - padding: 3px 10px; - border-radius: 12px; - text-transform: uppercase; - letter-spacing: 0.3px; -} - -.section-description { - margin: 12px 0 14px; - color: rgba(0, 0, 0, 0.65); - line-height: 1.6; -} - -.sub-header-block { - margin-bottom: 14px; -} - -.section-block-label { - font-size: 12px; - font-weight: 600; - text-transform: uppercase; - letter-spacing: 0.5px; - color: rgba(0, 0, 0, 0.5); - margin-bottom: 6px; -} - -.endpoints { - padding-top: 8px; - border-top: 1px solid rgba(128, 128, 128, 0.1); -} - -.endpoints > :first-child { - padding-top: 0; -} - -body.dark .api-section { - background: #252526; - border-color: rgba(255, 255, 255, 0.08); -} - -body.dark .api-section:hover { - box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25); -} - -html[data-theme='ultra-dark'] .api-section { - background: #0a0a0a; - border-color: rgba(255, 255, 255, 0.06); -} - -html[data-theme='ultra-dark'] .api-section:hover { - box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); -} - -body.dark .section-title { - color: rgba(255, 255, 255, 0.92); -} - -body.dark .section-icon { - color: rgba(255, 255, 255, 0.5); -} - -body.dark .section-description { - color: rgba(255, 255, 255, 0.7); -} - -body.dark .section-block-label { - color: rgba(255, 255, 255, 0.55); -} - -body.dark .endpoint-count { - color: rgba(255, 255, 255, 0.55); - background: rgba(255, 255, 255, 0.06); -} diff --git a/frontend/src/pages/api-docs/EndpointSection.tsx b/frontend/src/pages/api-docs/EndpointSection.tsx deleted file mode 100644 index 8b254d19..00000000 --- a/frontend/src/pages/api-docs/EndpointSection.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import type { ComponentType } from 'react'; -import { Table } from 'antd'; -import type { ColumnsType } from 'antd/es/table'; -import { DownOutlined, RightOutlined } from '@ant-design/icons'; -import EndpointRow from './EndpointRow'; -import type { Endpoint } from './EndpointRow'; -import { safeInlineHtml } from './endpoints.js'; -import './EndpointSection.css'; - -interface SubHeader { - name: string; - desc?: string; -} - -export interface Section { - id: string; - title: string; - description?: string; - endpoints: Endpoint[]; - subHeader?: SubHeader[]; -} - -interface EndpointSectionProps { - section: Section; - icon?: ComponentType<{ className?: string }> | null; - collapsed?: boolean; - onToggle?: () => void; -} - -const subHeaderColumns: ColumnsType = [ - { title: 'Header', dataIndex: 'name', key: 'name', width: 240 }, - { - title: 'Description', - dataIndex: 'desc', - key: 'desc', - render: (value: string) => ( - - ), - }, -]; - -export default function EndpointSection({ - section, - icon: Icon = null, - collapsed = false, - onToggle, -}: EndpointSectionProps) { - const endpointLabel = section.endpoints.length === 1 - ? '1 endpoint' - : `${section.endpoints.length} endpoints`; - - return ( -
-
-
- {collapsed ? : } - {Icon && } -

{section.title}

-
- {endpointLabel} -
- - {section.description && !collapsed && ( -

- )} - - {section.subHeader && !collapsed && ( -

-
Response headers
-
- - )} - -
- {section.endpoints.map((endpoint, idx) => ( - - ))} -
- - ); -} diff --git a/frontend/src/pages/clients/ClientsPage.tsx b/frontend/src/pages/clients/ClientsPage.tsx index f94ce883..0a024536 100644 --- a/frontend/src/pages/clients/ClientsPage.tsx +++ b/frontend/src/pages/clients/ClientsPage.tsx @@ -61,8 +61,6 @@ const ClientBulkAdjustModal = lazy(() => import('./ClientBulkAdjustModal')); import '@/styles/page-cards.css'; import './ClientsPage.css'; -const basePath = window.X_UI_BASE_PATH || ''; -const requestUri = window.location.pathname; const FILTER_STATE_KEY = 'clientsFilterState'; type Bucket = 'active' | 'deactive' | 'depleted' | 'expiring'; @@ -108,14 +106,13 @@ export default function ClientsPage() { ipLimitEnable, tgBotEnable, expireDiff, trafficDiff, pageSize, create, update, remove, removeMany, bulkAdjust, attach, detach, resetTraffic, resetAllTraffics, delDepleted, setEnable, - applyTrafficEvent, applyClientStatsEvent, applyInvalidate, + applyTrafficEvent, applyClientStatsEvent, hydrate, } = useClients(); useWebSocket({ traffic: applyTrafficEvent, client_stats: applyClientStatsEvent, - invalidate: applyInvalidate, }); const [togglingEmail, setTogglingEmail] = useState(null); @@ -614,7 +611,7 @@ export default function ClientsPage() { {messageContextHolder} {modalContextHolder} - + diff --git a/frontend/src/pages/inbounds/InboundFormModal.tsx b/frontend/src/pages/inbounds/InboundFormModal.tsx index 6c7213ec..1e0a9b39 100644 --- a/frontend/src/pages/inbounds/InboundFormModal.tsx +++ b/frontend/src/pages/inbounds/InboundFormModal.tsx @@ -60,7 +60,7 @@ import { DBInbound } from '@/models/dbinbound.js'; import FinalMaskForm from '@/components/FinalMaskForm'; import DateTimePicker from '@/components/DateTimePicker'; import JsonEditor from '@/components/JsonEditor'; -import type { NodeRecord } from '@/hooks/useNodes'; +import type { NodeRecord } from '@/api/queries/useNodesQuery'; import './InboundFormModal.css'; const { TextArea } = Input; diff --git a/frontend/src/pages/inbounds/InboundList.tsx b/frontend/src/pages/inbounds/InboundList.tsx index b2f9c75f..c73db4d3 100644 --- a/frontend/src/pages/inbounds/InboundList.tsx +++ b/frontend/src/pages/inbounds/InboundList.tsx @@ -33,7 +33,7 @@ import { import { HttpUtil, SizeFormatter, IntlUtil, ColorUtils } from '@/utils'; import InfinityIcon from '@/components/InfinityIcon'; import { useDatepicker } from '@/hooks/useDatepicker'; -import type { NodeRecord } from '@/hooks/useNodes'; +import type { NodeRecord } from '@/api/queries/useNodesQuery'; import './InboundList.css'; type ProtocolFlags = { diff --git a/frontend/src/pages/inbounds/InboundsPage.tsx b/frontend/src/pages/inbounds/InboundsPage.tsx index 1192cb2b..7cd570c5 100644 --- a/frontend/src/pages/inbounds/InboundsPage.tsx +++ b/frontend/src/pages/inbounds/InboundsPage.tsx @@ -25,7 +25,7 @@ import { coerceInboundJsonField } from '@/models/dbinbound.js'; import { useTheme } from '@/hooks/useTheme'; import { useMediaQuery } from '@/hooks/useMediaQuery'; import { useWebSocket } from '@/hooks/useWebSocket'; -import { useNodes } from '@/hooks/useNodes'; +import { useNodesQuery } from '@/api/queries/useNodesQuery'; import AppSidebar from '@/components/AppSidebar'; import CustomStatistic from '@/components/CustomStatistic'; const TextModal = lazy(() => import('@/components/TextModal')); @@ -74,20 +74,17 @@ export default function InboundsPage() { remarkModel, refresh, hydrateInbound, - fetchDefaultSettings, applyTrafficEvent, applyClientStatsEvent, - applyInvalidate, - applyInboundsEvent, } = useInbounds(); const [modal, modalContextHolder] = Modal.useModal(); const [messageApi, messageContextHolder] = message.useMessage(); useEffect(() => { setMessageInstance(messageApi); }, [messageApi]); - const { nodes: nodesList } = useNodes(); + const { nodes: nodesList } = useNodesQuery(); const nodesById = useMemo(() => { - const map = new Map['nodes'][number]>(); + const map = new Map['nodes'][number]>(); for (const n of nodesList || []) map.set(n.id, n); return map; }, [nodesList]); @@ -105,15 +102,8 @@ export default function InboundsPage() { useWebSocket({ traffic: applyTrafficEvent, client_stats: applyClientStatsEvent, - invalidate: applyInvalidate, - inbounds: applyInboundsEvent, }); - useEffect(() => { - fetchDefaultSettings().then(() => refresh()); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - const [formOpen, setFormOpen] = useState(false); const [formMode, setFormMode] = useState<'add' | 'edit'>('add'); const [formDbInbound, setFormDbInbound] = useState(null); @@ -449,15 +439,12 @@ export default function InboundsPage() { } }, [hydrateInbound, openEdit, checkFallback, findClientIndex, exportInboundLinks, exportInboundSubs, exportInboundClipboard, confirmDelete, confirmResetTraffic, confirmClone, messageApi]); - const basePath = (typeof window !== 'undefined' && window.X_UI_BASE_PATH) || ''; - const requestUri = typeof window !== 'undefined' ? window.location.pathname : ''; - return ( {messageContextHolder} {modalContextHolder} - + diff --git a/frontend/src/pages/inbounds/useInbounds.ts b/frontend/src/pages/inbounds/useInbounds.ts index aacca078..6a5ff89a 100644 --- a/frontend/src/pages/inbounds/useInbounds.ts +++ b/frontend/src/pages/inbounds/useInbounds.ts @@ -1,9 +1,11 @@ -import { useCallback, useMemo, useRef, useState } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useQuery, useQueryClient } from '@tanstack/react-query'; import { HttpUtil } from '@/utils'; import { DBInbound } from '@/models/dbinbound.js'; import { Protocols } from '@/models/inbound.js'; import { setDatepicker } from '@/hooks/useDatepicker'; +import { keys } from '@/api/queryKeys'; export interface SubSettings { enable: boolean; @@ -25,6 +27,27 @@ interface ClientRollup { comments: Map; } +interface ApiMsg { + success?: boolean; + obj?: T; + msg?: string; +} + +interface DefaultsPayload { + expireDiff?: number; + trafficDiff?: number; + tgBotEnable?: boolean; + subEnable?: boolean; + subTitle?: string; + subURI?: string; + subJsonURI?: string; + subJsonEnable?: boolean; + pageSize?: number; + remarkModel?: string; + datepicker?: string; + ipLimitEnable?: boolean; +} + const TRACKED_PROTOCOLS = [ Protocols.VMESS, Protocols.VLESS, @@ -33,40 +56,98 @@ const TRACKED_PROTOCOLS = [ Protocols.HYSTERIA, ]; +async function fetchSlimInbounds(): Promise { + const msg = await HttpUtil.get('/panel/api/inbounds/list/slim', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch inbounds'); + return Array.isArray(msg.obj) ? msg.obj : []; +} + +async function fetchOnlineClients(): Promise { + const msg = await HttpUtil.post('/panel/api/clients/onlines', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch onlines'); + return Array.isArray(msg.obj) ? msg.obj : []; +} + +async function fetchLastOnlineMap(): Promise> { + const msg = await HttpUtil.post('/panel/api/clients/lastOnline', undefined, { silent: true }) as ApiMsg>; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch lastOnline'); + return (msg.obj && typeof msg.obj === 'object') ? msg.obj : {}; +} + +async function fetchDefaultSettings(): Promise { + const msg = await HttpUtil.post('/panel/setting/defaultSettings', undefined, { silent: true }) as ApiMsg; + if (!msg?.success) throw new Error(msg?.msg || 'Failed to fetch defaults'); + return (msg.obj as DefaultsPayload) || {}; +} + export function useInbounds() { - const [fetched, setFetched] = useState(false); - const refreshingRef = useRef(false); + const queryClient = useQueryClient(); + + const slimQuery = useQuery({ + queryKey: keys.inbounds.slim(), + queryFn: fetchSlimInbounds, + staleTime: Infinity, + }); + + const onlinesQuery = useQuery({ + queryKey: keys.clients.onlines(), + queryFn: fetchOnlineClients, + staleTime: Infinity, + }); + + const lastOnlineQuery = useQuery({ + queryKey: keys.clients.lastOnline(), + queryFn: fetchLastOnlineMap, + staleTime: Infinity, + }); + + const defaultsQuery = useQuery({ + queryKey: keys.settings.defaults(), + queryFn: fetchDefaultSettings, + staleTime: Infinity, + }); + + const defaults = defaultsQuery.data ?? {}; + const expireDiff = (defaults.expireDiff ?? 0) * 86400000; + const trafficDiff = (defaults.trafficDiff ?? 0) * 1073741824; + const tgBotEnable = !!defaults.tgBotEnable; + const ipLimitEnable = !!defaults.ipLimitEnable; + const pageSize = defaults.pageSize ?? 0; + const remarkModel = defaults.remarkModel || '-ieo'; + const datepicker = (defaults.datepicker as 'gregorian' | 'jalalian') || 'gregorian'; + + const subSettings: SubSettings = useMemo(() => ({ + enable: !!defaults.subEnable, + subTitle: defaults.subTitle || '', + subURI: defaults.subURI || '', + subJsonURI: defaults.subJsonURI || '', + subJsonEnable: !!defaults.subJsonEnable, + }), [defaults.subEnable, defaults.subTitle, defaults.subURI, defaults.subJsonURI, defaults.subJsonEnable]); + + useEffect(() => { + if (defaults.datepicker) setDatepicker(datepicker); + }, [datepicker, defaults.datepicker]); + + const expireDiffRef = useRef(expireDiff); + expireDiffRef.current = expireDiff; + const trafficDiffRef = useRef(trafficDiff); + trafficDiffRef.current = trafficDiff; + + // dbInbounds mirrors the slim query data wrapped as DBInbound instances, but + // stays mutable so the WS-driven applyClientStatsEvent / applyTrafficEvent + // can merge per-row updates without invalidating the entire query. const [dbInbounds, setDbInbounds] = useState([]); const dbInboundsRef = useRef([]); dbInboundsRef.current = dbInbounds; const [clientCount, setClientCount] = useState>({}); + const [statsVersion, setStatsVersion] = useState(0); + const [onlineClients, setOnlineClients] = useState([]); const onlineClientsRef = useRef([]); onlineClientsRef.current = onlineClients; const [lastOnlineMap, setLastOnlineMap] = useState>({}); - const [statsVersion, setStatsVersion] = useState(0); - - const [expireDiff, setExpireDiff] = useState(0); - const expireDiffRef = useRef(0); - expireDiffRef.current = expireDiff; - const [trafficDiff, setTrafficDiff] = useState(0); - const trafficDiffRef = useRef(0); - trafficDiffRef.current = trafficDiff; - - const [subSettings, setSubSettings] = useState({ - enable: false, - subTitle: '', - subURI: '', - subJsonURI: '', - subJsonEnable: false, - }); - const [remarkModel, setRemarkModel] = useState('-ieo'); - const [datepicker, setDatepickerState] = useState('gregorian'); - const [tgBotEnable, setTgBotEnable] = useState(false); - const [ipLimitEnable, setIpLimitEnable] = useState(false); - const [pageSize, setPageSize] = useState(0); const rollupClients = useCallback( (dbInbound: DBInboundInstance, inbound: { clients?: { email?: string; enable?: boolean; comment?: string }[] }): ClientRollup => { @@ -130,27 +211,6 @@ export function useInbounds() { [], ); - const setInbounds = useCallback( - (rows: unknown[]) => { - const next: DBInboundInstance[] = []; - const counts: Record = {}; - for (const row of rows as { protocol: string; id: number }[]) { - const dbInbound = new DBInbound(row) as DBInboundInstance; - const parsed = (dbInbound as unknown as { toInbound: () => { clients?: unknown[]; isSSMultiUser?: boolean } }).toInbound(); - next.push(dbInbound); - if (TRACKED_PROTOCOLS.includes(row.protocol)) { - if ((dbInbound as unknown as { isSS: boolean }).isSS && !parsed.isSSMultiUser) continue; - counts[row.id] = rollupClients(dbInbound, parsed as { clients?: { email?: string; enable?: boolean; comment?: string }[] }); - } - } - dbInboundsRef.current = next; - setDbInbounds(next); - setClientCount(counts); - setFetched(true); - }, - [rollupClients], - ); - const rebuildClientCount = useCallback(() => { const counts: Record = {}; for (const dbInbound of dbInboundsRef.current) { @@ -164,57 +224,46 @@ export function useInbounds() { setClientCount(counts); }, [rollupClients]); - const fetchOnlineUsers = useCallback(async () => { - const msg = await HttpUtil.post('/panel/api/clients/onlines'); - if (msg?.success) { - const list = (msg.obj || []) as string[]; - onlineClientsRef.current = list; - setOnlineClients(list); + // Seed dbInbounds + clientCount from the slim query. Runs on first fetch and + // again every time the query refetches (e.g. invalidate from WS bridge). + useEffect(() => { + if (!slimQuery.data) return; + const next: DBInboundInstance[] = []; + const counts: Record = {}; + for (const row of slimQuery.data as { protocol: string; id: number }[]) { + const dbInbound = new DBInbound(row) as DBInboundInstance; + const parsed = (dbInbound as unknown as { toInbound: () => { clients?: unknown[]; isSSMultiUser?: boolean } }).toInbound(); + next.push(dbInbound); + if (TRACKED_PROTOCOLS.includes(row.protocol)) { + if ((dbInbound as unknown as { isSS: boolean }).isSS && !parsed.isSSMultiUser) continue; + counts[row.id] = rollupClients(dbInbound, parsed as { clients?: { email?: string; enable?: boolean; comment?: string }[] }); + } } - }, []); + dbInboundsRef.current = next; + setDbInbounds(next); + setClientCount(counts); + }, [slimQuery.data, rollupClients]); - const fetchLastOnlineMap = useCallback(async () => { - const msg = await HttpUtil.post('/panel/api/clients/lastOnline'); - if (msg?.success && msg.obj) { - setLastOnlineMap(msg.obj as Record); + useEffect(() => { + if (onlinesQuery.data) { + onlineClientsRef.current = onlinesQuery.data; + setOnlineClients(onlinesQuery.data); } - }, []); + }, [onlinesQuery.data]); - const fetchDefaultSettings = useCallback(async () => { - const msg = await HttpUtil.post('/panel/setting/defaultSettings'); - if (!msg?.success) return; - const s = (msg.obj || {}) as Record; - setExpireDiff((s.expireDiff as number ?? 0) * 86400000); - setTrafficDiff((s.trafficDiff as number ?? 0) * 1073741824); - setTgBotEnable(!!s.tgBotEnable); - setSubSettings({ - enable: !!s.subEnable, - subTitle: (s.subTitle as string) || '', - subURI: (s.subURI as string) || '', - subJsonURI: (s.subJsonURI as string) || '', - subJsonEnable: !!s.subJsonEnable, - }); - setPageSize((s.pageSize as number) ?? 0); - setRemarkModel((s.remarkModel as string) || '-ieo'); - const dp = ((s.datepicker as string) || 'gregorian') as 'gregorian' | 'jalalian'; - setDatepickerState(dp); - setDatepicker(dp); - setIpLimitEnable(!!s.ipLimitEnable); - }, []); + useEffect(() => { + if (lastOnlineQuery.data) setLastOnlineMap(lastOnlineQuery.data); + }, [lastOnlineQuery.data]); + + const fetched = slimQuery.data !== undefined && defaultsQuery.data !== undefined; const refresh = useCallback(async () => { - if (refreshingRef.current) return; - refreshingRef.current = true; - try { - const msg = await HttpUtil.get('/panel/api/inbounds/list/slim'); - if (!msg?.success) return; - await fetchLastOnlineMap(); - await fetchOnlineUsers(); - setInbounds(Array.isArray(msg.obj) ? msg.obj : []); - } finally { - window.setTimeout(() => { refreshingRef.current = false; }, 500); - } - }, [fetchLastOnlineMap, fetchOnlineUsers, setInbounds]); + await Promise.all([ + queryClient.invalidateQueries({ queryKey: keys.inbounds.slim() }), + queryClient.invalidateQueries({ queryKey: keys.clients.onlines() }), + queryClient.invalidateQueries({ queryKey: keys.clients.lastOnline() }), + ]); + }, [queryClient]); // hydrateInbound fetches the full inbound (including settings.clients with // uuid/password/flow/etc.) and swaps it into the cached list. Use this @@ -313,25 +362,6 @@ export function useInbounds() { [rebuildClientCount], ); - const applyInvalidate = useCallback( - (payload: unknown) => { - if (!payload || typeof payload !== 'object') return; - const p = payload as { type?: string }; - if (p.type === 'inbounds') { - refresh(); - } - }, - [refresh], - ); - - const applyInboundsEvent = useCallback( - (payload: unknown) => { - if (!Array.isArray(payload)) return; - setInbounds(payload); - }, - [setInbounds], - ); - const totals = useMemo(() => { let up = 0; let down = 0; @@ -361,10 +391,7 @@ export function useInbounds() { pageSize, refresh, hydrateInbound, - fetchDefaultSettings, applyTrafficEvent, applyClientStatsEvent, - applyInvalidate, - applyInboundsEvent, }; } diff --git a/frontend/src/pages/index/IndexPage.tsx b/frontend/src/pages/index/IndexPage.tsx index 5334c171..21bfcb3a 100644 --- a/frontend/src/pages/index/IndexPage.tsx +++ b/frontend/src/pages/index/IndexPage.tsx @@ -36,7 +36,7 @@ import { import { HttpUtil, SizeFormatter, TimeFormatter, ClipboardManager, FileManager } from '@/utils'; import { useTheme } from '@/hooks/useTheme'; -import { useStatus } from '@/hooks/useStatus'; +import { useStatusQuery } from '@/api/queries/useStatusQuery'; import { useMediaQuery } from '@/hooks/useMediaQuery'; import AppSidebar from '@/components/AppSidebar'; import CustomStatistic from '@/components/CustomStatistic'; @@ -59,7 +59,7 @@ import './IndexPage.css'; export default function IndexPage() { const { t } = useTranslation(); const { isDark, isUltra, antdThemeConfig } = useTheme(); - const { status, fetched, refresh } = useStatus(); + const { status, fetched, refresh } = useStatusQuery(); const { isMobile } = useMediaQuery(); const [messageApi, messageContextHolder] = message.useMessage(); useEffect(() => { setMessageInstance(messageApi); }, [messageApi]); @@ -72,7 +72,6 @@ export default function IndexPage() { }); const basePath = window.X_UI_BASE_PATH || ''; - const requestUri = window.location.pathname; const [showIp, setShowIp] = useState(false); const [logsOpen, setLogsOpen] = useState(false); @@ -158,7 +157,7 @@ export default function IndexPage() { {messageContextHolder} - + diff --git a/frontend/src/pages/nodes/NodeFormModal.tsx b/frontend/src/pages/nodes/NodeFormModal.tsx index 795fec76..93dc3aba 100644 --- a/frontend/src/pages/nodes/NodeFormModal.tsx +++ b/frontend/src/pages/nodes/NodeFormModal.tsx @@ -13,7 +13,7 @@ import { Switch, message, } from 'antd'; -import type { NodeRecord } from '@/hooks/useNodes'; +import type { NodeRecord } from '@/api/queries/useNodesQuery'; import './NodeFormModal.css'; type Mode = 'add' | 'edit'; diff --git a/frontend/src/pages/nodes/NodeList.tsx b/frontend/src/pages/nodes/NodeList.tsx index 3cfaee99..8179a979 100644 --- a/frontend/src/pages/nodes/NodeList.tsx +++ b/frontend/src/pages/nodes/NodeList.tsx @@ -28,7 +28,7 @@ import { } from '@ant-design/icons'; import NodeHistoryPanel from './NodeHistoryPanel'; -import type { NodeRecord } from '@/hooks/useNodes'; +import type { NodeRecord } from '@/api/queries/useNodesQuery'; import './NodeList.css'; interface NodeListProps { diff --git a/frontend/src/pages/nodes/NodesPage.tsx b/frontend/src/pages/nodes/NodesPage.tsx index 83932e2b..2f5b7a79 100644 --- a/frontend/src/pages/nodes/NodesPage.tsx +++ b/frontend/src/pages/nodes/NodesPage.tsx @@ -10,9 +10,9 @@ import { import { useTheme } from '@/hooks/useTheme'; import { useMediaQuery } from '@/hooks/useMediaQuery'; -import { useNodes } from '@/hooks/useNodes'; -import type { NodeRecord } from '@/hooks/useNodes'; -import { useWebSocket } from '@/hooks/useWebSocket'; +import { useNodesQuery } from '@/api/queries/useNodesQuery'; +import type { NodeRecord } from '@/api/queries/useNodesQuery'; +import { useNodeMutations } from '@/api/queries/useNodeMutations'; import AppSidebar from '@/components/AppSidebar'; import CustomStatistic from '@/components/CustomStatistic'; import NodeList from './NodeList'; @@ -21,9 +21,6 @@ import { setMessageInstance } from '@/utils/messageBus'; import '@/styles/page-cards.css'; import './NodesPage.css'; -const basePath = window.X_UI_BASE_PATH || ''; -const requestUri = window.location.pathname; - export default function NodesPage() { const { t } = useTranslation(); const { isDark, isUltra, antdThemeConfig } = useTheme(); @@ -32,21 +29,8 @@ export default function NodesPage() { const [messageApi, messageContextHolder] = message.useMessage(); useEffect(() => { setMessageInstance(messageApi); }, [messageApi]); - const { - nodes, - loading, - fetched, - totals, - applyNodesEvent, - create, - update, - remove, - setEnable, - testConnection, - probe, - } = useNodes(); - - useWebSocket({ nodes: applyNodesEvent }); + const { nodes, loading, fetched, totals } = useNodesQuery(); + const { create, update, remove, setEnable, testConnection, probe } = useNodeMutations(); const [formOpen, setFormOpen] = useState(false); const [formMode, setFormMode] = useState<'add' | 'edit'>('add'); @@ -112,7 +96,7 @@ export default function NodesPage() { {messageContextHolder} {modalContextHolder} - + diff --git a/frontend/src/pages/settings/SettingsPage.tsx b/frontend/src/pages/settings/SettingsPage.tsx index c4342b11..8442f27b 100644 --- a/frontend/src/pages/settings/SettingsPage.tsx +++ b/frontend/src/pages/settings/SettingsPage.tsx @@ -28,7 +28,7 @@ import { HttpUtil, PromiseUtil } from '@/utils'; import { setMessageInstance } from '@/utils/messageBus'; import { useTheme } from '@/hooks/useTheme'; import { useMediaQuery } from '@/hooks/useMediaQuery'; -import { useAllSetting } from '@/hooks/useAllSetting'; +import { useAllSettings } from '@/api/queries/useAllSettings'; import AppSidebar from '@/components/AppSidebar'; import GeneralTab from './GeneralTab'; import SecurityTab from './SecurityTab'; @@ -42,8 +42,6 @@ interface ApiMsg { success?: boolean; } -const basePath = window.X_UI_BASE_PATH || ''; -const requestUri = window.location.pathname; const tabSlugs = ['general', 'security', 'telegram', 'subscription', 'subscription-formats']; function slugToKey(slug: string): string { @@ -94,7 +92,7 @@ export default function SettingsPage() { setSpinning, saveDisabled, saveAll, - } = useAllSetting(); + } = useAllSettings(); const [entryHost, setEntryHost] = useState(''); const [entryPort, setEntryPort] = useState(''); @@ -270,7 +268,7 @@ export default function SettingsPage() { {messageContextHolder} {modalContextHolder} - + diff --git a/frontend/src/pages/xray/XrayPage.tsx b/frontend/src/pages/xray/XrayPage.tsx index 20646b4f..a0e262c9 100644 --- a/frontend/src/pages/xray/XrayPage.tsx +++ b/frontend/src/pages/xray/XrayPage.tsx @@ -31,7 +31,6 @@ import { import { useTheme } from '@/hooks/useTheme'; import { useMediaQuery } from '@/hooks/useMediaQuery'; -import { useWebSocket } from '@/hooks/useWebSocket'; import { useXraySetting } from '@/hooks/useXraySetting'; import type { XraySettingsValue } from '@/hooks/useXraySetting'; import AppSidebar from '@/components/AppSidebar'; @@ -89,7 +88,6 @@ export default function XrayPage() { testingAll, fetchAll, resetOutboundsTraffic, - applyOutboundsEvent, testOutbound, testAllOutbounds, saveAll, @@ -97,8 +95,6 @@ export default function XrayPage() { restartXray, } = xs; - useWebSocket({ outbounds: applyOutboundsEvent as never }); - const [modal, modalContextHolder] = Modal.useModal(); const [warpOpen, setWarpOpen] = useState(false); const [nordOpen, setNordOpen] = useState(false); @@ -140,9 +136,6 @@ export default function XrayPage() { const warpExist = !!templateSettings?.outbounds?.find((o) => o?.tag === 'warp'); const nordExist = !!templateSettings?.outbounds?.find((o) => o?.tag?.startsWith?.('nord-')); - const basePath = window.X_UI_BASE_PATH || ''; - const requestUri = window.location.pathname; - async function onTestOutbound(idx: number, mode: string) { const outbound = templateSettings?.outbounds?.[idx]; if (outbound) await testOutbound(idx, outbound, mode); @@ -259,7 +252,7 @@ export default function XrayPage() { {messageContextHolder} {modalContextHolder} - + diff --git a/frontend/src/queryClient.ts b/frontend/src/queryClient.ts new file mode 100644 index 00000000..fc46dfa4 --- /dev/null +++ b/frontend/src/queryClient.ts @@ -0,0 +1,14 @@ +import { QueryClient } from '@tanstack/react-query'; + +export const queryClient = new QueryClient({ + defaultOptions: { + queries: { + staleTime: 30_000, + refetchOnWindowFocus: true, + retry: 1, + }, + mutations: { + retry: 0, + }, + }, +}); diff --git a/frontend/src/routes.tsx b/frontend/src/routes.tsx new file mode 100644 index 00000000..d72180ac --- /dev/null +++ b/frontend/src/routes.tsx @@ -0,0 +1,42 @@ +import { lazy, Suspense } from 'react'; +import { createBrowserRouter, type RouteObject } from 'react-router-dom'; + +import PanelLayout from '@/layouts/PanelLayout'; + +const IndexPage = lazy(() => import('@/pages/index/IndexPage')); +const InboundsPage = lazy(() => import('@/pages/inbounds/InboundsPage')); +const ClientsPage = lazy(() => import('@/pages/clients/ClientsPage')); +const NodesPage = lazy(() => import('@/pages/nodes/NodesPage')); +const SettingsPage = lazy(() => import('@/pages/settings/SettingsPage')); +const XrayPage = lazy(() => import('@/pages/xray/XrayPage')); +const ApiDocsPage = lazy(() => import('@/pages/api-docs/ApiDocsPage')); + +function withSuspense(node: React.ReactNode) { + return {node}; +} + +const routes: RouteObject[] = [ + { + path: '/', + element: , + children: [ + { index: true, element: withSuspense() }, + { path: 'inbounds', element: withSuspense() }, + { path: 'clients', element: withSuspense() }, + { path: 'nodes', element: withSuspense() }, + { path: 'settings', element: withSuspense() }, + { path: 'xray', element: withSuspense() }, + { path: 'api-docs', element: withSuspense() }, + ], + }, +]; + +function computeBasename() { + const raw = (typeof window !== 'undefined' && window.X_UI_BASE_PATH) || '/'; + const trimmed = raw.replace(/\/+$/, ''); + return `${trimmed}/panel`; +} + +export const router = createBrowserRouter(routes, { + basename: computeBasename(), +}); diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 9a860191..96117856 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -22,22 +22,7 @@ function resolveDBPath() { return '/etc/x-ui/x-ui.db'; } -const BASE_MIGRATED_ROUTES = { - 'panel': '/index.html', - 'panel/': '/index.html', - 'panel/settings': '/settings.html', - 'panel/settings/': '/settings.html', - 'panel/inbounds': '/inbounds.html', - 'panel/inbounds/': '/inbounds.html', - 'panel/clients': '/clients.html', - 'panel/clients/': '/clients.html', - 'panel/xray': '/xray.html', - 'panel/xray/': '/xray.html', - 'panel/nodes': '/nodes.html', - 'panel/nodes/': '/nodes.html', - 'panel/api-docs': '/api-docs.html', - 'panel/api-docs/': '/api-docs.html', -}; +const PANEL_API_PREFIXES = ['panel/api/', 'panel/setting/', 'panel/xray/', 'panel/csrf-token']; let cachedBasePath = '/'; @@ -101,7 +86,14 @@ function bypassMigratedRoute(req) { if (url.startsWith(basePath)) { const stripped = url.slice(basePath.length); - if (stripped in BASE_MIGRATED_ROUTES) return BASE_MIGRATED_ROUTES[stripped]; + for (const prefix of PANEL_API_PREFIXES) { + if (stripped === prefix.replace(/\/$/, '') || stripped.startsWith(prefix)) { + return undefined; + } + } + if (stripped === 'panel' || stripped === 'panel/' || stripped.startsWith('panel/')) { + return '/index.html'; + } } return undefined; } @@ -172,12 +164,6 @@ export default defineConfig({ input: { index: path.resolve(__dirname, 'index.html'), login: path.resolve(__dirname, 'login.html'), - settings: path.resolve(__dirname, 'settings.html'), - inbounds: path.resolve(__dirname, 'inbounds.html'), - clients: path.resolve(__dirname, 'clients.html'), - xray: path.resolve(__dirname, 'xray.html'), - nodes: path.resolve(__dirname, 'nodes.html'), - apiDocs: path.resolve(__dirname, 'api-docs.html'), subpage: path.resolve(__dirname, 'subpage.html'), }, output: { @@ -210,6 +196,13 @@ export default defineConfig({ ) return 'vendor-codemirror'; if (id.includes('/node_modules/persian-calendar-suite/')) return 'vendor-jalali'; if (id.includes('/node_modules/otpauth/')) return 'vendor-otpauth'; + if (id.includes('/node_modules/@tanstack/')) return 'vendor-tanstack'; + if (id.includes('/node_modules/react-router')) return 'vendor-router'; + if ( + id.includes('/node_modules/swagger-ui-react/') + || id.includes('/node_modules/swagger-ui/') + || id.includes('/node_modules/swagger-client/') + ) return 'vendor-swagger'; if (id.includes('dayjs')) return 'vendor-dayjs'; if (id.includes('axios')) return 'vendor-axios'; return 'vendor'; diff --git a/frontend/xray.html b/frontend/xray.html deleted file mode 100644 index eb743fe5..00000000 --- a/frontend/xray.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - Xray Config - - -
-
- - - diff --git a/web/controller/dist.go b/web/controller/dist.go index 682f0024..1c2b6212 100644 --- a/web/controller/dist.go +++ b/web/controller/dist.go @@ -23,6 +23,21 @@ func SetDistFS(fs embed.FS) { var distPageBuildTime = time.Now() +// ServeOpenAPISpec returns the generated OpenAPI 3.0 description of the +// panel API. Postman / Insomnia / openapi-generator consume this URL +// directly; the in-panel Swagger UI page also fetches it. The spec is +// produced at frontend build time by scripts/build-openapi.mjs and +// embedded into the binary via the dist FS. +func ServeOpenAPISpec(c *gin.Context) { + body, err := distFS.ReadFile("dist/openapi.json") + if err != nil { + c.JSON(http.StatusNotFound, gin.H{"success": false, "msg": "openapi.json not found"}) + return + } + c.Header("Cache-Control", "public, max-age=300") + c.Data(http.StatusOK, "application/json; charset=utf-8", body) +} + func serveDistPage(c *gin.Context, name string) { body, err := distFS.ReadFile("dist/" + name) if err != nil { diff --git a/web/controller/xui.go b/web/controller/xui.go index 2da9a52e..fcb80a5c 100644 --- a/web/controller/xui.go +++ b/web/controller/xui.go @@ -26,18 +26,23 @@ func NewXUIController(g *gin.RouterGroup) *XUIController { } // initRouter sets up the main panel routes and initializes sub-controllers. +// +// The HTML routes all hand the same single-page-app shell (index.html) to the +// browser; React Router takes over and renders the correct page from the URL. +// The /panel/api, /panel/setting, /panel/xray sub-routers register POST/JSON +// endpoints on different paths and stay untouched by the shell handler. func (a *XUIController) initRouter(g *gin.RouterGroup) { g = g.Group("/panel") g.Use(a.checkLogin) g.Use(middleware.CSRFMiddleware()) - g.GET("/", a.index) - g.GET("/inbounds", a.inbounds) - g.GET("/clients", a.clients) - g.GET("/nodes", a.nodes) - g.GET("/settings", a.settings) - g.GET("/xray", a.xraySettings) - g.GET("/api-docs", a.apiDocs) + g.GET("/", a.panelSPA) + g.GET("/inbounds", a.panelSPA) + g.GET("/clients", a.panelSPA) + g.GET("/nodes", a.panelSPA) + g.GET("/settings", a.panelSPA) + g.GET("/xray", a.panelSPA) + g.GET("/api-docs", a.panelSPA) // SPA pages built by Vite don't have a server-rendered , // so they fetch the session token via this endpoint at startup and replay it @@ -48,45 +53,13 @@ func (a *XUIController) initRouter(g *gin.RouterGroup) { a.xraySettingController = NewXraySettingController(g) } -// The main panel's HTML routes serve the pre-built SPA pages from distFS, -// instead of rendering the legacy Go templates. Each handler is a -// thin wrapper around serveDistPage so the basePath injection + -// no-cache headers stay centralised. - -// index renders the main panel index page. -func (a *XUIController) index(c *gin.Context) { +// panelSPA serves the React SPA shell. Every GET under /panel/ that isn't an +// API endpoint returns the same index.html — React Router reads the URL and +// mounts the matching page on the client. +func (a *XUIController) panelSPA(c *gin.Context) { serveDistPage(c, "index.html") } -// inbounds renders the inbounds management page. -func (a *XUIController) inbounds(c *gin.Context) { - serveDistPage(c, "inbounds.html") -} - -func (a *XUIController) clients(c *gin.Context) { - serveDistPage(c, "clients.html") -} - -// nodes renders the multi-panel nodes management page. -func (a *XUIController) nodes(c *gin.Context) { - serveDistPage(c, "nodes.html") -} - -// settings renders the settings management page. -func (a *XUIController) settings(c *gin.Context) { - serveDistPage(c, "settings.html") -} - -// xraySettings renders the Xray settings page. -func (a *XUIController) xraySettings(c *gin.Context) { - serveDistPage(c, "xray.html") -} - -// apiDocs renders the in-panel API documentation page. -func (a *XUIController) apiDocs(c *gin.Context) { - serveDistPage(c, "api-docs.html") -} - // csrfToken returns the session CSRF token to authenticated SPA clients. // The endpoint is GET (a safe method) so it bypasses CSRFMiddleware itself, // but checkLogin still gates the response — anonymous callers get 401/redirect. diff --git a/web/web.go b/web/web.go index b6c050f4..ca990a3e 100644 --- a/web/web.go +++ b/web/web.go @@ -227,6 +227,7 @@ func (s *Server) initRouter() (*gin.Engine, error) { s.index = controller.NewIndexController(g) s.panel = controller.NewXUIController(g) + g.GET("/panel/api/openapi.json", controller.ServeOpenAPISpec) s.api = controller.NewAPIController(g, s.customGeoService) // Initialize WebSocket hub