forked from midou/invidious
Remove top page
This commit is contained in:
@ -239,7 +239,6 @@ struct Config
|
||||
hmac_key: String?, # HMAC signing key for CSRF tokens and verifying pubsub subscriptions
|
||||
domain: String?, # Domain to be used for links to resources on the site where an absolute URL is required
|
||||
use_pubsub_feeds: {type: Bool | Int32, default: false}, # Subscribe to channels using PubSubHubbub (requires domain, hmac_key)
|
||||
top_enabled: {type: Bool, default: true},
|
||||
captcha_enabled: {type: Bool, default: true},
|
||||
login_enabled: {type: Bool, default: true},
|
||||
registration_enabled: {type: Bool, default: true},
|
||||
@ -276,30 +275,6 @@ struct DBConfig
|
||||
})
|
||||
end
|
||||
|
||||
def rank_videos(db, n)
|
||||
top = [] of {Float64, String}
|
||||
|
||||
db.query("SELECT id, wilson_score, published FROM videos WHERE views > 5000 ORDER BY published DESC LIMIT 1000") do |rs|
|
||||
rs.each do
|
||||
id = rs.read(String)
|
||||
wilson_score = rs.read(Float64)
|
||||
published = rs.read(Time)
|
||||
|
||||
# Exponential decay, older videos tend to rank lower
|
||||
temperature = wilson_score * Math.exp(-0.000005*((Time.utc - published).total_minutes))
|
||||
top << {temperature, id}
|
||||
end
|
||||
end
|
||||
|
||||
top.sort!
|
||||
|
||||
# Make hottest come first
|
||||
top.reverse!
|
||||
top = top.map { |a, b| b }
|
||||
|
||||
return top[0..n - 1]
|
||||
end
|
||||
|
||||
def login_req(f_req)
|
||||
data = {
|
||||
# Unfortunately there's not much information available on `bgRequest`; part of Google's BotGuard
|
||||
|
@ -170,41 +170,6 @@ def subscribe_to_feeds(db, logger, key, config)
|
||||
end
|
||||
end
|
||||
|
||||
def pull_top_videos(config, db)
|
||||
loop do
|
||||
begin
|
||||
top = rank_videos(db, 40)
|
||||
rescue ex
|
||||
sleep 1.minute
|
||||
Fiber.yield
|
||||
|
||||
next
|
||||
end
|
||||
|
||||
if top.size == 0
|
||||
sleep 1.minute
|
||||
Fiber.yield
|
||||
|
||||
next
|
||||
end
|
||||
|
||||
videos = [] of Video
|
||||
|
||||
top.each do |id|
|
||||
begin
|
||||
videos << get_video(id, db)
|
||||
rescue ex
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
yield videos
|
||||
|
||||
sleep 1.minute
|
||||
Fiber.yield
|
||||
end
|
||||
end
|
||||
|
||||
def pull_popular_videos(db)
|
||||
loop do
|
||||
videos = db.query_all("SELECT DISTINCT ON (ucid) * FROM channel_videos WHERE ucid IN \
|
||||
|
@ -227,11 +227,6 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="top_enabled"><%= translate(locale, "Top enabled: ") %></label>
|
||||
<input name="top_enabled" id="top_enabled" type="checkbox" <% if config.top_enabled %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="captcha_enabled"><%= translate(locale, "CAPTCHA enabled: ") %></label>
|
||||
<input name="captcha_enabled" id="captcha_enabled" type="checkbox" <% if config.captcha_enabled %>checked<% end %>>
|
||||
|
@ -1,20 +0,0 @@
|
||||
<% content_for "header" do %>
|
||||
<meta name="description" content="<%= translate(locale, "An alternative front-end to YouTube") %>">
|
||||
<title>
|
||||
<% if env.get("preferences").as(Preferences).default_home != "Top" %>
|
||||
<%= translate(locale, "Top") %> - Invidious
|
||||
<% else %>
|
||||
Invidious
|
||||
<% end %>
|
||||
</title>
|
||||
<% end %>
|
||||
|
||||
<%= rendered "components/feed_menu" %>
|
||||
|
||||
<div class="pure-g">
|
||||
<% top_videos.each_slice(4) do |slice| %>
|
||||
<% slice.each do |item| %>
|
||||
<%= rendered "components/item" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
Reference in New Issue
Block a user