Skip to content

Commit

Permalink
for iOS devices send video and image lol
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelz committed Jan 21, 2023
1 parent 93ac0e4 commit 889eb59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/photos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def index
photos = Photo.where(user: nil).order('created_at desc')
videos = Video.where(user: nil).order('created_at desc')
end

Rails.logger.warn("USER AGENT: #{request.user_agent}")
@feed = [photos, videos].flatten(2).sort_by(&:created_at).reverse[0..MAX_FEED]
respond_to do |f|
f.html
Expand All @@ -42,7 +42,7 @@ def index
{
url: p.is_a?(Photo) ? p.image(:medium).url : p.video.url,
class: p.class.name,
#image: Base64.encode64( (p.class == Photo ? p.image(:medium) : p.video).read).gsub("\n",''),
**(request.user_agent =~ /CFNetwork/ ? {image: Base64.encode64( (p.class == Photo ? p.image(:medium) : p.video).read).gsub("\n",'')} : {}),
screenshot: p.is_a?(Video) ? p.video(:screenshot).url : '',
name: p.name,
filename: p.name,
Expand Down

0 comments on commit 889eb59

Please sign in to comment.