From e445a5f82e3879ed91f525c5f664837f68b7738a Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 13:56:07 +0100 Subject: [PATCH 1/7] Upgrade caniuse-lite --- assets/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/package-lock.json b/assets/package-lock.json index 930243676..bc7766a3e 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -2485,9 +2485,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001587", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", - "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==", + "version": "1.0.30001677", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001677.tgz", + "integrity": "sha512-fmfjsOlJUpMWu+mAAtZZZHz7UEwsUxIIvu1TJfO1HqFQvB/B+ii0xr9B5HpbZY/mC4XZ8SvjHJqtAY6pDPQEog==", "dev": true, "funding": [ { From de941f7af077b37fad4973d3db2da8642319f95f Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 13:56:30 +0100 Subject: [PATCH 2/7] Upgrade tzdata --- mix.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.lock b/mix.lock index 3e3128ea1..dde0ab33c 100644 --- a/mix.lock +++ b/mix.lock @@ -36,7 +36,7 @@ "merkle_map": {:hex, :merkle_map, "0.2.1", "01a88c87a6b9fb594c67c17ebaf047ee55ffa34e74297aa583ed87148006c4c8", [:mix], [], "hexpm", "fed4d143a5c8166eee4fa2b49564f3c4eace9cb252f0a82c1613bba905b2d04d"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, + "mimerl": {:hex, :mimerl, "1.3.0", "d0cd9fc04b9061f82490f6581e0128379830e78535e017f7780f37fea7545726", [:rebar3], [], "hexpm", "a1e15a50d1887217de95f0b9b0793e32853f7c258a5cd227650889b38839fe9d"}, "mix_test_watch": {:hex, :mix_test_watch, "1.2.0", "1f9acd9e1104f62f280e30fc2243ae5e6d8ddc2f7f4dc9bceb454b9a41c82b42", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "278dc955c20b3fb9a3168b5c2493c2e5cffad133548d307e0a50c7f2cfbf34f6"}, "mochiweb": {:hex, :mochiweb, "2.22.0", "f104d6747c01a330c38613561977e565b788b9170055c5241ac9dd6e4617cba5", [:rebar3], [], "hexpm", "cbbd1fd315d283c576d1c8a13e0738f6dafb63dc840611249608697502a07655"}, "oban": {:hex, :oban, "2.17.2", "bcd1276473d8635475076b01032c00474f9c7841d3a2ca46ead26e1ec023cdd3", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, "~> 0.9", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "de90489c05c039a6d942fa54d8fa13b858db315da2178e4e2c35c82c0a3ab556"}, @@ -72,7 +72,7 @@ "telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"}, "timex": {:hex, :timex, "3.7.11", "bb95cb4eb1d06e27346325de506bcc6c30f9c6dea40d1ebe390b262fad1862d1", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.20", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.1", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8b9024f7efbabaf9bd7aa04f65cf8dcd7c9818ca5737677c7b76acbc6a94d1aa"}, "toml": {:hex, :toml, "0.7.0", "fbcd773caa937d0c7a02c301a1feea25612720ac3fa1ccb8bfd9d30d822911de", [:mix], [], "hexpm", "0690246a2478c1defd100b0c9b89b4ea280a22be9a7b313a8a058a2408a2fa70"}, - "tzdata": {:hex, :tzdata, "1.1.1", "20c8043476dfda8504952d00adac41c6eda23912278add38edc140ae0c5bcc46", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "a69cec8352eafcd2e198dea28a34113b60fdc6cb57eb5ad65c10292a6ba89787"}, + "tzdata": {:hex, :tzdata, "1.1.2", "45e5f1fcf8729525ec27c65e163be5b3d247ab1702581a94674e008413eef50b", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "cec7b286e608371602318c414f344941d5eb0375e14cfdab605cca2fe66cba8b"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, "websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"}, "websock_adapter": {:hex, :websock_adapter, "0.5.5", "9dfeee8269b27e958a65b3e235b7e447769f66b5b5925385f5a569269164a210", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "4b977ba4a01918acbf77045ff88de7f6972c2a009213c515a445c48f224ffce9"}, From 285bc229b952f7871b653c89df5eb974b018d5b8 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 13:56:42 +0100 Subject: [PATCH 3/7] Disable tzdata's auto-update mechanism This solves the problem described in #453 --- config/config.exs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/config.exs b/config/config.exs index 725fa3a1b..e2efa929f 100644 --- a/config/config.exs +++ b/config/config.exs @@ -112,6 +112,8 @@ config :asciinema, Oban, config :scrivener_html, view_style: :bootstrap_v4 +config :tzdata, :autoupdate, :disabled + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{config_env()}.exs" From 4589fb748bebae24ba58715f5159b1f69a7b066c Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 15:32:21 +0100 Subject: [PATCH 4/7] Add test for SVG rendering --- test/controllers/recording_svg_test.exs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/controllers/recording_svg_test.exs diff --git a/test/controllers/recording_svg_test.exs b/test/controllers/recording_svg_test.exs new file mode 100644 index 000000000..0dc5fddec --- /dev/null +++ b/test/controllers/recording_svg_test.exs @@ -0,0 +1,19 @@ +defmodule Asciinema.RecordingSvgTest do + use ExUnit.Case, async: true + alias AsciinemaWeb.RecordingSVG + import Asciinema.Factory + + describe "show/1" do + test "renders SVG document" do + asciicast = build(:asciicast, snapshot: [[["foobar", %{}]], [["bazqux", %{}]]]) + + svg = render_svg(asciicast) + + assert svg =~ ~r/^<\?xml.+foobar.+bazqux/s + end + end + + defp render_svg(asciicast) do + Phoenix.LiveViewTest.rendered_to_string(RecordingSVG.show(%{asciicast: asciicast})) + end +end From c532f600ea210eb74eb91ef7f9a9d259d85a0606 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 15:45:51 +0100 Subject: [PATCH 5/7] Fix RGB colors rendering in SVG --- lib/asciinema_web/controllers/recording_svg.ex | 2 ++ test/controllers/recording_svg_test.exs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/asciinema_web/controllers/recording_svg.ex b/lib/asciinema_web/controllers/recording_svg.ex index 612c54dc0..e6e7e8401 100644 --- a/lib/asciinema_web/controllers/recording_svg.ex +++ b/lib/asciinema_web/controllers/recording_svg.ex @@ -45,6 +45,7 @@ defmodule AsciinemaWeb.RecordingSVG do defp bg_color(attrs, theme, default_fallback \\ false) defp bg_color(%{"bg" => bg}, theme, _) when is_integer(bg), do: Themes.color(theme, bg) + defp bg_color(%{"bg" => "#" <> _ = c}, _theme, _), do: c defp bg_color(%{"bg" => [_r, _g, _b] = c}, _theme, _), do: Colors.hex(c) defp bg_color(%{"bg" => "rgb(" <> _ = c}, _theme, _), do: c defp bg_color(_, _, false), do: nil @@ -52,6 +53,7 @@ defmodule AsciinemaWeb.RecordingSVG do defp fg_color(attrs, theme, default_fallback \\ false) defp fg_color(%{"fg" => fg}, theme, _) when is_integer(fg), do: Themes.color(theme, fg) + defp fg_color(%{"fg" => "#" <> _ = c}, _theme, _), do: c defp fg_color(%{"fg" => [_r, _g, _b] = c}, _theme, _), do: Colors.hex(c) defp fg_color(%{"fg" => "rgb(" <> _ = c}, _theme, _), do: c defp fg_color(_, _, false), do: nil diff --git a/test/controllers/recording_svg_test.exs b/test/controllers/recording_svg_test.exs index 0dc5fddec..f427b523f 100644 --- a/test/controllers/recording_svg_test.exs +++ b/test/controllers/recording_svg_test.exs @@ -11,6 +11,22 @@ defmodule Asciinema.RecordingSvgTest do assert svg =~ ~r/^<\?xml.+foobar.+bazqux/s end + + test "supports RGB color in fg/bg text attrs" do + asciicast = + build(:asciicast, + snapshot: [ + [["foo", %{"fg" => [16, 32, 48]}], ["bar", %{"bg" => "rgb(64,80,96)"}]], + [["baz", %{"fg" => "#708090"}]] + ] + ) + + svg = render_svg(asciicast) + + assert svg =~ "#102030" + assert svg =~ "rgb(64,80,96)" + assert svg =~ "#708090" + end end defp render_svg(asciicast) do From 66c6472867039f495dce2c943879268e46db752c Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 15:51:53 +0100 Subject: [PATCH 6/7] Link to the latest CLI 3.0 RC release --- lib/asciinema_web/controllers/live_stream_html/show.html.heex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/asciinema_web/controllers/live_stream_html/show.html.heex b/lib/asciinema_web/controllers/live_stream_html/show.html.heex index f3b15aff8..03a7217c8 100644 --- a/lib/asciinema_web/controllers/live_stream_html/show.html.heex +++ b/lib/asciinema_web/controllers/live_stream_html/show.html.heex @@ -104,7 +104,7 @@

How to stream

- asciinema CLI 3.0: + asciinema CLI 3.0:

<.input From 65d8f8df2786b56f8904de0b34c23e83b7ae08e0 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 3 Nov 2024 15:57:12 +0100 Subject: [PATCH 7/7] Tweak visibility setting annotation --- lib/asciinema_web/controllers/user_html/edit.html.heex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/asciinema_web/controllers/user_html/edit.html.heex b/lib/asciinema_web/controllers/user_html/edit.html.heex index c3a7ddac9..171282440 100644 --- a/lib/asciinema_web/controllers/user_html/edit.html.heex +++ b/lib/asciinema_web/controllers/user_html/edit.html.heex @@ -138,7 +138,7 @@ - NOTE: This applies to *new* uploads. Existing recordings are not affected by changes to this setting. + NOTE: This setting applies to *new* uploads. Existing recordings are not affected by changes to this setting.