- Mount custom CSS, favicon, and JS into static directories - Create custom.js to inject theme CSS and favicon via JavaScript - Add CustomThemeInjector Plug in custom.exs to inject script tag - Custom theme features: - Pivoine rose primary color (#CE275B) - Gray tone backgrounds - Custom SVG favicon with rose gradient - Bootstrap 4 component overrides 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
1.6 KiB
Elixir
58 lines
1.6 KiB
Elixir
import Config
|
|
|
|
# Configure Swoosh SMTP adapter to skip TLS certificate verification
|
|
# This is needed for IONOS SMTP server which has certificate key usage issues
|
|
config :asciinema, Asciinema.Emails.Mailer,
|
|
adapter: Swoosh.Adapters.SMTP,
|
|
relay: System.get_env("SMTP_HOST"),
|
|
username: System.get_env("SMTP_USERNAME"),
|
|
password: System.get_env("SMTP_PASSWORD"),
|
|
port: System.get_env("SMTP_PORT") || 587,
|
|
tls: :always,
|
|
auth: :always,
|
|
ssl: false,
|
|
tls_options: [
|
|
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, "</head>") do
|
|
script_tag = ~s(<script src="/js/custom.js"></script>\n)
|
|
modified_body = String.replace(body, "</head>", "#{script_tag}</head>", 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]
|