transloadit / uppy

The next open source file uploader for web browsers :dog:
https://uppy.io
MIT License
28.98k stars 2k forks source link

plugins: plugin system #20

Closed hedgerh closed 8 years ago

hedgerh commented 8 years ago

Currently, the client is going to use a pluggable architecture that allows integration from third party APIs like so:

transloadit
  .use(dropbox)
  .use(googleDrive)

There are two major use cases for the transloadit client:

  1. Upload files to Transloadit with the help of the transloadit client UI
  2. Upload files to Transloadit with a custom UI

What will the transloadit plugins need to provide in both of these cases?

It seems the process can be abstracted as follows:

input file -> modifications/configuration -> uploading -> server-side processing -> output
hedgerh commented 8 years ago

If the user is using their own UI and want to integrate with dropbox, for instance, what is the transloadit-dropbox plugin going to provide them to do this?

kvz commented 8 years ago

I think there is one more step

input file -> modifications/configuration -> uploading -> server-side processing -> output

modifications/configuration is for instance: selecting an area that the server will use as cropping coordinates. Like https://transloadit.com/example_apps/image-cropper/index.php

hedgerh commented 8 years ago

Updated my post to reflect that for easy reference.

kvz commented 8 years ago

If the user is using their own UI and want to integrate with dropbox, for instance, what is the transloadit-dropbox plugin going to provide them to do this?

A consistent interface I think? If dropbox' integration kit does BC-breaking changes, our plugin could compensate for that. Our plugin might also need to ask servers for auth tokens or similar.

I'm not sure of course. It's an interesting idea. We'd need to learn more

arturi commented 8 years ago

The ‘simplest’ way to figure this out: build Instagram, Dropbox and Google Drive, compare them and see if they turned out different or mostly the same. Then question this again.

Look here, it is a plugin for social share & like buttons: https://github.com/sapegin/social-likes/blob/master/src/social-likes.js#L33. Seems like they all are kind of the same, but there are minor differences and additions here and there.

kvz commented 8 years ago

The ‘simplest’ way to figure this out: build Instagram, Dropbox and Google Drive, compare them and see if they turned out different or mostly the same. Then question this again.

I'd have to agree that this is best decided by trying.

kvz commented 8 years ago

My gut feeling says we'd get a messy core quickly if it had to compensate for all the different implementation details of the external libraries. Small wrappers seem cleaner and easier to update, and protect core from many changes as external libraries change

As for

input file -> modifications/configuration -> uploading -> server-side processing -> output

I think each plugin will need to 'announce' where it belongs in this chain by exposing a type.

kvz commented 8 years ago

We have settled for now on a basic system as laid in https://github.com/transloadit/transloadit-js-client/blob/f1aa1072d5159c372624a57d5a8edaad2119efa9/classes.es6#L55