alias Pleroma.{User, Activity}
alias Pleroma.Web.OStatus.FeedRepresenter
alias Pleroma.Repo
+ alias Pleroma.Web.OStatus
import Ecto.Query
+ def feed_redirect(conn, %{"nickname" => nickname}) do
+ user = User.get_cached_by_nickname(nickname)
+ redirect conn, external: OStatus.feed_path(user)
+ end
+
def feed(conn, %{"nickname" => nickname}) do
user = User.get_cached_by_nickname(nickname)
query = from activity in Activity,
pipe_through :ostatus
get "/users/:nickname/feed", OStatus.OStatusController, :feed
- get "/users/:nickname", OStatus.OStatusController, :feed
+ get "/users/:nickname", OStatus.OStatusController, :feed_redirect
post "/users/:nickname/salmon", OStatus.OStatusController, :salmon_incoming
post "/push/hub/:nickname", Websub.WebsubController, :websub_subscription_request
get "/push/subscriptions/:id", Websub.WebsubController, :websub_subscription_confirmation
defp valid_topic(%{"hub.topic" => topic}, user) do
if topic == OStatus.feed_path(user) do
- {:ok, topic}
+ {:ok, OStatus.feed_path(user)}
else
{:error, "Wrong topic requested, expected #{OStatus.feed_path(user)}, got #{topic}"}
end