mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-30 13:11:37 +03:00
- client: Fix client Access settings normalization
Close #1820 Squashed commit of the following: commit 5aadec2e6e126588313ff006d6f95223ba19a526 Merge: a4db6b4295f41285
Author: ArtemBaskal <a.baskal@adguard.com> Date: Wed Jul 15 11:15:31 2020 +0300 Merge branch 'master' into fix/1820 commit a4db6b42ab9cbf43d96c783a72a99e0a2c594108 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 19:08:09 2020 +0300 Remove textarea comma splitting commit bb34797aac6602b405941dbd90fe6a81b663bb92 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 18:21:18 2020 +0300 Fix client Access settings normalization commit ac4fb536514f54c5722077d78dbbd981c4e906a8 Merge: 0c758ddcb9fca8d0
Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Jul 14 18:14:38 2020 +0300 Merge branch 'master' into fix/1820 commit 0c758ddcd738136b92e6f947a8068ecc59f7ec25 Merge: 15650db3f5a1f311
Author: ArtemBaskal <a.baskal@adguard.com> Date: Fri Jul 3 11:22:00 2020 +0300 Merge branch 'master' into fix/1820 commit 15650db35323009001fd427a74a312705b54ac86 Author: ArtemBaskal <a.baskal@adguard.com> Date: Mon Jun 29 12:01:51 2020 +0300 '- client: Don't normalise disallowed domains'
This commit is contained in:
parent
95f4128551
commit
a32c1f2ee0
8 changed files with 54 additions and 32 deletions
client/src/helpers
|
@ -306,15 +306,26 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const normalizeTextarea = (text) => {
|
||||
if (!text) {
|
||||
return [];
|
||||
}
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns []string
|
||||
*/
|
||||
export const splitByNewLine = (text) => text.split('\n')
|
||||
.filter((n) => n.trim());
|
||||
|
||||
return text.replace(/[;, ]/g, '\n')
|
||||
.split('\n')
|
||||
.filter((n) => n);
|
||||
};
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
*/
|
||||
export const trimMultilineString = (text) => splitByNewLine(text)
|
||||
.map((line) => line.trim()).join('\n');
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
*/
|
||||
export const removeEmptyLines = (text) => splitByNewLine(text)
|
||||
.join('\n');
|
||||
|
||||
/**
|
||||
* Normalizes the topClients array
|
||||
|
@ -533,10 +544,6 @@ export const getMap = (arr, key, value) => arr.reduce((acc, curr) => {
|
|||
return acc;
|
||||
}, {});
|
||||
|
||||
export const normalizeMultiline = (multiline) => `${normalizeTextarea(multiline)
|
||||
.map((line) => line.trim())
|
||||
.join('\n')}\n`;
|
||||
|
||||
/**
|
||||
* @param parsedIp {object} ipaddr.js IPv4 or IPv6 object
|
||||
* @param cidr {array} ipaddr.js CIDR array
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue