diff --git a/assets/src/components/Search.vue b/assets/src/components/Search.vue index 6829597f..b821df3f 100644 --- a/assets/src/components/Search.vue +++ b/assets/src/components/Search.vue @@ -20,7 +20,11 @@ {{ text }} @@ -184,10 +188,12 @@ export default { // In case of being a search. api.search(path, this.value, (event) => { - let url = event.data - if (url[0] === '/') url = url.substring(1) + let response = JSON.parse(event.data) + if (response.path[0] === '/') { + response.path = response.path.substring(1) + } - this.search.push(url) + this.search.push(response) this.scrollable.scrollTop = this.scrollable.scrollHeight }, (event) => { diff --git a/assets/src/css/header.css b/assets/src/css/header.css index 0fa0e7be..770a6a3a 100644 --- a/assets/src/css/header.css +++ b/assets/src/css/header.css @@ -177,11 +177,24 @@ header .search-button { #search.active #result i { color: #ccc; +} + +#search.active #result > p > i { text-align: center; margin: 0 auto; display: table; } +#search.active #result ul li a { + display: flex; + align-items: center; + padding: .3em 0; +} + +#search.active #result ul li a i { + margin-right: .3em; +} + #search::-webkit-input-placeholder { color: rgba(255, 255, 255, .5); } diff --git a/rice-box.go.REMOVED.git-id b/rice-box.go.REMOVED.git-id deleted file mode 100644 index 8aded46d..00000000 --- a/rice-box.go.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7327806da8feadd5f82e2286efb2e2dd44109d3e \ No newline at end of file diff --git a/websockets.go b/websockets.go index 50e07b73..2eff040d 100644 --- a/websockets.go +++ b/websockets.go @@ -2,6 +2,7 @@ package filemanager import ( "bytes" + "encoding/json" "mime" "net/http" "os" @@ -321,7 +322,12 @@ func search(c *RequestContext, w http.ResponseWriter, r *http.Request) (int, err } } - return conn.WriteMessage(websocket.TextMessage, []byte(path)) + response, _ := json.Marshal(map[string]interface{}{ + "dir": f.IsDir(), + "path": path, + }) + + return conn.WriteMessage(websocket.TextMessage, response) }) if err != nil {