diff --git a/asciinema/compose.yaml b/asciinema/compose.yaml index 15ac611..3c42064 100644 --- a/asciinema/compose.yaml +++ b/asciinema/compose.yaml @@ -8,7 +8,7 @@ services: volumes: - asciinema_data:/var/opt/asciinema - ./custom.exs:/opt/app/etc/custom.exs:ro - - ./theme:/opt/app/priv/static/theme/custom:ro + - ./theme:/opt/app/priv/static/theme:ro environment: SECRET_KEY_BASE: ${ASCIINEMA_SECRET_KEY} URL_HOST: ${ASCIINEMA_TRAEFIK_HOST} diff --git a/asciinema/custom.exs b/asciinema/custom.exs index c929124..7969e6a 100644 --- a/asciinema/custom.exs +++ b/asciinema/custom.exs @@ -16,9 +16,21 @@ config :asciinema, Asciinema.Emails.Mailer, versions: [:"tlsv1.2", :"tlsv1.3"] ] -# Try to inject custom head HTML (if supported by asciinema) -config :asciinema, AsciinemaWeb.Endpoint, - extra_head_html: """ - - - """ +# Override static_paths to include our theme directory +# This allows serving custom CSS and favicon from /theme path +defmodule AsciinemaWeb do + def static_paths, do: ~w(assets fonts images js favicon.ico robots.txt theme) +end + +# Define a custom layout view that injects our theme CSS and favicon +defmodule AsciinemaWeb.CustomLayoutView do + def head(_conn, _assigns) do + Phoenix.HTML.raw(""" + + + """) + end +end + +# Override the layout view to use our custom head function +config :asciinema, AsciinemaWeb.LayoutView, head: &AsciinemaWeb.CustomLayoutView.head/2