Explorar el Código

Merge branch 'master' into fix/remote-uploads

Artur Paikin hace 7 años
padre
commit
e6da1ec66b

+ 4 - 3
CHANGELOG.md

@@ -107,6 +107,7 @@ To be released: 2018-01-26.
 - [ ] dashboard: cancel button for any kind of uploads? currently resume/pause only for tus, and cancel for XHR (@arturi, @goto-bus-stop)
 - [ ] docs: quick start guide: https://community.transloadit.com/t/quick-start-guide-would-be-really-helpful/14605 (@arturi)
 - [ ] docs: on writing plugins (@goto-bus-stop)
+- [x] docs: fix reference to incorrect width/height options (#475 / @xhocquet)
 - [ ] goldenretriever: add “ghost” files (@arturi)
 - [ ] webcam: URL.createObjectURL(MediaStream) is deprecated and will be removed soon: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/srcObject
 - [ ] xhrupload: add bundle option to send multiple files in one request (#442 / @goto-bus-stop)
@@ -119,9 +120,9 @@ Released: 2017-12-21.
 Theme: 🎄 Christmas edition
 
 - **⚠️ Breaking** core: rendering engine switched from `Yo-Yo` to `Preact`, and all views from `html` hyperx template strings to `JSX` (#451 / @arturi)
-- **⚠️ Breaking** core: large refactor of Core and Plugins: `setFileState`, merge `MetaData` plugin into `Dashboard`, prefix "private" core methods with underscores (@arturi / #438) 
-- **⚠️ Breaking** core: renamed `core` to `uppy` in plugins and what not. So instead of `this.core.state` we now use `this.uppy.state` (#438 / @arturi) 
-- **⚠️ Breaking** core: renamed events to remove `core:` prefix, as been suggested already. So: `success`, `error`, `upload-started` and so on, and prefixed event names for plugins sometimes, like `dashboard:file-card` (#438 / @arturi) 
+- **⚠️ Breaking** core: large refactor of Core and Plugins: `setFileState`, merge `MetaData` plugin into `Dashboard`, prefix "private" core methods with underscores (@arturi / #438)
+- **⚠️ Breaking** core: renamed `core` to `uppy` in plugins and what not. So instead of `this.core.state` we now use `this.uppy.state` (#438 / @arturi)
+- **⚠️ Breaking** core: renamed events to remove `core:` prefix, as been suggested already. So: `success`, `error`, `upload-started` and so on, and prefixed event names for plugins sometimes, like `dashboard:file-card` (#438 / @arturi)
 - **⚠️ Breaking** core: CSS class names have been altered to use `uppy-` namespace, so `.UppyDashboard-files` --> `.uppy-Dashboard-files` and so on
 - **⚠️ Breaking** dashboard: added `metaFields` option, pass an array of settings for UI field objects `{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }` (#438 / @arturi, @goto-bus-stop)
 - **⚠️ Breaking** core: deprecate `getMetaFromForm` in favor of new `Form` plugin (#407 / @arturi)

+ 1 - 1
CONTRIBUTING.md

@@ -1,3 +1,3 @@
 Please refer to our:
 
-- Contributor's guide in [`website/src/guide/contributing.md`](https://github.com/transloadit/uppy/blob/master/website/src/guide/contributing.md)
+- Contributor's guide in [`website/src/docs/contributing.md`](https://github.com/transloadit/uppy/blob/master/website/src/docs/contributing.md)

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 The MIT License (MIT)
 
-Copyright (c) 2015 Transloadit
+Copyright (c) 2018 Transloadit
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal

+ 26 - 22
README.md

@@ -1,18 +1,17 @@
-# [Uppy](http://uppy.io)
+# [Uppy](https://uppy.io)
 
-<img src="http://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="120" alt="Uppy logo: a superman puppy in a pink suit" align="right">
+<img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="120" alt="Uppy logo: a superman puppy in a pink suit" align="right">
 
 <a href="https://www.npmjs.com/package/uppy"><img src="https://img.shields.io/npm/v/uppy.svg?style=flat-square"></a>
 <a href="https://travis-ci.org/transloadit/uppy"><img src="https://img.shields.io/travis/transloadit/uppy/master.svg?style=flat-square" alt="Build Status"></a>
-<a href="https://www.npmjs.com/package/uppy"><img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square"></a>
 
-Uppy is a sleek, modular file uploader that integrates seemlessly with any application. It’s fast, easy to use and lets you worry about more important problems than building a file uploader.
+Uppy is a sleek, modular file uploader that integrates seamlessly with any application. It’s fast, easy to use and lets you worry about more important problems than building a file uploader.
 
 - **Fetch** files from local disk, Google Drive, Dropbox, Instagram, or snap and record selfies with a camera;
 - **Preview** and edit metadata with a nice interface;
-- **Upload** to the final destination, optionally processing/encoding on the way;
+- **Upload** to the final destination, optionally process/encode
 
-**[Read the docs](http://uppy.io/docs)** | **[Try Uppy](http://uppy.io/examples/dashboard/)**
+**[Read the docs](https://uppy.io/docs)** | **[Try Uppy](https://uppy.io/examples/dashboard/)**
 
 Uppy is being developed by the [Transloadit](https://transloadit.com) team.
 
@@ -42,16 +41,16 @@ const uppy = Uppy({ autoProceed: false })
   })
 ```
 
-**[Try it online](http://uppy.io/examples/dashboard/)** or **[read the docs](http://uppy.io/docs)** for more details on how to use Uppy and its plugins.
+**[Try it online](https://uppy.io/examples/dashboard/)** or **[read the docs](https://uppy.io/docs)** for more details on how to use Uppy and its plugins.
 
 ## Features
 
 - Lightweight, modular plugin-based architecture, easy on dependencies :zap:
-- Resumable file uploads via the open [tus](http://tus.io/) standard
+- Resumable file uploads via the open [tus](https://tus.io/) standard, so large uploads survive network hiccups
 - Supports picking files from: Webcam, Dropbox, Google Drive, Instagram, bypassing the user’s device where possible, syncing between servers directly via [uppy-server](https://github.com/transloadit/uppy-server)
-- Works great with file encoding and processing backends, such as [Transloadit](http://transloadit.com), works great without (just roll your own Apache/Nginx/Node/etc backend)
+- Works great with file encoding and processing backends, such as [Transloadit](https://transloadit.com), works great without (just roll your own Apache/Nginx/Node/FFmpeg/etc backend)
 - Sleek user interface :sparkles:
-- Optional file recovering (after a browser crash) with [Golden Retriever](https://uppy.io/docs/golden-retriever/)
+- Optional file recovery (after a browser crash) with [Golden Retriever](https://uppy.io/docs/golden-retriever/)
 - Speaks multiple languages (i18n) :earth_africa:
 - Built with accessibility in mind
 - Free for the world, forever (as in beer 🍺, pizza 🍕, and liberty 🗽)
@@ -63,11 +62,11 @@ const uppy = Uppy({ autoProceed: false })
 $ npm install uppy --save
 ```
 
-We recommend installing from NPM and then using a module bundler such as [Webpack](http://webpack.github.io/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/).
+We recommend installing from npm and then using a module bundler such as [Webpack](http://webpack.github.io/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/).
 
 Add CSS [uppy.min.css](https://unpkg.com/uppy/dist/uppy.min.css), either to `<head>` of your HTML page or include in JS, if your bundler of choice supports it — transforms and plugins are available for Browserify and Webpack.
 
-If you like, you can also use a pre-built bundle, for example from [unpkg CDN](https://unpkg.com/uppy/). In that case `Uppy` will attach itself to the global `window.Uppy` object.
+Alternatively, you can also use a pre-built bundle, for example from [unpkg CDN](https://unpkg.com/uppy/). In that case `Uppy` will attach itself to the global `window.Uppy` object.
 
 > ⚠️ The bundle currently consists of most Uppy plugins, so this method is not recommended for production, as your users will have to download all plugins, when you are likely using just a few.
 
@@ -85,6 +84,7 @@ If you like, you can also use a pre-built bundle, for example from [unpkg CDN](h
 3\. Initialize:
 
 ``` html
+<div class="UppyDragDrop"></div>
 <script>
   var uppy = Uppy.Core()
   uppy.use(Uppy.DragDrop, { target: '.UppyDragDrop' })
@@ -95,17 +95,17 @@ If you like, you can also use a pre-built bundle, for example from [unpkg CDN](h
 
 ## Documentation
 
-- [Uppy](http://uppy.io/docs/uppy/) — full list of options, methods and events.
-- [Plugins](http://uppy.io/docs/plugins/) — list of Uppy plugins and their options.
-- [Server](http://uppy.io/docs/server/) — setting up and running an Uppy Server instance, which adds support for Instagram, Dropbox, Google Drive and other remote sources.
-- [React](/docs/react/) — components to integrate uppy UI plugins with react apps.
+- [Uppy](https://uppy.io/docs/uppy/) — full list of options, methods and events.
+- [Plugins](https://uppy.io/docs/plugins/) — list of Uppy plugins and their options.
+- [Server](https://uppy.io/docs/server/) — setting up and running an Uppy Server instance, which adds support for Instagram, Dropbox, Google Drive and other remote sources.
+- [React](https://uppy.io/docs/react/) — components to integrate Uppy UI plugins with React apps.
 - Architecture & Making a Plugin — how to write a plugin for Uppy [documentation in progress].
 
 ## Plugins
 
-- `Tus` — resumable uploads via [tus.io](http://tus.io) open standard
-- `XHRUpload` — regular uploads for any backend out there
-- `Transloadit` — support for [Transloadit](http://transloadit.com)’s robust file encoding and processing backend
+- `Tus` — resumable uploads via the open [tus](http://tus.io) standard
+- `XHRUpload` — regular uploads for any backend out there (like Apache, Nginx)
+- `Transloadit` — support for [Transloadit](http://transloadit.com)’s robust file uploading and encoding backend
 - `Dashboard` — universal UI with previews, progress bars, metadata editor and all the cool stuff
 - `DragDrop` — plain and simple drag and drop area
 - `FileInput` — even more plain “select files” button
@@ -113,7 +113,7 @@ If you like, you can also use a pre-built bundle, for example from [unpkg CDN](h
 - `StatusBar` — more detailed progress, pause/resume/cancel buttons, percentage, speed, uploaded/total sizes (included by default with `Dashboard`)
 - `Informer` — send notifications like “smile” before taking a selfie or “upload failed” when all is lost (also included by default with `Dashboard`)
 - `GoldenRetriever` — restores files after a browser crash, like it’s nothing
-- `Form` — collects metadata from `<form>` right before Uppy upload, then optionally appends results back to the form
+- `Form` — collects metadata from `<form>` right before an Uppy upload, then optionally appends results back to the form
 - `ReduxDevTools` — for your emerging [time traveling](https://github.com/gaearon/redux-devtools) needs
 - `GoogleDrive` — select files from [Google Drive](https://www.google.com/drive/)
 - `Dropbox` — select files from [Dropbox](https://www.dropbox.com/)
@@ -136,16 +136,20 @@ Yep, we have Uppy React components, please see [Uppy React docs](https://uppy.io
 
 ### Can I use it with Rails/Node/Go/PHP?
 
-Yes, whatever you want on the backend will work with `XHRUpload` plugin, since it just does a `POST` or `PUT` request. If you want resumability with the Tus plugin, use [one of tus server implementations](http://tus.io/implementations.html) 👌🏼
+Yes, whatever you want on the backend will work with `XHRUpload` plugin, since it just does a `POST` or `PUT` request. If you want resumability with the Tus plugin, use [one of the tus server implementations](https://tus.io/implementations.html) 👌🏼
 
 ### Do I need to install special service/server for it?
 
-No, as mentioned previously, `XHRUpload` plugin is old-school and just works with everything. However, you need [`uppy-server`](https://github.com/transloadit/uppy-server) if you’d like your users to be able to pick files from Google Drive or Dropbox (more services coming). And you can add [tus](http://tus.io) if you want resumability.
+Nope, as mentioned previously, the `XHRUpload` plugin is old-school and just works with everything. However, you need [`uppy-server`](https://github.com/transloadit/uppy-server) if you’d like your users to be able to pick files from Instagram, Google Drive or Dropbox (more services coming). And you can add [tus](http://tus.io) if you want resumability.
 
 ### Does Uppy support S3 uploads?
 
 Yes, there is an S3 plugin, check out the [docs](https://uppy.io/docs/aws-s3/) for more!
 
+### Why is all this goodness free?
+
+Transloadit's team is small and we have a shared ambition to make a living from open source. By giving away projects like [tus.io](https://tus.io) and [Uppy](https://uppy.io), we're hoping to advance the state of the art, make life a tiny little bit better for everyone, and in doing so have rewarding jobs and get some eyes on our commercial service: [a content ingestion & processing platform](https://transloadit.com). Our thinking is that if just a fraction of our open source userbase can see the appeal of hosted versions straight from the source, that could already be enough to sustain our work. So far this is working out! We're able to dedicate 80% of our time to open source and haven't gone bankrupt just yet :D
+
 ## Contributions are welcome
 
  - Contributor’s guide in [`website/src/docs/contributing.md`](website/src/docs/contributing.md)

+ 3 - 6
examples/cdn-example/index.html

@@ -11,12 +11,9 @@
     <script src="https://unpkg.com/uppy/dist/uppy.min.js"></script>
     <script>
       const uppy = Uppy.Core({debug: true, autoProceed: false})
-        .use(Uppy.Dashboard, {
-          trigger: '#uppyModalOpener',
-          target: 'body'
-        })
-        .use(Uppy.Webcam, {target: Dashboard})
-        .use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/', resume: true })
+        .use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
+        .use(Uppy.Webcam, {target: Uppy.Dashboard})
+        .use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
         .run()
 
       uppy.on('success', (fileCount) => {

+ 4 - 0
src/plugins/AwsS3/index.js

@@ -16,6 +16,8 @@ module.exports = class AwsS3 extends Plugin {
     }
 
     const defaultOptions = {
+      timeout: 30 * 1000,
+      limit: 0,
       getUploadParameters: this.getUploadParameters.bind(this),
       locale: defaultLocale
     }
@@ -117,6 +119,8 @@ module.exports = class AwsS3 extends Plugin {
     this.uppy.use(XHRUpload, {
       fieldName: 'file',
       responseUrlFieldName: 'location',
+      timeout: this.opts.timeout,
+      limit: this.opts.limit,
       getResponseData (xhr) {
         // If no response, we've hopefully done a PUT request to the file
         // in the bucket on its full URL.

+ 1 - 1
src/plugins/Dropbox/index.js

@@ -39,7 +39,7 @@ module.exports = class Dropbox extends Plugin {
 
   install () {
     this.view = new View(this)
-    // Set default state
+    // Set default state for Dropbox
     this.setPluginState({
       authenticated: false,
       files: [],

+ 1 - 1
src/plugins/Instagram/index.js

@@ -39,7 +39,7 @@ module.exports = class Instagram extends Plugin {
     this.view = new View(this, {
       viewType: 'grid'
     })
-    // Set default state for Google Drive
+    // Set default state for Instagram
     this.setPluginState({
       authenticated: false,
       files: [],

+ 3 - 3
test/endtoend/src/main.js

@@ -14,7 +14,7 @@ const uppyDragDrop = Uppy({
     target: '#uppyDragDrop'
   })
   .use(ProgressBar, { target: '#uppyDragDrop-progress' })
-  .use(Tus, { endpoint: 'http://master.tus.io/files/' })
+  .use(Tus, { endpoint: 'https://master.tus.io/files/' })
   .run()
 
 const uppyi18n = Uppy({
@@ -31,7 +31,7 @@ const uppyi18n = Uppy({
     }
   })
   .use(ProgressBar, { target: '#uppyi18n-progress' })
-  .use(XHRUpload, { endpoint: 'http://api2.transloadit.com' })
+  .use(XHRUpload, { endpoint: 'https://api2.transloadit.com' })
   .run()
 
 const uppyDashboard = Uppy({
@@ -42,7 +42,7 @@ const uppyDashboard = Uppy({
     target: '#uppyDashboard',
     inline: true
   })
-  .use(Tus, { endpoint: 'http://master.tus.io/files/' })
+  .use(Tus, { endpoint: 'https://master.tus.io/files/' })
   .run()
 
 console.log(uppyDragDrop, uppyi18n, uppyDashboard)

+ 1 - 1
website/_config.yml

@@ -13,7 +13,7 @@ logo_large: /images/logos/uppy-dog-full.svg
 logo_medium: /images/logos/uppy-dog-head-arrow.svg
 logo_icon: /images/logos/uppy-dog-head-arrow.png
 description: >
-    Uppy is a sleek, modular file uploader that integrates seemlessly with any framework. 
+    Uppy is a sleek, modular file uploader that integrates seamlessly with any framework. 
     It fetches files from local disk, Google Drive, Dropbox, Instagram, remote URLs, cameras and other exciting locations, and then uploads them to the final destination. 
     It’s fast, easy to use and let's you worry about more important problems than building a file uploader.
 descriptionWho: >

+ 22 - 17
website/src/docs/contributing.md

@@ -16,6 +16,24 @@ npm install
 
 Our website's examples section is also our playground, read "Website Development"'s "Local Previews" section to get up and running.
 
+## Tests
+
+Unit tests are using Jest and can be run with:
+
+`npm run test:unit`
+
+For acceptance (or end to end) tests, we use [Webdriverio](http://webdriver.io). For it to run locally, you need to install selenium standalone server, just follow [the guide](http://webdriver.io/guide.html) to do so. You can also install Selenium Standalone server from NPM:
+
+`npm install selenium-standalone`
+
+And then launch it:
+
+`selenium-standalone start`
+
+After you’ve installed and launched the selenium standalone server, run:
+
+`npm run test:acceptance:local`
+
 ## Website Development
 
 We keep the [uppy.io](http://uppy.io) website in `./website` for so it's easy to keep docs & code in sync as we're still iterating at high velocity. For those reading this screaming murder, [HashiCorp does this](https://github.com/hashicorp/terraform/tree/master/website) for all their projects, and it's working well for them on a scale vastly more impressive than Uppy's.
@@ -41,29 +59,16 @@ npm start
 
 This will watch the website, as well as Uppy, as the examples, and rebuild everything and refresh your browser as files change.
 
-Then, to work on e.g. the Multipart example, you'd edit the following files:
+Then, to work on e.g. the XHRUpload example, you'd edit the following files:
 
 ```bash
 atom src/core/Core.js \
-  src/plugins/Multipart.js \
-  src/plugins/Formtag.js \
+  src/plugins/XHRUpload.js \
   src/plugins/Plugin.js \
-  website/src/examples/multipart/app.es6
+  website/src/examples/xhrupload/app.es6
 ```
 
-And open <http://0.0.0.0:4000/examples/multipart/index.html> in your webbrowser.
-
-## Tests
-
-Unit tests can be run with:
-
-`npm run test:unit`
-
-For acceptance (or end to end) tests, we use [Webdriverio](http://webdriver.io). For it to run locally, you need to install selenium standalone server, just follow [the guide](http://webdriver.io/guide.html) to do so.
-
-After you’ve installed and launched the selenium standalone server, run:
-
-`npm run test:acceptance:local`
+And open <http://0.0.0.0:4000/examples/xhrupload/> in your webbrowser.
 
 ## CSS Guidelines
 

+ 4 - 4
website/src/docs/dashboard.md

@@ -22,8 +22,8 @@ uppy.use(Dashboard, {
   target: 'body',
   trigger: '#uppy-select-files',
   inline: false,
-  width: 750,
-  height: 550,
+  maxWidth: 750,
+  maxHeight: 550,
   semiTransparent: false,
   showProgressDetails: false,
   hideUploadButton: false,
@@ -74,11 +74,11 @@ By default Dashboard will be rendered as a modal, which is opened via clicking o
 
 String with a CSS selector for a button that will trigger opening Dashboard modal. Multiple buttons or links can be used, if it’s a class selector (`.uppy-choose`, for example).
 
-### `width: 750`
+### `maxWidth: 750`
 
 Maximum width of the Dashboard in pixels. Used when `inline: true`.
 
-### `height: 550`
+### `maxHeight: 550`
 
 Maximum height of the Dashboard in pixels. Used when `inline: true`.
 

+ 1 - 1
website/src/docs/react.md

@@ -63,7 +63,7 @@ The plugins that are available as React component wrappers are:
  - [StatusBar][]
 
 [React]: https://facebook.github.io/react
-[Preact]: https://preact.js.org/
+[Preact]: https://preactjs.com/
 [Dashboard]: /docs/dashboard
 [DragDrop]: /docs/dragdrop
 [ProgressBar]: /docs/progressbar

+ 4 - 4
website/src/docs/server.md

@@ -7,7 +7,7 @@ order: 2
 
 Drag and Drop, Webcam, basic file manipulation (adding metadata, for example) and uploading via tus resumable uploads or XHR/Multipart are all possible using just the uppy client module.
 
-However, if you add [uppy-server](https://github.com/transloadit/uppy-server) to the mix, your users will be able to select files from remote sources, such as Instagram, Google Drive and Dropbox, bypassing the client (so a 5 GB video isn’t eating into your mobile data plan), and then uploaded to the final distanation. Files are removed from uppy-server after an upload is complete, or after a resonable timeout. Access tokens also don’t stick around for long, for security.
+However, if you add [uppy-server](https://github.com/transloadit/uppy-server) to the mix, your users will be able to select files from remote sources, such as Instagram, Google Drive and Dropbox, bypassing the client (so a 5 GB video isn’t eating into your mobile data plan), and then uploaded to the final destination. Files are removed from uppy-server after an upload is complete, or after a reasonable timeout. Access tokens also don’t stick around for long, for security.
 
 Uppy Server handles the server-to-server communication between your server and file storage providers such as Google Drive, Dropbox, Instagram, etc.
 
@@ -77,7 +77,7 @@ This takes your `server` instance and your uppy [options](#Options) as parameter
 
 ### Run as standalone server
 
-Please ensure that the required env varaibles are set before runnning/using uppy-server as a standalone server. [See](#Configure-Standalone).
+Please ensure that the required env variables are set before running/using uppy-server as a standalone server. [See](#Configure-Standalone).
 
 ```bash
 $ uppy-server
@@ -104,7 +104,7 @@ export UPPYSERVER_DOMAIN="YOUR SERVER DOMAIN"
 # corresponds to the filePath option
 export UPPYSERVER_DATADIR="PATH/TO/DOWNLOAD/DIRECTORY"
 
-###### Optionional variables ##########
+###### Optional variables ##########
 
 # corresponds to the server.protocol option. defaults to http
 export UPPYSERVER_PROTOCOL="YOUR SERVER PROTOCOL"
@@ -236,7 +236,7 @@ The default value simply returns `filename`, so all files will be uploaded to th
 ### Adding Custom Providers
 
 As of now, uppy-server supports **Google Drive**, **Dropbox** and **Instagram** out of the box, but you may also choose to add your custom providers. You can do this by passing the `customProviders`
-option when calling the uppy `app` method. The custom provider is expected to supoort Oauth 1 or 2 for authentication/authorization.
+option when calling the uppy `app` method. The custom provider is expected to support Oauth 1 or 2 for authentication/authorization.
 
 ```javascript
 let options = {

+ 3 - 0
website/src/docs/stores.md

@@ -5,7 +5,10 @@ title: "Custom Stores"
 permalink: docs/stores/
 ---
 
+> This section is about storing internal application state, if you work with React/Redux, for example. If none of this rings a bell, you can safely skip this section.
+
 By default, Uppy stores its internal state in an object.
+
 If your app uses a state management library such as [Redux](https://redux.js.org), it can be useful to have Uppy store its state there instead—that way, you could write custom uploader UI components in the same way as the other components in the application.
 
 Uppy comes with two state management solutions (stores):