diff options
author | feld <feld@feld.me> | 2022-03-01 19:02:48 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2022-03-01 19:02:48 +0000 |
commit | 0b686c6e541b2e12f86f91f93ef55149468d9738 (patch) | |
tree | df548f6ba13a52c971094a6c46b0528558deb5df /lib | |
parent | ee05abe052a0e56faf67711362b270893a4ab703 (diff) | |
parent | 9c52a496f7096f328544ba8bae39e91566f9d7c1 (diff) | |
download | pleroma-0b686c6e541b2e12f86f91f93ef55149468d9738.tar.gz |
Merge branch 'revert-ee05abe0' into 'develop'
Revert "Merge branch 'revert/notice-routes' into 'develop'"
See merge request pleroma/pleroma!3639
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/router.ex | 5 | ||||
-rw-r--r-- | lib/pleroma/web/static_fe/static_fe_controller.ex | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 9198d280b..26706a6b8 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -669,6 +669,11 @@ defmodule Pleroma.Web.Router do get("/activities/:uuid", OStatus.OStatusController, :activity) get("/notice/:id", OStatus.OStatusController, :notice) + # Notice compatibility routes for other frontends + get("/@:nickname/:id", OStatus.OStatusController, :notice) + get("/@:nickname/posts/:id", OStatus.OStatusController, :notice) + get("/:nickname/status/:id", OStatus.OStatusController, :notice) + # Mastodon compatibility routes get("/users/:nickname/statuses/:id", OStatus.OStatusController, :object) get("/users/:nickname/statuses/:id/activity", OStatus.OStatusController, :activity) diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex index 50f0927a3..827c0a384 100644 --- a/lib/pleroma/web/static_fe/static_fe_controller.ex +++ b/lib/pleroma/web/static_fe/static_fe_controller.ex @@ -167,6 +167,15 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do defp assign_id(%{path_info: ["notice", notice_id]} = conn, _opts), do: assign(conn, :notice_id, notice_id) + defp assign_id(%{path_info: ["@" <> _nickname, notice_id]} = conn, _opts), + do: assign(conn, :notice_id, notice_id) + + defp assign_id(%{path_info: ["@" <> _nickname, "posts", notice_id]} = conn, _opts), + do: assign(conn, :notice_id, notice_id) + + defp assign_id(%{path_info: [_nickname, "status", notice_id]} = conn, _opts), + do: assign(conn, :notice_id, notice_id) + defp assign_id(%{path_info: ["users", user_id]} = conn, _opts), do: assign(conn, :username_or_id, user_id) |