The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
combine regex
Jonathan Summers-Muir07ef1b8d523f
diff --git a/studio/components/interfaces/Auth/Auth.constants.ts b/studio/components/interfaces/Auth/Auth.constants.tsindex 1c403b8efba..6225f2a760e 100644--- a/studio/components/interfaces/Auth/Auth.constants.ts+++ b/studio/components/interfaces/Auth/Auth.constants.ts@@ -8,15 +8,21 @@// "www.vercel.com"// "uptime-monitor-fe.vercel.app"// "https://uptime-monitor-fe.vercel.app/"-export const domainRegexStrict =+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+// export const webRegex = /^(ftp|http|https):\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/i// iOS deep linking scheme https://benoitpasquier.com/deep-linking-url-scheme-ios/-export const appRegex = /^[a-z0-9]+([.][a-z0-9]+)*:\/(\/[-a-z0-9._~!$&'()*+,;=:@%]+)+$/i+const appRegex = /^[a-z0-9]+([.][a-z0-9]+)*:\/(\/[-a-z0-9._~!$&'()*+,;=:@%]+)+$/i-// combine the above regexes+// Regex from https://stackoverflow.com/a/18696953/4807782+const localhostRegex = /^(?:^|\s)((https?:\/\/)?(?:localhost|[\w-]+(?:\.[\w-]+)+)(:\d+)?(\/\S*)?)/i-export const domainRegex = new RegExp(`(${webRegex.source})|(${appRegex.source})`, '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'+)diff --git a/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx b/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsxindex 0e9b11cde7e..54ce00e6280 100644--- a/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx+++ b/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx@@ -13,7 +13,7 @@ import {FormSectionLabel,} from 'components/ui/Forms'import { defaultDisabledSmtpFormValues } from './SmtpForm.constants'-import { domainRegexStrict } from './../Auth.constants'+import { domainRegex } from './../Auth.constants'import { isSmtpEnabled, generateFormValues } from './SmtpForm.utils'const SmtpForm = () => {@@ -51,7 +51,7 @@ const SmtpForm = () => {},then: (schema) =>schema- .matches(domainRegexStrict, 'Must be a valid URL or IP address')+ .matches(domainRegex, 'Must be a valid URL or IP address').required('Host URL is required.'),otherwise: (schema) => schema,}),