mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-18 21:03:27 +00:00
Change User-Agent of link preview fetching service to include "Bot" (#14248)
This forces Twitter to render OpenGraph tags in the response
This commit is contained in:
parent
c7c07abe44
commit
ed04697510
|
@ -45,7 +45,7 @@ class FetchLinkCardService < BaseService
|
|||
def html
|
||||
return @html if defined?(@html)
|
||||
|
||||
Request.new(:get, @url).add_headers('Accept' => 'text/html').perform do |res|
|
||||
Request.new(:get, @url).add_headers('Accept' => 'text/html', 'User-Agent' => Mastodon::Version.user_agent + ' Bot').perform do |res|
|
||||
if res.code == 200 && res.mime_type == 'text/html'
|
||||
@html = res.body_with_limit
|
||||
@html_charset = res.charset
|
||||
|
|
Loading…
Reference in a new issue