CuteHttpFileServer/chfs是一个免费的、HTTP协议的文件共享服务器,使用浏览器可以快速访问。它具有以下特点:
单个文件,整个软件只有一个可执行程序,无配置文件等其他文件跨平台运行,支持主流平台:Windows,Linux和Mac界面简洁,简单易用支持扫码下载和手机端访问,手机与电脑之间共享文件非常方便支持账户权限控制和地址过滤支持快速分享文字片段支持webdav协议使用 chfs 主要是因为它简单且跨平台,虽然没有开源,但还是可以通过配置文件进行改装,扩展
官网地址:http://iscute.cn/chfs
启动命令:chfs --file config.ini
自定义页面 1. 去除广告作者为了宣传,特意在页面底部加上了自己联系方式和捐助链接
所以我们如何去除呢?让看起来是没有广告的。
从官网的文档可以看到用户还可以写一个配置文件,配置文件中有这样一段话:
居然可以加HTML标签,那么javascript呢?当然也是可以的,好吧,直接上配置:
<h3 style="text-align: center;color: dimgray;">xxx 文件管理系统h3>
<script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.slim.min.js">script>
<script>// 去除底部广告
$(document).ready(function () {
$('.footer')[0].remove();
});script>
因为配置是一行, 压缩下代码,总的配置文件如下 config.ini:
port=7000path=/home/testhadoop/www/share
log=/home/testhadoop/chfs/log.log
html.title=大数据测试用例文件管理
html.notice=` xxx 文件管理系统
2. 动态修改文件的链接
这里为了支持某些文件直接在线打开,所以要改变文件的url
<h3 style="text-align: center;color: dimgray;">xxx 文件管理系统h3>
<script src="https://cdn.bootcss.com/jquery/3.4.0/jquery.slim.min.js">script>
<script>// 去除底部广告
$(document).ready(function () {
$('.footer')[0].remove();
});// 当文件时思维导图时,替换 url 调用直接打开接口 window.onload = function () {
$('#table').hover(function () {
$('#filelist a[style="margin-left:3px;"]').each(function (i, e) {if (e.href.endsWith('.xmind') || e.href.endsWith('.mmap')) {
e.href = e.href.replace('http://172.22.145.101:7000/shared', 'http://172.22.145.101:8090/tool/mind?path=/home/testhadoop/www/share')
}
})
})
}script>
同1, 把这段代码压缩和放在 html.notice 中就可以了,记得要用 ``括起来, 最终效果:
port=7000path=/home/testhadoop/www/share
log=/home/testhadoop/chfs/log.log
html.title=测试文件管理
html.notice=` "text-align: center;color: dimgray;">测试文件管理系统