mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-04-30 13:11:37 +03:00
+ client: add whois info to dashboard and logs
This commit is contained in:
parent
9e4f80f3c1
commit
a52715e086
6 changed files with 86 additions and 46 deletions
client/src/helpers
|
@ -245,9 +245,33 @@ export const redirectToCurrentProtocol = (values, httpPort = 80) => {
|
|||
|
||||
export const normalizeTextarea = text => text && text.replace(/[;, ]/g, '\n').split('\n').filter(n => n);
|
||||
|
||||
export const getClientName = (clients, ip) => {
|
||||
const formatWhois = (whois) => {
|
||||
if (!whois) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const keys = Object.keys(whois);
|
||||
if (keys.length > 0) {
|
||||
return (
|
||||
keys.map(key => whois[key])
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
export const getClientInfo = (clients, ip) => {
|
||||
const client = clients.find(item => ip === item.ip);
|
||||
return (client && client.name) || '';
|
||||
|
||||
if (!client) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const { name, whois_info } = client;
|
||||
const formattedWhois = formatWhois(whois_info);
|
||||
const whois = formattedWhois && formattedWhois.length > 0 && formattedWhois.join(' | ');
|
||||
|
||||
return { name, whois };
|
||||
};
|
||||
|
||||
export const sortClients = (clients) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue