x3ui-api 1.1.0 → 1.1.2
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/package.json +1 -1
- package/src/core/X3UIClient.d.ts +3 -0
- package/src/core/X3UIClient.js +12 -1
- package/src/index.d.ts +6 -5
package/package.json
CHANGED
package/src/core/X3UIClient.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {AxiosInstance} from "axios";
|
|
2
2
|
import {
|
|
3
|
+
ClientSettings,
|
|
3
4
|
DeepPartial,
|
|
4
5
|
InboundConfig,
|
|
5
6
|
LoginResponse,
|
|
@@ -20,6 +21,8 @@ export default class X3UIClient {
|
|
|
20
21
|
|
|
21
22
|
addInbound(config: Omit<InboundConfig, 'id'>): Promise<InboundConfig>;
|
|
22
23
|
|
|
24
|
+
addClient(id: number, client: DeepPartial<ClientSettings>): Promise<void>;
|
|
25
|
+
|
|
23
26
|
updateInbound(id: number, config: DeepPartial<InboundConfig>): Promise<void>;
|
|
24
27
|
|
|
25
28
|
deleteInbound(id: number): Promise<void>;
|
package/src/core/X3UIClient.js
CHANGED
|
@@ -160,7 +160,18 @@ module.exports = class X3UIClient {
|
|
|
160
160
|
if (!this.isAuthed) {
|
|
161
161
|
await this.login();
|
|
162
162
|
}
|
|
163
|
-
const response = await this.client.
|
|
163
|
+
const response = await this.client.get('/panel/api/server/getNewX25519Cert');
|
|
164
|
+
return response.data.obj;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async addClient(id, client) {
|
|
168
|
+
if (!this.isAuthed) {
|
|
169
|
+
await this.login();
|
|
170
|
+
}
|
|
171
|
+
const response = await this.client.post(`/panel/api/inbounds/addClient`, {
|
|
172
|
+
id,
|
|
173
|
+
settings: JSON.stringify({clients: [client]})
|
|
174
|
+
});
|
|
164
175
|
return response.data.obj;
|
|
165
176
|
}
|
|
166
177
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -31,11 +31,11 @@ export interface InboundConfig {
|
|
|
31
31
|
listen: string;
|
|
32
32
|
port: number;
|
|
33
33
|
protocol: string;
|
|
34
|
-
settings:
|
|
35
|
-
streamSettings:
|
|
34
|
+
settings: InboundSettings;
|
|
35
|
+
streamSettings: StreamSettings;
|
|
36
36
|
tag: string;
|
|
37
|
-
sniffing:
|
|
38
|
-
allocate:
|
|
37
|
+
sniffing: SniffingSettings;
|
|
38
|
+
allocate: AllocateSettings;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export interface AllocateSettings {
|
|
@@ -100,7 +100,8 @@ export interface InboundSettings {
|
|
|
100
100
|
|
|
101
101
|
export interface ClientSettings {
|
|
102
102
|
id: string;
|
|
103
|
-
flow
|
|
103
|
+
flow?: string;
|
|
104
|
+
security?: string;
|
|
104
105
|
email: string;
|
|
105
106
|
limitIp: number;
|
|
106
107
|
totalGB: number;
|