1
0

Made AssetsFS() a standalone func.

This commit is contained in:
Alexander Andreev 2023-05-25 02:31:21 +04:00
parent 8eb8a24a23
commit 5101a892de
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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)