According to https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests, we have so many preflight requests because we add `Uppy-Versions` header and `Content-Type: application/json` to each request. It's particularly not useful for for requests with no body / an empty body because the remote Companion doesn't check `Content-Type`.
It was added in b25f243627, and since f0f1105ef0, it is only used for log
purposes.
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Nick Rutten <2504906+nickrttn@users.noreply.github.com>
Co-authored-by: Murderlon <merlijn@soverin.net>
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
* respond with 500 if unhandled upload error
400 seems inappropriate
* add todo
* fix companion download error
respond with correct response code when calling /get
and request to the upstream server fail
also add a unit test for this
* forward 429 from provider
allows us to retry it
* rename fn
* add a way to test refresh tokens
* fix race condtiion with refreshing token
* implement retry and fix socket
- Make sure we don't instantiate a new Provider for every file uploaded (reuse the original provider instead) - this caused the refresh token synchronization not to work
- Retry most errors when uploading (`/get`) using companion, but for HTTP, only retry certain HTTP status codes
- Reimplement the websocket code to be more stable and retry as well
* remove unused socket wrapper
* remove useFastRemoteRetry
because it isn't supported in Companion as far as I can tell
* fix error handling
* remove unneeded logic
* apply review suggestion
* retry awaiting for companion socket too
* retry whole operation instead of individually
or else we risk getting stuck retrying just half of the operation, which might never recover
* improvements
- rewrite so we can use p-retry for exponential backoff for socket reconnect too
- improve logging
- simplify/reuse code
* Update packages/@uppy/utils/src/fetchWithNetworkError.js
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
* Explain requestClient Symbol with comment
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
* Update packages/@uppy/provider-views/src/View.js
* fixes
preventing socket.send when the socket is not in the connected state
catch errors in handlers
* log if trying to refresh with no token
* log whether we got a refresh token
* dont log retrying when in reality not
* always prompt: consent
for google drive
* add signal to post
* refactor away eventmanager
and event handler error catching
* don't fail with upload-error
if a file is canceled
* fix expect
* add capabilities support
* make requestClient non-enumerable
---------
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
* Dashboard: auto discover plugins no matter when they were installed
* Remove target from RemoteSoruces, making it compatible with @uppy/react
* Update packages/@uppy/dashboard/src/Dashboard.jsx
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
* Removed comments, added comments
* better comment
* Change type — otherwise gets listed on Dashboard sources
* Add RemoteSources to React test
* Add RemoteSources to React example
* Add tests
* Refactor for less iteration for each plugin, rename functions
* Prevent error when opts are undefined
* remove console.logs
* prettier
---------
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
JS files are ignored for now because we want to migrate them to TS
anyway.
MD files are also ignored to minimize the diff.
ESLint is run twice twice on TS files in case it conflicts with Prettier.
seems like it's gone out of sync:
Run corepack yarn install --immutable
➤ YN0000: ┌ Resolution step
Resolution step
➤ YN0000: └ Completed in 0s 979ms
➤ YN0000: ┌ Post-resolution validation
Post-resolution validation
➤ YN0028: - svelte: ^4.0.0
➤ YN0028: + svelte: ^3.0.0 || ^4.0.0
➤ YN0028: The lockfile would have been modified by this install, which is explicitly forbidden.
* When Compressor changed file format, update file.meta.name
* only use the setFileState, update comment
* Use Compressor ESM, check for name and extension
* Add test with mocked compress()
* Test user changing the file.meta.name
* Update packages/@uppy/compressor/package.json
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
* Cleaner variables, remove excessive checks
* Fix package.json
---------
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
* @uppy/transloadit: implement Server-sent event API
* pass events from event stream to JS
* @uppy/transloadit: remove Socket.io
Now that SSE is available, WebSockets do not bring much to the table.
---------
Co-authored-by: Artur Paikin <artur@arturpaikin.com>