diff --git a/lib/mobilizon_web/controllers/activity_pub_controller.ex b/lib/mobilizon_web/controllers/activity_pub_controller.ex index a7e9a650..10db79ac 100644 --- a/lib/mobilizon_web/controllers/activity_pub_controller.ex +++ b/lib/mobilizon_web/controllers/activity_pub_controller.ex @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/activity_pub/activity_pub_controller.ex + defmodule MobilizonWeb.ActivityPubController do use MobilizonWeb, :controller alias Mobilizon.{Actors, Actors.Actor, Events} diff --git a/lib/mobilizon_web/controllers/node_info_controller.ex b/lib/mobilizon_web/controllers/node_info_controller.ex index af7248e6..ab8b5e07 100644 --- a/lib/mobilizon_web/controllers/node_info_controller.ex +++ b/lib/mobilizon_web/controllers/node_info_controller.ex @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex + defmodule MobilizonWeb.NodeInfoController do use MobilizonWeb, :controller diff --git a/lib/mobilizon_web/controllers/web_finger_controller.ex b/lib/mobilizon_web/controllers/web_finger_controller.ex index ffbf7db9..5a787d1a 100644 --- a/lib/mobilizon_web/controllers/web_finger_controller.ex +++ b/lib/mobilizon_web/controllers/web_finger_controller.ex @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/web_finger/web_finger_controller.ex + defmodule MobilizonWeb.WebFingerController do use MobilizonWeb, :controller diff --git a/lib/mobilizon_web/http_signature.ex b/lib/mobilizon_web/http_signature.ex index e3c33513..a10b8c12 100644 --- a/lib/mobilizon_web/http_signature.ex +++ b/lib/mobilizon_web/http_signature.ex @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/plugs/http_signature.ex + defmodule MobilizonWeb.HTTPSignaturePlug do @moduledoc """ # HTTPSignaturePlug diff --git a/lib/service/activity_pub/activity_pub.ex b/lib/service/activity_pub/activity_pub.ex index 1636fdc6..c3bc3c80 100644 --- a/lib/service/activity_pub/activity_pub.ex +++ b/lib/service/activity_pub/activity_pub.ex @@ -1,6 +1,7 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/activity_pub/activity_pub.ex defmodule Mobilizon.Service.ActivityPub do @moduledoc """ diff --git a/lib/service/activity_pub/transmogrifier.ex b/lib/service/activity_pub/transmogrifier.ex index 7228e7e1..9e8a13ac 100644 --- a/lib/service/activity_pub/transmogrifier.ex +++ b/lib/service/activity_pub/transmogrifier.ex @@ -1,6 +1,7 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/activity_pub/transmogrifier.ex defmodule Mobilizon.Service.ActivityPub.Transmogrifier do @moduledoc """ diff --git a/lib/service/activity_pub/utils.ex b/lib/service/activity_pub/utils.ex index 5e32c5c5..2b766d6e 100644 --- a/lib/service/activity_pub/utils.ex +++ b/lib/service/activity_pub/utils.ex @@ -1,6 +1,7 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/activity_pub/utils.ex defmodule Mobilizon.Service.ActivityPub.Utils do @moduledoc """ diff --git a/lib/service/federator.ex b/lib/service/federator.ex index 20d8c98d..968a3755 100644 --- a/lib/service/federator.ex +++ b/lib/service/federator.ex @@ -1,6 +1,7 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/federator/federator.ex defmodule Mobilizon.Service.Federator do @moduledoc """ diff --git a/lib/service/formatter/formatter.ex b/lib/service/formatter/formatter.ex index a13556e6..70512b0b 100644 --- a/lib/service/formatter/formatter.ex +++ b/lib/service/formatter/formatter.ex @@ -1,6 +1,7 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/formatter.ex defmodule Mobilizon.Service.Formatter do alias Mobilizon.Actors.Actor diff --git a/lib/service/http_signatures/http_signatures.ex b/lib/service/http_signatures/http_signatures.ex index 832dfd37..d718f021 100644 --- a/lib/service/http_signatures/http_signatures.ex +++ b/lib/service/http_signatures/http_signatures.ex @@ -1,6 +1,7 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/pleroma/web/http_signatures/http_signatures.ex # https://tools.ietf.org/html/draft-cavage-http-signatures-08 defmodule Mobilizon.Service.HTTPSignatures do diff --git a/lib/service/streamer.ex b/lib/service/streamer.ex deleted file mode 100644 index 7b14ce58..00000000 --- a/lib/service/streamer.ex +++ /dev/null @@ -1,95 +0,0 @@ -# Portions of this file are derived from Pleroma: -# Copyright © 2017-2018 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Mobilizon.Service.Streamer do - @moduledoc """ - # Streamer - - Handles streaming activities - """ - - use GenServer - require Logger - - def init(args) do - {:ok, args} - end - - def start_link do - spawn(fn -> - # 30 seconds - Process.sleep(1000 * 30) - GenServer.cast(__MODULE__, %{action: :ping}) - end) - - GenServer.start_link(__MODULE__, %{}, name: __MODULE__) - end - - def add_socket(topic, socket) do - GenServer.cast(__MODULE__, %{action: :add, socket: socket, topic: topic}) - end - - def remove_socket(topic, socket) do - GenServer.cast(__MODULE__, %{action: :remove, socket: socket, topic: topic}) - end - - def stream(topic, item) do - GenServer.cast(__MODULE__, %{action: :stream, topic: topic, item: item}) - end - - def handle_cast(%{action: :ping}, topics) do - topics - |> Map.values() - |> List.flatten() - |> Enum.each(fn socket -> - Logger.debug("Sending keepalive ping") - send(socket.transport_pid, {:text, ""}) - end) - - spawn(fn -> - # 30 seconds - Process.sleep(1000 * 30) - GenServer.cast(__MODULE__, %{action: :ping}) - end) - - {:noreply, topics} - end - - def handle_cast(%{action: :add, topic: topic, socket: socket}, sockets) do - topic = internal_topic(topic, socket) - sockets_for_topic = sockets[topic] || [] - sockets_for_topic = Enum.uniq([socket | sockets_for_topic]) - sockets = Map.put(sockets, topic, sockets_for_topic) - - Logger.debug(fn -> - "Got new conn for #{topic}" - end) - - {:noreply, sockets} - end - - def handle_cast(%{action: :remove, topic: topic, socket: socket}, sockets) do - topic = internal_topic(topic, socket) - sockets_for_topic = sockets[topic] || [] - sockets_for_topic = List.delete(sockets_for_topic, socket) - sockets = Map.put(sockets, topic, sockets_for_topic) - - Logger.debug(fn -> - "Removed conn for #{topic}" - end) - - {:noreply, sockets} - end - - def handle_cast(m, state) do - Logger.info("Unknown: #{inspect(m)}, #{inspect(state)}") - {:noreply, state} - end - - defp internal_topic("user", socket) do - "user:#{socket.assigns[:user].id}" - end - - defp internal_topic(topic, _), do: topic -end diff --git a/lib/service/web_finger/web_finger.ex b/lib/service/web_finger/web_finger.ex index cdaa5a99..4e453bf5 100644 --- a/lib/service/web_finger/web_finger.ex +++ b/lib/service/web_finger/web_finger.ex @@ -1,12 +1,13 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # 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.Service.WebFinger do @moduledoc """ # WebFinger - Performs the WebFinger requests and responses (json only) + Performs the WebFinger requests and responses (JSON only) """ alias Mobilizon.Actors diff --git a/lib/service/xml_builder.ex b/lib/service/xml_builder.ex index c2177d54..ac32a45b 100644 --- a/lib/service/xml_builder.ex +++ b/lib/service/xml_builder.ex @@ -1,12 +1,13 @@ # Portions of this file are derived from Pleroma: # Copyright © 2017-2018 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/lib/xml_builder.ex defmodule Mobilizon.Service.XmlBuilder do @moduledoc """ XML Builder. - Do we still need this ? Only for xrd ? + Needed to build XRD for webfinger host_meta """ def to_xml({tag, attributes, content}) do diff --git a/test/mobilizon/service/activitypub/activitypub_test.exs b/test/mobilizon/service/activity_pub/activity_pub_test.exs similarity index 93% rename from test/mobilizon/service/activitypub/activitypub_test.exs rename to test/mobilizon/service/activity_pub/activity_pub_test.exs index d870afca..5975ad4a 100644 --- a/test/mobilizon/service/activitypub/activitypub_test.exs +++ b/test/mobilizon/service/activity_pub/activity_pub_test.exs @@ -1,4 +1,9 @@ -defmodule Mobilizon.Service.Activitypub.ActivitypubTest do +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/activity_pub_test.exs + +defmodule Mobilizon.Service.ActivityPub.ActivityPubTest do use Mobilizon.DataCase import Mobilizon.Factory diff --git a/test/mobilizon/service/activitypub/transmogrifier_test.exs b/test/mobilizon/service/activity_pub/transmogrifier_test.exs similarity index 98% rename from test/mobilizon/service/activitypub/transmogrifier_test.exs rename to test/mobilizon/service/activity_pub/transmogrifier_test.exs index faa7e2d6..e6da6555 100644 --- a/test/mobilizon/service/activitypub/transmogrifier_test.exs +++ b/test/mobilizon/service/activity_pub/transmogrifier_test.exs @@ -1,4 +1,10 @@ -defmodule Mobilizon.Service.Activitypub.TransmogrifierTest do +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/activity_pub/transmogrifier_test.exs + +defmodule Mobilizon.Service.ActivityPub.TransmogrifierTest do + use Mobilizon.DataCase import Mobilizon.Factory diff --git a/test/mobilizon/service/activitypub/utils_test.exs b/test/mobilizon/service/activity_pub/utils_test.exs similarity index 96% rename from test/mobilizon/service/activitypub/utils_test.exs rename to test/mobilizon/service/activity_pub/utils_test.exs index 45b25efc..642531ef 100644 --- a/test/mobilizon/service/activitypub/utils_test.exs +++ b/test/mobilizon/service/activity_pub/utils_test.exs @@ -1,4 +1,4 @@ -defmodule Mobilizon.Service.Activitypub.UtilsTest do +defmodule Mobilizon.Service.ActivityPub.UtilsTest do use Mobilizon.DataCase import Mobilizon.Factory alias Mobilizon.Service.ActivityPub.Utils diff --git a/test/mobilizon/service/web_finger/web_finger_test.exs b/test/mobilizon/service/web_finger/web_finger_test.exs index 06fa4d1f..e66a5df5 100644 --- a/test/mobilizon/service/web_finger/web_finger_test.exs +++ b/test/mobilizon/service/web_finger/web_finger_test.exs @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# 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.Service.WebFingerTest do use Mobilizon.DataCase alias Mobilizon.Service.WebFinger diff --git a/test/mobilizon_web/controllers/activity_pub_controller_test.exs b/test/mobilizon_web/controllers/activity_pub_controller_test.exs index f9450a04..4038a043 100644 --- a/test/mobilizon_web/controllers/activity_pub_controller_test.exs +++ b/test/mobilizon_web/controllers/activity_pub_controller_test.exs @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only +# Upstream: https://git.pleroma.social/pleroma/pleroma/blob/develop/test/web/web_finger/web_finger_controller_test.exs + defmodule MobilizonWeb.ActivityPubControllerTest do use MobilizonWeb.ConnCase import Mobilizon.Factory diff --git a/test/mobilizon_web/controllers/webfinger_controller_test.exs b/test/mobilizon_web/controllers/webfinger_controller_test.exs index de9b2643..37b41bef 100644 --- a/test/mobilizon_web/controllers/webfinger_controller_test.exs +++ b/test/mobilizon_web/controllers/webfinger_controller_test.exs @@ -1,3 +1,8 @@ +# Portions of this file are derived from Pleroma: +# Copyright © 2017-2018 Pleroma Authors +# 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 MobilizonWeb.WebFingerTest do use MobilizonWeb.ConnCase alias Mobilizon.Actors.Actor