Commit 92a8944d authored by lain's avatar lain
Browse files

Redirect to user feed instead of directly serving it.

parent 1854842b
......@@ -4,8 +4,14 @@ defmodule Pleroma.Web.OStatus.OStatusController do
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)
def feed(conn, %{"nickname" => nickname}) do
user = User.get_cached_by_nickname(nickname)
query = from activity in Activity,
......@@ -74,7 +74,7 @@ def user_fetcher(username) do
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
......@@ -99,7 +99,7 @@ defp lease_time(_) do
defp valid_topic(%{"hub.topic" => topic}, user) do
if topic == OStatus.feed_path(user) do
{:ok, topic}
{:ok, OStatus.feed_path(user)}
{:error, "Wrong topic requested, expected #{OStatus.feed_path(user)}, got #{topic}"}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment