diff options
| author | 2024-07-08 09:38:27 +0200 | |
|---|---|---|
| committer | 2024-07-08 09:38:27 +0200 | |
| commit | bbbf6ebe376c7b6c3a64e14571a3a477b880e3ad (patch) | |
| tree | d24aa92f743de5c440ce786d61cc86f72bf9a3e7 /web/source/settings/views/admin/actions | |
| parent | [chore]: Bump github.com/microcosm-cc/bluemonday from 1.0.26 to 1.0.27 (#3081) (diff) | |
| download | gotosocial-bbbf6ebe376c7b6c3a64e14571a3a477b880e3ad.tar.xz | |
[frontend] Better autocapitalize/spellcheck settings on forms (#3077)
Diffstat (limited to 'web/source/settings/views/admin/actions')
| -rw-r--r-- | web/source/settings/views/admin/actions/keys/expireremote.tsx | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/web/source/settings/views/admin/actions/keys/expireremote.tsx b/web/source/settings/views/admin/actions/keys/expireremote.tsx index d695ec0c8..1d62f9439 100644 --- a/web/source/settings/views/admin/actions/keys/expireremote.tsx +++ b/web/source/settings/views/admin/actions/keys/expireremote.tsx @@ -22,9 +22,33 @@ import { TextInput } from "../../../../components/form/inputs"; import MutationButton from "../../../../components/form/mutation-button"; import { useTextInput } from "../../../../lib/form"; import { useInstanceKeysExpireMutation } from "../../../../lib/query/admin/actions"; +import isValidDomain from "is-valid-domain"; export default function ExpireRemote({}) { - const domainField = useTextInput("domain"); + const domainField = useTextInput("domain", { + validator: (v: string) => { + if (v.length === 0) { + return ""; + } + + if (v[v.length-1] === ".") { + return "invalid domain"; + } + + const valid = isValidDomain(v, { + subdomain: true, + wildcard: false, + allowUnicode: true, + topLevel: false, + }); + + if (valid) { + return ""; + } + + return "invalid domain"; + } + }); const [expire, expireResult] = useInstanceKeysExpireMutation(); @@ -52,11 +76,13 @@ export default function ExpireRemote({}) { <TextInput field={domainField} label="Domain" - type="string" + type="text" + autoCapitalize="none" + spellCheck="false" placeholder="example.org" /> <MutationButton - disabled={!domainField.value} + disabled={!domainField.value || !domainField.valid} label="Expire keys" result={expireResult} /> |
