New concept "simple auth" - authentication that happens immediately (in one http request) without redirecting to any third party.
uppyAuthToken initially used to simply contain an encrypted & json encoded OAuth2 access_token for a specific provider. Then we added refresh tokens as well inside uppyAuthToken #4448. Now we also allow storing other state or parameters needed for that specific provider, like username, password, host name, webdav URL etc... This is needed for providers like webdav, ftp etc, where the user needs to give some more input data while authenticating
Companion:
- `providerTokens` has been renamed to `providerUserSession` because it now includes not only tokens, but a user's session with a provider.
Companion `Provider` class:
- New `hasSimpleAuth` static boolean property - whether this provider uses simple auth
- uppyAuthToken expiry default 24hr again for providers that don't support refresh tokens
- make uppyAuthToken expiry configurable per provider - new `authStateExpiry` static property (defaults to 24hr)
- new static property `grantDynamicToUserSession`, allows providers to specify which state from Grant `dynamic` to include into the provider's `providerUserSession`.
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>
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.
* Unify redis initialization
* Incorporate PR feedback
* Remove comment that made sense when redisOptions was set to null
---------
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
* show how many files are added when loading
remake of https://github.com/transloadit/uppy/pull/4388
* add french (cherry pick)
* implement concurrent file listing
* refactor / fix lint
* refactor/reduce duplication
* pull out totals validation
don't do it for every file added, as it's very slow
instead do the check at the end when all files are added.
this allows us to easily work with 10k+ files
fixes#4389
* Update packages/@uppy/core/src/Uppy.js
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
* make restricter.validate validate everything
instead make more specific methods for sub-validation
also rename validateTotals to validateAggregateRestrictions
* improve errors and user feedback
- handle errors centrally so that we can limit the amount of toasts (informers) sent to the users (prevent flooding hundreds/thousands of them)
- introduce FileRestrictionError which is a restriction error for a specific file
- introduce isUserFacing field for RestrictionError
* fix performance issue reintroduced
* improvements
- show "%{count} additional restrictions were not fulfilled" for any restriction errors more than 4
- refactor/rename methods
- improve ghost logic/comments
* improve performance when uploading
- introduce new event "upload-start" that can contain multiple files
- make a new patchFilesState method to allow updating more files
- unify "upload-start" logic in all plugins (send it before files start uploading)
- defer slicing buffer until we need the data
- refactor to reuse code
* fix e2e build issue
* try to upgrade cypress
maybe it fixes the error
* Revert "fix e2e build issue"
This reverts commit ff3e580c0f.
* upgrade parcel
* move mutation logic to end
* remove FileRestrictionError
merge it with RestrictionError
* fix silly bug
looks like the e2e tests are doing its job 👏
---------
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
`node:` protocol is available as of Node.js 14.18.0 LTS. Since we are
dropping support for all Node.js versions below that, we can take
advantage of this prefix to help differentiate built-in modules from npm
modules.
Now that we removed all JSX and CJS from `.js` files,
there's no need to run Babel on every files, which speeds up greatly the
time it takes for Vite to get ready.
* Fix Compressor docs
* Remove unused test commands
* Add note that all options are passed
* Add event to types
* Update website/src/docs/compressor.md
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
* Update packages/@uppy/compressor/types/index.d.ts
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
* add files array as callback to compressor:complete
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
* @uppy/angular: update ng version
* hack to allow the publish of the Angular package
* fix @types/webpack-dev-server resolution (the package is deprecated anyway)
* Add Storybook back
* Fix default value of Input
* Update README
* Apply suggestions from code review
* fix @types/react version conflict
* Update packages/@uppy/angular/.storybook/tsconfig.json
* fix broken npm run test
* improve jest / companion
add `npm run test:companion:watch`
move env variables into code to make testing easier
this allows for watching (source is causing problems with npm scripts)
also now we can run `corepack yarn test:companion -t 'single test'`
* fix root project jest
make sure we don't run companion tests on npm run test:unit (as they don't work in a browser/jsdom environment)
* improve validation logic
previously incorrect options gives an Uploader object in an incorrect state
* rewrite uploader to make it more testable
* add test for xhr
* check that metadata values are strings
* fix nested meta
causing error #3477
* convert meta to strings instead
like the official FormData spec does
* fix broken companion dev #3473
* fix botched merge
* fix botched merge and remove --fix
* fix botchedf merge
* quick fix
* .
* remove eslint fix
And use `pull_request_target` event instead of `pull_request` to use secrets from forks.
Fixes: https://github.com/transloadit/uppy/issues/3473
Co-authored-by: Mikael Finstad <finstaden@gmail.com>