mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-21 08:26:08 +00:00
feat(script): allows _discord subdomains
This commit is contained in:
@@ -59,6 +59,7 @@ describe('validateDomainData', () => {
|
||||
{ ...defaultDomain, name: 'help.baa' },
|
||||
{ ...defaultDomain, name: '_github-pages-challenge-is-a-dev' },
|
||||
{ ...defaultDomain, name: '_github-challenge-is-a-dev' },
|
||||
{ ...defaultDomain, name: '_discord' },
|
||||
];
|
||||
|
||||
const validCases = [
|
||||
@@ -86,6 +87,7 @@ describe('validateDomainData', () => {
|
||||
{ ...defaultDomain, name: '_github-challenge-hello01-ga' },
|
||||
{ ...defaultDomain, name: '_github-challenge-hello01_ga' },
|
||||
{ ...defaultDomain, record: { TXT: ['foobar wow nice!!!', 'more text'] } },
|
||||
{ ...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"
|
||||
]
|
||||
|
||||
@@ -27,6 +27,11 @@ const validateMXRecord = type => 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',
|
||||
@@ -34,17 +39,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