Swap to icon grid instead of individual icons
saves like 3kb :p
This commit is contained in:
@@ -21,7 +21,7 @@ import (
|
||||
var (
|
||||
//go:embed private/*
|
||||
privateDirectory embed.FS
|
||||
serveHash = fmt.Sprintf("%x", time.Now().Unix())
|
||||
serveHash = fmt.Sprintf("%X", time.Now().Unix())
|
||||
serveDirectory = os.Getenv("HTTP_DIRECTORY")
|
||||
serveAddress = os.Getenv("HTTP_ADDRESS")
|
||||
tmpl = template.Must(
|
||||
@@ -83,32 +83,33 @@ func getEntrySizeHuman(b int64) string {
|
||||
|
||||
func getEntryIcon(name string, isDir bool) string {
|
||||
if isDir {
|
||||
return "icon_folder.png"
|
||||
return "icon-directory"
|
||||
}
|
||||
switch strings.ToLower(path.Ext(name)) {
|
||||
// Custom Filetypes
|
||||
case ".redir":
|
||||
return "icon_redirect.png"
|
||||
return "icon-redirect"
|
||||
|
||||
// Default Filetypes
|
||||
case ".mp3", ".flac", ".ogg", ".wav", ".aac", ".opus", ".m4a":
|
||||
return "icon_audio.png"
|
||||
return "icon-audio"
|
||||
case ".mp4", ".mkv", ".webm", ".avi", ".mov", ".m4v":
|
||||
return "icon_video.png"
|
||||
return "icon-video"
|
||||
case ".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", ".bmp", ".tiff":
|
||||
return "icon_photo.png"
|
||||
return "icon-photo"
|
||||
case ".zip", ".tar", ".gz", ".7z", ".rar", ".zst", ".xz", ".bz2":
|
||||
return "icon_archive.png"
|
||||
return "icon-archive"
|
||||
case ".exe", ".elf", ".bin", ".out", ".appimage", ".deb", ".rpm":
|
||||
return "icon_program.png"
|
||||
return "icon-program"
|
||||
case ".pdf", ".txt", ".md", ".srt", ".vtt", ".ass", ".log":
|
||||
return "icon_document.png"
|
||||
return "icon-document"
|
||||
case ".html", ".ts", ".js", ".go", ".rs", ".pug":
|
||||
return "icon_script.png"
|
||||
return "icon-script"
|
||||
case ".json", ".xml", ".yaml", ".toml", ".ini", ".cfg":
|
||||
return "icon_config.png"
|
||||
return "icon-config"
|
||||
|
||||
default:
|
||||
return "icon_generic.png"
|
||||
return "icon-generic"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user