diff --git a/CHANGELOG_soapbox.md b/CHANGELOG_soapbox.md
index c9441e17f4..d5b8c0d532 100644
--- a/CHANGELOG_soapbox.md
+++ b/CHANGELOG_soapbox.md
@@ -22,3 +22,4 @@ Based on Pleroma 2.3.0-stable.
- Domain blocks: reposts from a blocked domain are now correctly blocked.
- Fixed some (not all) Markdown issues, such as broken trailing slash in links.
- Don't crash so hard when email settings are invalid.
+- Return OpenGraph metadata on Soapbox FE routes.
diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex
index 72ad14f052..5e732e4bb7 100644
--- a/lib/pleroma/web/router.ex
+++ b/lib/pleroma/web/router.ex
@@ -637,6 +637,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 fe485d10db..4210706361 100644
--- a/lib/pleroma/web/static_fe/static_fe_controller.ex
+++ b/lib/pleroma/web/static_fe/static_fe_controller.ex
@@ -168,6 +168,15 @@ defp represent(%Activity{object: %Object{data: data}} = activity, selected) 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)
diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs
index 2038f4ddd1..fab042439a 100644
--- a/test/pleroma/web/o_status/o_status_controller_test.exs
+++ b/test/pleroma/web/o_status/o_status_controller_test.exs
@@ -343,4 +343,54 @@ test "does not require authentication on non-federating instances", %{
|> response(200)
end
end
+
+ describe "notice compatibility routes" do
+ test "Soapbox FE", %{conn: conn} do
+ user = insert(:user)
+ note_activity = insert(:note_activity, user: user)
+
+ resp =
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/@#{user.nickname}/posts/#{note_activity.id}")
+ |> response(200)
+
+ expected =
+ ""
+
+ assert resp =~ expected
+ end
+
+ test "Mastodon", %{conn: conn} do
+ user = insert(:user)
+ note_activity = insert(:note_activity, user: user)
+
+ resp =
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/@#{user.nickname}/#{note_activity.id}")
+ |> response(200)
+
+ expected =
+ ""
+
+ assert resp =~ expected
+ end
+
+ test "Twitter", %{conn: conn} do
+ user = insert(:user)
+ note_activity = insert(:note_activity, user: user)
+
+ resp =
+ conn
+ |> put_req_header("accept", "text/html")
+ |> get("/#{user.nickname}/status/#{note_activity.id}")
+ |> response(200)
+
+ expected =
+ ""
+
+ assert resp =~ expected
+ end
+ end
end
diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs
index 100b83d6a3..7596a9a546 100644
--- a/test/pleroma/web/plugs/frontend_static_plug_test.exs
+++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs
@@ -86,6 +86,8 @@ test "api routes are detected correctly" do
"objects",
"activities",
"notice",
+ "@:nickname",
+ ":nickname",
"users",
"tags",
"mailer",