404 hosts add update complete, fix certbot renewals

and remove the need for email and agreement on cert requests
This commit is contained in:
Jamie Curnow
2025-09-23 18:02:00 +10:00
parent d85e515ab9
commit 18537b9288
32 changed files with 449 additions and 446 deletions

View File

@@ -2,7 +2,7 @@ import { IconShield } from "@tabler/icons-react";
import { Field, useFormikContext } from "formik";
import Select, { type ActionMeta, components, type OptionProps } from "react-select";
import type { Certificate } from "src/api/backend";
import { useCertificates, useUser } from "src/hooks";
import { useCertificates } from "src/hooks";
import { DateTimeFormat, intl } from "src/locale";
interface CertOption {
@@ -39,26 +39,33 @@ export function SSLCertificateField({
required,
allowNew,
}: Props) {
const { data: currentUser } = useUser("me");
const { isLoading, isError, error, data } = useCertificates();
const { values, setFieldValue } = useFormikContext();
const v: any = values || {};
const handleChange = (newValue: any, _actionMeta: ActionMeta<CertOption>) => {
setFieldValue(name, newValue?.value);
const { sslForced, http2Support, hstsEnabled, hstsSubdomains, dnsChallenge, letsencryptEmail } = v;
const {
sslForced,
http2Support,
hstsEnabled,
hstsSubdomains,
dnsChallenge,
dnsProvider,
dnsProviderCredentials,
propagationSeconds,
} = v;
if (!newValue?.value) {
sslForced && setFieldValue("sslForced", false);
http2Support && setFieldValue("http2Support", false);
hstsEnabled && setFieldValue("hstsEnabled", false);
hstsSubdomains && setFieldValue("hstsSubdomains", false);
}
if (newValue?.value === "new") {
if (!letsencryptEmail) {
setFieldValue("letsencryptEmail", currentUser?.email);
}
} else {
dnsChallenge && setFieldValue("dnsChallenge", false);
if (newValue?.value !== "new") {
dnsChallenge && setFieldValue("dnsChallenge", undefined);
dnsProvider && setFieldValue("dnsProvider", undefined);
dnsProviderCredentials && setFieldValue("dnsProviderCredentials", undefined);
propagationSeconds && setFieldValue("propagationSeconds", undefined);
}
};
@@ -105,7 +112,7 @@ export function SSLCertificateField({
<Select
className="react-select-container"
classNamePrefix="react-select"
defaultValue={options[0]}
defaultValue={options.find((o) => o.value === field.value) || options[0]}
options={options}
components={{ Option }}
styles={{