|
@@ -1,5 +1,5 @@
|
|
import { UIPlugin } from '@uppy/core'
|
|
import { UIPlugin } from '@uppy/core'
|
|
-import { Provider } from '@uppy/companion-client'
|
|
|
|
|
|
+import { Provider, tokenStorage, getAllowedHosts } from '@uppy/companion-client'
|
|
import { ProviderViews } from '@uppy/provider-views'
|
|
import { ProviderViews } from '@uppy/provider-views'
|
|
import { h } from 'preact'
|
|
import { h } from 'preact'
|
|
|
|
|
|
@@ -12,14 +12,16 @@ export default class Dropbox extends UIPlugin {
|
|
constructor (uppy, opts) {
|
|
constructor (uppy, opts) {
|
|
super(uppy, opts)
|
|
super(uppy, opts)
|
|
this.id = this.opts.id || 'Dropbox'
|
|
this.id = this.opts.id || 'Dropbox'
|
|
- Provider.initPlugin(this, opts)
|
|
|
|
- this.title = this.opts.title || 'Dropbox'
|
|
|
|
|
|
+ this.type = 'acquirer'
|
|
|
|
+ this.storage = this.opts.storage || tokenStorage
|
|
|
|
+ this.files = []
|
|
this.icon = () => (
|
|
this.icon = () => (
|
|
<svg className="uppy-DashboardTab-iconDropbox" aria-hidden="true" focusable="false" width="32" height="32" viewBox="0 0 32 32">
|
|
<svg className="uppy-DashboardTab-iconDropbox" aria-hidden="true" focusable="false" width="32" height="32" viewBox="0 0 32 32">
|
|
<path d="M10.5 7.5L5 10.955l5.5 3.454 5.5-3.454 5.5 3.454 5.5-3.454L21.5 7.5 16 10.955zM10.5 21.319L5 17.864l5.5-3.455 5.5 3.455zM16 17.864l5.5-3.455 5.5 3.455-5.5 3.455zM16 25.925l-5.5-3.455 5.5-3.454 5.5 3.454z" fill="currentcolor" fillRule="nonzero" />
|
|
<path d="M10.5 7.5L5 10.955l5.5 3.454 5.5-3.454 5.5 3.454 5.5-3.454L21.5 7.5 16 10.955zM10.5 21.319L5 17.864l5.5-3.455 5.5 3.455zM16 17.864l5.5-3.455 5.5 3.455-5.5 3.455zM16 25.925l-5.5-3.455 5.5-3.454 5.5 3.454z" fill="currentcolor" fillRule="nonzero" />
|
|
</svg>
|
|
</svg>
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+ this.opts.companionAllowedHosts = getAllowedHosts(this.opts.companionAllowedHosts, this.opts.companionUrl)
|
|
this.provider = new Provider(uppy, {
|
|
this.provider = new Provider(uppy, {
|
|
companionUrl: this.opts.companionUrl,
|
|
companionUrl: this.opts.companionUrl,
|
|
companionHeaders: this.opts.companionHeaders,
|
|
companionHeaders: this.opts.companionHeaders,
|
|
@@ -33,7 +35,7 @@ export default class Dropbox extends UIPlugin {
|
|
this.defaultLocale = locale
|
|
this.defaultLocale = locale
|
|
|
|
|
|
this.i18nInit()
|
|
this.i18nInit()
|
|
- this.title = this.i18n('pluginNameDropbox')
|
|
|
|
|
|
+ this.title = this.opts.title || this.i18n('pluginNameDropbox')
|
|
|
|
|
|
this.onFirstRender = this.onFirstRender.bind(this)
|
|
this.onFirstRender = this.onFirstRender.bind(this)
|
|
this.render = this.render.bind(this)
|
|
this.render = this.render.bind(this)
|