From 196d009cff9c71bb9e6c4bc99b9c4060b79e5c46 Mon Sep 17 00:00:00 2001 From: Michael L Date: Fri, 18 Aug 2023 11:42:40 +0500 Subject: [PATCH] Add viewers of stream and show comments after video ends --- components/lenta/templates/stars.html | 6 ++++++ components/post/index.js | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/lenta/templates/stars.html b/components/lenta/templates/stars.html index c6ee332d40..b796c19ec5 100644 --- a/components/lenta/templates/stars.html +++ b/components/lenta/templates/stars.html @@ -99,6 +99,12 @@ <% if(Number(share.scnt)) {%>
<%-Number(share.scnt)%>
<% } %> <% } %> + + <% if(videoMeta?.viewers) {%> +
+
<%-Number(videoMeta.viewers)%>
+
+ <% } %> <% } %> diff --git a/components/post/index.js b/components/post/index.js index bc46e2341a..24236b8ad2 100644 --- a/components/post/index.js +++ b/components/post/index.js @@ -1145,11 +1145,15 @@ var post = (function () { var renders = { comments: function (clbk) { if ((!ed.repost || ed.fromempty) && ed.comments != 'no') { - if (!share.settings.c) { + const + meta = window.parseVideo(share.url), + state = _.clone(window.peertubeglobalcache[meta?.id]); + + if (!state?.isLive || !share.settings.c) { self.fastTemplate( 'commentspreview', function (rendered) { - var _el = el.c.find('.commentsWrapper'); + var _el = el.c.find('.commentsWrapper').addClass('commentsVisible'); var rf = ''; @@ -1616,6 +1620,9 @@ var post = (function () { } }, stars: function (clbk) { + const + meta = window.parseVideo(share.url), + state = _.clone(window.peertubeglobalcache[meta?.id]); self.shell( { @@ -1624,6 +1631,7 @@ var post = (function () { el: el.stars, data: { share: share, + videoMeta: state }, ignorelinksandimages : true, animation : false,