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

Add directdownload endpoint #9178

Merged
merged 12 commits into from
May 1, 2018
Merged

Add directdownload endpoint #9178

merged 12 commits into from
May 1, 2018

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented Apr 13, 2018

Fixes #9142

A basic endpoint to allow clients to have an easy streaming endpoint (for example opening a file in VLC).

  1. post request is made to <server>/ocs/v2.php/apps/dav/api/v1/direct with fileId=<x>
  2. A link is returned
  3. This link is used by the client to stream

We first ask the storage for a link (S3 for example could provide this directly). Otherwise we generate a 60 char token.

The link thus only gives read access for a limited time.
The link is read only (of course)
The link is more than unique enough (just check 62^60)

Todo:

  • Links are valid for 8 hours. However after those 8 hours a request shoudl not directly trigger bruteforce protection.
  • Cleanup tokens expired more than a day ago in a cron job.
  • Some error handling
  • Tests

@rullzer rullzer added this to the Nextcloud 14 milestone Apr 13, 2018
@rullzer rullzer changed the title Feature/9142/directdownload Add directdownload endpoint Apr 13, 2018
@rullzer
Copy link
Member Author

rullzer commented Apr 13, 2018

@tobiasKaminsky

@nickvergessen
Copy link
Member

Can I haz hooks for activities 🤓

@rullzer
Copy link
Member Author

rullzer commented Apr 18, 2018

@nickvergessen o yes please that would be awesome!

@rullzer
Copy link
Member Author

rullzer commented Apr 23, 2018

@nickvergessen when do you want the hooks? On creation or on access? (or both?)

@codecov
Copy link

codecov bot commented Apr 23, 2018

Codecov Report

Merging #9178 into master will decrease coverage by 0.01%.
The diff coverage is 46.97%.

@@             Coverage Diff              @@
##             master    #9178      +/-   ##
============================================
- Coverage     51.92%   51.91%   -0.02%     
- Complexity    25388    25429      +41     
============================================
  Files          1608     1618      +10     
  Lines         95429    95644     +215     
  Branches       1394     1394              
============================================
+ Hits          49555    49656     +101     
- Misses        45874    45988     +114
Impacted Files Coverage Δ Complexity Δ
apps/dav/composer/composer/autoload_static.php 0% <ø> (ø) 1 <0> (ø) ⬇️
apps/dav/lib/Direct/Server.php 0% <0%> (ø) 1 <1> (?)
remote.php 0% <0%> (ø) 0 <0> (ø) ⬇️
...av/lib/Migration/Version1005Date20180413093149.php 0% <0%> (ø) 2 <2> (?)
apps/dav/appinfo/v2/direct.php 0% <0%> (ø) 0 <0> (?)
apps/dav/lib/Direct/ServerFactory.php 0% <0%> (ø) 2 <2> (?)
apps/dav/composer/composer/autoload_classmap.php 0% <0%> (ø) 0 <0> (ø) ⬇️
apps/dav/appinfo/routes.php 0% <0%> (ø) 0 <0> (ø) ⬇️
apps/dav/lib/Db/DirectMapper.php 10% <10%> (ø) 4 <4> (?)
apps/dav/lib/Db/Direct.php 100% <100%> (ø) 1 <1> (?)
... and 14 more

rullzer added 12 commits April 26, 2018 10:35
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Tests
* No directdownload from storage yet (as it is not tested at all)
* No direct links for folders

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer force-pushed the feature/9142/directdownload branch from 393422a to 1c75dda Compare April 26, 2018 08:35
@rullzer rullzer added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Apr 26, 2018
@rullzer
Copy link
Member Author

rullzer commented Apr 26, 2018

Ok let do this. I can add the activity hooks later.

@tobiasKaminsky already played around with it on android and it seems to do the job ;)

@tobiasKaminsky
Copy link
Member

Yes, from my side it is working :-)

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐘

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

Successfully merging this pull request may close these issues.

5 participants