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:
18
client2/src/App.tsx
Normal file
18
client2/src/App.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import './main.pcss';
|
||||
import './lib/ant/ant.less';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Store, { storeValue } from 'Store';
|
||||
import './lib/ant';
|
||||
|
||||
import App from './components/App';
|
||||
|
||||
const Container = () => {
|
||||
return (
|
||||
<Store.Provider value={storeValue}>
|
||||
<App/>
|
||||
</Store.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
ReactDOM.render(<Container />, document.getElementById('app'));
|
||||
18
client2/src/Install.tsx
Normal file
18
client2/src/Install.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import './main.pcss';
|
||||
import './lib/ant/ant.less';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import Store, { storeValue } from 'Store/installStore';
|
||||
import './lib/ant';
|
||||
|
||||
import Install from './components/Install';
|
||||
|
||||
const Container = () => {
|
||||
return (
|
||||
<Store.Provider value={storeValue}>
|
||||
<Install/>
|
||||
</Store.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
ReactDOM.render(<Container />, document.getElementById('app'));
|
||||
BIN
client2/src/assets/img/background_min.png
Normal file
BIN
client2/src/assets/img/background_min.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
16
client2/src/components/App.tsx
Normal file
16
client2/src/components/App.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import React, { FC, useContext } from 'react';
|
||||
import Store from 'Store';
|
||||
import Icons from 'Lib/theme/Icons';
|
||||
|
||||
const App: FC = observer(() => {
|
||||
const store = useContext(Store);
|
||||
return (
|
||||
<div>
|
||||
{store.ui.currentLang}
|
||||
<Icons/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default App;
|
||||
14
client2/src/components/Install/Install.module.pcss
Normal file
14
client2/src/components/Install/Install.module.pcss
Normal file
@@ -0,0 +1,14 @@
|
||||
.layout {
|
||||
background-image: url('../../assets/img/background_min.png');
|
||||
background-repeat: no-repeat;
|
||||
min-height: 100vh;
|
||||
background-color: #f1f3f7;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 40px;
|
||||
}
|
||||
.content {
|
||||
max-width: 404px;
|
||||
}
|
||||
122
client2/src/components/Install/Install.tsx
Normal file
122
client2/src/components/Install/Install.tsx
Normal file
@@ -0,0 +1,122 @@
|
||||
import React, { FC } from 'react';
|
||||
import { Layout } from 'antd';
|
||||
import { Formik, FormikHelpers } from 'formik';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import { IInitialConfigurationBeta } from 'Entities/InitialConfigurationBeta';
|
||||
import Icons from 'Lib/theme/Icons';
|
||||
import {
|
||||
DEFAULT_DNS_ADDRESS,
|
||||
DEFAULT_DNS_PORT,
|
||||
DEFAULT_IP_ADDRESS,
|
||||
DEFAULT_IP_PORT,
|
||||
} from 'Consts/install';
|
||||
import { notifyError } from 'Common/ui';
|
||||
import InstallStore from 'Store/stores/Install';
|
||||
|
||||
import AdminInterface from './components/AdminInterface';
|
||||
import Auth from './components/Auth';
|
||||
import DnsServer from './components/DnsServer';
|
||||
import Stepper from './components/Stepper';
|
||||
import Welcome from './components/Welcome';
|
||||
import ConfigureDevices from './components/ConfigureDevices';
|
||||
|
||||
import s from './Install.module.pcss';
|
||||
|
||||
const { Content } = Layout;
|
||||
|
||||
export type FormValues = IInitialConfigurationBeta & { step: number };
|
||||
|
||||
const InstallForm: FC = observer(() => {
|
||||
const initialValues: FormValues = {
|
||||
step: 0,
|
||||
web: {
|
||||
ip: [DEFAULT_IP_ADDRESS],
|
||||
port: DEFAULT_IP_PORT,
|
||||
},
|
||||
dns: {
|
||||
ip: [DEFAULT_DNS_ADDRESS],
|
||||
port: DEFAULT_DNS_PORT,
|
||||
},
|
||||
password: '',
|
||||
username: '',
|
||||
};
|
||||
|
||||
const onNext = async (values: FormValues, { setFieldValue }: FormikHelpers<FormValues>) => {
|
||||
const currentStep = values.step;
|
||||
const checker = (condition: boolean, message: string) => {
|
||||
if (condition) {
|
||||
setFieldValue('step', currentStep + 1);
|
||||
} else {
|
||||
notifyError(message);
|
||||
}
|
||||
};
|
||||
switch (currentStep) {
|
||||
case 1: {
|
||||
// web
|
||||
const check = await InstallStore.checkConfig(values);
|
||||
checker(check?.web?.status === '', check?.web?.status || '');
|
||||
break;
|
||||
}
|
||||
case 3: {
|
||||
// dns
|
||||
const check = await InstallStore.checkConfig(values);
|
||||
checker(check?.dns?.status === '', check?.dns?.status || '');
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
// configure
|
||||
const config = await InstallStore.configure(values);
|
||||
if (config) {
|
||||
const { web } = values;
|
||||
window.location.href = `http://${web.ip[0]}:${web.port}`;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
setFieldValue('step', currentStep + 1);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Formik
|
||||
initialValues={initialValues}
|
||||
onSubmit={onNext}
|
||||
>
|
||||
{({ values, handleSubmit, setFieldValue }) => (
|
||||
<form noValidate className={s.content} onSubmit={handleSubmit}>
|
||||
<Stepper currentStep={values.step} />
|
||||
{values.step === 0 && (
|
||||
<Welcome onNext={() => setFieldValue('step', 1)}/>
|
||||
)}
|
||||
{values.step === 1 && (
|
||||
<AdminInterface values={values} setFieldValue={setFieldValue} />
|
||||
)}
|
||||
{values.step === 2 && (
|
||||
<Auth values={values} setFieldValue={setFieldValue} />
|
||||
)}
|
||||
{values.step === 3 && (
|
||||
<DnsServer values={values} setFieldValue={setFieldValue} />
|
||||
)}
|
||||
{values.step === 4 && (
|
||||
<ConfigureDevices values={values} setFieldValue={setFieldValue} />
|
||||
)}
|
||||
</form>
|
||||
)}
|
||||
</Formik>
|
||||
);
|
||||
});
|
||||
|
||||
const Install: FC = () => {
|
||||
return (
|
||||
<Layout className={s.layout}>
|
||||
<Content className={s.container}>
|
||||
<InstallForm />
|
||||
</Content>
|
||||
<Icons/>
|
||||
</Layout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Install;
|
||||
@@ -0,0 +1,17 @@
|
||||
.manualOptions {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.name {
|
||||
padding-bottom: 5px;
|
||||
border-bottom: 1px solid var(--gray300);
|
||||
margin-bottom: 16px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.manualOption {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import cn from 'classnames';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FormikHelpers } from 'formik';
|
||||
|
||||
import { Input, Radio, Switch } from 'Common/controls';
|
||||
import { DEFAULT_IP_ADDRESS } from 'Consts/install';
|
||||
import { chechNetworkType, NETWORK_TYPE } from 'Helpers/installHelpers';
|
||||
import theme from 'Lib/theme';
|
||||
import Store from 'Store/installStore';
|
||||
|
||||
import s from './AdminInterface.module.pcss';
|
||||
import { FormValues } from '../../Install';
|
||||
import StepButtons from '../StepButtons';
|
||||
|
||||
enum NETWORK_OPTIONS {
|
||||
ALL = 'all',
|
||||
CUSTOM = 'custom',
|
||||
}
|
||||
|
||||
interface AdminInterfaceProps {
|
||||
values: FormValues;
|
||||
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
|
||||
}
|
||||
|
||||
const AdminInterface: FC<AdminInterfaceProps> = observer(({
|
||||
values,
|
||||
setFieldValue,
|
||||
}) => {
|
||||
const { ui: { intl }, install: { addresses } } = useContext(Store);
|
||||
const { web: { ip } } = values;
|
||||
const radioValue = ip.length === 1 && ip[0] === DEFAULT_IP_ADDRESS
|
||||
? NETWORK_OPTIONS.ALL : NETWORK_OPTIONS.CUSTOM;
|
||||
|
||||
const onSelectRadio = (v: string | number) => {
|
||||
const value = v === NETWORK_OPTIONS.ALL
|
||||
? [DEFAULT_IP_ADDRESS] : [];
|
||||
setFieldValue('web.ip', value);
|
||||
};
|
||||
|
||||
const getManualBlock = () => (
|
||||
<div className={s.manualOptions}>
|
||||
{addresses?.interfaces.map((a) => {
|
||||
let name = '';
|
||||
const type = chechNetworkType(a.name);
|
||||
switch (type) {
|
||||
case NETWORK_TYPE.ETHERNET:
|
||||
name = `${intl.getMessage('ethernet')} (${a.name}) `;
|
||||
break;
|
||||
case NETWORK_TYPE.LOCAL:
|
||||
name = `${intl.getMessage('localhost')} (${a.name}) `;
|
||||
break;
|
||||
default:
|
||||
name = a.name || '';
|
||||
break;
|
||||
}
|
||||
return (
|
||||
<div key={a.name}>
|
||||
<div>
|
||||
<div className={s.name}>
|
||||
{name}
|
||||
</div>
|
||||
{a.ipAddresses?.map((addrIp) => (
|
||||
<div key={addrIp} className={s.manualOption}>
|
||||
<div className={theme.typography.subtext}>
|
||||
http://{addrIp}
|
||||
</div>
|
||||
<Switch
|
||||
checked={values.web.ip.includes(addrIp)}
|
||||
onChange={() => {
|
||||
const temp = new Set(ip);
|
||||
if (temp.has(addrIp)) {
|
||||
temp.delete(addrIp);
|
||||
} else {
|
||||
temp.add(addrIp);
|
||||
}
|
||||
setFieldValue('web.ip', Array.from(temp.values()));
|
||||
}}/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={s.content}>
|
||||
<div className={theme.typography.title}>
|
||||
{intl.getMessage('install_admin_interface_title')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_block)}>
|
||||
{intl.getMessage('install_admin_interface_title_decs')}
|
||||
</div>
|
||||
<div className={theme.typography.subTitle}>
|
||||
{intl.getMessage('install_admin_interface_where_interface')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_admin_interface_where_interface_desc')}
|
||||
</div>
|
||||
<Radio
|
||||
value={radioValue}
|
||||
onSelect={onSelectRadio}
|
||||
options={[
|
||||
{
|
||||
value: NETWORK_OPTIONS.ALL,
|
||||
label: intl.getMessage('install_all_networks'),
|
||||
desc: intl.getMessage('install_all_networks_description'),
|
||||
},
|
||||
{
|
||||
value: NETWORK_OPTIONS.CUSTOM,
|
||||
label: intl.getMessage('install_choose_networks'),
|
||||
desc: intl.getMessage('install_choose_networks_desc'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{ radioValue !== NETWORK_OPTIONS.ALL && getManualBlock()}
|
||||
<div className={theme.typography.subTitle}>
|
||||
{intl.getMessage('install_admin_interface_port')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_admin_interface_port_desc')}
|
||||
</div>
|
||||
<Input
|
||||
label={`${intl.getMessage('port')}:`}
|
||||
placeholder={intl.getMessage('port')}
|
||||
type="number"
|
||||
name="webPort"
|
||||
value={values.web.port}
|
||||
onChange={(v) => {
|
||||
const port = v === '' ? '' : parseInt(v, 10);
|
||||
setFieldValue('web.port', port);
|
||||
}}
|
||||
/>
|
||||
<StepButtons
|
||||
setFieldValue={setFieldValue}
|
||||
currentStep={1}
|
||||
values={values}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default AdminInterface;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './AdminInterface';
|
||||
55
client2/src/components/Install/components/Auth/Auth.tsx
Normal file
55
client2/src/components/Install/components/Auth/Auth.tsx
Normal file
@@ -0,0 +1,55 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import cn from 'classnames';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FormikHelpers } from 'formik';
|
||||
|
||||
import { Input } from 'Common/controls';
|
||||
import theme from 'Lib/theme';
|
||||
import Store from 'Store/installStore';
|
||||
|
||||
import StepButtons from '../StepButtons';
|
||||
import { FormValues } from '../../Install';
|
||||
|
||||
interface AuthProps {
|
||||
values: FormValues;
|
||||
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
|
||||
}
|
||||
|
||||
const Auth: FC<AuthProps> = observer(({
|
||||
values,
|
||||
setFieldValue,
|
||||
}) => {
|
||||
const { ui: { intl } } = useContext(Store);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={theme.typography.title}>
|
||||
{intl.getMessage('install_auth_title')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_block)}>
|
||||
{intl.getMessage('install_auth_description')}
|
||||
</div>
|
||||
<Input
|
||||
placeholder={intl.getMessage('login')}
|
||||
type="username"
|
||||
name="username"
|
||||
value={values.username}
|
||||
onChange={(v) => setFieldValue('username', v)}
|
||||
/>
|
||||
<Input
|
||||
placeholder={intl.getMessage('password')}
|
||||
type="password"
|
||||
name="password"
|
||||
value={values.password}
|
||||
onChange={(v) => setFieldValue('password', v)}
|
||||
/>
|
||||
<StepButtons
|
||||
setFieldValue={setFieldValue}
|
||||
currentStep={2}
|
||||
values={values}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default Auth;
|
||||
1
client2/src/components/Install/components/Auth/index.ts
Normal file
1
client2/src/components/Install/components/Auth/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './Auth';
|
||||
@@ -0,0 +1,4 @@
|
||||
.tabs {
|
||||
width: 505px;
|
||||
margin-left: -131px;
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import { Tabs } from 'antd';
|
||||
import cn from 'classnames';
|
||||
import { FormikHelpers } from 'formik';
|
||||
|
||||
import Store from 'Store/installStore';
|
||||
import theme from 'Lib/theme';
|
||||
import { danger, p } from 'Common/formating';
|
||||
import { DEFAULT_DNS_PORT, DEFAULT_IP_ADDRESS, DEFAULT_IP_PORT } from 'Consts/install';
|
||||
|
||||
import { FormValues } from '../../Install';
|
||||
import StepButtons from '../StepButtons';
|
||||
import s from './ConfigureDevices.module.pcss';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
interface ConfigureDevicesProps {
|
||||
values: FormValues;
|
||||
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
|
||||
}
|
||||
|
||||
const ConfigureDevices: FC<ConfigureDevicesProps> = ({
|
||||
values, setFieldValue,
|
||||
}) => {
|
||||
const { ui: { intl }, install: { addresses } } = useContext(Store);
|
||||
|
||||
const dhcp = (e: string) => (
|
||||
// TODO: link to dhcp
|
||||
<a href="http://" target="_blank" rel="noopener noreferrer">{e}</a>
|
||||
);
|
||||
|
||||
const allIps = addresses?.interfaces.reduce<string[]>((all, data) => {
|
||||
const { ipAddresses } = data;
|
||||
if (ipAddresses) {
|
||||
all.push(...ipAddresses);
|
||||
}
|
||||
return all;
|
||||
}, [] as string[]);
|
||||
|
||||
const { web: { ip: webIp }, dns: { ip: dnsIp } } = values;
|
||||
const selectedWebIps = webIp.length === 1 && webIp[0] === DEFAULT_IP_ADDRESS
|
||||
? allIps : webIp;
|
||||
const selectedDnsIps = dnsIp.length === 1 && dnsIp[0] === DEFAULT_IP_ADDRESS
|
||||
? allIps : dnsIp;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={theme.typography.title}>
|
||||
{intl.getMessage('install_configure_title')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_block)}>
|
||||
{intl.getMessage('install_configure_danger_notice', { danger })}
|
||||
</div>
|
||||
<div className={theme.typography.subTitle}>
|
||||
{intl.getMessage('install_configure_how_to_title')}
|
||||
</div>
|
||||
<Tabs defaultActiveKey="1" tabPosition="left" className={s.tabs}>
|
||||
<TabPane tab="Router" key="1">
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_configure_router', { p })}
|
||||
</div>
|
||||
</TabPane>
|
||||
<TabPane tab="Windows" key="2">
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_configure_windows', { p })}
|
||||
</div>
|
||||
</TabPane>
|
||||
<TabPane tab="Macos" key="3">
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_configure_macos', { p })}
|
||||
</div>
|
||||
</TabPane>
|
||||
<TabPane tab="Linux" key="4">
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{/* TODO: add linux setup */}
|
||||
{intl.getMessage('install_configure_router', { p })}
|
||||
</div>
|
||||
</TabPane>
|
||||
<TabPane tab="Android" key="5">
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_configure_android', { p })}
|
||||
</div>
|
||||
</TabPane>
|
||||
<TabPane tab="iOs" key="6">
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_configure_ios', { p })}
|
||||
</div>
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
|
||||
<div className={theme.typography.subTitle}>
|
||||
{intl.getMessage('install_configure_adresses')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
<p>
|
||||
{intl.getMessage('install_admin_interface_title')}
|
||||
</p>
|
||||
<p>
|
||||
{selectedWebIps?.map((ip) => (
|
||||
<div key={ip}>
|
||||
{ip}{values.web.port !== DEFAULT_IP_PORT && `:${values.web.port}`}
|
||||
</div>
|
||||
))}
|
||||
</p>
|
||||
<p>
|
||||
{intl.getMessage('install_dns_server_title')}
|
||||
</p>
|
||||
<div>
|
||||
{selectedDnsIps?.map((ip) => (
|
||||
<div key={ip}>
|
||||
{ip}{values.dns.port !== DEFAULT_DNS_PORT && `:${values.dns.port}`}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_configure_dhcp', { dhcp })}
|
||||
</div>
|
||||
<StepButtons
|
||||
setFieldValue={setFieldValue}
|
||||
currentStep={4}
|
||||
values={values}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConfigureDevices;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './ConfigureDevices';
|
||||
@@ -0,0 +1,12 @@
|
||||
.manualOptions {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.manualOption {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid var(--gray300);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import cn from 'classnames';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FormikHelpers } from 'formik';
|
||||
|
||||
import { Input, Radio, Switch } from 'Common/controls';
|
||||
import { DEFAULT_IP_ADDRESS } from 'Consts/install';
|
||||
import { chechNetworkType, NETWORK_TYPE } from 'Helpers/installHelpers';
|
||||
import theme from 'Lib/theme';
|
||||
import Store from 'Store/installStore';
|
||||
|
||||
import s from './DnsServer.module.pcss';
|
||||
import { FormValues } from '../../Install';
|
||||
import StepButtons from '../StepButtons';
|
||||
|
||||
enum NETWORK_OPTIONS {
|
||||
ALL = 'all',
|
||||
CUSTOM = 'custom',
|
||||
}
|
||||
|
||||
interface DnsServerProps {
|
||||
values: FormValues;
|
||||
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
|
||||
}
|
||||
|
||||
const DnsServer: FC<DnsServerProps> = observer(({
|
||||
values,
|
||||
setFieldValue,
|
||||
}) => {
|
||||
const { ui: { intl }, install: { addresses } } = useContext(Store);
|
||||
const { dns: { ip } } = values;
|
||||
const radioValue = ip.length === 1 && ip[0] === DEFAULT_IP_ADDRESS
|
||||
? NETWORK_OPTIONS.ALL : NETWORK_OPTIONS.CUSTOM;
|
||||
|
||||
const onSelectRadio = (v: string | number) => {
|
||||
const value = v === NETWORK_OPTIONS.ALL
|
||||
? [DEFAULT_IP_ADDRESS] : [];
|
||||
setFieldValue('dns.ip', value);
|
||||
};
|
||||
|
||||
const getManualBlock = () => (
|
||||
<div className={s.manualOptions}>
|
||||
{addresses?.interfaces.map((a) => {
|
||||
let name = '';
|
||||
const type = chechNetworkType(a.name);
|
||||
switch (type) {
|
||||
case NETWORK_TYPE.ETHERNET:
|
||||
name = `${intl.getMessage('ethernet')} (${a.name}) `;
|
||||
break;
|
||||
case NETWORK_TYPE.LOCAL:
|
||||
name = `${intl.getMessage('localhost')} (${a.name}) `;
|
||||
break;
|
||||
default:
|
||||
name = a.name || '';
|
||||
break;
|
||||
}
|
||||
return (
|
||||
<div key={a.name}>
|
||||
<div>
|
||||
<div className={s.name}>
|
||||
{name}
|
||||
</div>
|
||||
{a.ipAddresses?.map((addrIp) => (
|
||||
<div key={addrIp} className={s.manualOption}>
|
||||
<div className={theme.typography.subtext}>
|
||||
{addrIp}
|
||||
</div>
|
||||
<Switch
|
||||
checked={values.dns.ip.includes(addrIp)}
|
||||
onChange={() => {
|
||||
const temp = new Set(ip);
|
||||
if (temp.has(addrIp)) {
|
||||
temp.delete(addrIp);
|
||||
} else {
|
||||
temp.add(addrIp);
|
||||
}
|
||||
setFieldValue('dns.ip', Array.from(temp.values()));
|
||||
}}/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className={theme.typography.title}>
|
||||
{intl.getMessage('install_dns_server_title')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_block)}>
|
||||
{intl.getMessage('install_dns_server_desc')}
|
||||
</div>
|
||||
<div className={theme.typography.subTitle}>
|
||||
{intl.getMessage('install_dns_server_network_interfaces')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_dns_server_network_interfaces_desc')}
|
||||
</div>
|
||||
<Radio
|
||||
value={radioValue}
|
||||
onSelect={onSelectRadio}
|
||||
options={[
|
||||
{
|
||||
value: NETWORK_OPTIONS.ALL,
|
||||
label: intl.getMessage('install_all_networks'),
|
||||
desc: intl.getMessage('install_all_networks_description'),
|
||||
},
|
||||
{
|
||||
value: NETWORK_OPTIONS.CUSTOM,
|
||||
label: intl.getMessage('install_choose_networks'),
|
||||
desc: intl.getMessage('install_choose_networks_desc'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{ radioValue !== NETWORK_OPTIONS.ALL && getManualBlock()}
|
||||
<div className={theme.typography.subTitle}>
|
||||
{intl.getMessage('install_dns_server_port')}
|
||||
</div>
|
||||
<div className={cn(theme.typography.text, theme.typography.text_base)}>
|
||||
{intl.getMessage('install_dns_server_port_desc')}
|
||||
</div>
|
||||
<Input
|
||||
label={`${intl.getMessage('port')}:`}
|
||||
placeholder={intl.getMessage('port')}
|
||||
type="number"
|
||||
name="dnsPort"
|
||||
value={values.dns.port}
|
||||
onChange={(v) => {
|
||||
const port = v === '' ? '' : parseInt(v, 10);
|
||||
setFieldValue('dns.port', port);
|
||||
}}
|
||||
/>
|
||||
<StepButtons
|
||||
setFieldValue={setFieldValue}
|
||||
currentStep={3}
|
||||
values={values}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default DnsServer;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './DnsServer';
|
||||
@@ -0,0 +1,8 @@
|
||||
.button {
|
||||
margin-top: 48px;
|
||||
width: 190px;
|
||||
|
||||
&.inGroup {
|
||||
margin-right: 24px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import { Button } from 'antd';
|
||||
import cn from 'classnames';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
import { FormikHelpers } from 'formik';
|
||||
|
||||
import Store from 'Store/installStore';
|
||||
|
||||
import { FormValues } from '../../Install';
|
||||
import s from './StepButtons.module.pcss';
|
||||
|
||||
interface StepButtonsProps {
|
||||
setFieldValue: FormikHelpers<FormValues>['setFieldValue'];
|
||||
currentStep: number;
|
||||
values: FormValues;
|
||||
}
|
||||
|
||||
const StepButtons: FC<StepButtonsProps> = observer(({
|
||||
setFieldValue,
|
||||
currentStep,
|
||||
}) => {
|
||||
const { ui: { intl } } = useContext(Store);
|
||||
return (
|
||||
<div>
|
||||
<Button
|
||||
size="large"
|
||||
type="ghost"
|
||||
className={cn(s.button, s.inGroup)}
|
||||
onClick={() => setFieldValue('step', currentStep - 1)}
|
||||
>
|
||||
{intl.getMessage('back')}
|
||||
</Button>
|
||||
<Button
|
||||
size="large"
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
className={cn(s.button)}
|
||||
>
|
||||
{intl.getMessage('next')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default StepButtons;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './StepButtons';
|
||||
@@ -0,0 +1,3 @@
|
||||
.stepper {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import React, { FC } from 'react';
|
||||
import { Steps } from 'antd';
|
||||
|
||||
import s from './Stepper.module.pcss';
|
||||
|
||||
interface StepperProps {
|
||||
currentStep: number;
|
||||
}
|
||||
|
||||
const { Step } = Steps;
|
||||
|
||||
const Stepper: FC<StepperProps> = ({ currentStep }) => {
|
||||
return (
|
||||
<Steps progressDot current={currentStep} className={s.stepper}>
|
||||
<Step/>
|
||||
<Step/>
|
||||
<Step/>
|
||||
<Step/>
|
||||
<Step/>
|
||||
</Steps>
|
||||
);
|
||||
};
|
||||
|
||||
export default Stepper;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './Stepper';
|
||||
@@ -0,0 +1,15 @@
|
||||
.iconContainer{
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
.icon {
|
||||
width: 185px;
|
||||
height: 57px;
|
||||
}
|
||||
.button {
|
||||
margin-top: 48px;
|
||||
width: 190px;
|
||||
|
||||
&.inGroup {
|
||||
margin-right: 24px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import React, { FC, useContext } from 'react';
|
||||
import { Button } from 'antd';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import Store from 'Store/installStore';
|
||||
import Icon from 'Common/ui/Icon';
|
||||
import theme from 'Lib/theme';
|
||||
|
||||
import s from './Welcome.module.pcss';
|
||||
|
||||
interface WelcomeProps {
|
||||
onNext: () => void;
|
||||
}
|
||||
|
||||
const Welcome: FC<WelcomeProps> = observer(({ onNext }) => {
|
||||
const { ui: { intl } } = useContext(Store);
|
||||
return (
|
||||
<div className={s.content}>
|
||||
<div className={s.iconContainer}>
|
||||
<Icon icon="mainLogo" className={s.icon} />
|
||||
</div>
|
||||
<div className={theme.typography.title}>
|
||||
{intl.getMessage('install_wellcome_title')}
|
||||
</div>
|
||||
<div className={theme.typography.text}>
|
||||
{intl.getMessage('install_wellcome_desc')}
|
||||
</div>
|
||||
<Button
|
||||
size="large"
|
||||
type="primary"
|
||||
className={s.button}
|
||||
onClick={onNext}
|
||||
>
|
||||
{intl.getMessage('install_wellcome_button')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
export default Welcome;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './Welcome';
|
||||
1
client2/src/components/Install/index.ts
Normal file
1
client2/src/components/Install/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './Install';
|
||||
146
client2/src/components/common/controls/Input/Input.tsx
Normal file
146
client2/src/components/common/controls/Input/Input.tsx
Normal file
@@ -0,0 +1,146 @@
|
||||
import React, { FC, FocusEvent, KeyboardEvent, ClipboardEvent, ChangeEvent, useState } from 'react';
|
||||
import { Input as InputControl } from 'antd';
|
||||
import { InputProps as InputControlProps } from 'antd/lib/input';
|
||||
import cn from 'classnames';
|
||||
|
||||
import { Icon } from 'Common/ui';
|
||||
import theme from 'Lib/theme';
|
||||
|
||||
interface AdminInterfaceProps {
|
||||
autoComplete?: InputControlProps['autoComplete'];
|
||||
autoFocus?: InputControlProps['autoFocus'];
|
||||
className?: string;
|
||||
description?: string;
|
||||
disabled?: boolean;
|
||||
error?: boolean;
|
||||
id?: string;
|
||||
inputMode?: InputControlProps['inputMode'];
|
||||
label?: string;
|
||||
wrapperClassName?: string;
|
||||
name: string;
|
||||
onBlur?: (e: FocusEvent<HTMLInputElement>) => void;
|
||||
onChange?: (data: string, e?: ChangeEvent<HTMLInputElement>) => void;
|
||||
onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
|
||||
onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
||||
onPaste?: (e: ClipboardEvent<HTMLInputElement>) => void;
|
||||
pattern?: InputControlProps['pattern'];
|
||||
placeholder: string;
|
||||
prefix?: InputControlProps['prefix'];
|
||||
size?: InputControlProps['size'];
|
||||
suffix?: InputControlProps['suffix'];
|
||||
type: InputControlProps['type'];
|
||||
value: string | number;
|
||||
}
|
||||
|
||||
const InputComponent: FC<AdminInterfaceProps> = ({
|
||||
autoComplete,
|
||||
autoFocus,
|
||||
className,
|
||||
description,
|
||||
disabled,
|
||||
error,
|
||||
id,
|
||||
inputMode,
|
||||
label,
|
||||
wrapperClassName,
|
||||
name,
|
||||
onBlur,
|
||||
onChange,
|
||||
onFocus,
|
||||
onKeyDown,
|
||||
onPaste,
|
||||
pattern,
|
||||
placeholder,
|
||||
prefix,
|
||||
size = 'middle',
|
||||
suffix,
|
||||
type,
|
||||
value,
|
||||
}) => {
|
||||
const [inputType, setInputType] = useState(type);
|
||||
|
||||
const inputClass = cn(
|
||||
'input',
|
||||
{ input_big: size === 'large' },
|
||||
{ input_medium: size === 'middle' },
|
||||
{ input_small: size === 'small' },
|
||||
className,
|
||||
);
|
||||
|
||||
const handleBlur = (e: FocusEvent<HTMLInputElement>) => {
|
||||
if (onBlur) {
|
||||
onBlur(e);
|
||||
}
|
||||
};
|
||||
|
||||
const showPassword = () => {
|
||||
if (inputType === 'password') {
|
||||
setInputType('text');
|
||||
} else {
|
||||
setInputType('password');
|
||||
}
|
||||
};
|
||||
|
||||
const showPasswordIcon = () => {
|
||||
const icon = inputType === 'password' ? 'visibility_disable' : 'visibility_enable';
|
||||
return (
|
||||
<Icon
|
||||
icon={icon}
|
||||
className={theme.form.reveal}
|
||||
onClick={showPassword}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const validSuffix = (
|
||||
<>
|
||||
{!!suffix && suffix}
|
||||
{(type === 'password') && showPasswordIcon()}
|
||||
</>
|
||||
);
|
||||
|
||||
let descriptionView = null;
|
||||
if (description) {
|
||||
descriptionView = (
|
||||
<div className={theme.form.label}>
|
||||
{description}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<label htmlFor={id || name} className={cn(theme.form.group, wrapperClassName)}>
|
||||
{label && (
|
||||
<div className={theme.form.label}>
|
||||
{label}
|
||||
</div>
|
||||
)}
|
||||
<InputControl
|
||||
autoComplete={autoComplete}
|
||||
autoFocus={autoFocus}
|
||||
className={inputClass}
|
||||
disabled={disabled}
|
||||
formNoValidate
|
||||
id={id || name}
|
||||
inputMode={inputMode}
|
||||
name={name}
|
||||
onBlur={handleBlur}
|
||||
onChange={(e) => onChange && onChange(e.target.value ? e.target.value : '', e)}
|
||||
onFocus={onFocus}
|
||||
onKeyDown={onKeyDown}
|
||||
onPaste={onPaste}
|
||||
pattern={pattern}
|
||||
placeholder={placeholder}
|
||||
prefix={prefix}
|
||||
size="large"
|
||||
suffix={validSuffix}
|
||||
type={inputType}
|
||||
value={value}
|
||||
data-error={error}
|
||||
/>
|
||||
{descriptionView}
|
||||
</label>
|
||||
);
|
||||
};
|
||||
|
||||
export default InputComponent;
|
||||
1
client2/src/components/common/controls/Input/index.ts
Normal file
1
client2/src/components/common/controls/Input/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as Input } from './Input';
|
||||
@@ -0,0 +1,16 @@
|
||||
.group {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.radio {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 16px;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid var(--gray300);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
}
|
||||
57
client2/src/components/common/controls/Radio/Radio.tsx
Normal file
57
client2/src/components/common/controls/Radio/Radio.tsx
Normal file
@@ -0,0 +1,57 @@
|
||||
import React, { FC } from 'react';
|
||||
import { Radio } from 'antd';
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import theme from 'Lib/theme';
|
||||
|
||||
import s from './Radio.module.pcss';
|
||||
|
||||
const { Group } = Radio;
|
||||
|
||||
interface AdminInterfaceProps {
|
||||
options: {
|
||||
label: string;
|
||||
desc?: string;
|
||||
value: string | number;
|
||||
}[];
|
||||
onSelect: (value: string | number) => void;
|
||||
value: string | number;
|
||||
}
|
||||
|
||||
const RadioComponent: FC<AdminInterfaceProps> = observer(({
|
||||
options, onSelect, value,
|
||||
}) => {
|
||||
if (options.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Group
|
||||
value={value}
|
||||
onChange={(e) => {
|
||||
onSelect(e.target.value);
|
||||
}}
|
||||
className={s.group}
|
||||
>
|
||||
{options.map((o) => (
|
||||
<Radio
|
||||
key={o.value}
|
||||
value={o.value}
|
||||
className={s.radio}
|
||||
>
|
||||
<div>
|
||||
{o.label}
|
||||
</div>
|
||||
{o.desc && (
|
||||
<div className={theme.typography.subtext}>
|
||||
{o.desc}
|
||||
</div>
|
||||
)}
|
||||
</Radio>
|
||||
))}
|
||||
</Group>
|
||||
|
||||
);
|
||||
});
|
||||
|
||||
export default RadioComponent;
|
||||
1
client2/src/components/common/controls/Radio/index.ts
Normal file
1
client2/src/components/common/controls/Radio/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './Radio';
|
||||
3
client2/src/components/common/controls/Switch/Switch.tsx
Normal file
3
client2/src/components/common/controls/Switch/Switch.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import { Switch as SwitchE } from 'antd';
|
||||
|
||||
export default SwitchE;
|
||||
1
client2/src/components/common/controls/Switch/index.ts
Normal file
1
client2/src/components/common/controls/Switch/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as Switch } from './Switch';
|
||||
3
client2/src/components/common/controls/index.ts
Normal file
3
client2/src/components/common/controls/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as Radio } from './Radio';
|
||||
export { Input } from './Input';
|
||||
export { Switch } from './Switch';
|
||||
12
client2/src/components/common/formating/danger.tsx
Normal file
12
client2/src/components/common/formating/danger.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import React from 'react';
|
||||
import theme from 'Lib/theme';
|
||||
|
||||
const danger = (e: string) => {
|
||||
return (
|
||||
<span className={theme.typography.danger}>
|
||||
{e}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
export default danger;
|
||||
2
client2/src/components/common/formating/index.ts
Normal file
2
client2/src/components/common/formating/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as danger } from './danger';
|
||||
export { default as p } from './p';
|
||||
11
client2/src/components/common/formating/p.tsx
Normal file
11
client2/src/components/common/formating/p.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
|
||||
const danger = (e: string) => {
|
||||
return (
|
||||
<p>
|
||||
{e}
|
||||
</p>
|
||||
);
|
||||
};
|
||||
|
||||
export default danger;
|
||||
0
client2/src/components/common/index.ts
Normal file
0
client2/src/components/common/index.ts
Normal file
7
client2/src/components/common/ui/Icon/Icon.module.pcss
Normal file
7
client2/src/components/common/ui/Icon/Icon.module.pcss
Normal file
@@ -0,0 +1,7 @@
|
||||
.icon {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
25
client2/src/components/common/ui/Icon/Icon.tsx
Normal file
25
client2/src/components/common/ui/Icon/Icon.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import React, { FC } from 'react';
|
||||
import cn from 'classnames';
|
||||
import { IconType } from 'Lib/theme/Icons';
|
||||
|
||||
import s from './Icon.module.pcss';
|
||||
|
||||
interface IconProps {
|
||||
icon: IconType;
|
||||
color?: string;
|
||||
className?: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const Icon: FC<IconProps> = ({ icon, color, className, onClick }) => {
|
||||
const iconClass = cn(s.icon, color, className);
|
||||
|
||||
return (
|
||||
<svg className={iconClass} onClick={onClick}>
|
||||
<use xlinkHref={`#${icon}`} />
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
export default Icon;
|
||||
export { IconType } from 'Lib/theme/Icons';
|
||||
1
client2/src/components/common/ui/Icon/index.ts
Normal file
1
client2/src/components/common/ui/Icon/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default, IconType } from './Icon';
|
||||
1
client2/src/components/common/ui/Notifications/index.ts
Normal file
1
client2/src/components/common/ui/Notifications/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { notifyError, notifySuccess } from './notifications';
|
||||
@@ -0,0 +1,42 @@
|
||||
import React from 'react';
|
||||
import { notification } from 'antd';
|
||||
|
||||
import { DEFAULT_NOTIFICATION_DURATION } from 'Consts/common';
|
||||
|
||||
export const notifySuccess = (title: string, code?: string) => {
|
||||
notification.success({
|
||||
message: (
|
||||
<div
|
||||
data-notification={code || 'success'}
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
),
|
||||
placement: 'bottomRight',
|
||||
duration: DEFAULT_NOTIFICATION_DURATION,
|
||||
className: 'notification',
|
||||
});
|
||||
};
|
||||
|
||||
export const notifyError = (
|
||||
title: string,
|
||||
options?: {
|
||||
btn?: React.ReactNode;
|
||||
duration?: number;
|
||||
onClose?: () => void;
|
||||
},
|
||||
) => {
|
||||
const { btn, duration, onClose } = options || {};
|
||||
notification.error({
|
||||
onClose,
|
||||
message: (
|
||||
<div>
|
||||
{title}
|
||||
</div>
|
||||
),
|
||||
placement: 'bottomRight',
|
||||
duration: typeof duration === 'number' ? duration : DEFAULT_NOTIFICATION_DURATION,
|
||||
className: 'notification',
|
||||
btn,
|
||||
});
|
||||
};
|
||||
2
client2/src/components/common/ui/index.ts
Normal file
2
client2/src/components/common/ui/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as Icon } from './Icon';
|
||||
export { notifyError, notifySuccess } from './Notifications';
|
||||
15
client2/src/lib/ant/Radio.pcss
Normal file
15
client2/src/lib/ant/Radio.pcss
Normal file
@@ -0,0 +1,15 @@
|
||||
.ant-radio {
|
||||
margin-right: 18px;
|
||||
}
|
||||
|
||||
.ant-radio-inner {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background-color: transparent;
|
||||
border-color: var(--gray400);
|
||||
|
||||
&::after {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
}
|
||||
65
client2/src/lib/ant/Step.pcss
Normal file
65
client2/src/lib/ant/Step.pcss
Normal file
@@ -0,0 +1,65 @@
|
||||
.ant-steps {
|
||||
display: flex;
|
||||
margin-left: -67px;
|
||||
.ant-steps-item-process {
|
||||
.ant-steps-item-icon {
|
||||
top: -4px;
|
||||
box-sizing: content-box;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
.ant-steps-icon {
|
||||
background: var(--green400);
|
||||
.ant-steps-icon-dot {
|
||||
background: var(--green400);
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ant-steps-item-content {
|
||||
width: 99px;
|
||||
}
|
||||
.ant-steps-item-finish > .ant-steps-item-container > .ant-steps-item-tail,
|
||||
.ant-steps-item-wait > .ant-steps-item-container > .ant-steps-item-tail,
|
||||
.ant-steps-item-process > .ant-steps-item-container > .ant-steps-item-tail {
|
||||
top: 2px;
|
||||
width: 100%;
|
||||
margin: 0px 0px 0px 70px;
|
||||
padding: 0;
|
||||
&::after {
|
||||
width: calc(100% - 8px);
|
||||
height: 2px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
.ant-steps-item-wait > .ant-steps-item-container > .ant-steps-item-tail::after,
|
||||
.ant-steps-item-process > .ant-steps-item-container > .ant-steps-item-tail::after {
|
||||
background-color: var(--gray400);
|
||||
}
|
||||
.ant-steps-item-finish > .ant-steps-item-container > .ant-steps-item-tail::after {
|
||||
background-color: var(--green400);
|
||||
}
|
||||
|
||||
.ant-steps-item-finish {
|
||||
.ant-steps-item-icon {
|
||||
.ant-steps-icon {
|
||||
background: var(--green400);
|
||||
.ant-steps-icon-dot {
|
||||
background: var(--green400);
|
||||
border: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ant-steps-item-icon {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
.ant-steps-icon {
|
||||
background: transparent;
|
||||
.ant-steps-icon-dot {
|
||||
background: transparent;
|
||||
border: 2px solid var(--gray400);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
client2/src/lib/ant/ant-overrides.less
Normal file
8
client2/src/lib/ant/ant-overrides.less
Normal file
@@ -0,0 +1,8 @@
|
||||
@primary-color: #67b279;
|
||||
@success-color: #53d4b1;
|
||||
@text-color: #000;
|
||||
@link-hover-color: #1332BB;
|
||||
@link-active-color: #246FFF;
|
||||
|
||||
@font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
|
||||
@font-size-base: 14px;
|
||||
2
client2/src/lib/ant/ant.less
Normal file
2
client2/src/lib/ant/ant.less
Normal file
@@ -0,0 +1,2 @@
|
||||
@import '~antd/dist/antd.less';
|
||||
@import './ant-overrides.less';
|
||||
5
client2/src/lib/ant/index.ts
Normal file
5
client2/src/lib/ant/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import './Step.pcss';
|
||||
import './Radio.pcss';
|
||||
|
||||
const insertStyles = true;
|
||||
export default insertStyles;
|
||||
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));
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
1
client2/src/lib/consts/common.ts
Normal file
1
client2/src/lib/consts/common.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const DEFAULT_NOTIFICATION_DURATION = 5;
|
||||
1
client2/src/lib/consts/forms.ts
Normal file
1
client2/src/lib/consts/forms.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const EMPTY_FIELD_ERROR = 'empty_field';
|
||||
7
client2/src/lib/consts/install.ts
Normal file
7
client2/src/lib/consts/install.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export const DEFAULT_IP_ADDRESS = '0.0.0.0';
|
||||
|
||||
export const DEFAULT_IP_PORT = 80;
|
||||
|
||||
export const DEFAULT_DNS_ADDRESS = '0.0.0.0';
|
||||
|
||||
export const DEFAULT_DNS_PORT = 53;
|
||||
78
client2/src/lib/entities/AddUrlRequest.ts
Normal file
78
client2/src/lib/entities/AddUrlRequest.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAddUrlRequest {
|
||||
name?: string;
|
||||
url?: string;
|
||||
whitelist?: boolean;
|
||||
}
|
||||
|
||||
export default class AddUrlRequest {
|
||||
readonly _name: string | undefined;
|
||||
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
readonly _url: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: URL or an absolute path to the file containing filtering rules.
|
||||
*
|
||||
* Example: https://filters.adtidy.org/windows/filters/15.txt
|
||||
*/
|
||||
get url(): string | undefined {
|
||||
return this._url;
|
||||
}
|
||||
|
||||
readonly _whitelist: boolean | undefined;
|
||||
|
||||
get whitelist(): boolean | undefined {
|
||||
return this._whitelist;
|
||||
}
|
||||
|
||||
constructor(props: IAddUrlRequest) {
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
if (typeof props.url === 'string') {
|
||||
this._url = props.url.trim();
|
||||
}
|
||||
if (typeof props.whitelist === 'boolean') {
|
||||
this._whitelist = props.whitelist;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IAddUrlRequest {
|
||||
const data: IAddUrlRequest = {
|
||||
};
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
if (typeof this._url !== 'undefined') {
|
||||
data.url = this._url;
|
||||
}
|
||||
if (typeof this._whitelist !== 'undefined') {
|
||||
data.whitelist = this._whitelist;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
url: !this._url ? true : typeof this._url === 'string' && !this._url ? true : this._url,
|
||||
whitelist: !this._whitelist ? true : typeof this._whitelist === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IAddUrlRequest>): AddUrlRequest {
|
||||
return new AddUrlRequest({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
67
client2/src/lib/entities/AddressInfo.ts
Normal file
67
client2/src/lib/entities/AddressInfo.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAddressInfo {
|
||||
ip: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
export default class AddressInfo {
|
||||
readonly _ip: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 127.0.0.1
|
||||
*/
|
||||
get ip(): string {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
static ipValidate(ip: string): boolean {
|
||||
return typeof ip === 'string' && !!ip.trim();
|
||||
}
|
||||
|
||||
readonly _port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 53
|
||||
*/
|
||||
get port(): number {
|
||||
return this._port;
|
||||
}
|
||||
|
||||
static portValidate(port: number): boolean {
|
||||
return typeof port === 'number';
|
||||
}
|
||||
|
||||
constructor(props: IAddressInfo) {
|
||||
this._ip = props.ip.trim();
|
||||
this._port = props.port;
|
||||
}
|
||||
|
||||
serialize(): IAddressInfo {
|
||||
const data: IAddressInfo = {
|
||||
ip: this._ip,
|
||||
port: this._port,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
ip: typeof this._ip === 'string' && !this._ip ? true : this._ip,
|
||||
port: typeof this._port === 'number',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IAddressInfo>): AddressInfo {
|
||||
return new AddressInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
71
client2/src/lib/entities/AddressInfoBeta.ts
Normal file
71
client2/src/lib/entities/AddressInfoBeta.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAddressInfoBeta {
|
||||
ip: string[];
|
||||
port: number;
|
||||
}
|
||||
|
||||
export default class AddressInfoBeta {
|
||||
readonly _ip: string[];
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 127.0.0.1
|
||||
*/
|
||||
get ip(): string[] {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
static get ipMinItems() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ipValidate(ip: string[]): boolean {
|
||||
return ip.reduce<boolean>((result, p) => result && (typeof p === 'string' && !!p.trim()), true);
|
||||
}
|
||||
|
||||
readonly _port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 53
|
||||
*/
|
||||
get port(): number {
|
||||
return this._port;
|
||||
}
|
||||
|
||||
static portValidate(port: number): boolean {
|
||||
return typeof port === 'number';
|
||||
}
|
||||
|
||||
constructor(props: IAddressInfoBeta) {
|
||||
this._ip = props.ip;
|
||||
this._port = props.port;
|
||||
}
|
||||
|
||||
serialize(): IAddressInfoBeta {
|
||||
const data: IAddressInfoBeta = {
|
||||
ip: this._ip,
|
||||
port: this._port,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
ip: this._ip.reduce((result, p) => result && typeof p === 'string', true),
|
||||
port: typeof this._port === 'number',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IAddressInfoBeta>): AddressInfoBeta {
|
||||
return new AddressInfoBeta({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
81
client2/src/lib/entities/AddressesInfo.ts
Normal file
81
client2/src/lib/entities/AddressesInfo.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import NetInterface, { INetInterface } from './NetInterface';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAddressesInfo {
|
||||
dns_port: number;
|
||||
interfaces: { [key: string]: INetInterface };
|
||||
web_port: number;
|
||||
}
|
||||
|
||||
export default class AddressesInfo {
|
||||
readonly _dns_port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 53
|
||||
*/
|
||||
get dnsPort(): number {
|
||||
return this._dns_port;
|
||||
}
|
||||
|
||||
static dnsPortValidate(dnsPort: number): boolean {
|
||||
return typeof dnsPort === 'number';
|
||||
}
|
||||
|
||||
readonly _interfaces: { [key: string]: NetInterface };
|
||||
|
||||
/** */
|
||||
get interfaces(): { [key: string]: NetInterface } {
|
||||
return this._interfaces;
|
||||
}
|
||||
|
||||
readonly _web_port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 80
|
||||
*/
|
||||
get webPort(): number {
|
||||
return this._web_port;
|
||||
}
|
||||
|
||||
static webPortValidate(webPort: number): boolean {
|
||||
return typeof webPort === 'number';
|
||||
}
|
||||
|
||||
constructor(props: IAddressesInfo) {
|
||||
this._dns_port = props.dns_port;
|
||||
this._interfaces = Object.keys(props.interfaces).reduce((prev, key) => {
|
||||
return { ...prev, [key]: new NetInterface(props.interfaces[key])};
|
||||
},{})
|
||||
this._web_port = props.web_port;
|
||||
}
|
||||
|
||||
serialize(): IAddressesInfo {
|
||||
const data: IAddressesInfo = {
|
||||
dns_port: this._dns_port,
|
||||
interfaces: Object.keys(this._interfaces).reduce<Record<string, any>>((prev, key) => ({ ...prev, [key]: this._interfaces[key].serialize() }), {}),
|
||||
web_port: this._web_port,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
dns_port: typeof this._dns_port === 'number',
|
||||
web_port: typeof this._web_port === 'number',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IAddressesInfo>): AddressesInfo {
|
||||
return new AddressesInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
80
client2/src/lib/entities/AddressesInfoBeta.ts
Normal file
80
client2/src/lib/entities/AddressesInfoBeta.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import NetInterface, { INetInterface } from './NetInterface';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IAddressesInfoBeta {
|
||||
dns_port: number;
|
||||
interfaces: INetInterface[];
|
||||
web_port: number;
|
||||
}
|
||||
|
||||
export default class AddressesInfoBeta {
|
||||
readonly _dns_port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 53
|
||||
*/
|
||||
get dnsPort(): number {
|
||||
return this._dns_port;
|
||||
}
|
||||
|
||||
static dnsPortValidate(dnsPort: number): boolean {
|
||||
return typeof dnsPort === 'number';
|
||||
}
|
||||
|
||||
readonly _interfaces: NetInterface[];
|
||||
|
||||
/** */
|
||||
get interfaces(): NetInterface[] {
|
||||
return this._interfaces;
|
||||
}
|
||||
|
||||
readonly _web_port: number;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 80
|
||||
*/
|
||||
get webPort(): number {
|
||||
return this._web_port;
|
||||
}
|
||||
|
||||
static webPortValidate(webPort: number): boolean {
|
||||
return typeof webPort === 'number';
|
||||
}
|
||||
|
||||
constructor(props: IAddressesInfoBeta) {
|
||||
this._dns_port = props.dns_port;
|
||||
this._interfaces = props.interfaces.map((p) => new NetInterface(p));
|
||||
this._web_port = props.web_port;
|
||||
}
|
||||
|
||||
serialize(): IAddressesInfoBeta {
|
||||
const data: IAddressesInfoBeta = {
|
||||
dns_port: this._dns_port,
|
||||
interfaces: this._interfaces.map((p) => p.serialize()),
|
||||
web_port: this._web_port,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
dns_port: typeof this._dns_port === 'number',
|
||||
web_port: typeof this._web_port === 'number',
|
||||
interfaces: this._interfaces.reduce((result, p) => result && p.validate().length === 0, true),
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IAddressesInfoBeta>): AddressesInfoBeta {
|
||||
return new AddressesInfoBeta({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
31
client2/src/lib/entities/BlockedServicesArray.ts
Normal file
31
client2/src/lib/entities/BlockedServicesArray.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IBlockedServicesArray {
|
||||
}
|
||||
|
||||
export default class BlockedServicesArray {
|
||||
constructor(props: IBlockedServicesArray) {
|
||||
}
|
||||
|
||||
serialize(): IBlockedServicesArray {
|
||||
const data: IBlockedServicesArray = {
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IBlockedServicesArray>): BlockedServicesArray {
|
||||
return new BlockedServicesArray({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
75
client2/src/lib/entities/CheckConfigRequest.ts
Normal file
75
client2/src/lib/entities/CheckConfigRequest.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import CheckConfigRequestInfo, { ICheckConfigRequestInfo } from './CheckConfigRequestInfo';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigRequest {
|
||||
dns?: ICheckConfigRequestInfo;
|
||||
set_static_ip?: boolean;
|
||||
web?: ICheckConfigRequestInfo;
|
||||
}
|
||||
|
||||
export default class CheckConfigRequest {
|
||||
readonly _dns: CheckConfigRequestInfo | undefined;
|
||||
|
||||
get dns(): CheckConfigRequestInfo | undefined {
|
||||
return this._dns;
|
||||
}
|
||||
|
||||
readonly _set_static_ip: boolean | undefined;
|
||||
|
||||
get setStaticIp(): boolean | undefined {
|
||||
return this._set_static_ip;
|
||||
}
|
||||
|
||||
readonly _web: CheckConfigRequestInfo | undefined;
|
||||
|
||||
get web(): CheckConfigRequestInfo | undefined {
|
||||
return this._web;
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigRequest) {
|
||||
if (props.dns) {
|
||||
this._dns = new CheckConfigRequestInfo(props.dns);
|
||||
}
|
||||
if (typeof props.set_static_ip === 'boolean') {
|
||||
this._set_static_ip = props.set_static_ip;
|
||||
}
|
||||
if (props.web) {
|
||||
this._web = new CheckConfigRequestInfo(props.web);
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigRequest {
|
||||
const data: ICheckConfigRequest = {
|
||||
};
|
||||
if (typeof this._dns !== 'undefined') {
|
||||
data.dns = this._dns.serialize();
|
||||
}
|
||||
if (typeof this._set_static_ip !== 'undefined') {
|
||||
data.set_static_ip = this._set_static_ip;
|
||||
}
|
||||
if (typeof this._web !== 'undefined') {
|
||||
data.web = this._web.serialize();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
dns: !this._dns ? true : this._dns.validate().length === 0,
|
||||
web: !this._web ? true : this._web.validate().length === 0,
|
||||
set_static_ip: !this._set_static_ip ? true : typeof this._set_static_ip === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigRequest>): CheckConfigRequest {
|
||||
return new CheckConfigRequest({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
75
client2/src/lib/entities/CheckConfigRequestBeta.ts
Normal file
75
client2/src/lib/entities/CheckConfigRequestBeta.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import CheckConfigRequestInfoBeta, { ICheckConfigRequestInfoBeta } from './CheckConfigRequestInfoBeta';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigRequestBeta {
|
||||
dns?: ICheckConfigRequestInfoBeta;
|
||||
set_static_ip?: boolean;
|
||||
web?: ICheckConfigRequestInfoBeta;
|
||||
}
|
||||
|
||||
export default class CheckConfigRequestBeta {
|
||||
readonly _dns: CheckConfigRequestInfoBeta | undefined;
|
||||
|
||||
get dns(): CheckConfigRequestInfoBeta | undefined {
|
||||
return this._dns;
|
||||
}
|
||||
|
||||
readonly _set_static_ip: boolean | undefined;
|
||||
|
||||
get setStaticIp(): boolean | undefined {
|
||||
return this._set_static_ip;
|
||||
}
|
||||
|
||||
readonly _web: CheckConfigRequestInfoBeta | undefined;
|
||||
|
||||
get web(): CheckConfigRequestInfoBeta | undefined {
|
||||
return this._web;
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigRequestBeta) {
|
||||
if (props.dns) {
|
||||
this._dns = new CheckConfigRequestInfoBeta(props.dns);
|
||||
}
|
||||
if (typeof props.set_static_ip === 'boolean') {
|
||||
this._set_static_ip = props.set_static_ip;
|
||||
}
|
||||
if (props.web) {
|
||||
this._web = new CheckConfigRequestInfoBeta(props.web);
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigRequestBeta {
|
||||
const data: ICheckConfigRequestBeta = {
|
||||
};
|
||||
if (typeof this._dns !== 'undefined') {
|
||||
data.dns = this._dns.serialize();
|
||||
}
|
||||
if (typeof this._set_static_ip !== 'undefined') {
|
||||
data.set_static_ip = this._set_static_ip;
|
||||
}
|
||||
if (typeof this._web !== 'undefined') {
|
||||
data.web = this._web.serialize();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
dns: !this._dns ? true : this._dns.validate().length === 0,
|
||||
web: !this._web ? true : this._web.validate().length === 0,
|
||||
set_static_ip: !this._set_static_ip ? true : typeof this._set_static_ip === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigRequestBeta>): CheckConfigRequestBeta {
|
||||
return new CheckConfigRequestBeta({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
81
client2/src/lib/entities/CheckConfigRequestInfo.ts
Normal file
81
client2/src/lib/entities/CheckConfigRequestInfo.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigRequestInfo {
|
||||
autofix?: boolean;
|
||||
ip?: string;
|
||||
port?: number;
|
||||
}
|
||||
|
||||
export default class CheckConfigRequestInfo {
|
||||
readonly _autofix: boolean | undefined;
|
||||
|
||||
get autofix(): boolean | undefined {
|
||||
return this._autofix;
|
||||
}
|
||||
|
||||
readonly _ip: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 127.0.0.1
|
||||
*/
|
||||
get ip(): string | undefined {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
readonly _port: number | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 53
|
||||
*/
|
||||
get port(): number | undefined {
|
||||
return this._port;
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigRequestInfo) {
|
||||
if (typeof props.autofix === 'boolean') {
|
||||
this._autofix = props.autofix;
|
||||
}
|
||||
if (typeof props.ip === 'string') {
|
||||
this._ip = props.ip.trim();
|
||||
}
|
||||
if (typeof props.port === 'number') {
|
||||
this._port = props.port;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigRequestInfo {
|
||||
const data: ICheckConfigRequestInfo = {
|
||||
};
|
||||
if (typeof this._autofix !== 'undefined') {
|
||||
data.autofix = this._autofix;
|
||||
}
|
||||
if (typeof this._ip !== 'undefined') {
|
||||
data.ip = this._ip;
|
||||
}
|
||||
if (typeof this._port !== 'undefined') {
|
||||
data.port = this._port;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
|
||||
port: !this._port ? true : typeof this._port === 'number',
|
||||
autofix: !this._autofix ? true : typeof this._autofix === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigRequestInfo>): CheckConfigRequestInfo {
|
||||
return new CheckConfigRequestInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
85
client2/src/lib/entities/CheckConfigRequestInfoBeta.ts
Normal file
85
client2/src/lib/entities/CheckConfigRequestInfoBeta.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigRequestInfoBeta {
|
||||
autofix?: boolean;
|
||||
ip?: string[];
|
||||
port?: number;
|
||||
}
|
||||
|
||||
export default class CheckConfigRequestInfoBeta {
|
||||
readonly _autofix: boolean | undefined;
|
||||
|
||||
get autofix(): boolean | undefined {
|
||||
return this._autofix;
|
||||
}
|
||||
|
||||
readonly _ip: string[] | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 127.0.0.1
|
||||
*/
|
||||
get ip(): string[] | undefined {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
static get ipMinItems() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
readonly _port: number | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 53
|
||||
*/
|
||||
get port(): number | undefined {
|
||||
return this._port;
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigRequestInfoBeta) {
|
||||
if (typeof props.autofix === 'boolean') {
|
||||
this._autofix = props.autofix;
|
||||
}
|
||||
if (props.ip) {
|
||||
this._ip = props.ip;
|
||||
}
|
||||
if (typeof props.port === 'number') {
|
||||
this._port = props.port;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigRequestInfoBeta {
|
||||
const data: ICheckConfigRequestInfoBeta = {
|
||||
};
|
||||
if (typeof this._autofix !== 'undefined') {
|
||||
data.autofix = this._autofix;
|
||||
}
|
||||
if (typeof this._ip !== 'undefined') {
|
||||
data.ip = this._ip;
|
||||
}
|
||||
if (typeof this._port !== 'undefined') {
|
||||
data.port = this._port;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
ip: !this._ip ? true : this._ip.reduce((result, p) => result && typeof p === 'string', true),
|
||||
port: !this._port ? true : typeof this._port === 'number',
|
||||
autofix: !this._autofix ? true : typeof this._autofix === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigRequestInfoBeta>): CheckConfigRequestInfoBeta {
|
||||
return new CheckConfigRequestInfoBeta({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
64
client2/src/lib/entities/CheckConfigResponse.ts
Normal file
64
client2/src/lib/entities/CheckConfigResponse.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import CheckConfigResponseInfo, { ICheckConfigResponseInfo } from './CheckConfigResponseInfo';
|
||||
import CheckConfigStaticIpInfo, { ICheckConfigStaticIpInfo } from './CheckConfigStaticIpInfo';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigResponse {
|
||||
dns: ICheckConfigResponseInfo;
|
||||
static_ip: ICheckConfigStaticIpInfo;
|
||||
web: ICheckConfigResponseInfo;
|
||||
}
|
||||
|
||||
export default class CheckConfigResponse {
|
||||
readonly _dns: CheckConfigResponseInfo;
|
||||
|
||||
get dns(): CheckConfigResponseInfo {
|
||||
return this._dns;
|
||||
}
|
||||
|
||||
readonly _static_ip: CheckConfigStaticIpInfo;
|
||||
|
||||
get staticIp(): CheckConfigStaticIpInfo {
|
||||
return this._static_ip;
|
||||
}
|
||||
|
||||
readonly _web: CheckConfigResponseInfo;
|
||||
|
||||
get web(): CheckConfigResponseInfo {
|
||||
return this._web;
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigResponse) {
|
||||
this._dns = new CheckConfigResponseInfo(props.dns);
|
||||
this._static_ip = new CheckConfigStaticIpInfo(props.static_ip);
|
||||
this._web = new CheckConfigResponseInfo(props.web);
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigResponse {
|
||||
const data: ICheckConfigResponse = {
|
||||
dns: this._dns.serialize(),
|
||||
static_ip: this._static_ip.serialize(),
|
||||
web: this._web.serialize(),
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
dns: this._dns.validate().length === 0,
|
||||
web: this._web.validate().length === 0,
|
||||
static_ip: this._static_ip.validate().length === 0,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigResponse>): CheckConfigResponse {
|
||||
return new CheckConfigResponse({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
59
client2/src/lib/entities/CheckConfigResponseInfo.ts
Normal file
59
client2/src/lib/entities/CheckConfigResponseInfo.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigResponseInfo {
|
||||
can_autofix: boolean;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export default class CheckConfigResponseInfo {
|
||||
readonly _can_autofix: boolean;
|
||||
|
||||
get canAutofix(): boolean {
|
||||
return this._can_autofix;
|
||||
}
|
||||
|
||||
static canAutofixValidate(canAutofix: boolean): boolean {
|
||||
return typeof canAutofix === 'boolean';
|
||||
}
|
||||
|
||||
readonly _status: string;
|
||||
|
||||
get status(): string {
|
||||
return this._status;
|
||||
}
|
||||
|
||||
static statusValidate(status: string): boolean {
|
||||
return typeof status === 'string' && !!status.trim();
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigResponseInfo) {
|
||||
this._can_autofix = props.can_autofix;
|
||||
this._status = props.status.trim();
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigResponseInfo {
|
||||
const data: ICheckConfigResponseInfo = {
|
||||
can_autofix: this._can_autofix,
|
||||
status: this._status,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
status: typeof this._status === 'string' && !this._status ? true : this._status,
|
||||
can_autofix: typeof this._can_autofix === 'boolean',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigResponseInfo>): CheckConfigResponseInfo {
|
||||
return new CheckConfigResponseInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
79
client2/src/lib/entities/CheckConfigStaticIpInfo.ts
Normal file
79
client2/src/lib/entities/CheckConfigStaticIpInfo.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { CheckConfigStaticIpInfoStatic } from './CheckConfigStaticIpInfoStatic';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface ICheckConfigStaticIpInfo {
|
||||
error?: string;
|
||||
ip?: string;
|
||||
static?: CheckConfigStaticIpInfoStatic;
|
||||
}
|
||||
|
||||
export default class CheckConfigStaticIpInfo {
|
||||
readonly _error: string | undefined;
|
||||
|
||||
/** */
|
||||
get error(): string | undefined {
|
||||
return this._error;
|
||||
}
|
||||
|
||||
readonly _ip: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: Current dynamic IP address. Set if static=no
|
||||
* Example: 192.168.1.1
|
||||
*/
|
||||
get ip(): string | undefined {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
readonly _static: CheckConfigStaticIpInfoStatic | undefined;
|
||||
|
||||
get static(): CheckConfigStaticIpInfoStatic | undefined {
|
||||
return this._static;
|
||||
}
|
||||
|
||||
constructor(props: ICheckConfigStaticIpInfo) {
|
||||
if (typeof props.error === 'string') {
|
||||
this._error = props.error.trim();
|
||||
}
|
||||
if (typeof props.ip === 'string') {
|
||||
this._ip = props.ip.trim();
|
||||
}
|
||||
if (props.static) {
|
||||
this._static = props.static;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): ICheckConfigStaticIpInfo {
|
||||
const data: ICheckConfigStaticIpInfo = {
|
||||
};
|
||||
if (typeof this._error !== 'undefined') {
|
||||
data.error = this._error;
|
||||
}
|
||||
if (typeof this._ip !== 'undefined') {
|
||||
data.ip = this._ip;
|
||||
}
|
||||
if (typeof this._static !== 'undefined') {
|
||||
data.static = this._static;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
|
||||
error: !this._error ? true : typeof this._error === 'string' && !this._error ? true : this._error,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<ICheckConfigStaticIpInfo>): CheckConfigStaticIpInfo {
|
||||
return new CheckConfigStaticIpInfo({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export enum CheckConfigStaticIpInfoStatic {
|
||||
YES = 'yes',
|
||||
NO = 'no',
|
||||
ERROR = 'error'
|
||||
}
|
||||
176
client2/src/lib/entities/Client.ts
Normal file
176
client2/src/lib/entities/Client.ts
Normal file
@@ -0,0 +1,176 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClient {
|
||||
blocked_services?: string[];
|
||||
filtering_enabled?: boolean;
|
||||
ids?: string[];
|
||||
name?: string;
|
||||
parental_enabled?: boolean;
|
||||
safebrowsing_enabled?: boolean;
|
||||
safesearch_enabled?: boolean;
|
||||
upstreams?: string[];
|
||||
use_global_blocked_services?: boolean;
|
||||
use_global_settings?: boolean;
|
||||
}
|
||||
|
||||
export default class Client {
|
||||
readonly _blocked_services: string[] | undefined;
|
||||
|
||||
get blockedServices(): string[] | undefined {
|
||||
return this._blocked_services;
|
||||
}
|
||||
|
||||
readonly _filtering_enabled: boolean | undefined;
|
||||
|
||||
get filteringEnabled(): boolean | undefined {
|
||||
return this._filtering_enabled;
|
||||
}
|
||||
|
||||
readonly _ids: string[] | undefined;
|
||||
|
||||
/** */
|
||||
get ids(): string[] | undefined {
|
||||
return this._ids;
|
||||
}
|
||||
|
||||
readonly _name: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: Name
|
||||
* Example: localhost
|
||||
*/
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
readonly _parental_enabled: boolean | undefined;
|
||||
|
||||
get parentalEnabled(): boolean | undefined {
|
||||
return this._parental_enabled;
|
||||
}
|
||||
|
||||
readonly _safebrowsing_enabled: boolean | undefined;
|
||||
|
||||
get safebrowsingEnabled(): boolean | undefined {
|
||||
return this._safebrowsing_enabled;
|
||||
}
|
||||
|
||||
readonly _safesearch_enabled: boolean | undefined;
|
||||
|
||||
get safesearchEnabled(): boolean | undefined {
|
||||
return this._safesearch_enabled;
|
||||
}
|
||||
|
||||
readonly _upstreams: string[] | undefined;
|
||||
|
||||
get upstreams(): string[] | undefined {
|
||||
return this._upstreams;
|
||||
}
|
||||
|
||||
readonly _use_global_blocked_services: boolean | undefined;
|
||||
|
||||
get useGlobalBlockedServices(): boolean | undefined {
|
||||
return this._use_global_blocked_services;
|
||||
}
|
||||
|
||||
readonly _use_global_settings: boolean | undefined;
|
||||
|
||||
get useGlobalSettings(): boolean | undefined {
|
||||
return this._use_global_settings;
|
||||
}
|
||||
|
||||
constructor(props: IClient) {
|
||||
if (props.blocked_services) {
|
||||
this._blocked_services = props.blocked_services;
|
||||
}
|
||||
if (typeof props.filtering_enabled === 'boolean') {
|
||||
this._filtering_enabled = props.filtering_enabled;
|
||||
}
|
||||
if (props.ids) {
|
||||
this._ids = props.ids;
|
||||
}
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
if (typeof props.parental_enabled === 'boolean') {
|
||||
this._parental_enabled = props.parental_enabled;
|
||||
}
|
||||
if (typeof props.safebrowsing_enabled === 'boolean') {
|
||||
this._safebrowsing_enabled = props.safebrowsing_enabled;
|
||||
}
|
||||
if (typeof props.safesearch_enabled === 'boolean') {
|
||||
this._safesearch_enabled = props.safesearch_enabled;
|
||||
}
|
||||
if (props.upstreams) {
|
||||
this._upstreams = props.upstreams;
|
||||
}
|
||||
if (typeof props.use_global_blocked_services === 'boolean') {
|
||||
this._use_global_blocked_services = props.use_global_blocked_services;
|
||||
}
|
||||
if (typeof props.use_global_settings === 'boolean') {
|
||||
this._use_global_settings = props.use_global_settings;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IClient {
|
||||
const data: IClient = {
|
||||
};
|
||||
if (typeof this._blocked_services !== 'undefined') {
|
||||
data.blocked_services = this._blocked_services;
|
||||
}
|
||||
if (typeof this._filtering_enabled !== 'undefined') {
|
||||
data.filtering_enabled = this._filtering_enabled;
|
||||
}
|
||||
if (typeof this._ids !== 'undefined') {
|
||||
data.ids = this._ids;
|
||||
}
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
if (typeof this._parental_enabled !== 'undefined') {
|
||||
data.parental_enabled = this._parental_enabled;
|
||||
}
|
||||
if (typeof this._safebrowsing_enabled !== 'undefined') {
|
||||
data.safebrowsing_enabled = this._safebrowsing_enabled;
|
||||
}
|
||||
if (typeof this._safesearch_enabled !== 'undefined') {
|
||||
data.safesearch_enabled = this._safesearch_enabled;
|
||||
}
|
||||
if (typeof this._upstreams !== 'undefined') {
|
||||
data.upstreams = this._upstreams;
|
||||
}
|
||||
if (typeof this._use_global_blocked_services !== 'undefined') {
|
||||
data.use_global_blocked_services = this._use_global_blocked_services;
|
||||
}
|
||||
if (typeof this._use_global_settings !== 'undefined') {
|
||||
data.use_global_settings = this._use_global_settings;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
ids: !this._ids ? true : this._ids.reduce((result, p) => result && typeof p === 'string', true),
|
||||
use_global_settings: !this._use_global_settings ? true : typeof this._use_global_settings === 'boolean',
|
||||
filtering_enabled: !this._filtering_enabled ? true : typeof this._filtering_enabled === 'boolean',
|
||||
parental_enabled: !this._parental_enabled ? true : typeof this._parental_enabled === 'boolean',
|
||||
safebrowsing_enabled: !this._safebrowsing_enabled ? true : typeof this._safebrowsing_enabled === 'boolean',
|
||||
safesearch_enabled: !this._safesearch_enabled ? true : typeof this._safesearch_enabled === 'boolean',
|
||||
use_global_blocked_services: !this._use_global_blocked_services ? true : typeof this._use_global_blocked_services === 'boolean',
|
||||
blocked_services: !this._blocked_services ? true : this._blocked_services.reduce((result, p) => result && typeof p === 'string', true),
|
||||
upstreams: !this._upstreams ? true : this._upstreams.reduce((result, p) => result && typeof p === 'string', true),
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClient>): Client {
|
||||
return new Client({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
85
client2/src/lib/entities/ClientAuto.ts
Normal file
85
client2/src/lib/entities/ClientAuto.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientAuto {
|
||||
ip?: string;
|
||||
name?: string;
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export default class ClientAuto {
|
||||
readonly _ip: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: IP address
|
||||
* Example: 127.0.0.1
|
||||
*/
|
||||
get ip(): string | undefined {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
readonly _name: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: Name
|
||||
* Example: localhost
|
||||
*/
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
readonly _source: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: The source of this information
|
||||
* Example: etc/hosts
|
||||
*/
|
||||
get source(): string | undefined {
|
||||
return this._source;
|
||||
}
|
||||
|
||||
constructor(props: IClientAuto) {
|
||||
if (typeof props.ip === 'string') {
|
||||
this._ip = props.ip.trim();
|
||||
}
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
if (typeof props.source === 'string') {
|
||||
this._source = props.source.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IClientAuto {
|
||||
const data: IClientAuto = {
|
||||
};
|
||||
if (typeof this._ip !== 'undefined') {
|
||||
data.ip = this._ip;
|
||||
}
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
if (typeof this._source !== 'undefined') {
|
||||
data.source = this._source;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
source: !this._source ? true : typeof this._source === 'string' && !this._source ? true : this._source,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientAuto>): ClientAuto {
|
||||
return new ClientAuto({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
45
client2/src/lib/entities/ClientDelete.ts
Normal file
45
client2/src/lib/entities/ClientDelete.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientDelete {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export default class ClientDelete {
|
||||
readonly _name: string | undefined;
|
||||
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
constructor(props: IClientDelete) {
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IClientDelete {
|
||||
const data: IClientDelete = {
|
||||
};
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientDelete>): ClientDelete {
|
||||
return new ClientDelete({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
222
client2/src/lib/entities/ClientFindSubEntry.ts
Normal file
222
client2/src/lib/entities/ClientFindSubEntry.ts
Normal file
@@ -0,0 +1,222 @@
|
||||
import WhoisInfo, { IWhoisInfo } from './WhoisInfo';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientFindSubEntry {
|
||||
blocked_services?: string[];
|
||||
disallowed?: boolean;
|
||||
disallowed_rule?: string;
|
||||
filtering_enabled?: boolean;
|
||||
ids?: string[];
|
||||
name?: string;
|
||||
parental_enabled?: boolean;
|
||||
safebrowsing_enabled?: boolean;
|
||||
safesearch_enabled?: boolean;
|
||||
upstreams?: string[];
|
||||
use_global_blocked_services?: boolean;
|
||||
use_global_settings?: boolean;
|
||||
whois_info?: IWhoisInfo[];
|
||||
}
|
||||
|
||||
export default class ClientFindSubEntry {
|
||||
readonly _blocked_services: string[] | undefined;
|
||||
|
||||
get blockedServices(): string[] | undefined {
|
||||
return this._blocked_services;
|
||||
}
|
||||
|
||||
readonly _disallowed: boolean | undefined;
|
||||
|
||||
/** */
|
||||
get disallowed(): boolean | undefined {
|
||||
return this._disallowed;
|
||||
}
|
||||
|
||||
readonly _disallowed_rule: string | undefined;
|
||||
|
||||
/** */
|
||||
get disallowedRule(): string | undefined {
|
||||
return this._disallowed_rule;
|
||||
}
|
||||
|
||||
readonly _filtering_enabled: boolean | undefined;
|
||||
|
||||
get filteringEnabled(): boolean | undefined {
|
||||
return this._filtering_enabled;
|
||||
}
|
||||
|
||||
readonly _ids: string[] | undefined;
|
||||
|
||||
/** */
|
||||
get ids(): string[] | undefined {
|
||||
return this._ids;
|
||||
}
|
||||
|
||||
readonly _name: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: Name
|
||||
* Example: localhost
|
||||
*/
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
readonly _parental_enabled: boolean | undefined;
|
||||
|
||||
get parentalEnabled(): boolean | undefined {
|
||||
return this._parental_enabled;
|
||||
}
|
||||
|
||||
readonly _safebrowsing_enabled: boolean | undefined;
|
||||
|
||||
get safebrowsingEnabled(): boolean | undefined {
|
||||
return this._safebrowsing_enabled;
|
||||
}
|
||||
|
||||
readonly _safesearch_enabled: boolean | undefined;
|
||||
|
||||
get safesearchEnabled(): boolean | undefined {
|
||||
return this._safesearch_enabled;
|
||||
}
|
||||
|
||||
readonly _upstreams: string[] | undefined;
|
||||
|
||||
get upstreams(): string[] | undefined {
|
||||
return this._upstreams;
|
||||
}
|
||||
|
||||
readonly _use_global_blocked_services: boolean | undefined;
|
||||
|
||||
get useGlobalBlockedServices(): boolean | undefined {
|
||||
return this._use_global_blocked_services;
|
||||
}
|
||||
|
||||
readonly _use_global_settings: boolean | undefined;
|
||||
|
||||
get useGlobalSettings(): boolean | undefined {
|
||||
return this._use_global_settings;
|
||||
}
|
||||
|
||||
readonly _whois_info: WhoisInfo[] | undefined;
|
||||
|
||||
get whoisInfo(): WhoisInfo[] | undefined {
|
||||
return this._whois_info;
|
||||
}
|
||||
|
||||
constructor(props: IClientFindSubEntry) {
|
||||
if (props.blocked_services) {
|
||||
this._blocked_services = props.blocked_services;
|
||||
}
|
||||
if (typeof props.disallowed === 'boolean') {
|
||||
this._disallowed = props.disallowed;
|
||||
}
|
||||
if (typeof props.disallowed_rule === 'string') {
|
||||
this._disallowed_rule = props.disallowed_rule.trim();
|
||||
}
|
||||
if (typeof props.filtering_enabled === 'boolean') {
|
||||
this._filtering_enabled = props.filtering_enabled;
|
||||
}
|
||||
if (props.ids) {
|
||||
this._ids = props.ids;
|
||||
}
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
if (typeof props.parental_enabled === 'boolean') {
|
||||
this._parental_enabled = props.parental_enabled;
|
||||
}
|
||||
if (typeof props.safebrowsing_enabled === 'boolean') {
|
||||
this._safebrowsing_enabled = props.safebrowsing_enabled;
|
||||
}
|
||||
if (typeof props.safesearch_enabled === 'boolean') {
|
||||
this._safesearch_enabled = props.safesearch_enabled;
|
||||
}
|
||||
if (props.upstreams) {
|
||||
this._upstreams = props.upstreams;
|
||||
}
|
||||
if (typeof props.use_global_blocked_services === 'boolean') {
|
||||
this._use_global_blocked_services = props.use_global_blocked_services;
|
||||
}
|
||||
if (typeof props.use_global_settings === 'boolean') {
|
||||
this._use_global_settings = props.use_global_settings;
|
||||
}
|
||||
if (props.whois_info) {
|
||||
this._whois_info = props.whois_info.map((p) => new WhoisInfo(p));
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IClientFindSubEntry {
|
||||
const data: IClientFindSubEntry = {
|
||||
};
|
||||
if (typeof this._blocked_services !== 'undefined') {
|
||||
data.blocked_services = this._blocked_services;
|
||||
}
|
||||
if (typeof this._disallowed !== 'undefined') {
|
||||
data.disallowed = this._disallowed;
|
||||
}
|
||||
if (typeof this._disallowed_rule !== 'undefined') {
|
||||
data.disallowed_rule = this._disallowed_rule;
|
||||
}
|
||||
if (typeof this._filtering_enabled !== 'undefined') {
|
||||
data.filtering_enabled = this._filtering_enabled;
|
||||
}
|
||||
if (typeof this._ids !== 'undefined') {
|
||||
data.ids = this._ids;
|
||||
}
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
if (typeof this._parental_enabled !== 'undefined') {
|
||||
data.parental_enabled = this._parental_enabled;
|
||||
}
|
||||
if (typeof this._safebrowsing_enabled !== 'undefined') {
|
||||
data.safebrowsing_enabled = this._safebrowsing_enabled;
|
||||
}
|
||||
if (typeof this._safesearch_enabled !== 'undefined') {
|
||||
data.safesearch_enabled = this._safesearch_enabled;
|
||||
}
|
||||
if (typeof this._upstreams !== 'undefined') {
|
||||
data.upstreams = this._upstreams;
|
||||
}
|
||||
if (typeof this._use_global_blocked_services !== 'undefined') {
|
||||
data.use_global_blocked_services = this._use_global_blocked_services;
|
||||
}
|
||||
if (typeof this._use_global_settings !== 'undefined') {
|
||||
data.use_global_settings = this._use_global_settings;
|
||||
}
|
||||
if (typeof this._whois_info !== 'undefined') {
|
||||
data.whois_info = this._whois_info.map((p) => p.serialize());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
ids: !this._ids ? true : this._ids.reduce((result, p) => result && typeof p === 'string', true),
|
||||
use_global_settings: !this._use_global_settings ? true : typeof this._use_global_settings === 'boolean',
|
||||
filtering_enabled: !this._filtering_enabled ? true : typeof this._filtering_enabled === 'boolean',
|
||||
parental_enabled: !this._parental_enabled ? true : typeof this._parental_enabled === 'boolean',
|
||||
safebrowsing_enabled: !this._safebrowsing_enabled ? true : typeof this._safebrowsing_enabled === 'boolean',
|
||||
safesearch_enabled: !this._safesearch_enabled ? true : typeof this._safesearch_enabled === 'boolean',
|
||||
use_global_blocked_services: !this._use_global_blocked_services ? true : typeof this._use_global_blocked_services === 'boolean',
|
||||
blocked_services: !this._blocked_services ? true : this._blocked_services.reduce((result, p) => result && typeof p === 'string', true),
|
||||
upstreams: !this._upstreams ? true : this._upstreams.reduce((result, p) => result && typeof p === 'string', true),
|
||||
whois_info: !this._whois_info ? true : this._whois_info.reduce((result, p) => result && p.validate().length === 0, true),
|
||||
disallowed: !this._disallowed ? true : typeof this._disallowed === 'boolean',
|
||||
disallowed_rule: !this._disallowed_rule ? true : typeof this._disallowed_rule === 'string' && !this._disallowed_rule ? true : this._disallowed_rule,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientFindSubEntry>): ClientFindSubEntry {
|
||||
return new ClientFindSubEntry({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
61
client2/src/lib/entities/ClientUpdate.ts
Normal file
61
client2/src/lib/entities/ClientUpdate.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import Client, { IClient } from './Client';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientUpdate {
|
||||
data?: IClient;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export default class ClientUpdate {
|
||||
readonly _data: Client | undefined;
|
||||
|
||||
get data(): Client | undefined {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
readonly _name: string | undefined;
|
||||
|
||||
get name(): string | undefined {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
constructor(props: IClientUpdate) {
|
||||
if (props.data) {
|
||||
this._data = new Client(props.data);
|
||||
}
|
||||
if (typeof props.name === 'string') {
|
||||
this._name = props.name.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IClientUpdate {
|
||||
const data: IClientUpdate = {
|
||||
};
|
||||
if (typeof this._data !== 'undefined') {
|
||||
data.data = this._data.serialize();
|
||||
}
|
||||
if (typeof this._name !== 'undefined') {
|
||||
data.name = this._name;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
|
||||
data: !this._data ? true : this._data.validate().length === 0,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientUpdate>): ClientUpdate {
|
||||
return new ClientUpdate({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
62
client2/src/lib/entities/Clients.ts
Normal file
62
client2/src/lib/entities/Clients.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import Client, { IClient } from './Client';
|
||||
import ClientAuto, { IClientAuto } from './ClientAuto';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClients {
|
||||
auto_clients?: IClientAuto[];
|
||||
clients?: IClient[];
|
||||
}
|
||||
|
||||
export default class Clients {
|
||||
readonly _auto_clients: ClientAuto[] | undefined;
|
||||
|
||||
get autoClients(): ClientAuto[] | undefined {
|
||||
return this._auto_clients;
|
||||
}
|
||||
|
||||
readonly _clients: Client[] | undefined;
|
||||
|
||||
get clients(): Client[] | undefined {
|
||||
return this._clients;
|
||||
}
|
||||
|
||||
constructor(props: IClients) {
|
||||
if (props.auto_clients) {
|
||||
this._auto_clients = props.auto_clients.map((p) => new ClientAuto(p));
|
||||
}
|
||||
if (props.clients) {
|
||||
this._clients = props.clients.map((p) => new Client(p));
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IClients {
|
||||
const data: IClients = {
|
||||
};
|
||||
if (typeof this._auto_clients !== 'undefined') {
|
||||
data.auto_clients = this._auto_clients.map((p) => p.serialize());
|
||||
}
|
||||
if (typeof this._clients !== 'undefined') {
|
||||
data.clients = this._clients.map((p) => p.serialize());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
clients: !this._clients ? true : this._clients.reduce((result, p) => result && p.validate().length === 0, true),
|
||||
auto_clients: !this._auto_clients ? true : this._auto_clients.reduce((result, p) => result && p.validate().length === 0, true),
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClients>): Clients {
|
||||
return new Clients({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
31
client2/src/lib/entities/ClientsArray.ts
Normal file
31
client2/src/lib/entities/ClientsArray.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientsArray {
|
||||
}
|
||||
|
||||
export default class ClientsArray {
|
||||
constructor(props: IClientsArray) {
|
||||
}
|
||||
|
||||
serialize(): IClientsArray {
|
||||
const data: IClientsArray = {
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientsArray>): ClientsArray {
|
||||
return new ClientsArray({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
31
client2/src/lib/entities/ClientsAutoArray.ts
Normal file
31
client2/src/lib/entities/ClientsAutoArray.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientsAutoArray {
|
||||
}
|
||||
|
||||
export default class ClientsAutoArray {
|
||||
constructor(props: IClientsAutoArray) {
|
||||
}
|
||||
|
||||
serialize(): IClientsAutoArray {
|
||||
const data: IClientsAutoArray = {
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientsAutoArray>): ClientsAutoArray {
|
||||
return new ClientsAutoArray({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
31
client2/src/lib/entities/ClientsFindEntry.ts
Normal file
31
client2/src/lib/entities/ClientsFindEntry.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientsFindEntry {
|
||||
}
|
||||
|
||||
export default class ClientsFindEntry {
|
||||
constructor(props: IClientsFindEntry) {
|
||||
}
|
||||
|
||||
serialize(): IClientsFindEntry {
|
||||
const data: IClientsFindEntry = {
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientsFindEntry>): ClientsFindEntry {
|
||||
return new ClientsFindEntry({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
31
client2/src/lib/entities/ClientsFindResponse.ts
Normal file
31
client2/src/lib/entities/ClientsFindResponse.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IClientsFindResponse {
|
||||
}
|
||||
|
||||
export default class ClientsFindResponse {
|
||||
constructor(props: IClientsFindResponse) {
|
||||
}
|
||||
|
||||
serialize(): IClientsFindResponse {
|
||||
const data: IClientsFindResponse = {
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IClientsFindResponse>): ClientsFindResponse {
|
||||
return new ClientsFindResponse({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
250
client2/src/lib/entities/DNSConfig.ts
Normal file
250
client2/src/lib/entities/DNSConfig.ts
Normal file
@@ -0,0 +1,250 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDNSConfig {
|
||||
blocking_ipv4?: string;
|
||||
blocking_ipv6?: string;
|
||||
blocking_mode?: string;
|
||||
bootstrap_dns?: string[];
|
||||
cache_size?: number;
|
||||
cache_ttl_max?: number;
|
||||
cache_ttl_min?: number;
|
||||
dhcp_available?: boolean;
|
||||
dnssec_enabled?: boolean;
|
||||
edns_cs_enabled?: boolean;
|
||||
protection_enabled?: boolean;
|
||||
ratelimit?: number;
|
||||
upstream_dns?: string[];
|
||||
upstream_dns_file?: string;
|
||||
upstream_mode?: any;
|
||||
}
|
||||
|
||||
export default class DNSConfig {
|
||||
readonly _blocking_ipv4: string | undefined;
|
||||
|
||||
get blockingIpv4(): string | undefined {
|
||||
return this._blocking_ipv4;
|
||||
}
|
||||
|
||||
readonly _blocking_ipv6: string | undefined;
|
||||
|
||||
get blockingIpv6(): string | undefined {
|
||||
return this._blocking_ipv6;
|
||||
}
|
||||
|
||||
readonly _blocking_mode: string | undefined;
|
||||
|
||||
get blockingMode(): string | undefined {
|
||||
return this._blocking_mode;
|
||||
}
|
||||
|
||||
readonly _bootstrap_dns: string[] | undefined;
|
||||
|
||||
/**
|
||||
* Description: Bootstrap servers, port is optional after colon. Empty value will reset it to default values.
|
||||
*
|
||||
* Example: 8.8.8.8:53,1.1.1.1:53
|
||||
*/
|
||||
get bootstrapDns(): string[] | undefined {
|
||||
return this._bootstrap_dns;
|
||||
}
|
||||
|
||||
readonly _cache_size: number | undefined;
|
||||
|
||||
get cacheSize(): number | undefined {
|
||||
return this._cache_size;
|
||||
}
|
||||
|
||||
readonly _cache_ttl_max: number | undefined;
|
||||
|
||||
get cacheTtlMax(): number | undefined {
|
||||
return this._cache_ttl_max;
|
||||
}
|
||||
|
||||
readonly _cache_ttl_min: number | undefined;
|
||||
|
||||
get cacheTtlMin(): number | undefined {
|
||||
return this._cache_ttl_min;
|
||||
}
|
||||
|
||||
readonly _dhcp_available: boolean | undefined;
|
||||
|
||||
get dhcpAvailable(): boolean | undefined {
|
||||
return this._dhcp_available;
|
||||
}
|
||||
|
||||
readonly _dnssec_enabled: boolean | undefined;
|
||||
|
||||
get dnssecEnabled(): boolean | undefined {
|
||||
return this._dnssec_enabled;
|
||||
}
|
||||
|
||||
readonly _edns_cs_enabled: boolean | undefined;
|
||||
|
||||
get ednsCsEnabled(): boolean | undefined {
|
||||
return this._edns_cs_enabled;
|
||||
}
|
||||
|
||||
readonly _protection_enabled: boolean | undefined;
|
||||
|
||||
get protectionEnabled(): boolean | undefined {
|
||||
return this._protection_enabled;
|
||||
}
|
||||
|
||||
readonly _ratelimit: number | undefined;
|
||||
|
||||
get ratelimit(): number | undefined {
|
||||
return this._ratelimit;
|
||||
}
|
||||
|
||||
readonly _upstream_dns: string[] | undefined;
|
||||
|
||||
/**
|
||||
* Description: Upstream servers, port is optional after colon. Empty value will reset it to default values.
|
||||
*
|
||||
* Example: tls://1.1.1.1,tls://1.0.0.1
|
||||
*/
|
||||
get upstreamDns(): string[] | undefined {
|
||||
return this._upstream_dns;
|
||||
}
|
||||
|
||||
readonly _upstream_dns_file: string | undefined;
|
||||
|
||||
get upstreamDnsFile(): string | undefined {
|
||||
return this._upstream_dns_file;
|
||||
}
|
||||
|
||||
readonly _upstream_mode: any | undefined;
|
||||
|
||||
get upstreamMode(): any | undefined {
|
||||
return this._upstream_mode;
|
||||
}
|
||||
|
||||
constructor(props: IDNSConfig) {
|
||||
if (typeof props.blocking_ipv4 === 'string') {
|
||||
this._blocking_ipv4 = props.blocking_ipv4.trim();
|
||||
}
|
||||
if (typeof props.blocking_ipv6 === 'string') {
|
||||
this._blocking_ipv6 = props.blocking_ipv6.trim();
|
||||
}
|
||||
if (typeof props.blocking_mode === 'string') {
|
||||
this._blocking_mode = props.blocking_mode.trim();
|
||||
}
|
||||
if (props.bootstrap_dns) {
|
||||
this._bootstrap_dns = props.bootstrap_dns;
|
||||
}
|
||||
if (typeof props.cache_size === 'number') {
|
||||
this._cache_size = props.cache_size;
|
||||
}
|
||||
if (typeof props.cache_ttl_max === 'number') {
|
||||
this._cache_ttl_max = props.cache_ttl_max;
|
||||
}
|
||||
if (typeof props.cache_ttl_min === 'number') {
|
||||
this._cache_ttl_min = props.cache_ttl_min;
|
||||
}
|
||||
if (typeof props.dhcp_available === 'boolean') {
|
||||
this._dhcp_available = props.dhcp_available;
|
||||
}
|
||||
if (typeof props.dnssec_enabled === 'boolean') {
|
||||
this._dnssec_enabled = props.dnssec_enabled;
|
||||
}
|
||||
if (typeof props.edns_cs_enabled === 'boolean') {
|
||||
this._edns_cs_enabled = props.edns_cs_enabled;
|
||||
}
|
||||
if (typeof props.protection_enabled === 'boolean') {
|
||||
this._protection_enabled = props.protection_enabled;
|
||||
}
|
||||
if (typeof props.ratelimit === 'number') {
|
||||
this._ratelimit = props.ratelimit;
|
||||
}
|
||||
if (props.upstream_dns) {
|
||||
this._upstream_dns = props.upstream_dns;
|
||||
}
|
||||
if (typeof props.upstream_dns_file === 'string') {
|
||||
this._upstream_dns_file = props.upstream_dns_file.trim();
|
||||
}
|
||||
if (props.upstream_mode) {
|
||||
this._upstream_mode = props.upstream_mode;
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDNSConfig {
|
||||
const data: IDNSConfig = {
|
||||
};
|
||||
if (typeof this._blocking_ipv4 !== 'undefined') {
|
||||
data.blocking_ipv4 = this._blocking_ipv4;
|
||||
}
|
||||
if (typeof this._blocking_ipv6 !== 'undefined') {
|
||||
data.blocking_ipv6 = this._blocking_ipv6;
|
||||
}
|
||||
if (typeof this._blocking_mode !== 'undefined') {
|
||||
data.blocking_mode = this._blocking_mode;
|
||||
}
|
||||
if (typeof this._bootstrap_dns !== 'undefined') {
|
||||
data.bootstrap_dns = this._bootstrap_dns;
|
||||
}
|
||||
if (typeof this._cache_size !== 'undefined') {
|
||||
data.cache_size = this._cache_size;
|
||||
}
|
||||
if (typeof this._cache_ttl_max !== 'undefined') {
|
||||
data.cache_ttl_max = this._cache_ttl_max;
|
||||
}
|
||||
if (typeof this._cache_ttl_min !== 'undefined') {
|
||||
data.cache_ttl_min = this._cache_ttl_min;
|
||||
}
|
||||
if (typeof this._dhcp_available !== 'undefined') {
|
||||
data.dhcp_available = this._dhcp_available;
|
||||
}
|
||||
if (typeof this._dnssec_enabled !== 'undefined') {
|
||||
data.dnssec_enabled = this._dnssec_enabled;
|
||||
}
|
||||
if (typeof this._edns_cs_enabled !== 'undefined') {
|
||||
data.edns_cs_enabled = this._edns_cs_enabled;
|
||||
}
|
||||
if (typeof this._protection_enabled !== 'undefined') {
|
||||
data.protection_enabled = this._protection_enabled;
|
||||
}
|
||||
if (typeof this._ratelimit !== 'undefined') {
|
||||
data.ratelimit = this._ratelimit;
|
||||
}
|
||||
if (typeof this._upstream_dns !== 'undefined') {
|
||||
data.upstream_dns = this._upstream_dns;
|
||||
}
|
||||
if (typeof this._upstream_dns_file !== 'undefined') {
|
||||
data.upstream_dns_file = this._upstream_dns_file;
|
||||
}
|
||||
if (typeof this._upstream_mode !== 'undefined') {
|
||||
data.upstream_mode = this._upstream_mode;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
bootstrap_dns: !this._bootstrap_dns ? true : this._bootstrap_dns.reduce((result, p) => result && typeof p === 'string', true),
|
||||
upstream_dns: !this._upstream_dns ? true : this._upstream_dns.reduce((result, p) => result && typeof p === 'string', true),
|
||||
upstream_dns_file: !this._upstream_dns_file ? true : typeof this._upstream_dns_file === 'string' && !this._upstream_dns_file ? true : this._upstream_dns_file,
|
||||
protection_enabled: !this._protection_enabled ? true : typeof this._protection_enabled === 'boolean',
|
||||
dhcp_available: !this._dhcp_available ? true : typeof this._dhcp_available === 'boolean',
|
||||
ratelimit: !this._ratelimit ? true : typeof this._ratelimit === 'number',
|
||||
blocking_mode: !this._blocking_mode ? true : typeof this._blocking_mode === 'string' && !this._blocking_mode ? true : this._blocking_mode,
|
||||
blocking_ipv4: !this._blocking_ipv4 ? true : typeof this._blocking_ipv4 === 'string' && !this._blocking_ipv4 ? true : this._blocking_ipv4,
|
||||
blocking_ipv6: !this._blocking_ipv6 ? true : typeof this._blocking_ipv6 === 'string' && !this._blocking_ipv6 ? true : this._blocking_ipv6,
|
||||
edns_cs_enabled: !this._edns_cs_enabled ? true : typeof this._edns_cs_enabled === 'boolean',
|
||||
dnssec_enabled: !this._dnssec_enabled ? true : typeof this._dnssec_enabled === 'boolean',
|
||||
cache_size: !this._cache_size ? true : typeof this._cache_size === 'number',
|
||||
cache_ttl_min: !this._cache_ttl_min ? true : typeof this._cache_ttl_min === 'number',
|
||||
cache_ttl_max: !this._cache_ttl_max ? true : typeof this._cache_ttl_max === 'number',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDNSConfig>): DNSConfig {
|
||||
return new DNSConfig({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
90
client2/src/lib/entities/DhcpConfig.ts
Normal file
90
client2/src/lib/entities/DhcpConfig.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import DhcpConfigV4, { IDhcpConfigV4 } from './DhcpConfigV4';
|
||||
import DhcpConfigV6, { IDhcpConfigV6 } from './DhcpConfigV6';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpConfig {
|
||||
enabled?: boolean;
|
||||
interface_name?: string;
|
||||
v4?: IDhcpConfigV4;
|
||||
v6?: IDhcpConfigV6;
|
||||
}
|
||||
|
||||
export default class DhcpConfig {
|
||||
readonly _enabled: boolean | undefined;
|
||||
|
||||
get enabled(): boolean | undefined {
|
||||
return this._enabled;
|
||||
}
|
||||
|
||||
readonly _interface_name: string | undefined;
|
||||
|
||||
get interfaceName(): string | undefined {
|
||||
return this._interface_name;
|
||||
}
|
||||
|
||||
readonly _v4: DhcpConfigV4 | undefined;
|
||||
|
||||
get v4(): DhcpConfigV4 | undefined {
|
||||
return this._v4;
|
||||
}
|
||||
|
||||
readonly _v6: DhcpConfigV6 | undefined;
|
||||
|
||||
get v6(): DhcpConfigV6 | undefined {
|
||||
return this._v6;
|
||||
}
|
||||
|
||||
constructor(props: IDhcpConfig) {
|
||||
if (typeof props.enabled === 'boolean') {
|
||||
this._enabled = props.enabled;
|
||||
}
|
||||
if (typeof props.interface_name === 'string') {
|
||||
this._interface_name = props.interface_name.trim();
|
||||
}
|
||||
if (props.v4) {
|
||||
this._v4 = new DhcpConfigV4(props.v4);
|
||||
}
|
||||
if (props.v6) {
|
||||
this._v6 = new DhcpConfigV6(props.v6);
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDhcpConfig {
|
||||
const data: IDhcpConfig = {
|
||||
};
|
||||
if (typeof this._enabled !== 'undefined') {
|
||||
data.enabled = this._enabled;
|
||||
}
|
||||
if (typeof this._interface_name !== 'undefined') {
|
||||
data.interface_name = this._interface_name;
|
||||
}
|
||||
if (typeof this._v4 !== 'undefined') {
|
||||
data.v4 = this._v4.serialize();
|
||||
}
|
||||
if (typeof this._v6 !== 'undefined') {
|
||||
data.v6 = this._v6.serialize();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
enabled: !this._enabled ? true : typeof this._enabled === 'boolean',
|
||||
interface_name: !this._interface_name ? true : typeof this._interface_name === 'string' && !this._interface_name ? true : this._interface_name,
|
||||
v4: !this._v4 ? true : this._v4.validate().length === 0,
|
||||
v6: !this._v6 ? true : this._v6.validate().length === 0,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpConfig>): DhcpConfig {
|
||||
return new DhcpConfig({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
117
client2/src/lib/entities/DhcpConfigV4.ts
Normal file
117
client2/src/lib/entities/DhcpConfigV4.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpConfigV4 {
|
||||
gateway_ip?: string;
|
||||
lease_duration?: number;
|
||||
range_end?: string;
|
||||
range_start?: string;
|
||||
subnet_mask?: string;
|
||||
}
|
||||
|
||||
export default class DhcpConfigV4 {
|
||||
readonly _gateway_ip: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 192.168.1.1
|
||||
*/
|
||||
get gatewayIp(): string | undefined {
|
||||
return this._gateway_ip;
|
||||
}
|
||||
|
||||
readonly _lease_duration: number | undefined;
|
||||
|
||||
get leaseDuration(): number | undefined {
|
||||
return this._lease_duration;
|
||||
}
|
||||
|
||||
readonly _range_end: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 192.168.10.50
|
||||
*/
|
||||
get rangeEnd(): string | undefined {
|
||||
return this._range_end;
|
||||
}
|
||||
|
||||
readonly _range_start: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 192.168.1.2
|
||||
*/
|
||||
get rangeStart(): string | undefined {
|
||||
return this._range_start;
|
||||
}
|
||||
|
||||
readonly _subnet_mask: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 255.255.255.0
|
||||
*/
|
||||
get subnetMask(): string | undefined {
|
||||
return this._subnet_mask;
|
||||
}
|
||||
|
||||
constructor(props: IDhcpConfigV4) {
|
||||
if (typeof props.gateway_ip === 'string') {
|
||||
this._gateway_ip = props.gateway_ip.trim();
|
||||
}
|
||||
if (typeof props.lease_duration === 'number') {
|
||||
this._lease_duration = props.lease_duration;
|
||||
}
|
||||
if (typeof props.range_end === 'string') {
|
||||
this._range_end = props.range_end.trim();
|
||||
}
|
||||
if (typeof props.range_start === 'string') {
|
||||
this._range_start = props.range_start.trim();
|
||||
}
|
||||
if (typeof props.subnet_mask === 'string') {
|
||||
this._subnet_mask = props.subnet_mask.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDhcpConfigV4 {
|
||||
const data: IDhcpConfigV4 = {
|
||||
};
|
||||
if (typeof this._gateway_ip !== 'undefined') {
|
||||
data.gateway_ip = this._gateway_ip;
|
||||
}
|
||||
if (typeof this._lease_duration !== 'undefined') {
|
||||
data.lease_duration = this._lease_duration;
|
||||
}
|
||||
if (typeof this._range_end !== 'undefined') {
|
||||
data.range_end = this._range_end;
|
||||
}
|
||||
if (typeof this._range_start !== 'undefined') {
|
||||
data.range_start = this._range_start;
|
||||
}
|
||||
if (typeof this._subnet_mask !== 'undefined') {
|
||||
data.subnet_mask = this._subnet_mask;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
gateway_ip: !this._gateway_ip ? true : typeof this._gateway_ip === 'string' && !this._gateway_ip ? true : this._gateway_ip,
|
||||
subnet_mask: !this._subnet_mask ? true : typeof this._subnet_mask === 'string' && !this._subnet_mask ? true : this._subnet_mask,
|
||||
range_start: !this._range_start ? true : typeof this._range_start === 'string' && !this._range_start ? true : this._range_start,
|
||||
range_end: !this._range_end ? true : typeof this._range_end === 'string' && !this._range_end ? true : this._range_end,
|
||||
lease_duration: !this._lease_duration ? true : typeof this._lease_duration === 'number',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpConfigV4>): DhcpConfigV4 {
|
||||
return new DhcpConfigV4({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
59
client2/src/lib/entities/DhcpConfigV6.ts
Normal file
59
client2/src/lib/entities/DhcpConfigV6.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpConfigV6 {
|
||||
lease_duration?: number;
|
||||
range_start?: string;
|
||||
}
|
||||
|
||||
export default class DhcpConfigV6 {
|
||||
readonly _lease_duration: number | undefined;
|
||||
|
||||
get leaseDuration(): number | undefined {
|
||||
return this._lease_duration;
|
||||
}
|
||||
|
||||
readonly _range_start: string | undefined;
|
||||
|
||||
get rangeStart(): string | undefined {
|
||||
return this._range_start;
|
||||
}
|
||||
|
||||
constructor(props: IDhcpConfigV6) {
|
||||
if (typeof props.lease_duration === 'number') {
|
||||
this._lease_duration = props.lease_duration;
|
||||
}
|
||||
if (typeof props.range_start === 'string') {
|
||||
this._range_start = props.range_start.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDhcpConfigV6 {
|
||||
const data: IDhcpConfigV6 = {
|
||||
};
|
||||
if (typeof this._lease_duration !== 'undefined') {
|
||||
data.lease_duration = this._lease_duration;
|
||||
}
|
||||
if (typeof this._range_start !== 'undefined') {
|
||||
data.range_start = this._range_start;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
range_start: !this._range_start ? true : typeof this._range_start === 'string' && !this._range_start ? true : this._range_start,
|
||||
lease_duration: !this._lease_duration ? true : typeof this._lease_duration === 'number',
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpConfigV6>): DhcpConfigV6 {
|
||||
return new DhcpConfigV6({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
103
client2/src/lib/entities/DhcpLease.ts
Normal file
103
client2/src/lib/entities/DhcpLease.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpLease {
|
||||
expires: string;
|
||||
hostname: string;
|
||||
ip: string;
|
||||
mac: string;
|
||||
}
|
||||
|
||||
export default class DhcpLease {
|
||||
readonly _expires: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 2017-07-21T17:32:28Z
|
||||
*/
|
||||
get expires(): string {
|
||||
return this._expires;
|
||||
}
|
||||
|
||||
static expiresValidate(expires: string): boolean {
|
||||
return typeof expires === 'string' && !!expires.trim();
|
||||
}
|
||||
|
||||
readonly _hostname: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: dell
|
||||
*/
|
||||
get hostname(): string {
|
||||
return this._hostname;
|
||||
}
|
||||
|
||||
static hostnameValidate(hostname: string): boolean {
|
||||
return typeof hostname === 'string' && !!hostname.trim();
|
||||
}
|
||||
|
||||
readonly _ip: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 192.168.1.22
|
||||
*/
|
||||
get ip(): string {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
static ipValidate(ip: string): boolean {
|
||||
return typeof ip === 'string' && !!ip.trim();
|
||||
}
|
||||
|
||||
readonly _mac: string;
|
||||
|
||||
/**
|
||||
* Description: undefined
|
||||
* Example: 00:11:09:b3:b3:b8
|
||||
*/
|
||||
get mac(): string {
|
||||
return this._mac;
|
||||
}
|
||||
|
||||
static macValidate(mac: string): boolean {
|
||||
return typeof mac === 'string' && !!mac.trim();
|
||||
}
|
||||
|
||||
constructor(props: IDhcpLease) {
|
||||
this._expires = props.expires.trim();
|
||||
this._hostname = props.hostname.trim();
|
||||
this._ip = props.ip.trim();
|
||||
this._mac = props.mac.trim();
|
||||
}
|
||||
|
||||
serialize(): IDhcpLease {
|
||||
const data: IDhcpLease = {
|
||||
expires: this._expires,
|
||||
hostname: this._hostname,
|
||||
ip: this._ip,
|
||||
mac: this._mac,
|
||||
};
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
mac: typeof this._mac === 'string' && !this._mac ? true : this._mac,
|
||||
ip: typeof this._ip === 'string' && !this._ip ? true : this._ip,
|
||||
hostname: typeof this._hostname === 'string' && !this._hostname ? true : this._hostname,
|
||||
expires: typeof this._expires === 'string' && !this._expires ? true : this._expires,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpLease>): DhcpLease {
|
||||
return new DhcpLease({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
62
client2/src/lib/entities/DhcpSearchResult.ts
Normal file
62
client2/src/lib/entities/DhcpSearchResult.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import DhcpSearchV4, { IDhcpSearchV4 } from './DhcpSearchV4';
|
||||
import DhcpSearchV6, { IDhcpSearchV6 } from './DhcpSearchV6';
|
||||
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpSearchResult {
|
||||
v4?: IDhcpSearchV4;
|
||||
v6?: IDhcpSearchV6;
|
||||
}
|
||||
|
||||
export default class DhcpSearchResult {
|
||||
readonly _v4: DhcpSearchV4 | undefined;
|
||||
|
||||
get v4(): DhcpSearchV4 | undefined {
|
||||
return this._v4;
|
||||
}
|
||||
|
||||
readonly _v6: DhcpSearchV6 | undefined;
|
||||
|
||||
get v6(): DhcpSearchV6 | undefined {
|
||||
return this._v6;
|
||||
}
|
||||
|
||||
constructor(props: IDhcpSearchResult) {
|
||||
if (props.v4) {
|
||||
this._v4 = new DhcpSearchV4(props.v4);
|
||||
}
|
||||
if (props.v6) {
|
||||
this._v6 = new DhcpSearchV6(props.v6);
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDhcpSearchResult {
|
||||
const data: IDhcpSearchResult = {
|
||||
};
|
||||
if (typeof this._v4 !== 'undefined') {
|
||||
data.v4 = this._v4.serialize();
|
||||
}
|
||||
if (typeof this._v6 !== 'undefined') {
|
||||
data.v6 = this._v6.serialize();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
v4: !this._v4 ? true : this._v4.validate().length === 0,
|
||||
v6: !this._v6 ? true : this._v6.validate().length === 0,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpSearchResult>): DhcpSearchResult {
|
||||
return new DhcpSearchResult({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
64
client2/src/lib/entities/DhcpSearchResultOtherServer.ts
Normal file
64
client2/src/lib/entities/DhcpSearchResultOtherServer.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpSearchResultOtherServer {
|
||||
error?: string;
|
||||
found?: string;
|
||||
}
|
||||
|
||||
export default class DhcpSearchResultOtherServer {
|
||||
readonly _error: string | undefined;
|
||||
|
||||
/** */
|
||||
get error(): string | undefined {
|
||||
return this._error;
|
||||
}
|
||||
|
||||
readonly _found: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: yes|no|error
|
||||
* Example: no
|
||||
*/
|
||||
get found(): string | undefined {
|
||||
return this._found;
|
||||
}
|
||||
|
||||
constructor(props: IDhcpSearchResultOtherServer) {
|
||||
if (typeof props.error === 'string') {
|
||||
this._error = props.error.trim();
|
||||
}
|
||||
if (typeof props.found === 'string') {
|
||||
this._found = props.found.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDhcpSearchResultOtherServer {
|
||||
const data: IDhcpSearchResultOtherServer = {
|
||||
};
|
||||
if (typeof this._error !== 'undefined') {
|
||||
data.error = this._error;
|
||||
}
|
||||
if (typeof this._found !== 'undefined') {
|
||||
data.found = this._found;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
found: !this._found ? true : typeof this._found === 'string' && !this._found ? true : this._found,
|
||||
error: !this._error ? true : typeof this._error === 'string' && !this._error ? true : this._error,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpSearchResultOtherServer>): DhcpSearchResultOtherServer {
|
||||
return new DhcpSearchResultOtherServer({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
64
client2/src/lib/entities/DhcpSearchResultStaticIP.ts
Normal file
64
client2/src/lib/entities/DhcpSearchResultStaticIP.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
// This file was autogenerated. Please do not change.
|
||||
// All changes will be overwrited on commit.
|
||||
export interface IDhcpSearchResultStaticIP {
|
||||
ip?: string;
|
||||
static?: string;
|
||||
}
|
||||
|
||||
export default class DhcpSearchResultStaticIP {
|
||||
readonly _ip: string | undefined;
|
||||
|
||||
/** */
|
||||
get ip(): string | undefined {
|
||||
return this._ip;
|
||||
}
|
||||
|
||||
readonly _static: string | undefined;
|
||||
|
||||
/**
|
||||
* Description: yes|no|error
|
||||
* Example: yes
|
||||
*/
|
||||
get static(): string | undefined {
|
||||
return this._static;
|
||||
}
|
||||
|
||||
constructor(props: IDhcpSearchResultStaticIP) {
|
||||
if (typeof props.ip === 'string') {
|
||||
this._ip = props.ip.trim();
|
||||
}
|
||||
if (typeof props.static === 'string') {
|
||||
this._static = props.static.trim();
|
||||
}
|
||||
}
|
||||
|
||||
serialize(): IDhcpSearchResultStaticIP {
|
||||
const data: IDhcpSearchResultStaticIP = {
|
||||
};
|
||||
if (typeof this._ip !== 'undefined') {
|
||||
data.ip = this._ip;
|
||||
}
|
||||
if (typeof this._static !== 'undefined') {
|
||||
data.static = this._static;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
validate(): string[] {
|
||||
const validate = {
|
||||
static: !this._static ? true : typeof this._static === 'string' && !this._static ? true : this._static,
|
||||
ip: !this._ip ? true : typeof this._ip === 'string' && !this._ip ? true : this._ip,
|
||||
};
|
||||
const isError: string[] = [];
|
||||
Object.keys(validate).forEach((key) => {
|
||||
if (!(validate as any)[key]) {
|
||||
isError.push(key);
|
||||
}
|
||||
});
|
||||
return isError;
|
||||
}
|
||||
|
||||
update(props: Partial<IDhcpSearchResultStaticIP>): DhcpSearchResultStaticIP {
|
||||
return new DhcpSearchResultStaticIP({ ...this.serialize(), ...props });
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user