mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-19 19:38:51 +00:00
Clean useless database arguments (3/5)
This commit is contained in:
@@ -150,7 +150,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
return error_json(400, "User cannot have more than 100 playlists.")
|
||||
end
|
||||
|
||||
playlist = create_playlist(PG_DB, title, privacy, user)
|
||||
playlist = create_playlist(title, privacy, user)
|
||||
env.response.headers["Location"] = "#{HOST_URL}/api/v1/auth/playlists/#{playlist.id}"
|
||||
env.response.status_code = 201
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ module Invidious::Routes::API::V1::Misc
|
||||
end
|
||||
|
||||
begin
|
||||
playlist = get_playlist(PG_DB, plid, locale)
|
||||
playlist = get_playlist(plid, locale)
|
||||
rescue ex : InfoException
|
||||
return error_json(404, ex)
|
||||
rescue ex
|
||||
|
||||
@@ -6,9 +6,9 @@ module Invidious::Routes::Embed
|
||||
|
||||
if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
|
||||
begin
|
||||
playlist = get_playlist(PG_DB, plid, locale: locale)
|
||||
playlist = get_playlist(plid, locale: locale)
|
||||
offset = env.params.query["index"]?.try &.to_i? || 0
|
||||
videos = get_playlist_videos(PG_DB, playlist, offset: offset, locale: locale)
|
||||
videos = get_playlist_videos(playlist, offset: offset, locale: locale)
|
||||
rescue ex
|
||||
return error_template(500, ex)
|
||||
end
|
||||
@@ -60,9 +60,9 @@ module Invidious::Routes::Embed
|
||||
|
||||
if plid
|
||||
begin
|
||||
playlist = get_playlist(PG_DB, plid, locale: locale)
|
||||
playlist = get_playlist(plid, locale: locale)
|
||||
offset = env.params.query["index"]?.try &.to_i? || 0
|
||||
videos = get_playlist_videos(PG_DB, playlist, offset: offset, locale: locale)
|
||||
videos = get_playlist_videos(playlist, offset: offset, locale: locale)
|
||||
rescue ex
|
||||
return error_template(500, ex)
|
||||
end
|
||||
|
||||
@@ -265,7 +265,7 @@ module Invidious::Routes::Feeds
|
||||
|
||||
if plid.starts_with? "IV"
|
||||
if playlist = Invidious::Database::Playlists.select(id: plid)
|
||||
videos = get_playlist_videos(PG_DB, playlist, offset: 0, locale: locale)
|
||||
videos = get_playlist_videos(playlist, offset: 0, locale: locale)
|
||||
|
||||
return XML.build(indent: " ", encoding: "UTF-8") do |xml|
|
||||
xml.element("feed", "xmlns:yt": "http://www.youtube.com/xml/schemas/2015",
|
||||
|
||||
@@ -50,7 +50,7 @@ module Invidious::Routes::Playlists
|
||||
return error_template(400, "User cannot have more than 100 playlists.")
|
||||
end
|
||||
|
||||
playlist = create_playlist(PG_DB, title, privacy, user)
|
||||
playlist = create_playlist(title, privacy, user)
|
||||
|
||||
env.redirect "/playlist?list=#{playlist.id}"
|
||||
end
|
||||
@@ -66,8 +66,8 @@ module Invidious::Routes::Playlists
|
||||
user = user.as(User)
|
||||
|
||||
playlist_id = env.params.query["list"]
|
||||
playlist = get_playlist(PG_DB, playlist_id, locale)
|
||||
subscribe_playlist(PG_DB, user, playlist)
|
||||
playlist = get_playlist(playlist_id, locale)
|
||||
subscribe_playlist(user, playlist)
|
||||
|
||||
env.redirect "/playlist?list=#{playlist.id}"
|
||||
end
|
||||
@@ -161,7 +161,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
begin
|
||||
videos = get_playlist_videos(PG_DB, playlist, offset: (page - 1) * 100, locale: locale)
|
||||
videos = get_playlist_videos(playlist, offset: (page - 1) * 100, locale: locale)
|
||||
rescue ex
|
||||
videos = [] of PlaylistVideo
|
||||
end
|
||||
@@ -314,7 +314,7 @@ module Invidious::Routes::Playlists
|
||||
|
||||
begin
|
||||
playlist_id = env.params.query["playlist_id"]
|
||||
playlist = get_playlist(PG_DB, playlist_id, locale).as(InvidiousPlaylist)
|
||||
playlist = get_playlist(playlist_id, locale).as(InvidiousPlaylist)
|
||||
raise "Invalid user" if playlist.author != user.email
|
||||
rescue ex
|
||||
if redirect
|
||||
@@ -405,7 +405,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
begin
|
||||
playlist = get_playlist(PG_DB, plid, locale)
|
||||
playlist = get_playlist(plid, locale)
|
||||
rescue ex
|
||||
return error_template(500, ex)
|
||||
end
|
||||
@@ -422,7 +422,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
begin
|
||||
videos = get_playlist_videos(PG_DB, playlist, offset: (page - 1) * 100, locale: locale)
|
||||
videos = get_playlist_videos(playlist, offset: (page - 1) * 100, locale: locale)
|
||||
rescue ex
|
||||
return error_template(500, "Error encountered while retrieving playlist videos.<br>#{ex.message}")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user