Added mod time to files
This commit is contained in:
@@ -6,9 +6,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const fileElement = "<p><a href='https://darkstorm.tech%v'>%v</a></p>"
|
const fileElement = "<p><a href='https://darkstorm.tech%v'>%v</a><div style='float:right;'>%v</div></p>"
|
||||||
|
|
||||||
func filesRequest(w http.ResponseWriter, r *http.Request) {
|
func filesRequest(w http.ResponseWriter, r *http.Request) {
|
||||||
partPath := filepath.Clean(r.URL.Path)
|
partPath := filepath.Clean(r.URL.Path)
|
||||||
@@ -38,7 +39,8 @@ func filesRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
if f.IsDir() {
|
if f.IsDir() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
pageContent += fmt.Sprintf(fileElement, filepath.Join(partPath, f.Name()), f.Name())
|
inf, _ := f.Info()
|
||||||
|
pageContent += fmt.Sprintf(fileElement, filepath.Join(partPath, f.Name()), f.Name(), inf.ModTime().Format(time.DateOnly))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
http.ServeFile(w, r, path)
|
http.ServeFile(w, r, path)
|
||||||
|
|||||||
Reference in New Issue
Block a user