Pull request: beta client squashed
Merge in DNS/adguard-home from beta-client-2 to master
Squashed commit of the following:
commit b2640cc49a6c5484d730b534dcf5a8013d7fa478
Merge: 659def862 aef4659e9
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Dec 29 19:23:09 2020 +0300
Merge branch 'master' into beta-client-2
commit 659def8626467949c35b7a6a0c99ffafb07b4385
Author: Eugene Burkov <e.burkov@adguard.com>
Date: Tue Dec 29 17:25:14 2020 +0300
all: upgrade github actions node version
commit b4b8cf8dd75672e9155da5d111ac66e8f5ba1535
Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com>
Date: Tue Dec 29 16:57:14 2020 +0300
all: beta client squashed
This commit is contained in:
31
client2/src/lib/apis/blockedServices.ts
Normal file
31
client2/src/lib/apis/blockedServices.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class BlockedServicesApi {
|
||||
static async blockedServicesList(): Promise<string[] | Error> {
|
||||
return await fetch(`/control/blocked_services/list`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async blockedServicesSet(data: string[]): Promise<number | Error> {
|
||||
return await fetch(`/control/blocked_services/set`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
103
client2/src/lib/apis/clients.ts
Normal file
103
client2/src/lib/apis/clients.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
import qs from 'qs';
|
||||
import Client, { IClient } from 'Entities/Client';
|
||||
import ClientDelete, { IClientDelete } from 'Entities/ClientDelete';
|
||||
import ClientUpdate, { IClientUpdate } from 'Entities/ClientUpdate';
|
||||
import Clients, { IClients } from 'Entities/Clients';
|
||||
import ClientsFindEntry, { IClientsFindEntry } from 'Entities/ClientsFindEntry';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class ClientsApi {
|
||||
static async clientsAdd(client: IClient): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const clientValid = new Client(client);
|
||||
haveError.push(...clientValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/clients/add`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(clientValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async clientsDelete(clientdelete: IClientDelete): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const clientdeleteValid = new ClientDelete(clientdelete);
|
||||
haveError.push(...clientdeleteValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/clients/delete`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(clientdeleteValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async clientsFind(ip0?: string): Promise<IClientsFindEntry[] | Error> {
|
||||
const queryParams = {
|
||||
ip0: ip0,
|
||||
}
|
||||
return await fetch(`/control/clients/find?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async clientsStatus(): Promise<IClients | Error> {
|
||||
return await fetch(`/control/clients`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async clientsUpdate(clientupdate: IClientUpdate): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const clientupdateValid = new ClientUpdate(clientupdate);
|
||||
haveError.push(...clientupdateValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/clients/update`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(clientupdateValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
110
client2/src/lib/apis/dhcp.ts
Normal file
110
client2/src/lib/apis/dhcp.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import DhcpConfig, { IDhcpConfig } from 'Entities/DhcpConfig';
|
||||
import DhcpSearchResult, { IDhcpSearchResult } from 'Entities/DhcpSearchResult';
|
||||
import DhcpStaticLease, { IDhcpStaticLease } from 'Entities/DhcpStaticLease';
|
||||
import DhcpStatus, { IDhcpStatus } from 'Entities/DhcpStatus';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class DhcpApi {
|
||||
static async checkActiveDhcp(): Promise<IDhcpSearchResult | Error> {
|
||||
return await fetch(`/control/dhcp/find_active_dhcp`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dhcpAddStaticLease(dhcpstaticlease: IDhcpStaticLease): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const dhcpstaticleaseValid = new DhcpStaticLease(dhcpstaticlease);
|
||||
haveError.push(...dhcpstaticleaseValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/dhcp/add_static_lease`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(dhcpstaticleaseValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dhcpRemoveStaticLease(dhcpstaticlease: IDhcpStaticLease): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const dhcpstaticleaseValid = new DhcpStaticLease(dhcpstaticlease);
|
||||
haveError.push(...dhcpstaticleaseValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/dhcp/remove_static_lease`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(dhcpstaticleaseValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dhcpReset(): Promise<number | Error> {
|
||||
return await fetch(`/control/dhcp/reset`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dhcpSetConfig(dhcpconfig: IDhcpConfig): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const dhcpconfigValid = new DhcpConfig(dhcpconfig);
|
||||
haveError.push(...dhcpconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/dhcp/set_config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(dhcpconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dhcpStatus(): Promise<IDhcpStatus | Error> {
|
||||
return await fetch(`/control/dhcp/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
167
client2/src/lib/apis/filtering.ts
Normal file
167
client2/src/lib/apis/filtering.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import qs from 'qs';
|
||||
import AddUrlRequest, { IAddUrlRequest } from 'Entities/AddUrlRequest';
|
||||
import FilterCheckHostResponse, { IFilterCheckHostResponse } from 'Entities/FilterCheckHostResponse';
|
||||
import FilterConfig, { IFilterConfig } from 'Entities/FilterConfig';
|
||||
import FilterRefreshRequest, { IFilterRefreshRequest } from 'Entities/FilterRefreshRequest';
|
||||
import FilterRefreshResponse, { IFilterRefreshResponse } from 'Entities/FilterRefreshResponse';
|
||||
import FilterSetUrl, { IFilterSetUrl } from 'Entities/FilterSetUrl';
|
||||
import FilterStatus, { IFilterStatus } from 'Entities/FilterStatus';
|
||||
import RemoveUrlRequest, { IRemoveUrlRequest } from 'Entities/RemoveUrlRequest';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class FilteringApi {
|
||||
static async filteringAddURL(addurlrequest: IAddUrlRequest): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const addurlrequestValid = new AddUrlRequest(addurlrequest);
|
||||
haveError.push(...addurlrequestValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/filtering/add_url`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(addurlrequestValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringCheckHost(name?: string): Promise<IFilterCheckHostResponse | Error> {
|
||||
const queryParams = {
|
||||
name: name,
|
||||
}
|
||||
return await fetch(`/control/filtering/check_host?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringConfig(filterconfig: IFilterConfig): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const filterconfigValid = new FilterConfig(filterconfig);
|
||||
haveError.push(...filterconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/filtering/config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(filterconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringRefresh(filterrefreshrequest: IFilterRefreshRequest): Promise<IFilterRefreshResponse | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const filterrefreshrequestValid = new FilterRefreshRequest(filterrefreshrequest);
|
||||
haveError.push(...filterrefreshrequestValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/filtering/refresh`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(filterrefreshrequestValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringRemoveURL(removeurlrequest: IRemoveUrlRequest): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const removeurlrequestValid = new RemoveUrlRequest(removeurlrequest);
|
||||
haveError.push(...removeurlrequestValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/filtering/remove_url`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(removeurlrequestValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringSetRules(data: string): Promise<number | Error> {
|
||||
const params = String(data);
|
||||
return await fetch(`/control/filtering/set_rules`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
body: params,
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringSetURL(filterseturl: IFilterSetUrl): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const filterseturlValid = new FilterSetUrl(filterseturl);
|
||||
haveError.push(...filterseturlValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/filtering/set_url`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(filterseturlValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async filteringStatus(): Promise<IFilterStatus | Error> {
|
||||
return await fetch(`/control/filtering/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
160
client2/src/lib/apis/global.ts
Normal file
160
client2/src/lib/apis/global.ts
Normal file
@@ -0,0 +1,160 @@
|
||||
import DNSConfig, { IDNSConfig } from 'Entities/DNSConfig';
|
||||
import GetVersionRequest, { IGetVersionRequest } from 'Entities/GetVersionRequest';
|
||||
import Login, { ILogin } from 'Entities/Login';
|
||||
import ProfileInfo, { IProfileInfo } from 'Entities/ProfileInfo';
|
||||
import ServerStatus, { IServerStatus } from 'Entities/ServerStatus';
|
||||
import UpstreamsConfig, { IUpstreamsConfig } from 'Entities/UpstreamsConfig';
|
||||
import UpstreamsConfigResponse, { IUpstreamsConfigResponse } from 'Entities/UpstreamsConfigResponse';
|
||||
import VersionInfo, { IVersionInfo } from 'Entities/VersionInfo';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class GlobalApi {
|
||||
static async beginUpdate(): Promise<number | Error> {
|
||||
return await fetch(`/control/update`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dnsConfig(dnsconfig: IDNSConfig): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const dnsconfigValid = new DNSConfig(dnsconfig);
|
||||
haveError.push(...dnsconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/dns_config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(dnsconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async dnsInfo(): Promise<IDNSConfig | Error> {
|
||||
return await fetch(`/control/dns_info`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async getProfile(): Promise<IProfileInfo | Error> {
|
||||
return await fetch(`/control/profile`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async getVersionJson(getversionrequest: IGetVersionRequest): Promise<IVersionInfo | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const getversionrequestValid = new GetVersionRequest(getversionrequest);
|
||||
haveError.push(...getversionrequestValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/version.json`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(getversionrequestValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async login(login: ILogin): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const loginValid = new Login(login);
|
||||
haveError.push(...loginValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/login`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(loginValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async logout(): Promise<number | Error> {
|
||||
return await fetch(`/control/logout`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async status(): Promise<IServerStatus | Error> {
|
||||
return await fetch(`/control/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async testUpstreamDNS(upstreamsconfig: IUpstreamsConfig): Promise<IUpstreamsConfigResponse | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const upstreamsconfigValid = new UpstreamsConfig(upstreamsconfig);
|
||||
haveError.push(...upstreamsconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/test_upstream_dns`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(upstreamsconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
32
client2/src/lib/apis/i18n.ts
Normal file
32
client2/src/lib/apis/i18n.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class I18nApi {
|
||||
static async changeLanguage(data: string): Promise<number | Error> {
|
||||
const params = String(data);
|
||||
return await fetch(`/control/i18n/change_language`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
body: params,
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async currentLanguage(): Promise<number | Error> {
|
||||
return await fetch(`/control/i18n/current_language`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
123
client2/src/lib/apis/install.ts
Normal file
123
client2/src/lib/apis/install.ts
Normal file
@@ -0,0 +1,123 @@
|
||||
import AddressesInfo, { IAddressesInfo } from 'Entities/AddressesInfo';
|
||||
import AddressesInfoBeta, { IAddressesInfoBeta } from 'Entities/AddressesInfoBeta';
|
||||
import CheckConfigRequest, { ICheckConfigRequest } from 'Entities/CheckConfigRequest';
|
||||
import CheckConfigRequestBeta, { ICheckConfigRequestBeta } from 'Entities/CheckConfigRequestBeta';
|
||||
import CheckConfigResponse, { ICheckConfigResponse } from 'Entities/CheckConfigResponse';
|
||||
import InitialConfiguration, { IInitialConfiguration } from 'Entities/InitialConfiguration';
|
||||
import InitialConfigurationBeta, { IInitialConfigurationBeta } from 'Entities/InitialConfigurationBeta';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class InstallApi {
|
||||
static async installCheckConfig(checkconfigrequest: ICheckConfigRequest): Promise<ICheckConfigResponse | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const checkconfigrequestValid = new CheckConfigRequest(checkconfigrequest);
|
||||
haveError.push(...checkconfigrequestValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/install/check_config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(checkconfigrequestValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async installCheckConfigBeta(checkconfigrequestbeta: ICheckConfigRequestBeta): Promise<ICheckConfigResponse | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const checkconfigrequestbetaValid = new CheckConfigRequestBeta(checkconfigrequestbeta);
|
||||
haveError.push(...checkconfigrequestbetaValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/install/check_config_beta`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(checkconfigrequestbetaValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async installConfigure(initialconfiguration: IInitialConfiguration): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const initialconfigurationValid = new InitialConfiguration(initialconfiguration);
|
||||
haveError.push(...initialconfigurationValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/install/configure`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(initialconfigurationValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async installConfigureBeta(initialconfigurationbeta: IInitialConfigurationBeta): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const initialconfigurationbetaValid = new InitialConfigurationBeta(initialconfigurationbeta);
|
||||
haveError.push(...initialconfigurationbetaValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/install/configure_beta`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(initialconfigurationbetaValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async installGetAddresses(): Promise<IAddressesInfo | Error> {
|
||||
return await fetch(`/control/install/get_addresses`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async installGetAddressesBeta(): Promise<IAddressesInfoBeta | Error> {
|
||||
return await fetch(`/control/install/get_addresses_beta`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
72
client2/src/lib/apis/log.ts
Normal file
72
client2/src/lib/apis/log.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import qs from 'qs';
|
||||
import QueryLog, { IQueryLog } from 'Entities/QueryLog';
|
||||
import QueryLogConfig, { IQueryLogConfig } from 'Entities/QueryLogConfig';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class LogApi {
|
||||
static async queryLog(older_than?: string, offset?: number, limit?: number, search?: string, response_status?: string): Promise<IQueryLog | Error> {
|
||||
const queryParams = {
|
||||
older_than: older_than,
|
||||
offset: offset,
|
||||
limit: limit,
|
||||
search: search,
|
||||
response_status: response_status,
|
||||
}
|
||||
return await fetch(`/control/querylog?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async queryLogConfig(querylogconfig: IQueryLogConfig): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const querylogconfigValid = new QueryLogConfig(querylogconfig);
|
||||
haveError.push(...querylogconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/querylog_config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(querylogconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async queryLogInfo(): Promise<IQueryLogConfig | Error> {
|
||||
return await fetch(`/control/querylog_info`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async querylogClear(): Promise<number | Error> {
|
||||
return await fetch(`/control/querylog_clear`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
35
client2/src/lib/apis/mobileconfig.ts
Normal file
35
client2/src/lib/apis/mobileconfig.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import qs from 'qs';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class MobileconfigApi {
|
||||
static async mobileConfigDoH(host?: string): Promise<number | Error> {
|
||||
const queryParams = {
|
||||
host: host,
|
||||
}
|
||||
return await fetch(`/control/apple/doh.mobileconfig?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async mobileConfigDoT(host?: string): Promise<number | Error> {
|
||||
const queryParams = {
|
||||
host: host,
|
||||
}
|
||||
return await fetch(`/control/apple/dot.mobileconfig?${qs.stringify(queryParams, { arrayFormat: 'comma' })}`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
44
client2/src/lib/apis/parental.ts
Normal file
44
client2/src/lib/apis/parental.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class ParentalApi {
|
||||
static async parentalDisable(): Promise<number | Error> {
|
||||
return await fetch(`/control/parental/disable`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async parentalEnable(data: string): Promise<number | Error> {
|
||||
const params = String(data);
|
||||
return await fetch(`/control/parental/enable`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
body: params,
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async parentalStatus(): Promise<any | Error> {
|
||||
return await fetch(`/control/parental/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
61
client2/src/lib/apis/rewrite.ts
Normal file
61
client2/src/lib/apis/rewrite.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import RewriteEntry, { IRewriteEntry } from 'Entities/RewriteEntry';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class RewriteApi {
|
||||
static async rewriteAdd(rewriteentry: IRewriteEntry): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const rewriteentryValid = new RewriteEntry(rewriteentry);
|
||||
haveError.push(...rewriteentryValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/rewrite/add`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(rewriteentryValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async rewriteDelete(rewriteentry: IRewriteEntry): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const rewriteentryValid = new RewriteEntry(rewriteentry);
|
||||
haveError.push(...rewriteentryValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/rewrite/delete`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(rewriteentryValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async rewriteList(): Promise<IRewriteEntry[] | Error> {
|
||||
return await fetch(`/control/rewrite/list`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
39
client2/src/lib/apis/safebrowsing.ts
Normal file
39
client2/src/lib/apis/safebrowsing.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class SafebrowsingApi {
|
||||
static async safebrowsingDisable(): Promise<number | Error> {
|
||||
return await fetch(`/control/safebrowsing/disable`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async safebrowsingEnable(): Promise<number | Error> {
|
||||
return await fetch(`/control/safebrowsing/enable`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async safebrowsingStatus(): Promise<any | Error> {
|
||||
return await fetch(`/control/safebrowsing/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
39
client2/src/lib/apis/safesearch.ts
Normal file
39
client2/src/lib/apis/safesearch.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class SafesearchApi {
|
||||
static async safesearchDisable(): Promise<number | Error> {
|
||||
return await fetch(`/control/safesearch/disable`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async safesearchEnable(): Promise<number | Error> {
|
||||
return await fetch(`/control/safesearch/enable`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async safesearchStatus(): Promise<any | Error> {
|
||||
return await fetch(`/control/safesearch/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
64
client2/src/lib/apis/stats.ts
Normal file
64
client2/src/lib/apis/stats.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import Stats, { IStats } from 'Entities/Stats';
|
||||
import StatsConfig, { IStatsConfig } from 'Entities/StatsConfig';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class StatsApi {
|
||||
static async stats(): Promise<IStats | Error> {
|
||||
return await fetch(`/control/stats`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async statsConfig(statsconfig: IStatsConfig): Promise<number | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const statsconfigValid = new StatsConfig(statsconfig);
|
||||
haveError.push(...statsconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/stats_config`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(statsconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async statsInfo(): Promise<IStatsConfig | Error> {
|
||||
return await fetch(`/control/stats_info`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async statsReset(): Promise<number | Error> {
|
||||
return await fetch(`/control/stats_reset`, {
|
||||
method: 'POST',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.status;
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
61
client2/src/lib/apis/tls.ts
Normal file
61
client2/src/lib/apis/tls.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import TlsConfig, { ITlsConfig } from 'Entities/TlsConfig';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export default class TlsApi {
|
||||
static async tlsConfigure(tlsconfig: ITlsConfig): Promise<ITlsConfig | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const tlsconfigValid = new TlsConfig(tlsconfig);
|
||||
haveError.push(...tlsconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/tls/configure`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(tlsconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async tlsStatus(): Promise<ITlsConfig | Error> {
|
||||
return await fetch(`/control/tls/status`, {
|
||||
method: 'GET',
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static async tlsValidate(tlsconfig: ITlsConfig): Promise<ITlsConfig | string[] | Error> {
|
||||
const haveError: string[] = [];
|
||||
const tlsconfigValid = new TlsConfig(tlsconfig);
|
||||
haveError.push(...tlsconfigValid.validate());
|
||||
if (haveError.length > 0) {
|
||||
return Promise.resolve(haveError);
|
||||
}
|
||||
return await fetch(`/control/tls/validate`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(tlsconfigValid.serialize()),
|
||||
}).then(async (res) => {
|
||||
if (res.status === 200) {
|
||||
return res.json();
|
||||
} else {
|
||||
return new Error(String(res.status));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user