# yaml-language-server: $schema=https://raw.githubusercontent.com/xemle/home-gallery/master/gallery.config.schema.json
#
# HomeGallery configuration file
#
# Default configuration file is gallery.config.yml.
# JSON format is also supported (gallery.config.json)
#
# Directory value examples:
# - /absolute/directory
# - relative/directory/to/current/working/dir
# - ~/directory/in/your/home
# - ./relative/directory/to/configuration/file
#
# Variable replacement example:
#
#   baseDir: '~'
#   configDir: '{baseDir}/.config/home-gallery'
#
# configDir is replaced to '~/.config/home-gallery' and than to '$HOME/.config/home-gallery'
#
# Variables are overwritten by environment variables
#
# Variables are baseDir, configDir, configPrefix, cacheDir and dir in sources
# or environment variables GALLERY_BASE_DIR, GALLERY_CONFIG_DIR, GALLERY_CONFIG_PREFIX, GALLERY_CACHE_DIR
#


# Base directory
#
# default: ~
#baseDir: ~
# default: '{baseDir}/.config/home-gallery'
#configDir: '{baseDir}/.config/home-gallery'
# file prefix for index, database and events
#
# default: ''
#configPrefix: ''
# Cache directory for storage directory and other cache files
#
# default: '{baseDir}/.cache/home-gallery'
#cacheDir: '{baseDir}/.cache/home-gallery'

#
# Sources
#
# List of media source directories. These can be read only.
#
# All sources are used to build the gallery database. If you need
# different databases or gallery instances use different gallery
# configurations
#
# default: []
#
#sources:
  # Simple source directory with default settings
  #- /home/me/Photos
  # Source directory with custom settings
  # [dir property] Path of source directory
  #- dir: /home/me/Photos
    # Index filename which must be unique
    #
    # For directory /mnt/photos the index file is {configDir}/photos.idx
    # If two sources have the same index file an error is raised
    #
    # default: '{configDir}/{configPrefix}{basename(dir)}.idx'
    #index: '{configDir}/{configPrefix}{basename(dir)}.idx'
    #
    # All files and subdirectories are included by default.
    # Set exclude patterns to ignore some files or foldes.
    # Last match wins
    #
    # Exclude patterns are using gitignore patterns (see https://git-scm.com/docs/gitignore)
    #
    # To include only one subdirectory you need to use:
    # - **       # exclude/ignores everything
    # - !/dir    # include dir name
    # - !/dir/** # include everything below /dir
    #
    #excludes:
      # examples:
      #   * '.DS_Store'
      #   * '._*'
      #   * "'*.tmp'"
      #   * "'*cache*'"
      #- '.DS_Store'
    # Read exclude patterns from file (one pattern per line)
    #excludeFromFile: '{configDir}/excludes'
    # If a file with this name is present in a directory, the this directory is excluded
    #
    # default: '.galleryignore'
    #excludeIfPresent: '.galleryignore'
    # Exclude big files such as videos to speedup initial setup
    #
    # examples:
    #   * '20M'
    #   * '1G'
    #maxFileSize: '20M'
    # If source directory/disk is offline/unmounted set it to true.
    # Offline sources require an index file. Previews and meta data
    # should be extracted first before marking a source offline
    #offline: true
    # Allows the original files to be downloaded via de webapp.
    # This adds a link to images of this source in the details view.
    # Sources set as `offline` won't be made available
    #downloadable: true
    # File matcher for checksum recalculation and detecting file changes
    #
    # default: size-ctime-inode
    # size-ctime-inode matcher should be used if possible,
    # might not work on windows
    #matcher: size-ctime-inode
    # size-ctime matcher should be used if stable fs inodes are
    # not available and might not work for fuse shares
    #matcher: size-ctime
    # size matcher should be used if you know what you are doing
    #matcher: size

