aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoni Sawicki <tenox@google.com>2022-03-24 01:07:14 -0700
committerAntoni Sawicki <tenox@google.com>2022-03-24 01:07:14 -0700
commitaf8f944cd6a504c011f6fee40597909d5d511e35 (patch)
tree966af656df45291d9c19b30f2c86dc717304ad4f
parentf959058f7b6565e21d0a6d2ef80779bd4a06cfe6 (diff)
downloadwfm-af8f944cd6a504c011f6fee40597909d5d511e35.tar.gz
add total bytes line
-rw-r--r--TODO.md7
-rw-r--r--dir.go6
2 files changed, 7 insertions, 6 deletions
diff --git a/TODO.md b/TODO.md
index f97f055..b797c71 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,6 +1,6 @@
# WFM TODO
-## General
+## Interfaces
* webdav server
* FastCGI Interface
@@ -24,12 +24,10 @@
## ACME / Auto Cert Manager
* acme dir with key/cert is exposed inside chroot dir
- obtain acme cert before chroot?? self call https?
- get and preload cert manually on start?
+ get and preload cert manually on start before chroot?
hide acm cache dir?
* try https://github.com/go-acme/lego
-
## Layout / UI
* add flag to specify own favicon.ico
* top bar too long on mobile/small screen
@@ -41,7 +39,6 @@
* separate icons for different file types like images, docs, etc
* errors in dialog boxes instead of plain text
* html as template
-* total bytes on the last line
## File IO
* exclude/hide folders based on list
diff --git a/dir.go b/dir.go
index e30549f..e6a7994 100644
--- a/dir.go
+++ b/dir.go
@@ -27,6 +27,7 @@ func listFiles(w http.ResponseWriter, uDir, sort, hi, user string, modern bool)
qeDir := url.QueryEscape(uDir)
r := 0
+ var total uint64
// List Directories First
for _, f := range d {
@@ -116,9 +117,12 @@ func listFiles(w http.ResponseWriter, uDir, sort, hi, user string, modern bool)
</TD>
</TR>
`))
+ total = total + uint64(f.Size())
}
- w.Write([]byte(`</TABLE>`))
+ // Footer
+ w.Write([]byte(`<TR><TD></TD><TD ALIGN="right" STYLE="border-top:1px solid grey">Total ` +
+ humanize.Bytes(total) + `</TD><TD></TD><TD></TD></TR></TABLE>`))
footer(w)
}