mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-23 14:03:37 +00:00
Use get_user for watch page
This commit is contained in:
parent
8d66493c01
commit
e2c50d4d1f
@ -193,8 +193,6 @@ before_all do |env|
|
|||||||
notifications = PG_DB.query_one?("SELECT cardinality(notifications) FROM users WHERE id = $1", sid, as: Int32)
|
notifications = PG_DB.query_one?("SELECT cardinality(notifications) FROM users WHERE id = $1", sid, as: Int32)
|
||||||
notifications ||= 0
|
notifications ||= 0
|
||||||
env.set "notifications", notifications
|
env.set "notifications", notifications
|
||||||
else
|
|
||||||
env.set "authorized", false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -219,9 +217,13 @@ get "/watch" do |env|
|
|||||||
|
|
||||||
authorized = env.get? "authorized"
|
authorized = env.get? "authorized"
|
||||||
if authorized
|
if authorized
|
||||||
|
headers = HTTP::Headers.new
|
||||||
|
headers["Cookie"] = env.request.headers["Cookie"]
|
||||||
|
|
||||||
sid = env.get("sid").as(String)
|
sid = env.get("sid").as(String)
|
||||||
|
|
||||||
subscriptions = PG_DB.query_one("SELECT subscriptions FROM users WHERE id = $1", sid, as: Array(String))
|
user = get_user(sid, client, headers, PG_DB)
|
||||||
|
subscriptions = user.subscriptions
|
||||||
else
|
else
|
||||||
subscriptions = [] of String
|
subscriptions = [] of String
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user