Custom file handling

Long press the settings button, check the option "custom file handling" to enable the functionality.

The custom file handling configuration file is "default.filecap", each line of it has the format as follows:
[file extension]:[mimetype]:[command line]

The "[file extension]" part can have at most two-segment of extensions such as "txt.xz","html.gz".
"[mimetype]" indicates the type of "[command line]" output.
"[command line]" is same as the one in default.cmds. The most often used replacements are:
%u (url), %U (urlencoded url), %c (cookie), %p (site password, curl format).

default.filecap example:

txt:text/html:curl %p "%u"
mp3:text/html:echo '<audio controls width=100% height=100%><source src="%u"></audio>'
m4b:text/html:echo '<audio controls width=100% height=100%><source src="%u"></audio>'
m3u8:text/html:echo '<video controls width=100% height=100%><source src="%u"></video>'
mp4:text/html:echo '<video controls width=100% height=100%><source src="%u"></video>'
mkv:text/html:echo '<video controls width=100% height=100%><source src="%u"></video>'
doc:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
xls:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
ppt:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
docx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
xlsx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
pptx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
xz:text/plain:curl %p "%u"|xz -d --

Examples for html5 application:

pdf:uweb:echo file:///data/data/info.torapp.uweb/files/app/pdf.js/web/viewer.html?file=%u
djvu:uweb:echo file:///data/data/info.torapp.uweb/files/app/djvu.html?url=%u
epub:uweb:echo file:///data/data/info.torapp.uweb/files/app/reader/index.html?bookPath==%u

Last Modified: 24 September 2022
fix typos from torinfo.uweb to torapp.uweb