mirror of https://github.com/iv-org/invidious.git
Upgrade to Crystal 0.25 and update signature
This commit is contained in:
parent
604ae665b6
commit
f5ea832721
|
@ -1,5 +1,5 @@
|
||||||
name: invidious
|
name: invidious
|
||||||
version: 0.1.0
|
version: 0.2.0
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- Omar Roth <omarroth@hotmail.com>
|
- Omar Roth <omarroth@hotmail.com>
|
||||||
|
@ -19,6 +19,6 @@ dependencies:
|
||||||
github: detectlanguage/detectlanguage-crystal
|
github: detectlanguage/detectlanguage-crystal
|
||||||
branch: master
|
branch: master
|
||||||
|
|
||||||
crystal: 0.24.2
|
crystal: 0.25.0
|
||||||
|
|
||||||
license: AGPLv3
|
license: AGPLv3
|
||||||
|
|
|
@ -227,7 +227,7 @@ def fetch_video(id, client)
|
||||||
published = published.split(" ")
|
published = published.split(" ")
|
||||||
published = published[-3..-1].join(" ")
|
published = published[-3..-1].join(" ")
|
||||||
if !published.includes?("ago")
|
if !published.includes?("ago")
|
||||||
published = Time.parse(published, "%b %-d, %Y")
|
published = Time.parse(published, "%b %-d, %Y", Time::Location.local)
|
||||||
else
|
else
|
||||||
# Time matches format "20 hours ago", "40 minutes ago"...
|
# Time matches format "20 hours ago", "40 minutes ago"...
|
||||||
delta = published.split(" ")[0].to_i
|
delta = published.split(" ")[0].to_i
|
||||||
|
@ -298,10 +298,12 @@ end
|
||||||
def decrypt_signature(a)
|
def decrypt_signature(a)
|
||||||
a = a.split("")
|
a = a.split("")
|
||||||
|
|
||||||
a.delete_at(0..2)
|
a = splice(a, 60)
|
||||||
a = splice(a, 44)
|
|
||||||
a.delete_at(0..1)
|
a.delete_at(0..1)
|
||||||
a = splice(a, 34)
|
a = splice(a, 31)
|
||||||
|
a.reverse!
|
||||||
|
a = splice(a, 33)
|
||||||
|
a.delete_at(0..2)
|
||||||
|
|
||||||
return a.join("")
|
return a.join("")
|
||||||
end
|
end
|
||||||
|
@ -574,8 +576,8 @@ def fetch_channel(ucid, client, db, pull_videos = true)
|
||||||
rss.xpath_nodes("//feed/entry").each do |entry|
|
rss.xpath_nodes("//feed/entry").each do |entry|
|
||||||
video_id = entry.xpath_node("videoid").not_nil!.content
|
video_id = entry.xpath_node("videoid").not_nil!.content
|
||||||
title = entry.xpath_node("title").not_nil!.content
|
title = entry.xpath_node("title").not_nil!.content
|
||||||
published = Time.parse(entry.xpath_node("published").not_nil!.content, "%FT%X%z")
|
published = Time.parse(entry.xpath_node("published").not_nil!.content, "%FT%X%z", Time::Location.local)
|
||||||
updated = Time.parse(entry.xpath_node("updated").not_nil!.content, "%FT%X%z")
|
updated = Time.parse(entry.xpath_node("updated").not_nil!.content, "%FT%X%z", Time::Location.local)
|
||||||
author = entry.xpath_node("author/name").not_nil!.content
|
author = entry.xpath_node("author/name").not_nil!.content
|
||||||
ucid = entry.xpath_node("channelid").not_nil!.content
|
ucid = entry.xpath_node("channelid").not_nil!.content
|
||||||
|
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ end
|
||||||
# Add redirect if SSL is enabled
|
# Add redirect if SSL is enabled
|
||||||
if Kemal.config.ssl
|
if Kemal.config.ssl
|
||||||
spawn do
|
spawn do
|
||||||
server = HTTP::Server.new("0.0.0.0", 80) do |context|
|
server = HTTP::Server.new do |context|
|
||||||
redirect_url = "https://#{context.request.host}#{context.request.path}"
|
redirect_url = "https://#{context.request.host}#{context.request.path}"
|
||||||
if context.request.query
|
if context.request.query
|
||||||
redirect_url += "?#{context.request.query}"
|
redirect_url += "?#{context.request.query}"
|
||||||
|
@ -1009,6 +1009,7 @@ if Kemal.config.ssl
|
||||||
context.response.status_code = 301
|
context.response.status_code = 301
|
||||||
end
|
end
|
||||||
|
|
||||||
|
server.bind_tcp "0.0.0.0", 80
|
||||||
server.listen
|
server.listen
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue