mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
richer news feed, change screenshots/thumbnails to use retina quality
This commit is contained in:
parent
45168341de
commit
1d200a886e
11 changed files with 69 additions and 36 deletions
7
Rakefile
7
Rakefile
|
@ -168,4 +168,11 @@ task :cleantags => [:environment] do
|
||||||
matching_tag.delete
|
matching_tag.delete
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
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'
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -59,8 +59,8 @@ class Site < Sequel::Model
|
||||||
HTML_REGEX = /htm|html/
|
HTML_REGEX = /htm|html/
|
||||||
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
|
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
|
||||||
|
|
||||||
SCREENSHOT_RESOLUTIONS = ['235x141', '105x63', '270x162', '37x37', '146x88', '302x182', '90x63', '82x62', '348x205']
|
SCREENSHOT_RESOLUTIONS = ['540x405', '210x158', '100x100', '50x50']
|
||||||
THUMBNAIL_RESOLUTIONS = ['105x63', '90x63']
|
THUMBNAIL_RESOLUTIONS = ['210x158']
|
||||||
|
|
||||||
CLAMAV_THREAT_MATCHES = [
|
CLAMAV_THREAT_MATCHES = [
|
||||||
/^VBS/,
|
/^VBS/,
|
||||||
|
@ -779,7 +779,6 @@ class Site < Sequel::Model
|
||||||
following_ids = self.followings_dataset.select(:site_id).all.collect {|f| f.site_id}
|
following_ids = self.followings_dataset.select(:site_id).all.collect {|f| f.site_id}
|
||||||
Event.filter(site_id: following_ids+[self.id]).
|
Event.filter(site_id: following_ids+[self.id]).
|
||||||
order(:created_at.desc).
|
order(:created_at.desc).
|
||||||
exclude(actioning_site_id: self.id).
|
|
||||||
paginate(current_page, limit)
|
paginate(current_page, limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
|
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
|
||||||
<% else %>
|
<% else %>
|
||||||
<% site.followings_dataset.select(:site_id).all.each do |following| %>
|
<% site.followings_dataset.select(:site_id).all.each do |following| %>
|
||||||
<a href="/site/<%= following.site_dataset.select(:username).first.username %>"><img src="<%= site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
|
<a href="/site/<%= following.site_dataset.select(:username).first.username %>"><img src="<%= site.screenshot_path 'index.html', '50x50' %>" class="avatar"></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<% site.follows_dataset.select(:actioning_site_id).all.each do |follow| %>
|
<% site.follows_dataset.select(:actioning_site_id).all.each do |follow| %>
|
||||||
<% follow_actioning_site = follow.actioning_site_dataset.select(:username).first %>
|
<% follow_actioning_site = follow.actioning_site_dataset.select(:username).first %>
|
||||||
<a href="/site/<%= follow_actioning_site.username %>"><img src="<%= follow_actioning_site.screenshot_path 'index.html', '37x37' %>" class="avatar"></a>
|
<a href="/site/<%= follow_actioning_site.username %>"><img src="<%= follow_actioning_site.screenshot_path 'index.html', '50x50' %>" class="avatar"></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,15 +18,23 @@
|
||||||
<div class="news-item follow">
|
<div class="news-item follow">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="icon"></div>
|
<div class="icon"></div>
|
||||||
<% actioning_site = event.actioning_site_dataset.select(:username, :title, :domain).first %>
|
<% actioning_site = event.actioning_site_dataset.select(:id, :username, :title, :domain).first %>
|
||||||
<% event_site = event.site_dataset.select(:id, :username, :title, :domain).first %>
|
<% event_site = event.site_dataset.select(:id, :username, :title, :domain).first %>
|
||||||
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><%= actioning_site.title.shorten(40) %></a>
|
|
||||||
is following
|
<% if current_site && current_site.id == actioning_site.id %>
|
||||||
|
You
|
||||||
|
<% else %>
|
||||||
|
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><%= actioning_site.username %></a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
started following
|
||||||
|
|
||||||
<% if current_site && event_site.id == current_site.id %>
|
<% if current_site && event_site.id == current_site.id %>
|
||||||
your site!
|
your site!
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><%= event_site.title.shorten(40) %></a>
|
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><%= event_site.username %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<span class="date">
|
<span class="date">
|
||||||
<a href="?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
<a href="?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -39,7 +47,7 @@
|
||||||
<% if current_site && event_site.id == current_site.id %>
|
<% if current_site && event_site.id == current_site.id %>
|
||||||
Your site was updated.
|
Your site was updated.
|
||||||
<% else %>
|
<% else %>
|
||||||
<a href="/site/<%= event_site.username %>" class="user"><%= event_site.title %></a> has been updated.
|
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><%= event_site.title.shorten(45) %></a> has been updated.
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="date">
|
<span class="date">
|
||||||
<a href="?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
<a href="?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
|
||||||
|
@ -54,9 +62,9 @@
|
||||||
<div class="html-thumbnail <%= site_change_file_display_class f %>">
|
<div class="html-thumbnail <%= site_change_file_display_class f %>">
|
||||||
<a href="//<%= event_site.host %>/<%= f %>">
|
<a href="//<%= event_site.host %>/<%= f %>">
|
||||||
<% if site_change_file_display_class(f) == 'html' %>
|
<% if site_change_file_display_class(f) == 'html' %>
|
||||||
<img src="<%= event_site.screenshot_url(f, '90x63') %>">
|
<img src="<%= event_site.screenshot_url(f, '210x158') %>">
|
||||||
<% elsif site_change_file_display_class(f) == 'image' %>
|
<% elsif site_change_file_display_class(f) == 'image' %>
|
||||||
<img src="<%= event_site.thumbnail_url(f, '90x63') %>">
|
<img src="<%= event_site.thumbnail_url(f, '210x158') %>">
|
||||||
<% elsif site_change_file_display_class(f) == 'misc' %>
|
<% elsif site_change_file_display_class(f) == 'misc' %>
|
||||||
<span class="misc-icon">
|
<span class="misc-icon">
|
||||||
<%= File.extname(f).sub('.', '') %>
|
<%= File.extname(f).sub('.', '') %>
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
<% actioning_site = profile_comment.actioning_site_dataset.select(:username, :title, :domain).first %>
|
<% actioning_site = profile_comment.actioning_site_dataset.select(:id, :username).first %>
|
||||||
|
<% site = profile_comment.site_dataset.select(:id, :username).first %>
|
||||||
|
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<div class="icon" style="background-image:url(<%= actioning_site.screenshot_url('index.html', '82x62') %>);"></div>
|
<div class="icon" style="background-image:url(<%= actioning_site.screenshot_url('index.html', '100x100') %>);"></div>
|
||||||
<a href="/site/<%= actioning_site.username %>" class="user"><%= actioning_site.title %></a>
|
|
||||||
<% if request.path == '/' %>
|
<% if current_site && current_site.id == actioning_site.id && request.path == '/' %>
|
||||||
posted on your site profile:
|
You
|
||||||
|
<% else %>
|
||||||
|
<a href="/site/<%= actioning_site.username %>" class="user"><%= actioning_site.username %></a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if request.path == '/' %>
|
||||||
|
<% if current_site && current_site.id == profile_comment.site_id %>
|
||||||
|
left a comment on <a href="/site/<%= current_site.username %>">your profile</a>:
|
||||||
|
<% else %>
|
||||||
|
left a comment on <a href="/site/<%= profile_comment.site.username %>" class="user"><%= profile_comment.site.username %></a><%= site.username[site.username.length-1] == 's' ? "'" : "'s" %> site profile:
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<span class="date">
|
<span class="date">
|
||||||
<a href="?event_id=<%= profile_comment.event.id %>"><%= profile_comment.created_at.ago %></a>
|
<a href="?event_id=<%= profile_comment.event.id %>"><%= profile_comment.created_at.ago %></a>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<% @sites.each do |site| %>
|
<% @sites.each do |site| %>
|
||||||
<li>
|
<li>
|
||||||
<a href="//<%= site.host %>" class="neo-Screen-Shot" target="_blank" title="<%= site.title %>">
|
<a href="//<%= site.host %>" class="neo-Screen-Shot" target="_blank" title="<%= site.title %>">
|
||||||
<span class="img-Holder" style="background:url(<%= site.screenshot_url('index.html', '270x162') %>) no-repeat;">
|
<span class="img-Holder" style="background:url(<%= site.screenshot_url('index.html', '540x405') %>) no-repeat;">
|
||||||
<img src="/img/placeholder.png" alt="<%= site.title %>" />
|
<img src="/img/placeholder.png" alt="<%= site.title %>" />
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<div class="col col-50 signup-Area" style="width: 289px;">
|
<div class="col col-50 signup-Area" style="width: 289px;">
|
||||||
<div class="signup-Form">
|
<div class="signup-Form">
|
||||||
<fieldset class="content">
|
<fieldset class="content">
|
||||||
<img class="screenshot" src="<%= current_site.screenshot_url('index.html', '270x162') %>">
|
<img class="screenshot" src="<%= current_site.screenshot_url('index.html', '540x405') %>">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -112,14 +112,14 @@
|
||||||
<div class="upload-Boundary <%= @file_list.length <= 5 ? 'with-instruction' : '' %>">
|
<div class="upload-Boundary <%= @file_list.length <= 5 ? 'with-instruction' : '' %>">
|
||||||
<% @file_list.each do |file| %>
|
<% @file_list.each do |file| %>
|
||||||
<div class="file filehover">
|
<div class="file filehover">
|
||||||
<% if file[:is_html] && current_site.screenshot_exists?(file[:path], '105x63') %>
|
<% if file[:is_html] && current_site.screenshot_exists?(file[:path], '210x158') %>
|
||||||
<div class="html-thumbnail html fileimagehover">
|
<div class="html-thumbnail html fileimagehover">
|
||||||
<img src="<%= current_site.screenshot_url(file[:path], '105x63') %>">
|
<img src="<%= current_site.screenshot_url(file[:path], '210x158') %>">
|
||||||
<div class="overlay"></div>
|
<div class="overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
<% elsif file[:is_image] && current_site.thumbnail_exists?(file[:path], '105x63') %>
|
<% elsif file[:is_image] && current_site.thumbnail_exists?(file[:path], '210x158') %>
|
||||||
<div class="html-thumbnail image fileimagehover">
|
<div class="html-thumbnail image fileimagehover">
|
||||||
<img src="<%= current_site.thumbnail_url(file[:path], '105x63') %>" style="">
|
<img src="<%= current_site.thumbnail_url(file[:path], '210x158') %>">
|
||||||
<div class="overlay"></div>
|
<div class="overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
<% elsif file[:is_directory] %>
|
<% elsif file[:is_directory] %>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<div class="site-suggestion">
|
<div class="site-suggestion">
|
||||||
<div class="site-portrait">
|
<div class="site-portrait">
|
||||||
<a href="//<%= suggested_site.host %>">
|
<a href="//<%= suggested_site.host %>">
|
||||||
<img src="<%= suggested_site.screenshot_url('index.html', '270x162') %>">
|
<img src="<%= suggested_site.screenshot_url('index.html', '540x405') %>">
|
||||||
</a>
|
</a>
|
||||||
<span class="caption">
|
<span class="caption">
|
||||||
<a href="/site/<%= suggested_site.username %>"><%= suggested_site.title %></a>
|
<a href="/site/<%= suggested_site.username %>"><%= suggested_site.title %></a>
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a href="//<%= site.host %>"><img src="<%= site.screenshot_url('index.html', '348x205') %>" style="width:340px" class="large-portrait"></a>
|
<a href="//<%= site.host %>"><img src="<%= site.screenshot_url('index.html', '540x405') %>" class="large-portrait"></a>
|
||||||
|
|
||||||
<div style="margin-top: 20px; margin-bottom: 20px" class="txt-Center">
|
<div style="margin-top: 20px; margin-bottom: 20px" class="txt-Center">
|
||||||
<a href="/site/<%= site.username %>" class="btn-Action">View Site Profile</a>
|
<a href="/site/<%= site.username %>" class="btn-Action">View Site Profile</a>
|
||||||
|
|
|
@ -184,42 +184,42 @@
|
||||||
<ul class="row website-Gallery hp-Gallery">
|
<ul class="row website-Gallery hp-Gallery">
|
||||||
<li>
|
<li>
|
||||||
<a href="http://dragonquest.neocities.org/" title="The Quest of Dragons" target="_blank">
|
<a href="http://dragonquest.neocities.org/" title="The Quest of Dragons" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/dragonquest/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of The Quest of Dragons" />
|
<img src="//neocities.org/site_screenshots/dragonquest/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of The Quest of Dragons" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://codeventurer.neocities.org/" title="codeventurer" target="_blank">
|
<a href="http://codeventurer.neocities.org/" title="codeventurer" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/codeventurer/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of codeventurer" />
|
<img src="//neocities.org/site_screenshots/codeventurer/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of codeventurer" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://clouds.neocities.org/" title="Cloud Quotes" target="_blank">
|
<a href="http://clouds.neocities.org/" title="Cloud Quotes" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/clouds/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of Cloud Quotes" />
|
<img src="//neocities.org/site_screenshots/clouds/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of Cloud Quotes" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://manatee.neocities.org/" title="Title of Website" target="_blank">
|
<a href="http://manatee.neocities.org/" title="Title of Website" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/manatee/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of TITLE OF WEBSITE" />
|
<img src="//neocities.org/site_screenshots/manatee/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of TITLE OF WEBSITE" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://suppilulemur.neocities.org/" title="Sokoban" target="_blank">
|
<a href="http://suppilulemur.neocities.org/" title="Sokoban" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/suppilulemur/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of Sokoban" />
|
<img src="//neocities.org/site_screenshots/suppilulemur/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of Sokoban" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://drawinglair.neocities.org/" title="Tomasz Zawadzki" target="_blank">
|
<a href="http://drawinglair.neocities.org/" title="Tomasz Zawadzki" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/drawinglair/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of Tomasz Zawadzki" />
|
<img src="//neocities.org/site_screenshots/drawinglair/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of Tomasz Zawadzki" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://rik.neocities.org/" title="Rock Im Kaff" target="_blank">
|
<a href="http://rik.neocities.org/" title="Rock Im Kaff" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/rik/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of Eleanor Holroyd's Website" />
|
<img src="//neocities.org/site_screenshots/rik/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of Eleanor Holroyd's Website" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="http://cute-animation.neocities.org/" title="Cute Animation" target="_blank">
|
<a href="http://cute-animation.neocities.org/" title="Cute Animation" target="_blank">
|
||||||
<img src="//neocities.org/site_screenshots/cute-animation/index.html.270x162.jpg" class="neo-SS" alt="Thumbnail of Cute Animation" />
|
<img src="//neocities.org/site_screenshots/cute-animation/index.html.540x405.jpg" class="neo-SS" alt="Thumbnail of Cute Animation" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="col col-50 signup-Area large">
|
<div class="col col-50 signup-Area large">
|
||||||
<div class="signup-Form">
|
<div class="signup-Form">
|
||||||
<fieldset class="content">
|
<fieldset class="content">
|
||||||
<a href="//<%= site.host %>"><img class="screenshot" src="<%= site.screenshot_url('index.html', '348x205') %>" style="width: 358px;height: 215px;"></a>
|
<a href="//<%= site.host %>"><img class="screenshot" src="<%= site.screenshot_url('index.html', '540x405') %>"></a>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,7 +44,7 @@ class ScreenshotWorker
|
||||||
f.fetch(
|
f.fetch(
|
||||||
output: screenshot_output_path,
|
output: screenshot_output_path,
|
||||||
width: 1280,
|
width: 1280,
|
||||||
height: 720
|
height: 960
|
||||||
)
|
)
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
# :nocov:
|
# :nocov:
|
||||||
|
@ -89,7 +89,15 @@ class ScreenshotWorker
|
||||||
FileUtils.mkdir_p screenshot_path unless Dir.exists?(screenshot_path)
|
FileUtils.mkdir_p screenshot_path unless Dir.exists?(screenshot_path)
|
||||||
|
|
||||||
Site::SCREENSHOT_RESOLUTIONS.each do |res|
|
Site::SCREENSHOT_RESOLUTIONS.each do |res|
|
||||||
img.scale(*res.split('x').collect {|r| r.to_i}).write(File.join(user_screenshots_path, "#{path}.#{res}.jpg")) {
|
width, height = res.split('x').collect {|r| r.to_i}
|
||||||
|
|
||||||
|
if width == height
|
||||||
|
new_img = img.crop_resized width, height, Magick::NorthGravity
|
||||||
|
else
|
||||||
|
new_img = img.scale width, height
|
||||||
|
end
|
||||||
|
|
||||||
|
new_img.write(File.join(user_screenshots_path, "#{path}.#{res}.jpg")) {
|
||||||
self.quality = 90
|
self.quality = 90
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue