+ else
+ {:enabled, false} ->
+ conn
+ |> put_status(404)
+ |> json(%{error: "Federated timeline is disabled"})
+
+ {:authenticated, false} ->
+ fail_on_bad_auth(conn)
+ end
+ end
+
+ # GET /api/v1/timelines/bubble
+ def bubble(%{assigns: %{user: user}} = conn, params) do
+ Logger.debug("TimelineController.bubble")
+
+ if is_nil(user) and restrict_unauthenticated?(:bubble) do
+ fail_on_bad_auth(conn)
+ else
+ bubble_instances =
+ Enum.uniq(
+ Config.get([:instance, :local_bubble], []) ++
+ [Pleroma.Web.Endpoint.host()]
+ )
+
+ Logger.debug("TimelineController.bubble: fetching activities")
+
+ activities =
+ params
+ |> Map.put(:type, ["Create"])
+ |> Map.put(:blocking_user, user)
+ |> Map.put(:muting_user, user)
+ |> Map.put(:reply_filtering_user, user)
+ |> Map.put(:instance, bubble_instances)
+ |> ActivityPub.fetch_public_activities()
+
+ Logger.debug("TimelineController.bubble: rendering")
+
+ conn
+ |> add_link_headers(activities)
+ |> render("index.json",
+ activities: activities,
+ for: user,
+ as: :activity,
+ with_muted: Map.get(params, :with_muted, false)
+ )