Skip to content

Commit

Permalink
Fix for removing deleted channels from bookmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
iBicha committed Nov 16, 2024
1 parent e32ed96 commit 57f6da3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Sort options for channel shorts

### Fixed

- Bug where deleted channels cannot be removed from bookmarks

## [0.29.2] - 2024-11-07

### Changed
Expand Down
37 changes: 35 additions & 2 deletions playlet-lib/src/components/Services/Invidious/InvidiousService.bs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ namespace Invidious

statusCode = response.StatusCode()
if statusCode = 404
' Similar to VideoInfoHandler, we can return a valid response
' in case of a deleted playlist.
response.OverrideStatusCode(200)
return {
isLastPage: true
Expand All @@ -379,6 +381,21 @@ namespace Invidious
function ChannelVideosHandler(context as object) as object
response = context.response

statusCode = response.StatusCode()
if statusCode = 404
' Similar to VideoInfoHandler, we can return a valid response
' in case of a deleted channel.
response.OverrideStatusCode(200)
return {
isLastPage: true
items: [{
"type": "video"
"videoId": "-----------"
"title": "[Channel videos not found]"
}]
}
end if

if response.StatusCode() = 200
json = response.Json()
return {
Expand Down Expand Up @@ -406,7 +423,7 @@ namespace Invidious
response = context.response

statusCode = response.StatusCode()
if statusCode >= 500
if statusCode >= 500 or statusCode = 404
' In some cases, such as a video became private, or a live stream ended,
' Invidious returns a 500 error. We can in this case return a valid response
' with just a video id, which will allow us to show a valid thumbnail if possible.
Expand Down Expand Up @@ -438,6 +455,8 @@ namespace Invidious

statusCode = response.StatusCode()
if statusCode = 404
' Similar to VideoInfoHandler, we can return a valid response
' in case of a deleted playlist.
response.OverrideStatusCode(200)
return {
items: [{
Expand All @@ -461,7 +480,21 @@ namespace Invidious
function ChannelInfoHandler(context as object) as object
response = context.response

if response.StatusCode() = 200
statusCode = response.StatusCode()
if statusCode = 404
' Similar to VideoInfoHandler, we can return a valid response
' in case of a deleted channel.
response.OverrideStatusCode(200)
return {
items: [{
"type": "channel"
"authorId": context.feedSource.pathParams.ucid
"author": "[Channel not found]"
}]
}
end if

if statusCode = 200
json = response.Json()
json.type = "channel"
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ namespace InvidiousContent

function GetChannelThumbnail(authorThumbnails as object) as string
if authorThumbnails = invalid or authorThumbnails.Count() = 0
return ""
return "pkg:/images/icons/user-200.png"
end if
url = authorThumbnails[authorThumbnails.Count() - 1].url
if url.startsWith("//")
Expand Down

0 comments on commit 57f6da3

Please sign in to comment.