Fix typescript/svelte checks

This commit is contained in:
nemunaire 2025-10-24 17:20:35 +07:00
commit 474f25007b
17 changed files with 199 additions and 155 deletions

View file

@ -38,7 +38,12 @@
</h3>
<ul class="footer-links">
<li><a href="/#features">Features</a></li>
<li><a href="#">Download</a></li>
<li>
<a
href="https://github.com/happyDomain/happydeliver/releases"
target="_blank">Download</a
>
</li>
<li>
<a href="https://github.com/happyDomain/happydeliver/" target="_blank">
GitHub
@ -73,16 +78,32 @@
class="d-flex flex-wrap justify-content-between footer-links"
style="gap: .5em; font-size: 2em"
>
<a href="https://framagit.org/happyDomain/happydeliver" target="_blank">
<a
href="https://framagit.org/happyDomain/happydeliver"
target="_blank"
aria-label="Visit our GitLab repository"
>
<i class="bi bi-gitlab"></i>
</a>
<a href="https://github.com/happyDomain/happydeliver" target="_blank">
<a
href="https://github.com/happyDomain/happydeliver"
target="_blank"
aria-label="Visit our GitHub repository"
>
<i class="bi bi-github"></i>
</a>
<a href="https://feedback.happydomain.org/" target="_blank">
<a
href="https://feedback.happydomain.org/"
target="_blank"
aria-label="Share your feedback"
>
<i class="bi bi-lightbulb-fill"></i>
</a>
<a href="https://floss.social/@happyDomain" target="_blank">
<a
href="https://floss.social/@happyDomain"
target="_blank"
aria-label="Follow us on Mastodon"
>
<i class="bi bi-mastodon"></i>
</a>
</div>

View file

@ -10,10 +10,11 @@ export const load: Load = async ({}) => {
try {
response = await apiCreateTest();
} catch (err) {
error(err.response.status, err.message);
const errorObj = err as { response?: { status?: number }; message?: string };
error(errorObj.response?.status || 500, errorObj.message || "Unknown error");
}
if (response.response.ok) {
if (response.response.ok && response.data) {
redirect(302, `/test/${response.data.id}`);
} else {
error(response.response.status, response.error);

View file

@ -28,6 +28,8 @@
let fetching = $state(false);
async function fetchTest() {
if (!testId) return;
if (nbfetch > 0) {
nextfetch = Math.max(nextfetch, Math.floor(3 + nbfetch * 0.5));
}
@ -89,8 +91,8 @@
}
}
let lastTestId = null;
function testChange(newTestId) {
let lastTestId: string | null = null;
function testChange(newTestId: string) {
if (lastTestId != newTestId) {
lastTestId = newTestId;
test = null;
@ -100,7 +102,10 @@
}
$effect(() => {
testChange(page.params.test);
const newTestId = page.params.test;
if (newTestId) {
testChange(newTestId);
}
})
onDestroy(() => {
@ -128,9 +133,9 @@
function handleExportJSON() {
const dataStr = JSON.stringify(report, null, 2);
const dataBlob = new Blob([dataStr], { type: 'application/json' });
const dataBlob = new Blob([dataStr], { type: "application/json" });
const url = URL.createObjectURL(dataBlob);
const link = document.createElement('a');
const link = document.createElement("a");
link.href = url;
link.download = `report-${testId}.json`;
link.click();
@ -140,7 +145,7 @@
</script>
<svelte:head>
<title>{report ? `Test 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">
@ -283,11 +288,11 @@
<div class="row mb-4" id="header">
<div class="col-12">
<HeaderAnalysisCard
dmarcRecord={report.dns_results.dmarc_record}
dmarcRecord={report.dns_results?.dmarc_record}
headerAnalysis={report.header_analysis}
headerGrade={report.summary?.header_grade}
headerScore={report.summary?.header_score}
xAlignedFrom={report.authentication.x_aligned_from}
xAlignedFrom={report.authentication?.x_aligned_from}
/>
</div>
</div>
@ -348,23 +353,6 @@
}
}
.category-section {
margin-bottom: 2rem;
}
.category-title {
font-size: 1.25rem;
font-weight: 600;
color: #495057;
padding-bottom: 0.5rem;
border-bottom: 2px solid #e9ecef;
}
.category-score {
font-size: 1rem;
font-weight: 700;
}
.menu-container {
position: relative;
}