Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

website: add blog post 2.4-2.7 #3557

Merged
merged 15 commits into from
Mar 11, 2022
Merged
72 changes: 72 additions & 0 deletions website/src/_posts/2022-03-2.4-2.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: "Uppy 2.4-2.7: Compress Images, Transloadit Rate Limiting, Move to ESM"
date: 2022-03-11
author:
- aduh95
- arturi
- mifi
- murderlon
image: "https://uppy.io/images/blog/2.4-2.7/compressor.jpg"
published: true
---

Recent Uppy updates brings image compression, improved Transloadit rate limiting, lighter Dashboard. We’ve also moved our end to end tests to Cypress, and are slowly converting to ESM modules.

<img class="border" alt="Uppy Compressor plugin showing compressed images notification" src="/images/blog/2.4-2.7/compressor.jpg">

<!--more-->

## Compressor

Some of the most commonly uploaded files on the internet are images — photos, stock images, screenshots, documents scans. Uppy now includes a new plugin, `@uppy/compressor` that optimizes images (JPEG, PNG), saving on average up to 60% in size (roughly 18 MB for 10 images). It uses [Compressor.js](https://github.com/fengyuanchen/compressorjs) under the hood.

[Read the docs](https://uppy.io/docs/compressor/) for options and try it out.

```js
import Uppy from '@uppy/core'
import Compressor from '@uppy/compressor'

const uppy = new Uppy()
uppy.use(Compressor)
```

`@uppy/compressor` is also the first plugin that we are releasing as ESM, backwards compatible as CJS, to test out how this works. Please report any issues.

## Hosted Companion Custom Credentials

It’s no secret [Transloadit hosted Companion](https://transloadit.com/docs/sdks/uppy/) is the easiest secure way to allow your users pick files from cloud sources like Google Drive, Instagram, Box, etc via Uppy. Up until now, however, that meant your users had to authenticate their cloud account with Transloadit, while you might want to show your own logo instead. That’s now possible: head to `Transloadit Console` / `Credentials`, scroll to `Third-party Credentials`, click on `Add new Credentials, select `Companion OAuth\`, and voilà!
arturi marked this conversation as resolved.
Show resolved Hide resolved

<img class="border" alt="Transloadit Companion 3rd party credentials" src="/images/blog/2.4-2.7/companion-3rd-party-oauth.jpg">

Try it out with [Free Transloadit Community plan — 5GB / month and Companion](https://transloadit.com/pricing/).

## Transloadit Rate Limiting

We’ve added rate limiting to Transloadit [assembly creation and status polling](https://github.com/transloadit/uppy/pull/3429) and [tus retries](https://github.com/transloadit/uppy/pull/3394):

> When the remote server responds with HTTP 429, all requests are paused for a while in the hope that it can resolve the rate limiting. Failed requests are also now queued up after the retry delay. Before that, they were scheduled for retry without being queued up, which would sometimes end up overflowing the limit option.

Now uploading many files is even more robust.

## Move to ESM

The JavaScript ecosystem is moving towards ESM, and we want to follow suit. We are slowly starting to adopt ESM in Uppy packages, and to do that we integrated into our build system a plugin that transpiles ESM source code to CommonJS syntax which is distributed with the npm package. Nothing changes from your side, we know that not everyone is using tooling that support ESM, so we’re holding on to CommonJS for the time being. Our plan is to refactor all official Uppy plugins to ESM before Uppy 3.0 is released, and drop CommonJS in favor of ESM in the npm packages then.

For details, see [PR 3468](https://github.com/transloadit/uppy/pull/3468).

## End to End: Move to Cypress

We’ve had end to end from the start in Uppy, but the developer experience was less than ideal with custom Webdriver.io + Selenium. The transition to Cypress]\(https://github.com/transloadit/uppy/pull/3444) allows us to write tests with ease and comfort, backed by great documentation.
arturi marked this conversation as resolved.
Show resolved Hide resolved

## Lighter Bundle

We continue to look for ways to reduce Uppy bundle size and modernize our build toolchain. This time, we’ve replaced [Exifr.js](https://github.com/exif-js/exif-js) legacy bundle with the modern one without IE polyfills. Our Browserify bundler has been replaced with a modern and more efficient ESBuild.

## Companion Improvements

* Improved private ip check (#3403)
* Implement periodic ping functionality (#3246)
* Fix broken thumbnails for box and dropbox (#3460)
* Fix unpslash author meta, sanitize metadata to strings and improve companion tests (#3478)

That’s it for today! See full [changelog](https://github.com/transloadit/uppy/blob/master/CHANGELOG.md#1300) for more details.
25 changes: 17 additions & 8 deletions website/src/examples/dashboard/app.es6
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Facebook = require('@uppy/facebook')
const OneDrive = require('@uppy/onedrive')
const Zoom = require('@uppy/zoom')
const Unsplash = require('@uppy/unsplash')
// const Box = require('@uppy/box')
const Box = require('@uppy/box')
const ImageEditor = require('@uppy/image-editor')
const Url = require('@uppy/url')
const Webcam = require('@uppy/webcam')
Expand All @@ -16,6 +16,7 @@ const ScreenCapture = require('@uppy/screen-capture')
const Tus = require('@uppy/tus')
const DropTarget = require('@uppy/drop-target')
const GoldenRetriever = require('@uppy/golden-retriever')
const Compressor = require('@uppy/compressor')
const localeList = require('../locale_list.json')

const COMPANION = require('../env')
Expand Down Expand Up @@ -156,13 +157,13 @@ function uppySetOptions () {
window.uppy.removePlugin(zoomInstance)
}

// const boxInstance = window.uppy.getPlugin('Box')
// if (opts.Box && !boxInstance) {
// window.uppy.use(Box, { target: Dashboard, companionUrl: COMPANION })
// }
// if (!opts.Box && boxInstance) {
// window.uppy.removePlugin(boxInstance)
// }
const boxInstance = window.uppy.getPlugin('Box')
if (opts.Box && !boxInstance) {
window.uppy.use(Box, { target: Dashboard, companionUrl: COMPANION })
}
if (!opts.Box && boxInstance) {
window.uppy.removePlugin(boxInstance)
}

const webcamInstance = window.uppy.getPlugin('Webcam')
if (opts.Webcam && !webcamInstance) {
Expand Down Expand Up @@ -217,6 +218,14 @@ function uppySetOptions () {
if (!opts.GoldenRetriever && goldenRetrieverInstance) {
window.uppy.removePlugin(goldenRetrieverInstance)
}

const compressorInstance = window.uppy.getPlugin('Compressor')
if (opts.Compressor && !compressorInstance) {
window.uppy.use(Compressor)
}
if (!opts.Compressor && compressorInstance) {
window.uppy.removePlugin(compressorInstance)
}
}

function whenLocaleAvailable (localeName, callback) {
Expand Down
11 changes: 7 additions & 4 deletions website/src/examples/dashboard/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<li><label for="opts-darkMode"><input type="checkbox" id="opts-darkMode" /> Dark Mode</label></li>
<li><label for="opts-disabled"><input type="checkbox" id="opts-disabled" checked/> Disabled</label></li>
<li><label for="opts-GoldenRetriever"><input type="checkbox" id="opts-GoldenRetriever" checked/> Recover incomplete uploads</label></li>
<li><label for="opts-Compressor"><input type="checkbox" id="opts-Compressor" checked/> Compress images</label></li>
</ul>
<ul>
<li><label for="opts-Webcam"><input type="checkbox" id="opts-Webcam" checked/> Webcam</label></li>
Expand All @@ -18,7 +19,7 @@
<li><label for="opts-GoogleDrive"><input type="checkbox" id="opts-GoogleDrive" checked/> Google Drive</label></li>
<li><label for="opts-Dropbox"><input type="checkbox" id="opts-Dropbox" checked/> Dropbox</label></li>
<li><label for="opts-Unsplash"><input type="checkbox" id="opts-Unsplash" checked/> Unsplash</label></li>
<!-- <li><label for="opts-Box"><input type="checkbox" id="opts-Box" checked/> Box</label></li> -->
<li><label for="opts-Box"><input type="checkbox" id="opts-Box" checked/> Box</label></li>
<li><label for="opts-Instagram"><input type="checkbox" id="opts-Instagram" checked/> Instagram</label></li>
<li><label for="opts-Facebook"><input type="checkbox" id="opts-Facebook" checked/> Facebook</label></li>
<li><label for="opts-OneDrive"><input type="checkbox" id="opts-OneDrive" checked/> OneDrive</label></li>
Expand Down Expand Up @@ -51,7 +52,7 @@
GoogleDrive: document.querySelector('#opts-GoogleDrive'),
Dropbox: document.querySelector('#opts-Dropbox'),
Unsplash: document.querySelector('#opts-Unsplash'),
// Box: document.querySelector('#opts-Box'),
Box: document.querySelector('#opts-Box'),
Instagram: document.querySelector('#opts-Instagram'),
Facebook: document.querySelector('#opts-Facebook'),
OneDrive: document.querySelector('#opts-OneDrive'),
Expand All @@ -63,7 +64,8 @@
imageEditor: document.querySelector('#opts-imageEditor'),
disabled: document.querySelector('#opts-disabled'),
DropTarget: document.querySelector('#opts-DropTarget'),
GoldenRetriever: document.querySelector('#opts-GoldenRetriever')
GoldenRetriever: document.querySelector('#opts-GoldenRetriever'),
Compressor: document.querySelector('#opts-Compressor'),
}

var defaultOpts = {
Expand All @@ -74,7 +76,7 @@
Instagram: true,
Dropbox: true,
Unsplash: true,
// Box: true,
Box: true,
OneDrive: true,
Facebook: false,
Url: true,
Expand All @@ -85,6 +87,7 @@
disabled: false,
DropTarget: true,
GoldenRetriever: false,
Compressor: true,
}

// try to get options from localStorage, if its empty, set to defaultOpts
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/src/images/blog/2.4-2.7/compressor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.