{ config, flake, ... }:
let
  inherit (flake.config.people) user0;
  inherit (flake.config.people.users.${user0}) name;
  inherit (flake.config.services.instances) glance jellyfin web;
  service = glance;
  jellyfinUserName = name;
  jellyfinHost = "https://${jellyfin.subdomain}.${web.domains.url0}";
in
{
  type = "custom-api";
  title = "Jellyfin History";
  frameless = true;
  cache = "5m";
  options = {
    media-server = "jellyfin";
    base-url = jellyfinHost;
    api-key = config.sops.secrets."${service.name}-${jellyfin.name}".path;
    user-name = jellyfinUserName;
    history-length = "10";
    small-column = true;
    compact = true;
    show-thumbnail = false;
    thumbnail-aspect-ratio = "default";
    show-user = true;
    time-absolute = false;
    time-format = "Jan 02 15:04";
  };
  template = import ./config;
}
