3xui-api-client 2.1.1 β 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/README.md +300 -286
- package/index.d.ts +390 -2
- package/index.js +703 -69
- package/package.json +4 -8
- package/src/generators/CredentialGenerator.js +21 -18
- package/src/session/SessionManager.js +24 -1
- package/src/utils/ByteConversion.js +132 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.1.0] - 2026-06-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- π **Dual Panel Support** - Automatic panel version detection (modern React v2.x+ vs legacy Vue v1.x) with seamless fallback during login. This is also configurable via the `panelVersion` constructor option (`auto`, `modern`, `legacy`).
|
|
12
|
+
- Comprehensive Phase C API test coverage and documentation consolidation.
|
|
13
|
+
- π’ **Automatic GBβBytes Conversion** ([#6](https://github.com/iamhelitha/3xui-api-client/pull/6)) - `totalGB` values in `addClientWithCredentials`, `updateClientWithCredentials`, `addModernClient`, and `updateModernClient` are now automatically converted to bytes. Pass `totalGB: 100` and receive a proper 100 GB limit β no manual byte calculation needed. Includes safety warnings for suspiciously small values.
|
|
14
|
+
- π **`loginRetryBackoff` option** ([#7](https://github.com/iamhelitha/3xui-api-client/pull/7)) - Configurable delay (default **500 ms**) before each forced re-login on a `401` response. Prevents bursts of concurrent serverless cold starts from tripping fail2ban or 3x-ui login-rate limits. Set `loginRetryBackoff: 0` to disable.
|
|
15
|
+
- π **Session Security documentation** ([#7](https://github.com/iamhelitha/3xui-api-client/pull/7)) - New README section covering plaintext cookie storage trade-offs per store type, deterministic session key design, and serverless / multi-instance hardening guidance.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- π΄ **CRITICAL**: Fixed `updateUser` endpoint session breaking. Modifying admin credentials now automatically refreshes internal credentials and re-authenticates the session.
|
|
19
|
+
- Fixed `updateSetting` payload formatting by automatically merging updates with current settings before sending.
|
|
20
|
+
- Fixed `updateXrayConfig` to correctly accept and validate both configuration objects and JSON strings.
|
|
21
|
+
- π **Silent quota error** ([#6](https://github.com/iamhelitha/3xui-api-client/pull/6)) - Users passing `totalGB: 100` previously received a 100-byte limit instead of 100 GB. Closes [#5](https://github.com/iamhelitha/3xui-api-client/issues/5).
|
|
22
|
+
- Cleaned up obsolete testing scratch scripts.
|
|
23
|
+
- Fixed minor linting errors in `index.js`.
|
|
24
|
+
|
|
25
|
+
### Security
|
|
26
|
+
- Inline documentation added to `MemorySessionStore` and `DatabaseSessionStore` explicitly warning that session cookies (admin-equivalent credentials) are stored in plaintext and must be protected at the infrastructure level. Closes [#4](https://github.com/iamhelitha/3xui-api-client/issues/4).
|
|
27
|
+
|
|
28
|
+
## [3.0.1] - 2026-06-07
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
- Re-release as 3.0.1 β version 3.0.0 was previously published and unpublished, making it permanently blocked on npm.
|
|
32
|
+
|
|
33
|
+
## [3.0.0] - 2026-06-07
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
- π **API Token Authentication** β Pass `token` or `apiToken` in options to authenticate via Bearer token instead of cookie-based login. Resolves compatibility with 3x-ui v3.0.2+ where the legacy login mechanism changed. ([#1](https://github.com/iamhelitha/3xui-api-client/issues/1))
|
|
37
|
+
- π **Object-style constructor** β `new ThreeXUI(url, { username, password, token })` as an alternative to the positional `(url, user, pass)` signature.
|
|
38
|
+
- π‘ **48 new Modern API routes** (3x-ui v2.x/v3.x endpoints):
|
|
39
|
+
- **Clients** (25 routes): `getClients`, `getPagedClients`, `getClient`, `getClientTraffic`, `getSubLinks`, `getClientLinks`, `addModernClient`, `updateModernClient`, `deleteModernClient`, `attachClientToInbounds`, `detachClientFromInbounds`, `resetAllModernClientTraffics`, `deleteDepletedModernClients`, bulk operations (`bulkAdjust`, `bulkDel`, `bulkCreate`, `bulkAttach`, `bulkDetach`, `bulkResetTraffic`), `resetModernClientTrafficByEmail`, `updateModernClientTrafficByEmail`, `getModernClientIps`, `clearModernClientIps`, `getOnlines`, `getModernLastOnline`
|
|
40
|
+
- **Client Groups** (7 routes): `getGroups`, `getGroupEmails`, `createGroup`, `renameGroup`, `deleteGroup`, `bulkAddGroups`, `bulkRemoveGroups`
|
|
41
|
+
- **Nodes** (9 routes): `getNodes`, `getNode`, `getNodeHistory`, `addNode`, `updateNode`, `deleteNode`, `setNodeEnable`, `testNode`, `probeNode`
|
|
42
|
+
- **Custom Geo** (7 routes): `getCustomGeos`, `getGeoAliases`, `addCustomGeo`, `updateCustomGeo`, `deleteCustomGeo`, `downloadCustomGeo`, `updateAllCustomGeo`
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Constructor signature extended to accept an options object as the second argument (fully backward compatible β existing `(url, user, pass)` usage is unchanged).
|
|
46
|
+
- `_request()` and `login()` skip cookie-based auth flow when a token is configured.
|
|
47
|
+
- `isSessionValid()` returns `true` immediately when token auth is active.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
- ESLint errors (trailing whitespace, missing curly braces) introduced in new route additions.
|
|
51
|
+
- Indentation inconsistency in TypeScript declarations (`updateClientWithCredentials`).
|
|
52
|
+
|
|
53
|
+
### Backward Compatibility
|
|
54
|
+
- All existing `(url, username, password)` constructor calls continue to work without any changes.
|
|
55
|
+
- All 55 original API routes are unchanged.
|
|
56
|
+
- Verified against older 3x-ui servers β cookie-based login, session management, and all core routes function identically.
|
|
57
|
+
|
|
8
58
|
## [2.1.1] - 2025-11-30
|
|
9
59
|
|
|
10
60
|
### Fixed
|