1 defmodule Pleroma.Web.OEmbed.OEmbedController do
2 use Pleroma.Web, :controller
4 alias Pleroma.Web.OEmbed
5 alias Pleroma.Web.OEmbed.{NoteView, ActivityRepresenter}
6 alias Pleroma.Web.MediaProxy
10 def url(conn, %{ "url" => url} ) do
11 case format = get_format(conn) do
13 result = OEmbed.recognize_path(url)
14 render_oembed(conn, format, result)
18 def render_oembed(conn, format \\ "json", result)
19 def render_oembed(conn, "json", result) do
21 |> put_resp_content_type("application/json")
22 |> json(NoteView.render("note.json", result))
25 def render_oembed(conn, "xml", result) do
27 |> put_resp_content_type("application/xml")
28 |> NoteView.render("note.json", result)