mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 19:41:37 +01:00
e95bdec7c5
- Use statuses controller for embeds instead of stream entries controller - Prefer /@:username/:id/embed URL for embeds - Use /@:username as author_url in OEmbed - Add follow link to embeds which opens web intent in new window - Use redis cache in development - Cache entire embed
24 lines
519 B
Ruby
24 lines
519 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::OEmbedController < Api::BaseController
|
|
respond_to :json
|
|
|
|
def show
|
|
@status = status_finder.status
|
|
render json: @status, serializer: OEmbedSerializer, width: maxwidth_or_default, height: maxheight_or_default
|
|
end
|
|
|
|
private
|
|
|
|
def status_finder
|
|
StatusFinder.new(params[:url])
|
|
end
|
|
|
|
def maxwidth_or_default
|
|
(params[:maxwidth].presence || 400).to_i
|
|
end
|
|
|
|
def maxheight_or_default
|
|
params[:maxheight].present? ? params[:maxheight].to_i : nil
|
|
end
|
|
end
|