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

Draft: Google Picker #5443

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ COMPANION_PREAUTH_SECRET=development2
# NOTE: Only enable this in development. Enabling it in production is a security risk
COMPANION_ALLOW_LOCAL_URLS=true

COMPANION_ENABLE_URL_ENDPOINT=true
COMPANION_ENABLE_GOOGLE_PICKER_ENDPOINT=true

# to enable S3
COMPANION_AWS_KEY="YOUR AWS KEY"
COMPANION_AWS_SECRET="YOUR AWS SECRET"
Expand Down Expand Up @@ -89,3 +92,10 @@ VITE_TRANSLOADIT_TEMPLATE=***
VITE_TRANSLOADIT_SERVICE_URL=https://api2.transloadit.com
# Fill in if you want requests sent to Transloadit to be signed:
# VITE_TRANSLOADIT_SECRET=***

# For Google Photos Picker and Google Drive Picker:
VITE_GOOGLE_PICKER_CLIENT_ID=***

# For Google Drive Picker
VITE_GOOGLE_PICKER_API_KEY=***
VITE_GOOGLE_PICKER_APP_ID=***
14 changes: 11 additions & 3 deletions docs/companion.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ OAuth.
## When should I use it?

If you want to let users download files from [Box][], [Dropbox][], [Facebook][],
[Google Drive][googledrive], [Google Photos][googlephotos], [Instagram][],
[OneDrive][], [Unsplash][], [Import from URL][url], or [Zoom][] — you need
Companion.
[Google Drive][googledrive], [Google Photos][googlephotos], [Google Drive
Picker][googledrivepicker], [Google Photos Picker][googlephotospicker],
[Instagram][], [OneDrive][], [Unsplash][], [Import from URL][url], or [Zoom][]
you need Companion.

