mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-22 13:17:13 +00: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
25 lines
519 B
Ruby
25 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
|