Skip to content

Commit

Permalink
Merge stable branch
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jul 6, 2022
2 parents 4347b9b + 7534edd commit 4bdfbe7
Show file tree
Hide file tree
Showing 24 changed files with 284 additions and 151 deletions.
2 changes: 2 additions & 0 deletions .env.example
Expand Up @@ -49,6 +49,8 @@ VITE_UPLOADER=tus
# VITE_UPLOADER=transloadit-xhr

VITE_COMPANION_URL=http://localhost:3020
# See also Transloadit.COMPANION_PATTERN
VITE_COMPANION_ALLOWED_HOSTS=/\.transloadit\.com$/
VITE_TUS_ENDPOINT=https://tusd.tusdemo.net/files/
VITE_XHR_ENDPOINT=https://xhr-server.herokuapp.com/upload

Expand Down
40 changes: 39 additions & 1 deletion .github/CONTRIBUTING.md
Expand Up @@ -40,7 +40,7 @@ yarn run test:unit

### End-to-End tests

We use [Cypress](cypress.io/) for our e2e test suite. Be sure to checkout “[Writing your first test](https://docs.cypress.io/guides/getting-started/writing-your-first-test#Add-a-test-file)” and the “[Introduction to Cypress](https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Cypress-Can-Be-Simple-Sometimes)”. You should also be aware of the “[Best Practices](https://docs.cypress.io/guides/references/best-practices)”.
We use [Cypress](https://www.cypress.io/) for our e2e test suite. Be sure to checkout “[Writing your first test](https://docs.cypress.io/guides/getting-started/writing-your-first-test#Add-a-test-file)” and the “[Introduction to Cypress](https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Cypress-Can-Be-Simple-Sometimes)”. You should also be aware of the “[Best Practices](https://docs.cypress.io/guides/references/best-practices)”.

To get started make sure you have your `.env` set up. Copy the contents of `.env.example` to a file named `.env` and add the values relevant for the test(s) you are trying to run.

Expand All @@ -54,6 +54,44 @@ To generate the boilerplate for a new test run:

## Development

### Companion

To start the Companion server along with Uppy, run:

```bash
yarn run dev:with-companion
```

or if you only want to run Companion

```bash
yarn run start:companion
```

This would get the Companion instance running on `http://localhost:3020`. It uses [nodemon](https://github.com/remy/nodemon) so it will automatically restart when files are changed.

### Live example

An example server is running at <https://companion.uppy.io>, which is deployed with [Kubernetes](https://github.com/transloadit/uppy/blob/main/packages/%40uppy/companion/KUBERNETES.md)

### How the Authentication and Token mechanism works

This section describes how Authentication works between Companion and Providers. While this behaviour is the same for all Providers (Dropbox, Instagram, Google Drive, etc.), we are going to be referring to Dropbox in place of any Provider throughout this section.

The following steps describe the actions that take place when a user Authenticates and Uploads from Dropbox through Companion:

* The visitor to a website with Uppy clicks `Connect to Dropbox`.
* Uppy sends a request to Companion, which in turn sends an OAuth request to Dropbox (Requires that OAuth credentials from Dropbox have been added to Companion).
* Dropbox asks the visitor to log in, and whether the Website should be allowed to access your files
* If the visitor agrees, Companion will receive a token from Dropbox, with which we can temporarily download files.
* Companion encrypts the token with a secret key and sends the encrypted token to Uppy (client)
* Every time the visitor clicks on a folder in Uppy, it asks Companion for the new list of files, with this question, the token (still encrypted by Companion) is sent along.
* Companion decrypts the token, requests the list of files from Dropbox and sends it to Uppy.
* When a file is selected for upload, Companion receives the token again according to this procedure, decrypts it again, and thereby downloads the file from Dropbox.
* As the bytes arrive, Companion uploads the bytes to the final destination (depending on the configuration: Apache, a Tus server, S3 bucket, etc).
* Companion reports progress to Uppy, as if it were a local upload.
* Completed!

### Instagram integration

Even though facebook [allows using](https://developers.facebook.com/blog/post/2018/06/08/enforce-https-facebook-login/) http://localhost in dev mode, Instagram doesn’t seem to support that, and seems to need a publically available domain name with HTTPS.
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/companion-deploy.yml
Expand Up @@ -25,17 +25,19 @@ jobs:
tag-sha: true
tag-match: |
\d{1,3}.\d{1,3}.\d{1,3}
- uses: docker/setup-buildx-action@v1
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Log in to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
file: Dockerfile
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-beta-candidate.yml
Expand Up @@ -7,7 +7,7 @@ env:
BETA_BRANCH: 3.x

jobs:
prepare-release:
prepare-beta-release:
name: Prepare release candidate Pull Request
runs-on: ubuntu-latest
steps:
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Install dependencies
run: corepack yarn install --immutable
- name: Bump candidate packages version
run: corepack yarn version apply --all --json | jq -s > releases.json
run: corepack yarn version apply --all --prerelease=beta.%n --json | jq -s > releases.json
- name: Prepare changelog
run: corepack yarn workspace @uppy-dev/release update-changelogs releases.json | xargs git add
- name: Update CDN URLs
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Expand Up @@ -84,6 +84,29 @@ Released: 2022-05-30
- @uppy/transloadit: remove IE 10 hack (Antoine du Hamel / #3777)


## 2.12.2

Released: 2022-07-06

| Package | Version | Package | Version |
| -------------------- | ------- | -------------------- | ------- |
| @uppy/companion | 3.7.0 | @uppy/transloadit | 2.3.2 |
| @uppy/locales | 2.1.1 | @uppy/robodog | 2.8.2 |
| @uppy/provider-views | 2.1.2 | uppy | 2.12.2 |

- @uppy/provider-views: improve logging (Mikael Finstad / #3638)
- docs: de-dupe companion dev docs (Mikael Finstad / #3852)
- @uppy/companion: Getkey safe behavior (Mikael Finstad / #3592)
- website: fix broken links (YukeshShr / #3861)
- @uppy/companion: doc: fix Google Drive example (Antoine du Hamel / #3855)
- @uppy/locales,@uppy/transloadit: Fix undefined error in in onTusError (Merlijn Vos / #3848)
- @uppy/companion: build an ARM64 container (Stuart Auld / #3841)
- @uppy/locales: Add missing translations and reorder nl_NL locale (Kasper Meinema / #3839)
- docs: Fix typo in aws-s3-multipart.md (Ikko Ashimine / #3838)
- meta: do not rebase when preparing beta candidates (Antoine du Hamel)
- meta: fix hard-coded branch name in release script (Antoine du Hamel)


## 2.12.1

Released: 2022-06-09
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
@@ -1,5 +1,8 @@
FROM node:16.13.0-alpine as build

# Create link to node on amd64 so that corepack can find it
RUN if [ "$(uname -m)" == "aarch64" ]; then mkdir -p /usr/local/sbin/ && ln -s /usr/local/bin/node /usr/local/sbin/node; fi

WORKDIR /app

COPY package.json .yarnrc.yml /app/
Expand Down

0 comments on commit 4bdfbe7

Please sign in to comment.