Removed ImageProxyController API route
• Removed: - ImageProxyController API route - removed from news reducer for trends. • Todo: - Devise solution for integrating cross site images from trends -> social
This commit is contained in:
parent
559ccc7e51
commit
65949c7e71
@ -1,14 +0,0 @@
|
|||||||
require 'base64'
|
|
||||||
require 'net/http'
|
|
||||||
|
|
||||||
class Api::V2::ImageProxyController < EmptyController
|
|
||||||
def get
|
|
||||||
if params[:trends_url].nil?
|
|
||||||
raise GabSocial::NotPermittedError
|
|
||||||
else
|
|
||||||
url = URI.parse(params[:trends_url])
|
|
||||||
image = Net::HTTP.get_response(url)
|
|
||||||
send_data image.body, type: image.content_type, disposition: 'inline'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -46,7 +46,7 @@ const normalizeTrendsItem = (item) => {
|
|||||||
title: `${item.pagePreview.title}`.trim(),
|
title: `${item.pagePreview.title}`.trim(),
|
||||||
description: `${item.pagePreview.description}`.trim(),
|
description: `${item.pagePreview.description}`.trim(),
|
||||||
publish_date: item.pubDate,
|
publish_date: item.pubDate,
|
||||||
image: Array.isArray(item.pagePreview.images) ? `/api/v2/image_proxy?trends_url=${item.pagePreview.images[0]}` : null,
|
image: Array.isArray(item.pagePreview.images) ? null : null, // : todo :
|
||||||
feed_title: item.feed.title,
|
feed_title: item.feed.title,
|
||||||
feed_slug: item.feed.slug,
|
feed_slug: item.feed.slug,
|
||||||
feed_base_url: `${item.feed.url}`.replace('www.', '').replace('https://', '').replace('http://', '').replace('/', ''),
|
feed_base_url: `${item.feed.url}`.replace('www.', '').replace('https://', '').replace('http://', '').replace('/', ''),
|
||||||
|
@ -388,7 +388,6 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
namespace :v2 do
|
namespace :v2 do
|
||||||
get '/search', to: 'search#index', as: :search
|
get '/search', to: 'search#index', as: :search
|
||||||
get '/image_proxy', to: 'image_proxy#get'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :web do
|
namespace :web do
|
||||||
|
Loading…
Reference in New Issue
Block a user