Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Nov 3, 2024
2 parents 64a9184 + 65d8f8d commit f712afd
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 7 deletions.
6 changes: 3 additions & 3 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<h2>How to stream</h2>

<h3>
<a href="https://github.com/asciinema/asciinema/releases/tag/v3.0.0-rc.2">asciinema CLI 3.0</a>:
<a href="https://github.com/asciinema/asciinema/releases/tag/v3.0.0-rc.3">asciinema CLI 3.0</a>:
</h3>

<.input
Expand Down
2 changes: 2 additions & 0 deletions lib/asciinema_web/controllers/recording_svg.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ 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
defp bg_color(_, theme, true), do: theme.bg

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
Expand Down
2 changes: 1 addition & 1 deletion lib/asciinema_web/controllers/user_html/edit.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
</small>
</div>
<small class="form-text text-muted">
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.
</small>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down Expand Up @@ -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"},
Expand Down
35 changes: 35 additions & 0 deletions test/controllers/recording_svg_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
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

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
Phoenix.LiveViewTest.rendered_to_string(RecordingSVG.show(%{asciicast: asciicast}))
end
end

0 comments on commit f712afd

Please sign in to comment.