mirror of
https://git.pleroma.social/sjw/pleroma.git
synced 2024-12-27 20:25:17 +01:00
Use activitypub to fetch posts.
This falls back to ostatus.
This commit is contained in:
parent
74c74decf5
commit
c381d0b577
@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
alias Pleroma.Web.MastodonAPI.{StatusView, AccountView, MastodonView, ListView}
|
alias Pleroma.Web.MastodonAPI.{StatusView, AccountView, MastodonView, ListView}
|
||||||
alias Pleroma.Web.ActivityPub.ActivityPub
|
alias Pleroma.Web.ActivityPub.ActivityPub
|
||||||
alias Pleroma.Web.ActivityPub.Utils
|
alias Pleroma.Web.ActivityPub.Utils
|
||||||
alias Pleroma.Web.{CommonAPI, OStatus}
|
alias Pleroma.Web.CommonAPI
|
||||||
alias Pleroma.Web.OAuth.{Authorization, Token, App}
|
alias Pleroma.Web.OAuth.{Authorization, Token, App}
|
||||||
alias Comeonin.Pbkdf2
|
alias Comeonin.Pbkdf2
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
@ -658,12 +658,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
|
|
||||||
fetched =
|
fetched =
|
||||||
if Regex.match?(~r/https?:/, query) do
|
if Regex.match?(~r/https?:/, query) do
|
||||||
with {:ok, activities} <- OStatus.fetch_activity_from_url(query) do
|
with {:ok, object} <- ActivityPub.fetch_object_from_id(query) do
|
||||||
activities
|
[Activity.get_create_activity_by_object_ap_id(object.data["id"])]
|
||||||
|> Enum.filter(fn
|
|
||||||
%{data: %{"type" => "Create"}} -> true
|
|
||||||
_ -> false
|
|
||||||
end)
|
|
||||||
else
|
else
|
||||||
_e -> []
|
_e -> []
|
||||||
end
|
end
|
||||||
@ -710,12 +706,8 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
|||||||
|
|
||||||
fetched =
|
fetched =
|
||||||
if Regex.match?(~r/https?:/, query) do
|
if Regex.match?(~r/https?:/, query) do
|
||||||
with {:ok, activities} <- OStatus.fetch_activity_from_url(query) do
|
with {:ok, object} <- ActivityPub.fetch_object_from_id(query) do
|
||||||
activities
|
[Activity.get_create_activity_by_object_ap_id(object.data["id"])]
|
||||||
|> Enum.filter(fn
|
|
||||||
%{data: %{"type" => "Create"}} -> true
|
|
||||||
_ -> false
|
|
||||||
end)
|
|
||||||
else
|
else
|
||||||
_e -> []
|
_e -> []
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user