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.Feed.TagController do
6 use Pleroma.Web, :controller
9 alias Pleroma.Web.ActivityPub.ActivityPub
10 alias Pleroma.Web.Feed.FeedView
12 import Pleroma.Web.ControllerHelper, only: [put_in_if_exist: 3]
14 def feed(conn, %{"tag" => raw_tag} = params) do
15 tag = parse_tag(raw_tag)
18 %{"type" => ["Create"], "whole_db" => true, "tag" => tag}
19 |> put_in_if_exist("max_id", params["max_id"])
20 |> ActivityPub.fetch_public_activities()
23 |> put_resp_content_type("application/atom+xml")
26 activities: activities,
28 feed_config: Config.get([:feed])
32 defp parse_tag(raw_tag) when is_binary(raw_tag) do
33 case Enum.reverse(String.split(raw_tag, ".")) do
34 [format | tag] when format in ["atom", "rss"] -> Enum.join(tag, ".")
39 defp parse_tag(raw_tag), do: raw_tag