GithubHelp home page GithubHelp logo

sigoden / dufs Goto Github PK

View Code? Open in Web Editor NEW
4.7K 4.7K 231.0 618 KB

A file server that supports static serving, uploading, searching, accessing control, webdav...

License: Other

Rust 83.37% CSS 1.75% HTML 2.93% JavaScript 11.65% Dockerfile 0.16% Shell 0.15%
cloud-disk command-line file-sharing file-upload-server rust static-server webdav webdav-server

dufs's People

Contributors

aneeshusa avatar davidpolitis avatar elmtran avatar figsoda avatar horizon0514 avatar jessehu avatar jkoop avatar kianmeng avatar moonfruit avatar muxiu1997 avatar nq5 avatar plantatorbob avatar ragebflame avatar ryanrussell avatar sigoden avatar sprat avatar tieway59 avatar tinytinni avatar tobyp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dufs's Issues

Rename duf to dufs

There's another tool also called duf whose command is also duf.

Various Linux distributions (Arch Linux, Debian, Nix, etc) already provide a package named duf that provides the other duf.

Proposal: Rename this tool to allow users to use it without name/file conflict.

Search sometimes results in "fatal runtime error"

Problem

With some search terms I run into the following error:

$ dufs --allow-search -p 8080 -b 192.168.0.1
Listening on:
  http://192.168.0.1:8080/

2022-07-02T14:53:42+02:00 INFO - 192.168.0.113 "GET /" - 200

thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow
Aborted
$

I don't see why this happens: some search terms don't work even though they yield fewer results than others that do work.

Whatever the cause might be, I think dufs should try to return an error page with (maybe with HTTP 500 or 503) instead of terminating completely. I'd rather not start dufs in a while (true) loop. 😉

Log

See above.

Environment:

  • Dufs version: 0.23.1
  • Browser/Webdav Info: Chrome/101.0.4951.67
  • OS Info: Win10 21H2

日志时间

日志时间为世界时间,能不能启用北京时间啊,哪怕给个参数也可以

Docker pull 镜像出现 500 网络错误

(base) [root@tx_01 ~]# docker pull sigoden/dufs
Using default tag: latest
latest: Pulling from sigoden/dufs
5d874ac73acd: Pulling fs layer 
error pulling image configuration: received unexpected HTTP status: 500 Internal Server Error

分别在阿里和腾讯以及本地服务器都尝试进行镜像下拉,全部报这个错误。

safari not show layout correctly

Problem

The Safari browser seems to not show the layout correctly (both macOS and iOS Safari). The spacing between two lines is too big and the "Actions" logo is not aligned either.
Here is Safari:
image
Here is the normal Chrome:
image

Environment:

  • Dufs version: 0.23.0
  • Browser/Webdav Info: Safari 15.5 (17613.2.7.1.8)
  • OS Info: macOS 12.4

bug: filenames aren't properly escaped in WebDAV PROPFIND

To reproduce the issue, create a folder with a file called This & that. Try to mount the folder via WebDAV. See it fail (possibly with an XML parse error).

Excerpts from the PROPFIND response from duf and apache2:

<!-- duf -->
<D:href>/path/to/This & that</D:href>
<D:displayname>This & that</D:displayname>
<!-- apache2 -->
<D:href>/path/to/This%20&amp;%20that</D:href>

直接在chrome上浏览文本文件,中文显示乱码

Problem

  • 创建F:\测试文件.txt,并往里面填入中文,保存为utf8格式
  • win10的cmd运行:.\dufs.exe -p 80 F:\测试文件.txt
  • Chrome的地址栏输入:127.0.0.1即可显示测试文件.txt的内容,但是中文部分是乱码。

乱码如下截图
image

测试文件.txt文件内容为:

中文字体
english

如果将测试文件.txt另存为带有BOM的UTF-8,则Chrome上显示正常。

Environment:

  • Dufs version: 0.26.0
  • Browser/Webdav Info: Chrome 103.0.5060.114
  • OS Info: Windows 10

create/delete folder

Hi sigoden, thanks for your development, this tool helps me a lot. Just love it.

Sometimes, when I upload new files and want to classify them from previous ones, I will create a folder and put them is there.
Since dufs does not support creating new folder on web UI, I have to go to the terminal and run mkdir command.
So if create/delete folder is supported on web UI, it will be very helpful.

Hope to hear your opinion.
Thanks in advance.

corrupted files in zipped files

I'm experiencing issues when extracting files form an zip-archive. Downloading the individual .jpg files works fine, but they become corrupted during the zipping process and/or download.

Version: 0.22.0
OS: Ubuntu 18.04
Browser: FF 99.0

Can I hidden all hidden files?

Specific Demand

Can I hidden all hidden files?

Implement Suggestion

--hidden .* or other option
If you have any suggestion for complete this feature, you can tell us.
I want to hidden all hidden files, but not I can only hidden them by names.

