From dd73774f7d24daa382b2ffbe8ffc17177c28065f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sun, 9 Nov 2025 09:52:16 +0100 Subject: [PATCH] fix: remove broken CustomThemeInjector Plug from custom.exs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Plug was causing AsciinemaWeb.Endpoint to fail on startup. Reverting to just SMTP configuration while we find a proper way to inject custom theme. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- asciinema/custom.exs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/asciinema/custom.exs b/asciinema/custom.exs index 46a7ef5..dd1b726 100644 --- a/asciinema/custom.exs +++ b/asciinema/custom.exs @@ -15,43 +15,3 @@ config :asciinema, Asciinema.Emails.Mailer, verify: :verify_none, versions: [:"tlsv1.2", :"tlsv1.3"] ] - -# Custom Plug to inject theme JavaScript into HTML responses -defmodule CustomThemeInjector do - @behaviour Plug - - def init(opts), do: opts - - def call(conn, _opts) do - Plug.Conn.register_before_send(conn, fn conn -> - if html_response?(conn) do - inject_custom_script(conn) - else - conn - end - end) - end - - defp html_response?(conn) do - case Plug.Conn.get_resp_header(conn, "content-type") do - [content_type | _] -> String.contains?(content_type, "text/html") - [] -> false - end - end - - defp inject_custom_script(conn) do - {status, headers, body} = Plug.Conn.sent_resp(conn) - - if is_binary(body) and String.contains?(body, "") do - script_tag = ~s(\n) - modified_body = String.replace(body, "", "#{script_tag}", global: false) - %{conn | status: status, resp_headers: headers, resp_body: modified_body} - else - conn - end - end -end - -# Add the custom plug to the endpoint -config :asciinema, AsciinemaWeb.Endpoint, - http: [plug: CustomThemeInjector]