mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add home page
This commit is contained in:
parent
3bd6f0151b
commit
a9cea62d5b
3 changed files with 58 additions and 2 deletions
|
@ -123,6 +123,21 @@ macro templated(filename)
|
|||
end
|
||||
|
||||
get "/" do |env|
|
||||
top = rank_videos(PG_DB, 120)
|
||||
|
||||
args = [] of String
|
||||
1..(top.size - 1).times { |i| args << "($#{i + 1}), " }
|
||||
args << "($#{top.size}) "
|
||||
args = args.join("")
|
||||
|
||||
videos = [] of Video
|
||||
PG_DB.query("SELECT * FROM videos d INNER JOIN (VALUES #{args}) v(id) USING (id)", top) do |rs|
|
||||
rs.each do
|
||||
video = rs.read(Video)
|
||||
videos << video
|
||||
end
|
||||
end
|
||||
|
||||
templated "index"
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue