mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 13:33:38 +00:00
Fix playlist limit
This commit is contained in:
parent
4818b89ab1
commit
7c45026383
@ -453,7 +453,13 @@ feed_threads: 1
|
||||
##
|
||||
#modified_source_code_url: ""
|
||||
|
||||
|
||||
##
|
||||
## Maximum custom playlist length limit.
|
||||
##
|
||||
## Accepted values: Integer
|
||||
## Default: 500
|
||||
##
|
||||
#playlist_length_limit: 500
|
||||
|
||||
#########################################
|
||||
#
|
||||
@ -859,7 +865,7 @@ default_user_preferences:
|
||||
## Default: false
|
||||
##
|
||||
#automatic_instance_redirect: false
|
||||
|
||||
|
||||
##
|
||||
## Show the entire video description by default (when set to 'false',
|
||||
## only the first few lines of the description are shown and a
|
||||
@ -869,11 +875,3 @@ default_user_preferences:
|
||||
## Default: false
|
||||
##
|
||||
#extend_desc: false
|
||||
|
||||
##
|
||||
## Maximum custom playlist length limit.
|
||||
##
|
||||
## Accepted values: Integer
|
||||
## Default: 500
|
||||
##
|
||||
#playlist_length_limit: 500
|
||||
|
@ -248,7 +248,7 @@ module Invidious::Database::PlaylistVideos
|
||||
return PG_DB.query_one?(request, plid, index, as: String)
|
||||
end
|
||||
|
||||
def select_ids(plid : String, index : VideoIndex, limit = CONFIG.playlist_length_limit) : Array(String)
|
||||
def select_ids(plid : String, index : VideoIndex, limit = 500) : Array(String)
|
||||
request = <<-SQL
|
||||
SELECT id FROM playlist_videos
|
||||
WHERE plid = $1
|
||||
|
@ -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: CONFIG.playlist_length_limit).each do |video_id|
|
||||
Invidious::Database::PlaylistVideos.select_ids(playlist.id, playlist.index, limit: 500).each do |video_id|
|
||||
json.string video_id
|
||||
end
|
||||
end
|
||||
|
@ -71,7 +71,9 @@ struct Invidious::User
|
||||
Invidious::Database::Playlists.update_description(playlist.id, description)
|
||||
|
||||
videos = item["videos"]?.try &.as_a?.try &.each_with_index do |video_id, idx|
|
||||
raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos") if idx > 500
|
||||
if idx > CONFIG.playlist_length_limit
|
||||
raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
|
||||
end
|
||||
|
||||
video_id = video_id.try &.as_s?
|
||||
next if !video_id
|
||||
|
Loading…
Reference in New Issue
Block a user