index.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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="stylesheet" href="../style.css#" type="text/css" />
  7. <title>Custom file handling</title>
  8. <script type="text/javascript">
  9. function findLang(){
  10. let href = location.href;
  11. for(let i=href.length-1;i>0;i--){
  12. if('/'==href.charAt(i) && '/'==href.charAt(i-3))
  13. return i;
  14. }
  15. return 0;
  16. }
  17. function nav2(page){
  18. let i = findLang();
  19. location.href = location.href.substring(0,i+1)+page;
  20. }
  21. function nav2Lang(lang){
  22. let i = findLang();
  23. let href = location.href;
  24. location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
  25. }
  26. </script>
  27. </head>
  28. <body>
  29. <header class='header'>
  30. <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>
  31. <a class="logo" href="javascript:void(0)" onclick="return nav2Lang('zh')">简体中文</a>
  32. <nav>
  33. </nav>
  34. </header>
  35. <br />
  36. <div class="container">
  37. <h1 class="title">Custom file handling
  38. <br>
  39. <span class="subtitle"></span>
  40. </h1>
  41. <ul class="tags">
  42. <li><a href="../tags/termux/index.html#">termux</a> </li>
  43. <li><a href="../tags/curl/index.html#">curl</a> </li>
  44. </ul>
  45. <p>Long press the settings button, check the option &quot;custom file handling&quot; to enable the functionality.</p>
  46. <p>The custom file handling configuration file is &quot;default.filecap&quot;, each line of it has the format as follows:<br>
  47. [file extension]:[mimetype]:[command line]</p>
  48. <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>
  49. &quot;[mimetype]&quot; indicates the type of &quot;[command line]&quot; output.<br>
  50. &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>
  51. %u (url), %U (urlencoded url), %c (cookie), %p (site password, curl format).</p>
  52. <p>default.filecap example:</p>
  53. <pre><code>txt:text/html:curl %p "%u"
  54. mp3:text/html:echo '&lt;audio controls width=100% height=100%>&lt;source src="%u">&lt;/audio>'
  55. m4b:text/html:echo '&lt;audio controls width=100% height=100%>&lt;source src="%u">&lt;/audio>'
  56. m3u8:text/html:echo '&lt;video controls width=100% height=100%>&lt;source src="%u">&lt;/video>'
  57. mp4:text/html:echo '&lt;video controls width=100% height=100%>&lt;source src="%u">&lt;/video>'
  58. mkv:text/html:echo '&lt;video controls width=100% height=100%>&lt;source src="%u">&lt;/video>'
  59. doc:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
  60. xls:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
  61. ppt:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
  62. docx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
  63. xlsx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
  64. pptx:uweb:echo http://docs.google.com/gview?embedded=true&url=%U
  65. xz:text/plain:curl %p "%u"|xz -d --</code></pre>
  66. <p>Examples for <a href="../html5/index.html#">html5 application</a>:</p>
  67. <pre><code>pdf:uweb:echo file:///data/data/info.torapp.uweb/files/app/pdf.js/web/viewer.html?file=%u
  68. djvu:uweb:echo file:///data/data/info.torapp.uweb/files/app/djvu.html?url=%u
  69. epub:uweb:echo file:///data/data/info.torapp.uweb/files/app/reader/index.html#?bookPath==%u</code></pre>
  70. </div>
  71. <p>Last Modified: 2 April 2024<br>
  72. add js function in README<br>
  73. <pre></pre>
  74. </p>
  75. <script id='jsgiscus'
  76. src='https://giscus.app/client.js'
  77. data-repo="torappinfo/uweb"
  78. data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
  79. data-category="Announcements"
  80. data-category-id="DIC_kwDOEgNLGc4CQjsh"
  81. data-mapping="title"
  82. data-strict="0"
  83. data-reactions-enabled="1"
  84. data-emit-metadata="0"
  85. data-input-position="top"
  86. data-theme="light"
  87. data-lang="en"
  88. data-loading="lazy"
  89. crossorigin="anonymous" async>
  90. </script>
  91. <footer class="site-footer">
  92. <div class="container">
  93. &copy; 2018-2024 Richard H. Cao
  94. </div>
  95. </footer>
  96. <!-- 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/>. -->
  97. </body>
  98. </html>