3xui-api-client 2.1.0 โ 2.1.1
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 +155 -146
- package/LICENSE +20 -20
- package/README.md +374 -317
- package/index.d.ts +435 -436
- package/index.js +1012 -714
- package/index.mjs +4 -4
- package/package.json +113 -113
- package/src/builders/ProtocolBuilders.js +689 -689
- package/src/generators/CredentialGenerator.js +361 -361
- package/src/middleware/WebMiddleware.js +310 -310
- package/src/security/SecurityEnhancer.js +325 -325
- package/src/session/SessionManager.js +492 -492
package/CHANGELOG.md
CHANGED
|
@@ -1,146 +1,155 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [2.1.
|
|
9
|
-
|
|
10
|
-
###
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- **
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
- **
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
- **
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
- Complete
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
- Server-side only
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
###
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
146
|
-
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.1.1] - 2025-11-30
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- ๐ **Login Response**: `login()` method now explicitly returns the `cookie` in the response object, making it easier to store sessions in databases.
|
|
12
|
+
- ๐ง **Configuration Auto-fix**: Automatically detects and fixes `PANEL_URL` configuration errors (removing trailing `/panel`) to prevent 404 errors.
|
|
13
|
+
|
|
14
|
+
### Documentation
|
|
15
|
+
- ๐ **Configuration Guide**: Added critical warning about `PANEL_URL` format in README.
|
|
16
|
+
|
|
17
|
+
## [2.1.0] - 2025-08-30
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- ๐ฅ **Firestore Session Store Support** - Custom session handler for Firebase Firestore integration
|
|
21
|
+
- ๐ **Enhanced Wiki Documentation** - Comprehensive guides with real-world examples and integration patterns
|
|
22
|
+
- ๐ **Client Identifier Clarification** - Clear documentation that 'email' field is an identifier, not a real email address
|
|
23
|
+
|
|
24
|
+
### Enhanced
|
|
25
|
+
- ๐ **Authentication Guide** - Added detailed session/cookie flow documentation and Firestore integration example
|
|
26
|
+
- ๐ฅ **Client Management Guide** - Clarified email field semantics and added identifier generation examples
|
|
27
|
+
- ๐ ๏ธ **Inbound Management Guide** - Added protocol-specific authentication method explanations
|
|
28
|
+
- ๐ **Home Documentation** - Improved navigation and cross-references between guides
|
|
29
|
+
|
|
30
|
+
### Documentation
|
|
31
|
+
- **Session Management**: Added comprehensive Firestore adapter example with cleanup patterns
|
|
32
|
+
- **API Flow Clarification**: Documented that all API calls automatically include stored session cookies
|
|
33
|
+
- **Client Identifiers**: Clarified that 'email' fields use random strings (e.g., '5yhuih4hg93') for privacy
|
|
34
|
+
- **Integration Examples**: Enhanced web integration patterns for Express.js and Next.js
|
|
35
|
+
- **Security Best Practices**: Consolidated security guidance in Authentication Guide
|
|
36
|
+
|
|
37
|
+
### Removed
|
|
38
|
+
- Removed any references to email generation functionality for clarity
|
|
39
|
+
- Cleaned up duplicate content across wiki files
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- Corrected misconceptions about email field usage in 3x-ui
|
|
43
|
+
- Improved consistency across documentation
|
|
44
|
+
|
|
45
|
+
## [2.0.0] - 2025-06-25
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- ๐ฏ **Built-in Credential Generation System** - Automatic generation of random passwords, UUIDs, and client identifiers
|
|
49
|
+
- ๐ง **Advanced Session Management** - Intelligent session caching, automatic renewal, and multi-server support
|
|
50
|
+
- ๐ **Web Integration Support** - Express.js and Next.js middleware for seamless web app integration
|
|
51
|
+
- ๐ก๏ธ **Enhanced Security Framework** - Input validation, security monitoring, and secure headers management
|
|
52
|
+
- ๐ฆ **Modular Architecture** - New `src/` directory structure with specialized modules:
|
|
53
|
+
- `CredentialGenerator.js` - Random credential generation utilities
|
|
54
|
+
- `SessionManager.js` - Advanced session handling and caching
|
|
55
|
+
- `WebMiddleware.js` - Express/Next.js integration helpers
|
|
56
|
+
- `ProtocolBuilders.js` - Automated inbound configuration builders
|
|
57
|
+
- `SecurityEnhancer.js` - Security validation and monitoring
|
|
58
|
+
|
|
59
|
+
### Enhanced
|
|
60
|
+
- ๐ **Improved Authentication** - More robust session handling with automatic recovery
|
|
61
|
+
- ๐ **Better Error Handling** - Enhanced error messages and recovery mechanisms
|
|
62
|
+
- ๐จ **Developer Experience** - Improved TypeScript definitions and code documentation
|
|
63
|
+
- ๐งช **Testing Framework** - Updated test suite with better coverage and reliability
|
|
64
|
+
- ๐ **Documentation** - Comprehensive wiki updates with practical examples
|
|
65
|
+
|
|
66
|
+
### New Features
|
|
67
|
+
- **Credential Generation**:
|
|
68
|
+
- Random password generation with customizable complexity
|
|
69
|
+
- UUID v4 generation for unique client identifiers
|
|
70
|
+
- Secure random string generation for API keys
|
|
71
|
+
- Email-like identifier generation for client management
|
|
72
|
+
|
|
73
|
+
- **Session Management**:
|
|
74
|
+
- Intelligent session caching with TTL support
|
|
75
|
+
- Multi-server session handling
|
|
76
|
+
- Automatic session renewal and cleanup
|
|
77
|
+
- Database-ready session storage format
|
|
78
|
+
|
|
79
|
+
- **Web Integration**:
|
|
80
|
+
- Express.js middleware for route protection
|
|
81
|
+
- Next.js API route helpers
|
|
82
|
+
- Automatic cookie management
|
|
83
|
+
- Request/response transformation utilities
|
|
84
|
+
|
|
85
|
+
- **Protocol Builders**:
|
|
86
|
+
- Automated VLESS configuration generation
|
|
87
|
+
- VMess protocol setup helpers
|
|
88
|
+
- Trojan and Shadowsocks builders
|
|
89
|
+
- Reality and WireGuard configuration support
|
|
90
|
+
|
|
91
|
+
### Changed
|
|
92
|
+
- **Breaking Change**: Enhanced API structure with new module organization
|
|
93
|
+
- **Package Structure**: Moved from monolithic to modular architecture
|
|
94
|
+
- **Dependencies**: Updated to latest stable versions
|
|
95
|
+
- **Configuration**: Improved configuration options and defaults
|
|
96
|
+
|
|
97
|
+
### Security
|
|
98
|
+
- Enhanced input validation and sanitization
|
|
99
|
+
- Improved session security with automatic cleanup
|
|
100
|
+
- Better error handling to prevent information leakage
|
|
101
|
+
- Security monitoring and alerting capabilities
|
|
102
|
+
|
|
103
|
+
### Developer Experience
|
|
104
|
+
- Better TypeScript support with comprehensive type definitions
|
|
105
|
+
- Improved documentation with real-world examples
|
|
106
|
+
- Enhanced testing framework with automated validation
|
|
107
|
+
- ESLint configuration for code quality
|
|
108
|
+
|
|
109
|
+
### Performance
|
|
110
|
+
- Optimized session management with intelligent caching
|
|
111
|
+
- Reduced API call overhead through better request batching
|
|
112
|
+
- Improved memory usage with automatic cleanup
|
|
113
|
+
- Faster authentication flow with session reuse
|
|
114
|
+
|
|
115
|
+
## [1.0.0] - 2025-06-20
|
|
116
|
+
|
|
117
|
+
### Added
|
|
118
|
+
- Complete API client library for 3x-ui panel management
|
|
119
|
+
- Authentication with automatic session management
|
|
120
|
+
- Inbound management (5 methods): getInbounds, getInbound, addInbound, updateInbound, deleteInbound
|
|
121
|
+
- Client management (7 methods): addClient, updateClient, deleteClient, getClientTrafficsByEmail, getClientTrafficsById, getClientIps, clearClientIps
|
|
122
|
+
- Traffic management (4 methods): resetClientTraffic, resetAllTraffics, resetAllClientTraffics, deleteDepletedClients
|
|
123
|
+
- System operations (2 methods): getOnlineClients, createBackup
|
|
124
|
+
- Comprehensive error handling and automatic re-authentication
|
|
125
|
+
- TypeScript definitions for better developer experience
|
|
126
|
+
- ESM module support alongside CommonJS
|
|
127
|
+
- Complete documentation and wiki guides
|
|
128
|
+
- Interactive testing suite with 19 test files
|
|
129
|
+
- Security best practices implementation
|
|
130
|
+
|
|
131
|
+
### Features
|
|
132
|
+
- ๐ Secure session-based authentication
|
|
133
|
+
- ๐ Automatic login retry on session expiry
|
|
134
|
+
- ๐ Complete API coverage (19 routes tested and working)
|
|
135
|
+
- ๐ก๏ธ Server-side only design for security
|
|
136
|
+
- ๐ Comprehensive documentation with real-world examples
|
|
137
|
+
- ๐งช Extensive testing suite with actual API responses
|
|
138
|
+
- ๐ TypeScript support for better DX
|
|
139
|
+
- ๐ Both CommonJS and ESM module support
|
|
140
|
+
|
|
141
|
+
### Security
|
|
142
|
+
- No vulnerabilities in dependencies
|
|
143
|
+
- Secure session cookie handling
|
|
144
|
+
- Server-side only architecture
|
|
145
|
+
- Input validation and error handling
|
|
146
|
+
- Automatic timeout and retry mechanisms
|
|
147
|
+
|
|
148
|
+
## [Unreleased]
|
|
149
|
+
|
|
150
|
+
### Planned
|
|
151
|
+
- GitHub Actions CI/CD pipeline
|
|
152
|
+
- Automated semantic releases
|
|
153
|
+
- Enhanced unit test coverage
|
|
154
|
+
- Performance benchmarking tools
|
|
155
|
+
- Advanced monitoring and analytics
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Helitha Guruge
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Helitha Guruge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|