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: implement ftp provider poc #4620

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft

draft: implement ftp provider poc #4620

wants to merge 46 commits into from

Conversation

mifi
Copy link
Contributor

@mifi mifi commented Aug 14, 2023

Note: not sure if it will scale because companion/uppy has stateless file browsing (1 stateless HTTP request per list operation). For FTP this means that, for every user click or file download, i create a new FTP connection, send 1 operation and then close the ftp connection

don't merge before #4619

TODO

can be tested with for example:

mifi added 15 commits August 9, 2023 16:06
not critical but some browsers might have problems
so we don't have to decode/decrypt/encode/encrypt so many times
New concept "simple auth" - authentication that happens immediately (in one http request) without redirecting to any third party.

uppyAuthToken initially used to simply contain an encrypted & json encoded OAuth2 access_token for a specific provider. Then we added refresh tokens as well inside uppyAuthToken #4448. Now we also allow storing other state or parameters needed for that specific provider, like username, password, host name, webdav URL etc... This is needed for providers like webdav, ftp etc, where the user needs to give some more input data while authenticating

Companion:
- `providerTokens` has been renamed to `providerUserSession` because it now includes not only tokens, but a user's session with a provider.

Companion `Provider` class:
- New `hasSimpleAuth` static boolean property - whether this provider uses simple auth
- uppyAuthToken expiry default 24hr again for providers that don't support refresh tokens
- make uppyAuthToken expiry configurable per provider - new `authStateExpiry` static property (defaults to 24hr)
- new static property `grantDynamicToUserSession`, allows providers to specify which state from Grant `dynamic` to include into the provider's `providerUserSession`.
also for thumbnails
for consistency
it wasn't returning the status code (like `got` does on error)
it's needed to respond properly with a http error
instead log error and show the key
this in on par with other i18n frameworks
and don't replace the whole view with a loader when plugin state loading
it will cause auth views to lose state
an inter-view loading text looks much more graceful and is how SearchProviderView works too
add support for passing objects and messages from companion to uppy
this allows companion to for example give a more detailed error when authenticating
don't force the user to use html form
and use preact for it, for flexibility
@mifi mifi changed the title implement ftp provider poc draft: implement ftp provider poc Aug 14, 2023
@socket-security
Copy link

socket-security bot commented Aug 14, 2023

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

Packages Version New capabilities Transitives Size Publisher
parse-uri 1.0.7 None +0 5.42 kB kikobeats
basic-ftp 5.0.3 network +0 136 kB patrickjuchli

@mifi mifi marked this pull request as draft August 14, 2023 08:52
@mifi mifi mentioned this pull request Aug 14, 2023
3 tasks
mifi added 11 commits August 14, 2023 21:56
# Conflicts:
#	packages/@uppy/companion/src/server/controllers/refresh-token.js
#	packages/@uppy/companion/src/server/provider/index.js
this is useful because:

      // onedrive gives some errors here that the user might want to know about
      // e.g. these happen if you try to login to a users in an organization,
      // without an Office365 licence or OneDrive account setup completed
      // 400: Tenant does not have a SPO license
      // 403: You do not have access to create this personal site or you do not have a valid license
Base automatically changed from provider-user-sessions to main December 5, 2023 21:55
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.

None yet

1 participant