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 'sass', require: nil
|
||||||
gem 'dav4rack'
|
gem 'dav4rack'
|
||||||
gem 'filesize'
|
gem 'filesize'
|
||||||
|
gem 'thread'
|
||||||
|
|
||||||
platform :mri do
|
platform :mri do
|
||||||
gem 'magic' # sudo apt-get install file, For OSX: brew install libmagic
|
gem 'magic' # sudo apt-get install file, For OSX: brew install libmagic
|
||||||
|
|
|
@ -181,6 +181,7 @@ GEM
|
||||||
json (~> 1.8.1)
|
json (~> 1.8.1)
|
||||||
mime-types (>= 1.25, < 3.0)
|
mime-types (>= 1.25, < 3.0)
|
||||||
rest-client (~> 1.4)
|
rest-client (~> 1.4)
|
||||||
|
thread (0.1.4)
|
||||||
thread_safe (0.3.4)
|
thread_safe (0.3.4)
|
||||||
tilt (1.4.1)
|
tilt (1.4.1)
|
||||||
timers (1.1.0)
|
timers (1.1.0)
|
||||||
|
@ -250,6 +251,7 @@ DEPENDENCIES
|
||||||
sinatra-flash
|
sinatra-flash
|
||||||
sinatra-xsendfile
|
sinatra-xsendfile
|
||||||
stripe
|
stripe
|
||||||
|
thread
|
||||||
tilt
|
tilt
|
||||||
webmock
|
webmock
|
||||||
zipruby
|
zipruby
|
||||||
|
|
29
Rakefile
29
Rakefile
|
@ -51,13 +51,6 @@ task :parse_logs => [:environment] do
|
||||||
end
|
end
|
||||||
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'
|
desc 'Update banned IPs list'
|
||||||
task :update_blocked_ips => [:environment] do
|
task :update_blocked_ips => [:environment] do
|
||||||
|
|
||||||
|
@ -170,9 +163,23 @@ task :cleantags => [:environment] do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require 'thread/pool'
|
||||||
|
|
||||||
desc 'update screenshots'
|
desc 'update screenshots'
|
||||||
task :updatescreenshots => [:environment] do
|
task :update_screenshots => [:environment] do
|
||||||
Site.select(:username).where(site_changed: true, is_banned: false, is_crashing: false).all.each do |site|
|
pool = Thread.pool 10
|
||||||
ScreenshotWorker.new.perform site.username, 'index.html'
|
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
|
end
|
||||||
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 %>
|
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username).first %>
|
||||||
<div class="comment" id="comment_<%= comment.id %>">
|
<div class="comment" id="comment_<%= comment.id %>">
|
||||||
<img class="avatar" src="<%= comment_actioning_site.screenshot_url('index.html', '82x62') %>">
|
<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">
|
<span class="date">
|
||||||
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
|
<a href="?event_id=<%= event.id %>"><%= comment.created_at.ago %></a>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Add table
Reference in a new issue