Compare commits
3 Commits
beta-v0.10
...
ADG-9783
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe5ed799da | ||
|
|
5a33876ac4 | ||
|
|
bcffb41864 |
@@ -18,6 +18,10 @@ See also the [v0.107.58 GitHub milestone][ms-v0.107.58].
|
||||
NOTE: Add new changes BELOW THIS COMMENT.
|
||||
-->
|
||||
|
||||
### Added
|
||||
|
||||
- Client id and DNS record type to the filtering check form.
|
||||
|
||||
### Security
|
||||
|
||||
- Go version has been updated to prevent the possibility of exploiting the Go vulnerabilities fixed in [1.24.1][go-1.24.1].
|
||||
|
||||
@@ -620,6 +620,10 @@
|
||||
"check_cname": "CNAME: {{cname}}",
|
||||
"check_reason": "Reason: {{reason}}",
|
||||
"check_service": "Service name: {{service}}",
|
||||
"check_hostname": "Hostname or domain name",
|
||||
"check_client_id": "Client identifier (ClientID or IP address)",
|
||||
"check_enter_client_id": "Enter client identifier",
|
||||
"check_dns_record": "Select DNS record type",
|
||||
"service_name": "Service name",
|
||||
"check_not_found": "Not found in your filter lists",
|
||||
"client_confirm_block": "Are you sure you want to block the client \"{{ip}}\"?",
|
||||
|
||||
@@ -9,13 +9,17 @@ import Info from './Info';
|
||||
import { RootState } from '../../../initialState';
|
||||
import { validateRequiredValue } from '../../../helpers/validators';
|
||||
import { Input } from '../../ui/Controls/Input';
|
||||
import { DNS_RECORD_TYPES } from '../../../helpers/constants';
|
||||
import { Select } from '../../ui/Controls/Select';
|
||||
|
||||
interface FormValues {
|
||||
export type FilteringCheckFormValues = {
|
||||
name: string;
|
||||
client_id?: string;
|
||||
dns_record_type?: string;
|
||||
}
|
||||
|
||||
type Props = {
|
||||
onSubmit?: (data: FormValues) => void;
|
||||
onSubmit?: (data: FilteringCheckFormValues) => void;
|
||||
};
|
||||
|
||||
const Check = ({ onSubmit }: Props) => {
|
||||
@@ -27,11 +31,13 @@ const Check = ({ onSubmit }: Props) => {
|
||||
const {
|
||||
control,
|
||||
handleSubmit,
|
||||
formState: { isDirty, isValid },
|
||||
} = useForm<FormValues>({
|
||||
formState: { isValid },
|
||||
} = useForm<FilteringCheckFormValues>({
|
||||
mode: 'onBlur',
|
||||
defaultValues: {
|
||||
name: '',
|
||||
client_id: '',
|
||||
dns_record_type: DNS_RECORD_TYPES[0],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -48,24 +54,56 @@ const Check = ({ onSubmit }: Props) => {
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
label={t('check_hostname')}
|
||||
data-testid="check_domain_name"
|
||||
placeholder={t('form_enter_host')}
|
||||
placeholder="example.com"
|
||||
error={fieldState.error?.message}
|
||||
rightAddon={
|
||||
<span className="input-group-append">
|
||||
<button
|
||||
className="btn btn-success btn-standard btn-large"
|
||||
type="submit"
|
||||
data-testid="check_domain_submit"
|
||||
disabled={!isDirty || !isValid || processingCheck}>
|
||||
{t('check')}
|
||||
</button>
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="client_id"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Input
|
||||
{...field}
|
||||
type="text"
|
||||
data-testid="check_client_id"
|
||||
label={t('check_client_id')}
|
||||
placeholder={t('check_enter_client_id')}
|
||||
error={fieldState.error?.message}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
<Controller
|
||||
name="dns_record_type"
|
||||
control={control}
|
||||
render={({ field }) => (
|
||||
<Select
|
||||
{...field}
|
||||
label={t('check_dns_record')}
|
||||
data-testid="check_dns_record_type"
|
||||
>
|
||||
{DNS_RECORD_TYPES.map((type) => (
|
||||
<option key={type} value={type}>
|
||||
{type}
|
||||
</option>
|
||||
))}
|
||||
</Select>
|
||||
)}
|
||||
/>
|
||||
|
||||
<button
|
||||
className="btn btn-success btn-standard btn-large"
|
||||
type="submit"
|
||||
data-testid="check_domain_submit"
|
||||
disabled={!isValid || processingCheck}
|
||||
>
|
||||
{t('check')}
|
||||
</button>
|
||||
|
||||
{hostname && (
|
||||
<>
|
||||
<hr />
|
||||
|
||||
@@ -7,7 +7,7 @@ import PageTitle from '../ui/PageTitle';
|
||||
|
||||
import Examples from './Examples';
|
||||
|
||||
import Check from './Check';
|
||||
import Check, { FilteringCheckFormValues } from './Check';
|
||||
|
||||
import { getTextareaCommentsHighlight, syncScroll } from '../../helpers/highlightTextareaComments';
|
||||
import { COMMENT_LINE_DEFAULT_TOKEN } from '../../helpers/constants';
|
||||
@@ -48,7 +48,7 @@ class CustomRules extends Component<CustomRulesProps> {
|
||||
this.props.setRules(this.props.filtering.userRules);
|
||||
};
|
||||
|
||||
handleCheck = (values: any) => {
|
||||
handleCheck = (values: FilteringCheckFormValues) => {
|
||||
this.props.checkHost(values);
|
||||
};
|
||||
|
||||
|
||||
@@ -523,3 +523,12 @@ export const TIME_UNITS = {
|
||||
HOURS: 'hours',
|
||||
DAYS: 'days',
|
||||
};
|
||||
|
||||
export const DNS_RECORD_TYPES = [
|
||||
"A", "AAAA", "AFSDB", "APL", "CAA", "CDNSKEY", "CDS", "CERT", "CNAME",
|
||||
"CSYNC", "DHCID", "DLV", "DNAME", "DNSKEY", "DS", "EUI48", "EUI64",
|
||||
"HINFO", "HIP", "HTTPS", "IPSECKEY", "KEY", "KX", "LOC", "MX", "NAPTR",
|
||||
"NS", "NSEC", "NSEC3", "NSEC3PARAM", "OPENPGPKEY", "PTR", "RP", "RRSIG",
|
||||
"SIG", "SMIMEA", "SOA", "SRV", "SSHFP", "SVCB", "TA", "TKEY",
|
||||
"TLSA", "TSIG", "TXT", "URI", "ZONEMD"
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user