From 4175d822797be0d997df43fb81fea3614c2accf9 Mon Sep 17 00:00:00 2001 From: Artem Baskal Date: Fri, 17 Jul 2020 17:59:34 +0300 Subject: [PATCH] + client: 1889 Show a link to the FAQ article about Ubuntu when port 53 is in use Close #1889 Squashed commit of the following: commit 4fa57f692d0a66d20e9ba9d235ec423e5118db20 Author: ArtemBaskal Date: Fri Jul 17 17:28:38 2020 +0300 Revert "Update locales" This reverts commit dd88f8047e612022678dfabe8dda446c4b8f201b. commit dd88f8047e612022678dfabe8dda446c4b8f201b Author: ArtemBaskal Date: Fri Jul 17 17:26:00 2020 +0300 Update locales commit 954ae2e97e988b53856766100c873e6d40b75123 Merge: 28f205a8 c1e56c83 Author: ArtemBaskal Date: Fri Jul 17 17:23:50 2020 +0300 Merge branch 'master' into feature/1889 commit 28f205a858281811af7d708356e10108983c7292 Author: ArtemBaskal Date: Fri Jul 17 15:39:57 2020 +0300 Rename systemdns-resolved ---> systemd-resolved commit 3d62e26984f73285a7b788b6f42efcb3376ae562 Author: ArtemBaskal Date: Fri Jul 17 15:15:10 2020 +0300 Add commas to port 53 locale commit 457563085186244dca36a80a959e5a9486558299 Author: ArtemBaskal Date: Fri Jul 17 13:34:13 2020 +0300 minor commit 7aacf879951f8ab619824730cb28ea5cd2518812 Author: ArtemBaskal Date: Fri Jul 17 13:27:55 2020 +0300 + client: Show a link to the FAQ article about Ubuntu when port 53 is in use --- client/src/__locales/en.json | 3 +- client/src/helpers/constants.js | 4 + client/src/install/Setup/Settings.js | 108 ++++++++++++++++----------- 3 files changed, 71 insertions(+), 44 deletions(-) diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 419ee4c2..5160c32e 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -563,5 +563,6 @@ "filter_category_regional_desc": "Lists that focus on regional ads and tracking servers", "filter_category_other_desc": "Other blocklists", "original_response": "Original response", - "click_to_view_queries": "Click to view queries" + "click_to_view_queries": "Click to view queries", + "port_53_faq_link": "Port 53 is often occupied by \"DNSStubListener\" or \"systemd-resolved\" services. Please read <0>this instruction on how to resolve this." } diff --git a/client/src/helpers/constants.js b/client/src/helpers/constants.js index 89f3d35e..aa8d3291 100644 --- a/client/src/helpers/constants.js +++ b/client/src/helpers/constants.js @@ -35,6 +35,10 @@ export const REPOSITORY = { }; export const PRIVACY_POLICY_LINK = 'https://adguard.com/privacy/home.html'; +export const PORT_53_FAQ_LINK = 'https://github.com/AdguardTeam/AdGuardHome/wiki/FAQ#bindinuse'; + +export const ADDRESS_IN_USE_TEXT = 'address already in use'; +export const UBUNTU_SYSTEM_PORT = 53; export const INSTALL_FIRST_STEP = 1; export const INSTALL_TOTAL_STEPS = 5; diff --git a/client/src/install/Setup/Settings.js b/client/src/install/Setup/Settings.js index a939af41..443b8036 100644 --- a/client/src/install/Setup/Settings.js +++ b/client/src/install/Setup/Settings.js @@ -1,4 +1,4 @@ -import React, { Component, Fragment } from 'react'; +import React, { Component } from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { Field, reduxForm, formValueSelector } from 'redux-form'; @@ -9,7 +9,9 @@ import Controls from './Controls'; import AddressList from './AddressList'; import { getInterfaceIp } from '../../helpers/helpers'; -import { ALL_INTERFACES_IP, FORM_NAME } from '../../helpers/constants'; +import { + ALL_INTERFACES_IP, FORM_NAME, ADDRESS_IN_USE_TEXT, PORT_53_FAQ_LINK, UBUNTU_SYSTEM_PORT, +} from '../../helpers/constants'; import { renderInputField, toNumber } from '../../helpers/form'; import { validateRequiredValue, validateInstallPort } from '../../helpers/validators'; @@ -20,37 +22,38 @@ const STATIC_STATUS = { }; const renderInterfaces = ((interfaces) => ( - Object.keys(interfaces).map((item) => { - const option = interfaces[item]; - const { - name, - ip_addresses, - flags, - } = option; + Object.keys(interfaces) + .map((item) => { + const option = interfaces[item]; + const { + name, + ip_addresses, + flags, + } = option; - if (option && ip_addresses?.length > 0) { - const ip = getInterfaceIp(option); - const isDown = flags?.includes('down'); + if (option && ip_addresses?.length > 0) { + const ip = getInterfaceIp(option); + const isDown = flags?.includes('down'); + + if (isDown) { + return ( + + ); + } - if (isDown) { return ( - ); } - return ( - - ); - } - - return false; - }) + return false; + }) )); class Settings extends Component { @@ -79,9 +82,9 @@ class Settings extends Component { } return ( - + <> {status === STATIC_STATUS.DISABLED && ( - + <>
text]}> install_static_configure @@ -94,7 +97,7 @@ class Settings extends Component { > set_static_ip - + )} {status === STATIC_STATUS.ERROR && (
@@ -108,7 +111,7 @@ class Settings extends Component {
)} - + ); }; @@ -121,8 +124,16 @@ class Settings extends Component { handleFix, } = this.props; - const web = { ip: webIp, port: webPort, autofix: false }; - const dns = { ip: dnsIp, port: dnsPort, autofix: false }; + const web = { + ip: webIp, + port: webPort, + autofix: false, + }; + const dns = { + ip: dnsIp, + port: dnsPort, + autofix: false, + }; const set_static_ip = false; if (type === 'web') { @@ -143,8 +154,16 @@ class Settings extends Component { handleFix, } = this.props; - const web = { ip: webIp, port: webPort, autofix: false }; - const dns = { ip: dnsIp, port: dnsPort, autofix: false }; + const web = { + ip: webIp, + port: webPort, + autofix: false, + }; + const dns = { + ip: dnsIp, + port: dnsPort, + autofix: false, + }; const set_static_ip = true; if (window.confirm(this.props.t('confirm_static_ip', { ip }))) { @@ -228,11 +247,9 @@ class Settings extends Component { onClick={() => this.handleAutofix('web')} > fix - - } -
-
- } + } + } +
@@ -289,7 +306,7 @@ class Settings extends Component {
{dnsStatus - && + && <>
{dnsStatus} {isDnsFixAvailable @@ -314,9 +331,14 @@ class Settings extends Component { autofix_warning_result

} -
-
- } + } + {dnsPort === UBUNTU_SYSTEM_PORT && !isDnsFixAvailable + && dnsStatus.includes(ADDRESS_IN_USE_TEXT) + && link]}> + port_53_faq_link + } +