diff --git a/app/mastodon_account.rb b/app/mastodon_account.rb index 0852397..02b0420 100644 --- a/app/mastodon_account.rb +++ b/app/mastodon_account.rb @@ -12,6 +12,10 @@ class MastodonAccount @config = File.exist?(CONFIG_FILE) ? YAML.load(File.read(CONFIG_FILE)) : {} end + def max_alt_length + 1500 + end + def save_config File.write(CONFIG_FILE, YAML.dump(@config)) end diff --git a/app/tootify.rb b/app/tootify.rb index bbfae87..3c3882a 100644 --- a/app/tootify.rb +++ b/app/tootify.rb @@ -106,6 +106,10 @@ class Tootify cid = image['image']['ref']['$link'] mime = image['image']['mimeType'] + if alt.length > @mastodon.max_alt_length + alt = alt[0...@mastodon.max_alt_length - 3] + "(…)" + end + data = @bluesky.fetch_blob(cid) uploaded_media = @mastodon.upload_media(data, cid, mime, alt)