show tor hle in ui, test thumbnail enqueue

This commit is contained in:
Dylan Knutson
2025-07-25 00:41:28 +00:00
parent dffdef51cd
commit 5b67f2ad9a
5 changed files with 40 additions and 4 deletions

View File

@@ -100,7 +100,6 @@ services:
tor: tor:
image: dockurr/tor image: dockurr/tor
container_name: tor
volumes: volumes:
- devcontainer-redux-tor-config:/etc/tor - devcontainer-redux-tor-config:/etc/tor
- devcontainer-redux-tor-data:/var/lib/tor - devcontainer-redux-tor-data:/var/lib/tor

View File

@@ -13,7 +13,13 @@ class Job::FaPostFurArchiverPostFileJob < Scraper::JobBase
sig { override.params(args: T::Hash[Symbol, T.untyped]).returns(T.untyped) } sig { override.params(args: T::Hash[Symbol, T.untyped]).returns(T.untyped) }
def perform(args) def perform(args)
post = T.cast(args[:post], Domain::Post::FaPost) post = T.cast(args[:post], T.nilable(Domain::Post::FaPost))
if post.nil?
post_file = T.cast(args[:post_file], T.nilable(Domain::PostFile))
fatal_error("no post or post file found, skipping") if post_file.nil?
post = T.cast(post_file.post, T.nilable(Domain::Post::FaPost))
fatal_error("no post found, skipping") if post.nil?
end
# todo - try multiple post files? # todo - try multiple post files?
post_file = post_file =

View File

@@ -205,4 +205,21 @@ class Domain::Post::FaPost < Domain::Post
def tags_for_view def tags_for_view
keywords.map { |value| TagForView.new(category: :general, value:) } keywords.map { |value| TagForView.new(category: :general, value:) }
end end
sig { returns(T.nilable(Domain::PostFile)) }
def fur_archiver_post_file
files.to_a.find do |file|
uri = Addressable::URI.parse(file.url_str)
uri.host == "furarchiver.net"
end
end
sig { returns(T.nilable(Domain::PostFile)) }
def tor_post_file
files.to_a.find do |file|
uri = Addressable::URI.parse(file.url_str)
uri.host ==
"g6jy5jkx466lrqojcngbnksugrcfxsl562bzuikrka5rv7srgguqbjid.onion"
end
end
end end

View File

@@ -9,10 +9,16 @@
<%= link_to "FuzzySearch", log_entry_path(hle), title: post.fuzzysearch_checked_at&.strftime("%Y-%m-%d %H:%M:%S"), class: "text-blue-600" %> <%= link_to "FuzzySearch", log_entry_path(hle), title: post.fuzzysearch_checked_at&.strftime("%Y-%m-%d %H:%M:%S"), class: "text-blue-600" %>
</span> </span>
<% end %> <% end %>
<% if post.tried_from_fur_archiver? %> <% if (hle = post.fur_archiver_post_file&.log_entry) %>
<span> <span>
<i class="fa-solid fa-download mr-1"></i> <i class="fa-solid fa-download mr-1"></i>
FurArchiver <%= link_to "FurArchiver", log_entry_path(hle), title: hle.requested_at&.strftime("%Y-%m-%d %H:%M:%S"), class: "text-blue-600" %>
</span>
<% end %>
<% if (hle = post.tor_post_file&.log_entry) %>
<span>
<i class="fa-solid fa-mask mr-1"></i>
<%= link_to "Tor", log_entry_path(hle), title: hle.requested_at&.strftime("%Y-%m-%d %H:%M:%S"), class: "text-blue-600" %>
</span> </span>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -173,6 +173,14 @@ RSpec.describe Job::FaPostFurArchiverPostFileJob do
post.reload post.reload
expect(post.files.length).to eq(3) expect(post.files.length).to eq(3)
end end
it "enqueues the thumbnail job" do
perform_now({ post: post })
job_args = SpecUtil.enqueued_job_args(Domain::PostFileThumbnailJob)
expect(job_args).to eq(
[{ post_file: post.files.last, caused_by_entry: @log_entries[0] }],
)
end
end end
end end
end end