|
@@ -28,7 +28,6 @@
|
|
|
// If global `URL` constructor is available, use it
|
|
|
const URL_ = typeof URL === 'function' ? URL : require('url-parse')
|
|
|
const { Plugin } = require('@uppy/core')
|
|
|
-const Translator = require('@uppy/utils/lib/Translator')
|
|
|
const RateLimitedQueue = require('@uppy/utils/lib/RateLimitedQueue')
|
|
|
const settle = require('@uppy/utils/lib/settle')
|
|
|
const hasProperty = require('@uppy/utils/lib/hasProperty')
|
|
@@ -93,12 +92,6 @@ module.exports = class AwsS3 extends Plugin {
|
|
|
this.id = this.opts.id || 'AwsS3'
|
|
|
this.title = 'AWS S3'
|
|
|
|
|
|
- this.defaultLocale = {
|
|
|
- strings: {
|
|
|
- preparingUpload: 'Preparing upload...'
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
const defaultOptions = {
|
|
|
timeout: 30 * 1000,
|
|
|
limit: 0,
|
|
@@ -108,24 +101,11 @@ module.exports = class AwsS3 extends Plugin {
|
|
|
|
|
|
this.opts = { ...defaultOptions, ...opts }
|
|
|
|
|
|
- this.i18nInit()
|
|
|
-
|
|
|
this.client = new RequestClient(uppy, opts)
|
|
|
this.handleUpload = this.handleUpload.bind(this)
|
|
|
this.requests = new RateLimitedQueue(this.opts.limit)
|
|
|
}
|
|
|
|
|
|
- setOptions (newOpts) {
|
|
|
- super.setOptions(newOpts)
|
|
|
- this.i18nInit()
|
|
|
- }
|
|
|
-
|
|
|
- i18nInit () {
|
|
|
- this.translator = new Translator([this.defaultLocale, this.uppy.locale, this.opts.locale])
|
|
|
- this.i18n = this.translator.translate.bind(this.translator)
|
|
|
- this.setPluginState() // so that UI re-renders and we see the updated locale
|
|
|
- }
|
|
|
-
|
|
|
getUploadParameters (file) {
|
|
|
if (!this.opts.companionUrl) {
|
|
|
throw new Error('Expected a `companionUrl` option containing a Companion address.')
|
|
@@ -297,7 +277,7 @@ module.exports = class AwsS3 extends Plugin {
|
|
|
// Revert to `this.uppy.use(XHRUpload)` once the big comment block at the top of
|
|
|
// this file is solved
|
|
|
this._uploader = new MiniXHRUpload(this.uppy, xhrOptions)
|
|
|
- this._uploader.i18n = this.i18n
|
|
|
+ this._uploader.i18n = this.uppy.i18n
|
|
|
}
|
|
|
|
|
|
uninstall () {
|