Allow unlisted playlists to be viewed from /api/v1/playlists/
This commit is contained in:
parent
57a80a3c10
commit
bf48809b61
1 changed files with 5 additions and 5 deletions
|
@ -4596,7 +4596,7 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
user = env.get?("user").try &.as(User)
|
user = env.get?("user").try &.as(User)
|
||||||
if !playlist || !playlist.privacy.public? && playlist.author != user.try &.email
|
if !playlist || playlist.privacy.private? && playlist.author != user.try &.email
|
||||||
env.response.status_code = 404
|
env.response.status_code = 404
|
||||||
error_message = {"error" => "Playlist does not exist."}.to_json
|
error_message = {"error" => "Playlist does not exist."}.to_json
|
||||||
next error_message
|
next error_message
|
||||||
|
@ -4888,7 +4888,7 @@ patch "/api/v1/auth/playlists/:plid" do |env|
|
||||||
plid = env.params.url["plid"]
|
plid = env.params.url["plid"]
|
||||||
|
|
||||||
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
||||||
if !playlist || playlist.author != user.email && !playlist.privacy.public?
|
if !playlist || playlist.author != user.email && playlist.privacy.private?
|
||||||
env.response.status_code = 404
|
env.response.status_code = 404
|
||||||
error_message = {"error" => "Playlist does not exist."}.to_json
|
error_message = {"error" => "Playlist does not exist."}.to_json
|
||||||
next error_message
|
next error_message
|
||||||
|
@ -4923,7 +4923,7 @@ delete "/api/v1/auth/playlists/:plid" do |env|
|
||||||
plid = env.params.url["plid"]
|
plid = env.params.url["plid"]
|
||||||
|
|
||||||
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
||||||
if !playlist || playlist.author != user.email && !playlist.privacy.public?
|
if !playlist || playlist.author != user.email && playlist.privacy.private?
|
||||||
env.response.status_code = 404
|
env.response.status_code = 404
|
||||||
error_message = {"error" => "Playlist does not exist."}.to_json
|
error_message = {"error" => "Playlist does not exist."}.to_json
|
||||||
next error_message
|
next error_message
|
||||||
|
@ -4950,7 +4950,7 @@ post "/api/v1/auth/playlists/:plid/videos" do |env|
|
||||||
plid = env.params.url["plid"]
|
plid = env.params.url["plid"]
|
||||||
|
|
||||||
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
||||||
if !playlist || playlist.author != user.email && !playlist.privacy.public?
|
if !playlist || playlist.author != user.email && playlist.privacy.private?
|
||||||
env.response.status_code = 404
|
env.response.status_code = 404
|
||||||
error_message = {"error" => "Playlist does not exist."}.to_json
|
error_message = {"error" => "Playlist does not exist."}.to_json
|
||||||
next error_message
|
next error_message
|
||||||
|
@ -5016,7 +5016,7 @@ delete "/api/v1/auth/playlists/:plid/videos/:index" do |env|
|
||||||
index = env.params.url["index"].to_i64(16)
|
index = env.params.url["index"].to_i64(16)
|
||||||
|
|
||||||
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
playlist = PG_DB.query_one?("SELECT * FROM playlists WHERE id = $1", plid, as: InvidiousPlaylist)
|
||||||
if !playlist || playlist.author != user.email && !playlist.privacy.public?
|
if !playlist || playlist.author != user.email && playlist.privacy.private?
|
||||||
env.response.status_code = 404
|
env.response.status_code = 404
|
||||||
error_message = {"error" => "Playlist does not exist."}.to_json
|
error_message = {"error" => "Playlist does not exist."}.to_json
|
||||||
next error_message
|
next error_message
|
||||||
|
|
Loading…
Reference in a new issue