|
|
@ -217,17 +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)
|
|
|
|
|
|
|
|
|
|
|
|
user = get_user(sid, client, headers, PG_DB)
|
|
|
|
subscriptions = PG_DB.query_one?("SELECT subscriptions FROM users WHERE id = $1", sid, as: Array(String))
|
|
|
|
subscriptions = user.subscriptions
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
subscriptions = [] of String
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subscriptions = [] of String
|
|
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
video = get_video(id, client, PG_DB)
|
|
|
|
video = get_video(id, client, PG_DB)
|
|
|
|
rescue ex
|
|
|
|
rescue ex
|
|
|
|