mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-21 06:26:44 +00:00
Merge pull request #8080 from is-a-dev/feat/support-discord-verification
feat(script): allows _discord subdomains
This commit is contained in:
@@ -63,6 +63,7 @@ describe('validateDomainData', () => {
|
||||
{ ...defaultDomain, record: { AAAA: ['182.22.222.22', '::1'] } },
|
||||
{ ...defaultDomain, record: { AAAA: '182.22.222.22' } },
|
||||
{ ...defaultDomain, record: { A: '::1' } },
|
||||
{ ...defaultDomain, name: '_discord' },
|
||||
];
|
||||
|
||||
const validCases = [
|
||||
@@ -92,6 +93,7 @@ describe('validateDomainData', () => {
|
||||
{ ...defaultDomain, record: { TXT: ['foobar wow nice!!!', 'more text'] } },
|
||||
{ ...defaultDomain, record: { AAAA: ['::1', '2001:db8:3333:4444:5555:6666:7777:8888'] } },
|
||||
{ ...defaultDomain, record: { A: ['122.222.222.222'] } },
|
||||
{ ...defaultDomain, name: '_discord.subdomain' },
|
||||
];
|
||||
|
||||
it('should return false for invalid data', () => {
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
"ww3",
|
||||
"ww4",
|
||||
"wwww",
|
||||
"your-domain-name"
|
||||
"your-domain-name",
|
||||
"_discord"
|
||||
]
|
||||
|
||||
@@ -36,6 +36,11 @@ const validateAAAARecord = R.propSatisfies(and([
|
||||
|
||||
const checkRestrictedNames = R.complement(R.includes(R.__, INVALID_NAMES))
|
||||
|
||||
const extraSupportedNames = [
|
||||
testRegex(/^_github(-pages)?-challenge-[a-z0-9-_]+$/i), // Exception for github verification records
|
||||
R.equals('_discord'),
|
||||
]
|
||||
|
||||
const validateDomainData = validate({
|
||||
name: {
|
||||
reason: 'The name of the file is invalid. It must be lowercased, alphanumeric and each component must be more than 2 characters long',
|
||||
@@ -43,17 +48,15 @@ const validateDomainData = validate({
|
||||
R.equals('@'),
|
||||
and([
|
||||
R.is(String),
|
||||
checkRestrictedNames,
|
||||
R.compose(
|
||||
R.all(or([
|
||||
and([
|
||||
testRegex(/^_github(-pages)?-challenge-[a-z0-9-_]+$/i), // Exception for github verification records
|
||||
checkRestrictedNames,
|
||||
]),
|
||||
and([
|
||||
R.compose(between(2, 100), R.length),
|
||||
testRegex(/^[a-z0-9-]+$/g),
|
||||
checkRestrictedNames,
|
||||
])
|
||||
]),
|
||||
...extraSupportedNames,
|
||||
])),
|
||||
R.split('.'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user