add uptodown link
[uweb.git] / en / filecap / index.html
blob7ecf4a0fcab2d7a8fd82e6fb66e2bd9f38f248eb
1 <!doctype html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1" />
6 <link rel="canonical" href="https://jamesfengcao.gitlab.io/uweb/en/filecap/" />
8 <link rel="stylesheet" href="../style.css#" type="text/css" />
9 <title>Custom file handling</title>
10 <script>
11 function findLang(){
12 let href = location.href;
13 for(let i=href.length-1;i>0;i--){
14 if('/'==href.charAt(i) && '/'==href.charAt(i-3))
15 return i;
17 return 0;
19 function nav2(page){
20 let i = findLang();
21 location.href = location.href.substring(0,i+1)+page;
23 function nav2Lang(lang){
24 let i = findLang();
25 let href = location.href;
26 location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
28 </script>
29 </head>
30 <body>
31 <header class='header'>
32 <a class="logo" href="javascript:void(0)" onclick="return nav2('index.html#')">Home</a> <a class="logo" href="javascript:void(0)" onclick="return nav2('tags/index.html#')">Tags</a>
35 <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
38 <nav>
39 </nav>
40 </header>
41 <br />
43 <div class="container">
44 <h1 class="title">Custom file handling
45 <br>
46 <span class="subtitle"></span>
47 </h1>
48 <ul class="tags">
50 <li><a href="../tags/termux/index.html#">termux</a> </li>
52 <li><a href="../tags/curl/index.html#">curl</a> </li>
54 </ul>
55 <p>Long press the settings button, check the option &quot;custom file handling&quot; to enable the functionality.</p>
56 <p>The custom file handling configuration file is &quot;default.filecap&quot;, each line of it has the format as follows:<br>
57 [file extension]:[mimetype]:[command line]</p>
58 <p>The &quot;[file extension]&quot; part can have at most two-segment of extensions such as &quot;txt.xz&quot;,&quot;html.gz&quot;.<br>
59 &quot;[mimetype]&quot; indicates the type of &quot;[command line]&quot; output.<br>
60 &quot;[command line]&quot; is same as the one in <a href="../cmds/index.html#">default.cmds</a>. The most often used replacements are:<br>
61 %u (url), %U (urlencoded url), %c (cookie), %p (site password, curl format).</p>
62 <p>default.filecap example:</p>
63 <pre><code>txt:text/html:curl %p "%u"
64 mp3:text/html:echo '&lt;audio controls width=100% height=100%>&lt;source src="%u">&lt;/audio>'
65 m4b:text/html:echo '&lt;audio controls width=100% height=100%>&lt;source src="%u">&lt;/audio>'
66 m3u8:text/html:echo '&lt;video controls width=100% height=100%>&lt;source src="%u">&lt;/video>'
67 mp4:text/html:echo '&lt;video controls width=100% height=100%>&lt;source src="%u">&lt;/video>'
68 mkv:text/html:echo '&lt;video controls width=100% height=100%>&lt;source src="%u">&lt;/video>'
69 doc:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
70 xls:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
71 ppt:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
72 docx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
73 xlsx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
74 pptx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
75 xz:text/plain:curl %p "%u"|xz -d --</code></pre>
76 <p>Examples for <a href="../html5/index.html#">html5 application</a>:</p>
77 <pre><code>pdf:uweb:echo file:///data/data/info.torapp.uweb/files/app/pdf.js/web/viewer.html?file=%u
78 djvu:uweb:echo file:///data/data/info.torapp.uweb/files/app/djvu.html?url=%u
79 epub:uweb:echo file:///data/data/info.torapp.uweb/files/app/reader/index.html#?bookPath==%u</code></pre>
81 </div>
82 <p>Last Modified: 2 April 2024<br>
83 add js function in README<br>
84 <pre></pre>
85 </p>
87 <script id='jsgiscus'
88 src='https://giscus.app/client.js'
89 data-repo="torappinfo/uweb"
90 data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
91 data-category="Announcements"
92 data-category-id="DIC_kwDOEgNLGc4CQjsh"
93 data-mapping="title"
94 data-strict="0"
95 data-reactions-enabled="1"
96 data-emit-metadata="0"
97 data-input-position="top"
98 data-theme="light"
99 data-lang="en"
100 data-loading="lazy"
101 crossorigin="anonymous" async>
102 </script>
104 <footer class="site-footer">
105 <div class="container">
106 &copy; 2018-2024 Richard H. Cao
107 </div>
108 </footer>
109 <!-- This document is licensed under the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available at <https://www.gnu.org/licenses/>. -->
112 </body>
113 </html>