diff --git a/.gitattributes b/.gitattributes index 7273afe43..eb0c94757 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,10 @@ *.ex diff=elixir *.exs diff=elixir +priv/static/instance/static.css diff=css + # Most of js/css files included in the repo are minified bundles, # and we don't want to search/diff those as text files. *.js binary *.js.map binary *.css binary - -priv/static/instance/static.css diff=css -priv/static/static-fe/static-fe.css diff=css diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 9f7c94c53..3d89cd4ff 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -716,15 +716,6 @@ defmodule Pleroma.Web.Router do get("/users/:nickname/feed", Feed.UserController, :feed, as: :user_feed) end - scope "/", Pleroma.Web do - # Note: html format is supported only if static FE is enabled - pipe_through([:accepts_html_xml, :static_fe]) - - # Profile pages for static-fe - get("/users/:nickname/with_replies", Feed.UserController, :user_feed) - get("/users/:nickname/media", Feed.UserController, :user_feed) - end - scope "/", Pleroma.Web do pipe_through(:accepts_html) get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player) @@ -759,8 +750,7 @@ defmodule Pleroma.Web.Router do end scope "/", Pleroma.Web.ActivityPub do - # Note: html format is supported only if static FE is enabled - pipe_through([:activitypub_client, :accepts_html_xml_json, :static_fe]) + pipe_through([:activitypub_client]) get("/api/ap/whoami", ActivityPubController, :whoami) get("/users/:nickname/inbox", ActivityPubController, :read_inbox) diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex index 1ee0aa096..97c41c6f9 100644 --- a/lib/pleroma/web/static_fe/static_fe_controller.ex +++ b/lib/pleroma/web/static_fe/static_fe_controller.ex @@ -10,7 +10,6 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do alias Pleroma.User alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.Visibility - alias Pleroma.Web.CommonAPI alias Pleroma.Web.Metadata alias Pleroma.Web.Router.Helpers @@ -46,7 +45,7 @@ def show(%{assigns: %{notice_id: notice_id}} = conn, _params) do end end - def show(%{assigns: %{username_or_id: username_or_id, tab: tab}} = conn, params) do + def show(%{assigns: %{username_or_id: username_or_id}} = conn, params) do with {_, %User{local: true} = user} <- {:fetch_user, User.get_cached_by_nickname_or_id(username_or_id)}, {_, :visible} <- {:visibility, User.visible_for(user, _reading_user = nil)} do @@ -57,25 +56,10 @@ def show(%{assigns: %{username_or_id: username_or_id, tab: tab}} = conn, params) |> Map.take(@page_keys) |> Map.new(fn {k, v} -> {String.to_existing_atom(k), v} end) - params = case tab do - "posts" -> - Map.put(params, :exclude_replies, true) - "media" -> - Map.put(params, :only_media, true) - _ -> params - end - - - timeline = case tab do - tab when tab in ["posts", "with_replies", "media"] -> - user - |> ActivityPub.fetch_user_activities(_reading_user = nil, params) - |> Enum.map(&represent/1) - "following" -> - User.get_friends(user) - "followers" -> - User.get_followers(user) - end + timeline = + user + |> ActivityPub.fetch_user_activities(_reading_user = nil, params) + |> Enum.map(&represent/1) prev_page_id = (params["min_id"] || params["max_id"]) && @@ -176,11 +160,7 @@ defp represent(%Activity{object: %Object{data: data}} = activity, selected) do sensitive: data["sensitive"], selected: selected, counts: get_counts(activity), - id: activity.id, - visibility: Visibility.get_visibility(activity.object), - reply_to: data["inReplyTo"], - reply_to_user: data["inReplyTo"] && CommonAPI.get_user(hd(data["to"])), - edited_at: data["updated"] + id: activity.id } end @@ -188,14 +168,7 @@ defp assign_id(%{path_info: ["notice", notice_id]} = conn, _opts), do: assign(conn, :notice_id, notice_id) defp assign_id(%{path_info: ["users", user_id]} = conn, _opts), - do: conn - |> assign(:username_or_id, user_id) - |> assign(:tab, "posts") - - defp assign_id(%{path_info: ["users", user_id, tab]} = conn, _opts), - do: conn - |> assign(:username_or_id, user_id) - |> assign(:tab, tab) + do: assign(conn, :username_or_id, user_id) defp assign_id(%{path_info: ["objects", object_id]} = conn, _opts), do: assign(conn, :object_id, object_id) diff --git a/lib/pleroma/web/static_fe/static_fe_view.ex b/lib/pleroma/web/static_fe/static_fe_view.ex index e2013d697..8e23a79a3 100644 --- a/lib/pleroma/web/static_fe/static_fe_view.ex +++ b/lib/pleroma/web/static_fe/static_fe_view.ex @@ -22,39 +22,17 @@ def fetch_media_type(%{"mediaType" => mediaType}) do Utils.fetch_media_type(@media_types, mediaType) end - def time_ago(date) do - {:ok, date, _} = DateTime.from_iso8601(date) - {:ok, now} = DateTime.now("Etc/UTC") - - years = now.year - date.year - months = now.month - date.month - days = now.day - date.day - hours = now.hour - date.hour - minutes = now.minute - date.minute - seconds = now.second - date.second - cond do - years > 0 -> ngettext("1 year ago", "%{count} years ago", years) - months > 0 -> ngettext("1 month ago", "%{count} months ago", months) - days > 6 -> ngettext("1 week ago", "%{count} weeks ago", trunc(days / 7)) - days > 0 -> ngettext("1 day ago", "%{count} days ago", days) - hours > 0 -> ngettext("1 hour ago", "%{count} hours ago", hours) - minutes > 0 -> ngettext("1 minute ago", "%{count} minutes ago", minutes) - seconds > 0 -> ngettext("1 second ago", "%{count} seconds ago", seconds) - true -> gettext("now") - end - end - def format_date(date) do {:ok, date, _} = DateTime.from_iso8601(date) Strftime.strftime!(date, "%Y/%m/%d %l:%M:%S %p UTC") end - def instance_name, do: Pleroma.Config.get([:instance, :name], "Akkoma") + def instance_name, do: Pleroma.Config.get([:instance, :name], "Pleroma") def open_content? do Pleroma.Config.get( [:frontend_configurations, :collapse_message_with_subjects], - false + true ) end end diff --git a/lib/pleroma/web/templates/layout/static_fe.html.eex b/lib/pleroma/web/templates/layout/static_fe.html.eex index 3d55393f0..e6adb526b 100644 --- a/lib/pleroma/web/templates/layout/static_fe.html.eex +++ b/lib/pleroma/web/templates/layout/static_fe.html.eex @@ -6,39 +6,10 @@