X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fostatus%2Fostatus_controller.ex;h=27ec24f576b939cac7ae777a469c0e4c3cacba7f;hb=8902942128e3aee814c215d700e2eaee21b491e9;hp=af6e22c2b8c90e18c4aeefa1f9817568abf399b6;hpb=bcecdc3ab194135d5bc17496b8091a6c17775c87;p=akkoma diff --git a/lib/pleroma/web/ostatus/ostatus_controller.ex b/lib/pleroma/web/ostatus/ostatus_controller.ex index af6e22c2b..27ec24f57 100644 --- a/lib/pleroma/web/ostatus/ostatus_controller.ex +++ b/lib/pleroma/web/ostatus/ostatus_controller.ex @@ -134,9 +134,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do %User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do case format = get_format(conn) do "html" -> - conn - |> put_resp_content_type("text/html") - |> send_file(200, Application.app_dir(:pleroma, "priv/static/index.html")) + serve_static_with_meta(conn, activity) _ -> represent_activity(conn, format, activity, user) @@ -153,11 +151,20 @@ defmodule Pleroma.Web.OStatus.OStatusController do end end + defp serve_static_with_meta(conn, activity) do + {:ok, index_content } = File.read(Application.app_dir(:pleroma, "priv/static/index.html")) + links = OStatus.metadata(request_url(conn)) + response = String.replace(index_content, "", links) + conn + |> put_resp_content_type("text/html") + |> send_resp(200, response) + end + defp represent_activity( conn, "activity+json", %Activity{data: %{"type" => "Create"}} = activity, - user + _user ) do object = Object.normalize(activity.data["object"]) @@ -166,7 +173,7 @@ defmodule Pleroma.Web.OStatus.OStatusController do |> json(ObjectView.render("object.json", %{object: object})) end - defp represent_activity(conn, "activity+json", _, _) do + defp represent_activity(_conn, "activity+json", _, _) do {:error, :not_found} end