diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-12-26 02:33:28 +0000 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-12-26 02:33:28 +0000 |
commit | 0eb6e858f7e11f4caec5ee19234b4751be83dea8 (patch) | |
tree | 2a970bc5a40385175e1358c287d386e981616997 /lib | |
parent | 73609211a425922a5068d3912a36b82abe24e12c (diff) | |
parent | 2c06eff519f63e67aada70d492094e6e56bbfccd (diff) | |
download | pleroma-0eb6e858f7e11f4caec5ee19234b4751be83dea8.tar.gz pleroma-0eb6e858f7e11f4caec5ee19234b4751be83dea8.zip |
Merge branch 'notice-routes' into 'develop'
Add notice compatibility routes for other frontends
Closes #1785
See merge request pleroma/pleroma!3402
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 9ce35ad6b..e278036a2 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -650,6 +650,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) |