This commit is contained in:
fgsfds 2025-08-21 18:18:46 +03:30 committed by GitHub
commit a1ff7eceda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View file

@ -676,16 +676,16 @@
const parts = log.split(' ');
if(parts.length === 10) {
if(parts.length >= 10) {
const dateTime = `<b>${parts[0]} ${parts[1]}</b>`;
const from = `<b>${parts[3]}</b>`;
const to = `<b>${parts[5].replace(/^\/+/, "")}</b>`;
let outboundColor = '';
if (parts[9] === "b") {
if (parts[parts.length - 1] === "b") {
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
}
@ -695,10 +695,10 @@ ${dateTime}
${from}
${parts[4]}
${to}
${parts.slice(6, 9).join(' ')}
${parts.slice(6, parts.length - 2).join(' ')}
</span>`;
} else {
formattedLogs += `<span>${log}</span>`;
formattedLogs += `<span>${parts.slice(0, parts.length - 2).join(' ')}</span>`;
}
});

View file

@ -533,12 +533,12 @@ func (s *ServerService) GetXrayLogs(
}
//adding suffixes to further distinguish entries by outbound
if hasSuffix(line, freedoms) {
if stringContains(line, freedoms) {
if showDirect == "false" {
continue
}
line = line + " f"
} else if hasSuffix(line, blackholes) {
} else if stringContains(line, blackholes) {
if showBlocked == "false" {
continue
}
@ -560,9 +560,9 @@ func (s *ServerService) GetXrayLogs(
return lines
}
func hasSuffix(line string, suffixes []string) bool {
func stringContains(line string, suffixes []string) bool {
for _, sfx := range suffixes {
if strings.HasSuffix(line, sfx+"]") {
if strings.Contains(line, sfx+"]") {
return true
}
}