Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function addRemoteProvider (uppy, name, opts) {
const Provider = remoteProviders[name]
const providerOptions = {
// Default to the :tl: Companion servers.
companionUrl: Transloadit.COMPANION,
companionAllowedHosts: Transloadit.COMPANION_PATTERN
}
remoteProviderOptionNames.forEach((name) => {
if (has(opts, name)) providerOptions[name] = opts[name]
})
// Apply overrides for a specific provider plugin.
if (typeof opts[name] === 'object') {
Object.assign(providerOptions, opts[name])
}
uppy.use(Provider, providerOptions)
}
uppy
.use(Transloadit, {
getAssemblyOptions,
waitForEncoding: true
})
.use(Dashboard, {
inline: true,
maxHeight: 400,
target: '#uppy-dashboard-container',
note: 'Images only, 1–2 files, up to 1 MB'
})
.use(Instagram, {
target: Dashboard,
companionUrl: 'https://api2.transloadit.com/companion',
companionAllowedHosts: Transloadit.COMPANION_PATTERN
})
.use(Webcam, { target: Dashboard, modes: ['picture'] })
uppy
.on('transloadit:result', (stepName, result) => {
const file = uppy.getFile(result.localId)
var resultContainer = document.createElement('div')
resultContainer.innerHTML = `
<div>
<h3>Name: ${file.name}</h3>
<img src="${result.ssl_url}"> <br>
<a href="${result.ssl_url}">View</a>
</div>
`
document
.getElementById('uppy-transloadit-result')