Add logo feature

This commit is contained in:
Pim van Pelt
2025-12-03 12:32:36 +01:00
parent 60a149b669
commit 99ad6fbff1
3 changed files with 119 additions and 42 deletions
+16 -11
View File
@@ -279,17 +279,19 @@ func generateS3HTML(entries []indexgen.FileEntry, opts *indexgen.Options, client
// Prepare template data (similar to ProcessDir in indexgen)
data := struct {
DirName string
Entries []indexgen.FileEntry
DirAppend bool
OutputFile string
IsRoot bool
DirName string
Entries []indexgen.FileEntry
DirAppend bool
OutputFile string
IsRoot bool
WatermarkURL string
}{
DirName: opts.TopDir, // Use bucket name as directory name
Entries: entries,
DirAppend: opts.DirAppend,
OutputFile: opts.OutputFile,
IsRoot: isRoot,
DirName: opts.TopDir, // Use bucket name as directory name
Entries: entries,
DirAppend: opts.DirAppend,
OutputFile: opts.OutputFile,
IsRoot: isRoot,
WatermarkURL: opts.WatermarkURL,
}
// Generate HTML content in memory
@@ -345,6 +347,7 @@ func main() {
var s3URL string
var dryRun bool
var showIndexFiles bool
var watermarkURL string
// Set defaults
opts.DirAppend = true
@@ -359,6 +362,7 @@ func main() {
flag.StringVar(&excludeRegexStr, "x", "", "exclude files matching regular expression")
flag.BoolVar(&opts.Verbose, "v", false, "verbosely list every processed file")
flag.BoolVar(&showIndexFiles, "i", false, "show index.html files in directory listings")
flag.StringVar(&watermarkURL, "wm", "", "watermark logo URL to display in top left corner")
flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Generate directory index files (recursive is ON, hidden files included by default).\n")
@@ -398,9 +402,10 @@ func main() {
}
}
// Set dry run and show index files flags
// Set dry run, show index files, and watermark URL
opts.DryRun = dryRun
opts.ShowIndexFiles = showIndexFiles
opts.WatermarkURL = watermarkURL
if s3URL != "" {
// Parse S3 URL