From: Ivan Tashkinov Date: Sat, 17 Oct 2020 10:12:39 +0000 (+0300) Subject: Merge remote-tracking branch 'remotes/origin/develop' into ostatus-controller-no... X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=049ece1ef38f1aeb656a88ed1d15bf3d4a364e01;p=akkoma Merge remote-tracking branch 'remotes/origin/develop' into ostatus-controller-no-auth-check-on-non-federating-instances # Conflicts: # lib/pleroma/web/feed/user_controller.ex # lib/pleroma/web/o_status/o_status_controller.ex # lib/pleroma/web/router.ex # lib/pleroma/web/static_fe/static_fe_controller.ex --- 049ece1ef38f1aeb656a88ed1d15bf3d4a364e01 diff --cc lib/pleroma/web/o_status/o_status_controller.ex index e03ca8c0a,b044260b3..668ae0ea4 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@@ -13,9 -11,15 +11,11 @@@ defmodule Pleroma.Web.OStatus.OStatusCo alias Pleroma.Web.ActivityPub.ActivityPubController alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.Endpoint + alias Pleroma.Web.Fallback.RedirectController alias Pleroma.Web.Metadata.PlayerView + alias Pleroma.Web.Plugs.RateLimiter alias Pleroma.Web.Router - plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug, - unless_func: &Pleroma.Web.Plugs.FederatingPlug.federating?/1 - ) - plug( RateLimiter, [name: :ap_routes, params: ["uuid"]] when action in [:object, :activity] diff --cc lib/pleroma/web/router.ex index ef56360ed,d2d939989..07a574f35 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@@ -586,10 -566,17 +586,10 @@@ defmodule Pleroma.Web.Router d ) end - pipeline :ostatus do - plug(:accepts, ["html", "xml", "rss", "atom", "activity+json", "json"]) - plug(Pleroma.Web.Plugs.StaticFEPlug) - end - - pipeline :oembed do - plug(:accepts, ["json", "xml"]) - end - scope "/", Pleroma.Web do - pipe_through([:ostatus, :http_signature]) + # Note: html format is supported only if static FE is enabled + # Note: http signature is only considered for json requests (no auth for non-json requests) - pipe_through([:accepts_html_json, :http_signature, Pleroma.Plugs.StaticFEPlug]) ++ pipe_through([:accepts_html_json, :http_signature, Pleroma.Web.Plugs.StaticFEPlug]) get("/objects/:uuid", OStatus.OStatusController, :object) get("/activities/:uuid", OStatus.OStatusController, :activity) @@@ -598,31 -586,10 +598,31 @@@ # Mastodon compatibility routes get("/users/:nickname/statuses/:id", OStatus.OStatusController, :object) get("/users/:nickname/statuses/:id/activity", OStatus.OStatusController, :activity) + end - get("/users/:nickname/feed", Feed.UserController, :feed, as: :user_feed) + scope "/", Pleroma.Web do + # Note: html format is supported only if static FE is enabled + # Note: http signature is only considered for json requests (no auth for non-json requests) - pipe_through([:accepts_html_xml_json, :http_signature, Pleroma.Plugs.StaticFEPlug]) ++ pipe_through([:accepts_html_xml_json, :http_signature, Pleroma.Web.Plugs.StaticFEPlug]) + + # Note: returns user _profile_ for json requests, redirects to user _feed_ for non-json ones get("/users/:nickname", Feed.UserController, :feed_redirect, as: :user_feed) + end + + scope "/", Pleroma.Web do + # Note: html format is supported only if static FE is enabled - pipe_through([:accepts_html_xml, Pleroma.Plugs.StaticFEPlug]) ++ pipe_through([:accepts_html_xml, Pleroma.Web.Plugs.StaticFEPlug]) + get("/users/:nickname/feed", Feed.UserController, :feed, as: :user_feed) + end + + scope "/", Pleroma.Web do + pipe_through(:accepts_html) + get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player) + end + + scope "/", Pleroma.Web do + pipe_through(:accepts_xml_rss_atom) get("/tags/:tag", Feed.TagController, :feed, as: :tag_feed) end