diff --git a/src/invidious.cr b/src/invidious.cr index b0df9dc0..c9392c13 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -280,7 +280,7 @@ get "/watch" do |env| user = env.get? "user" if user user = user.as(User) - if user.watched != ["N/A"] && !user.watched.includes? id + if !user.watched.includes? id PG_DB.exec("UPDATE users SET watched = watched || $1 WHERE id = $2", [id], user.id) end @@ -1670,11 +1670,7 @@ post "/login" do |env| sid = Base64.encode(Random::Secure.random_bytes(50)) user = create_user(sid, email, password) - if user.watched = ["N/A"] - user_array = user.to_a[0..-2] - else - user_array = user.to_a - end + user_array = user.to_a user_array[5] = user_array[5].to_json args = arg_array(user_array) diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index 26a1aaa2..b76befb2 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -148,10 +148,7 @@ class User }, password: String?, token: String, - watched: { - type: Array(String), - default: ["N/A"], - }, + watched: Array(String), }) end @@ -825,11 +822,7 @@ def get_user(sid, client, headers, db, refresh = true) if refresh && Time.now - user.updated > 1.minute user = fetch_user(sid, client, headers, db) - if user.watched = ["N/A"] - user_array = user.to_a[0..-2] - else - user_array = user.to_a - end + user_array = user.to_a user_array[5] = user_array[5].to_json args = arg_array(user_array) @@ -839,11 +832,7 @@ def get_user(sid, client, headers, db, refresh = true) end else user = fetch_user(sid, client, headers, db) - if user.watched = ["N/A"] - user_array = user.to_a[0..-2] - else - user_array = user.to_a - end + user_array = user.to_a user_array[5] = user_array[5].to_json args = arg_array(user.to_a)