Skip to content

Commit

Permalink
Merge pull request #359 from pooza/2_1_13
Browse files Browse the repository at this point in the history
2.1.13
  • Loading branch information
pooza committed Mar 11, 2019
2 parents 28783b0 + f2405fe commit 11672cd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/mulukhiya_toot_proxy/server.rb
Expand Up @@ -11,12 +11,12 @@ def before_post
(@config['/instance_url'] || "https://#{@headers['HTTP_HOST']}"),
@headers['HTTP_AUTHORIZATION'].split(/\s+/)[1],
)
@tags = params['status'].scan(
Regexp.new(@config['/mastodon/hashtag/pattern'], Regexp::IGNORECASE),
)
end

post '/api/v1/statuses' do
tags = params['status'].scan(
Regexp.new(@config['/mastodon/hashtag/pattern'], Regexp::IGNORECASE),
)
results = []
Handler.all do |handler|
Timeout.timeout(handler.timeout) do
Expand All @@ -32,7 +32,7 @@ def before_post
r = @mastodon.toot(params)
@renderer.message = r.parsed_response
@renderer.message['results'] = results.join(', ')
@renderer.message['tags'].keep_if{|v| @tags.include?(v['name'])}
@renderer.message['tags']&.keep_if{|v| tags.include?(v['name'])}
@renderer.status = r.code
headers({'X-Mulukhiya' => results.join(', ')})
return @renderer.to_s
Expand Down

0 comments on commit 11672cd

Please sign in to comment.