How to use the valid-url.isHttpsUri function in valid-url

To help you get started, we’ve selected a few valid-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pubpub / pubpub / client / components / FormattingBar / Media / MediaYoutube.js View on Github external
handleInput(url) {
		const input = getIframeSrc(url) || url;
		const isValid = isHttpsUri(input) && getEmbedType(input) === 'youtube';
		this.setState(
			{
				input: input,
				isValid: isValid,
			},
			() => {
				if (!this.state.isValid) {
					return this.setState({ embedUrl: '', embedTitle: '' });
				}

				const queryParams = `?type=${getEmbedType(input)}&input=${input}`;
				return apiFetch(`/api/editor/embed${queryParams}`).then((result) => {
					this.setState({
						embedUrl: getIframeSrc(result.html),
						embedTitle: result.title,
					});
github pubpub / pubpub / client / components / FormattingBar / Media / MediaSoundcloud.js View on Github external
handleInput(url) {
		const input = getIframeSrc(url) || url;
		const isValid = isHttpsUri(input) && getEmbedType(input) === 'soundcloud';
		this.setState(
			{
				input: input,
				isValid: isValid,
			},
			() => {
				if (!this.state.isValid) {
					return this.setState({ embedUrl: '', embedTitle: '' });
				}

				const queryParams = `?type=${getEmbedType(input)}&input=${input}`;
				return apiFetch(`/api/editor/embed${queryParams}`).then((result) => {
					this.setState({
						embedUrl: getIframeSrc(result.html),
						embedTitle: result.title,
					});
github wavesplatform / WavesExplorerLite / src / js / ConfigurationForm.js View on Github external
return Promise.resolve().then(() => {
        const url = values.apiBaseUrl.trim();
        if (!url) {
            throw {
                apiBaseUrl: 'Url is required'
            };
        }

        const currentProtocol = window.location.protocol;
        if (currentProtocol.startsWith('https') && !isHttpsUri(values.apiBaseUrl)) {
            throw {
                apiBaseUrl: `Invalid url. The url must match protocol definition (${currentProtocol})`
            };
        }

        if (!isWebUri(values.apiBaseUrl)) {
            throw {
                apiBaseUrl: `Invalid url`
            };
        }

        return nodeApi(values.apiBaseUrl)
            .version()
            .catch(() => {
                throw {
                    apiBaseUrl: 'Failed to connect to the specified node'
github pubpub / pubpub / client / components / FormattingBar / Media / MediaCodepen.js View on Github external
handleInput(url) {
		const input = getIframeSrc(url) || url;
		const isValid = isHttpsUri(input) && getEmbedType(input) === 'codepen';
		this.setState(
			{
				input: input,
				isValid: isValid,
			},
			() => {
				if (!this.state.isValid) {
					return this.setState({ embedUrl: '', embedTitle: '' });
				}

				const queryParams = `?type=${getEmbedType(input)}&input=${input}`;
				return apiFetch(`/api/editor/embed${queryParams}`).then((result) => {
					this.setState({
						embedUrl: getIframeSrc(result.html),
						embedTitle: result.title,
					});
github pubpub / pubpub / client / components / FormattingBar / Media / MediaIframe.js View on Github external
render() {
		const isValid = isHttpsUri(this.state.url);
		return (
			<div>
				 {
						const val = evt.target.value;
						this.setState({ url: getIframeSrc(val) || val });
					}}
					rightElement={
						</div>
github pubpub / pubpub / client / components / FormattingBar / Media / MediaVimeo.js View on Github external
handleInput(url) {
		const input = getIframeSrc(url) || url;
		const isValid = isHttpsUri(input) && getEmbedType(input) === 'vimeo';
		this.setState(
			{
				input: input,
				isValid: isValid,
			},
			() => {
				if (!this.state.isValid) {
					return this.setState({ embedUrl: '', embedTitle: '' });
				}

				const queryParams = `?type=${getEmbedType(input)}&input=${input}`;
				return apiFetch(`/api/editor/embed${queryParams}`).then((result) => {
					this.setState({
						embedUrl: getIframeSrc(result.html),
						embedTitle: result.title,
					});
github microsoft / botbuilder-tools / packages / MSBot / bin / msbot-connect-azure.js View on Github external
if (!args.resourceGroup || args.resourceGroup.length == 0) {
        throw new Error('Bad or missing --resourceGroup for registered bot');
    }
    const services = [];
    const service = new models_1.AzureBotService({
        type: schema_1.ServiceType.AzureBotService,
        id: args.id,
        name: args.hasOwnProperty('name') ? args.name : args.id,
        tenantId: args.tenantId,
        subscriptionId: args.subscriptionId,
        resourceGroup: args.resourceGroup
    });
    config.connectService(service);
    services.push(service);
    if (args.endpoint) {
        if (!args.endpoint || !validurl.isHttpsUri(args.endpoint)) {
            throw new Error('Bad or missing --endpoint');
        }
        if (!args.appId || !utils_1.uuidValidate(args.appId)) {
            throw new Error('Bad or missing --appId');
        }
        if (!args.appPassword || args.appPassword.length == 0) {
            throw new Error('Bad or missing --appPassword');
        }
        const endpointService = new models_1.EndpointService({
            type: schema_1.ServiceType.Endpoint,
            id: args.endpoint,
            name: args.name || args.endpoint,
            appId: args.appId,
            appPassword: args.appPassword,
            endpoint: args.endpoint
        });

valid-url

URI validation functions

Unrecognized
Latest version published 11 years ago

Package Health Score

71 / 100
Full package analysis

Similar packages