stories: show archive link to archive.is
This commit is contained in:
parent
c3b62cc166
commit
3afe1538f8
|
@ -163,6 +163,11 @@ class="story <%= story.vote && story.vote[:vote] == 1 ? "upvoted" : "" %>
|
|||
(hidden by <%= pluralize(story.hider_count, "user") %>)
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if story.url.present? %>
|
||||
|
|
||||
<a href="https://archive.is/<%= story.url %>" rel="nofollow"
|
||||
target="_new">cached</a>
|
||||
<% end %>
|
||||
<% if !story.is_gone? %>
|
||||
<span class="comments_label">
|
||||
|
|
||||
|
|
|
@ -41,6 +41,14 @@ class StoryCacher
|
|||
Rails.logger.error "error fetching #{db_url}: #{e.message}"
|
||||
end
|
||||
|
||||
begin
|
||||
s = Sponge.new
|
||||
s.timeout = 45
|
||||
s.fetch("https://archive.is/#{db_url}")
|
||||
rescue => e
|
||||
Rails.logger.error "error caching #{db_url}: #{e.message}"
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue