mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Subdomain can start from a number
Summary: Allowing subdomain names to start from a number. Test Plan: Updated tests Reviewers: paulfitz Reviewed By: paulfitz Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D3009
This commit is contained in:
parent
a825115c04
commit
7e78ebfeeb
@ -15,7 +15,7 @@ const BLACKLISTED_SUBDOMAINS = new Set([
|
|||||||
'w', 'ww', 'wwww', 'wwwww',
|
'w', 'ww', 'wwww', 'wwwww',
|
||||||
'docs', 'api', 'static',
|
'docs', 'api', 'static',
|
||||||
'ftp', 'imap', 'pop', 'smtp', 'mail', 'git', 'blog', 'wiki', 'support', 'kb', 'help',
|
'ftp', 'imap', 'pop', 'smtp', 'mail', 'git', 'blog', 'wiki', 'support', 'kb', 'help',
|
||||||
'admin', 'store', 'dev', 'beta', 'dev',
|
'admin', 'store', 'dev', 'beta',
|
||||||
'community', 'try', 'wpx',
|
'community', 'try', 'wpx',
|
||||||
|
|
||||||
// a few random tech brands
|
// a few random tech brands
|
||||||
@ -23,6 +23,9 @@ const BLACKLISTED_SUBDOMAINS = new Set([
|
|||||||
|
|
||||||
// updates for new special domains
|
// updates for new special domains
|
||||||
'current', 'staging', 'prod', 'login', 'login-dev',
|
'current', 'staging', 'prod', 'login', 'login-dev',
|
||||||
|
|
||||||
|
// some domains that look suspicious
|
||||||
|
'1ogin', '1ogin-dev'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +40,7 @@ const BLACKLISTED_SUBDOMAINS = new Set([
|
|||||||
*/
|
*/
|
||||||
export function checkSubdomainValidity(subdomain: string): void {
|
export function checkSubdomainValidity(subdomain: string): void {
|
||||||
// stick with limited alphanumeric subdomains.
|
// stick with limited alphanumeric subdomains.
|
||||||
if (!(/^[a-z][-a-z0-9]*$/.test(subdomain))) {
|
if (!(/^[a-z0-9][-a-z0-9]*$/.test(subdomain))) {
|
||||||
throw new Error('Domain must include letters, numbers, and dashes only.');
|
throw new Error('Domain must include letters, numbers, and dashes only.');
|
||||||
}
|
}
|
||||||
// 'docs-*' is reserved for personal orgs.
|
// 'docs-*' is reserved for personal orgs.
|
||||||
|
Loading…
Reference in New Issue
Block a user