2016-12-01 07:01:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-08 03:09:25 +09:00
|
|
|
class Api::OEmbedController < Api::BaseController
|
2020-01-14 16:52:32 +09:00
|
|
|
skip_before_action :require_authenticated_user!
|
|
|
|
|
2020-01-24 08:20:51 +09:00
|
|
|
before_action :set_status
|
|
|
|
before_action :require_public_status!
|
|
|
|
|
2016-12-01 07:01:03 +09:00
|
|
|
def show
|
2024-09-20 21:39:48 +09:00
|
|
|
render json: @status, serializer: OEmbedSerializer, width: params[:maxwidth], height: params[:maxheight]
|
2016-12-01 07:01:03 +09:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-01-24 08:20:51 +09:00
|
|
|
def set_status
|
|
|
|
@status = status_finder.status
|
|
|
|
end
|
|
|
|
|
|
|
|
def require_public_status!
|
|
|
|
not_found if @status.hidden?
|
|
|
|
end
|
|
|
|
|
2017-08-30 17:23:43 +09:00
|
|
|
def status_finder
|
|
|
|
StatusFinder.new(params[:url])
|
2017-04-27 21:42:22 +09:00
|
|
|
end
|
2016-12-01 07:01:03 +09:00
|
|
|
end
|