# Extractor settings
#extractor:
  # Exclude file patterns
  #excludes:
    #- ...any string
  # Read exclude patterns from file
  #excludeFromFile: '{configDir}/excludes'
  #image:
    # default: [1920,1280,800,320,128]
    #previewSizes:
      #- ...any number
    # default: 80
    #previewQuality: 80
  #video:
    # used as preview size and preview filename
    #
    # default: 720
    #previewSize: 720
    # used as target video container and preview filename
    #
    # default: mp4
    #ext: mp4
    # overwrites previewSize.
    # E.g. -2:'min(ih,max(720,min(1080,ih*.5)))' for 720p <= height*0.5 <= 1080p or height, if height < 720
    #
    # default: "-2:'min(720,ih)'"
    #scale: "-2:'min(720,ih)'"
    # default: 30
    #frameRate: 30
    # default: 30
    #maxVideoBitRate: 30
    # default: libx264
    #videoEncoder: libx264
    # default: slow
    #preset: slow
    # default: baseline
    #profile: baseline
    # default: '3.0'
    #level: '3.0'
    # Additional ffmpeg args
    #addFfmpegArgs:
      #- ...any string
    # custom ffmpeg args for video conversion, replaces all other settings such previewSize, videoEncoder, addFfmpegArgs, ...
    #customFfmpegArgs:
      #- ...any string
  #apiServer:
    # URL of the API server
    #
    # In docker compose this is overwritten by GALLERY_API_SERVER env
    #
    # default: 'https://api.home-gallery.org'
    #url: 'https://api.home-gallery.org'
    # Timeout in seconds for each API request
    #
    # default: 30
    #timeout: 30
    # Concurrent requests to API server
    #
    # If you use a low power device you should reduce this value to 3
    #
    # default: 30
    #concurrent: 30
    #disable:
      #- similarDetection
      #- objectDetection
      #- faceDetection
  #geoReverse:
    # default: 'https://nominatim.openstreetmap.org'
    #url: 'https://nominatim.openstreetmap.org'
    #
    # Preffered address language of geo code reverse lookups
    #
    # default: ["en","de"]
    #addressLanguage:
      #- ...any string
  #useNative:
    # use libvips to resize images
    #- vipsthumbnail
    # use ImageMagick to resize images
    #- convert
    # Use ffprobe/ffmpeg from system
    #- ffprobe
    #- ffmpeg

# Storage settings
#storage:
  # default: '{cacheDir}/storage'
  #dir: '{cacheDir}/storage'

#database:
  # default: '{configDir}/{configPrefix}database.db'
  #file: '{configDir}/{configPrefix}database.db'
  # The full database creation is memory consuming. The default value is 2048 MB.
  # On memory errors or for larger photo collections (>50000 images) 4096 MB is recommended
  # Use less memory for smaller devices (e.g. Raspberry Pi Zero), e.g. 512 MB.
  # Node's default memory limit is 512 MB (changeable via --max-old-space-size node arg)
  #maxMemory: 2048
  # examples:
  #   * '*.xmp'
  #   * '*.svg'
  #excludes:
    #- ...any string
  #excludeFromFile: '{configDir}/excludes'
  #supportedTypes: image # one of: image, rawImage, video
  # Time zone of the media dates in the database
  #
  # 'local' keeps the wall clock of the camera, eg 2004-10-19T10:34:17. A media
  # keeps the day and the hour it was taken at, on every device which shows the
  # gallery.
  #
  # 'utc' converts the media date to UTC, eg 2004-10-19T08:34:17Z, and the
  # gallery shows and filters the UTC time. Media without a time zone offset in
  # their meta data are taken as UTC.
  #
  # The value is written to the database header. Changing it requires a full
  # rebuild by 'gallery database', which reuses the extracted meta data and does
  # not run the extractor again
  #
  # default: local
  #timezone: local # one of: local, utc

#events:
  # default: '{configDir}/{configPrefix}events.db'
  #file: '{configDir}/{configPrefix}events.db'

#server:
  # default: 3000
  #port: 3000
  # default: '0.0.0.0'
  #host: '0.0.0.0'
  # Optional https certificate key
  #key: '{configDir}/server.key'
  # Optional https certificate
  #cert: '{configDir}/server.crt'
  # Trust source ip as trusted proxy. Default is off
  # Predefined local ip addresses. See expressjs documentation for details
  #trustProxy: loopback # one of: loopback, linklokal, uniquelocal
  # Dedicated IP address
  #trustProxy: '192.168.5.42'
  # Prefix of application, including basePath of http page
  #prefix: /gallery
  # Prefix path for browser only. basePath is Overwritten by prefix
  # Use this if you use prefix by a http proxy which strips the prefix to / towards the gallery app
  #basePath: /
  # The public URL of the gallery instance
  #publicUrl: 'https://acme.com/gallery'
  # Open browser when server starts
  #openBrowser: true
  # Enable basic authentication users and ip whitelist rules which require no authentication
  #auth:
    #public:
      # Database filter for anonymous users
      #filter: 'year >= 2024 tag:public'
    #
    # Passwords can be in plain text, {SHA} or {SHA256-salted}.
    #
    # Hashed password can be generated via
    #   node -e "pw=process.argv[1];const {createHash,randomBytes}=require('crypto');salt=randomBytes(12);hash=createHash('sha256').update(salt.toString()+pw).digest('base64');console.log('{SHA256-salted}'+salt.toString('base64')+'.'+hash)" 'password'
    #   {SHA256-salted}FkcbhhcHYW0DdE9u.P9Ik9MG8ldtO0fzGB+RV186vi8PZMomsya5OWC0AEiA=
    #   node -e "pw=process.argv[1]||'';sha1=require('crypto').createHash('sha1').update(pw).digest('base64');console.log('{SHA}'+sha1)" password
    #   {SHA}W6ph5Mm5Pz8GgiULbPgzG37mj9g=
    #
    #users:
      # Simple username:password pair
      #- johndoe: s3cr3t
      # User object with dedicated username, password properties
      #- username: guest
        #password: '{SHA256-salted}W1jrZgK81z06YLhA.qTSmeyYtPP19ZEpGiiAyVn61nly4jqbuuGoSefzLm98='
        # Database filter for the user
        #filter: 'year >= 2019 not tag:private'
    #
    # Rules when the request need authentication
    # First matching rule wins.
    #
    # For public gallery use
    # rules:
    #   - allow: localhost
    #   - deny: all
    #
    #rules:
      # [allow property] Allow rules without authentication like localhost
      #
      # examples:
      #   * all
      #   * localhost
      #   * '192.168/16'
      #- allow: all
      # [deny property] Deny rules which hosts requires authentication like all
      #
      # examples:
      #   * all
      #   * localhost
      #   * '192.168/16'
      #- deny: all
  # Import sources on server start
  #
  # default: true
  #importSources: true
  # Watch sources and import files on changes
  #
  # default: true
  #watchSources: true
  #api:
    #tree:
      # default: 4
      #monthGroupSize: 4
      # default: 4
      #ignoreRecentYears: 4

# Configuration for webapp module
#webapp:
  # Title of the webapp
  #
  # default: 'Home Gallery'
  #title: 'Home Gallery'
  #pluginManager:
    #
    # List of plugin urls to load
    #
    # default: []
    #plugins:
      #- ...any string
  #
  # List of feature flags to disable. By default all features are enabled.
  #
  # The feature flags can also be disabled by query param 'disabled'
  #
  # default: []
  #disabled:
    # Flags for edition tags
    #- serverEvents
    #- events
    #- edit
    # Disable database loading and use embedded entries only
    #- database
    # Enable progressive web application support
    #- pwa
    # Recommended performance features. Disable them on local dev issues
    #- offlineDatabase
    #- worker
    #- ...any string
  #
  # List of downloadable media sources. This list will be injected from the server
  #
  # default: []
  #sources:
    # [downloadable property] default: false
    #- downloadable: false
      #indexName: ""
  #
  # Customize pages
  #
  # default: []
  #pages:
    #disabled:
      #- edit
      #- date
      #- video
      #- map
      #- tag
      #- album
      #- onThisDay
      #- all
      #- ...any string
    # Initial page of the webapp on its first load. It falls back to the page of all media if the configured page is disabled
    #
    # default: all
    #landing: all # one of: all, albums, years, tags, map
    #
    # Customize albums page
    #
    # default: []
    #albums:
      # Show the index as root album. An index is a media source directory and is the parent of all its albums. By default only its subdirectories are listed
      #
      # default: false
      #showIndex: false
      # Show a cover thumbnail of the album. The cover is the first media of the album or of its first sub-album. A media whose file name ends with '_cover' before its extension is preferred
      #
      # default: true
      #showCover: true
      # Initial size of the album thumbnails. Smaller thumbnails show more albums per row in the grid view and shorter rows in the list view. It is overruled by the size controls of the nav bar
      #
      # default: medium
      #thumbnailSize: medium # one of: xsmall, small, medium, large, xlarge
      # Initial album order. It is overruled by the order of the page
      #
      # default: name
      #order: name # one of: name, nameDesc
      # Initial album view. The list view shows the album tree, the grid view shows all albums as squared cover thumbnails. It is overruled by the view toggle of the page
      #
      # default: list
      #view: list # one of: list, grid
      # Mark albums whose media were added to the gallery within this amount of days. An album with only recently added media is marked as new, an album with some of them as updated. 0 disables the marks. A media is added when the file index finds its file the first time, so all albums of a new gallery are new for these days. A database which was built by an older version needs a rebuild by 'gallery database'
      #
      # default: 3
      #recentDays: 3
    #
    # Customize media lists
    #
    # default: []
    #list:
      # Layout of the media lists. 'fluent' keeps the aspect ratio of the media, 'grid' crops them to a grid of squares and 'list' shows one media per row with its file name beside its thumbnail. It is overruled by the layout toggle of the nav bar
      #
      # default: list
      #thumbnails: list # one of: list, grid, fluent
      # Initial size of the thumbnails. Smaller thumbnails show more media per row. It is overruled by the size controls of the nav bar
      #
      # default: medium
      #thumbnailSize: medium # one of: xsmall, small, medium, large, xlarge
      # Show the date scrollbar of media lists. It is placed at the right side of the list and jumps to the media of the selected date
      #
      # default: true
      #scrollbar: true
      # Show the file name of every media below its thumbnail in the fluent and in the grid media list. The name is shown without its directory and with its file extension. The list layout shows it beside the thumbnail in any case
      #
      # default: true
      #showFilename: true
      # Order of media lists without an explicit 'order by' expression in the search query. It is an order key with an optional direction, eg 'date asc', 'filesize desc' or 'count(tags) desc'. Supported keys are date, file, filename, updated, duration, width, height, filesize, random and count(files), count(tags), count(faces), count(objects)
      #
      # default: 'date desc'
      #defaultOrder: 'date desc'
    #
    # Customize single media view
    #
    # default: []
    #mediaView:
      #disabled:
        #- detail
        #- map
        #- similar
        #- annotation
        #- edit
        #- tag
        #- share
        # Disables navigation to overview, prev and next
        #- nav
      # Start the video playback when a video is opened. Browsers can still block the autoplay until the site has user interaction
      #
      # default: true
      #autoPlayVideo: true
  #
  # Date format as in linux date command
  #   %b month name
  #   %d day of month, eg 01
  #   %m month, eg 12
  #   %Y 4 full year, eg 2025
  #   %y 2-digit year, eg 25
  #   %a short weekday name, eg. Mon
  #   %A full weekday name, eg. Monday
  #   %H hour eg 18
  #   %I hour eg 06 (12-hour clock)
  #   %p am/AM
  #   %P AM/PM
  #   %M minute, eg 06
  #   %S seconds, eg 45
  #
  # default: []
  #
  #format:
    # Date format
    #
    # default: '%d.%m.%Y'
    #date: '%d.%m.%Y'
    # Month year format
    #
    # default: '%b %Y'
    #monthYear: '%b %Y'
    # Year format
    #
    # default: '%Y'
    #year: '%Y'
    # time format
    #
    # default: '%H:%M:%S'
    #time: '%H:%M:%S'
    # time format with hour and minute
    #
    # default: '%H:%M'
    #hourMinute: '%H:%M'

# Plugin manager settings
#pluginManager:
  #
  # Load plugins from following directories.
  #
  # Each file or directory is handled as plugin
  #
  # example:
  #   * plugins
  #
  #dirs:
    #- ...any string
  #
  # List of dedicated plugin files
  #
  # example:
  #   * './my-plugin'
  #plugins:
    #- ...any string
  #
  # Disable plugins by name or by name.extension
  #
  # examples:
  #   * acmePlugin
  #   * acmePlugin.exentionName
  #disabled:
    #- ...any string

# Logger settings
#logger:
  # Console logger
  #- type: console
    # Log level
    #
    # default: info
    #level: info # one of: trace, debug, info, warn, error, fatal, silent
    # Use newline delimited JSON if format is set to json
    #format: json
  # File logger
  #- type: file
    # Log level
    #
    # default: debug
    #level: debug # one of: trace, debug, info, warn, error, fatal, silent
    # Log file path
    #
    # File logger format is in newline delimited JSON. See http://ndjson.org
    #file: '{configDir}/{configPrefix}gallery.log'