From a52bb647807607471135c4510c13fca9c9b25c22 Mon Sep 17 00:00:00 2001 From: Korbs Date: Wed, 11 Sep 2024 09:35:01 -0400 Subject: [PATCH] Fix channel --- source/src/pages/channel/[...slug].astro | 34 ++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/source/src/pages/channel/[...slug].astro b/source/src/pages/channel/[...slug].astro index dde71c4..cb9d54c 100755 --- a/source/src/pages/channel/[...slug].astro +++ b/source/src/pages/channel/[...slug].astro @@ -17,6 +17,13 @@ const CreatorId = Astro.url.href.split("channel/").pop(); const channel = await fetch(DEFAULT_MEDIA_DATA_PROXY + "/api/v1/channels/" + CreatorId).then((response) => response.json()); const DescriptionFormat = channel.descriptionHtml.replaceAll("\n", "
"); +// Is the user logged in? +if (Astro.cookies.get('sb-access-token') === undefined) { + var Guest = true +} else { + var Guest = false +} + // User Subscription import { supabase } from "@library/supabase" const { data: { user } } = await supabase.auth.getUser() @@ -27,10 +34,16 @@ let { data: subs } = await supabase .eq('UserSubscribed', id) .eq('Id', CreatorId) -if (subs[0] === undefined) { - var Subbed = false -} else { - var Subbed = true + +if (Guest === false) { + if (subs[0] === undefined) { + var Subbed = false + } else { + var Subbed = true + } +} +else { + var Subbed = "NotLoggedIn" } --- @@ -43,6 +56,17 @@ if (subs[0] === undefined) { : Follow } + { + ()=> { + if (Subbed === true) { + return Unfollow + } else if (Subbed === false) { + return Follow + } else if(Subbed === "NotLoggedIn") { + return null + } + } + }
@@ -68,7 +92,7 @@ if (subs[0] === undefined) {


-

{t("CHANNEL.LATEST")}

+

Latest Videos

{channel.latestVideos.map((data) =>