mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adding favicon to filer also
This commit is contained in:
parent
9b603f5ffa
commit
dd5661b297
|
@ -12,6 +12,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||
"github.com/chrislusf/seaweedfs/weed/images"
|
||||
"github.com/chrislusf/seaweedfs/weed/operation"
|
||||
"github.com/chrislusf/seaweedfs/weed/security"
|
||||
"github.com/chrislusf/seaweedfs/weed/stats"
|
||||
|
@ -188,3 +189,15 @@ func statsMemoryHandler(w http.ResponseWriter, r *http.Request) {
|
|||
m["Memory"] = stats.MemStat()
|
||||
writeJsonQuiet(w, r, http.StatusOK, m)
|
||||
}
|
||||
|
||||
func faviconHandler(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := images.Asset("favicon/favicon.ico")
|
||||
if err != nil {
|
||||
glog.V(2).Infoln("favicon read error:", err)
|
||||
return
|
||||
}
|
||||
|
||||
if e := writeResponseContent("favicon.ico", "image/x-icon", bytes.NewReader(data), w, r); e != nil {
|
||||
glog.V(2).Infoln("response write error:", e)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, ip string, port int,
|
|||
fs.filer.LoadConfiguration()
|
||||
|
||||
defaultMux.HandleFunc("/admin/register", fs.registerHandler)
|
||||
defaultMux.HandleFunc("/favicon.ico", faviconHandler)
|
||||
defaultMux.HandleFunc("/", fs.filerHandler)
|
||||
if defaultMux != readonlyMux {
|
||||
readonlyMux.HandleFunc("/", fs.readonlyFilerHandler)
|
||||
|
|
|
@ -67,7 +67,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
|||
adminMux.HandleFunc("/", vs.privateStoreHandler)
|
||||
if publicMux != adminMux {
|
||||
// separated admin and public port
|
||||
publicMux.HandleFunc("/favicon.ico", vs.faviconHandler)
|
||||
publicMux.HandleFunc("/favicon.ico", faviconHandler)
|
||||
publicMux.HandleFunc("/", vs.publicReadOnlyHandler)
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,3 @@ func (vs *VolumeServer) publicReadOnlyHandler(w http.ResponseWriter, r *http.Req
|
|||
vs.GetOrHeadHandler(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) faviconHandler(w http.ResponseWriter, r *http.Request) {
|
||||
vs.FaviconHandler(w, r)
|
||||
}
|
||||
|
|
|
@ -151,18 +151,6 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) FaviconHandler(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := images.Asset("favicon/favicon.ico")
|
||||
if err != nil {
|
||||
glog.V(2).Infoln("favicon read error:", err)
|
||||
return
|
||||
}
|
||||
|
||||
if e := writeResponseContent("favicon.ico", "image/x-icon", bytes.NewReader(data), w, r); e != nil {
|
||||
glog.V(2).Infoln("response write error:", e)
|
||||
}
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) tryHandleChunkedFile(n *storage.Needle, fileName string, w http.ResponseWriter, r *http.Request) (processed bool) {
|
||||
if !n.IsChunkedManifest() || r.URL.Query().Get("cm") == "false" {
|
||||
return false
|
||||
|
|
Loading…
Reference in a new issue