|
@ -2,6 +2,9 @@ package weed_server |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"context" |
|
|
"context" |
|
|
|
|
|
"encoding/base64" |
|
|
|
|
|
"fmt" |
|
|
|
|
|
"github.com/skip2/go-qrcode" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"strconv" |
|
|
"strconv" |
|
|
"strings" |
|
|
"strings" |
|
@ -65,7 +68,15 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque |
|
|
lastFileName, |
|
|
lastFileName, |
|
|
shouldDisplayLoadMore, |
|
|
shouldDisplayLoadMore, |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
|
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var qrImageString string |
|
|
|
|
|
img, err := qrcode.Encode(fmt.Sprintf("http://%s:%d%s", fs.option.Host, fs.option.Port, r.URL.Path), qrcode.Medium, 128) |
|
|
|
|
|
if err == nil { |
|
|
|
|
|
qrImageString = base64.StdEncoding.EncodeToString(img) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ui.StatusTpl.Execute(w, struct { |
|
|
ui.StatusTpl.Execute(w, struct { |
|
|
Path string |
|
|
Path string |
|
|
Breadcrumbs []ui.Breadcrumb |
|
|
Breadcrumbs []ui.Breadcrumb |
|
@ -73,6 +84,7 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque |
|
|
Limit int |
|
|
Limit int |
|
|
LastFileName string |
|
|
LastFileName string |
|
|
ShouldDisplayLoadMore bool |
|
|
ShouldDisplayLoadMore bool |
|
|
|
|
|
QrImage string |
|
|
}{ |
|
|
}{ |
|
|
path, |
|
|
path, |
|
|
ui.ToBreadcrumb(path), |
|
|
ui.ToBreadcrumb(path), |
|
@ -80,6 +92,6 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque |
|
|
limit, |
|
|
limit, |
|
|
lastFileName, |
|
|
lastFileName, |
|
|
shouldDisplayLoadMore, |
|
|
shouldDisplayLoadMore, |
|
|
|
|
|
qrImageString, |
|
|
}) |
|
|
}) |
|
|
} |
|
|
|
|
|
} |
|
|
} |