web: Format code files

This commit is contained in:
nemunaire 2026-01-24 19:18:26 +08:00
commit ac9b567025
22 changed files with 964 additions and 459 deletions

View file

@ -1,9 +1,9 @@
<script lang="ts">
import { page } from "$app/stores";
import { page } from "$app/state";
import { ErrorDisplay } from "$lib/components";
let status = $derived($page.status);
let message = $derived($page.error?.message || "An unexpected error occurred");
let status = $derived(page.status);
let message = $derived(page.error?.message || "An unexpected error occurred");
function getErrorTitle(status: number): string {
switch (status) {

View file

@ -1,9 +1,9 @@
<script lang="ts">
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap-icons/font/bootstrap-icons.css";
import "bootstrap/dist/css/bootstrap.min.css";
import "../app.css";
import favicon from '$lib/assets/favicon.svg';
import favicon from "$lib/assets/favicon.svg";
import Logo from "$lib/components/Logo.svelte";
import { theme } from "$lib/stores/theme";
@ -25,7 +25,7 @@
</script>
<svelte:head>
<link rel="icon" href={favicon} />
<link rel="icon" href={favicon} />
</svelte:head>
<div class="min-vh-100 d-flex flex-column">

View file

@ -1,8 +1,9 @@
<script lang="ts">
import { goto } from "$app/navigation";
import { createTest as apiCreateTest } from "$lib/api";
import { appConfig } from "$lib/stores/config";
import { FeatureCard, HowItWorksStep } from "$lib/components";
import { appConfig } from "$lib/stores/config";
let loading = $state(false);
let error = $state<string | null>(null);

View file

@ -15,8 +15,10 @@
}
// Basic IPv4/IPv6 validation
const ipv4Pattern = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
const ipv6Pattern = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}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-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
if (!ipv4Pattern.test(ip.trim()) && !ipv6Pattern.test(ip.trim())) {
error = "Please enter a valid IPv4 or IPv6 address (e.g., 192.0.2.1)";
@ -48,7 +50,8 @@
Check IP Blacklist Status
</h1>
<p class="lead text-muted">
Test an IP address against multiple DNS-based blacklists (RBLs) to check its reputation.
Test an IP address against multiple DNS-based blacklists (RBLs) to check its
reputation.
</p>
</div>
@ -103,7 +106,9 @@
</h3>
<ul class="list-unstyled mb-0 small">
{#each $appConfig.rbls as rbl}
<li class="mb-2"><i class="bi bi-arrow-right me-2"></i>{rbl}</li>
<li class="mb-2">
<i class="bi bi-arrow-right me-2"></i>{rbl}
</li>
{/each}
</ul>
</div>
@ -118,7 +123,9 @@
Why Check Blacklists?
</h3>
<p class="small mb-2">
DNS-based blacklists (RBLs) are used by email servers to identify and block spam sources. Being listed can severely impact email deliverability.
DNS-based blacklists (RBLs) are used by email servers to identify
and block spam sources. Being listed can severely impact email
deliverability.
</p>
<p class="small mb-3">
This tool checks your IP against multiple popular RBLs to help you:
@ -128,7 +135,8 @@
<i class="bi bi-arrow-right me-2"></i>Monitor IP reputation
</li>
<li class="mb-1">
<i class="bi bi-arrow-right me-2"></i>Identify deliverability issues
<i class="bi bi-arrow-right me-2"></i>Identify deliverability
issues
</li>
<li class="mb-1">
<i class="bi bi-arrow-right me-2"></i>Take corrective action
@ -146,7 +154,8 @@
Need Complete Email Analysis?
</h3>
<p class="small mb-2">
For comprehensive deliverability testing including DKIM verification, content analysis, spam scoring, and more:
For comprehensive deliverability testing including DKIM verification, content
analysis, spam scoring, and more:
</p>
<a href="/" class="btn btn-sm btn-outline-primary">
<i class="bi bi-envelope-plus me-1"></i>
@ -159,7 +168,9 @@
<style>
.card {
transition: transform 0.2s ease, box-shadow 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease;
}
.card:hover {

View file

@ -80,7 +80,8 @@
<!-- Error State -->
<div class="card shadow-sm">
<div class="card-body text-center py-5">
<i class="bi bi-exclamation-triangle text-danger" style="font-size: 4rem;"></i>
<i class="bi bi-exclamation-triangle text-danger" style="font-size: 4rem;"
></i>
<h3 class="h4 mt-4">Check Failed</h3>
<p class="text-muted mb-4">{error}</p>
<button class="btn btn-primary" onclick={analyzeIP}>
@ -98,22 +99,33 @@
<div class="row align-items-center">
<div class="col-md-6 text-center text-md-start mb-3 mb-md-0">
<h2 class="h2 mb-2">
<span class="font-monospace text-truncate">{result.ip}</span>
<span class="font-monospace text-truncate">{result.ip}</span
>
</h2>
{#if result.listed_count === 0}
<div class="alert alert-success mb-0 d-inline-block">
<i class="bi bi-check-circle me-2"></i>
<strong>Not Listed</strong>
<p class="d-inline mb-0 mt-1 small">
This IP address is not listed on any checked blacklists.
This IP address is not listed on any checked
blacklists.
</p>
</div>
{:else}
<div class="alert alert-danger mb-0 d-inline-block">
<i class="bi bi-exclamation-triangle me-2"></i>
<strong>Listed on {result.listed_count} blacklist{result.listed_count > 1 ? "s" : ""}</strong>
<strong
>Listed on {result.listed_count} blacklist{result.listed_count >
1
? "s"
: ""}</strong
>
<p class="mb-0 mt-1 small">
This IP address is listed on {result.listed_count} of {result.checks.length} checked blacklist{result.checks.length > 1 ? "s" : ""}.
This IP address is listed on {result.listed_count} of
{result.checks.length} checked blacklist{result
.checks.length > 1
? "s"
: ""}.
</p>
</div>
{/if}
@ -121,8 +133,8 @@
<div class="offset-md-3 col-md-3 text-center">
<div
class="p-2 rounded text-center summary-card"
class:bg-light={$theme === 'light'}
class:bg-secondary={$theme !== 'light'}
class:bg-light={$theme === "light"}
class:bg-secondary={$theme !== "light"}
>
<GradeDisplay score={result.score} grade={result.grade} />
<small class="text-muted d-block">Blacklist Score</small>
@ -154,23 +166,36 @@
</h3>
{#if result.listed_count === 0}
<p class="mb-3">
<strong>Good news!</strong> This IP address is not currently listed on any of the
checked DNS-based blacklists (RBLs). This indicates a good sender reputation
and should not negatively impact email deliverability.
<strong>Good news!</strong> This IP address is not currently listed
on any of the checked DNS-based blacklists (RBLs). This indicates
a good sender reputation and should not negatively impact email deliverability.
</p>
{:else}
<p class="mb-3">
<strong>Warning:</strong> This IP address is listed on {result.listed_count} blacklist{result.listed_count > 1 ? "s" : ""}.
Being listed can significantly impact email deliverability as many mail servers
<strong>Warning:</strong> This IP address is listed on {result.listed_count}
blacklist{result.listed_count > 1 ? "s" : ""}. Being listed can
significantly impact email deliverability as many mail servers
use these blacklists to filter incoming mail.
</p>
<div class="alert alert-warning">
<h4 class="h6 mb-2">Recommended Actions:</h4>
<ul class="mb-0 small">
<li>Investigate the cause of the listing (compromised system, spam complaints, etc.)</li>
<li>Fix any security issues or stop sending practices that led to the listing</li>
<li>Request delisting from each RBL (check their websites for removal procedures)</li>
<li>Monitor your IP reputation regularly to prevent future listings</li>
<li>
Investigate the cause of the listing (compromised
system, spam complaints, etc.)
</li>
<li>
Fix any security issues or stop sending practices that
led to the listing
</li>
<li>
Request delisting from each RBL (check their websites
for removal procedures)
</li>
<li>
Monitor your IP reputation regularly to prevent future
listings
</li>
</ul>
</div>
{/if}
@ -186,8 +211,8 @@
</h3>
<p class="mb-3">
This blacklist check tests IP reputation only. For comprehensive
deliverability testing including DKIM verification, content analysis,
spam scoring, and DNS configuration:
deliverability testing including DKIM verification, content
analysis, spam scoring, and DNS configuration:
</p>
<a href="/" class="btn btn-primary">
<i class="bi bi-envelope-plus me-2"></i>

View file

@ -13,7 +13,8 @@
}
// Basic domain validation
const domainPattern = /^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?(\.[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?)*$/;
const domainPattern =
/^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?(\.[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]?)*$/;
if (!domainPattern.test(domain.trim())) {
error = "Please enter a valid domain name (e.g., example.com)";
return;
@ -99,10 +100,18 @@
What's Checked
</h3>
<ul class="list-unstyled mb-0 small">
<li class="mb-2"><i class="bi bi-arrow-right me-2"></i>MX Records</li>
<li class="mb-2"><i class="bi bi-arrow-right me-2"></i>SPF Records</li>
<li class="mb-2"><i class="bi bi-arrow-right me-2"></i>DMARC Policy</li>
<li class="mb-2"><i class="bi bi-arrow-right me-2"></i>BIMI Support</li>
<li class="mb-2">
<i class="bi bi-arrow-right me-2"></i>MX Records
</li>
<li class="mb-2">
<i class="bi bi-arrow-right me-2"></i>SPF Records
</li>
<li class="mb-2">
<i class="bi bi-arrow-right me-2"></i>DMARC Policy
</li>
<li class="mb-2">
<i class="bi bi-arrow-right me-2"></i>BIMI Support
</li>
<li class="mb-0">
<i class="bi bi-arrow-right me-2"></i>Disposable Domain Check
</li>
@ -149,7 +158,9 @@
<style>
.card {
transition: transform 0.2s ease, box-shadow 0.2s ease;
transition:
transform 0.2s ease,
box-shadow 0.2s ease;
}
.card:hover {

View file

@ -1,12 +1,13 @@
<script lang="ts">
import { page } from "$app/stores";
import { page } from "$app/state";
import { onMount } from "svelte";
import { testDomain } from "$lib/api";
import type { DomainTestResponse } from "$lib/api/types.gen";
import { DnsRecordsCard, GradeDisplay, TinySurvey } from "$lib/components";
import { theme } from "$lib/stores/theme";
let domain = $derived($page.params.domain);
let domain = $derived(page.params.domain);
let loading = $state(true);
let error = $state<string | null>(null);
let result = $state<DomainTestResponse | null>(null);
@ -80,7 +81,8 @@
<!-- Error State -->
<div class="card shadow-sm">
<div class="card-body text-center py-5">
<i class="bi bi-exclamation-triangle text-danger" style="font-size: 4rem;"></i>
<i class="bi bi-exclamation-triangle text-danger" style="font-size: 4rem;"
></i>
<h3 class="h4 mt-4">Analysis Failed</h3>
<p class="text-muted mb-4">{error}</p>
<button class="btn btn-primary" onclick={analyzeDomain}>
@ -105,8 +107,9 @@
<i class="bi bi-exclamation-triangle me-2"></i>
<strong>Disposable Email Provider Detected</strong>
<p class="mb-0 mt-1 small">
This domain is a known temporary/disposable email service.
Emails from this domain may have lower deliverability.
This domain is a known temporary/disposable email
service. Emails from this domain may have lower
deliverability.
</p>
</div>
{:else}
@ -116,8 +119,8 @@
<div class="offset-md-3 col-md-3 text-center">
<div
class="p-2 rounded text-center summary-card"
class:bg-light={$theme === 'light'}
class:bg-secondary={$theme !== 'light'}
class:bg-light={$theme === "light"}
class:bg-secondary={$theme !== "light"}
>
<GradeDisplay score={result.score} grade={result.grade} />
<small class="text-muted d-block">DNS</small>
@ -150,8 +153,8 @@
</h3>
<p class="mb-3">
This domain-only test checks DNS configuration. For comprehensive
deliverability testing including DKIM verification, content analysis,
spam scoring, and blacklist checks:
deliverability testing including DKIM verification, content
analysis, spam scoring, and blacklist checks:
</p>
<a href="/" class="btn btn-primary">
<i class="bi bi-envelope-plus me-2"></i>

View file

@ -1,20 +1,21 @@
<script lang="ts">
import { onDestroy } from "svelte";
import { page } from "$app/state";
import { getTest, getReport, reanalyzeReport } from "$lib/api";
import type { Test, Report } from "$lib/api/types.gen";
import { onDestroy } from "svelte";
import { getReport, getTest, reanalyzeReport } from "$lib/api";
import type { Report, Test } from "$lib/api/types.gen";
import {
ScoreCard,
SummaryCard,
SpamAssassinCard,
PendingState,
AuthenticationCard,
DnsRecordsCard,
BlacklistCard,
ContentAnalysisCard,
HeaderAnalysisCard,
TinySurvey,
DnsRecordsCard,
ErrorDisplay,
HeaderAnalysisCard,
PendingState,
ScoreCard,
SpamAssassinCard,
SummaryCard,
TinySurvey,
} from "$lib/components";
let testId = $derived(page.params.test);
@ -188,7 +189,13 @@
</script>
<svelte:head>
<title>{report ? `Test${report.dns_results ? ` of ${report.dns_results.from_domain}` : ''} ${report.test_id?.slice(0, 7) || ''}` : (test ? `Test ${test.id.slice(0, 7)}` : "Loading...")} - happyDeliver</title>
<title>
{report
? `Test${report.dns_results ? ` of ${report.dns_results.from_domain}` : ""} ${report.test_id?.slice(0, 7) || ""}`
: test
? `Test ${test.id.slice(0, 7)}`
: "Loading..."} - happyDeliver
</title>
</svelte:head>
<div class="container py-5">