func staticHandler(c *fb.Context) (code int, err error) {
	if c.REQ.URL.Path != "/static/manifest.json" {
		c.REQ.URL.Path = strings.TrimPrefix(c.REQ.URL.Path, "/static")
		http.FileServer(c.Assets.HTTPBox()).ServeHTTP(c.RESP, c.REQ)
		return 0, nil
	}
	return renderFile(c, "manifest.json")
}
staticHandler handles the static assets path.
package web
import (
	"encoding/json"
	"github.com/browsefile/backend/src/cnst"
	fb "github.com/browsefile/backend/src/lib"
	"github.com/browsefile/backend/src/lib/utils"
	"html/template"
	"log"
	"net/http"
	"strings"
)
func Handler(m *fb.FileBrowser) http.Handler {
	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		c := &fb.Context{
			FileBrowser: m,
			User:        nil,
			File:        nil,
			Params:      new(fb.Params),
		}
		c.REQ = r
		c.RESP = w
		c.Method = c.REQ.Method
		code, err := serve(c)
		if err != nil {
			txt := http.StatusText(code)
			if len(c.Params.PreviewType) == 0 {
				log.Printf("%v: %v %v\n", r.URL.Path, code, txt)
				log.Println(err)
			} else {
				log.Println(err)
				err = nil
			}
		}
		if !c.Rendered && c.Router > 0 && c.Router != cnst.R_DOWNLOAD && c.Router != cnst.R_PLAYLIST {
			w.WriteHeader(code)
		}
	})
}
func serve(c *fb.Context) (int, error) {
	if strings.HasPrefix(c.REQ.URL.Path, "/static") {
		if c.Method != http.MethodGet {
			return http.StatusNotImplemented, nil
		}
		return staticHandler(c)
	}
	if strings.HasPrefix(c.REQ.URL.Path, cnst.WEB_DAV_URL) {
		ServeDav(c, c.RESP, c.REQ)
		return http.StatusOK, nil
	}
	if strings.HasPrefix(c.REQ.URL.Path, "/api") {
		return apiHandler(c)
	}
	c.RESP.Header().Set("x-content-type-options", "nosniff")
	c.RESP.Header().Set("x-xss-protection", "1; mode=block")
	return renderFile(c, "index.html")
}