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.StaticFEView do
8 alias Calendar.Strftime
9 alias Pleroma.Emoji.Formatter
11 alias Pleroma.Web.Endpoint
12 alias Pleroma.Web.Gettext
13 alias Pleroma.Web.MediaProxy
14 alias Pleroma.Web.Metadata.Utils
15 alias Pleroma.Web.Router.Helpers
19 @media_types ["image", "audio", "video"]
21 def emoji_for_user(%User{} = user) do
24 |> Enum.filter(fn %{"type" => t} -> t == "Emoji" end)
25 |> Enum.map(fn %{"icon" => %{"url" => url}, "name" => name} ->
26 {String.trim(name, ":"), url}
30 def fetch_media_type(%{"mediaType" => mediaType}) do
31 Utils.fetch_media_type(@media_types, mediaType)
34 def format_date(date) do
35 {:ok, date, _} = DateTime.from_iso8601(date)
36 Strftime.strftime!(date, "%Y/%m/%d %l:%M:%S %p UTC")
39 def instance_name, do: Pleroma.Config.get([:instance, :name], "Pleroma")
43 [:frontend_configurations, :collapse_message_with_subjects],