From 1ef3d9729ce06efabe8444991f4a214f60dc1b6e Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Wed, 10 Apr 2024 15:03:11 +0200 Subject: [PATCH] Use short public stream token in the command in streaming instructions --- lib/asciinema_web/controllers/live_stream/show.html.heex | 2 +- lib/asciinema_web/controllers/live_stream_html.ex | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/asciinema_web/controllers/live_stream/show.html.heex b/lib/asciinema_web/controllers/live_stream/show.html.heex index 988534316..59a9d8037 100644 --- a/lib/asciinema_web/controllers/live_stream/show.html.heex +++ b/lib/asciinema_web/controllers/live_stream/show.html.heex @@ -105,7 +105,7 @@ name="rec-cmd-asciinema-streamer" data-behavior="auto-select" readonly - value={"asciinema stream -f #{ws_producer_url(@stream)}"} + value={"asciinema stream -f #{short_public_token(@stream)}"} />

diff --git a/lib/asciinema_web/controllers/live_stream_html.ex b/lib/asciinema_web/controllers/live_stream_html.ex index 319532deb..a19fada68 100644 --- a/lib/asciinema_web/controllers/live_stream_html.ex +++ b/lib/asciinema_web/controllers/live_stream_html.ex @@ -40,6 +40,10 @@ defmodule AsciinemaWeb.LiveStreamHTML do end end + defp short_public_token(stream) do + String.slice(stream.public_token, 0, 4) + end + def cinema_height(stream) do MediaView.cinema_height(cols(stream), rows(stream)) end