Send web mentions in the background

This commit is contained in:
2023-09-24 15:23:39 +10:00
parent a9aa16da8b
commit d9715bf9ac
4 changed files with 31 additions and 12 deletions

View File

@@ -0,0 +1,23 @@
require "httparty"
require "que"
module Adamantium
module Jobs
class SendWebMentions < Que::Job
def run(post_content:, post_url:)
link_finder = Admin::Container["post_utilities.link_finder"]
settings = Admin::Container["settings"]
source = post_url
links = link_finder.call(post_content)
links.each do |target|
HTTParty.post(settings.webmention_service, {
token: settings.webmention_token,
source: source,
target: target
})
end
end
end
end
end