summaryrefslogtreecommitdiffstats
path: root/src/invidious.cr
diff options
context:
space:
mode:
Diffstat (limited to 'src/invidious.cr')
-rw-r--r--src/invidious.cr18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 570c33e6..21a12ff2 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -655,7 +655,7 @@ get "/subscription_manager" do |env|
end
subscriptions = PG_DB.query_all("SELECT * FROM channels WHERE id = ANY(#{values})", as: InvidiousChannel)
- subscriptions.sort_by! { |channel| channel.author.downcase }
+ subscriptions.sort_by!(&.author.downcase)
if action_takeout
if format == "json"
@@ -703,13 +703,13 @@ get "/subscription_manager" do |env|
xml.element("outline", text: title, title: title) do
subscriptions.each do |channel|
if format == "newpipe"
- xmlUrl = "https://www.youtube.com/feeds/videos.xml?channel_id=#{channel.id}"
+ xml_url = "https://www.youtube.com/feeds/videos.xml?channel_id=#{channel.id}"
else
- xmlUrl = "#{HOST_URL}/feed/channel/#{channel.id}"
+ xml_url = "#{HOST_URL}/feed/channel/#{channel.id}"
end
xml.element("outline", text: channel.author, title: channel.author,
- "type": "rss", xmlUrl: xmlUrl)
+ "type": "rss", xmlUrl: xml_url)
end
end
end
@@ -759,7 +759,7 @@ post "/data_control" do |env|
body = JSON.parse(body)
if body["subscriptions"]?
- user.subscriptions += body["subscriptions"].as_a.map { |a| a.as_s }
+ user.subscriptions += body["subscriptions"].as_a.map(&.as_s)
user.subscriptions.uniq!
user.subscriptions = get_batch_channels(user.subscriptions, PG_DB, false, false)
@@ -768,7 +768,7 @@ post "/data_control" do |env|
end
if body["watch_history"]?
- user.watched += body["watch_history"].as_a.map { |a| a.as_s }
+ user.watched += body["watch_history"].as_a.map(&.as_s)
user.watched.uniq!
PG_DB.exec("UPDATE users SET watched = $1 WHERE email = $2", user.watched, user.email)
end
@@ -876,12 +876,12 @@ post "/data_control" do |env|
File.write(tempfile.path, entry.io.gets_to_end)
db = DB.open("sqlite3://" + tempfile.path)
- user.watched += db.query_all("SELECT url FROM streams", as: String).map { |url| url.lchop("https://www.youtube.com/watch?v=") }
+ user.watched += db.query_all("SELECT url FROM streams", as: String).map(&.lchop("https://www.youtube.com/watch?v="))
user.watched.uniq!
PG_DB.exec("UPDATE users SET watched = $1 WHERE email = $2", user.watched, user.email)
- user.subscriptions += db.query_all("SELECT url FROM subscriptions", as: String).map { |url| url.lchop("https://www.youtube.com/channel/") }
+ user.subscriptions += db.query_all("SELECT url FROM subscriptions", as: String).map(&.lchop("https://www.youtube.com/channel/"))
user.subscriptions.uniq!
user.subscriptions = get_batch_channels(user.subscriptions, PG_DB, false, false)
@@ -1351,7 +1351,7 @@ error 500 do |env, ex|
error_template(500, ex)
end
-static_headers do |response, filepath, filestat|
+static_headers do |response|
response.headers.add("Cache-Control", "max-age=2629800")
end