mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
better update screenshot, fix username ref on news comment
This commit is contained in:
parent
fbdce831de
commit
5403d61ac2
4 changed files with 22 additions and 12 deletions
1
Gemfile
1
Gemfile
|
@ -23,6 +23,7 @@ gem 'zipruby'
|
|||
gem 'sass', require: nil
|
||||
gem 'dav4rack'
|
||||
gem 'filesize'
|
||||
gem 'thread'
|
||||
|
||||
platform :mri do
|
||||
gem 'magic' # sudo apt-get install file, For OSX: brew install libmagic
|
||||
|
|
|
@ -181,6 +181,7 @@ GEM
|
|||
json (~> 1.8.1)
|
||||
mime-types (>= 1.25, < 3.0)
|
||||
rest-client (~> 1.4)
|
||||
thread (0.1.4)
|
||||
thread_safe (0.3.4)
|
||||
tilt (1.4.1)
|
||||
timers (1.1.0)
|
||||
|
@ -250,6 +251,7 @@ DEPENDENCIES
|
|||
sinatra-flash
|
||||
sinatra-xsendfile
|
||||
stripe
|
||||
thread
|
||||
tilt
|
||||
webmock
|
||||
zipruby
|
||||
|
|
27
Rakefile
27
Rakefile
|
@ -51,13 +51,6 @@ task :parse_logs => [:environment] do
|
|||
end
|
||||
end
|
||||
|
||||
desc 'Update screenshots'
|
||||
task :update_screenshots => [:environment] do
|
||||
Site.select(:username).filter(is_banned: false).filter(~{updated_at: nil}).order(:updated_at.desc).all.collect {|s|
|
||||
ScreenshotWorker.perform_async s.username
|
||||
}
|
||||
end
|
||||
|
||||
desc 'Update banned IPs list'
|
||||
task :update_blocked_ips => [:environment] do
|
||||
|
||||
|
@ -170,9 +163,23 @@ task :cleantags => [:environment] do
|
|||
end
|
||||
end
|
||||
|
||||
require 'thread/pool'
|
||||
|
||||
desc 'update screenshots'
|
||||
task :updatescreenshots => [:environment] do
|
||||
Site.select(:username).where(site_changed: true, is_banned: false, is_crashing: false).all.each do |site|
|
||||
ScreenshotWorker.new.perform site.username, 'index.html'
|
||||
task :update_screenshots => [:environment] do
|
||||
pool = Thread.pool 10
|
||||
Site.select(:username).where(site_changed: true, is_banned: false, is_crashing: false).filter(~{updated_at: nil}).order(:updated_at.desc).all.each do |site|
|
||||
pool.process { ScreenshotWorker.new.perform site.username, 'index.html' }
|
||||
end
|
||||
|
||||
sleep
|
||||
end
|
||||
|
||||
=begin
|
||||
desc 'Update screenshots'
|
||||
task :update_screenshots => [:environment] do
|
||||
Site.select(:username).filter(is_banned: false).filter(~{updated_at: nil}).order(:updated_at.desc).all.collect {|s|
|
||||
ScreenshotWorker.perform_async s.username
|
||||
}
|
||||
end
|
||||
=end
|
|
@ -89,7 +89,7 @@
|
|||
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username).first %>
|
||||
<div class="comment" id="comment_<%= comment.id %>">
|
||||
<img class="avatar" src="<%= comment_actioning_site.screenshot_url('index.html', '82x62') %>">
|
||||
<a href="/site/<%= comment_actioning_site.username %>" class="user"><%= comment_actioning_site.title %></a>
|
||||
<a href="/site/<%= comment_actioning_site.username %>" class="user" title="<%= comment_actioning_site.title %>"><%= comment_actioning_site.username %></a>
|
||||
<span class="date">
|
||||
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
|
||||
</span>
|
||||
|
|
Loading…
Add table
Reference in a new issue