diff --git a/client/src/Components/StarPrompt/index.jsx b/client/src/Components/StarPrompt/index.jsx index 64fce1d3f..f5f130387 100644 --- a/client/src/Components/StarPrompt/index.jsx +++ b/client/src/Components/StarPrompt/index.jsx @@ -74,7 +74,7 @@ const StarPrompt = ({ repoUrl = "https://github.com/bluewave-labs/checkmate" }) { - try { - return new URL(url); - } catch (error) { - return null; - } -}; - /** * Create page renders monitor creation or configuration views. * @component @@ -299,7 +285,7 @@ const UptimeCreate = ({ isClone = false }) => { const isBusy = isLoading || isCreating || isDeleting || isUpdating || isPausing; const displayInterval = monitor?.interval / MS_PER_MINUTE || 1; - const parsedUrl = parseUrl(monitor?.url); + const parsedUrl = monitor?.url; const protocol = parsedUrl?.protocol?.replace(":", "") || ""; useEffect(() => { diff --git a/client/src/Validation/validation.js b/client/src/Validation/validation.js index c778efc9e..902356ae2 100644 --- a/client/src/Validation/validation.js +++ b/client/src/Validation/validation.js @@ -150,6 +150,11 @@ const monitorValidation = joi.object({ // can be replaced by a shortest alternative // (?![-_])(?:[-\\w\\u00a1-\\uffff]{0,63}[^-_]\\.)+ "(?:" + + // Single hostname without dots (like localhost) + "[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62}" + + "|" + + // Domain with dots + "(?:" + "(?:" + "[a-z0-9\\u00a1-\\uffff]" + "[a-z0-9\\u00a1-\\uffff_-]{0,62}" + @@ -159,6 +164,7 @@ const monitorValidation = joi.object({ // TLD identifier name, may end with dot "(?:[a-z\\u00a1-\\uffff]{2,}\\.?)" + ")" + + ")" + // port number (optional) "(?::\\d{2,5})?" + // resource path (optional)