log photos

This commit is contained in:
2023-02-04 14:24:23 +11:00
parent 14db39d5e9
commit 6d5fe4371f

View File

@@ -28,7 +28,7 @@ module Adamantium
key = Digest::MD5.hexdigest text_with_tags
mastodon_token = settings.mastodon_token
mastodon_server = settings.mastodon_server.split("@").first
logger.info(post[:photo])
logger.info("Photos: #{post[:photo].inspect}")
media_ids = post[:photo]&.map do |photo|
file = Tempfile.new(SecureRandom.uuid)
file.write(URI.open(photo["value"]).read)
@@ -44,13 +44,13 @@ module Adamantium
})
file.close
file.unlink
puts "*" * 88
puts response.inspect
logger.info(response.body)
puts "*" * 88
JSON.parse(response.body).fetch(:id, nil)
JSON.parse(response.body, symbolize_names: true).fetch(:id, nil)
end&.compact
raise media_ids.inspect
response = HTTParty.post("#{mastodon_server}api/v1/statuses", {
headers: {
"Idempotency-Key": key,