akkoma/lib/pleroma/web/rich_media/controllers/rich_media_controller.ex

18 lines
402 B
Elixir
Raw Normal View History

2019-01-02 07:02:50 -07:00
defmodule Pleroma.Web.RichMedia.RichMediaController do
use Pleroma.Web, :controller
import Pleroma.Web.ControllerHelper, only: [json_response: 3]
def parse(conn, %{"url" => url}) do
case Pleroma.Web.RichMedia.Parser.parse(url) do
{:ok, data} ->
conn
|> json_response(200, data)
{:error, msg} ->
conn
|> json_response(404, msg)
end
end
end