Made AssetsFS() a standalone func.
This commit is contained in:
parent
8eb8a24a23
commit
5101a892de
@ -94,7 +94,7 @@ func main() {
|
|||||||
http.Error(w, r, nethttp.StatusNotFound, "")
|
http.Error(w, r, nethttp.StatusNotFound, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
srv.ServeStatic("/assets/*filepath", hand.AssetsFS())
|
srv.ServeStatic("/assets/*filepath", http.AssetsFS())
|
||||||
srv.GET("/robots.txt", http.RobotsTxt)
|
srv.GET("/robots.txt", http.RobotsTxt)
|
||||||
srv.GET("/favicon.svg", http.Favicon)
|
srv.GET("/favicon.svg", http.Favicon)
|
||||||
|
|
||||||
|
@ -42,10 +42,6 @@ func NewUploadHandlers(lFile *log.Logger, uploadDir string, uploadDirSize *int64
|
|||||||
limitFileSize: limFileSz}
|
limitFileSize: limFileSz}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*UploadHandlers) AssetsFS() http.FileSystem {
|
|
||||||
return web.Assets()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *UploadHandlers) Index(w http.ResponseWriter, r *http.Request) {
|
func (h *UploadHandlers) Index(w http.ResponseWriter, r *http.Request) {
|
||||||
var storCapacity int64 = h.limitStorage << 20
|
var storCapacity int64 = h.limitStorage << 20
|
||||||
var fMaxSize int64 = h.limitFileSize << 20
|
var fMaxSize int64 = h.limitFileSize << 20
|
||||||
@ -237,6 +233,10 @@ func Error(w http.ResponseWriter, r *http.Request, code int, reason string) {
|
|||||||
web.ErrorXXX(utils.MainSite(r.Host), code, reason, w)
|
web.ErrorXXX(utils.MainSite(r.Host), code, reason, w)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AssetsFS() http.FileSystem {
|
||||||
|
return web.Assets()
|
||||||
|
}
|
||||||
|
|
||||||
func RobotsTxt(w http.ResponseWriter, r *http.Request) {
|
func RobotsTxt(w http.ResponseWriter, r *http.Request) {
|
||||||
data, _ := web.AssetsGetFile("robots.txt")
|
data, _ := web.AssetsGetFile("robots.txt")
|
||||||
w.Write(data)
|
w.Write(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user