mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-08 13:46:08 +00:00
bc309ed9f8
Drop the axios (and qs) dependencies in favor of a native fetch wrapper.
axios only ever handled same-origin JSON/form calls, a CSRF header, a 401
redirect, and a 403-retry, all of which the platform now provides directly.
- New src/api/http-init.ts (replaces axios-init.ts) reimplements the
request/response interceptors on fetch: base-path prefixing,
X-Requested-With, same-origin credentials, the CSRF token on unsafe
methods, a single 403 retry with token refresh, and the 401
redirect-and-latch. A small encodeForm() reproduces qs's
arrayFormat:'repeat' encoding, so the request wire format is unchanged.
- HttpUtil (src/utils/index.ts) keeps its public signatures and the Msg
envelope, so the ~49 API call sites are untouched. HttpOptions is now
hand-rolled instead of extending AxiosRequestConfig.
- PanelUpdateModal drops its lone direct axios.get in favor of HttpUtil.get
with { silent, timeout }.
- Add tests for the fetch core (CSRF header, form/JSON/FormData bodies,
base-path prefix, 403 retry, 401 redirect, tolerant body parse) and for
HttpUtil's envelope unwrap / toast / error mapping; this logic was
previously untested.
- Remove the vendor-axios manualChunks branch and the qs type shim, and
reword stale "axios" mentions in docs and route comments.
85 lines
2.3 KiB
JSON
85 lines
2.3 KiB
JSON
{
|
|
"name": "3x-ui-frontend",
|
|
"private": true,
|
|
"version": "0.4.1",
|
|
"type": "module",
|
|
"description": "3x-ui panel frontend (React 19 + Ant Design 6 + Vite 8).",
|
|
"engines": {
|
|
"node": ">=22.0.0",
|
|
"npm": ">=10.0.0"
|
|
},
|
|
"scripts": {
|
|
"dev": "vite",
|
|
"build": "npm run gen:api && vite build",
|
|
"preview": "vite preview",
|
|
"lint": "eslint src",
|
|
"typecheck": "tsc --noEmit",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"gen": "npm run gen:zod && npm run gen:api",
|
|
"gen:api": "node --experimental-strip-types --disable-warning=ExperimentalWarning scripts/build-openapi.mjs",
|
|
"gen:zod": "cd .. && go run ./tools/openapigen"
|
|
},
|
|
"dependencies": {
|
|
"@ant-design/icons": "^6.3.2",
|
|
"@codemirror/lang-json": "^6.0.2",
|
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
"@noble/hashes": "^2.2.0",
|
|
"@tanstack/react-query": "^5.101.2",
|
|
"@tanstack/react-query-devtools": "^5.101.2",
|
|
"antd": "^6.5.0",
|
|
"codemirror": "^6.0.2",
|
|
"dayjs": "^1.11.21",
|
|
"i18next": "^26.3.4",
|
|
"otpauth": "^9.5.1",
|
|
"persian-calendar-suite": "^1.5.5",
|
|
"react": "^19.2.7",
|
|
"react-dom": "^19.2.7",
|
|
"react-i18next": "^17.0.8",
|
|
"react-router-dom": "^7.18.1",
|
|
"recharts": "^3.9.1",
|
|
"swagger-ui-react": "^5.32.8",
|
|
"zod": "^4.4.3"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@testing-library/dom": "^10.4.1",
|
|
"@testing-library/react": "^16.3.2",
|
|
"@types/react": "^19.2.17",
|
|
"@types/react-dom": "^19.2.3",
|
|
"@types/swagger-ui-react": "^5.18.0",
|
|
"@vitejs/plugin-react": "^6.0.3",
|
|
"@vitest/coverage-v8": "^4.1.9",
|
|
"eslint": "^10.6.0",
|
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
"globals": "^17.7.0",
|
|
"jsdom": "^29.1.1",
|
|
"typescript": "^6.0.3",
|
|
"typescript-eslint": "^8.62.1",
|
|
"vite": "8.1.3",
|
|
"vitest": "^4.1.9"
|
|
},
|
|
"overrides": {
|
|
"eslint-plugin-jsx-a11y": {
|
|
"eslint": "$eslint"
|
|
},
|
|
"dompurify": "^3.4.11",
|
|
"react-copy-to-clipboard": "^5.1.1",
|
|
"react-inspector": "^9.0.0",
|
|
"react-debounce-input": {
|
|
"react": "^19.0.0"
|
|
},
|
|
"swagger-ui-react": {
|
|
"js-yaml": "^4.2.0"
|
|
}
|
|
},
|
|
"allowScripts": {
|
|
"@scarf/scarf": false,
|
|
"@tree-sitter-grammars/tree-sitter-yaml": false,
|
|
"tree-sitter": false,
|
|
"core-js-pure": false,
|
|
"tree-sitter-json": false
|
|
}
|
|
}
|