Returning proper URLs in JSON even if behind a proxy
This commit is contained in:
parent
f36683f9d4
commit
ac41401b85
2 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
json.package @p.name
|
||||
|
||||
json.screenshots @p.screenshots do |s|
|
||||
json.small_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:large, timestamp: false)}"
|
||||
json.small_image_url "https://#{request.env['HTTP_HOST']}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "https://#{request.env['HTTP_HOST']}#{s.image.url(:large, timestamp: false)}"
|
||||
json.version s.version
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ json.cache! ['json_screenshots'], expires_in: 1.hour do
|
|||
json.extract! s, :version
|
||||
json.extract! p, :maintainer, :name, :section, :maintainer_email, :homepage, :description
|
||||
json.url package_url(p.name)
|
||||
json.small_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "#{request.protocol}#{request.host_with_port}#{s.image.url(:large, timestamp: false)}"
|
||||
json.small_image_url "https://#{request.env['HTTP_HOST']}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "https://#{request.env['HTTP_HOST']}#{s.image.url(:large, timestamp: false)}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue