mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-08-23 11:26:52 +00:00
fixed xray log entries highlight with email
This commit is contained in:
parent
3d0212c21d
commit
cabb89ae27
2 changed files with 9 additions and 9 deletions
|
@ -676,16 +676,16 @@
|
||||||
|
|
||||||
const parts = log.split(' ');
|
const parts = log.split(' ');
|
||||||
|
|
||||||
if(parts.length === 10) {
|
if(parts.length >= 10) {
|
||||||
const dateTime = `<b>${parts[0]} ${parts[1]}</b>`;
|
const dateTime = `<b>${parts[0]} ${parts[1]}</b>`;
|
||||||
const from = `<b>${parts[3]}</b>`;
|
const from = `<b>${parts[3]}</b>`;
|
||||||
const to = `<b>${parts[5].replace(/^\/+/, "")}</b>`;
|
const to = `<b>${parts[5].replace(/^\/+/, "")}</b>`;
|
||||||
|
|
||||||
let outboundColor = '';
|
let outboundColor = '';
|
||||||
if (parts[9] === "b") {
|
if (parts[parts.length - 1] === "b") {
|
||||||
outboundColor = ' style="color: #e04141;"'; //red for blocked
|
outboundColor = ' style="color: #e04141;"'; //red for blocked
|
||||||
}
|
}
|
||||||
else if (parts[9] === "p") {
|
else if (parts[parts.length - 1] === "p") {
|
||||||
outboundColor = ' style="color: #3c89e8;"'; //blue for proxies
|
outboundColor = ' style="color: #3c89e8;"'; //blue for proxies
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,10 +695,10 @@ ${dateTime}
|
||||||
${from}
|
${from}
|
||||||
${parts[4]}
|
${parts[4]}
|
||||||
${to}
|
${to}
|
||||||
${parts.slice(6, 9).join(' ')}
|
${parts.slice(6, parts.length - 2).join(' ')}
|
||||||
</span>`;
|
</span>`;
|
||||||
} else {
|
} else {
|
||||||
formattedLogs += `<span>${log}</span>`;
|
formattedLogs += `<span>${parts.slice(0, parts.length - 2).join(' ')}</span>`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -520,12 +520,12 @@ func (s *ServerService) GetXrayLogs(
|
||||||
}
|
}
|
||||||
|
|
||||||
//adding suffixes to further distinguish entries by outbound
|
//adding suffixes to further distinguish entries by outbound
|
||||||
if hasSuffix(line, freedoms) {
|
if stringContains(line, freedoms) {
|
||||||
if showDirect == "false" {
|
if showDirect == "false" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
line = line + " f"
|
line = line + " f"
|
||||||
} else if hasSuffix(line, blackholes) {
|
} else if stringContains(line, blackholes) {
|
||||||
if showBlocked == "false" {
|
if showBlocked == "false" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -547,9 +547,9 @@ func (s *ServerService) GetXrayLogs(
|
||||||
return lines
|
return lines
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasSuffix(line string, suffixes []string) bool {
|
func stringContains(line string, suffixes []string) bool {
|
||||||
for _, sfx := range suffixes {
|
for _, sfx := range suffixes {
|
||||||
if strings.HasSuffix(line, sfx+"]") {
|
if strings.Contains(line, sfx+"]") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue