diff options
author | Reverite <github@reverite.sh> | 2019-11-13 20:03:31 -0500 |
---|---|---|
committer | Reverite <github@reverite.sh> | 2019-11-13 20:03:31 -0500 |
commit | 61a70e595d9ec7a6937d31b36d33063520cf1385 (patch) | |
tree | 6d7697e892f9324a5d6f00ed933606fea25fd871 /lib | |
parent | 48635bf45f6402c8f82d4cb66fa42e3e5e8f30c2 (diff) | |
parent | 707c4918b21d19dd53b64120dbc7263f45fc5ecd (diff) |
Merge branch 'glitch' into production
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mastodon/media_cli.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/mastodon/media_cli.rb b/lib/mastodon/media_cli.rb index e48175134..3b702f155 100644 --- a/lib/mastodon/media_cli.rb +++ b/lib/mastodon/media_cli.rb @@ -113,5 +113,27 @@ module Mastodon say("Imports:\t#{number_to_human_size(Import.sum(:data_file_size))}") say("Settings:\t#{number_to_human_size(SiteUpload.sum(:file_file_size))}") end + + desc 'lookup', 'Lookup where media is displayed by passing a media URL' + def lookup + prompt = TTY::Prompt.new + + url = prompt.ask('Please enter a URL to the media to lookup:', required: true) + + attachment_id = url + .split('/')[0..-2] + .grep(/\A\d+\z/) + .join('') + + if url.split('/')[0..-2].include? 'media_attachments' + model = MediaAttachment.find(attachment_id).status + prompt.say(ActivityPub::TagManager.instance.url_for(model)) + elsif url.split('/')[0..-2].include? 'accounts' + model = Account.find(attachment_id) + prompt.say(ActivityPub::TagManager.instance.url_for(model)) + else + prompt.say('Not found') + end + end end end |