Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
});
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,
});
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'
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,
});
render() {
const isValid = isHttpsUri(this.state.url);
return (
<div>
{
const val = evt.target.value;
this.setState({ url: getIframeSrc(val) || val });
}}
rightElement={
</div>
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,
});
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
});