Invidious is an alternative front-end to YouTube
Fix 'to_json' in struct PlaylistVideo
Samantaz Fox86f75758a764
diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.crindex 443d19d7..e25180c1 100644--- a/src/invidious/playlists.cr+++ b/src/invidious/playlists.cr@@ -57,7 +57,7 @@ struct PlaylistVideoendend- def to_json(locale, json : JSON::Builder, index : Int32?)+ def to_json(json : JSON::Builder, index : Int32? = nil)json.object dojson.field "title", self.titlejson.field "videoId", self.id@@ -81,14 +81,8 @@ struct PlaylistVideoendend- def to_json(locale, json : JSON::Builder? = nil, index : Int32? = nil)- if json- to_json(locale, json, index: index)- else- JSON.build do |json|- to_json(locale, json, index: index)- end- end+ def to_json(_json : Nil, index : Int32? = nil)+ JSON.build { |json| to_json(json, index: index) }endend@@ -144,7 +138,7 @@ struct Playlistjson.array dovideos = get_playlist_videos(PG_DB, self, offset: offset, locale: locale, video_id: video_id)videos.each do |video|- video.to_json(locale, json)+ video.to_json(json)endendend@@ -224,7 +218,7 @@ struct InvidiousPlaylistvideos = get_playlist_videos(PG_DB, self, offset: offset, locale: locale, video_id: video_id)videos.each_with_index do |video, index|- video.to_json(locale, json, offset + index)+ video.to_json(json, offset + index)endendenddiff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.crindex 7950b302..cdd9e2f6 100644--- a/src/invidious/routes/api/v1/authenticated.cr+++ b/src/invidious/routes/api/v1/authenticated.cr@@ -274,7 +274,10 @@ module Invidious::Routes::API::V1::Authenticatedenv.response.headers["Location"] = "#{HOST_URL}/api/v1/auth/playlists/#{plid}/videos/#{playlist_video.index.to_u64.to_s(16).upcase}"env.response.status_code = 201- playlist_video.to_json(locale, index: playlist.index.size)++ JSON.build do |json|+ playlist_video.to_json(json, index: playlist.index.size)+ endenddef self.delete_video_in_playlist(env)