From 4df4e44df4e7b16f77c4d3328613211fa198736f Mon Sep 17 00:00:00 2001 From: bakonpancakz Date: Thu, 18 Jun 2026 20:02:46 -0700 Subject: [PATCH] feature: Hide Dotfiles And Dotdirs if thats a thing. Enabled by default, use envvars to disable this feature. --- README | 7 ++++--- main.go | 6 ++++++ public/.hidden/.gitkeep | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 public/.hidden/.gitkeep diff --git a/README b/README index 1c83db5..7705e7a 100644 --- a/README +++ b/README @@ -10,9 +10,10 @@ A Miku flavored file browser inspired by THE FLAVOR FOLEY FILES (https://flavorf Configure the service using environment variables: -| Name | Default | Description -| HTTP_ADDRESS | 127.0.0.1:9000 | Address and Port to use for requests -| HTTP_DIRECTORY | | Starting directory to list and serve files from +| Name | Default | Description +| HTTP_ADDRESS | 127.0.0.1:9000 | Address and Port to use for requests +| HTTP_DIRECTORY | | Starting directory to list and serve files from +| HTTP_SHOW_DOTFILES | | Set this variable to list directories and files prefixed with a dot (e.g. .DS_Store) [ Credits ] diff --git a/main.go b/main.go index 7c6c48a..bdefd6d 100644 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ var ( privateDirectory embed.FS serveHash = fmt.Sprintf("%X", time.Now().Unix()) serveDirectory = os.Getenv("HTTP_DIRECTORY") + serveDotfiles = os.Getenv("HTTP_SHOW_DOTFILES") serveAddress = os.Getenv("HTTP_ADDRESS") tmpl = template.Must( template. @@ -194,6 +195,11 @@ func main() { continue } + // Ignore Dotfiles + if strings.HasPrefix(entry.Name(), ".") { + continue + } + // Check Symbolic Link isDir := entry.IsDir() if entry.Type()&os.ModeSymlink != 0 { diff --git a/public/.hidden/.gitkeep b/public/.hidden/.gitkeep new file mode 100644 index 0000000..a646a8e --- /dev/null +++ b/public/.hidden/.gitkeep @@ -0,0 +1,3 @@ +I'M CALLING OUT YOUR NAME RECEIVING NO REPLY +[ REFLECTED OFF THE SIDE OF THE SKYLINE ] +CALLING OUT IN VAIN, LIKE YOU WOULD EVEN TRY