1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.StaticFE.StaticFEController do
6 use Pleroma.Web, :controller
8 alias Pleroma.Web.StaticFE.ActivityRepresenter
9 alias Pleroma.Web.StaticFE.UserRepresenter
13 def show_notice(conn, %{"notice_id" => notice_id}) do
14 with {:ok, data} <- ActivityRepresenter.represent(notice_id) do
16 |> put_layout(:static_fe)
18 |> put_view(Pleroma.Web.StaticFE.StaticFEView)
19 |> render("notice.html", %{data: data})
28 def show_user(conn, %{"username_or_id" => username_or_id}) do
29 with {:ok, data} <- UserRepresenter.represent(username_or_id) do
31 |> put_layout(:static_fe)
33 |> put_view(Pleroma.Web.StaticFE.StaticFEView)
34 |> render("profile.html", %{data: data})
43 def show(%{path_info: ["notice", notice_id]} = conn, _params),
44 do: show_notice(conn, %{"notice_id" => notice_id})
46 def show(%{path_info: ["users", user_id]} = conn, _params),
47 do: show_user(conn, %{"username_or_id" => user_id})
49 def show(%{path_info: [user_id]} = conn, _params),
50 do: show_user(conn, %{"username_or_id" => user_id})
52 # Fallback for unhandled types
53 def show(conn, _params) do