Uppy 1.26: Dashboard “disabled”, per-file headers
Uppy 1.26 brings a new disabled
option for the Dashboad, ability to set
headers per file with XHR Upload, and fixes for the Transloadit plugin.
Dashboard “Disabled”
You can now specify a disabled
option for the Dashboard, in order to make it
non-interactive and grayed out. Users won ’t be able to click on buttons or drop
files.
This is useful when you need to confitionally enable/disable file uploading or manipulation, based on a condition in your app.
This option can be set on init:
uppy.use(Dashboard, {
disabled: true,
});
and via API:
const dashboard = uppy.getPlugin('Dashboard');
dashboard.setOptions({ disabled: true });
userNameInput.addEventListener('change', () => {
dashboard.setOptions({ disabled: false });
});
XHR Upload Per File headers
@uppy/xhr-upload
now accept a headers: (file) => {}
function, so you can do:
uppy.use(XHRUpload, {
headers: (file) => ({
authorization: `bearer ${global.userToken}`,
'header-name': file.meta.someMetaValue,
}),
});
to determine file-specific headers.
The function syntax for headers
is only available if the bundle
option is
false
(the default). bundle
uploads share only one set of headers.
Build System Improvements
- build: set legacy-peer-deps for npm 7. We have some peerDependency mismatches in our install tree. In npm 6 this was OK (maybe reason for a warning) but in npm 7 they hard fail the install
- build: added npm version check (33e656cad32b865f960dbd88abf4d3839c8377f0 / @goto-bus-stop)
Transloadit Plugin
- Fixed a case where the plugin used stale file data.
- Fixed polling fallback bugs.
- Url concatenation is now more robust.
Misc
- @uppy/companion: Docker tag release (#2771 / @kiloreux)
- @uppy/companion: Companion should respect previously set value for Accesss-Control-Allow-Methods (#2726 / @tim-kos, @mifi, @so-steve)
- @uppy/transloadit: fix polling fallback bugs (#2759 / @goto-bus-stop)
- @uppy/utils: added mp4 file type support — Safari 14.0 on Mac records audio using audio/mp4 MIME type which isn't currently recognised by Uppy (#2753 / @dominiceden)
See changelog for details.