Commit graph

323 commits

Author SHA1 Message Date
Antoine du Hamel
218c6d160b
@uppy/code: allow plugins to type PluginState (#4872) 2024-01-18 12:25:49 +01:00
Artur Paikin
4753a05754
meta: Comment on what we want to do about close, resetProgress, clearUploadedFiles, etc in the next major (#4865)
Comment on what we want to do about close, resetProgress, clearUploadedFiles, etc in the next major
2024-01-17 00:17:21 +07:00
Antoine du Hamel
984bdc135d
meta: use explicit-module-boundary-types lint rule (#4858)
* meta: use `explicit-module-boundary-types` instead of `explicit-function-return-type`

It seems to better align with what we are after: stability of public API types. We likely don't need explicit types for all functions, and it's a bit tedious to have when converting an existing plugin.
2024-01-08 13:57:02 +01:00
Antoine du Hamel
75b2e2363a
upgrade @transloadit/prettier-bytes (#4850) 2024-01-03 09:43:13 +01:00
Antoine du Hamel
725bdc5a16
@uppy/core: fix types (#4842) 2023-12-28 17:06:39 +01:00
Murderlon
c48aa82a8a
@uppy/core: refactor to TS
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-12-14 19:39:43 +01:00
Mikael Finstad
eb8a806908
fix uploadRemoteFile undefined (#4814)
* fix uploadRemoteFile undefined

for some reason, only when testing locally using VITE_COMPANION_URL=https://api2.transloadit.com/companion only
we get this error...
i'm thinking for some reason, the remote file gets serialized into state and then de-serialized again
causing remote.requestClient to be gone
so I solve it by instead storing the request clients in Uppy

fixes #4791

* fix bugs

* remove unrelated space changes

* apply suggestions

* Update Uppy.js

* fix lint

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-12-12 19:51:06 +00:00
Mikael Finstad
ec4bc58508
Provider user sessions (#4619)
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`.
2023-12-05 22:55:41 +01:00
Merlijn Vos
90da98d3d0
Fix onBeforeFileAdded with Golden Retriever (#4799) 2023-11-28 13:33:42 +01:00
Alexander Zaytsev
b6f34b2f1a
Update Uppy's blue color to meet WCAG contrast requirements (#4777)
* Use a darker shade of blue for `$blue`

* Remove transparency from the browse button

* Improve contrast of the `buttonImport`
2023-11-09 12:10:29 +01:00
Mikael Finstad
d72a937536
don't cancel all files when clicking "done" (#4771)
* don't cancel assembly when clicking "done"

* Reset state to default when Done button is pressed

* reuse code

* Apply suggestions from code review

Co-authored-by: Artur Paikin <artur@arturpaikin.com>

---------

Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2023-11-07 22:08:12 +00:00
Antoine du Hamel
773c8cb9a1
meta: add support for TypeScript plugins (#4640) 2023-10-17 15:38:15 +02:00
Artur Paikin
8b252086f5
@uppy/dashboard: auto discover and install plugins without target (#4343)
* 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>
2023-10-12 23:19:40 +01:00
Antoine du Hamel
34c78e9093
meta: run Prettier on existing files (#4713) 2023-09-29 11:11:28 +02:00
Antoine du Hamel
2c432b12cd
test: migrate to Vitest for Uppy core and Uppy plugins (#4700) 2023-09-26 17:23:17 +02:00
Merlijn Vos
ef613e6a9f
Move remote file upload logic into companion-client (#4573) 2023-08-24 14:27:28 +02:00
Merlijn Vos
aa3f03f033
@uppy/core: allow duplicate files with onBeforeFileAdded (#4594) 2023-08-07 11:23:11 +02:00
Merlijn Vos
9efd865a1f
Load Google Drive / OneDrive lists 5-10x faster & always load all files (#4513)
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Artur Paikin <artur@arturpaikin.com>
2023-07-10 10:15:35 +02:00
Mikael Finstad
2c75ddacfe
@uppy/companion: implement refresh for authentication tokens (#4448)
* allow storing multiple tokens

inside uppy auth token

* de-duplicate uploadRemote

by creating a new superclass UploaderPlugin

* pull out requestSocketToken

from MiniXHRUpload

* add class UploaderPlugin

* refactor

* refactor

* refactor/reuse

* refactor/make getAuthToken private

* fix bug

* implement refresh token

for dropbox and google drive

closes #2721

* fix test

* also update auth token cookie
when refreshing token

* fix build error on node 14

* increase auth token expiry

to workaround expiry

* Update packages/@uppy/companion-client/src/RequestClient.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

* make queueRequestSocketToken private

* rename arg

* fix lint

* log error message

* fix s3

* Update packages/@uppy/companion-client/src/Provider.js

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>

---------

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-22 11:18:48 +02:00
LinusMain
38de438864
Migrate all lodash' per-method-packages usage to lodash. (#4274)
Fixes: https://github.com/transloadit/uppy/issues/4272
Co-authored-by: R <r@r.com>
Co-authored-by: Mikael Finstad <finstaden@gmail.com>
Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-19 15:45:28 +02:00
Artur Paikin
ad96bdb8ce
@uppy/core: Don't set late (throttled) progress event on a file that is 100% complete (#4507)
Don't set late (throttled) progress event on a file that is 100% complete

Co-authored-by: Antoine du Hamel <antoine@transloadit.com>
2023-06-19 15:11:30 +02:00
Mikael Finstad
90f7fb9197
@uppy/core: improve performance of validating & uploading files (#4402)
* 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>
2023-04-15 23:50:19 +08:00
Mikael Finstad
465dec797d
User feedback adding recursive folders take 2 (#4399)
* show how many files are added when loading

remake of https://github.com/transloadit/uppy/pull/4388

* add french (cherry pick)

* add todo
2023-04-15 23:21:45 +08:00
Artur Paikin
cc5b0154c5
Single File Mode: fix layout and make optional (#4374)
* Only enable singleFile mode when Dashboard tall enough + add centerSingleFile option

* Shorten file name when Dashboard is short 📏

* Center and flex single file, prevent overflows, contain img instead of cover

* White image background looks better

* Fix broken file type icons (shown when no image preview)

* Don't stretch images smaller than container / background

* uppy-c-textInput font-family inherit

* No shadow, retain cover when non-single-file, add paddings

* if preview is available, set white background, otherwise keep violet

* add transparency to the white background

* centerSingleFile --> singleFileFullScreen
2023-04-13 22:06:53 +01:00
Mikael Finstad
3dd1e5e68c
@uppy/provider-views: fix race condition when adding folders (#4384)
* fix race condtion when adding files

don't call addFolder from listAllFiles
because that would call addFile before all folders were loaded

also remove unused selectedFolders state

* fix also the case of adding multiple folders

* fix todo: remove SharedHandler

* remove loaderWrapper

* fix logic

* fix the last race condition

* fix broken duplicate file check

* fix logic

* prettiyfy loop

* add user feedback

so they know that something is happening

* run corepack yarn run build:locale-pack

* Revert "run corepack yarn run build:locale-pack"

This reverts commit 85548ce2fc.

* Revert "add user feedback"

This reverts commit 4060019c35.

* use async generator instead of p-map

* re-fix race-condition

* remove providerFileToId

as suggested by @arturi

* use addFiles instead of addFile

* rename function

* use provider-supplied file ID

instead of generating an ID, for providers that we whitelsit
this allows adding the same time many times (with a different path)

* call core directly

* improve dev dashboard

* disable experimental getAsFileSystemHandle

it seems to be causing problems when dropping folders with subfolders in newest chrome
e.g a folder with 50 files and a subfolder which in turn has another 50 files

also refactor and document the code more

* Update packages/@uppy/provider-views/src/ProviderView/ProviderView.jsx

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* mov eto utils

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-04-04 12:13:39 +09:00
Artur Paikin
f9e9702166
UI: Use form attribite with a form in doc root to prevent outer form submit (#4283)
* Use form attribite with a form in doc root to prevent outer form submit

* Fix Unsplash a11y bug — don't focus on hidden links

* Combine search and filter into one SearchFilterInput component for Unsplash

* Refactor Browser and ProviderView

* Refactor FileCard to hooks

* Finish SearchFilterInput, add reset labels and no results copy, better styles

* don't use debounce for now

* combine useEffects, named export, extract RenderMetaFields component

* inputCSSClassName --> inputClassName

* Remove typo

* 🤦

* Patch Preact to work with Jest

* tabs vs spaces

---------

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-03-30 14:04:55 +01:00
Nguyễn bảo Trung
376375c975
@uppy/core: fix bug with setOptions (#4350) 2023-03-28 09:16:30 +02:00
Alexander Zaytsev
df32c1c5b0
@uppy/dashboard: Fix low-contrast hover styles (#4347)
Fix low-contrast hover styles on Dashboard icons
2023-03-07 19:27:42 +08:00
Alexander Zaytsev
2e596ca9a1
@uppy/dashboard: update provider icon style (#4345) 2023-03-07 16:24:48 +08:00
Artur Paikin
222e511a98
@uppy/core: fix uppy.resetProgress() (#4337)
* Fix uppy.resetProgress()

* Update tests
2023-03-02 20:16:42 +00:00
Artur Paikin
7c9e166401
Warn more instead of erroring (#4302) 2023-02-09 19:31:21 +00:00
Antoine du Hamel
be85449385
@uppy/xhr-upload: add 'upload-stalled' event (#4247)
* @uppy/xhr-upload: add`'upload-stalled'` event

* Apply suggestions from code review

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Add example

* Update website/src/docs/core.md

Co-authored-by: Merlijn Vos <merlijn@soverin.net>

* Update website/src/docs/core.md

* add bundle error and update locales

* add info message and update docs

* add French translation

* Update website/src/docs/core.md

* fixup! Update website/src/docs/core.md

---------

Co-authored-by: Merlijn Vos <merlijn@soverin.net>
2023-02-01 15:36:54 +00:00
Ikko Ashimine
717eab3b85
@uppy/core: fix typo in Uppy.test.js (#4235) 2022-11-28 10:41:29 -03:00
Artur Paikin
3fbe1c55d8
Fix button and input inconsistent font and style (#4162) 2022-10-21 15:32:00 +01:00
Antoine du Hamel
a11f92181f
@uppy/webcam: fix bug when Dashboard is using a custom id (#4099) 2022-10-19 16:08:49 -03:00
Andrew McIntee
7599f3abcb
@uppy/core: Fix Restrictor counts ghost files against maxNumberOfFiles (#4078)
Prevent core Restrictor class from including isGhost in maxNumberOfFiles count
2022-09-08 15:59:15 +02:00
Antoine du Hamel
a0eeb22458
meta: upgrade to Jest 29 (#4049) 2022-08-30 17:25:19 +02:00
Antoine du Hamel
e0f17e3753
meta: fix linter warnings (#4039) 2022-08-23 16:08:08 +02:00
Artur Paikin
7c460f3a66
core: uppy.addFile should accept browser File objects (#4020)
* If non-remote file has no .data, it’s a File object from the browser, convert it to Uppy format

* Add test

* Update packages/@uppy/core/src/Uppy.js

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

* Check for instanceof File

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-08-22 13:42:18 +01:00
Artur Paikin
4ed75ca61c
Style tweaks: use all: initial + other resets (#3983)
* Refactor uppy-u-reset: all: initial is now well-supported

* Utilize system-ui font-family, it should be provided by browsers now for multi-platform consistency

* Make Dashboard UI a little smaller by default

* Add uppy-c-btn to uppy-Dashboard-browse

* hide uploadNewlyAdded button when preprecessing

* Make “drop files here” tagline more even
2022-08-18 16:01:12 +01:00
Artur Paikin
c042f0220b
core: Remove deprecated get state and allowMultipleUploads option in Core (#3982)
* Remove deprecated get state and allowMultipleUploads option in Core

* Fix tests?

* core.getState()
2022-08-16 11:26:41 +01:00
Artur Paikin
346c2fcd43
core validateRestrictions: return error directly vs the result/reason obj (#3951)
* core validateRestrictions: return error directly vs the result/reason obj

* Refacrtor to actually use restrictionError instead of {reason, message}

* Return error instead of throwing
2022-08-08 10:58:43 +01:00
Merlijn Vos
9a213b59da
Fix all breaking todo comments for 3.0 (#3907)
- `@uppy/aws/s3-multipart`: remove `client` getter and setter.
  - reason: internal usage only
  - migrate: use exposed options only
- `@uppy/core`: remove `AggregateError` polyfill
  - reason: [should be polyfilled by the user](https://github.com/transloadit/uppy/pull/3532#discussion_r818602636)
  - migrate: install `AggregateError` polyfill or use `core-js`
- `@uppy/core`: remove `reset()` method
  - reason: it's a duplicate of `cancelAll`, but with a less intention revealing name
  - migrate: use `cancelAll`
- `@uppy/core`: remove backwards compatible exports (static properties on `Uppy`)
  - reason: transition to ESM
  - migrate: import the `Uppy` class by default and/or use named exports for everything else.
- `@uppy/react`: don't expose `validProps`
  - reason: internal only
  - migrate: do not depend on this
- `@uppy/store-redux`: remove backwards compatible exports (static properties on `ReduxStore`)
  - reason: transition to ESM
  - migrate: use named imports
- `@uppy/thumbnail-generator`: remove `rotateImage`, `protect`, and `canvasToBlob` from prototype.
  - reason: internal only
  - migrate: don't depend on this
2022-08-03 20:07:24 +02:00
Antoine du Hamel
6f3380b056
@uppy/store-default: export the class, don't expose .callbacks (#3928) 2022-08-03 11:19:09 +02:00
Antoine du Hamel
2e8f79787b
Merge stable branch 2022-07-27 19:47:25 +02:00
Antoine du Hamel
f808e9d741
@uppy/transloadit: cancel assemblies when all its files have been removed (#3893)
When starting an upload and removing it right away, it creates a race
condition when the assembly is created with no files and is never
closed. This commit ensures that the assembly is closed if all files
have been removed, or updated with the new expected number of
files otherwise.

Co-authored-by: Aaron Heimlich <aaron.heimlich@gmail.com>
2022-07-27 18:17:48 +02:00
Antoine du Hamel
a6029d0304 Merge stable branch 2022-06-09 21:15:10 +02:00
Antoine du Hamel
76751f6f4f
@uppy/core: fix TypeError when file was deleted (#3811) 2022-06-07 07:48:35 +02:00
Antoine du Hamel
6085477ed0
meta: disable ESM to CJS transform in dist files (#3773)
* meta: disable ESM to CJS transorm in dist files

This commit removes all the hacks that needed to happen in order to ship
working CJS code. Onwards, we plan to distribute Uppy packages as ESM.

* No mocking with Jest and ESM
2022-05-30 18:33:01 +02:00
Antoine du Hamel
456c2b7422
@uppy/core: refactor to ESM (#3744) 2022-05-20 11:04:09 +02:00