mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
update: allow ip-addresses and chrome extension ids.
This commit is contained in:
@@ -53,3 +53,10 @@ export function formatNum(number: number): string {
|
||||
* Returns a regex to check hostname validity. Supports wildcards too!
|
||||
*/
|
||||
export const hostnameRegex = String.raw`(\*)|(\*\.)?(?!-)[A-Za-z0-9\-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,18}|localhost`;
|
||||
|
||||
/**
|
||||
* Returns a regex to check hostname validity.
|
||||
*
|
||||
* Supports domains, localhost, wildcards, ip-addresses and Chrome extension IDs!
|
||||
*/
|
||||
export const extendedHostnameRegex = String.raw`(\*)|(\*\.)?((?!-)[A-Za-z0-9-]+([-.]{1}[a-z0-9]+)*\.[A-Za-z]{2,18}|localhost|(\d{1,3}\.){3}\d{1,3}|[a-z0-9]{32})`;
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
import { onMount } from 'svelte';
|
||||
import { project } from '../../../store';
|
||||
import { platform } from './store';
|
||||
import { hostnameRegex } from '$lib/helpers/string';
|
||||
import { extendedHostnameRegex } from '$lib/helpers/string';
|
||||
|
||||
let hostname: string = null;
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
id="hostname"
|
||||
label="Hostname"
|
||||
bind:value={hostname}
|
||||
pattern={hostnameRegex}
|
||||
pattern={extendedHostnameRegex}
|
||||
patternError="Please enter a valid hostname"
|
||||
placeholder="myapp.com" />
|
||||
</FormList>
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { PlatformType } from '@appwrite.io/console';
|
||||
import { isValueOfStringEnum } from '$lib/helpers/types';
|
||||
import { hostnameRegex } from '$lib/helpers/string';
|
||||
import { extendedHostnameRegex } from '$lib/helpers/string';
|
||||
|
||||
// enum Platform {
|
||||
// Android = 'flutter-android',
|
||||
@@ -174,7 +174,7 @@
|
||||
placeholder={placeholder[platform].hostname}
|
||||
tooltip={placeholder[platform].tooltip}
|
||||
required
|
||||
pattern={hostnameRegex}
|
||||
pattern={extendedHostnameRegex}
|
||||
patternError="Please enter a valid hostname"
|
||||
bind:value={$createPlatform.hostname} />
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
import { createPlatform } from '../store';
|
||||
import { Submit, trackEvent } from '$lib/actions/analytics';
|
||||
import { PlatformType } from '@appwrite.io/console';
|
||||
import { hostnameRegex } from '$lib/helpers/string';
|
||||
import { extendedHostnameRegex } from '$lib/helpers/string';
|
||||
|
||||
const projectId = $page.params.project;
|
||||
const suggestions = ['*.vercel.app', '*.netlify.app', '*.gitpod.io'];
|
||||
@@ -60,7 +60,7 @@
|
||||
placeholder="localhost"
|
||||
tooltip="The hostname that your website will use to interact with the Appwrite APIs in production or development environments. No protocol or port number required."
|
||||
required
|
||||
pattern={hostnameRegex}
|
||||
pattern={extendedHostnameRegex}
|
||||
patternError="Please enter a valid hostname"
|
||||
bind:value={$createPlatform.hostname} />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user