alandmoore / admbrowser

A Web browser for kiosks and digital signage, based on Python, PyQt, and Blink
35 stars 22 forks source link

Download file #17

Open gragia79 opened 3 years ago

gragia79 commented 3 years ago

Hello, congratulations for the well structured and ordered code. I ask, how can I download a file? my call is: <a href='Controller/name_file/date' targhet='_blank' /a> the called controller processes the data and responds with a octed-stram header. in my case I use codeigniter 4

return $ this-> response-> download ($ file, null) -> setFileName ($ fileName);

the browser sees the request twice.

header octed-stream i set admbrowser.yaml

content_handlers:
  'application / octed-stram': 'file'

and the file is downloaded. But the window new tab stays open in 'abaut: blank'. How should I set the download header? Or How can I close the window new tab when the download is finished? Thank you

just for information python-yaml is no longer maintained you have to use pyYAML. To change in requirements.

stroobandt commented 1 year ago

I am experiencing a similar problem. I would like to download an octet-stream and simply save it. I am wondering what handler would correspond to a Qt file save dialog.

allow_external_content: True
content_handlers:
  application/octet-stream: ???
alandmoore commented 1 year ago

I haven't had my head in Qt for a while, but I'm assuming one would need to implement a save dialog and file saving of some sort. I took a quick look over the docs and didn't see anything obvious built in to QtWebEngine.

Given that ADMBrowser is aimed at kiosk / locked down usage, I'd be interested in hearing a use case for downloading and saving files. That's one of the many things I created this browser to not have, though if there is an arguable use case I would accept a PR as long as it was disabled by default.

stroobandt commented 1 year ago

Here is a use case: A library thin client with only USB ports provides default access to https://pubmed.ncbi.nlm.nih.gov The accessible USB port allows to download medical scientific papers in PDF on a USB memory stick.

Here is another one: ADMbrowser manages the web interface of a router or headless system. Using ADMbrowser as a dedicated browser in this case provides additional security by preventing keystroke recording attacks. The web interface allows for downloading a backup of the router settings in a proprietary file format.

alandmoore commented 1 year ago

That makes sense. This is a feature that would definitely be disabled by default, and one would want to be able to secure it to make sure the download dialog doesn't become a back door to browsing the system.