@ -163,11 +166,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
end
defprocess_inline_images
proc=proc{|name|Rails.logger.debugname}
handler=Handler.new(proc)
handler=TextHandler.new
Ox.sax_parse(handler,@object['content'])
handler.srcs.eachdo|src|
# Handle images where the src is formatted as "/foo/bar.png"
# Handle images where the src is formatted as "/foo/bar.biz"
# we assume that the `url` field is populated which lets us infer
# the protocol and domain of the _original_ article, as though
# we were looking at it via a web browser
@ -176,11 +178,15 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
src=site+src
end
# if media is set to reject from this domain, replace the src with an empty string
ifskip_download?
@object['content'].gsub!(src,'')
next
end
# Create a local proxy media file for each image in the post
# TODO: what about <video> or <audio> elements? should we handle them?
# TODO: is there a max number of images we should be handling? maybe if there's more than that or there is just too much rich media, we should not render the post at all and do a converted stub?