Pull request: 4642 update dns addresses on encryption update

Updates #4642

Squashed commit of the following:

commit 75729120d3532dc2bd12b6c9e724a691043a1870
Merge: 5b681867 1c1ca1c6
Author: Ildar Kamalov <ik@adguard.com>
Date:   Thu Jun 9 11:58:13 2022 +0300

    Merge branch 'master' into 4642-dns-privacy

commit 5b68186705c3a9287a44e33c8cf7ab79060f35a4
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Jun 7 18:39:02 2022 +0300

    fix

commit 46a9346154d33206e829a97021f3ef47ac2a5611
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Jun 7 18:18:18 2022 +0300

    client: update dns addresses on encryption update
This commit is contained in:
Ildar Kamalov 2022-06-09 12:07:29 +03:00
parent 1c1ca1c6e3
commit 302faca32f
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@ export const getTlsStatus = () => async (dispatch) => {
export const setTlsConfigRequest = createAction('SET_TLS_CONFIG_REQUEST'); export const setTlsConfigRequest = createAction('SET_TLS_CONFIG_REQUEST');
export const setTlsConfigFailure = createAction('SET_TLS_CONFIG_FAILURE'); export const setTlsConfigFailure = createAction('SET_TLS_CONFIG_FAILURE');
export const setTlsConfigSuccess = createAction('SET_TLS_CONFIG_SUCCESS'); export const setTlsConfigSuccess = createAction('SET_TLS_CONFIG_SUCCESS');
export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS');
export const setTlsConfig = (config) => async (dispatch, getState) => { export const setTlsConfig = (config) => async (dispatch, getState) => {
dispatch(setTlsConfigRequest()); dispatch(setTlsConfigRequest());
@ -39,6 +40,12 @@ export const setTlsConfig = (config) => async (dispatch, getState) => {
const response = await apiClient.setTlsConfig(values); const response = await apiClient.setTlsConfig(values);
response.certificate_chain = atob(response.certificate_chain); response.certificate_chain = atob(response.certificate_chain);
response.private_key = atob(response.private_key); response.private_key = atob(response.private_key);
const dnsStatus = await apiClient.getGlobalStatus();
if (dnsStatus) {
dispatch(dnsStatusSuccess(dnsStatus));
}
dispatch(setTlsConfigSuccess(response)); dispatch(setTlsConfigSuccess(response));
dispatch(addSuccessToast('encryption_config_saved')); dispatch(addSuccessToast('encryption_config_saved'));
redirectToCurrentProtocol(response, httpPort); redirectToCurrentProtocol(response, httpPort);