Skip to content
This repository has been archived by the owner on May 22, 2021. It is now read-only.

Query flags to auto-download and display file #729

Open
migueldemoura opened this issue Jan 24, 2018 · 4 comments
Open

Query flags to auto-download and display file #729

migueldemoura opened this issue Jan 24, 2018 · 4 comments

Comments

@migueldemoura
Copy link

This is a feature request. I'm proposing two new flags to be added that modify the behaviour of the file download page.

Format:
https://send.firefox.com/download/FILE/?autodl=1&display=1#KEY

Key description:

  • autodl - if set to 1 and file isn't password-protected, automatically download the file (same as clicking the dl btn)
  • display - if set to 1 and the above conditions are true, display the file in-tab. This is extremely useful for images

This allows for a somewhat complete cli to be built without requiring the end-client to also have an interpreter.

@josecoelho96
Copy link

That would be very helpful. I'd found uses for it if this feature was implemented.

@dannycoates
Copy link
Contributor

This allows for a somewhat complete cli to be built without requiring the end-client to also have an interpreter.

@migueldemoura can you expand on this thought a bit?

It's probably already possible to use Send with only cli tools like curl and openssl enc in a shell script, you'd just want to use the /api endpoints instead of the html ones.

@migueldemoura
Copy link
Author

migueldemoura commented Jan 26, 2018

@dannycoates, sure! Afaik, you can send and retrieve files with a CLI. My use case is this, however:

TechUser: sends image with a CLI, gets download url and sends it to the other user
Non-techUser: opens link and image is displayed

The non-techie users don't have the cli tool.

This is the shortened and condensed version to the screenshot tool I've created:

from subprocess import call
import os
import tempfile
import requests

tmpFile = tempfile.gettempdir() + '/' + next(tempfile._get_candidate_names()) + '.png'
call('gnome-screenshot -a -f "' + tmpFile + '"', shell=True)

img = open(tmpFile, 'rb')
url = requests.post('https://example.com/upload', files={'image': img}).text
img.close()

os.remove(tmpFile)
print(url)

The idea is to swap my endpoint with Firefox Send's to take advantage of the "zero"-knowledge design but retain the same smooth UX. I have a repo with the full code if that helps visualize the flow.

What do you think? Much appreciated!

@ghost ghost added this to the Stretch milestone Jan 29, 2018
@migueldemoura
Copy link
Author

Any news on this, @dannycoates? I've since published the small script at https://github.com/migueldemoura/myazo. If I were to look at this, where should I start?

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

No branches or pull requests

3 participants