mirror of
https://github.com/xiaoxinpro/nginx-proxy-manager-zh.git
synced 2025-02-02 09:48:13 -05:00
Cert creation fixes
This commit is contained in:
parent
cc9d556665
commit
6df4ea4d69
@ -14,12 +14,14 @@ interface SelectOption extends OptionBase {
|
||||
}
|
||||
interface DomainNamesFieldProps {
|
||||
maxDomains?: number;
|
||||
isWildcardSupported?: boolean;
|
||||
isWildcardPermitted?: boolean;
|
||||
dnsProviderWildcardSupported?: boolean;
|
||||
onChange?: (i: string[]) => any;
|
||||
}
|
||||
function DomainNamesField({
|
||||
maxDomains,
|
||||
isWildcardSupported,
|
||||
isWildcardPermitted,
|
||||
dnsProviderWildcardSupported,
|
||||
onChange,
|
||||
}: DomainNamesFieldProps) {
|
||||
const { values, setFieldValue } = useFormikContext();
|
||||
@ -45,7 +47,10 @@ function DomainNamesField({
|
||||
}
|
||||
|
||||
// Prevent wildcards
|
||||
if (!isWildcardSupported && dom.indexOf("*") !== -1) {
|
||||
if (
|
||||
(!isWildcardPermitted || !dnsProviderWildcardSupported) &&
|
||||
dom.indexOf("*") !== -1
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -71,6 +76,18 @@ function DomainNamesField({
|
||||
setFieldValue("domainNames", doms);
|
||||
};
|
||||
|
||||
let helperTexts: string[] = [];
|
||||
if (maxDomains) {
|
||||
helperTexts.push(
|
||||
intl.formatMessage({ id: "domain_names.max" }, { count: maxDomains }),
|
||||
);
|
||||
}
|
||||
if (!isWildcardPermitted) {
|
||||
helperTexts.push(intl.formatMessage({ id: "wildcards-not-permitted" }));
|
||||
} else if (!dnsProviderWildcardSupported) {
|
||||
helperTexts.push(intl.formatMessage({ id: "wildcards-not-supported" }));
|
||||
}
|
||||
|
||||
return (
|
||||
<Field name="domainNames">
|
||||
{({ field, form }: any) => (
|
||||
@ -91,14 +108,11 @@ function DomainNamesField({
|
||||
isMulti
|
||||
placeholder="example.com"
|
||||
/>
|
||||
{maxDomains ? (
|
||||
<FormHelperText>
|
||||
{intl.formatMessage(
|
||||
{ id: "domain_names.max" },
|
||||
{ count: maxDomains },
|
||||
)}
|
||||
</FormHelperText>
|
||||
) : null}
|
||||
{helperTexts.length
|
||||
? helperTexts.map((i) => {
|
||||
return <FormHelperText>{i}</FormHelperText>;
|
||||
})
|
||||
: null}
|
||||
<FormErrorMessage>{form.errors.domainNames}</FormErrorMessage>
|
||||
</FormControl>
|
||||
)}
|
||||
|
@ -23,7 +23,8 @@ function DNSForm() {
|
||||
<CertificateAuthorityField onChange={handleCAChange} />
|
||||
<DomainNamesField
|
||||
maxDomains={maxDomains}
|
||||
isWildcardSupported={isWildcardSupported}
|
||||
dnsProviderWildcardSupported={isWildcardSupported}
|
||||
isWildcardPermitted /* true for DNS certs */
|
||||
/>
|
||||
<DNSProviderField />
|
||||
<EccField />
|
||||
|
@ -22,7 +22,9 @@ function HTTPForm() {
|
||||
<CertificateAuthorityField onChange={handleCAChange} />
|
||||
<DomainNamesField
|
||||
maxDomains={maxDomains}
|
||||
isWildcardSupported={isWildcardSupported}
|
||||
dnsProviderWildcardSupported={
|
||||
isWildcardSupported
|
||||
} /* technically not applicable for HTTP certs */
|
||||
/>
|
||||
<EccField />
|
||||
</>
|
||||
|
Loading…
Reference in New Issue
Block a user