signature.ex: Remove the use of ObjectID type

It is not in stable yet
This commit is contained in:
rinpatch 2020-05-01 22:29:22 +03:00
parent b6ca8cc539
commit 2646fdea22

View file

@ -8,7 +8,6 @@ defmodule Pleroma.Signature do
alias Pleroma.Keys
alias Pleroma.User
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.ObjectValidators.Types
def key_id_to_actor_id(key_id) do
uri =
@ -22,16 +21,14 @@ def key_id_to_actor_id(key_id) do
uri
end
maybe_ap_id = URI.to_string(uri)
case Types.ObjectID.cast(maybe_ap_id) do
{:ok, ap_id} ->
{:ok, ap_id}
case uri do
%URI{scheme: scheme} when scheme in ["https", "http"] ->
{:ok, URI.to_string(uri)}
_ ->
case Pleroma.Web.WebFinger.finger(maybe_ap_id) do
case Pleroma.Web.WebFinger.finger(URI.to_string(uri)) do
%{"ap_id" => ap_id} -> {:ok, ap_id}
_ -> {:error, maybe_ap_id}
_ -> {:error, URI.to_string(uri)}
end
end
end