diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex
index 6f5d41153..1a8e866ef 100644
--- a/lib/mix/tasks/pleroma/user.ex
+++ b/lib/mix/tasks/pleroma/user.ex
@@ -300,7 +300,7 @@ defmodule Mix.Tasks.Pleroma.User do
{:ok, invite} <- UserInviteToken.create_invite(options) do
shell_info("Generated user invite token " <> String.replace(invite.invite_type, "_", " "))
- url = ~p[/registration/#{invite.token}]
+ url = url(~p[/registration/#{invite.token}])
IO.puts(url)
else
error ->
diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex
index d3f25b6cf..ad87837fa 100644
--- a/lib/pleroma/user.ex
+++ b/lib/pleroma/user.ex
@@ -2449,7 +2449,7 @@ defmodule Pleroma.User do
end
if is_url(raw_value) do
- frontend_url = ~p[/#{nickname}]
+ frontend_url = url(~p[/#{nickname}])
possible_urls = [ap_id, frontend_url]
diff --git a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex
index bd0ddc21d..7344e1f77 100644
--- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex
+++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex
@@ -254,7 +254,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do
conn
|> json(%{
token: token.token,
- link: ~p[/api/v1/pleroma/password_reset/#{token.token}]
+ link: url(~p[/api/v1/pleroma/password_reset/#{token.token}])
})
end
diff --git a/lib/pleroma/web/plugs/http_signature_plug.ex b/lib/pleroma/web/plugs/http_signature_plug.ex
index 7f8343fce..eb6a46736 100644
--- a/lib/pleroma/web/plugs/http_signature_plug.ex
+++ b/lib/pleroma/web/plugs/http_signature_plug.ex
@@ -33,10 +33,10 @@ defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
end
def route_aliases(%{path_info: ["objects", id], query_string: query_string}) do
- ap_id = ~p[/objects/#{id}]
+ ap_id = url(~p[/objects/#{id}])
with %Activity{} = activity <- Activity.get_by_object_ap_id_with_object(ap_id) do
- ["/notice/#{activity.id}", "/notice/#{activity.id}?#{query_string}"]
+ [~p"/notice/#{activity.id}", "/notice/#{activity.id}?#{query_string}"]
else
_ -> []
end
diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex
index 04d5dc917..f0d45293e 100644
--- a/lib/pleroma/web/static_fe/static_fe_controller.ex
+++ b/lib/pleroma/web/static_fe/static_fe_controller.ex
@@ -110,7 +110,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
end
def show(%{assigns: %{object_id: _}} = conn, _params) do
- url = conn.url <> conn.request_path
+ url = unverified_url(conn, conn.request_path)
case Activity.get_create_by_object_ap_id_with_object(url) do
%Activity{} = activity ->
@@ -123,7 +123,7 @@ defmodule Pleroma.Web.StaticFE.StaticFEController do
end
def show(%{assigns: %{activity_id: _}} = conn, _params) do
- url = conn.url <> conn.request_path
+ url = unverified_url(conn, conn.request_path)
case Activity.get_by_ap_id(url) do
%Activity{} = activity ->
diff --git a/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex b/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex
index c4e12f4be..b9b08c45d 100644
--- a/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex
+++ b/lib/pleroma/web/templates/o_auth/mfa/recovery.html.eex
@@ -21,7 +21,7 @@
<%= submit Gettext.dpgettext("static_pages", "mfa recover verify recovery code button", "Verify") %>
<% end %>
- ">
+ ">
<%= Gettext.dpgettext("static_pages", "mfa recover use 2fa code link", "Enter a two-factor code") %>
diff --git a/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex b/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex
index bc3ca7c3a..59827780b 100644
--- a/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex
+++ b/lib/pleroma/web/templates/o_auth/mfa/totp.html.eex
@@ -21,7 +21,7 @@
<%= submit Gettext.dpgettext("static_pages", "mfa auth verify code button", "Verify") %>
<% end %>
- ">
+ ">
<%= Gettext.dpgettext("static_pages", "mfa auth page use recovery code link", "Enter a two-factor recovery code") %>
diff --git a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs
index e0a2cb9de..68d77ae5a 100644
--- a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs
@@ -783,7 +783,8 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do
describe "PATCH /resend_confirmation_email" do
test "it resend emails for two users", %{conn: conn, admin: admin} do
- [first_user, second_user] = insert_pair(:user, is_confirmed: false)
+ [first_user, second_user] =
+ insert_pair(:user, is_confirmed: false, confirmation_token: "something")
ret_conn =
patch(conn, "/api/v1/pleroma/admin/users/resend_confirmation_email", %{
diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs
index a347c7987..ebd536b0b 100644
--- a/test/pleroma/web/mastodon_api/update_credentials_test.exs
+++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs
@@ -529,7 +529,7 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
user: user,
conn: conn
} do
- fe_url = "#{Pleroma.Web.Endpoint.url()}/#{user.nickname}"
+ fe_url = url(~p[/#{user.nickname}])
Tesla.Mock.mock(fn
%{url: "http://example.com/rel_me/fe_path"} ->
diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs
index 475732838..22f65a0d1 100644
--- a/test/pleroma/web/mastodon_api/views/status_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs
@@ -258,7 +258,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
expected = %{
id: to_string(note.id),
uri: object_data["id"],
- url: ~p[/notice/#{note}],
+ url: url(~p[/notice/#{note}]),
account: AccountView.render("show.json", %{user: user, skip_visibility_check: true}),
in_reply_to_id: nil,
in_reply_to_account_id: nil,