index.html für einen S3 bucket erstellen.
Find a file
2026-03-31 12:22:10 +02:00
.gitignore initial import 2026-03-31 12:22:10 +02:00
config.yaml.example initial import 2026-03-31 12:22:10 +02:00
go.mod initial import 2026-03-31 12:22:10 +02:00
go.sum initial import 2026-03-31 12:22:10 +02:00
main.go initial import 2026-03-31 12:22:10 +02:00
README.md initial import 2026-03-31 12:22:10 +02:00

Bucket Index

Listet einen S3-Bucket (z.B. Garage) per API, extrahiert PDF-Metadaten (Title, Author, Year) und erzeugt pro Verzeichnis eine index.html im Apache-Directory-Index-Stil.

go build -o bucket-index .
./bucket-index config.yaml

Features

  • Hierarchische Bucket-Auflistung mit Unterverzeichnissen
  • PDF-Metadaten aus S3 (kein öffentlicher HTTP-Download nötig)
  • ETag-basierter YAML-Cache: bei unverändertem ETag kein erneuter Download
  • Spalten: Jahr | Titel | Autor | Datei | Size | Mtime | ETag
  • Klickbare Spaltenüberschriften zum Sortieren (Apache-FancyIndex-Stil)
  • Optionaler Passwortschutz (Frage/Antwort in Config)
  • HTTP-HEAD-Prüfung der öffentlichen URLs
  • Upload der Index-Dateien in einen S3-Bucket

Konfiguration

Siehe config.yaml.example:

input:
  s3:
    endpoint: https://s3.example.com
    region: garage
    bucket: my-bucket
    access_key: ...
    secret_key: ...

public_base_url: https://files.example.com

output:
  local: ./index.html           # Lokale Datei für Root-Index
  # cache: bucket-index-cache.yaml   # ETag-Cache (Default: gleiches Verz. wie local)
  # password_question: "Deine Frage?"
  # password_answer: "Antwort"       # Leer = kein Passwortschutz
  s3:                            # S3-Ziel für Upload (Credentials aus Umgebung)
    endpoint: https://s3.example.com
    region: garage
    bucket: my-bucket
  • input.s3: S3-Quelle (Endpoint, Bucket, Credentials oder AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY)
  • public_base_url: Basis-URL für die öffentlichen Dateilinks
  • output.local: Pfad für die lokale Root-Index-Datei
  • output.cache: YAML-Cache für PDF-Metadaten; bei gleichem ETag kein erneuter Download
  • output.password_question / password_answer: Beide gesetzt = Passwortschutz; sonst Links sofort sichtbar
  • output.s3: Upload-Ziel für die Index-Dateien (Credentials aus Umgebung: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)