Commit graph

28 commits

Author SHA1 Message Date
yoann-hellopret
0640a1a56a remove encodeURIComponent to avoid encoding characters twice (#2033) 2020-01-22 12:39:52 +01:00
Gerd R
72210adee7 Fix #2011 (#2012)
* fix #2011

The isXml() method will return false if the Content-Type header is not set in the S3 response

* aws-s3: fix lint

Co-authored-by: Renée Kooi <renee@kooi.me>
2020-01-06 14:49:56 +01:00
Renée Kooi
1afe6977af
Pass metadata to Companion getKey() option for S3 uploads (#1866)
* aws-s3: send metadata to companion

* companion: apply non-multipart s3 metadata to object

* companion: add metadata parameter to getKey() api

* docs: add `metadata` parameter for `getKey`
2019-12-09 15:05:40 +01:00
Renée Kooi
701551434a
aws-s3: support GCS responses, fixes #896 (#1956)
* aws-s3: support GCS responses, fixes #896

* also check text/xml
2019-12-02 13:18:34 +01:00
Alexis Hope
ad74af8b96 Test aws s3 plugin (#1934)
* begin testing aws-s3 uploader

* test getUplaodParameters

* getUploadParameters configured campanionUrl

* warn user when configured without campanionUrl

* warn if missconfigured

Co-Authored-By: Renée Kooi <renee@kooi.me>

* remove warning in constructor
2019-11-18 14:45:17 +01:00
Artur Paikin
4e54483e61 core: setOptions for Core and plugins (#1728)
* Add a method to update options in Core

* Add a method to update options in Plugin (for any plugins)

* Allow re-initializing i18n locales after they’ve been updated with .setOptions

* use rest spread instead of Object.assign

* override setOptions in plugins to include i18nInit

* merge restrictions object in setOptions

* check that newOpts exists

* add spread ...

* don’t double merge

* add i18nInit to all plugins that use translation strings

* add setOptions tests to Core and Dashboard

* add setOptions docs for Core and Plugins

* fix tests for thumbnail-generator by adding plugins: {} to mock core

cause ThumbnailGenerator now calls this.setPluginState, which expects `core.state.plugins`

* also update meta with setOptions if it’s passed, change the way this.opts is set in core

@goto-bus-stop does this look ok? merging restrictions opts in core

* if locale was passed to setOptions(), call plugin.setOptions() on all plugins, so that i18n updates

* add Dashboard test that checks if locale is updated from Core via setOptions()

* Reafactor website Dashboard example to use setOptions and allow selecting a locale

🎉
2019-11-04 10:33:30 +01:00
Renée Kooi
0f81d70c51
aws-s3: replace resolve-url by url-parse (#1854)
So it works in browser-ish, but non-DOM, environments. Will use the
global `URL` API if available, and fall back to url-parse, which has a
compatible-enough API.

Fixes https://github.com/transloadit/uppy/issues/1720
2019-10-04 11:00:50 +02:00
Renée Kooi
bb8b66d918
Use more cancellation-friendly strategy for limit: N uploads (#1736)
* xhr-upload: redo limit option using different strategy

* xhr-upload: fix marking requests as done

* Move duplicate createEventTracker definitions to @uppy/utils

* tus: new cancellation for local uploads

* tus: fix cancelling queued uploads

* tus: fix wrong name

* aws-s3-multipart: smol refactor

* aws-s3-multipart: new cancellation style

* aws-s3: new cancellation

* utils: port limitPromises test to RateLimitedQueue

* timing fix?

* tus: new cancellation on websocket

* xhr-upload: implement cancellation for remote uploads

* aws-s3-multipart: port to new cancellation

* utils: remove limitPromises

* xhr-upload: remove pause/resume code

* xhr-upload: clean up event listeners

* xhr-upload: extract progress timer to separate class

* Move ProgressTimeout class to utils

* utils: update typings

* Fix lint

* tus: make pause/resume respect the rate limiting queue

* tus: try to explain some of the tricky things at play in the Tus#upload method

* aws-s3-multipart: add missing { abort: true }

* aws-s3-multipart: make pause/resume respect the rate limiting queue

* eslintrc.json - fixed eslint warnings for jsdoc

* Revert "eslintrc.json - fixed eslint warnings for jsdoc"

This reverts commit 50b24773ce.

* eslintrc.json - allow indentation in jsdoc comments

* xhr-upload: fix promise return value

* tus: fix promise return value

* tus: add missing `return () => {}`

* utils: typing export type fixes

* tus: add more jsdoc

* companion-client: add missing SocketOptions type

* utils: fix more export typings

* core,companion-client,tus: more typings tweaking

* companion-client: test fix 😩

* companion-client: add type for Socket#open

* tus: fix emit() call

* add local cancellation fuzz....ish? test
2019-09-25 15:21:17 +02:00
Renée Kooi
c62ec3665d Update eslint to v6 (#1777)
* Update eslint

* Do eslint --fix

* Do not access Object.prototype method 'hasOwnProperty' from target object

* utils: add hasProperty

* eslint --fix

* Disable quote-props for locale files

* add back quotes in locale files

* revert locale files to state on master

* Update react-scripts
2019-08-13 21:45:30 +03:00
Randy Etheredge
5d895f2bfa Allow overriding of getResponseData() (#1647)
* Allow overriding of getResponseData()

* aws-s3: document getResponseData()
2019-06-24 12:15:39 +02:00
Renée Kooi
e6c52f7681
Use opts.id as the plugin ID for all plugins, fixes #1674 2019-06-19 09:58:14 +02:00
Renée Kooi
980210f76c
Add VERSION properties to all plugins.
And remove the proposal-object-rest-spread plugin because it is built
into preset-env now.
2019-05-27 16:53:47 +02:00
Alex N. Jose
66a8a4a852
Do not extract keys from empty fields.
Per documentation at https://uppy.io/docs/aws-s3/, `fields` can be empty. 
"For presigned PUT uploads, this should be left empty."

Adding a safety check before attempting to extract keys.
2019-05-17 20:44:12 -07:00
Artur Paikin
28fce1a137 Default locale for all plugins (#1443)
* first swing at building locale pack

* expose default locale on the plugin instance

* write a pretty en_US locale to a file, using stringify-object and template.js

* generated locale pack

* start adding a script that checks for unused locale strings

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* Update bin/build-locale-pack.js

* Console output improvements

* Also sort plugin locale keys

* Support dependencies when digging up sources

because e.g. 'emptyFolderAdded' is used in provider-views but set in Dashboard's defaultLocale

* More complex matching

So can can support cases like: `uppy.i18n(error.isAuthError ? 'companionAuthError' : 'companionError')`

* Remaining const defaultLocale -> this.defaultLocale

* Update packages/@uppy/locales/en_US.js

* Mock browser environment so all plugins can be instantiated

* Clean up output a bit

* Update bin/build-locale-pack.js

* Add all remaining plugin's locales to en_US bundle

* Update packages/@uppy/dashboard/src/index.js

* Update en_US.js

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* remove unused strings

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* Also write csv because that makes it real easy to import to friendlier places for translators /cc @arturi

* don’t set locale: this.defaultLocale — it overrides the lang pack

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* Add 'russian plural' for english, for consistency

Allows us to signal that this is possible in new target languages, and also run better linting

* Cleanup

* No longer write csv

* WIP for NL

* Create package.json

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* move locales to /src

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* ignore locales themselves

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* build minified locale packs

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* expose Uppy.locale = {} placeholder object

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* Update ru_RU.js

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* add locale bundles to example

Co-Authored-By: Kevin van Zonneveld <kevin@transloadit.com>

* Upload locales to cdn

* Allow to run tests with upload-to-cdn by setting a versionSuffix

* Move locale build to function, to make room for test()

* Bring ru_RU in sync with English

now that we've added 3 plural types across the board

* Document using locales as a consuming dev, and plugin dev

* Add linting for missing/excess locale strings

* Add the locales we had to remove to the legacy folder

and explain why they cannot make it back

* Move legacy outside of src so they are definitely not transpiled, etc

* Update packages/@uppy/locales/src/nl_NL.js

* Update website/src/docs/uppy.md
2019-04-17 13:34:23 +02:00
Ifedapo Olarewaju
f4e558bf94 rename serverUrl to companionUrl
and serverPattern to companionAllowedHosts
2019-04-14 13:53:50 +01:00
Craig Jennings
1f8e08d492 Avoid throwing error when file has been removed
There is a case where a fileId no longer exists in uppy, namely if the
file is removed from uppy before `getUploadParameters` returns.

fixes #1317
2019-02-27 12:16:45 -06:00
Renée Kooi
54ab032e7b
s3: Use user provided filename / type for uploaded object, fixes #1238 2019-01-28 11:26:40 +01:00
Renée Kooi
71d8064982
aws-s3: Avoid using responseXML. 2018-11-12 11:30:32 +01:00
Renée Kooi
e7b39e4ef1
aws-s3: Explicitly set responseType: text, fixes #518 2018-11-12 11:24:27 +01:00
Artur Paikin
5ec15c11ca update this.translator = new Translator in all plugins that use i18n
I wonder if this could somehow be done in Plugin class once
2018-10-20 12:50:34 -04:00
Renée Kooi
0f4f7dffff
Object rest spread 2018-10-08 12:46:29 +02:00
Renée Kooi
cd71bc48b3
aws-s3: Use RequestClient. 2018-10-08 12:45:05 +02:00
Kevin van Zonneveld
67af833fdb
More uppy server -> companion renames (#1037)
* Some uppy server -> companion renames

* Fix typos

* Implement most of @goto-bus-stop's feedback

* Nuke Create React App readme

* An Companion -> A Companion

* Companion server -> instance
2018-09-03 14:48:03 +02:00
Leonardo Schlossmacher
65bb56e1e5 Fix S3 plugin for browsers without support to responseURL 2018-07-07 18:42:43 +02:00
Renée Kooi
72689d01ac
Export Plugin class from @uppy/core. 2018-06-28 12:20:21 +02:00
Artur Paikin
356585f4af update to status-bar and xhr-upload in: tests, website, dependencies, examples 2018-06-21 16:20:55 -04:00
Renée Kooi
a0798cf5ee
Move S3 Multipart upload to a separate package. 2018-06-21 16:37:55 +02:00
Artur Paikin
6219ee77f7 Move AwsS3 to @uppy/aws-s3 2018-06-17 21:52:17 -04:00