mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-21 10:28:50 +00:00
Allow to set maximum custom playlist length via a config variable.
This commit is contained in:
@@ -226,8 +226,8 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
return error_json(403, "Invalid user")
|
||||
end
|
||||
|
||||
if playlist.index.size >= 500
|
||||
return error_json(400, "Playlist cannot have more than 500 videos")
|
||||
if playlist.index.size >= CONFIG.playlist_length_limit
|
||||
return error_json(400, "Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
|
||||
end
|
||||
|
||||
video_id = env.params.json["videoId"].try &.as(String)
|
||||
|
||||
@@ -330,11 +330,11 @@ module Invidious::Routes::Playlists
|
||||
when "action_edit_playlist"
|
||||
# TODO: Playlist stub
|
||||
when "action_add_video"
|
||||
if playlist.index.size >= 500
|
||||
if playlist.index.size >= CONFIG.playlist_length_limit
|
||||
if redirect
|
||||
return error_template(400, "Playlist cannot have more than 500 videos")
|
||||
return error_template(400, "Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
|
||||
else
|
||||
return error_json(400, "Playlist cannot have more than 500 videos")
|
||||
return error_json(400, "Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ module Invidious::Routes::Subscriptions
|
||||
json.field "privacy", playlist.privacy.to_s
|
||||
json.field "videos" do
|
||||
json.array do
|
||||
Invidious::Database::PlaylistVideos.select_ids(playlist.id, playlist.index, limit: 500).each do |video_id|
|
||||
Invidious::Database::PlaylistVideos.select_ids(playlist.id, playlist.index, limit: CONFIG.playlist_length_limit).each do |video_id|
|
||||
json.string video_id
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user