package handlers import ( "dwelling-files/pkg/files" "dwelling-files/web" "net/http" ) type IndexData struct { MainSite string CurrentPath string FilesTotalCount int64 FilesTotalSize string DirectoryCount int64 Items []files.DirEntry } type FilesHandlers struct { directoryPath string } func New(directoryPath *string) *FilesHandlers { return &FilesHandlers{ directoryPath: *directoryPath} } func (FilesHandlers) AssetsFS() http.FileSystem { return web.Assets() } func (FilesHandlers) Robots(w http.ResponseWriter, r *http.Request) { fc, _ := web.AssetsGetFile("robots.txt") w.Write(fc) } func (h *FilesHandlers) Index(w http.ResponseWriter, r *http.Request) { currentPath := "" var totalFiles int64 = 0 var totalFilesSize int64 = 0 var totalDirectories int64 = 0 web.Index(r.Host, currentPath, totalFiles, totalFilesSize, totalDirectories, nil, r, w) }