summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2021-12-07 03:57:18 +0100
committerSamantaz Fox <coding@samantaz.fr>2022-01-04 17:15:43 +0100
commit302fecbdcb8924b2f3a7cf8905f901c044cec728 (patch)
treea48cbb441266db7722aa716eb48d9bf62fc15a10
parentd74873fed1a4da2c2eb51a47932207b65ca473e5 (diff)
downloadinvidious-302fecbdcb8924b2f3a7cf8905f901c044cec728.tar.gz
invidious-302fecbdcb8924b2f3a7cf8905f901c044cec728.tar.bz2
invidious-302fecbdcb8924b2f3a7cf8905f901c044cec728.zip
Clean useless database arguments (5/5)
-rw-r--r--src/invidious/helpers/utils.cr2
-rw-r--r--src/invidious/routes/api/v1/authenticated.cr2
-rw-r--r--src/invidious/routes/feeds.cr4
-rw-r--r--src/invidious/users.cr2
4 files changed, 4 insertions, 6 deletions
diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr
index 7bbbcb92..8453d605 100644
--- a/src/invidious/helpers/utils.cr
+++ b/src/invidious/helpers/utils.cr
@@ -1,5 +1,3 @@
-require "db"
-
# See http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
def ci_lower_bound(pos, n)
if n == 0
diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr
index 44603c9a..fda655ef 100644
--- a/src/invidious/routes/api/v1/authenticated.cr
+++ b/src/invidious/routes/api/v1/authenticated.cr
@@ -44,7 +44,7 @@ module Invidious::Routes::API::V1::Authenticated
page = env.params.query["page"]?.try &.to_i?
page ||= 1
- videos, notifications = get_subscription_feed(PG_DB, user, max_results, page)
+ videos, notifications = get_subscription_feed(user, max_results, page)
JSON.build do |json|
json.object do
diff --git a/src/invidious/routes/feeds.cr b/src/invidious/routes/feeds.cr
index 5dcef351..fd8c25ce 100644
--- a/src/invidious/routes/feeds.cr
+++ b/src/invidious/routes/feeds.cr
@@ -94,7 +94,7 @@ module Invidious::Routes::Feeds
page = env.params.query["page"]?.try &.to_i?
page ||= 1
- videos, notifications = get_subscription_feed(PG_DB, user, max_results, page)
+ videos, notifications = get_subscription_feed(user, max_results, page)
# "updated" here is used for delivering new notifications, so if
# we know a user has looked at their feed e.g. in the past 10 minutes,
@@ -234,7 +234,7 @@ module Invidious::Routes::Feeds
params = HTTP::Params.parse(env.params.query["params"]? || "")
- videos, notifications = get_subscription_feed(PG_DB, user, max_results, page)
+ videos, notifications = get_subscription_feed(user, max_results, page)
XML.build(indent: " ", encoding: "UTF-8") do |xml|
xml.element("feed", "xmlns:yt": "http://www.youtube.com/xml/schemas/2015",
diff --git a/src/invidious/users.cr b/src/invidious/users.cr
index ad836d61..49074994 100644
--- a/src/invidious/users.cr
+++ b/src/invidious/users.cr
@@ -220,7 +220,7 @@ def subscribe_ajax(channel_id, action, env_headers)
end
end
-def get_subscription_feed(db, user, max_results = 40, page = 1)
+def get_subscription_feed(user, max_results = 40, page = 1)
limit = max_results.clamp(0, MAX_ITEMS_PER_PAGE)
offset = (page - 1) * limit