使用idm+工具下载进度卡在99%

  • 版本:0.16和0.17
  • 操作系统:windows10
  • 下载文件:视频文件(mkv和mp4都有出现)
  • 现象:使用多线程下载,进度卡在99%,对比文件大小缺失3个字节。服务端这边一直重复打印

retry when upload fail

while uploading a whole folder, some files may fail.
image
Maybe a retry button could be helpful, or auto retry could be better.

[Feature Request] enhance --render-index functionality

First of all, this is a very cool tool, so thank you for the development efforts. The addition of the --render-index argument is great. This might not be a common use case, but I've got a file server that is probably 50/50 split, where half of the directories contain an index.html and half do not. Currently, when I set that flag, any directory that doesn't have an index.html file just renders a blank page (404 from the server, since the file wasn't found).

Is there any way to make that argument kick in when there is a index.html file present, but fall back to the default rendering of a directory if not? Would be a very nice enhancement.

qnap挂载webdav问题(小众)

Problem
./dufs --enable-cors -a /temp@admin:admin@* -a /@admin:admin -A -- folder
比较奇怪的问题, 账号权限都对, 在威联通挂载根目录 http://aa.com:5000/ 不行, 但是 http://aa.com:5000/temp 就可以

可能是qnap比较特殊,因为手机mixplorer就没问题. 问题比较小众, 只是想挂载为目录用, 对大部分不影响

Log

2022-07-11T08:12:57Z INFO - 18ip9 "PROPFIND /" - 401
2022-07-11T08:13:11Z INFO - 18ip9 "PROPFIND /temp" - 207

Environment:

  • Dufs version: 0.26
  • Browser/Webdav Info: qnap
  • OS Info: qnap

symbolic links to external drives are not listed

Problem

as the title suggests, symbolic links linked to external disks are not listed.

Environment:

  • Dufs version: 0.26.0
  • Browser/Webdav Info: brave on android and librewolf on linux
  • OS Info: Arch Linux

Full webdav support

Specific Demand

It would seem that running the litmus test suite (https://github.com/tolsen/litmus / http://webdav.org/neon/litmus/) gives only a very partial webdav support (a lot of errors with copy and move, notably non support of directories, etc.).

It seems that the partial support causes problems when for example copying from command line in linux on a mounted (with gnome file manager) dav : the copy is stuck...

Implement Suggestion

It would be nice that the webdav server complies with (at least), the "http basic copymove locks props" tests of the litmus test suite.

Best regards.

[Feature request] File encryption

Hello,
Thanks for this amazing work.
It would be nice to have an option to encrypt files in place providing a key as argument.
That should be probably achievable with something like described here : https://kerkour.com/rust-file-encryption, apart from the tricky part of working out the real file size from the encrypted file size... and to store a generated per file nonce as an encrypted file header, so that the nonce is not the same for each file, but recoverable from the file itself...
Best regards.

auth timeout question

Hi sigoden,

I'm wondering if there is a time limit for the auth.

Cuz sometimes after several minutes, the auth dialog pops up again. The duration is not quite sure, so that's why I inquire.

And due to the circumstances above, When I upload a large number of files, the latter parts may fail. After the failure shows up, I refresh the page, and the auth dialog pops up, so I guess losing the auth session caused that, maybe.

Please share your opinion on this, Thanks.

单个文件不能共享,能否解决一下 谢谢

duf.exe -p 9999 -- "Q:\ONEDRIVE\5T\OneDrive - automation\plc\松下a4a5接线.xlsx"
duf.exe -p 9999 -- Q:\ONEDRIVE\15G\OneDrive\USB设备共享\网盘\miniserver\CMD.bat

单个文件不能共享,能否解决一下 谢谢

[Suggestion] Web static directory support

I tried to write a web page suitable for "duf" by myself. The main layout was referenced from h5ai, and it was packaged with Webpack, but the packaged pictures were scattered. Can Web Static Directory Support be Added? When the browser requests any file, it requests the files in the "assets" directory.

Limit the number of concurrent uploads

Specific Demand

Why limit number of concurrent uploads?

  1. allow some uploads to finish faster
  2. chrome seems to allow 6 concurrent uploads
  3. reduce the probability of upload failure in poor network connectivity

Maybe we should limit the number of concurrent uploads to 3.

Not Found when file name contains HTML escape code

Steps to reproduce

  1. Create a file whose name contains an HTML escape code:
    echo hello > 'abc&amp;def.txt'
  2. Run dufs to serve the folder that contains the created file.
  3. Open https://localhost:5000/ in Google Chrome.
  4. The file with name abc&amp;def.txt is nowhere to be found. Instead, there is abc&def.txt. Click the file.

Expected behavior

  • After step 3, the file with name abc&amp;def.txt should appear.
  • After clicking abc&amp;def.txt, the text hello should appear.

Actual behavior

  • The file with the correct name does not appear.
  • The file with the incorrect predictably leads to Not Found.

Notes

Using Nautilus to access the file via WebDAV (dav://localhost:5000/) works fine.

Additional suggestions

This flaw is probably caused by text being inserted directly to the constructed HTML page without escape, sanitization, or any form of text processing. This is dangerous as it could lead to some form of code injection attack. I am not just referring to this one bug, I am referring to other potential bugs that are similar to this.

Request:

  • Examine the whole codebase to find similar bugs.
  • Use a proven library/framework to generate the directory page instead of doing it manually. For example, miniserve (a similar program to dufs) uses maud to generate its directory page.

CORS needs 'Access-Control-Allow-Methods' header

Problem
Im trying to upload files to a Dufs server from an other server over http.
For this I run the Dufs server with this command, to anable CORS: dufs -A --enable-cors
But the PUT Request I send to the Server is blocked with the following error message:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at xxx. (Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’).

After looking in to the server.rs I found that in the add_cors function only the AccessControlAllowOrigin, AccessControlAllowCredentials and AccessControlAllowHeaders headers are set. However WebDav needs the PUT method and therefor the AccessControlAllowMethods header is needed.

Environment:

  • Dufs version: 0.25.0
  • Browser/Webdav Info: Firefox Version 102.0.1
  • OS Info: Windows 11

suggestion: webdav support

It doesn't need to be fancy, just respond correctly to OPTIONS and PROPFIND for readonly support. Although, of couse, full support would be nice.

image

Generate completion file

Specific Demand

dufs has almost 20 options, it is necessary to generate completion files.

Implement Suggestion

We will use clap_complete crate to generate completion scripts.

A new option --completions will be added.

cannot bind address 0.0.0.0

I cannot bind address 0.0.0.0, as a result, i cannot use the public IP to access the file server.
I found out the source code of args.rs just filter out the address, why?

Search not working with `--render-try-index`

First of all: thanks for this amazing little tool. I just discovered it a few minutes ago, but I already fell in love with it. Small, standalone, feature-rich aaaaand, at last, a file server with an easy upload function! Ticking all the right boxes for me! 👍

Now for the small problem I have...


Problem

I ran dufs with the following parameters:

$ dufs -A -p 8080 --render-try-index

Unfortunately, the search didn't work: whatever search term I entered, it would always just show the current directory's index. Also, it didn't matter if the search result would be within the current folder or in some directories below it.

Out of curiosity, I tried without --render-try-index and now the search function does work as expected (even recursively as I had hoped 🤓 ).

It would be great if we could use --render-try-index together with --allow-search. Index pages would take precedence and would deny any further processing of URL query parameters, such as ?q=.... But if no index file is found, the search should just work as if the --render-try-index option had not been set.

Log

N/A

Environment:

  • Dufs version: 0.23.1
  • Browser/Webdav Info: Chrome/101.0.4951.67
  • OS Info: Win10 21H2

Support move file

Specific Demand

I use dufs to manage my auto downloads folder, I need to arrange the files from the default download folder when downloaded, so if there is a move action, allow me moving file from one path to another path.

Implement Suggestion

maybe offer a move action, and allow to choose target folder

Render index.html

It would be great if there was an option like miniserve's:

--index <index_file>
The name of a directory index file to serve, like "index.html"

webdav 无法在 Koreader 里面打开

您好,我最近发现这个项目挺高兴的,下载了可执行文件后,就可以在我的电脑上开启 web 服务,将里面的文件分享出来。

然后我平时有一个需求,就是使用开源的阅读器 https://github.com/koreader/koreader 来阅读。这个软件有手机版本,也有 kindle 版本,所以我平时使用频率挺高的。

里面有一个云存储的功能,可以添加 webdav 地址,这样就可以在手机或者 kindle,直接下载 webdav 服务器里面的书籍了。但是我发现在软件里,无法访问 dufs 开启的 webdav 服务。

如果我不设置密码,使用手机访问,电脑终端这边会显示

2022-06-24T13:46:55+08:00 INFO - 192.168.68.211 "PROPFIND //" - 404

如果我添加账号密码,则会显示这样

$dufs --allow-upload -a /@admin:123
Listening on:
  http://127.0.0.1:5000/
  http://192.168.68.4:5000/
  http://[::1]:5000/

2022-06-24T13:58:00+08:00 INFO - ::1 "GET /" - 401
2022-06-24T13:58:06+08:00 INFO - ::1 "GET /" - 200
2022-06-24T13:58:23+08:00 INFO - 192.168.68.211 "PROPFIND //" - 401
2022-06-24T14:00:14+08:00 INFO - 192.168.68.211 "PROPFIND //" - 401

我使用过另外一个 webdav 应用 https://github.com/hacdias/webdav
这个可以在 Koreader 里面访问。

不知道问题出现在哪,期待大佬的解答。

suggestion: support SPA fallback in duf

It can be very useful to setup a simple server for SPA (Single Page Application)

  1. similar to "--spa" switch in miniserve
  2. try_files in Nginx
location / {
    root .../dist
    index ...index.html
    try_files $uri $uri/ /index.html;
}

[Suggestion] Add icon

Duf does not have an icon, a logo, a favicon in the browser. It would be interesting to add one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.