Companion supports the same [uploaders](/docs/guides/choosing-uploader) as Uppy:
[Tus](/docs/tus), [AWS S3](/docs/aws-s3), and [regular multipart](/docs/tus).
Expand Down Expand Up @@ -721,6 +722,11 @@ as well as
Set this to `true` to enable the [URL functionalily](https://uppy.io/docs/url/).
Default: `false`.

#### `enableGooglePickerEndpoint` `COMPANION_ENABLE_GOOGLE_PICKER_ENDPOINT`

Set this to `true` to enable the Google Picker (Photos / Drive) functionality.
Default: `false`.

### Events

The object returned by `companion.app()` also has a property `companionEmitter`
Expand Down Expand Up @@ -981,6 +987,8 @@ automatically restart when files are changed.
[facebook]: /docs/facebook
[googledrive]: /docs/google-drive
[googlephotos]: /docs/google-photos
[googledrivepicker]: /docs/google-drive-picker
[googlephotospicker]: /docs/google-photos-picker
[instagram]: /docs/instagram
[onedrive]: /docs/onedrive
[unsplash]: /docs/unsplash
Expand Down
51 changes: 1 addition & 50 deletions docs/sources/companion-plugins/box.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,56 +171,7 @@ companion.app({

### Options

#### `id`

A unique identifier for this plugin (`string`, default: `'Box'`).

#### `title`

Title / name shown in the UI, such as Dashboard tabs (`string`, default:
`'Box'`).

#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

URL to a [Companion](/docs/companion) instance (`string`, default: `null`).

#### `companionHeaders`

Custom headers that should be sent along to [Companion](/docs/companion) on
every request (`Object`, default: `{}`).

#### `companionAllowedHosts`

The valid and authorised URL(s) from which OAuth responses should be accepted
(`string` or `RegExp` or `Array`, default: `companionUrl`).

This value can be a `string`, a `RegExp` pattern, or an `Array` of both. This is
useful when you have your [Companion](/docs/companion) running on several hosts.
Otherwise, the default value should do fine.

#### `companionCookiesRule`

This option correlates to the
[RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials)
(`string`, default: `'same-origin'`).

This tells the plugin whether to send cookies to [Companion](/docs/companion).

#### `locale`

```js
export default {
strings: {
pluginNameBox: 'Box',
},
};
```
#### [Common Companion options...](./companion-options.mdx)

[template-credentials]:
https://transloadit.com/docs/#how-to-create-template-credentials
69 changes: 69 additions & 0 deletions docs/sources/companion-plugins/companion-options.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
slug: /companion-options
---

# Common Companion options

These are the options common to all Uppy plugins that use Companion.

## `id`

A unique identifier for this plugin (`string`, default is a unique ID for each
plugin).

## `title`

Title / name shown in the UI, such as Dashboard tabs (`string`, default is the
name of the plugin).

## `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

## `companionUrl`

URL to a [Companion](/docs/companion) instance (`string`, default: `null`).

## `companionHeaders`

Custom headers that should be sent along to [Companion](/docs/companion) on
every request (`Object`, default: `{}`).

## `companionAllowedHosts`

The valid and authorised URL(s) from which OAuth responses should be accepted
(`string` or `RegExp` or `Array`, default: `companionUrl`).

This value can be a `string`, a `RegExp` pattern, or an `Array` of both. This is
useful when you have your [Companion](/docs/companion) running on several hosts.
Otherwise, the default value should do fine.

## `companionCookiesRule`

This option correlates to the
[RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials)
(`string`, default: `'same-origin'`).

This tells the plugin whether to send cookies to [Companion](/docs/companion).

## `locale`

An object with `strings` property containing additional i18n strings. The key is
the i18n key and the value is the English string.

Example:

```js
{
strings: {
someKey: 'Some English string',
},
}
```

## `storage`

A custom storage to be used for the plugin’s persistent data. Type `AsyncStore`,
default is `LocalStorage`.
51 changes: 1 addition & 50 deletions docs/sources/companion-plugins/dropbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -171,56 +171,7 @@ companion.app({

### Options

#### `id`

A unique identifier for this plugin (`string`, default: `'Dropbox'`).

#### `title`

Title / name shown in the UI, such as Dashboard tabs (`string`, default:
`'Dropbox'`).

#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

URL to a [Companion](/docs/companion) instance (`string`, default: `null`).

#### `companionHeaders`

Custom headers that should be sent along to [Companion](/docs/companion) on
every request (`Object`, default: `{}`).

#### `companionAllowedHosts`

The valid and authorised URL(s) from which OAuth responses should be accepted
(`string` or `RegExp` or `Array`, default: `companionUrl`).

This value can be a `string`, a `RegExp` pattern, or an `Array` of both. This is
useful when you have your [Companion](/docs/companion) running on several hosts.
Otherwise, the default value should do fine.

#### `companionCookiesRule`

This option correlates to the
[RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials)
(`string`, default: `'same-origin'`).

This tells the plugin whether to send cookies to [Companion](/docs/companion).

#### `locale`

```js
export default {
strings: {
pluginNameDropbox: 'Dropbox',
},
};
```
#### [Common Companion options...](./companion-options.mdx)

[template-credentials]:
https://transloadit.com/docs/#how-to-create-template-credentials
51 changes: 1 addition & 50 deletions docs/sources/companion-plugins/facebook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,56 +168,7 @@ companion.app({

### Options

#### `id`

A unique identifier for this plugin (`string`, default: `'Facebook'`).

#### `title`

Title / name shown in the UI, such as Dashboard tabs (`string`, default:
`'Facebook'`).

#### `target`

DOM element, CSS selector, or plugin to place the drag and drop area into
(`string`, `Element`, `Function`, or `UIPlugin`, default:
[`Dashboard`](/docs/dashboard)).

#### `companionUrl`

URL to a [Companion](/docs/companion) instance (`string`, default: `null`).

#### `companionHeaders`

Custom headers that should be sent along to [Companion](/docs/companion) on
every request (`Object`, default: `{}`).

#### `companionAllowedHosts`

The valid and authorised URL(s) from which OAuth responses should be accepted
(`string` or `RegExp` or `Array`, default: `companionUrl`).

This value can be a `string`, a `RegExp` pattern, or an `Array` of both. This is
useful when you have your [Companion](/docs/companion) running on several hosts.
Otherwise, the default value should do fine.

#### `companionCookiesRule`

This option correlates to the
[RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials)
(`string`, default: `'same-origin'`).

This tells the plugin whether to send cookies to [Companion](/docs/companion).

#### `locale`

```js
export default {
strings: {
pluginNameFacebook: 'Facebook',
},
};
```
#### [Common Companion options...](./companion-options.mdx)

[template-credentials]:
https://transloadit.com/docs/#how-to-create-template-credentials
Loading
Loading