mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-11-02 04:54:25 +00:00
cb5b5cb5f7
* No need to re-require sidekiq plugins, they are required via Gemfile * Add derailed_benchmarks tool, no need to require TTY gems in Gemfile * Replace ruby-oembed with FetchOEmbedService Reduce startup by 45382 allocated objects * Remove preloaded JSON-LD in favour of caching HTTP responses Reduce boot RAM by about 6 MiB * Fix tests * Fix test suite by stubbing out JSON-LD contexts
21 lines
476 B
Ruby
21 lines
476 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::Web::EmbedsController < Api::Web::BaseController
|
|
respond_to :json
|
|
|
|
before_action :require_user!
|
|
|
|
def create
|
|
status = StatusFinder.new(params[:url]).status
|
|
render json: status, serializer: OEmbedSerializer, width: 400
|
|
rescue ActiveRecord::RecordNotFound
|
|
oembed = FetchOEmbedService.new.call(params[:url])
|
|
|
|
if oembed
|
|
render json: oembed
|
|
else
|
|
render json: {}, status: :not_found
|
|
end
|
|
end
|
|
end
|