From 5de36fd8d7c6129e4391d5e9e010f5260abe0903 Mon Sep 17 00:00:00 2001 From: zafer Date: Wed, 8 May 2024 00:21:04 +0300 Subject: [PATCH] use snapshot from video as channel og image --- lib/algora_web/live/channel_live.ex | 4 +++- lib/algora_web/live/chat_live.ex | 2 +- lib/algora_web/live/embed_live.ex | 2 +- lib/algora_web/live/video_live.ex | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/algora_web/live/channel_live.ex b/lib/algora_web/live/channel_live.ex index 5dbc586..43f1984 100644 --- a/lib/algora_web/live/channel_live.ex +++ b/lib/algora_web/live/channel_live.ex @@ -314,10 +314,12 @@ defmodule AlgoraWeb.ChannelLive do end defp apply_action(socket, :show, params) do + user = Accounts.get_user!(socket.assigns.channel.user_id) + socket |> assign(:page_title, socket.assigns.channel.name || params["channel_handle"]) |> assign(:page_description, socket.assigns.channel.tagline) - |> assign(:page_image, "#{AlgoraWeb.Endpoint.url()}/images/og/default.png") + |> assign(:page_image, Library.get_thumbnail_url(user)) end defp show_stream_modal(socket) do diff --git a/lib/algora_web/live/chat_live.ex b/lib/algora_web/live/chat_live.ex index 32f4071..c7acc57 100644 --- a/lib/algora_web/live/chat_live.ex +++ b/lib/algora_web/live/chat_live.ex @@ -184,6 +184,6 @@ defmodule AlgoraWeb.ChatLive do socket |> assign(:page_title, socket.assigns.channel.name || params["channel_handle"]) |> assign(:page_description, socket.assigns.channel.tagline) - |> assign(:page_image, "#{AlgoraWeb.Endpoint.url()}/images/og/default.png") + |> assign(:page_image, Library.get_thumbnail_url(socket.assigns.video)) end end diff --git a/lib/algora_web/live/embed_live.ex b/lib/algora_web/live/embed_live.ex index 3e43160..f651a6f 100644 --- a/lib/algora_web/live/embed_live.ex +++ b/lib/algora_web/live/embed_live.ex @@ -154,6 +154,6 @@ defmodule AlgoraWeb.EmbedLive do socket |> assign(:page_title, socket.assigns.channel.name || params["channel_handle"]) |> assign(:page_description, socket.assigns.channel.tagline) - |> assign(:page_image, "#{AlgoraWeb.Endpoint.url()}/images/og/default.png") + |> assign(:page_image, Library.get_thumbnail_url(socket.assigns.video)) end end diff --git a/lib/algora_web/live/video_live.ex b/lib/algora_web/live/video_live.ex index d563fb0..6e10dcb 100644 --- a/lib/algora_web/live/video_live.ex +++ b/lib/algora_web/live/video_live.ex @@ -634,7 +634,7 @@ defmodule AlgoraWeb.VideoLive do socket |> assign(:page_title, socket.assigns.channel.name || params["channel_handle"]) |> assign(:page_description, socket.assigns.channel.tagline) - |> assign(:page_image, "#{AlgoraWeb.Endpoint.url()}/images/og/default.png") + |> assign(:page_image, Library.get_thumbnail_url(socket.assigns.video)) end defp show_stream_modal(socket) do