From bf2781d465041c2e7db68cb3529115642a61e455 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Wed, 6 Mar 2019 16:35:21 +0300 Subject: [PATCH] * client: locales and pass object to testUpstream --- client/src/__locales/en.json | 6 ++--- client/src/actions/index.js | 21 +++++++++++---- .../src/components/Settings/Upstream/Form.js | 27 ++++++++++++++++--- client/src/components/Settings/index.js | 3 +-- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index b70cdd37..550ad44d 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -79,7 +79,7 @@ "no_settings": "No settings", "general_settings": "General settings", "upstream_dns": "Upstream DNS servers", - "upstream_dns_hint": "If you keep this field empty, AdGuard Home will use Cloudflare DNS<\/a> as an upstream. Use tls:\/\/ prefix for DNS over TLS servers.", + "upstream_dns_hint": "If you keep this field empty, AdGuard Home will use Cloudflare DNS<\/a> as an upstream.", "test_upstream_btn": "Test upstreams", "apply_btn": "Apply", "disabled_filtering_toast": "Disabled filtering", @@ -248,6 +248,6 @@ "reset_settings": "Reset settings", "update_announcement": "AdGuard Home {{version}} is now available! <0>Click here for more info.", "upstream_parallel": "Use parallel queries to speed up resolving by simultaneously querying all upstream servers", - "bootstrap_dns": "Bootstrap DNS", - "bootstrap_dns_desc": "Bootstrap DNS for DNS-over-HTTPS and DNS-over-TLS servers" + "bootstrap_dns": "Bootstrap DNS servers", + "bootstrap_dns_desc": "Bootstrap DNS servers are used to resolve the IP address of the DOH/DOT resolvers you specify as upstreams." } diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 0bb99940..9711a0dc 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -456,8 +456,12 @@ export const setUpstream = config => async (dispatch) => { dispatch(setUpstreamRequest()); try { const values = { ...config }; - values.bootstrap_dns = (values.bootstrap_dns && normalizeTextarea(values.bootstrap_dns)) || ''; - values.upstream_dns = (values.upstream_dns && normalizeTextarea(values.upstream_dns)) || ''; + values.bootstrap_dns = ( + values.bootstrap_dns && normalizeTextarea(values.bootstrap_dns) + ) || []; + values.upstream_dns = ( + values.upstream_dns && normalizeTextarea(values.upstream_dns) + ) || []; await apiClient.setUpstream(values); dispatch(addSuccessToast('updated_upstream_dns_toast')); @@ -472,12 +476,19 @@ export const testUpstreamRequest = createAction('TEST_UPSTREAM_REQUEST'); export const testUpstreamFailure = createAction('TEST_UPSTREAM_FAILURE'); export const testUpstreamSuccess = createAction('TEST_UPSTREAM_SUCCESS'); -export const testUpstream = values => async (dispatch) => { +export const testUpstream = config => async (dispatch) => { dispatch(testUpstreamRequest()); try { - const servers = normalizeTextarea(values); - const upstreamResponse = await apiClient.testUpstream(servers); + const values = { ...config }; + values.bootstrap_dns = ( + values.bootstrap_dns && normalizeTextarea(values.bootstrap_dns) + ) || []; + values.upstream_dns = ( + values.upstream_dns && normalizeTextarea(values.upstream_dns) + ) || []; + console.log(values); + const upstreamResponse = await apiClient.testUpstream(values); const testMessages = Object.keys(upstreamResponse).map((key) => { const message = upstreamResponse[key]; if (message !== 'OK') { diff --git a/client/src/components/Settings/Upstream/Form.js b/client/src/components/Settings/Upstream/Form.js index 7a38b31a..245e7d27 100644 --- a/client/src/components/Settings/Upstream/Form.js +++ b/client/src/components/Settings/Upstream/Form.js @@ -14,6 +14,8 @@ let Form = (props) => { handleSubmit, testUpstream, upstreamDns, + bootstrapDns, + allServers, submitting, invalid, processingSetUpstream, @@ -30,7 +32,9 @@ let Form = (props) => {
- + {
- + +
+ bootstrap_dns_desc +
@@ -70,7 +79,11 @@ let Form = (props) => {