From 47d32d2b1889e4599320f28bb1e4450fec192878 Mon Sep 17 00:00:00 2001 From: rustra Date: Wed, 22 Jan 2020 22:40:40 +0100 Subject: [PATCH] Put HTTPSignatures, WebFinger and ActivityStream alongside with ActivityPub --- lib/federation/activity_pub/activity_pub.ex | 10 +++++----- lib/federation/activity_pub/relay.ex | 3 ++- lib/federation/activity_pub/transmogrifier.ex | 2 +- lib/federation/activity_pub/utils.ex | 2 +- .../{activity_pub => }/activity_stream/converter.ex | 2 +- .../activity_stream/converter/actor.ex | 6 +++--- .../activity_stream/converter/address.ex | 4 ++-- .../activity_stream/converter/comment.ex | 8 ++++---- .../activity_stream/converter/event.ex | 12 ++++++------ .../activity_stream/converter/flag.ex | 6 +++--- .../activity_stream/converter/follower.ex | 6 +++--- .../activity_stream/converter/participant.ex | 6 +++--- .../activity_stream/converter/picture.ex | 10 ++-------- .../activity_stream/converter/tombstone.ex | 6 +++--- .../activity_stream/converter/utils.ex | 6 ++---- .../activity_stream/convertible.ex | 2 +- .../{activity_pub => }/http_signatures/signature.ex | 0 .../{activity_pub => }/web_finger/web_finger.ex | 4 ++-- .../{activity_pub => }/web_finger/xml_builder.ex | 2 +- .../controllers/web_finger_controller.ex | 2 +- lib/mobilizon_web/views/activity_pub/actor_view.ex | 2 +- lib/mobilizon_web/views/page_view.ex | 2 +- mix.exs | 4 ++-- test/federation/activity_pub/transmogrifier_test.exs | 2 +- test/federation/activity_pub/utils_test.exs | 2 +- .../activity_stream/converter/actor_test.exs | 4 ++-- .../{activity_pub => }/web_finger_test.exs | 4 ++-- .../controllers/webfinger_controller_test.exs | 2 +- 28 files changed, 57 insertions(+), 64 deletions(-) rename lib/federation/{activity_pub => }/activity_stream/converter.ex (76%) rename lib/federation/{activity_pub => }/activity_stream/converter/actor.ex (92%) rename lib/federation/{activity_pub => }/activity_stream/converter/address.ex (93%) rename lib/federation/{activity_pub => }/activity_stream/converter/comment.ex (92%) rename lib/federation/{activity_pub => }/activity_stream/converter/event.ex (91%) rename lib/federation/{activity_pub => }/activity_stream/converter/flag.ex (91%) rename lib/federation/{activity_pub => }/activity_stream/converter/follower.ex (79%) rename lib/federation/{activity_pub => }/activity_stream/converter/participant.ex (72%) rename lib/federation/{activity_pub => }/activity_stream/converter/picture.ex (86%) rename lib/federation/{activity_pub => }/activity_stream/converter/tombstone.ex (76%) rename lib/federation/{activity_pub => }/activity_stream/converter/utils.ex (95%) rename lib/federation/{activity_pub => }/activity_stream/convertible.ex (67%) rename lib/federation/{activity_pub => }/http_signatures/signature.ex (100%) rename lib/federation/{activity_pub => }/web_finger/web_finger.ex (96%) rename lib/federation/{activity_pub => }/web_finger/xml_builder.ex (94%) rename test/federation/{activity_pub => }/activity_stream/converter/actor_test.exs (81%) rename test/federation/{activity_pub => }/web_finger_test.exs (95%) diff --git a/lib/federation/activity_pub/activity_pub.ex b/lib/federation/activity_pub/activity_pub.ex index d54eb00c7..78191b105 100644 --- a/lib/federation/activity_pub/activity_pub.ex +++ b/lib/federation/activity_pub/activity_pub.ex @@ -22,13 +22,13 @@ defmodule Mobilizon.Federation.ActivityPub do Federator, Relay, Transmogrifier, - Visibility, - WebFinger + Visibility } - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Utils, as: ConverterUtils + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} + alias Mobilizon.Federation.ActivityStream.Converter.Utils, as: ConverterUtils alias Mobilizon.Federation.HTTPSignatures.Signature + alias Mobilizon.Federation.WebFinger alias MobilizonWeb.API.Utils, as: APIUtils alias MobilizonWeb.Email.{Admin, Mailer} @@ -38,7 +38,7 @@ defmodule Mobilizon.Federation.ActivityPub do @doc """ Wraps an object into an activity """ - @spec create_activity(map(), boolean()) :: {:ok, %Activity{}} + @spec create_activity(map, boolean) :: {:ok, Activity.t()} def create_activity(map, local \\ true) when is_map(map) do with map <- lazy_put_activity_defaults(map) do {:ok, diff --git a/lib/federation/activity_pub/relay.ex b/lib/federation/activity_pub/relay.ex index 111699de1..6a0fec7ef 100644 --- a/lib/federation/activity_pub/relay.ex +++ b/lib/federation/activity_pub/relay.ex @@ -12,7 +12,8 @@ defmodule Mobilizon.Federation.ActivityPub.Relay do alias Mobilizon.Actors.{Actor, Follower} alias Mobilizon.Federation.ActivityPub - alias Mobilizon.Federation.ActivityPub.{Activity, Transmogrifier, WebFinger} + alias Mobilizon.Federation.ActivityPub.{Activity, Transmogrifier} + alias Mobilizon.Federation.WebFinger alias MobilizonWeb.API.Follows diff --git a/lib/federation/activity_pub/transmogrifier.ex b/lib/federation/activity_pub/transmogrifier.ex index 486df279c..481fbe88e 100644 --- a/lib/federation/activity_pub/transmogrifier.ex +++ b/lib/federation/activity_pub/transmogrifier.ex @@ -15,7 +15,7 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier do alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub.{Activity, Utils} - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} alias MobilizonWeb.Email.Participation diff --git a/lib/federation/activity_pub/utils.ex b/lib/federation/activity_pub/utils.ex index 53485908e..016e8f21b 100644 --- a/lib/federation/activity_pub/utils.ex +++ b/lib/federation/activity_pub/utils.ex @@ -13,7 +13,7 @@ defmodule Mobilizon.Federation.ActivityPub.Utils do alias Mobilizon.Media.Picture alias Mobilizon.Federation.ActivityPub.{Activity, Federator, Relay} - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter + alias Mobilizon.Federation.ActivityStream.Converter alias Mobilizon.Federation.HTTPSignatures require Logger diff --git a/lib/federation/activity_pub/activity_stream/converter.ex b/lib/federation/activity_stream/converter.ex similarity index 76% rename from lib/federation/activity_pub/activity_stream/converter.ex rename to lib/federation/activity_stream/converter.ex index 39c21b4c9..4398304f5 100644 --- a/lib/federation/activity_pub/activity_stream/converter.ex +++ b/lib/federation/activity_stream/converter.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter do +defmodule Mobilizon.Federation.ActivityStream.Converter do @moduledoc """ Converter behaviour. diff --git a/lib/federation/activity_pub/activity_stream/converter/actor.ex b/lib/federation/activity_stream/converter/actor.ex similarity index 92% rename from lib/federation/activity_pub/activity_stream/converter/actor.ex rename to lib/federation/activity_stream/converter/actor.ex index f28da9e17..5468c6de1 100644 --- a/lib/federation/activity_pub/activity_stream/converter/actor.ex +++ b/lib/federation/activity_stream/converter/actor.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Actor do +defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do @moduledoc """ Actor converter. @@ -9,12 +9,12 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Actor do alias Mobilizon.Actors.Actor, as: ActorModel alias Mobilizon.Federation.ActivityPub.Utils - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} @behaviour Converter defimpl Convertible, for: ActorModel do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Actor, as: ActorConverter + alias Mobilizon.Federation.ActivityStream.Converter.Actor, as: ActorConverter defdelegate model_to_as(actor), to: ActorConverter end diff --git a/lib/federation/activity_pub/activity_stream/converter/address.ex b/lib/federation/activity_stream/converter/address.ex similarity index 93% rename from lib/federation/activity_pub/activity_stream/converter/address.ex rename to lib/federation/activity_stream/converter/address.ex index b24296fae..87b679ac7 100644 --- a/lib/federation/activity_pub/activity_stream/converter/address.ex +++ b/lib/federation/activity_stream/converter/address.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Address do +defmodule Mobilizon.Federation.ActivityStream.Converter.Address do @moduledoc """ Address converter. @@ -8,7 +8,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Address do alias Mobilizon.Addresses.Address, as: AddressModel - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter + alias Mobilizon.Federation.ActivityStream.Converter @behaviour Converter diff --git a/lib/federation/activity_pub/activity_stream/converter/comment.ex b/lib/federation/activity_stream/converter/comment.ex similarity index 92% rename from lib/federation/activity_pub/activity_stream/converter/comment.ex rename to lib/federation/activity_stream/converter/comment.ex index b9e7d43fc..064dfd74d 100644 --- a/lib/federation/activity_pub/activity_stream/converter/comment.ex +++ b/lib/federation/activity_stream/converter/comment.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Comment do +defmodule Mobilizon.Federation.ActivityStream.Converter.Comment do @moduledoc """ Comment converter. @@ -13,15 +13,15 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Comment do alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub.Visibility - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Utils, as: ConverterUtils + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} + alias Mobilizon.Federation.ActivityStream.Converter.Utils, as: ConverterUtils require Logger @behaviour Converter defimpl Convertible, for: CommentModel do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Comment, as: CommentConverter + alias Mobilizon.Federation.ActivityStream.Converter.Comment, as: CommentConverter defdelegate model_to_as(comment), to: CommentConverter end diff --git a/lib/federation/activity_pub/activity_stream/converter/event.ex b/lib/federation/activity_stream/converter/event.ex similarity index 91% rename from lib/federation/activity_pub/activity_stream/converter/event.ex rename to lib/federation/activity_stream/converter/event.ex index 76c31ad61..0a6adfd7b 100644 --- a/lib/federation/activity_pub/activity_stream/converter/event.ex +++ b/lib/federation/activity_stream/converter/event.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Event do +defmodule Mobilizon.Federation.ActivityStream.Converter.Event do @moduledoc """ Event converter. @@ -13,17 +13,17 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Event do alias Mobilizon.Media.Picture alias Mobilizon.Federation.ActivityPub - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Address, as: AddressConverter - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Picture, as: PictureConverter - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Utils, as: ConverterUtils + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} + alias Mobilizon.Federation.ActivityStream.Converter.Address, as: AddressConverter + alias Mobilizon.Federation.ActivityStream.Converter.Picture, as: PictureConverter + alias Mobilizon.Federation.ActivityStream.Converter.Utils, as: ConverterUtils require Logger @behaviour Converter defimpl Convertible, for: EventModel do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Event, as: EventConverter + alias Mobilizon.Federation.ActivityStream.Converter.Event, as: EventConverter defdelegate model_to_as(event), to: EventConverter end diff --git a/lib/federation/activity_pub/activity_stream/converter/flag.ex b/lib/federation/activity_stream/converter/flag.ex similarity index 91% rename from lib/federation/activity_pub/activity_stream/converter/flag.ex rename to lib/federation/activity_stream/converter/flag.ex index bd50a8031..b604ddb03 100644 --- a/lib/federation/activity_pub/activity_stream/converter/flag.ex +++ b/lib/federation/activity_stream/converter/flag.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Flag do +defmodule Mobilizon.Federation.ActivityStream.Converter.Flag do @moduledoc """ Flag converter. @@ -14,13 +14,13 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Flag do alias Mobilizon.Events.Event alias Mobilizon.Reports.Report - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} alias Mobilizon.Federation.ActivityPub.Relay + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} @behaviour Converter defimpl Convertible, for: Report do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Flag, as: FlagConverter + alias Mobilizon.Federation.ActivityStream.Converter.Flag, as: FlagConverter defdelegate model_to_as(report), to: FlagConverter end diff --git a/lib/federation/activity_pub/activity_stream/converter/follower.ex b/lib/federation/activity_stream/converter/follower.ex similarity index 79% rename from lib/federation/activity_pub/activity_stream/converter/follower.ex rename to lib/federation/activity_stream/converter/follower.ex index d280a3f69..028a393ee 100644 --- a/lib/federation/activity_pub/activity_stream/converter/follower.ex +++ b/lib/federation/activity_stream/converter/follower.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Follower do +defmodule Mobilizon.Federation.ActivityStream.Converter.Follower do @moduledoc """ Participant converter. @@ -9,10 +9,10 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Follower do alias Mobilizon.Actors.Actor alias Mobilizon.Actors.Follower, as: FollowerModel - alias Mobilizon.Federation.ActivityPub.ActivityStream.Convertible + alias Mobilizon.Federation.ActivityStream.Convertible defimpl Convertible, for: FollowerModel do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Follower, + alias Mobilizon.Federation.ActivityStream.Converter.Follower, as: FollowerConverter defdelegate model_to_as(follower), to: FollowerConverter diff --git a/lib/federation/activity_pub/activity_stream/converter/participant.ex b/lib/federation/activity_stream/converter/participant.ex similarity index 72% rename from lib/federation/activity_pub/activity_stream/converter/participant.ex rename to lib/federation/activity_stream/converter/participant.ex index 51eb26ea6..1581b6547 100644 --- a/lib/federation/activity_pub/activity_stream/converter/participant.ex +++ b/lib/federation/activity_stream/converter/participant.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Participant do +defmodule Mobilizon.Federation.ActivityStream.Converter.Participant do @moduledoc """ Participant converter. @@ -8,10 +8,10 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Participant alias Mobilizon.Events.Participant, as: ParticipantModel - alias Mobilizon.Federation.ActivityPub.ActivityStream.Convertible + alias Mobilizon.Federation.ActivityStream.Convertible defimpl Convertible, for: ParticipantModel do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Participant, as: ParticipantConverter + alias Mobilizon.Federation.ActivityStream.Converter.Participant, as: ParticipantConverter defdelegate model_to_as(participant), to: ParticipantConverter end diff --git a/lib/federation/activity_pub/activity_stream/converter/picture.ex b/lib/federation/activity_stream/converter/picture.ex similarity index 86% rename from lib/federation/activity_pub/activity_stream/converter/picture.ex rename to lib/federation/activity_stream/converter/picture.ex index 2c4b0894c..f2f29d1d0 100644 --- a/lib/federation/activity_pub/activity_stream/converter/picture.ex +++ b/lib/federation/activity_stream/converter/picture.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Picture do +defmodule Mobilizon.Federation.ActivityStream.Converter.Picture do @moduledoc """ Picture converter. @@ -33,13 +33,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Picture do ) when is_bitstring(picture_url) do with {:ok, %HTTPoison.Response{body: body}} <- HTTPoison.get(picture_url), - {:ok, - %{ - name: name, - url: url, - content_type: content_type, - size: size - }} <- + {:ok, %{name: name, url: url, content_type: content_type, size: size}} <- MobilizonWeb.Upload.store(%{body: body, name: name}), {:picture_exists, nil} <- {:picture_exists, Mobilizon.Media.get_picture_by_url(url)} do Mobilizon.Media.create_picture(%{ diff --git a/lib/federation/activity_pub/activity_stream/converter/tombstone.ex b/lib/federation/activity_stream/converter/tombstone.ex similarity index 76% rename from lib/federation/activity_pub/activity_stream/converter/tombstone.ex rename to lib/federation/activity_stream/converter/tombstone.ex index d782c0bf9..d0712286f 100644 --- a/lib/federation/activity_pub/activity_stream/converter/tombstone.ex +++ b/lib/federation/activity_stream/converter/tombstone.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Tombstone do +defmodule Mobilizon.Federation.ActivityStream.Converter.Tombstone do @moduledoc """ Comment converter. @@ -7,14 +7,14 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Tombstone do alias Mobilizon.Tombstone, as: TombstoneModel - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Converter, Convertible} + alias Mobilizon.Federation.ActivityStream.{Converter, Convertible} require Logger @behaviour Converter defimpl Convertible, for: TombstoneModel do - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Tombstone, as: TombstoneConverter + alias Mobilizon.Federation.ActivityStream.Converter.Tombstone, as: TombstoneConverter defdelegate model_to_as(comment), to: TombstoneConverter end diff --git a/lib/federation/activity_pub/activity_stream/converter/utils.ex b/lib/federation/activity_stream/converter/utils.ex similarity index 95% rename from lib/federation/activity_pub/activity_stream/converter/utils.ex rename to lib/federation/activity_stream/converter/utils.ex index 06c656603..1783ef81d 100644 --- a/lib/federation/activity_pub/activity_stream/converter/utils.ex +++ b/lib/federation/activity_stream/converter/utils.ex @@ -1,4 +1,4 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Utils do +defmodule Mobilizon.Federation.ActivityStream.Converter.Utils do @moduledoc """ Various utils for converters. """ @@ -29,9 +29,7 @@ defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Utils do end def fetch_address(%{id: id}) do - with {id, ""} <- Integer.parse(id) do - %{id: id} - end + with {id, ""} <- Integer.parse(id), do: %{id: id} end def fetch_address(address) when is_map(address) do diff --git a/lib/federation/activity_pub/activity_stream/convertible.ex b/lib/federation/activity_stream/convertible.ex similarity index 67% rename from lib/federation/activity_pub/activity_stream/convertible.ex rename to lib/federation/activity_stream/convertible.ex index cb27a76cc..cf6e2dfc1 100644 --- a/lib/federation/activity_pub/activity_stream/convertible.ex +++ b/lib/federation/activity_stream/convertible.ex @@ -1,4 +1,4 @@ -defprotocol Mobilizon.Federation.ActivityPub.ActivityStream.Convertible do +defprotocol Mobilizon.Federation.ActivityStream.Convertible do @moduledoc """ Convertible protocol. """ diff --git a/lib/federation/activity_pub/http_signatures/signature.ex b/lib/federation/http_signatures/signature.ex similarity index 100% rename from lib/federation/activity_pub/http_signatures/signature.ex rename to lib/federation/http_signatures/signature.ex diff --git a/lib/federation/activity_pub/web_finger/web_finger.ex b/lib/federation/web_finger/web_finger.ex similarity index 96% rename from lib/federation/activity_pub/web_finger/web_finger.ex rename to lib/federation/web_finger/web_finger.ex index 3e9459a54..bf71c384b 100644 --- a/lib/federation/activity_pub/web_finger/web_finger.ex +++ b/lib/federation/web_finger/web_finger.ex @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/web_finger/web_finger.ex -defmodule Mobilizon.Federation.ActivityPub.WebFinger do +defmodule Mobilizon.Federation.WebFinger do @moduledoc """ Performs the WebFinger requests and responses (JSON only). """ @@ -11,7 +11,7 @@ defmodule Mobilizon.Federation.ActivityPub.WebFinger do alias Mobilizon.Actors alias Mobilizon.Actors.Actor - alias Mobilizon.Federation.ActivityPub.WebFinger.XmlBuilder + alias Mobilizon.Federation.WebFinger.XmlBuilder require Jason require Logger diff --git a/lib/federation/activity_pub/web_finger/xml_builder.ex b/lib/federation/web_finger/xml_builder.ex similarity index 94% rename from lib/federation/activity_pub/web_finger/xml_builder.ex rename to lib/federation/web_finger/xml_builder.ex index 0c7cf45e6..76cc2cbea 100644 --- a/lib/federation/activity_pub/web_finger/xml_builder.ex +++ b/lib/federation/web_finger/xml_builder.ex @@ -3,7 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/xml_builder.ex -defmodule Mobilizon.Federation.ActivityPub.WebFinger.XmlBuilder do +defmodule Mobilizon.Federation.WebFinger.XmlBuilder do @moduledoc """ Builds XRD for WebFinger host_meta. """ diff --git a/lib/mobilizon_web/controllers/web_finger_controller.ex b/lib/mobilizon_web/controllers/web_finger_controller.ex index fca8074d1..6e96dc487 100644 --- a/lib/mobilizon_web/controllers/web_finger_controller.ex +++ b/lib/mobilizon_web/controllers/web_finger_controller.ex @@ -10,7 +10,7 @@ defmodule MobilizonWeb.WebFingerController do use MobilizonWeb, :controller - alias Mobilizon.Federation.ActivityPub.WebFinger + alias Mobilizon.Federation.WebFinger plug(MobilizonWeb.Plugs.Federating) diff --git a/lib/mobilizon_web/views/activity_pub/actor_view.ex b/lib/mobilizon_web/views/activity_pub/actor_view.ex index 477b17ac6..5d207a8cb 100644 --- a/lib/mobilizon_web/views/activity_pub/actor_view.ex +++ b/lib/mobilizon_web/views/activity_pub/actor_view.ex @@ -6,7 +6,7 @@ defmodule MobilizonWeb.ActivityPub.ActorView do alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub.{Activity, Utils} - alias Mobilizon.Federation.ActivityPub.ActivityStream.Convertible + alias Mobilizon.Federation.ActivityStream.Convertible @private_visibility_empty_collection %{elements: [], total: 0} diff --git a/lib/mobilizon_web/views/page_view.ex b/lib/mobilizon_web/views/page_view.ex index e89a18277..8a0cc3832 100644 --- a/lib/mobilizon_web/views/page_view.ex +++ b/lib/mobilizon_web/views/page_view.ex @@ -14,7 +14,7 @@ defmodule MobilizonWeb.PageView do alias Mobilizon.Service.Metadata.Utils, as: MetadataUtils alias Mobilizon.Federation.ActivityPub.Utils - alias Mobilizon.Federation.ActivityPub.ActivityStream.Convertible + alias Mobilizon.Federation.ActivityStream.Convertible def render("actor.activity-json", %{conn: %{assigns: %{object: %Actor{} = actor}}}) do actor diff --git a/mix.exs b/mix.exs index 02c248c61..6d92edd14 100644 --- a/mix.exs +++ b/mix.exs @@ -280,9 +280,9 @@ defmodule Mobilizon.Mixfile do Mobilizon.Federation.ActivityPub.Federator, Mobilizon.Federation.ActivityPub.Transmogrifier, Mobilizon.Federation.ActivityPub.Utils, - Mobilizon.Federation.ActivityPub.WebFinger, - Mobilizon.Federation.ActivityPub.WebFinger.XmlBuilder, Mobilizon.Federation.HTTPSignatures.Signature, + Mobilizon.Federation.WebFinger, + Mobilizon.Federation.WebFinger.XmlBuilder, MobilizonWeb.ActivityPub.ActorView, MobilizonWeb.ActivityPub.ObjectView, MobilizonWeb.ActivityPubController, diff --git a/test/federation/activity_pub/transmogrifier_test.exs b/test/federation/activity_pub/transmogrifier_test.exs index 532fa1650..07065c4cc 100644 --- a/test/federation/activity_pub/transmogrifier_test.exs +++ b/test/federation/activity_pub/transmogrifier_test.exs @@ -18,7 +18,7 @@ defmodule Mobilizon.Federation.ActivityPub.TransmogrifierTest do alias Mobilizon.Federation.ActivityPub alias Mobilizon.Federation.ActivityPub.Utils alias Mobilizon.Federation.ActivityPub.{Activity, Relay, Transmogrifier} - alias Mobilizon.Federation.ActivityPub.ActivityStream.{Convertible} + alias Mobilizon.Federation.ActivityStream.{Convertible} alias MobilizonWeb.API diff --git a/test/federation/activity_pub/utils_test.exs b/test/federation/activity_pub/utils_test.exs index 430fd109a..949635893 100644 --- a/test/federation/activity_pub/utils_test.exs +++ b/test/federation/activity_pub/utils_test.exs @@ -5,7 +5,7 @@ defmodule Mobilizon.Federation.ActivityPub.UtilsTest do import Mobilizon.Factory - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter + alias Mobilizon.Federation.ActivityStream.Converter alias MobilizonWeb.Endpoint alias MobilizonWeb.Router.Helpers, as: Routes diff --git a/test/federation/activity_pub/activity_stream/converter/actor_test.exs b/test/federation/activity_stream/converter/actor_test.exs similarity index 81% rename from test/federation/activity_pub/activity_stream/converter/actor_test.exs rename to test/federation/activity_stream/converter/actor_test.exs index 4e366e2aa..886845cbf 100644 --- a/test/federation/activity_pub/activity_stream/converter/actor_test.exs +++ b/test/federation/activity_stream/converter/actor_test.exs @@ -1,9 +1,9 @@ -defmodule Mobilizon.Federation.ActivityPub.ActivityStream.Converter.ActorTest do +defmodule Mobilizon.Federation.ActivityStream.Converter.ActorTest do use Mobilizon.DataCase alias Mobilizon.Actors.Actor - alias Mobilizon.Federation.ActivityPub.ActivityStream.Converter.Actor, as: ActorConverter + alias Mobilizon.Federation.ActivityStream.Converter.Actor, as: ActorConverter describe "actor to AS" do test "valid actor to as" do diff --git a/test/federation/activity_pub/web_finger_test.exs b/test/federation/web_finger_test.exs similarity index 95% rename from test/federation/activity_pub/web_finger_test.exs rename to test/federation/web_finger_test.exs index afe494011..4d3337f8d 100644 --- a/test/federation/activity_pub/web_finger_test.exs +++ b/test/federation/web_finger_test.exs @@ -3,13 +3,13 @@ # SPDX-License-Identifier: AGPL-3.0-only # Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/web_finger/web_finger_test.exs -defmodule Mobilizon.Federation.ActivityPub.WebFingerTest do +defmodule Mobilizon.Federation.WebFingerTest do use ExVCR.Mock, adapter: ExVCR.Adapter.Hackney use Mobilizon.DataCase import Mobilizon.Factory - alias Mobilizon.Federation.ActivityPub.WebFinger + alias Mobilizon.Federation.WebFinger @mastodon_account "tcit@social.tcit.fr" @mastodon_account_username "tcit" diff --git a/test/mobilizon_web/controllers/webfinger_controller_test.exs b/test/mobilizon_web/controllers/webfinger_controller_test.exs index 8ecc9da91..11739330a 100644 --- a/test/mobilizon_web/controllers/webfinger_controller_test.exs +++ b/test/mobilizon_web/controllers/webfinger_controller_test.exs @@ -9,7 +9,7 @@ defmodule MobilizonWeb.WebFingerControllerTest do import Mobilizon.Factory alias Mobilizon.Actors.Actor - alias Mobilizon.Federation.ActivityPub.WebFinger + alias Mobilizon.Federation.WebFinger setup_all do Mobilizon.Config.put([:instance, :federating], true)