2020-05-09 14:42:57 +00:00
|
|
|
|
<!doctype html>
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
<meta charset="utf-8">
|
2020-05-09 14:42:57 +00:00
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
2023-12-11 07:23:07 +00:00
|
|
|
|
|
2022-10-31 07:44:05 +00:00
|
|
|
|
<link rel="stylesheet" href="../style.css" type="text/css" />
|
2023-01-28 01:52:52 +00:00
|
|
|
|
<title>利用文件预处理预览/查看/播放可下载资源</title>
|
2022-06-30 03:43:09 +00:00
|
|
|
|
<script type="text/javascript">
|
2022-07-12 02:24:02 +00:00
|
|
|
|
function findLang(){
|
2022-06-30 03:43:09 +00:00
|
|
|
|
let href = location.href;
|
|
|
|
|
for(let i=href.length-1;i>0;i--){
|
|
|
|
|
if('/'==href.charAt(i) && '/'==href.charAt(i-3))
|
2022-07-12 02:24:02 +00:00
|
|
|
|
return i;
|
2022-06-30 03:43:09 +00:00
|
|
|
|
}
|
2022-07-12 02:24:02 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
function nav2(page){
|
|
|
|
|
let i = findLang();
|
|
|
|
|
location.href = location.href.substring(0,i+1)+page;
|
|
|
|
|
}
|
|
|
|
|
function nav2Lang(lang){
|
|
|
|
|
let i = findLang();
|
|
|
|
|
let href = location.href;
|
|
|
|
|
location.href = location.href.substring(0,i-2)+lang+location.href.substring(i);
|
2022-06-30 03:43:09 +00:00
|
|
|
|
}
|
|
|
|
|
</script>
|
2020-05-09 14:42:57 +00:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<header class='header'>
|
2022-06-30 03:43:09 +00:00
|
|
|
|
<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>
|
2022-07-12 02:24:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a class="logo" href="javascript:void(0)" onclick="return nav2Lang('en')">English</a>
|
|
|
|
|
|
|
|
|
|
|
2020-05-09 14:42:57 +00:00
|
|
|
|
<nav>
|
|
|
|
|
</nav>
|
|
|
|
|
</header>
|
2020-08-29 00:42:46 +00:00
|
|
|
|
<br />
|
2020-04-29 08:37:43 +00:00
|
|
|
|
|
2020-05-09 14:42:57 +00:00
|
|
|
|
<div class="container">
|
2023-01-28 01:52:52 +00:00
|
|
|
|
<h1 class="title">利用文件预处理预览/查看/播放可下载资源
|
2020-05-09 14:42:57 +00:00
|
|
|
|
<br>
|
|
|
|
|
<span class="subtitle"></span>
|
|
|
|
|
</h1>
|
|
|
|
|
<ul class="tags">
|
2020-04-29 08:37:43 +00:00
|
|
|
|
|
2023-12-11 07:23:07 +00:00
|
|
|
|
<li><a href="../tags/termux/index.html">termux</a> </li>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
|
2023-12-11 07:23:07 +00:00
|
|
|
|
<li><a href="../tags/curl/index.html">curl</a> </li>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
|
2020-05-09 14:42:57 +00:00
|
|
|
|
</ul>
|
|
|
|
|
<p>技巧等级:中级</p>
|
2022-07-09 00:45:17 +00:00
|
|
|
|
<p>文件预处理配置文件为default.filecap,每行格式如下:<br>
|
2020-05-09 14:42:57 +00:00
|
|
|
|
[文件后缀]:[mimetype]:[处理命令]</p>
|
|
|
|
|
<p>其中文件后缀可允许最多两段后缀,譬如"txt.xz","html.gz"。<br>
|
|
|
|
|
mimetype表示命令处理后的输出内容格式。<br>
|
2022-03-19 08:53:04 +00:00
|
|
|
|
处理命令与<a href="../cmd/index.html">default.cmds</a>相同,主要可能用到如下替换:<br>
|
2020-05-09 14:42:57 +00:00
|
|
|
|
%u(网址或文件路径)、%U(编码以后的网址)、%c(当前网址cookie)、%p(密码保护网站中的密码,curl格式)。</p>
|
2024-03-04 03:03:48 +00:00
|
|
|
|
<p>利用文件预处理,<a href="/zh/">超微浏览器</a>现在可以预览/查看/播放一切可下载资源,并且可以利用不同网站在线服务预览不同的文件,而手机上一个应用都不用装。</p>
|
2022-07-09 00:45:17 +00:00
|
|
|
|
<p>配置default.filecap如下:</p>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
<pre><code>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>'
|
2022-10-16 03:41:23 +00:00
|
|
|
|
doc:uweb:echo https://view.xdocin.com/view?src=%U
|
|
|
|
|
xls:uweb:echo https://view.xdocin.com/view?src=%U
|
|
|
|
|
ppt:uweb:echo https://view.xdocin.com/view?src=%U
|
|
|
|
|
docx:uweb:echo https://view.xdocin.com/view?src=%U
|
|
|
|
|
xlsx:uweb:echo https://view.xdocin.com/view?src=%U
|
|
|
|
|
pptx:uweb:echo https://view.xdocin.com/view?src=%U
|
2020-04-29 08:37:43 +00:00
|
|
|
|
xz:text/plain:curl %p "%u"|xz -d --</code></pre>
|
2022-03-19 08:53:04 +00:00
|
|
|
|
<p>安装过相应的<a href="../html5/index.html">html5应用</a>,则如下配置阅读相应格式文件:</p>
|
2022-09-24 06:12:26 +00:00
|
|
|
|
<pre><code>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</code></pre>
|
2020-08-24 02:55:05 +00:00
|
|
|
|
<p>长按设置按钮,勾选“文件预处理”,清后台重启浏览器。则网页上点击下载按钮时上述文件类型会自动预览。</p>
|
2022-03-19 08:53:04 +00:00
|
|
|
|
<p>如果用户配置中处理命令用到curl,则需要安装<a href="../gnuplot/index.html">Termux</a>,并在Termux中安装curl ("apt install curl")。<br>
|
2020-05-09 14:42:57 +00:00
|
|
|
|
如果用户不安装Termux,则上述配置命令中的"am"需要全部路径,需用"/system/bin/am"替换。</p>
|
2024-03-04 03:03:48 +00:00
|
|
|
|
<p>使用微软服务预览office文档 (https://view.officeapps.live.com/op/view.aspx?src=)必需当前UA为PC,否则会出现空白页面。有条件的用户建议使用google docs ("http://docs.google.com/gview?embedded=true&url=") 服务替换。</p>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
<p>若使用手机应用预览文件,则docx处理命令可改为:</p>
|
|
|
|
|
<pre>am start --user 0 -a android.intent.action.VIEW -d "%u" -t "application/docx"</pre>
|
2020-05-09 14:42:57 +00:00
|
|
|
|
<p>其余常见文件的类型名:<br>
|
|
|
|
|
application/msword<br>
|
|
|
|
|
application/msexcel<br>
|
|
|
|
|
application/pdf</p>
|
|
|
|
|
<p>目前已知服务:<br>
|
|
|
|
|
google docs, 功能强大,可查看几乎一切文档,但 "我的所爱在山腰,想要得到山太高。"</p>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
<p>微软office, 可预览office文档,ua必须是pc。</p>
|
|
|
|
|
|
|
|
|
|
</div>
|
2023-03-05 03:12:05 +00:00
|
|
|
|
<p>Last Modified: 28 January 2023<br>
|
2023-03-07 02:07:05 +00:00
|
|
|
|
minor changes for zh<br>
|
|
|
|
|
<pre></pre>
|
|
|
|
|
</p>
|
2023-05-09 03:11:05 +00:00
|
|
|
|
<script>
|
|
|
|
|
if(location.href.indexOf("/zh/")>0){
|
|
|
|
|
var script = document.createElement("script");
|
|
|
|
|
script.type = "text/javascript";
|
|
|
|
|
script.src = "../../js/gissues.js";
|
|
|
|
|
script.setAttribute("repo","jamesfengcao/uweb");
|
|
|
|
|
script.setAttribute("issue-term","title");
|
|
|
|
|
script.setAttribute("theme","github-light");
|
|
|
|
|
script.async = true;
|
|
|
|
|
document.body.appendChild(script);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2023-05-06 01:56:44 +00:00
|
|
|
|
<script id='jsgiscus'
|
|
|
|
|
src='https://giscus.app/client.js'
|
|
|
|
|
data-repo="torappinfo/uweb"
|
|
|
|
|
data-repo-id="MDEwOlJlcG9zaXRvcnkzMDIyMDU3MjE="
|
|
|
|
|
data-category="Announcements"
|
|
|
|
|
data-category-id="DIC_kwDOEgNLGc4CQjsh"
|
2023-05-06 02:49:29 +00:00
|
|
|
|
data-mapping="title"
|
2023-05-06 01:56:44 +00:00
|
|
|
|
data-strict="0"
|
|
|
|
|
data-reactions-enabled="1"
|
|
|
|
|
data-emit-metadata="0"
|
|
|
|
|
data-input-position="top"
|
|
|
|
|
data-theme="light"
|
|
|
|
|
data-lang="en"
|
|
|
|
|
data-loading="lazy"
|
2023-05-06 02:49:29 +00:00
|
|
|
|
crossorigin="anonymous" async>
|
2023-05-06 01:40:28 +00:00
|
|
|
|
</script>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
|
2020-05-09 14:42:57 +00:00
|
|
|
|
</body>
|
2020-04-29 08:37:43 +00:00
|
|
|
|
</html>
|