Add email-path checks

This commit is contained in:
nemunaire 2025-10-23 11:42:27 +07:00
commit 5d335c6a6c
7 changed files with 517 additions and 31 deletions

View file

@ -1,15 +1,17 @@
<script lang="ts">
import type { RBLCheck } from "$lib/api/types.gen";
import type { RBLCheck, ReceivedHop } from "$lib/api/types.gen";
import { getScoreColorClass } from "$lib/score";
import GradeDisplay from "./GradeDisplay.svelte";
import EmailPathCard from "./EmailPathCard.svelte";
interface Props {
blacklists: Record<string, RBLCheck[]>;
blacklistGrade?: string;
blacklistScore?: number;
receivedChain?: ReceivedHop[];
}
let { blacklists, blacklistGrade, blacklistScore }: Props = $props();
let { blacklists, blacklistGrade, blacklistScore, receivedChain }: Props = $props();
</script>
<div class="card shadow-sm">
@ -32,6 +34,10 @@
</h4>
</div>
<div class="card-body">
{#if receivedChain}
<EmailPathCard {receivedChain} />
{/if}
<div class="row row-cols-1 row-cols-lg-2">
{#each Object.entries(blacklists) as [ip, checks]}
<div class="col mb-3">

View file

@ -0,0 +1,41 @@
<script lang="ts">
import type { ReceivedHop } from "$lib/api/types.gen";
interface Props {
receivedChain: ReceivedHop[];
}
let { receivedChain }: Props = $props();
</script>
{#if receivedChain && receivedChain.length > 0}
<div class="mb-3">
<h5>Email Path (Received Chain)</h5>
<div class="list-group">
{#each receivedChain as hop, i}
<div class="list-group-item">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1">
<span class="badge bg-primary me-2">{receivedChain.length - i}</span>
{hop.reverse || '-'} <span class="text-muted">({hop.ip})</span>{hop.by || 'Unknown'}
</h6>
<small class="text-muted" title={hop.timestamp}>{hop.timestamp ? new Intl.DateTimeFormat('default', { dateStyle: 'long', 'timeStyle': 'short' }).format(new Date(hop.timestamp)) : '-'}</small>
</div>
{#if hop.with || hop.id}
<p class="mb-1 small">
{#if hop.with}
<span class="text-muted">Protocol:</span> <code>{hop.with}</code>
{/if}
{#if hop.id}
<span class="text-muted ms-3">ID:</span> <code>{hop.id}</code>
{/if}
{#if hop.from}
<span class="text-muted ms-3">Helo:</span> <code>{hop.from}</code>
{/if}
</p>
{/if}
</div>
{/each}
</div>
</div>
{/if}

View file

@ -160,34 +160,5 @@
</div>
</div>
{/if}
{#if headerAnalysis.received_chain && headerAnalysis.received_chain.length > 0}
<div class="mt-3">
<h6>Email Path (Received Chain)</h6>
<div class="list-group">
{#each headerAnalysis.received_chain as hop, i}
<div class="list-group-item">
<div class="d-flex w-100 justify-content-between">
<h6 class="mb-1">
<span class="badge bg-primary me-2">{i + 1}</span>
{hop.from || 'Unknown'}{hop.by || 'Unknown'}
</h6>
<small class="text-muted">{hop.timestamp || '-'}</small>
</div>
{#if hop.with || hop.id}
<p class="mb-1 small">
{#if hop.with}
<span class="text-muted">Protocol:</span> <code>{hop.with}</code>
{/if}
{#if hop.id}
<span class="text-muted ms-3">ID:</span> <code>{hop.id}</code>
{/if}
</p>
{/if}
</div>
{/each}
</div>
</div>
{/if}
</div>
</div>

View file

@ -173,6 +173,7 @@
blacklists={report.blacklists}
blacklistGrade={report.summary?.blacklist_grade}
blacklistScore={report.summary?.blacklist_score}
receivedChain={report.header_analysis?.received_chain}
/>
</div>
</div>