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 1 commit into
base: main
Choose a base branch
from
Open

Draft: Google Picker #5443

wants to merge 1 commit into from

Conversation

mifi
Copy link
Contributor

@mifi mifi commented Sep 2, 2024

Initial POC of Google Picker.

closes #5382

How to test:

Google Developer console setup

Instructions for enabling the Picker API in the Google Developer console for the first time:

Now set VITE_GOOGLE_PICKER_CLIENT_ID, VITE_GOOGLE_PICKER_API_KEY, VITE_GOOGLE_PICKER_APP_ID in your .env file and run yarn dev:with-companion

Problems/discussion

  • redirect_uri needs to be frontend URI, and wilcard is not allowed. Update: I've made appId, clientId and apiKey as Uppy options (not Companion) so this should be OK because people can then use their own credentials.
  • UI is not very good, wraps weirdly etc
  • No deep/multi select inside folders like we have now with Uppy
  • Cannot seem to be able to select drives shared with me
  • Cannot seem to get google photos to work (only Google Drive)
  • In the end I decided not to put it in RemoteSources because it has different options

TODO

  • tsconfig.json (I have just copy-pasted from google photos)
  • tsconfig.build.json (I have just copy-pasted from google photos)
  • google-picker.mdx (I have just copy-pasted from google photos)
  • google-picker/README.md (I have just copy-pasted from google photos)
  • in onPicked add the files along with any metadata needed by companion to download the files, like accessToken, clientId etc.
  • Create a new endpoint in companion to allow downloading files and pass the files along with parameters like clientId, scope, accessToken. The endpoint will call gapi.client.drive.files.get, and stream (download/upload) the file to the destination (e.g. tus/s3 etc). Need to make sure the endpoint is secure somehow in a way that it cannot be abused/exploited.
  • maybe this.provider is not needed in GooglePicker.ts
  • Need to save the auth token somewhere? (local storage?)

Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

🚮 Removed packages: npm/[email protected]), npm/[email protected]), npm/[email protected])

View full report↗︎

Copy link
Contributor

github-actions bot commented Sep 2, 2024

Diff output files
diff --git a/packages/@uppy/provider-views/lib/index.js b/packages/@uppy/provider-views/lib/index.js
index 3e5b730..319f9c4 100644
--- a/packages/@uppy/provider-views/lib/index.js
+++ b/packages/@uppy/provider-views/lib/index.js
@@ -1,2 +1,3 @@
+export { default as GooglePickerView } from "./GooglePicker/index.js";
 export { default as ProviderViews, defaultPickerIcon } from "./ProviderView/index.js";
 export { default as SearchProviderViews } from "./SearchProviderView/index.js";
diff --git a/packages/@uppy/transloadit/lib/index.js b/packages/@uppy/transloadit/lib/index.js
index 5d77af0..6e48521 100644
--- a/packages/@uppy/transloadit/lib/index.js
+++ b/packages/@uppy/transloadit/lib/index.js
@@ -458,6 +458,7 @@ function _getClientVersion2() {
   addPluginVersion("Facebook", "uppy-facebook");
   addPluginVersion("GoogleDrive", "uppy-google-drive");
   addPluginVersion("GooglePhotos", "uppy-google-photos");
+  addPluginVersion("GooglePicker", "uppy-google-picker");
   addPluginVersion("Instagram", "uppy-instagram");
   addPluginVersion("OneDrive", "uppy-onedrive");
   addPluginVersion("Zoom", "uppy-zoom");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Google Picker API
1 participant