aboutsummaryrefslogtreecommitdiff
path: root/weed
diff options
context:
space:
mode:
Diffstat (limited to 'weed')
-rw-r--r--weed/server/filer_server_handlers_read_dir.go44
-rw-r--r--weed/server/filer_ui/templates.go19
2 files changed, 45 insertions, 18 deletions
diff --git a/weed/server/filer_server_handlers_read_dir.go b/weed/server/filer_server_handlers_read_dir.go
index 9ca0209f4..99345550c 100644
--- a/weed/server/filer_server_handlers_read_dir.go
+++ b/weed/server/filer_server_handlers_read_dir.go
@@ -2,6 +2,9 @@ package weed_server
import (
"context"
+ "encoding/base64"
+ "fmt"
+ "github.com/skip2/go-qrcode"
"net/http"
"strconv"
"strings"
@@ -65,21 +68,30 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
lastFileName,
shouldDisplayLoadMore,
})
- } else {
- ui.StatusTpl.Execute(w, struct {
- Path string
- Breadcrumbs []ui.Breadcrumb
- Entries interface{}
- Limit int
- LastFileName string
- ShouldDisplayLoadMore bool
- }{
- path,
- ui.ToBreadcrumb(path),
- entries,
- limit,
- lastFileName,
- shouldDisplayLoadMore,
- })
+ 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 {
+ Path string
+ Breadcrumbs []ui.Breadcrumb
+ Entries interface{}
+ Limit int
+ LastFileName string
+ ShouldDisplayLoadMore bool
+ QrImage string
+ }{
+ path,
+ ui.ToBreadcrumb(path),
+ entries,
+ limit,
+ lastFileName,
+ shouldDisplayLoadMore,
+ qrImageString,
+ })
}
diff --git a/weed/server/filer_ui/templates.go b/weed/server/filer_ui/templates.go
index 04a81433b..f86dde5b1 100644
--- a/weed/server/filer_ui/templates.go
+++ b/weed/server/filer_ui/templates.go
@@ -21,9 +21,11 @@ var funcMap = template.FuncMap{
var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOCTYPE html>
<html>
<head>
- <title>SeaweedFS Filer</title>
- <link rel="stylesheet" href="/seaweedfsstatic/bootstrap/3.3.1/css/bootstrap.min.css">
+ <title>SeaweedFS Filer</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="/seaweedfsstatic/bootstrap/3.3.1/css/bootstrap.min.css">
<style>
+body { padding-bottom: 70px; }
#drop-area {
border: 1px transparent;
}
@@ -46,6 +48,11 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
#fileElem {
display: none;
}
+.qrImage {
+ display: block;
+ margin-left: auto;
+ margin-right: auto;
+}
</style>
</head>
<body>
@@ -116,6 +123,14 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(`<!DOC
</a>
</div>
{{end}}
+
+ <br/>
+ <br/>
+
+ <div class="navbar navbar-fixed-bottom">
+ <img src="data:image/png;base64,{{.QrImage}}" class="qrImage" />
+ </div>
+
</div>
</body>
<script type="text/javascript">