+ client: Refactor DHCP settings
This commit is contained in:
committed by
Simon Zolin
parent
c9f58ce4a7
commit
1d35d73fc5
@@ -32,25 +32,13 @@ class Api {
|
||||
}
|
||||
|
||||
// Global methods
|
||||
GLOBAL_STATUS = {
|
||||
path: 'status',
|
||||
method: 'GET',
|
||||
};
|
||||
GLOBAL_STATUS = { path: 'status', method: 'GET' }
|
||||
|
||||
GLOBAL_TEST_UPSTREAM_DNS = {
|
||||
path: 'test_upstream_dns',
|
||||
method: 'POST',
|
||||
};
|
||||
GLOBAL_TEST_UPSTREAM_DNS = { path: 'test_upstream_dns', method: 'POST' };
|
||||
|
||||
GLOBAL_VERSION = {
|
||||
path: 'version.json',
|
||||
method: 'POST',
|
||||
};
|
||||
GLOBAL_VERSION = { path: 'version.json', method: 'POST' };
|
||||
|
||||
GLOBAL_UPDATE = {
|
||||
path: 'update',
|
||||
method: 'POST',
|
||||
};
|
||||
GLOBAL_UPDATE = { path: 'update', method: 'POST' };
|
||||
|
||||
getGlobalStatus() {
|
||||
const { path, method } = this.GLOBAL_STATUS;
|
||||
@@ -81,45 +69,21 @@ class Api {
|
||||
}
|
||||
|
||||
// Filtering
|
||||
FILTERING_STATUS = {
|
||||
path: 'filtering/status',
|
||||
method: 'GET',
|
||||
};
|
||||
FILTERING_STATUS = { path: 'filtering/status', method: 'GET' };
|
||||
|
||||
FILTERING_ADD_FILTER = {
|
||||
path: 'filtering/add_url',
|
||||
method: 'POST',
|
||||
};
|
||||
FILTERING_ADD_FILTER = { path: 'filtering/add_url', method: 'POST' };
|
||||
|
||||
FILTERING_REMOVE_FILTER = {
|
||||
path: 'filtering/remove_url',
|
||||
method: 'POST',
|
||||
};
|
||||
FILTERING_REMOVE_FILTER = { path: 'filtering/remove_url', method: 'POST' };
|
||||
|
||||
FILTERING_SET_RULES = {
|
||||
path: 'filtering/set_rules',
|
||||
method: 'POST',
|
||||
};
|
||||
FILTERING_SET_RULES = { path: 'filtering/set_rules', method: 'POST' };
|
||||
|
||||
FILTERING_REFRESH = {
|
||||
path: 'filtering/refresh',
|
||||
method: 'POST',
|
||||
};
|
||||
FILTERING_REFRESH = { path: 'filtering/refresh', method: 'POST' };
|
||||
|
||||
FILTERING_SET_URL = {
|
||||
path: 'filtering/set_url',
|
||||
method: 'POST',
|
||||
};
|
||||
FILTERING_SET_URL = { path: 'filtering/set_url', method: 'POST' };
|
||||
|
||||
FILTERING_CONFIG = {
|
||||
path: 'filtering/config',
|
||||
method: 'POST',
|
||||
};
|
||||
FILTERING_CONFIG = { path: 'filtering/config', method: 'POST' };
|
||||
|
||||
FILTERING_CHECK_HOST = {
|
||||
path: 'filtering/check_host',
|
||||
method: 'GET',
|
||||
};
|
||||
FILTERING_CHECK_HOST = { path: 'filtering/check_host', method: 'GET' };
|
||||
|
||||
getFilteringStatus() {
|
||||
const { path, method } = this.FILTERING_STATUS;
|
||||
@@ -190,20 +154,11 @@ class Api {
|
||||
}
|
||||
|
||||
// Parental
|
||||
PARENTAL_STATUS = {
|
||||
path: 'parental/status',
|
||||
method: 'GET',
|
||||
};
|
||||
PARENTAL_STATUS = { path: 'parental/status', method: 'GET' };
|
||||
|
||||
PARENTAL_ENABLE = {
|
||||
path: 'parental/enable',
|
||||
method: 'POST',
|
||||
};
|
||||
PARENTAL_ENABLE = { path: 'parental/enable', method: 'POST' };
|
||||
|
||||
PARENTAL_DISABLE = {
|
||||
path: 'parental/disable',
|
||||
method: 'POST',
|
||||
};
|
||||
PARENTAL_DISABLE = { path: 'parental/disable', method: 'POST' };
|
||||
|
||||
getParentalStatus() {
|
||||
const { path, method } = this.PARENTAL_STATUS;
|
||||
@@ -226,20 +181,11 @@ class Api {
|
||||
}
|
||||
|
||||
// Safebrowsing
|
||||
SAFEBROWSING_STATUS = {
|
||||
path: 'safebrowsing/status',
|
||||
method: 'GET',
|
||||
};
|
||||
SAFEBROWSING_STATUS = { path: 'safebrowsing/status', method: 'GET' };
|
||||
|
||||
SAFEBROWSING_ENABLE = {
|
||||
path: 'safebrowsing/enable',
|
||||
method: 'POST',
|
||||
};
|
||||
SAFEBROWSING_ENABLE = { path: 'safebrowsing/enable', method: 'POST' };
|
||||
|
||||
SAFEBROWSING_DISABLE = {
|
||||
path: 'safebrowsing/disable',
|
||||
method: 'POST',
|
||||
};
|
||||
SAFEBROWSING_DISABLE = { path: 'safebrowsing/disable', method: 'POST' };
|
||||
|
||||
getSafebrowsingStatus() {
|
||||
const { path, method } = this.SAFEBROWSING_STATUS;
|
||||
@@ -257,20 +203,11 @@ class Api {
|
||||
}
|
||||
|
||||
// Safesearch
|
||||
SAFESEARCH_STATUS = {
|
||||
path: 'safesearch/status',
|
||||
method: 'GET',
|
||||
};
|
||||
SAFESEARCH_STATUS = { path: 'safesearch/status', method: 'GET' };
|
||||
|
||||
SAFESEARCH_ENABLE = {
|
||||
path: 'safesearch/enable',
|
||||
method: 'POST',
|
||||
};
|
||||
SAFESEARCH_ENABLE = { path: 'safesearch/enable', method: 'POST' };
|
||||
|
||||
SAFESEARCH_DISABLE = {
|
||||
path: 'safesearch/disable',
|
||||
method: 'POST',
|
||||
};
|
||||
SAFESEARCH_DISABLE = { path: 'safesearch/disable', method: 'POST' };
|
||||
|
||||
getSafesearchStatus() {
|
||||
const { path, method } = this.SAFESEARCH_STATUS;
|
||||
@@ -288,15 +225,9 @@ class Api {
|
||||
}
|
||||
|
||||
// Language
|
||||
CURRENT_LANGUAGE = {
|
||||
path: 'i18n/current_language',
|
||||
method: 'GET',
|
||||
};
|
||||
CURRENT_LANGUAGE = { path: 'i18n/current_language', method: 'GET' };
|
||||
|
||||
CHANGE_LANGUAGE = {
|
||||
path: 'i18n/change_language',
|
||||
method: 'POST',
|
||||
};
|
||||
CHANGE_LANGUAGE = { path: 'i18n/change_language', method: 'POST' };
|
||||
|
||||
getCurrentLanguage() {
|
||||
const { path, method } = this.CURRENT_LANGUAGE;
|
||||
@@ -313,40 +244,19 @@ class Api {
|
||||
}
|
||||
|
||||
// DHCP
|
||||
DHCP_STATUS = {
|
||||
path: 'dhcp/status',
|
||||
method: 'GET',
|
||||
};
|
||||
DHCP_STATUS = { path: 'dhcp/status', method: 'GET' };
|
||||
|
||||
DHCP_SET_CONFIG = {
|
||||
path: 'dhcp/set_config',
|
||||
method: 'POST',
|
||||
};
|
||||
DHCP_SET_CONFIG = { path: 'dhcp/set_config', method: 'POST' };
|
||||
|
||||
DHCP_FIND_ACTIVE = {
|
||||
path: 'dhcp/find_active_dhcp',
|
||||
method: 'POST',
|
||||
};
|
||||
DHCP_FIND_ACTIVE = { path: 'dhcp/find_active_dhcp', method: 'POST' };
|
||||
|
||||
DHCP_INTERFACES = {
|
||||
path: 'dhcp/interfaces',
|
||||
method: 'GET',
|
||||
};
|
||||
DHCP_INTERFACES = { path: 'dhcp/interfaces', method: 'GET' };
|
||||
|
||||
DHCP_ADD_STATIC_LEASE = {
|
||||
path: 'dhcp/add_static_lease',
|
||||
method: 'POST',
|
||||
};
|
||||
DHCP_ADD_STATIC_LEASE = { path: 'dhcp/add_static_lease', method: 'POST' };
|
||||
|
||||
DHCP_REMOVE_STATIC_LEASE = {
|
||||
path: 'dhcp/remove_static_lease',
|
||||
method: 'POST',
|
||||
};
|
||||
DHCP_REMOVE_STATIC_LEASE = { path: 'dhcp/remove_static_lease', method: 'POST' };
|
||||
|
||||
DHCP_RESET = {
|
||||
path: 'dhcp/reset',
|
||||
method: 'POST',
|
||||
};
|
||||
DHCP_RESET = { path: 'dhcp/reset', method: 'POST' };
|
||||
|
||||
getDhcpStatus() {
|
||||
const { path, method } = this.DHCP_STATUS;
|
||||
@@ -400,20 +310,11 @@ class Api {
|
||||
}
|
||||
|
||||
// Installation
|
||||
INSTALL_GET_ADDRESSES = {
|
||||
path: 'install/get_addresses',
|
||||
method: 'GET',
|
||||
};
|
||||
INSTALL_GET_ADDRESSES = { path: 'install/get_addresses', method: 'GET' };
|
||||
|
||||
INSTALL_CONFIGURE = {
|
||||
path: 'install/configure',
|
||||
method: 'POST',
|
||||
};
|
||||
INSTALL_CONFIGURE = { path: 'install/configure', method: 'POST' };
|
||||
|
||||
INSTALL_CHECK_CONFIG = {
|
||||
path: 'install/check_config',
|
||||
method: 'POST',
|
||||
};
|
||||
INSTALL_CHECK_CONFIG = { path: 'install/check_config', method: 'POST' };
|
||||
|
||||
getDefaultAddresses() {
|
||||
const { path, method } = this.INSTALL_GET_ADDRESSES;
|
||||
@@ -439,20 +340,11 @@ class Api {
|
||||
}
|
||||
|
||||
// DNS-over-HTTPS and DNS-over-TLS
|
||||
TLS_STATUS = {
|
||||
path: 'tls/status',
|
||||
method: 'GET',
|
||||
};
|
||||
TLS_STATUS = { path: 'tls/status', method: 'GET' };
|
||||
|
||||
TLS_CONFIG = {
|
||||
path: 'tls/configure',
|
||||
method: 'POST',
|
||||
};
|
||||
TLS_CONFIG = { path: 'tls/configure', method: 'POST' };
|
||||
|
||||
TLS_VALIDATE = {
|
||||
path: 'tls/validate',
|
||||
method: 'POST',
|
||||
};
|
||||
TLS_VALIDATE = { path: 'tls/validate', method: 'POST' };
|
||||
|
||||
getTlsStatus() {
|
||||
const { path, method } = this.TLS_STATUS;
|
||||
@@ -478,30 +370,15 @@ class Api {
|
||||
}
|
||||
|
||||
// Per-client settings
|
||||
GET_CLIENTS = {
|
||||
path: 'clients',
|
||||
method: 'GET',
|
||||
};
|
||||
GET_CLIENTS = { path: 'clients', method: 'GET' };
|
||||
|
||||
FIND_CLIENTS = {
|
||||
path: 'clients/find',
|
||||
method: 'GET',
|
||||
};
|
||||
FIND_CLIENTS = { path: 'clients/find', method: 'GET' };
|
||||
|
||||
ADD_CLIENT = {
|
||||
path: 'clients/add',
|
||||
method: 'POST',
|
||||
};
|
||||
ADD_CLIENT = { path: 'clients/add', method: 'POST' };
|
||||
|
||||
DELETE_CLIENT = {
|
||||
path: 'clients/delete',
|
||||
method: 'POST',
|
||||
};
|
||||
DELETE_CLIENT = { path: 'clients/delete', method: 'POST' };
|
||||
|
||||
UPDATE_CLIENT = {
|
||||
path: 'clients/update',
|
||||
method: 'POST',
|
||||
};
|
||||
UPDATE_CLIENT = { path: 'clients/update', method: 'POST' };
|
||||
|
||||
getClients() {
|
||||
const { path, method } = this.GET_CLIENTS;
|
||||
@@ -542,15 +419,9 @@ class Api {
|
||||
}
|
||||
|
||||
// DNS access settings
|
||||
ACCESS_LIST = {
|
||||
path: 'access/list',
|
||||
method: 'GET',
|
||||
};
|
||||
ACCESS_LIST = { path: 'access/list', method: 'GET' };
|
||||
|
||||
ACCESS_SET = {
|
||||
path: 'access/set',
|
||||
method: 'POST',
|
||||
};
|
||||
ACCESS_SET = { path: 'access/set', method: 'POST' };
|
||||
|
||||
getAccessList() {
|
||||
const { path, method } = this.ACCESS_LIST;
|
||||
@@ -567,20 +438,11 @@ class Api {
|
||||
}
|
||||
|
||||
// DNS rewrites
|
||||
REWRITES_LIST = {
|
||||
path: 'rewrite/list',
|
||||
method: 'GET',
|
||||
};
|
||||
REWRITES_LIST = { path: 'rewrite/list', method: 'GET' };
|
||||
|
||||
REWRITE_ADD = {
|
||||
path: 'rewrite/add',
|
||||
method: 'POST',
|
||||
};
|
||||
REWRITE_ADD = { path: 'rewrite/add', method: 'POST' };
|
||||
|
||||
REWRITE_DELETE = {
|
||||
path: 'rewrite/delete',
|
||||
method: 'POST',
|
||||
};
|
||||
REWRITE_DELETE = { path: 'rewrite/delete', method: 'POST' };
|
||||
|
||||
getRewritesList() {
|
||||
const { path, method } = this.REWRITES_LIST;
|
||||
@@ -606,15 +468,9 @@ class Api {
|
||||
}
|
||||
|
||||
// Blocked services
|
||||
BLOCKED_SERVICES_LIST = {
|
||||
path: 'blocked_services/list',
|
||||
method: 'GET',
|
||||
};
|
||||
BLOCKED_SERVICES_LIST = { path: 'blocked_services/list', method: 'GET' };
|
||||
|
||||
BLOCKED_SERVICES_SET = {
|
||||
path: 'blocked_services/set',
|
||||
method: 'POST',
|
||||
};
|
||||
BLOCKED_SERVICES_SET = { path: 'blocked_services/set', method: 'POST' };
|
||||
|
||||
getBlockedServices() {
|
||||
const { path, method } = this.BLOCKED_SERVICES_LIST;
|
||||
@@ -631,25 +487,13 @@ class Api {
|
||||
}
|
||||
|
||||
// Settings for statistics
|
||||
GET_STATS = {
|
||||
path: 'stats',
|
||||
method: 'GET',
|
||||
};
|
||||
GET_STATS = { path: 'stats', method: 'GET' };
|
||||
|
||||
STATS_INFO = {
|
||||
path: 'stats_info',
|
||||
method: 'GET',
|
||||
};
|
||||
STATS_INFO = { path: 'stats_info', method: 'GET' };
|
||||
|
||||
STATS_CONFIG = {
|
||||
path: 'stats_config',
|
||||
method: 'POST',
|
||||
};
|
||||
STATS_CONFIG = { path: 'stats_config', method: 'POST' };
|
||||
|
||||
STATS_RESET = {
|
||||
path: 'stats_reset',
|
||||
method: 'POST',
|
||||
};
|
||||
STATS_RESET = { path: 'stats_reset', method: 'POST' };
|
||||
|
||||
getStats() {
|
||||
const { path, method } = this.GET_STATS;
|
||||
@@ -676,25 +520,13 @@ class Api {
|
||||
}
|
||||
|
||||
// Query log
|
||||
GET_QUERY_LOG = {
|
||||
path: 'querylog',
|
||||
method: 'GET',
|
||||
};
|
||||
GET_QUERY_LOG = { path: 'querylog', method: 'GET' };
|
||||
|
||||
QUERY_LOG_CONFIG = {
|
||||
path: 'querylog_config',
|
||||
method: 'POST',
|
||||
};
|
||||
QUERY_LOG_CONFIG = { path: 'querylog_config', method: 'POST' };
|
||||
|
||||
QUERY_LOG_INFO = {
|
||||
path: 'querylog_info',
|
||||
method: 'GET',
|
||||
};
|
||||
QUERY_LOG_INFO = { path: 'querylog_info', method: 'GET' };
|
||||
|
||||
QUERY_LOG_CLEAR = {
|
||||
path: 'querylog_clear',
|
||||
method: 'POST',
|
||||
};
|
||||
QUERY_LOG_CLEAR = { path: 'querylog_clear', method: 'POST' };
|
||||
|
||||
getQueryLog(params) {
|
||||
const { path, method } = this.GET_QUERY_LOG;
|
||||
@@ -722,10 +554,7 @@ class Api {
|
||||
}
|
||||
|
||||
// Login
|
||||
LOGIN = {
|
||||
path: 'login',
|
||||
method: 'POST',
|
||||
};
|
||||
LOGIN = { path: 'login', method: 'POST' };
|
||||
|
||||
login(data) {
|
||||
const { path, method } = this.LOGIN;
|
||||
@@ -737,10 +566,7 @@ class Api {
|
||||
}
|
||||
|
||||
// Profile
|
||||
GET_PROFILE = {
|
||||
path: 'profile',
|
||||
method: 'GET',
|
||||
};
|
||||
GET_PROFILE = { path: 'profile', method: 'GET' };
|
||||
|
||||
getProfile() {
|
||||
const { path, method } = this.GET_PROFILE;
|
||||
@@ -748,15 +574,9 @@ class Api {
|
||||
}
|
||||
|
||||
// DNS config
|
||||
GET_DNS_CONFIG = {
|
||||
path: 'dns_info',
|
||||
method: 'GET',
|
||||
};
|
||||
GET_DNS_CONFIG = { path: 'dns_info', method: 'GET' };
|
||||
|
||||
SET_DNS_CONFIG = {
|
||||
path: 'dns_config',
|
||||
method: 'POST',
|
||||
};
|
||||
SET_DNS_CONFIG = { path: 'dns_config', method: 'POST' };
|
||||
|
||||
getDnsConfig() {
|
||||
const { path, method } = this.GET_DNS_CONFIG;
|
||||
|
||||
Reference in New Issue
Block a user