diff --git a/pkg/analyzer/content.go b/pkg/analyzer/content.go index 27eea4b..613e5d5 100644 --- a/pkg/analyzer/content.go +++ b/pkg/analyzer/content.go @@ -751,9 +751,7 @@ func (c *ContentAnalyzer) CalculateContentScore(results *ContentResults) (int, s brokenLinks++ } } - if brokenLinks == 0 { - score += 20 - } + score += 20 * brokenLinks / len(results.Links) // Too much links, 10 points penalty if len(results.Links) > 30 { score -= 10 @@ -771,11 +769,7 @@ func (c *ContentAnalyzer) CalculateContentScore(results *ContentResults) (int, s noAltCount++ } } - if noAltCount == 0 { - score += 15 - } else if noAltCount < len(results.Images) { - score += 7 - } + score += 15 * noAltCount / len(results.Images) } else { // No images is Ok score += 15 @@ -795,20 +789,12 @@ func (c *ContentAnalyzer) CalculateContentScore(results *ContentResults) (int, s // Penalize suspicious URLs (deduct up to 5 points) if len(results.SuspiciousURLs) > 0 { - penalty := len(results.SuspiciousURLs) - if penalty > 5.0 { - penalty = 5 - } - score -= penalty + score -= min(len(results.SuspiciousURLs), 5) } // Penalize harmful HTML tags (deduct 20 points per harmful tag, max 40 points) if len(results.HarmfullIssues) > 0 { - penalty := len(results.HarmfullIssues) * 20 - if penalty > 40 { - penalty = 40 - } - score -= penalty + score -= min(len(results.HarmfullIssues)*20, 40) } // Ensure score is between 0 and 100 diff --git a/web/src/lib/components/AuthenticationCard.svelte b/web/src/lib/components/AuthenticationCard.svelte index c43be7d..c14d4ec 100644 --- a/web/src/lib/components/AuthenticationCard.svelte +++ b/web/src/lib/components/AuthenticationCard.svelte @@ -12,7 +12,7 @@ let { authentication, authenticationGrade, authenticationScore, dnsResults }: Props = $props(); - function getAuthResultClass(result: string): string { + function getAuthResultClass(result: string, noneIsFail: boolean): string { switch (result) { case "pass": return "text-success"; @@ -22,12 +22,14 @@ case "softfail": case "neutral": return "text-warning"; + case "none": + return noneIsFail ? "text-danger" : "text-muted"; default: return "text-muted"; } } - function getAuthResultIcon(result: string): string { + function getAuthResultIcon(result: string, noneIsFail: boolean): string { switch (result) { case "pass": return "bi-check-circle-fill"; @@ -38,6 +40,8 @@ return "bi-exclamation-circle-fill"; case "missing": return "bi-dash-circle-fill"; + case "none": + return noneIsFail ? "bi-x-circle-fill" : "bi-question-circle"; default: return "bi-question-circle"; } @@ -77,10 +81,10 @@ {#if authentication.iprev}
{authentication.dmarc.details}
diff --git a/web/src/lib/components/ContentAnalysisCard.svelte b/web/src/lib/components/ContentAnalysisCard.svelte
index bc65de0..b5fc380 100644
--- a/web/src/lib/components/ContentAnalysisCard.svelte
+++ b/web/src/lib/components/ContentAnalysisCard.svelte
@@ -71,7 +71,7 @@
{#if contentAnalysis.html_issues && contentAnalysis.html_issues.length > 0}