Update TypeScript version and enhance ContactForm and email handling

- Upgraded TypeScript dependency from 5.7.3 to 5.8.3 for improved type checking and features.
- Modified ContactForm component to include a hidden input for the domain, capturing the current hostname.
- Updated API contact handling to log and utilize the domain information in email notifications.
- Refactored email sending functions to conditionally include the domain in the sender's address for better context.
This commit is contained in:
2025-06-26 23:40:44 +02:00
parent 559bd3e983
commit 246edb3952
5 changed files with 31 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
<form id="contact-form">
<input type="hidden" name="csrf_token" id="csrf_token" />
<input type="hidden" name="domain" id="domain" />
<label for="email">Email</label>
<input type="email" name="email" id="email" required aria-describedby="email-help" />
<div id="email-help" class="sr-only">Enter your email address</div>
@@ -43,7 +44,17 @@ async function fetchCsrfToken() {
}
}
document.addEventListener('DOMContentLoaded', fetchCsrfToken);
function setDomainHiddenField() {
const domainInput = document.getElementById('domain');
if (domainInput) {
(domainInput as HTMLInputElement).value = window.location.hostname;
}
}
document.addEventListener('DOMContentLoaded', () => {
fetchCsrfToken();
setDomainHiddenField();
});
const contactForm = document.getElementById('contact-form');
const feedbackDiv = document.getElementById('form-feedback');