From 889a502731904956bd8b3903dabe92b8c95d2891 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Tue, 24 Dec 2024 16:35:49 -0500 Subject: [PATCH] Support for auto-generated channels in Playlet backend --- CHANGELOG.md | 4 ++++ playlet-lib/src/components/ChannelView/ChannelView.bs | 7 +++++++ playlet-lib/src/config/invidious_video_api.yaml | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea59cf11..9c94c591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Support for auto-generated channels in Playlet backend + ### Removed - [YouTube.js](https://github.com/LuanRT/YouTube.js) from web app. It is no longer needed, so this reduces app size. diff --git a/playlet-lib/src/components/ChannelView/ChannelView.bs b/playlet-lib/src/components/ChannelView/ChannelView.bs index 39e45da4..1a33ac47 100644 --- a/playlet-lib/src/components/ChannelView/ChannelView.bs +++ b/playlet-lib/src/components/ChannelView/ChannelView.bs @@ -114,6 +114,13 @@ function CreateChannelFeeds(authorId as string, author as string, tabs as object feeds.Push(m.tabs[tabName](authorId, author, params)) end if end for + + ' If we're dealing with an auto-generated channel, we might not have any tabs at all. + ' In this case, it's better to show "home" instead of nothing at all. + if feeds.Count() = 0 and tabs.Count() > 0 and tabsParams <> invalid and tabsParams["featured"] <> invalid + feeds.Push(CreateChannelFeed("Home", "channel_featured", authorId, author, tabsParams["featured"])) + end if + return feeds end function diff --git a/playlet-lib/src/config/invidious_video_api.yaml b/playlet-lib/src/config/invidious_video_api.yaml index 076109ac..115710fb 100644 --- a/playlet-lib/src/config/invidious_video_api.yaml +++ b/playlet-lib/src/config/invidious_video_api.yaml @@ -165,6 +165,14 @@ channel_releases: paginationType: Continuation tryCount: 3 +# This is implemented only by Playlet backend. +# Created because auto-generated channels don't have tabs except for "featured" +channel_featured: + title: Channel Home + url: /api/v1/channels/{ucid}/featured + responseHandler: ChannelVideosHandler + paginationType: Continuation + watch_history: title: Watch history url: /api/v1/auth/history