From 586b209c89bc333fa5f73a47c163be83a420e5bc Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 29 May 2022 12:43:40 +0800 Subject: [PATCH] feat: support searching --- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 3 +- src/index.css | 50 +++++++++++++++-- src/index.html | 36 ++++++++---- src/server.rs | 146 +++++++++++++++++++++++++++++-------------------- 6 files changed, 160 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e2d6949c2..c2bcbb487 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -258,7 +258,7 @@ dependencies = [ [[package]] name = "duf" -version = "0.2.1" +version = "0.3.0" dependencies = [ "async-walkdir", "async_zip", diff --git a/Cargo.toml b/Cargo.toml index beb81b489..2ef2d4b38 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "duf" -version = "0.2.1" +version = "0.3.0" edition = "2021" authors = ["sigoden "] description = "Duf is a simple file server." diff --git a/README.md b/README.md index 79ebe8f91..3228e8886 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,13 @@ Duf is a simple file server. -![demo](https://user-images.githubusercontent.com/4012553/170822562-c6594de5-0bb2-4d5e-ba66-5731ab6481fd.png) +![demo](https://user-images.githubusercontent.com/4012553/170853143-05dc713e-f0d5-478d-baea-0914599b846c.png) ## Features - Serve static files - Download folder as zip file +- Search files - Upload files - Delete files - Basic authentication diff --git a/src/index.css b/src/index.css index 88f3f45af..718f7b4f6 100644 --- a/src/index.css +++ b/src/index.css @@ -4,16 +4,17 @@ html { color: #24292e; } +body { + width: 700px; +} + .head { display: flex; - align-items: baseline; + flex-wrap: wrap; + align-items: center; padding: 1em 1em 0; } -.head input { - display: none; -} - .breadcrumb { font-size: 1.25em; } @@ -44,11 +45,50 @@ html { padding-left: 0.5em; } +.toolbox { + display: flex; +} + +.searchbar { + display: flex; + flex-wrap: nowrap; + width: 246px; + height: 22px; + background-color: #fafafa; + transition: all .15s; + border: 1px #ddd solid; + border-radius: 15px; + margin: 0 0 2px 10px; +} + +.searchbar #search { + box-sizing: border-box; + width: 100%; + height: 100%; + font-size: 16px; + line-height: 16px; + padding: 1px; + font-family: helvetica neue,luxi sans,Tahoma,hiragino sans gb,STHeiti,sans-serif; + background-color: transparent; + border: none; + outline: none; +} + +.searchbar .icon { + color: #9a9a9a; + padding: 3px 3px; + cursor: pointer; +} + .upload-control { cursor: pointer; padding-left: 0.25em; } +.upload-control input { + display: none; +} + .main { padding: 0 1em; } diff --git a/src/index.html b/src/index.html index e330dbc74..1009c16fa 100644 --- a/src/index.html +++ b/src/index.html @@ -10,11 +10,20 @@
-
- - - +
+
+ + + +
+
@@ -34,7 +43,7 @@