Feat expiration date (#1296)
Closes #1287 Co-authored-by: Vadim Babadzhanyan <vadim.babadzhanyan@my.games>
This commit is contained in:
committed by
GitHub
parent
40af030266
commit
8145809e22
+20
-2
@@ -71,6 +71,13 @@ class API {
|
||||
});
|
||||
}
|
||||
|
||||
async getWGEnableExpireTime() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
path: '/wg-enable-expire-time',
|
||||
});
|
||||
}
|
||||
|
||||
async getSession() {
|
||||
return this.call({
|
||||
method: 'get',
|
||||
@@ -101,17 +108,20 @@ class API {
|
||||
...client,
|
||||
createdAt: new Date(client.createdAt),
|
||||
updatedAt: new Date(client.updatedAt),
|
||||
expiredAt: client.expiredAt !== null
|
||||
? new Date(client.expiredAt)
|
||||
: null,
|
||||
latestHandshakeAt: client.latestHandshakeAt !== null
|
||||
? new Date(client.latestHandshakeAt)
|
||||
: null,
|
||||
})));
|
||||
}
|
||||
|
||||
async createClient({ name }) {
|
||||
async createClient({ name, expiredDate }) {
|
||||
return this.call({
|
||||
method: 'post',
|
||||
path: '/wireguard/client',
|
||||
body: { name },
|
||||
body: { name, expiredDate },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -152,6 +162,14 @@ class API {
|
||||
});
|
||||
}
|
||||
|
||||
async updateClientExpireDate({ clientId, expireDate }) {
|
||||
return this.call({
|
||||
method: 'put',
|
||||
path: `/wireguard/client/${clientId}/expireDate/`,
|
||||
body: { expireDate },
|
||||
});
|
||||
}
|
||||
|
||||
async restoreConfiguration(file) {
|
||||
return this.call({
|
||||
method: 'put',
|
||||
|
||||
Reference in New Issue
Block a user