diff --git a/server/ctrl/static.go b/server/ctrl/static.go index 13905911..ccc02621 100644 --- a/server/ctrl/static.go +++ b/server/ctrl/static.go @@ -54,13 +54,13 @@ func AboutHandler(ctx App, res http.ResponseWriter, req *http.Request) { -

{{index .App 0}} ({{index .App 1}})

+

{{index .App 0}}
({{index .App 1}})

{{range .Plugins}} {{ index . 0 }} ({{ index . 1 }})
{{end}}

@@ -73,30 +73,22 @@ func AboutHandler(ctx App, res http.ResponseWriter, req *http.Request) { }{ App: []string{"Filestash " + APP_VERSION + "." + BUILD_NUMBER, hashFile(filepath.Join(GetCurrentDir(), "/filestash"), 6)}, Plugins: func () [][]string { - pPath := filepath.Join(GetCurrentDir(), PLUGIN_PATH) - file, err := os.Open(pPath) - if err != nil { - return [][]string{ - []string{"N/A", ""}, - } - } - files, err := file.Readdir(0) - if err != nil { - return [][]string{ - []string{"N/A", ""}, - } - } plugins := make([][]string, 0) + pPath := filepath.Join(GetCurrentDir(), PLUGIN_PATH) + if file, err := os.Open(pPath); err == nil { + if files, err := file.Readdir(0); err == nil { + for i:=0; i < len(files); i++ { + plugins = append(plugins, []string{ + files[i].Name(), + hashFile(pPath + "/" + files[i].Name(), 6), + }) + } + } + } plugins = append(plugins, []string { "config.json", hashFile(filepath.Join(GetCurrentDir(), "/data/config/config.json"), 6), }) - for i:=0; i < len(files); i++ { - plugins = append(plugins, []string{ - files[i].Name(), - hashFile(pPath + "/" + files[i].Name(), 6), - }) - } return plugins }(), }) diff --git a/server/middleware/http.go b/server/middleware/http.go index dd0e440f..5b6ffd0b 100644 --- a/server/middleware/http.go +++ b/server/middleware/http.go @@ -1,6 +1,7 @@ package middleware import ( + "fmt" . "github.com/mickael-kerjean/filestash/server/common" "net/http" "path/filepath" @@ -29,6 +30,8 @@ func IndexHeaders(fn func(App, http.ResponseWriter, *http.Request)) func(ctx App header := res.Header() header.Set("Content-Type", "text/html") header.Set("Cache-Control", "no-cache") + header.Set("Referrer-Policy", "same-origin") + header.Set("X-Powered-By", fmt.Sprintf("Filestash/%s ", APP_VERSION + "." + BUILD_NUMBER)) fn(ctx, res, req) } }