mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 03:15:06 +03:00
Update Auth.constants.ts
This commit is contained in:
1 parent
07ef1b8d52
commit
bc3bbb5359
1 file changed
+4
-2
@@ -1,6 +1,8 @@
|
||||
// [Joshen] Currently using the latter regex as the former is too strict, doesn't support
|
||||
// localhost - if we can combine these 2 together that'll be great but my regex-foo isn't too strong
|
||||
|
||||
// [MildTomato] Combined everything into domainRegex for now
|
||||
|
||||
// Regex from: https://stackoverflow.com/a/68002755/4807782
|
||||
// modified to accept numbers in the body of domain though
|
||||
// examples of matches:
|
||||
@@ -12,7 +14,8 @@ const baseDomainRegex =
|
||||
/^((ftp|http|https):\/\/)?(www.)?(?!.*(ftp|http|https|www.))[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+((\/)[\w#]+)*(\/\w+\?[a-zA-Z0-9_]+=\w+(&[a-zA-Z0-9_]+=\w+)*)?$/gm
|
||||
|
||||
// [Joshen] This regex allows for localhost as well, less strict
|
||||
// export const webRegex = /^(ftp|http|https):\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/i
|
||||
// [MildTomato] no longer used
|
||||
const webRegex = /^(ftp|http|https):\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/i
|
||||
|
||||
// iOS deep linking scheme https://benoitpasquier.com/deep-linking-url-scheme-ios/
|
||||
const appRegex = /^[a-z0-9]+([.][a-z0-9]+)*:\/(\/[-a-z0-9._~!$&'()*+,;=:@%]+)+$/i
|
||||
@@ -21,7 +24,6 @@ const appRegex = /^[a-z0-9]+([.][a-z0-9]+)*:\/(\/[-a-z0-9._~!$&'()*+,;=:@%]+)+$/
|
||||
const localhostRegex = /^(?:^|\s)((https?:\/\/)?(?:localhost|[\w-]+(?:\.[\w-]+)+)(:\d+)?(\/\S*)?)/i
|
||||
|
||||
// combine the above regexes
|
||||
// export const domainRegex = new RegExp(`(${webRegex.source})|(${appRegex.source})`, 'i')
|
||||
export const domainRegex = new RegExp(
|
||||
`(${baseDomainRegex.source})|(${localhostRegex.source})|(${appRegex.source})`,
|
||||
'i'
|
||||
|
||||
Reference in new issue
Block a user