update docs, tests, and examples with companionUrl rename

This commit is contained in:
Ifedapo Olarewaju 2019-04-15 14:56:37 +01:00
parent f4e558bf94
commit adeb2fecfa
30 changed files with 76 additions and 76 deletions

View file

@ -33,8 +33,8 @@ const Tus = require('@uppy/tus')
const uppy = Uppy({ autoProceed: false })
.use(Dashboard, { trigger: '#select-files' })
.use(GoogleDrive, { target: Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(Instagram, { target: Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(GoogleDrive, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Instagram, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })
.on('complete', (result) => {

View file

@ -10,7 +10,7 @@ const uppy = Uppy({
})
uppy.use(GoogleDrive, {
serverUrl: 'http://localhost:3020'
companionUrl: 'http://localhost:3020'
})
uppy.use(Webcam)
uppy.use(Dashboard, {
@ -19,5 +19,5 @@ uppy.use(Dashboard, {
plugins: ['GoogleDrive', 'Webcam']
})
uppy.use(AwsS3, {
serverUrl: 'http://localhost:3020'
companionUrl: 'http://localhost:3020'
})

View file

@ -33,9 +33,9 @@ const uppy = Uppy({
proudlyDisplayPoweredByUppy: true,
note: '2 files, images and video only'
})
.use(GoogleDrive, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Url, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(GoogleDrive, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Url, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: TUS_ENDPOINT })

View file

@ -18,7 +18,7 @@ module.exports = class MyCustomProvider extends Plugin {
// writing out the key explicitly for readability the key used to store
// the provider instance must be equal to this.id.
this[this.id] = new Provider(uppy, {
serverUrl: this.opts.serverUrl,
companionUrl: this.opts.companionUrl,
provider: 'mycustomprovider'
})

View file

@ -9,11 +9,11 @@ const uppy = Uppy({
})
uppy.use(GoogleDrive, {
serverUrl: 'http://localhost:3020'
companionUrl: 'http://localhost:3020'
})
uppy.use(MyCustomProvider, {
serverUrl: 'http://localhost:3020'
companionUrl: 'http://localhost:3020'
})
uppy.use(Dashboard, {

View file

@ -31,10 +31,10 @@ const uppy = Uppy({
proudlyDisplayPoweredByUppy: true,
note: '2 files, images and video only'
})
.use(GoogleDrive, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Dropbox, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Url, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(GoogleDrive, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Dropbox, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Url, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: TUS_ENDPOINT })
// .use(XHRUpload, { endpoint: XHR_ENDPOINT })

View file

@ -12,4 +12,4 @@ uppy.use(Dashboard, {
})
// No client side changes needed!
uppy.use(AwsS3, { serverUrl: '/companion' })
uppy.use(AwsS3, { companionUrl: '/companion' })

View file

@ -16,7 +16,7 @@ module.exports = class App extends React.Component {
this.uppy = new Uppy({ id: 'uppy1', autoProceed: true, debug: true })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })
.use(GoogleDrive, { serverUrl: 'https://companion.uppy.io' })
.use(GoogleDrive, { companionUrl: 'https://companion.uppy.io' })
this.uppy2 = new Uppy({ id: 'uppy2', autoProceed: false, debug: true })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })

View file

@ -12,8 +12,8 @@
<script>
const uppy = Uppy.Core({debug: true, autoProceed: false})
.use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
.use(Uppy.Instagram, { target: Uppy.Dashboard, serverUrl: 'http://localhost:3020' })
.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, serverUrl: 'http://localhost:3020' })
.use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: 'http://localhost:3020' })
.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: 'http://localhost:3020' })
.use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
uppy.on('success', (fileCount) => {

View file

@ -17,8 +17,8 @@ import * as Uppy from '../';
(() => {
const uppy = Uppy.Core({ autoProceed: false })
.use(Uppy.Dashboard, { trigger: '#select-files' })
.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(Uppy.Instagram, { target: Uppy.Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Uppy.Webcam, { target: Uppy.Dashboard })
.use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
.on('complete', (result) => {

View file

@ -15,7 +15,7 @@ class App extends Component {
this.uppy = new Uppy({ id: 'uppy1', autoProceed: true, debug: true })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })
.use(GoogleDrive, { serverUrl: 'https://companion.uppy.io' })
.use(GoogleDrive, { companionUrl: 'https://companion.uppy.io' })
this.uppy2 = new Uppy({ id: 'uppy2', autoProceed: false, debug: true })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })

View file

@ -16,7 +16,7 @@ Uppy({
target: '#uppyDashboard',
inline: true
})
.use(GoogleDrive, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Dropbox, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(GoogleDrive, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Dropbox, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })

View file

@ -32,10 +32,10 @@ const uppy = Core({
proudlyDisplayPoweredByUppy: true,
note: '2 files, images and video only'
})
.use(GoogleDrive, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Dropbox, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(Url, { target: Dashboard, serverUrl: 'http://localhost:3020' })
.use(GoogleDrive, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Instagram, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Dropbox, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Url, { target: Dashboard, companionUrl: 'http://localhost:3020' })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: TUS_ENDPOINT })
.use(Form, { target: '#upload-form' })

View file

@ -16,7 +16,7 @@ function initUrlPlugin (companionUrl) {
})
.use(Url, {
target: Dashboard,
serverUrl: companionUrl
companionUrl: companionUrl
})
.use(Tus, { endpoint: 'https://master.tus.io/files/' })
}

View file

@ -13,7 +13,7 @@ The `@uppy/aws-s3-multipart` plugin can be used to upload files directly to an S
const AwsS3Multipart = require('@uppy/aws-s3-multipart')
uppy.use(AwsS3Multipart, {
limit: 4,
serverUrl: 'https://uppy-companion.myapp.net/'
companionUrl: 'https://uppy-companion.myapp.net/'
})
```
@ -41,7 +41,7 @@ The `@uppy/aws-s3-multipart` plugin has the following configurable options:
The maximum amount of chunks to upload simultaneously. Set to `0` to disable limiting.
### serverUrl: null
### companionUrl: null
The Companion URL to use for proxying calls to the S3 Multipart API.

View file

@ -17,7 +17,7 @@ const ms = require('ms')
uppy.use(AwsS3, {
limit: 2,
timeout: ms('1 minute'),
serverUrl: 'https://uppy-companion.myapp.com/'
companionUrl: 'https://uppy-companion.myapp.com/'
})
```
@ -49,13 +49,13 @@ The `@uppy/aws-s3` plugin has the following configurable options:
A unique identifier for this plugin. Defaults to `'AwsS3'`.
### `serverUrl`
### `companionUrl`
When using [Companion][companion docs] to sign S3 uploads, set this option to the root URL of the Companion instance.
```js
uppy.use(AwsS3, {
serverUrl: 'https://uppy-companion.my-app.com/'
companionUrl: 'https://uppy-companion.my-app.com/'
})
```

View file

@ -52,7 +52,7 @@ The `@uppy/dropbox` plugin has the following configurable options:
```js
uppy.use(Dropbox, {
target: Dashboard,
serverUrl: 'https://companion.uppy.io/',
companionUrl: 'https://companion.uppy.io/',
})
```
@ -68,7 +68,7 @@ Title / name shown in the UI, such as Dashboard tabs. It defaults to `'Dropbox'`
DOM element, CSS selector, or plugin to mount the Dropbox provider into. This should normally be the Dashboard.
### `serverUrl: null`
### `companionUrl: null`
URL to a [Companion](/docs/companion) instance.
@ -76,7 +76,7 @@ URL to a [Companion](/docs/companion) instance.
Custom headers that should be sent along to [Companion](/docs/companion) on every request.
### `serverPattern: serverUrl`
### `companionAllowedHosts: companionUrl`
The valid and authorised URL(s) from which OAuth responses should be accepted.

View file

@ -51,7 +51,7 @@ The `@uppy/google-drive` plugin has the following configurable options:
```js
uppy.use(GoogleDrive, {
target: Dashboard,
serverUrl: 'https://companion.uppy.io/',
companionUrl: 'https://companion.uppy.io/',
})
```
@ -67,7 +67,7 @@ Configures the title / name shown in the UI, for instance, on Dashboard tabs. It
DOM element, CSS selector, or plugin to mount the Google Drive provider into. This should normally be the the [`@uppy/dashboard`](/docs/dashboard) plugin.
### `serverUrl: null`
### `companionUrl: null`
URL to a [Companion](/docs/companion) instance.
@ -75,7 +75,7 @@ URL to a [Companion](/docs/companion) instance.
Custom headers that should be sent along to [Companion](/docs/companion) on every request.
### `serverPattern: serverUrl`
### `companionAllowedHosts: companionUrl`
The valid and authorised URL(s) from which OAuth responses should be accepted.

View file

@ -53,7 +53,7 @@ The `@uppy/instagram` plugin has the following configurable options:
```js
uppy.use(Instagram, {
target: Dashboard,
serverUrl: 'https://companion.uppy.io/',
companionUrl: 'https://companion.uppy.io/',
})
```
@ -69,7 +69,7 @@ Configures the title / name shown in the UI, for instance, on Dashboard tabs. It
DOM element, CSS selector, or plugin to mount the Instagram provider into. This should normally be the Dashboard.
### `serverUrl: null`
### `companionUrl: null`
URL to a [Companion](/docs/companion) instance.
@ -77,7 +77,7 @@ URL to a [Companion](/docs/companion) instance.
Custom headers that should be sent along to [Companion](/docs/companion) on every request.
### `serverPattern: serverUrl`
### `companionAllowedHosts: companionUrl`
The valid and authorised URL(s) from which OAuth responses should be accepted.

View file

@ -10,7 +10,7 @@ The Provider plugins help you connect to your accounts with remote file provider
As of now, the supported providers are [**Dropbox**](/docs/dropbox), [**GoogleDrive**](/docs/google-drive), [**Instagram**](/docs/instagram), and [**URL**](/docs/url).
Usage of the Provider plugins is not that different from any other *acquirer* plugin, except that it takes an extra option `serverUrl`, which specifies the URL to the Companion that you are running. This allows Uppy to know what server to connect to when datacenter operations are required by the provider plugin.
Usage of the Provider plugins is not that different from any other *acquirer* plugin, except that it takes an extra option `companionUrl`, which specifies the URL to the Companion that you are running. This allows Uppy to know what server to connect to when datacenter operations are required by the provider plugin.
Here's a quick example:
@ -24,19 +24,19 @@ uppy.use(Dashboard, {
// for Google Drive
const GoogleDrive = require('@uppy/google-drive')
uppy.use(GoogleDrive, {target: Dashboard, serverUrl: 'http://localhost:3020'})
uppy.use(GoogleDrive, {target: Dashboard, companionUrl: 'http://localhost:3020'})
// for Dropbox
const Dropbox = require('@uppy/dropbox')
uppy.use(Dropbox, {target: Dashboard, serverUrl: 'http://localhost:3020'})
uppy.use(Dropbox, {target: Dashboard, companionUrl: 'http://localhost:3020'})
// for Instagram
const Instagram = require('@uppy/instagram')
uppy.use(Instagram, {target: Dashboard, serverUrl: 'http://localhost:3020'})
uppy.use(Instagram, {target: Dashboard, companionUrl: 'http://localhost:3020'})
// for URL
const Url = require('@uppy/url')
uppy.use(Url, {target: Dashboard, serverUrl: 'http://localhost:3020'})
uppy.use(Url, {target: Dashboard, companionUrl: 'http://localhost:3020'})
```
⚠️ The [Dashboard](/docs/dashboard) plugin is recommended as a universal container to all Provider plugins. It also comes with file previews, progress reporting and more. If you are using the Dashboard, it already [comes with all the nessesary styles](/docs/dashboard/#CSS) and functionality for Providers to work well.

View file

@ -77,11 +77,11 @@ Array of providers to use. Each entry is the name of a provider. The available o
- `'url'` Import files from public Web URLs using [Uppy Companion][companion].
- `'webcam'` Take photos and record videos using thee user's device camera.
### `serverUrl: Transloadit.COMPANION`
### `companionUrl: Transloadit.COMPANION`
The URL to a [Uppy Companion][companion] server to use.
### `serverPattern: Transloadit.COMPANION_PATTERN`
### `companionAllowedHosts: Transloadit.COMPANION_PATTERN`
The valid and authorised URL(s) from which OAuth responses should be accepted.

View file

@ -59,38 +59,38 @@ const Dropbox = require('@uppy/dropbox')
const Transloadit = require('@uppy/transloadit')
uppy.use(Dropbox, {
serverUrl: Transloadit.COMPANION
serverPattern: Transloadit.COMPANION_PATTERN
companionUrl: Transloadit.COMPANION
companionAllowedHosts: Transloadit.COMPANION_PATTERN
})
```
When using `Transloadit.COMPANION`, you should also configure [`serverPattern: Transloadit.COMPANION_PATTERN`](#Transloadit-COMPANION-PATTERN).
When using `Transloadit.COMPANION`, you should also configure [`companionAllowedHosts: Transloadit.COMPANION_PATTERN`](#Transloadit-COMPANION-PATTERN).
The value of this constant is `https://api2.transloadit.com/companion`. If you are using a custom [`service`](#service) option, you should also set a custom host option in your provider plugins, by taking a Transloadit API url and appending `/companion`:
```js
uppy.use(Dropbox, {
serverUrl: 'https://api2-us-east-1.transloadit.com/companion'
companionUrl: 'https://api2-us-east-1.transloadit.com/companion'
})
```
### `Transloadit.COMPANION_PATTERN`
A RegExp pattern matching Transloadit's hosted companion endpoints. The pattern is used in remote provider `serverPattern` options, to ensure that third party authentication messages cannot be faked by an attacker's page, but can only originate from Transloadit's servers.
A RegExp pattern matching Transloadit's hosted companion endpoints. The pattern is used in remote provider `companionAllowedHosts` options, to ensure that third party authentication messages cannot be faked by an attacker's page, but can only originate from Transloadit's servers.
Use it whenever you use `serverUrl: Transloadit.COMPANION`, like so:
Use it whenever you use `companionUrl: Transloadit.COMPANION`, like so:
```js
const Dropbox = require('@uppy/dropbox')
const Transloadit = require('@uppy/transloadit')
uppy.use(Dropbox, {
serverUrl: Transloadit.COMPANION
serverPattern: Transloadit.COMPANION_PATTERN
companionUrl: Transloadit.COMPANION
companionAllowedHosts: Transloadit.COMPANION_PATTERN
})
```
The value of this constant covers _all_ Transloadit's Companion servers, so it does not need to be changed if you are using a custom [`service`](#service) option. However, if you are not using the Transloadit Companion servers at `*.transloadit.com`, make sure to set the `serverPattern` option to something that matches what you do use.
The value of this constant covers _all_ Transloadit's Companion servers, so it does not need to be changed if you are using a custom [`service`](#service) option. However, if you are not using the Transloadit Companion servers at `*.transloadit.com`, make sure to set the `companionAllowedHosts` option to something that matches what you do use.
## Options

View file

@ -56,7 +56,7 @@ The `@uppy/url` plugin has the following configurable options:
```js
uppy.use(Url, {
target: Dashboard,
serverUrl: 'https://companion.uppy.io/',
companionUrl: 'https://companion.uppy.io/',
locale: {}
})
```
@ -73,7 +73,7 @@ Configures the title / name shown in the UI, for instance, on Dashboard tabs. It
DOM element, CSS selector, or plugin to mount the URL provider into. This should normally be the Dashboard.
### `serverUrl: null`
### `companionUrl: null`
URL to an Companion instance.

View file

@ -52,19 +52,19 @@ function uppyInit () {
})
if (opts.GoogleDrive) {
uppy.use(GoogleDrive, { target: Dashboard, serverUrl: COMPANION })
uppy.use(GoogleDrive, { target: Dashboard, companionUrl: COMPANION })
}
if (opts.Dropbox) {
uppy.use(Dropbox, { target: Dashboard, serverUrl: COMPANION })
uppy.use(Dropbox, { target: Dashboard, companionUrl: COMPANION })
}
if (opts.Instagram) {
uppy.use(Instagram, { target: Dashboard, serverUrl: COMPANION })
uppy.use(Instagram, { target: Dashboard, companionUrl: COMPANION })
}
if (opts.Url) {
uppy.use(Url, { target: Dashboard, serverUrl: COMPANION })
uppy.use(Url, { target: Dashboard, companionUrl: COMPANION })
}
if (opts.Webcam) {

View file

@ -52,9 +52,9 @@ const uppy = Uppy({
],
browserBackButtonClose: true
})
.use(GoogleDrive, { target: Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(Dropbox, { target: Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(Instagram, { target: Dashboard, serverUrl: 'https://companion.uppy.io' })
.use(GoogleDrive, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Dropbox, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Instagram, { target: Dashboard, companionUrl: 'https://companion.uppy.io' })
.use(Webcam, { target: Dashboard })
.use(Tus, { endpoint: 'https://master.tus.io/files/' })

View file

@ -61,8 +61,8 @@ function initUppy () {
})
.use(Instagram, {
target: Dashboard,
serverUrl: 'https://api2.transloadit.com/companion',
serverPattern: Transloadit.COMPANION_PATTERN
companionUrl: 'https://api2.transloadit.com/companion',
companionAllowedHosts: Transloadit.COMPANION_PATTERN
})
.use(Webcam, { target: Dashboard })

View file

@ -126,7 +126,7 @@ uppy
},
waitForEncoding: true
})
.use(Instagram, { target: Dashboard, serverUrl: 'https://api2.transloadit.com/companion', serverPattern: /\.transloadit\.com$/ })
.use(Instagram, { target: Dashboard, companionUrl: 'https://api2.transloadit.com/companion', companionAllowedHosts: /\.transloadit\.com$/ })
.use(Dashboard, {
inline: true,
maxHeight: 400,

View file

@ -22,7 +22,7 @@ Uppy()
})
.use(Instagram, {
target: Dashboard,
serverUrl: 'https://companion.uppy.io'
companionUrl: 'https://companion.uppy.io'
})
.use(Tus, { endpoint: 'https://master.tus.io/files/' })
.on('complete', (result) => {

View file

@ -102,10 +102,10 @@
{ id: 'caption', name: 'Caption', placeholder: 'describe what the image is about' }
]
})
.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, serverUrl: COMPANION_ENDPOINT })
.use(Uppy.Instagram, { target: Uppy.Dashboard, serverUrl: COMPANION_ENDPOINT })
.use(Uppy.GoogleDrive, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
.use(Uppy.Instagram, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
.use(Uppy.Webcam, { target: Uppy.Dashboard })
.use(Uppy.Url, { target: Uppy.Dashboard, serverUrl: COMPANION_ENDPOINT })
.use(Uppy.Url, { target: Uppy.Dashboard, companionUrl: COMPANION_ENDPOINT })
.use(Uppy.Tus, { endpoint: TUS_ENDPOINT})
uppy.on('success', (files) => {

View file

@ -12,7 +12,7 @@
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Instagram<span class="token punctuation">,</span> <span class="token punctuation">{</span>
target<span class="token punctuation">:</span> Dashboard<span class="token punctuation">,</span>
serverUrl<span class="token punctuation">:</span> <span class="token string">&apos;https://companion.uppy.io&apos;</span>
companionUrl<span class="token punctuation">:</span> <span class="token string">&apos;https://companion.uppy.io&apos;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Tus<span class="token punctuation">,</span> <span class="token punctuation">{</span> endpoint<span class="token punctuation">:</span> <span class="token string">&apos;https://master.tus.io/files/&apos;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token function">on</span><span class="token punctuation">(</span><span class="token string">&apos;complete&apos;</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token parameter">result</span><span class="token punctuation">)</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>