miniserve icon indicating copy to clipboard operation
miniserve copied to clipboard

How about add "delete file" feature?

Open Nillouise opened this issue 3 years ago • 11 comments

After I do some research on many mini http server, miniserve is a great work, which have authentication. But I also have found many mini http servers did not have "delete file" feature including miniserve.

I think "delete file" will be a good point to a mini http server, especially it can combine the authntication.

Nillouise avatar Oct 16 '20 14:10 Nillouise

Another Rust static file server with file deletion feature but less friendly UI: https://github.com/thecoshman/http.

NOBLES5E avatar Apr 24 '21 17:04 NOBLES5E

I have some time and would like to work on this. But first I have some questions regarding CLI flags.

There are several options as I see it:

  1. No new flags. Piggy-back on the existing [-u|--upload-files] and [-U|--mkdir] flags. -u allows rm and -U allows rm -rf.
  2. One new flag that allows both deleting files and directories.
  3. Two flags, one for files and one for directories.

The later options allow more granular control, but it could be teetering on the edge of over-engineering.

I personally like option 2 the most, because:

  1. compared to option 1, the granularity is justified, especially considering its relationship to the existing [-o|--overwrite-files] flag.
  2. it's not overdoing the granularity either, because it makes little sense to not allow removing entire directories, when a user can just delete all the files one by one.
  3. There are already many existing short flags. None of -r, -d, -D is available. The only reasonable one remaining is -R, which makes only 1 flag desirable.

@svenstaro let me know what you think.

cyqsimon avatar Mar 21 '23 12:03 cyqsimon

I think option 2. does indeed sound reasonable. Would be happy if you wanted to take a stab at this. Should be fairly easy too. Make sure to use non-blocking deletion though as it can take a long time to recursively delete some stuff.

svenstaro avatar Mar 21 '23 12:03 svenstaro

Has this feature been completed? In what version can it be used?

humbinal avatar May 14 '23 11:05 humbinal

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job.

TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

cyqsimon avatar May 14 '23 12:05 cyqsimon

@cyqsimon Ok, I see. Thank you very much !

humbinal avatar May 16 '23 00:05 humbinal

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job.

TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

Has this feature been completed?

gocpplua avatar Jan 25 '24 02:01 gocpplua

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job. TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

Has this feature been completed?

If I had a cent for every time I promised to do something then promptly forgot about it, I'd be doing that all day. No, probably it's enough to buy me a Big Mac or something.

Jokes aside, thanks for reminding me. Sometimes I do need some peer pressure to stop my procrastination. I've finished the prototype implementation today; please check out #1093. You can try it out like so:

cargo run -- --rm-files -- <DIR>

Note that in the current implementation, deletion is permanent. So it's probably a good idea to try it out on a temp dir. I'm not responsible for any of your data loss.

cyqsimon avatar Jan 26 '24 09:01 cyqsimon

Not yet. My original plan was to work on it last month, but then I went on a family vacation, and immediately afterward got a new job. TLDR is I'm kind of busy now. I will likely get some spare time early June, so that'll likely be when I can produce a working prototype.

Has this feature been completed?

If I had a cent for every time I promised to do something then promptly forgot about it, I'd be doing that all day. No, probably it's enough to buy me a Big Mac or something.

Jokes aside, thanks for reminding me. Sometimes I do need some peer pressure to stop my procrastination. I've finished the prototype implementation today; please check out #1093. You can try it out like so:

cargo run -- --rm-files -- <DIR>

Note that in the current implementation, deletion is permanent. So it's probably a good idea to try it out on a temp dir. I'm not responsible for any of your data loss.

Haha, thank you very much

gocpplua avatar Feb 04 '24 00:02 gocpplua