fixed xray log entries highlight with email

This commit is contained in:
fgsfds 2025-08-17 11:51:50 +05:00
parent 3d0212c21d
commit cabb89ae27
No known key found for this signature in database
GPG key ID: 264C1B9113012917
2 changed files with 9 additions and 9 deletions

View file

@ -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>`;
} }
}); });

View file

@ -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
} }
} }