diff options
Diffstat (limited to 'helpers.rb')
-rw-r--r-- | helpers.rb | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -162,7 +162,7 @@ helpers do a = fetch(actor) return nil unless a - mention = "#{a['preferredUsername']}@#{URI(actor).host}" + mention = "@#{a['preferredUsername']}@#{URI(actor).host}" cache mention, actor, a mention else @@ -171,11 +171,12 @@ helpers do end def actor(mention) - mention = mention.sub(/^@/, '').chomp + mention = mention.chomp actors = people.select { |p| p[0] == mention } if actors.empty? - _, server = mention.split('@') - a = fetch("https://#{server}/.well-known/webfinger?resource=acct:#{mention}", 'application/jrd+json') + server = mention.split('@').last + a = fetch("https://#{server}/.well-known/webfinger?resource=acct:#{mention.sub(/^@/, '')}", + 'application/jrd+json') return nil unless a actor = a['links'].select do |l| @@ -208,12 +209,6 @@ helpers do "#{type[0]}/#{ext}" end - # def find_file(id) - # Dir[File.join('*', 'object', '*', '*.json')].find do |f| - # JSON.load_file(f)['id'] == id - # end - # end - def find_object(id) Dir[File.join('*', '**', '*.json')].each do |file| object = JSON.load_file(file) |