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