From ee221277b05d2f682c340c1e1b81fbce4931735a Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 21 Dec 2020 22:54:26 +0300 Subject: Encapsulation of tags / hashtags fetching from objects. --- lib/pleroma/activity/ir/topics.ex | 10 ++--- lib/pleroma/object.ex | 45 +++++++++++++++++++--- lib/pleroma/web/activity_pub/mrf/simple_policy.ex | 8 ++-- lib/pleroma/web/activity_pub/transmogrifier.ex | 29 +++++++------- lib/pleroma/web/feed/feed_view.ex | 1 + lib/pleroma/web/mastodon_api/views/status_view.ex | 6 ++- .../web/templates/feed/feed/_activity.atom.eex | 2 +- .../web/templates/feed/feed/_activity.rss.eex | 2 +- .../web/templates/feed/feed/_tag_activity.atom.eex | 2 +- .../transmogrifier/note_handling_test.exs | 6 ++- test/pleroma/web/common_api_test.exs | 2 +- .../web/mastodon_api/views/status_view_test.exs | 4 +- 12 files changed, 78 insertions(+), 39 deletions(-) diff --git a/lib/pleroma/activity/ir/topics.ex b/lib/pleroma/activity/ir/topics.ex index fe2e8cb5c..2c74ac2bf 100644 --- a/lib/pleroma/activity/ir/topics.ex +++ b/lib/pleroma/activity/ir/topics.ex @@ -48,14 +48,12 @@ defp item_creation_tags(tags, _, _) do tags end - defp hashtags_to_topics(%{data: %{"tag" => tags}}) do - tags - |> Enum.filter(&is_bitstring(&1)) - |> Enum.map(fn tag -> "hashtag:" <> tag end) + defp hashtags_to_topics(object) do + object + |> Object.hashtags() + |> Enum.map(fn hashtag -> "hashtag:" <> hashtag end) end - defp hashtags_to_topics(_), do: [] - defp remote_topics(%{local: true}), do: [] defp remote_topics(%{actor: actor}) when is_binary(actor), diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 052ad413b..2088c7656 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -47,17 +47,33 @@ def with_joined_activity(query, activity_type \\ "Create", join_type \\ :inner) end def create(data) do - Object.change(%Object{}, %{data: data}) + %Object{} + |> Object.change(%{data: data}) |> Repo.insert() end def change(struct, params \\ %{}) do - struct - |> cast(params, [:data]) - |> validate_required([:data]) - |> unique_constraint(:ap_id, name: :objects_unique_apid_index) + changeset = + struct + |> cast(params, [:data]) + |> validate_required([:data]) + |> unique_constraint(:ap_id, name: :objects_unique_apid_index) + + if hashtags_changed?(struct, get_change(changeset, :data)) do + # TODO: modify assoc once it's introduced + changeset + else + changeset + end + end + + defp hashtags_changed?(%Object{} = struct, %{"tag" => _} = data) do + Enum.sort(embedded_hashtags(struct)) != + Enum.sort(object_data_hashtags(data)) end + defp hashtags_changed?(_, _), do: false + def get_by_id(nil), do: nil def get_by_id(id), do: Repo.get(Object, id) @@ -344,4 +360,23 @@ def replies(object, opts \\ []) do def self_replies(object, opts \\ []), do: replies(object, Keyword.put(opts, :self_only, true)) + + def tags(%Object{data: %{"tag" => tags}}) when is_list(tags), do: tags + + def tags(_), do: [] + + def hashtags(object), do: embedded_hashtags(object) + + defp embedded_hashtags(%Object{data: data}) do + object_data_hashtags(data) + end + + defp embedded_hashtags(_), do: [] + + defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do + # Note: AS2 map-type elements are ignored + Enum.filter(tags, &is_bitstring(&1)) + end + + defp object_data_hashtags(_), do: [] end diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex index 6cd91826d..e92091d66 100644 --- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex @@ -74,9 +74,11 @@ defp check_media_nsfw( object = if MRF.subdomain_match?(media_nsfw, actor_host) do - tags = (child_object["tag"] || []) ++ ["nsfw"] - child_object = Map.put(child_object, "tag", tags) - child_object = Map.put(child_object, "sensitive", true) + child_object = + child_object + |> Map.put("tag", (child_object["tag"] || []) ++ ["nsfw"]) + |> Map.put("sensitive", true) + Map.put(object, "object", child_object) else object diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 565d32433..fd17793d0 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -32,18 +32,18 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do """ def fix_object(object, options \\ []) do object - |> strip_internal_fields - |> fix_actor - |> fix_url - |> fix_attachments - |> fix_context + |> strip_internal_fields() + |> fix_actor() + |> fix_url() + |> fix_attachments() + |> fix_context() |> fix_in_reply_to(options) - |> fix_emoji - |> fix_tag - |> set_sensitive - |> fix_content_map - |> fix_addressing - |> fix_summary + |> fix_emoji() + |> fix_tag() + |> set_sensitive() + |> fix_content_map() + |> fix_addressing() + |> fix_summary() |> fix_type(options) end @@ -315,10 +315,9 @@ def fix_tag(%{"tag" => tag} = object) when is_list(tag) do tags = tag |> Enum.filter(fn data -> data["type"] == "Hashtag" and data["name"] end) - |> Enum.map(fn %{"name" => name} -> - name - |> String.slice(1..-1) - |> String.downcase() + |> Enum.map(fn + %{"name" => "#" <> hashtag} -> String.downcase(hashtag) + %{"name" => hashtag} -> String.downcase(hashtag) end) Map.put(object, "tag", tag ++ tags) diff --git a/lib/pleroma/web/feed/feed_view.ex b/lib/pleroma/web/feed/feed_view.ex index 30e0a2a55..1155c6a39 100644 --- a/lib/pleroma/web/feed/feed_view.ex +++ b/lib/pleroma/web/feed/feed_view.ex @@ -32,6 +32,7 @@ def prepare_activity(activity, opts \\ []) do %{ activity: activity, + object: object, data: Map.get(object, :data), actor: actor } diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 2301e21cf..bd08aa203 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -201,8 +201,10 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} like_count = object.data["like_count"] || 0 announcement_count = object.data["announcement_count"] || 0 - tags = object.data["tag"] || [] - sensitive = object.data["sensitive"] || Enum.member?(tags, "nsfw") + hashtags = Object.hashtags(object) + sensitive = object.data["sensitive"] || Enum.member?(hashtags, "nsfw") + + tags = Object.tags(object) tag_mentions = tags diff --git a/lib/pleroma/web/templates/feed/feed/_activity.atom.eex b/lib/pleroma/web/templates/feed/feed/_activity.atom.eex index 3fd150c4e..6688830ba 100644 --- a/lib/pleroma/web/templates/feed/feed/_activity.atom.eex +++ b/lib/pleroma/web/templates/feed/feed/_activity.atom.eex @@ -22,7 +22,7 @@ <% end %> - <%= for tag <- @data["tag"] || [] do %> + <%= for tag <- Pleroma.Object.hashtags(@object) do %> <% end %> diff --git a/lib/pleroma/web/templates/feed/feed/_activity.rss.eex b/lib/pleroma/web/templates/feed/feed/_activity.rss.eex index 42960de7d..fc6d74b42 100644 --- a/lib/pleroma/web/templates/feed/feed/_activity.rss.eex +++ b/lib/pleroma/web/templates/feed/feed/_activity.rss.eex @@ -21,7 +21,7 @@ <%= @data["external_url"] %> <% end %> - <%= for tag <- @data["tag"] || [] do %> + <%= for tag <- Pleroma.Object.hashtags(@object) do %> <% end %> diff --git a/lib/pleroma/web/templates/feed/feed/_tag_activity.atom.eex b/lib/pleroma/web/templates/feed/feed/_tag_activity.atom.eex index cf5874a91..c2de28fe4 100644 --- a/lib/pleroma/web/templates/feed/feed/_tag_activity.atom.eex +++ b/lib/pleroma/web/templates/feed/feed/_tag_activity.atom.eex @@ -41,7 +41,7 @@ <% end %> <% end %> - <%= for tag <- @data["tag"] || [] do %> + <%= for tag <- Pleroma.Object.hashtags(@object) do %> <% end %> diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index b4a006aec..a33959d9f 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -39,7 +39,8 @@ test "it works for incoming notices with tag not being an array (kroeg)" do {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) object = Object.normalize(data["object"]) - assert "test" in object.data["tag"] + assert "test" in Object.tags(object) + assert Object.hashtags(object) == ["test"] end test "it cleans up incoming notices which are not really DMs" do @@ -220,7 +221,8 @@ test "it works for incoming notices with hashtags" do {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) object = Object.normalize(data["object"]) - assert Enum.at(object.data["tag"], 2) == "moo" + assert Enum.at(Object.tags(object), 2) == "moo" + assert Object.hashtags(object) == ["moo"] end test "it works for incoming notices with contentMap" do diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 585b2c174..1e98208fb 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -493,7 +493,7 @@ test "it de-duplicates tags" do object = Object.normalize(activity) - assert object.data["tag"] == ["2hu"] + assert Object.tags(object) == ["2hu"] end test "it adds emoji in the object" do 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 f2a7469ed..6b8afc960 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -262,8 +262,8 @@ test "a note activity" do mentions: [], tags: [ %{ - name: "#{object_data["tag"]}", - url: "/tag/#{object_data["tag"]}" + name: "#{hd(object_data["tag"])}", + url: "/tag/#{hd(object_data["tag"])}" } ], application: %{ -- cgit v1.2.3 From 538af14d527d34cadb2b8a576ef060f208747e38 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 22 Dec 2020 17:55:30 +0300 Subject: possibility to run rollback in test env --- lib/mix/tasks/pleroma/ecto/rollback.ex | 5 +++-- test/mix/tasks/pleroma/ecto/rollback_test.exs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/mix/tasks/pleroma/ecto/rollback.ex b/lib/mix/tasks/pleroma/ecto/rollback.ex index 3dba952cb..41bd04a28 100644 --- a/lib/mix/tasks/pleroma/ecto/rollback.ex +++ b/lib/mix/tasks/pleroma/ecto/rollback.ex @@ -20,7 +20,8 @@ defmodule Mix.Tasks.Pleroma.Ecto.Rollback do start: :boolean, quiet: :boolean, log_sql: :boolean, - migrations_path: :string + migrations_path: :string, + env: :string ] @moduledoc """ @@ -59,7 +60,7 @@ def run(args \\ []) do level = Logger.level() Logger.configure(level: :info) - if Pleroma.Config.get(:env) == :test do + if opts[:env] == "test" do Logger.info("Rollback succesfully") else {:ok, _, _} = diff --git a/test/mix/tasks/pleroma/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs index 0236e35d5..56059d899 100644 --- a/test/mix/tasks/pleroma/ecto/rollback_test.exs +++ b/test/mix/tasks/pleroma/ecto/rollback_test.exs @@ -12,7 +12,7 @@ test "ecto.rollback info message" do Logger.configure(level: :warn) assert capture_log(fn -> - Mix.Tasks.Pleroma.Ecto.Rollback.run() + Mix.Tasks.Pleroma.Ecto.Rollback.run(["--env", "test"]) end) =~ "[info] Rollback succesfully" Logger.configure(level: level) -- cgit v1.2.3 From e369b1306b2f8b9732c21333b9957f7e4e408f90 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 22 Dec 2020 22:04:33 +0300 Subject: Added Hashtag entity and objects-hashtags association with auto-sync with `data.tag` on Object update. --- lib/pleroma/hashtag.ex | 58 ++++++++++++++++++++++ lib/pleroma/object.ex | 37 ++++++++++---- .../migrations/20201221202251_create_hashtags.exs | 14 ++++++ .../20201221203824_create_hashtags_objects.exs | 13 +++++ test/pleroma/object_test.exs | 27 ++++++++++ .../pleroma/web/activity_pub/activity_pub_test.exs | 5 ++ 6 files changed, 144 insertions(+), 10 deletions(-) create mode 100644 lib/pleroma/hashtag.ex create mode 100644 priv/repo/migrations/20201221202251_create_hashtags.exs create mode 100644 priv/repo/migrations/20201221203824_create_hashtags_objects.exs diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex new file mode 100644 index 000000000..b05927563 --- /dev/null +++ b/lib/pleroma/hashtag.ex @@ -0,0 +1,58 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Hashtag do + use Ecto.Schema + + import Ecto.Changeset + + alias Pleroma.Hashtag + alias Pleroma.Repo + + @derive {Jason.Encoder, only: [:data]} + + schema "hashtags" do + field(:name, :string) + field(:data, :map, default: %{}) + + many_to_many(:objects, Pleroma.Object, join_through: "hashtags_objects", on_replace: :delete) + + timestamps() + end + + def get_by_name(name) do + Repo.get_by(Hashtag, name: name) + end + + def get_or_create_by_name(name) when is_bitstring(name) do + with %Hashtag{} = hashtag <- get_by_name(name) do + {:ok, hashtag} + else + _ -> + %Hashtag{} + |> changeset(%{name: name}) + |> Repo.insert() + end + end + + def get_or_create_by_names(names) when is_list(names) do + Enum.reduce_while(names, {:ok, []}, fn name, {:ok, list} -> + case get_or_create_by_name(name) do + {:ok, %Hashtag{} = hashtag} -> + {:cont, {:ok, list ++ [hashtag]}} + + error -> + {:halt, error} + end + end) + end + + def changeset(%Hashtag{} = struct, params) do + struct + |> cast(params, [:name, :data]) + |> update_change(:name, &String.downcase/1) + |> validate_required([:name]) + |> unique_constraint(:name) + end +end diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 2088c7656..357a3b504 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Object do alias Pleroma.Activity alias Pleroma.Config + alias Pleroma.Hashtag alias Pleroma.Object alias Pleroma.Object.Fetcher alias Pleroma.ObjectTombstone @@ -26,6 +27,8 @@ defmodule Pleroma.Object do schema "objects" do field(:data, :map) + many_to_many(:hashtags, Hashtag, join_through: "hashtags_objects", on_replace: :delete) + timestamps() end @@ -53,17 +56,31 @@ def create(data) do end def change(struct, params \\ %{}) do - changeset = - struct - |> cast(params, [:data]) - |> validate_required([:data]) - |> unique_constraint(:ap_id, name: :objects_unique_apid_index) - - if hashtags_changed?(struct, get_change(changeset, :data)) do - # TODO: modify assoc once it's introduced - changeset + struct + |> cast(params, [:data]) + |> validate_required([:data]) + |> unique_constraint(:ap_id, name: :objects_unique_apid_index) + |> maybe_handle_hashtags_change(struct) + end + + defp maybe_handle_hashtags_change(changeset, struct) do + with data_hashtags_change = get_change(changeset, :data), + true <- hashtags_changed?(struct, data_hashtags_change), + {:ok, hashtag_records} <- + data_hashtags_change + |> object_data_hashtags() + |> Hashtag.get_or_create_by_names() do + put_assoc(changeset, :hashtags, hashtag_records) else - changeset + false -> + changeset + + {:error, hashtag_changeset} -> + failed_hashtag = get_field(hashtag_changeset, :name) + + validate_change(changeset, :data, fn _, _ -> + [data: "error referencing hashtag: #{failed_hashtag}"] + end) end end diff --git a/priv/repo/migrations/20201221202251_create_hashtags.exs b/priv/repo/migrations/20201221202251_create_hashtags.exs new file mode 100644 index 000000000..afc522002 --- /dev/null +++ b/priv/repo/migrations/20201221202251_create_hashtags.exs @@ -0,0 +1,14 @@ +defmodule Pleroma.Repo.Migrations.CreateHashtags do + use Ecto.Migration + + def change do + create_if_not_exists table(:hashtags) do + add(:name, :citext, null: false) + add(:data, :map, default: %{}) + + timestamps() + end + + create_if_not_exists(unique_index(:hashtags, [:name])) + end +end diff --git a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs new file mode 100644 index 000000000..b2649b4fb --- /dev/null +++ b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs @@ -0,0 +1,13 @@ +defmodule Pleroma.Repo.Migrations.CreateHashtagsObjects do + use Ecto.Migration + + def change do + create_if_not_exists table(:hashtags_objects) do + add(:hashtag_id, references(:hashtags), null: false) + add(:object_id, references(:objects), null: false) + end + + create_if_not_exists(unique_index(:hashtags_objects, [:hashtag_id, :object_id])) + create_if_not_exists(index(:hashtags_objects, [:object_id])) + end +end diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs index 5d4e6fb84..819ecd210 100644 --- a/test/pleroma/object_test.exs +++ b/test/pleroma/object_test.exs @@ -5,10 +5,13 @@ defmodule Pleroma.ObjectTest do use Pleroma.DataCase use Oban.Testing, repo: Pleroma.Repo + import ExUnit.CaptureLog import Pleroma.Factory import Tesla.Mock + alias Pleroma.Activity + alias Pleroma.Hashtag alias Pleroma.Object alias Pleroma.Repo alias Pleroma.Tests.ObanHelpers @@ -406,4 +409,28 @@ test "preserves internal fields on refetch", %{mock_modified: mock_modified} do assert updated_object.data["like_count"] == 1 end end + + describe ":hashtags association" do + test "Hashtag records are created with Object record and updated on its change" do + user = insert(:user) + + {:ok, %{object: object}} = + CommonAPI.post(user, %{status: "some text #hashtag1 #hashtag2 ..."}) + + assert [%Hashtag{name: "hashtag1"}, %Hashtag{name: "hashtag2"}] = + Enum.sort_by(object.hashtags, & &1.name) + + {:ok, object} = Object.update_data(object, %{"tag" => []}) + + assert [] = object.hashtags + + object = Object.get_by_id(object.id) |> Repo.preload(:hashtags) + assert [] = object.hashtags + + {:ok, object} = Object.update_data(object, %{"tag" => ["abc", "def"]}) + + assert [%Hashtag{name: "abc"}, %Hashtag{name: "def"}] = + Enum.sort_by(object.hashtags, & &1.name) + end + end end diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 9eb7ae86b..bfec32042 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -217,6 +217,11 @@ test "it fetches the appropriate tag-restricted posts" do tag_all: ["test", "reject"] }) + [fetch_one, fetch_two, fetch_three, fetch_four] = + Enum.map([fetch_one, fetch_two, fetch_three, fetch_four], fn statuses -> + Enum.map(statuses, fn s -> Repo.preload(s, object: :hashtags) end) + end) + assert fetch_one == [status_one, status_three] assert fetch_two == [status_one, status_two, status_three] assert fetch_three == [status_one, status_two] -- cgit v1.2.3 From cbb19d0e1882f5ce641f30b51d7156336f81aba9 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 26 Dec 2020 22:20:55 +0300 Subject: [#3213] Hashtag-filtering functions in ActivityPub. Mix task for migrating hashtags to `hashtags` table. --- lib/mix/tasks/pleroma/database.ex | 64 ++++++++ lib/pleroma/web/activity_pub/activity_pub.ex | 167 ++++++++++++++++----- .../pleroma/web/activity_pub/activity_pub_test.exs | 48 +++--- 3 files changed, 216 insertions(+), 63 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 22151ce08..093c7dd30 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -4,14 +4,18 @@ defmodule Mix.Tasks.Pleroma.Database do alias Pleroma.Conversation + alias Pleroma.Hashtag alias Pleroma.Maintenance alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User + require Logger require Pleroma.Constants + import Ecto.Query import Mix.Pleroma + use Mix.Task @shortdoc "A collection of database related tasks" @@ -128,6 +132,66 @@ def run(["fix_likes_collections"]) do |> Stream.run() end + def run(["transfer_hashtags"]) do + import Ecto.Query + + start_pleroma() + + from( + object in Object, + left_join: hashtag in assoc(object, :hashtags), + where: is_nil(hashtag.id), + where: fragment("(?)->>'tag' != '[]'", object.data), + select: %{ + id: object.id, + inserted_at: object.inserted_at, + tag: fragment("(?)->>'tag'", object.data) + }, + order_by: [desc: object.id] + ) + |> Pleroma.Repo.chunk_stream(100, :batches) + |> Stream.each(fn objects -> + chunk_start = List.first(objects) + chunk_end = List.last(objects) + + Logger.info( + "transfer_hashtags: " <> + "#{chunk_start.id} (#{chunk_start.inserted_at}) -- " <> + "#{chunk_end.id} (#{chunk_end.inserted_at})" + ) + + Enum.map( + objects, + fn object -> + hashtags = + object.tag + |> Jason.decode!() + |> Enum.filter(&is_bitstring(&1)) + + with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do + Repo.transaction(fn -> + for hashtag_record <- hashtag_records do + with {:error, _} <- + Ecto.Adapters.SQL.query( + Repo, + "insert into hashtags_objects(hashtag_id, object_id) values " <> + "(#{hashtag_record.id}, #{object.id});" + ) do + Logger.warn( + "ERROR: could not link object #{object.id} and hashtag #{hashtag_record.id}" + ) + end + end + end) + else + e -> Logger.warn("ERROR: could not process object #{object.id}: #{inspect(e)}") + end + end + ) + end) + |> Stream.run() + end + def run(["vacuum", args]) do start_pleroma() diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 1c91bc074..2e25412c6 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -660,33 +660,41 @@ defp restrict_since(query, %{since_id: since_id}) do defp restrict_since(query, _), do: query defp restrict_tag_reject(_query, %{tag_reject: _tag_reject, skip_preload: true}) do - raise "Can't use the child object without preloading!" + raise_on_missing_preload() end - defp restrict_tag_reject(query, %{tag_reject: [_ | _] = tag_reject}) do + defp restrict_tag_reject(query, %{tag_reject: tag_reject}) when is_list(tag_reject) do from( [_activity, object] in query, where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) ) end + defp restrict_tag_reject(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do + restrict_tag_reject(query, %{tag_reject: [tag_reject]}) + end + defp restrict_tag_reject(query, _), do: query defp restrict_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) do - raise "Can't use the child object without preloading!" + raise_on_missing_preload() end - defp restrict_tag_all(query, %{tag_all: [_ | _] = tag_all}) do + defp restrict_tag_all(query, %{tag_all: tag_all}) when is_list(tag_all) do from( [_activity, object] in query, where: fragment("(?)->'tag' \\?& (?)", object.data, ^tag_all) ) end + defp restrict_tag_all(query, %{tag_all: tag}) when is_binary(tag) do + restrict_tag(query, %{tag: tag}) + end + defp restrict_tag_all(query, _), do: query defp restrict_tag(_query, %{tag: _tag, skip_preload: true}) do - raise "Can't use the child object without preloading!" + raise_on_missing_preload() end defp restrict_tag(query, %{tag: tag}) when is_list(tag) do @@ -697,13 +705,79 @@ defp restrict_tag(query, %{tag: tag}) when is_list(tag) do end defp restrict_tag(query, %{tag: tag}) when is_binary(tag) do + restrict_tag(query, %{tag: [tag]}) + end + + defp restrict_tag(query, _), do: query + + defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do + raise_on_missing_preload() + end + + defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do + if has_named_binding?(query, :thread_mute) do + from( + [activity, object, thread_mute] in query, + group_by: [activity.id, object.id, thread_mute.id] + ) + else + from( + [activity, object] in query, + group_by: [activity.id, object.id] + ) + end + |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) + |> having( + [hashtag: hashtag], + fragment("not(array_agg(?) && (?))", hashtag.name, ^tags_reject) + ) + end + + defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do + restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) + end + + defp restrict_hashtag_reject_any(query, _), do: query + + defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do + raise_on_missing_preload() + end + + defp restrict_hashtag_all(query, %{tag_all: tags}) when is_list(tags) do + Enum.reduce( + tags, + query, + fn tag, acc -> restrict_hashtag_any(acc, %{tag: tag}) end + ) + end + + defp restrict_hashtag_all(query, %{tag_all: tag}) when is_binary(tag) do + restrict_hashtag_any(query, %{tag: tag}) + end + + defp restrict_hashtag_all(query, _), do: query + + defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do + raise_on_missing_preload() + end + + defp restrict_hashtag_any(query, %{tag: tags}) when is_list(tags) do from( [_activity, object] in query, - where: fragment("(?)->'tag' \\? (?)", object.data, ^tag) + join: hashtag in assoc(object, :hashtags), + where: hashtag.name in ^tags ) end - defp restrict_tag(query, _), do: query + defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do + restrict_hashtag_any(query, %{tag: [tag]}) + end + + defp restrict_hashtag_any(query, _), do: query + + defp raise_on_missing_preload do + raise "Can't use the child object without preloading!" + end defp restrict_recipients(query, [], _user), do: query @@ -1088,40 +1162,51 @@ def fetch_activities_query(recipients, opts \\ %{}) do skip_thread_containment: Config.get([:instance, :skip_thread_containment]) } - Activity - |> maybe_preload_objects(opts) - |> maybe_preload_bookmarks(opts) - |> maybe_preload_report_notes(opts) - |> maybe_set_thread_muted_field(opts) - |> maybe_order(opts) - |> restrict_recipients(recipients, opts[:user]) - |> restrict_replies(opts) - |> restrict_tag(opts) - |> restrict_tag_reject(opts) - |> restrict_tag_all(opts) - |> restrict_since(opts) - |> restrict_local(opts) - |> restrict_actor(opts) - |> restrict_type(opts) - |> restrict_state(opts) - |> restrict_favorited_by(opts) - |> restrict_blocked(restrict_blocked_opts) - |> restrict_muted(restrict_muted_opts) - |> restrict_filtered(opts) - |> restrict_media(opts) - |> restrict_visibility(opts) - |> restrict_thread_visibility(opts, config) - |> restrict_reblogs(opts) - |> restrict_pinned(opts) - |> restrict_muted_reblogs(restrict_muted_reblogs_opts) - |> restrict_instance(opts) - |> restrict_announce_object_actor(opts) - |> restrict_filtered(opts) - |> Activity.restrict_deactivated_users() - |> exclude_poll_votes(opts) - |> exclude_chat_messages(opts) - |> exclude_invisible_actors(opts) - |> exclude_visibility(opts) + query = + Activity + |> distinct([a], true) + |> maybe_preload_objects(opts) + |> maybe_preload_bookmarks(opts) + |> maybe_preload_report_notes(opts) + |> maybe_set_thread_muted_field(opts) + |> maybe_order(opts) + |> restrict_recipients(recipients, opts[:user]) + |> restrict_replies(opts) + |> restrict_since(opts) + |> restrict_local(opts) + |> restrict_actor(opts) + |> restrict_type(opts) + |> restrict_state(opts) + |> restrict_favorited_by(opts) + |> restrict_blocked(restrict_blocked_opts) + |> restrict_muted(restrict_muted_opts) + |> restrict_filtered(opts) + |> restrict_media(opts) + |> restrict_visibility(opts) + |> restrict_thread_visibility(opts, config) + |> restrict_reblogs(opts) + |> restrict_pinned(opts) + |> restrict_muted_reblogs(restrict_muted_reblogs_opts) + |> restrict_instance(opts) + |> restrict_announce_object_actor(opts) + |> restrict_filtered(opts) + |> Activity.restrict_deactivated_users() + |> exclude_poll_votes(opts) + |> exclude_chat_messages(opts) + |> exclude_invisible_actors(opts) + |> exclude_visibility(opts) + + if Config.get([:instance, :improved_hashtag_timeline]) do + query + |> restrict_hashtag_any(opts) + |> restrict_hashtag_all(opts) + |> restrict_hashtag_reject_any(opts) + else + query + |> restrict_tag(opts) + |> restrict_tag_reject(opts) + |> restrict_tag_all(opts) + end end def fetch_activities(recipients, opts \\ %{}, pagination \\ :keyset) do diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index bfec32042..573b26d66 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -199,33 +199,37 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_two} = CommonAPI.post(user, %{status: ". #essais"}) {:ok, status_three} = CommonAPI.post(user, %{status: ". #test #reject"}) - fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) + for new_timeline_enabled <- [true, false] do + clear_config([:instance, :improved_hashtag_timeline], new_timeline_enabled) - fetch_two = ActivityPub.fetch_activities([], %{type: "Create", tag: ["test", "essais"]}) + fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) - fetch_three = - ActivityPub.fetch_activities([], %{ - type: "Create", - tag: ["test", "essais"], - tag_reject: ["reject"] - }) + fetch_two = ActivityPub.fetch_activities([], %{type: "Create", tag: ["test", "essais"]}) - fetch_four = - ActivityPub.fetch_activities([], %{ - type: "Create", - tag: ["test"], - tag_all: ["test", "reject"] - }) + fetch_three = + ActivityPub.fetch_activities([], %{ + type: "Create", + tag: ["test", "essais"], + tag_reject: ["reject"] + }) - [fetch_one, fetch_two, fetch_three, fetch_four] = - Enum.map([fetch_one, fetch_two, fetch_three, fetch_four], fn statuses -> - Enum.map(statuses, fn s -> Repo.preload(s, object: :hashtags) end) - end) + fetch_four = + ActivityPub.fetch_activities([], %{ + type: "Create", + tag: ["test"], + tag_all: ["test", "reject"] + }) - assert fetch_one == [status_one, status_three] - assert fetch_two == [status_one, status_two, status_three] - assert fetch_three == [status_one, status_two] - assert fetch_four == [status_three] + [fetch_one, fetch_two, fetch_three, fetch_four] = + Enum.map([fetch_one, fetch_two, fetch_three, fetch_four], fn statuses -> + Enum.map(statuses, fn s -> Repo.preload(s, object: :hashtags) end) + end) + + assert fetch_one == [status_one, status_three] + assert fetch_two == [status_one, status_two, status_three] + assert fetch_three == [status_one, status_two] + assert fetch_four == [status_three] + end end describe "insertion" do -- cgit v1.2.3 From 77e39e6aae0852df13b9576a081f30da13d7ec5b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 23 Dec 2020 15:06:20 -0600 Subject: Create dir for EmojiStealPolicy automatically --- lib/pleroma/application.ex | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index bd568d858..a1655721a 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -114,6 +114,9 @@ def start(_type, _args) do set_postgres_server_version() + # Requires Config.TransferTask so ConfigDB values are loaded + steal_emoji_policy_setup() + result end @@ -300,4 +303,20 @@ def limiters_setup do [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] |> Enum.each(&ConcurrentLimiter.new(&1, 1, 0)) end + + @spec steal_emoji_policy_setup() :: :ok + def steal_emoji_policy_setup() do + with true <- + Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy in Config.get!([:mrf, :policies]) do + path = + [:instance, :static_dir] + |> Config.get!() + |> Path.join("emoji/steal") + + if !File.exists?(path), do: File.mkdir_p!(path) + else + _ -> + :ok + end + end end -- cgit v1.2.3 From 72aeb2e73b77611504e1cd524a9cb47faef6816f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 23 Dec 2020 15:16:58 -0600 Subject: Mark private --- lib/pleroma/application.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index a1655721a..e3edd05ca 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -305,7 +305,7 @@ def limiters_setup do end @spec steal_emoji_policy_setup() :: :ok - def steal_emoji_policy_setup() do + defp steal_emoji_policy_setup() do with true <- Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy in Config.get!([:mrf, :policies]) do path = -- cgit v1.2.3 From e02889edb29ca5631c346b59c299907e9f7b0161 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 23 Dec 2020 15:19:08 -0600 Subject: Add MRFs to the list of things that may need a soft reboot --- lib/pleroma/config/transfer_task.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex index a0d7b7d71..8a6d66891 100644 --- a/lib/pleroma/config/transfer_task.ex +++ b/lib/pleroma/config/transfer_task.ex @@ -28,7 +28,8 @@ defmodule Pleroma.Config.TransferTask do {:pleroma, Pleroma.Captcha, [:seconds_valid]}, {:pleroma, Pleroma.Upload, [:proxy_remote]}, {:pleroma, :instance, [:upload_limit]}, - {:pleroma, :gopher, [:enabled]} + {:pleroma, :gopher, [:enabled]}, + {:pleroma, :mrf, [:policies]} ] def start_link(restart_pleroma? \\ true) do -- cgit v1.2.3 From aafd7b44ceaf50788f12061ee88071a288155b95 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 24 Dec 2020 20:27:28 +0300 Subject: check dir existence in policy --- lib/pleroma/application.ex | 19 ------------ .../web/activity_pub/mrf/steal_emoji_policy.ex | 34 ++++++++++++++-------- 2 files changed, 22 insertions(+), 31 deletions(-) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index e3edd05ca..bd568d858 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -114,9 +114,6 @@ def start(_type, _args) do set_postgres_server_version() - # Requires Config.TransferTask so ConfigDB values are loaded - steal_emoji_policy_setup() - result end @@ -303,20 +300,4 @@ def limiters_setup do [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] |> Enum.each(&ConcurrentLimiter.new(&1, 1, 0)) end - - @spec steal_emoji_policy_setup() :: :ok - defp steal_emoji_policy_setup() do - with true <- - Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy in Config.get!([:mrf, :policies]) do - path = - [:instance, :static_dir] - |> Config.get!() - |> Path.join("emoji/steal") - - if !File.exists?(path), do: File.mkdir_p!(path) - else - _ -> - :ok - end - end end diff --git a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex index 2858af9eb..eabee6542 100644 --- a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex @@ -14,18 +14,12 @@ defp remote_host?(host), do: host != Config.get([Pleroma.Web.Endpoint, :url, :ho defp accept_host?(host), do: host in Config.get([:mrf_steal_emoji, :hosts], []) - defp steal_emoji({shortcode, url}) do + defp steal_emoji({shortcode, url}, emoji_dir_path) do url = Pleroma.Web.MediaProxy.url(url) {:ok, response} = Pleroma.HTTP.get(url) size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000) if byte_size(response.body) <= size_limit do - emoji_dir_path = - Config.get( - [:mrf_steal_emoji, :path], - Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") - ) - extension = url |> URI.parse() @@ -35,11 +29,9 @@ defp steal_emoji({shortcode, url}) do file_path = Path.join([emoji_dir_path, shortcode <> (extension || ".png")]) - try do - :ok = File.write(file_path, response.body) - + with :ok <- File.write(file_path, response.body) do shortcode - rescue + else e -> Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}") nil @@ -66,6 +58,16 @@ def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = messa if remote_host?(host) and accept_host?(host) do installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) + emoji_dir_path = + Config.get( + [:mrf_steal_emoji, :path], + Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") + ) + + if not Config.get([:mrf_steal_emoji, :dir_exists?], false) do + create_dir(emoji_dir_path) + end + new_emojis = foreign_emojis |> Enum.filter(fn {shortcode, _url} -> shortcode not in installed_emoji end) @@ -76,7 +78,7 @@ def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = messa !reject_emoji? end) - |> Enum.map(&steal_emoji(&1)) + |> Enum.map(&steal_emoji(&1, emoji_dir_path)) |> Enum.filter(& &1) if !Enum.empty?(new_emojis) do @@ -94,4 +96,12 @@ def filter(message), do: {:ok, message} def describe do {:ok, %{}} end + + defp create_dir(path) do + if not File.exists?(path) do + File.mkdir_p!(path) + end + + Config.put([:mrf_steal_emoji, :dir_exists?], true) + end end -- cgit v1.2.3 From 7bfb041658708f002e5da8f7b911b6011169dfef Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 25 Dec 2020 11:30:36 +0300 Subject: insreasing test coverage for StealEmojiPolicy --- .../web/activity_pub/mrf/steal_emoji_policy.ex | 64 ++++++------- .../activity_pub/mrf/steal_emoji_policy_test.exs | 103 ++++++++++++++------- 2 files changed, 103 insertions(+), 64 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex index eabee6542..0311ca433 100644 --- a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex @@ -10,52 +10,53 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do @moduledoc "Detect new emojis by their shortcode and steals them" @behaviour Pleroma.Web.ActivityPub.MRF - defp remote_host?(host), do: host != Config.get([Pleroma.Web.Endpoint, :url, :host]) - defp accept_host?(host), do: host in Config.get([:mrf_steal_emoji, :hosts], []) defp steal_emoji({shortcode, url}, emoji_dir_path) do url = Pleroma.Web.MediaProxy.url(url) - {:ok, response} = Pleroma.HTTP.get(url) - size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000) - if byte_size(response.body) <= size_limit do - extension = - url - |> URI.parse() - |> Map.get(:path) - |> Path.basename() - |> Path.extname() + with {:ok, %{status: status} = response} when status in 200..299 <- Pleroma.HTTP.get(url) do + size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000) + + if byte_size(response.body) <= size_limit do + extension = + url + |> URI.parse() + |> Map.get(:path) + |> Path.basename() + |> Path.extname() + + file_path = Path.join(emoji_dir_path, shortcode <> (extension || ".png")) - file_path = Path.join([emoji_dir_path, shortcode <> (extension || ".png")]) + case File.write(file_path, response.body) do + :ok -> + shortcode - with :ok <- File.write(file_path, response.body) do - shortcode + e -> + Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}") + nil + end else - e -> - Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}") - nil + Logger.debug( + "MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{ + size_limit + } B)" + ) + + nil end else - Logger.debug( - "MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{ - size_limit - } B)" - ) - - nil + e -> + Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}") + nil end - rescue - e -> - Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}") - nil end @impl true def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = message) do host = URI.parse(actor).host - if remote_host?(host) and accept_host?(host) do + if host != Pleroma.Web.Endpoint.host() and accept_host?(host) do installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) emoji_dir_path = @@ -70,10 +71,11 @@ def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = messa new_emojis = foreign_emojis - |> Enum.filter(fn {shortcode, _url} -> shortcode not in installed_emoji end) + |> Enum.reject(fn {shortcode, _url} -> shortcode in installed_emoji end) |> Enum.filter(fn {shortcode, _url} -> reject_emoji? = - Config.get([:mrf_steal_emoji, :rejected_shortcodes], []) + [:mrf_steal_emoji, :rejected_shortcodes] + |> Config.get([]) |> Enum.find(false, fn regex -> String.match?(shortcode, regex) end) !reject_emoji? diff --git a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs index 3f8222736..7665d00d0 100644 --- a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do use Pleroma.DataCase alias Pleroma.Config + alias Pleroma.Emoji alias Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy setup_all do @@ -14,22 +15,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do end setup do - emoji_path = Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") - File.rm_rf!(emoji_path) - File.mkdir!(emoji_path) + emoji_path = [:instance, :static_dir] |> Config.get() |> Path.join("emoji/stolen") - Pleroma.Emoji.reload() - - on_exit(fn -> - File.rm_rf!(emoji_path) - end) - - :ok - end - - test "does nothing by default" do - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - refute "firedfox" in installed_emoji + Emoji.reload() message = %{ "type" => "Create", @@ -39,30 +27,79 @@ test "does nothing by default" do } } - assert {:ok, message} == StealEmojiPolicy.filter(message) + on_exit(fn -> + File.rm_rf!(emoji_path) + end) - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - refute "firedfox" in installed_emoji + [message: message, path: emoji_path] end - test "Steals emoji on unknown shortcode from allowed remote host" do - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - refute "firedfox" in installed_emoji + test "does nothing by default", %{message: message} do + refute "firedfox" in installed() - message = %{ - "type" => "Create", - "object" => %{ - "emoji" => [{"firedfox", "https://example.org/emoji/firedfox.png"}], - "actor" => "https://example.org/users/admin" - } - } + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "firedfox" in installed() + end - clear_config([:mrf_steal_emoji, :hosts], ["example.org"]) - clear_config([:mrf_steal_emoji, :size_limit], 284_468) + test "Steals emoji on unknown shortcode from allowed remote host", %{ + message: message, + path: path + } do + refute "firedfox" in installed() + refute File.exists?(path) - assert {:ok, message} == StealEmojiPolicy.filter(message) + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 284_468) - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - assert "firedfox" in installed_emoji + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + assert "firedfox" in installed() + assert File.exists?(path) + + assert path + |> Path.join("firedfox.png") + |> File.exists?() + end + + test "reject shortcode", %{message: message} do + refute "firedfox" in installed() + + clear_config(:mrf_steal_emoji, + hosts: ["example.org"], + size_limit: 284_468, + rejected_shortcodes: [~r/firedfox/] + ) + + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "firedfox" in installed() + end + + test "reject if size is above the limit", %{message: message} do + refute "firedfox" in installed() + + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 50_000) + + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "firedfox" in installed() + end + + test "reject if host returns error", %{message: message} do + refute "firedfox" in installed() + + Tesla.Mock.mock(fn %{method: :get, url: "https://example.org/emoji/firedfox.png"} -> + {:ok, %Tesla.Env{status: 404, body: "Not found"}} + end) + + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 284_468) + + ExUnit.CaptureLog.capture_log(fn -> + assert {:ok, _message} = StealEmojiPolicy.filter(message) + end) =~ "MRF.StealEmojiPolicy: Failed to fetch https://example.org/emoji/firedfox.png" + + refute "firedfox" in installed() end + + defp installed, do: Emoji.get_all() |> Enum.map(fn {k, _} -> k end) end -- cgit v1.2.3 From dad76703aaf750e3811b0c963a92e39aa06b9c76 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 25 Dec 2020 11:34:09 +0300 Subject: not needed --- lib/pleroma/config/transfer_task.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex index 8a6d66891..a0d7b7d71 100644 --- a/lib/pleroma/config/transfer_task.ex +++ b/lib/pleroma/config/transfer_task.ex @@ -28,8 +28,7 @@ defmodule Pleroma.Config.TransferTask do {:pleroma, Pleroma.Captcha, [:seconds_valid]}, {:pleroma, Pleroma.Upload, [:proxy_remote]}, {:pleroma, :instance, [:upload_limit]}, - {:pleroma, :gopher, [:enabled]}, - {:pleroma, :mrf, [:policies]} + {:pleroma, :gopher, [:enabled]} ] def start_link(restart_pleroma? \\ true) do -- cgit v1.2.3 From 546da68a1186ba4f8f901f9da1f1f6065cd9846a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 25 Dec 2020 11:53:01 +0300 Subject: changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1604ab3a..716fbb75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix ability to update Pleroma Chat push notifications with PUT /api/v1/push/subscription and alert type pleroma:chat_mention - Emoji Reaction activity filtering from blocked and muted accounts. +- StealEmojiPolicy creates dir for emojis, if it doesn't exist. ## [2.2.1] - 2020-12-22 -- cgit v1.2.3 From 2e859794ee25bdf22216587f8c8260e47b2a038f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 27 Dec 2020 21:58:15 +0300 Subject: non condition dir creation --- lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex index 0311ca433..788f21261 100644 --- a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex @@ -65,9 +65,7 @@ def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = messa Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") ) - if not Config.get([:mrf_steal_emoji, :dir_exists?], false) do - create_dir(emoji_dir_path) - end + File.mkdir_p(emoji_dir_path) new_emojis = foreign_emojis @@ -98,12 +96,4 @@ def filter(message), do: {:ok, message} def describe do {:ok, %{}} end - - defp create_dir(path) do - if not File.exists?(path) do - File.mkdir_p!(path) - end - - Config.put([:mrf_steal_emoji, :dir_exists?], true) - end end -- cgit v1.2.3 From 14fae94c0e4b04123c7af148260d0a4a51042570 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 28 Dec 2020 00:08:09 +0300 Subject: [#3213] Made Object.hashtags/1 work with :hashtags assoc. Adjusted tests. --- lib/pleroma/config.ex | 2 ++ lib/pleroma/object.ex | 14 +++++++++++++- lib/pleroma/web/activity_pub/activity_pub.ex | 12 ++++++------ test/pleroma/activity/ir/topics_test.exs | 15 ++++++++------- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index 86d4f6b72..ee0167f4e 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -96,6 +96,8 @@ def restrict_unauthenticated_access?(resource, kind) do end end + def object_embedded_hashtags?, do: !get([:instance, :improved_hashtag_timeline]) + def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], []) def oauth_consumer_enabled?, do: oauth_consumer_strategies() != [] diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 1d756bcd1..08114d4f2 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -384,7 +384,19 @@ def tags(%Object{data: %{"tag" => tags}}) when is_list(tags), do: tags def tags(_), do: [] - def hashtags(object), do: embedded_hashtags(object) + def hashtags(%Object{} = object) do + cond do + Config.object_embedded_hashtags?() -> + embedded_hashtags(object) + + object.id == "pleroma:fake_object_id" -> + [] + + true -> + hashtag_records = Repo.preload(object, :hashtags).hashtags + Enum.map(hashtag_records, & &1.name) + end + end defp embedded_hashtags(%Object{data: data}) do object_data_hashtags(data) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 54d1a2350..626cad336 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1199,16 +1199,16 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> exclude_invisible_actors(opts) |> exclude_visibility(opts) - if Config.get([:instance, :improved_hashtag_timeline]) do - query - |> restrict_hashtag_any(opts) - |> restrict_hashtag_all(opts) - |> restrict_hashtag_reject_any(opts) - else + if Config.object_embedded_hashtags?() do query |> restrict_tag(opts) |> restrict_tag_reject(opts) |> restrict_tag_all(opts) + else + query + |> restrict_hashtag_any(opts) + |> restrict_hashtag_all(opts) + |> restrict_hashtag_reject_any(opts) end end diff --git a/test/pleroma/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs index b464822d9..984777bda 100644 --- a/test/pleroma/activity/ir/topics_test.exs +++ b/test/pleroma/activity/ir/topics_test.exs @@ -11,6 +11,8 @@ defmodule Pleroma.Activity.Ir.TopicsTest do require Pleroma.Constants + import Mock + describe "poll answer" do test "produce no topics" do activity = %Activity{object: %Object{data: %{"type" => "Answer"}}} @@ -77,14 +79,13 @@ test "with no attachments doesn't produce public:media topics", %{activity: acti refute Enum.member?(topics, "public:local:media") end - test "converts tags to hash tags", %{activity: %{object: %{data: data} = object} = activity} do - tagged_data = Map.put(data, "tag", ["foo", "bar"]) - activity = %{activity | object: %{object | data: tagged_data}} - - topics = Topics.get_activity_topics(activity) + test "converts tags to hash tags", %{activity: activity} do + with_mock(Object, [:passthrough], hashtags: fn _ -> ["foo", "bar"] end) do + topics = Topics.get_activity_topics(activity) - assert Enum.member?(topics, "hashtag:foo") - assert Enum.member?(topics, "hashtag:bar") + assert Enum.member?(topics, "hashtag:foo") + assert Enum.member?(topics, "hashtag:bar") + end end test "only converts strings to hash tags", %{ -- cgit v1.2.3 From a25c1e8ec0b6f4ef2e9f68c4ad5e48e18f5f01a7 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 30 Dec 2020 14:35:19 +0300 Subject: [#3213] Improved `database.transfer_hashtags` mix task: proper rollback, speedup. --- lib/mix/tasks/pleroma/database.ex | 46 +++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 093c7dd30..d44bd3478 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -137,6 +137,8 @@ def run(["transfer_hashtags"]) do start_pleroma() + Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") + from( object in Object, left_join: hashtag in assoc(object, :hashtags), @@ -144,21 +146,12 @@ def run(["transfer_hashtags"]) do where: fragment("(?)->>'tag' != '[]'", object.data), select: %{ id: object.id, - inserted_at: object.inserted_at, tag: fragment("(?)->>'tag'", object.data) - }, - order_by: [desc: object.id] + } ) |> Pleroma.Repo.chunk_stream(100, :batches) |> Stream.each(fn objects -> - chunk_start = List.first(objects) - chunk_end = List.last(objects) - - Logger.info( - "transfer_hashtags: " <> - "#{chunk_start.id} (#{chunk_start.inserted_at}) -- " <> - "#{chunk_end.id} (#{chunk_end.inserted_at})" - ) + Logger.info("Processing #{length(objects)} objects...") Enum.map( objects, @@ -168,28 +161,39 @@ def run(["transfer_hashtags"]) do |> Jason.decode!() |> Enum.filter(&is_bitstring(&1)) - with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do - Repo.transaction(fn -> + Repo.transaction(fn -> + with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do for hashtag_record <- hashtag_records do - with {:error, _} <- + with {:ok, _} <- Ecto.Adapters.SQL.query( Repo, "insert into hashtags_objects(hashtag_id, object_id) values " <> "(#{hashtag_record.id}, #{object.id});" ) do - Logger.warn( - "ERROR: could not link object #{object.id} and hashtag #{hashtag_record.id}" - ) + :noop + else + {:error, e} -> + error = + "ERROR: could not link object #{object.id} and hashtag " <> + "#{hashtag_record.id}: #{inspect(e)}" + + Logger.error(error) + Repo.rollback(error) end end - end) - else - e -> Logger.warn("ERROR: could not process object #{object.id}: #{inspect(e)}") - end + else + e -> + error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" + Logger.error(error) + Repo.rollback(error) + end + end) end ) end) |> Stream.run() + + Logger.info("Done transferring hashtags. Please check logs to ensure no errors.") end def run(["vacuum", args]) do -- cgit v1.2.3 From e0b5edb6d5a423bfd247e0774d2f5bc642b2fb80 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 30 Dec 2020 14:42:35 +0300 Subject: [#3213] Fixed Object.object_data_hashtags/1 to process only AS2 elements of `data.tag` (basing on #2984). --- lib/pleroma/object.ex | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 08114d4f2..dad572f2b 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -405,8 +405,16 @@ defp embedded_hashtags(%Object{data: data}) do defp embedded_hashtags(_), do: [] defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do - # Note: AS2 map-type elements are ignored - Enum.filter(tags, &is_bitstring(&1)) + # Note: Old format with copy of hashtags as strings is ignored, using AS2 + tags + |> Enum.filter(fn + %{"type" => "Hashtag"} = data -> Map.has_key?(data, "name") + _ -> false + end) + |> Enum.map(fn + %{"name" => "#" <> hashtag} -> String.downcase(hashtag) + %{"name" => hashtag} -> String.downcase(hashtag) + end) end defp object_data_hashtags(_), do: [] -- cgit v1.2.3 From 8d1a0c1afd46f8683e9022523cecffb9b60c9f8c Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 30 Dec 2020 15:22:49 +0300 Subject: [#3213] Made Object.object_data_hashtags/1 handle both AS2 and plain text hashtags. --- lib/pleroma/object.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index dad572f2b..7e79e15ee 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -405,16 +405,18 @@ defp embedded_hashtags(%Object{data: data}) do defp embedded_hashtags(_), do: [] defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do - # Note: Old format with copy of hashtags as strings is ignored, using AS2 tags |> Enum.filter(fn %{"type" => "Hashtag"} = data -> Map.has_key?(data, "name") + plain_text when is_bitstring(plain_text) -> true _ -> false end) |> Enum.map(fn %{"name" => "#" <> hashtag} -> String.downcase(hashtag) %{"name" => hashtag} -> String.downcase(hashtag) + hashtag when is_bitstring(hashtag) -> String.downcase(hashtag) end) + |> Enum.uniq() end defp object_data_hashtags(_), do: [] -- cgit v1.2.3 From 367f0c31c3c15f75aed1d3ba66914e4197c19596 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 31 Dec 2020 09:36:26 +0300 Subject: [#3213] Added query options support for Repo.chunk_stream/4. Used infinite timeout in transfer_hashtags select query. --- lib/mix/tasks/pleroma/database.ex | 11 +++++------ lib/pleroma/repo.ex | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index d44bd3478..f903cf75b 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -149,9 +149,9 @@ def run(["transfer_hashtags"]) do tag: fragment("(?)->>'tag'", object.data) } ) - |> Pleroma.Repo.chunk_stream(100, :batches) + |> Repo.chunk_stream(100, :batches, timeout: :infinity) |> Stream.each(fn objects -> - Logger.info("Processing #{length(objects)} objects...") + Logger.info("Processing #{length(objects)} objects starting from id #{hd(objects).id}...") Enum.map( objects, @@ -165,10 +165,9 @@ def run(["transfer_hashtags"]) do with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do for hashtag_record <- hashtag_records do with {:ok, _} <- - Ecto.Adapters.SQL.query( - Repo, - "insert into hashtags_objects(hashtag_id, object_id) values " <> - "(#{hashtag_record.id}, #{object.id});" + Repo.query( + "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", + [hashtag_record.id, object.id] ) do :noop else diff --git a/lib/pleroma/repo.ex b/lib/pleroma/repo.ex index 4524bd5e2..78711e6ac 100644 --- a/lib/pleroma/repo.ex +++ b/lib/pleroma/repo.ex @@ -63,8 +63,8 @@ def get_assoc(resource, association) do iex> Pleroma.Repo.chunk_stream(Pleroma.Activity.Queries.by_actor(ap_id), 500, :batches) """ @spec chunk_stream(Ecto.Query.t(), integer(), atom()) :: Enumerable.t() - def chunk_stream(query, chunk_size, returns_as \\ :one) do - # We don't actually need start and end funcitons of resource streaming, + def chunk_stream(query, chunk_size, returns_as \\ :one, query_options \\ []) do + # We don't actually need start and end functions of resource streaming, # but it seems to be the only way to not fetch records one-by-one and # have individual records be the elements of the stream, instead of # lists of records @@ -76,7 +76,7 @@ def chunk_stream(query, chunk_size, returns_as \\ :one) do |> order_by(asc: :id) |> where([r], r.id > ^last_id) |> limit(^chunk_size) - |> all() + |> all(query_options) |> case do [] -> {:halt, last_id} -- cgit v1.2.3 From 303055456f19152821ec5ec1df88d60c03f60905 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 31 Dec 2020 12:45:23 +0300 Subject: Alternative implementation of hashtag-filtering queries in ActivityPub. Fixed GROUP BY clause for aggregation on hashtags. --- lib/pleroma/activity.ex | 2 + lib/pleroma/web/activity_pub/activity_pub.ex | 120 ++++++++++++++++++++++----- 2 files changed, 100 insertions(+), 22 deletions(-) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index 9d970a808..df216e4de 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -113,6 +113,7 @@ def with_preloaded_bookmark(query, %User{} = user) do from([a] in query, left_join: b in Bookmark, on: b.user_id == ^user.id and b.activity_id == a.id, + as: :bookmark, preload: [bookmark: b] ) end @@ -123,6 +124,7 @@ def with_preloaded_report_notes(query) do from([a] in query, left_join: r in ReportNote, on: a.id == r.activity_id, + as: :report_note, preload: [report_notes: r] ) end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 626cad336..339843330 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -713,22 +713,92 @@ defp restrict_tag(query, %{tag: tag}) when is_binary(tag) do defp restrict_tag(query, _), do: query + defp restrict_hashtag(query, opts) do + [tag_any, tag_all, tag_reject] = + [:tag, :tag_all, :tag_reject] + |> Enum.map(&opts[&1]) + |> Enum.map(&List.wrap(&1)) + + has_conditions = Enum.any?([tag_any, tag_all, tag_reject], &Enum.any?(&1)) + + cond do + !has_conditions -> + query + + opts[:skip_preload] -> + raise_on_missing_preload() + + true -> + query + |> group_by_all_bindings() + |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) + |> maybe_restrict_hashtag_any(tag_any) + |> maybe_restrict_hashtag_all(tag_all) + |> maybe_restrict_hashtag_reject_any(tag_reject) + end + end + + # Groups by all bindings to allow aggregation on hashtags + defp group_by_all_bindings(query) do + # Expecting named bindings: :object, :bookmark, :thread_mute, :report_note + cond do + Enum.count(query.aliases) == 4 -> + from([a, o, b3, b4, b5] in query, group_by: [a.id, o.id, b3.id, b4.id, b5.id]) + + Enum.count(query.aliases) == 3 -> + from([a, o, b3, b4] in query, group_by: [a.id, o.id, b3.id, b4.id]) + + Enum.count(query.aliases) == 2 -> + from([a, o, b3] in query, group_by: [a.id, o.id, b3.id]) + + true -> + from([a, o] in query, group_by: [a.id, o.id]) + end + end + + defp maybe_restrict_hashtag_any(query, []) do + query + end + + defp maybe_restrict_hashtag_any(query, tags) do + having( + query, + [hashtag: hashtag], + fragment("array_agg(?) && (?)", hashtag.name, ^tags) + ) + end + + defp maybe_restrict_hashtag_all(query, []) do + query + end + + defp maybe_restrict_hashtag_all(query, tags) do + having( + query, + [hashtag: hashtag], + fragment("array_agg(?) @> (?)", hashtag.name, ^tags) + ) + end + + defp maybe_restrict_hashtag_reject_any(query, []) do + query + end + + defp maybe_restrict_hashtag_reject_any(query, tags) do + having( + query, + [hashtag: hashtag], + fragment("not(array_agg(?) && (?))", hashtag.name, ^tags) + ) + end + defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do raise_on_missing_preload() end defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do - if has_named_binding?(query, :thread_mute) do - from( - [activity, object, thread_mute] in query, - group_by: [activity.id, object.id, thread_mute.id] - ) - else - from( - [activity, object] in query, - group_by: [activity.id, object.id] - ) - end + query + |> group_by_all_bindings() |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) |> having( [hashtag: hashtag], @@ -1167,7 +1237,6 @@ def fetch_activities_query(recipients, opts \\ %{}) do query = Activity - |> distinct([a], true) |> maybe_preload_objects(opts) |> maybe_preload_bookmarks(opts) |> maybe_preload_report_notes(opts) @@ -1199,16 +1268,23 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> exclude_invisible_actors(opts) |> exclude_visibility(opts) - if Config.object_embedded_hashtags?() do - query - |> restrict_tag(opts) - |> restrict_tag_reject(opts) - |> restrict_tag_all(opts) - else - query - |> restrict_hashtag_any(opts) - |> restrict_hashtag_all(opts) - |> restrict_hashtag_reject_any(opts) + cond do + Config.object_embedded_hashtags?() -> + query + |> restrict_tag(opts) + |> restrict_tag_reject(opts) + |> restrict_tag_all(opts) + + # TODO: benchmark (initial approach preferring non-aggregate ops when possible) + Config.get([:instance, :improved_hashtag_timeline]) == :join -> + query + |> distinct([activity], true) + |> restrict_hashtag_any(opts) + |> restrict_hashtag_all(opts) + |> restrict_hashtag_reject_any(opts) + + true -> + restrict_hashtag(query, opts) end end -- cgit v1.2.3 From 64f0e96ff692521a8db70fd92196a3e0870f1ddc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 31 Dec 2020 12:13:08 -0600 Subject: Automatically confirm logged-in users --- lib/pleroma/web/endpoint.ex | 2 ++ lib/pleroma/web/plugs/confirm_user_plug.ex | 30 +++++++++++++++++++++++ test/pleroma/web/plugs/confirm_user_plug_test.exs | 30 +++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 lib/pleroma/web/plugs/confirm_user_plug.ex create mode 100644 test/pleroma/web/plugs/confirm_user_plug_test.exs diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index f26542e88..705035845 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -169,6 +169,8 @@ def call(conn, opts) do plug(MetricsExporterCaller) + plug(Pleroma.Web.Plugs.ConfirmUserPlug) + plug(Pleroma.Web.Router) @doc """ diff --git a/lib/pleroma/web/plugs/confirm_user_plug.ex b/lib/pleroma/web/plugs/confirm_user_plug.ex new file mode 100644 index 000000000..218068de0 --- /dev/null +++ b/lib/pleroma/web/plugs/confirm_user_plug.ex @@ -0,0 +1,30 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Plugs.ConfirmUserPlug do + @moduledoc """ + If a user has ever been granted an OAuth token, they are eligible to become + confirmed, regardless of the account_activation_required setting. This plug + will confirm a user if found. + """ + + alias Pleroma.User + import Plug.Conn + + def init(opts), do: opts + + def call(%{assigns: %{user: %User{confirmation_pending: true} = user}} = conn, _opts) do + with {:ok, user} <- confirm_user(user) do + assign(conn, :user, user) + end + end + + def call(conn, _opts), do: conn + + defp confirm_user(%User{} = user) do + user + |> User.confirmation_changeset(need_confirmation: false) + |> User.update_and_set_cache() + end +end diff --git a/test/pleroma/web/plugs/confirm_user_plug_test.exs b/test/pleroma/web/plugs/confirm_user_plug_test.exs new file mode 100644 index 000000000..43c1c28a9 --- /dev/null +++ b/test/pleroma/web/plugs/confirm_user_plug_test.exs @@ -0,0 +1,30 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Plugs.ConfirmUserPlugTest do + use Pleroma.Web.ConnCase, async: true + alias Pleroma.User + alias Pleroma.Web.Plugs.ConfirmUserPlug + import Pleroma.Factory + + test "it confirms an unconfirmed user", %{conn: conn} do + %User{id: user_id} = user = insert(:user, confirmation_pending: true) + + conn = + conn + |> assign(:user, user) + |> ConfirmUserPlug.call(%{}) + + assert %Plug.Conn{assigns: %{user: %User{id: ^user_id, confirmation_pending: false}}} = conn + assert %User{confirmation_pending: false} = User.get_by_id(user_id) + end + + test "it does nothing without an unconfirmed user", %{conn: conn} do + assert conn == ConfirmUserPlug.call(conn, %{}) + + user = insert(:user, confirmation_pending: false) + conn = assign(conn, :user, user) + assert conn == ConfirmUserPlug.call(conn, %{}) + end +end -- cgit v1.2.3 From 7b44605cb89943a905f6a0a7aab9ebeea58aa7ab Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 31 Dec 2020 14:04:51 -0600 Subject: Migration to confirm previously-logged-in users --- .../20201231185546_confirm_logged_in_users.exs | 22 ++++++++++++ .../migrations/confirm_logged_in_users_test.exs | 40 ++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 priv/repo/migrations/20201231185546_confirm_logged_in_users.exs create mode 100644 test/pleroma/repo/migrations/confirm_logged_in_users_test.exs diff --git a/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs b/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs new file mode 100644 index 000000000..de2f35169 --- /dev/null +++ b/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs @@ -0,0 +1,22 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do + use Ecto.Migration + import Ecto.Query + alias Pleroma.Repo + alias Pleroma.User + alias Pleroma.Web.OAuth.Token + + def up do + User + |> where([u], u.confirmation_pending == true) + |> join(:inner, [u], t in Token, on: t.user_id == u.id) + |> Repo.update_all(set: [confirmation_pending: false]) + end + + def down do + :noop + end +end diff --git a/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs b/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs new file mode 100644 index 000000000..f1fd89113 --- /dev/null +++ b/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs @@ -0,0 +1,40 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do + alias Pleroma.Repo + alias Pleroma.User + use Pleroma.DataCase, async: true + import Ecto.Query + import Pleroma.Factory + import Pleroma.Tests.Helpers + + setup_all do: require_migration("20201231185546_confirm_logged_in_users") + + test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do + insert_list(25, :oauth_token) + Repo.update_all(User, set: [confirmation_pending: true]) + insert_list(5, :user, confirmation_pending: true) + + count = + User + |> where(confirmation_pending: true) + |> Repo.aggregate(:count) + + assert count == 30 + + assert {25, nil} == migration.up() + + count = + User + |> where(confirmation_pending: true) + |> Repo.aggregate(:count) + + assert count == 5 + end + + test "down/0 does nothing", %{migration: migration} do + assert :noop == migration.down() + end +end -- cgit v1.2.3 From e1e7e4d379a67779a799049728d143eee2b88a7e Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 4 Jan 2021 13:38:31 +0100 Subject: Object: Rework how Object.normalize works Now it defaults to not fetching, and the option is named. --- lib/pleroma/activity.ex | 2 +- lib/pleroma/activity/ir/topics.ex | 2 +- lib/pleroma/conversation.ex | 3 +- lib/pleroma/emails/user_email.ex | 4 +-- lib/pleroma/gopher/server.ex | 2 +- lib/pleroma/html.ex | 2 +- lib/pleroma/notification.ex | 4 +-- lib/pleroma/object.ex | 33 +++++++++-------- lib/pleroma/object/fetcher.ex | 4 +-- .../web/activity_pub/activity_pub_controller.ex | 6 ++-- lib/pleroma/web/activity_pub/builder.ex | 2 +- .../web/activity_pub/mrf/ensure_re_prepended.ex | 2 +- lib/pleroma/web/activity_pub/object_validator.ex | 2 +- lib/pleroma/web/activity_pub/publisher.ex | 2 +- lib/pleroma/web/activity_pub/side_effects.ex | 2 +- lib/pleroma/web/activity_pub/transmogrifier.ex | 10 +++--- lib/pleroma/web/activity_pub/views/object_view.ex | 4 +-- lib/pleroma/web/common_api.ex | 12 +++---- lib/pleroma/web/common_api/utils.ex | 4 +-- lib/pleroma/web/embed_controller.ex | 2 +- lib/pleroma/web/feed/feed_view.ex | 2 +- .../mastodon_api/controllers/status_controller.ex | 4 +-- .../web/mastodon_api/views/notification_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/status_view.ex | 16 ++++----- lib/pleroma/web/o_status/o_status_controller.ex | 6 ++-- .../web/pleroma_api/controllers/chat_controller.ex | 2 +- .../controllers/emoji_reaction_controller.ex | 2 +- lib/pleroma/web/pleroma_api/views/scrobble_view.ex | 2 +- lib/pleroma/web/push/impl.ex | 2 +- lib/pleroma/web/rich_media/helpers.ex | 2 +- lib/pleroma/web/static_fe/static_fe_controller.ex | 2 +- lib/pleroma/web/streamer.ex | 2 +- test/mix/tasks/pleroma/user_test.exs | 4 +-- test/pleroma/activity_test.exs | 4 +-- test/pleroma/bbs/handler_test.exs | 6 ++-- test/pleroma/conversation/participation_test.exs | 4 +-- test/pleroma/conversation_test.exs | 8 ++--- test/pleroma/html_test.exs | 12 +++---- test/pleroma/object_test.exs | 41 ++++++++++++++-------- test/pleroma/user/welcome_chat_message_test.exs | 6 ++-- test/pleroma/user/welcome_message_test.exs | 4 ++- test/pleroma/user_test.exs | 6 ++-- .../activity_pub/activity_pub_controller_test.exs | 28 +++++++-------- .../pleroma/web/activity_pub/activity_pub_test.exs | 6 ++-- .../object_validators/announce_validation_test.exs | 4 +-- .../object_validators/chat_validation_test.exs | 2 +- test/pleroma/web/activity_pub/publisher_test.exs | 2 +- .../pleroma/web/activity_pub/side_effects_test.exs | 6 ++-- .../transmogrifier/announce_handling_test.exs | 4 +-- .../transmogrifier/answer_handling_test.exs | 6 ++-- .../transmogrifier/article_handling_test.exs | 4 +-- .../transmogrifier/audio_handling_test.exs | 4 +-- .../transmogrifier/delete_handling_test.exs | 4 +-- .../transmogrifier/note_handling_test.exs | 24 ++++++------- .../transmogrifier/question_handling_test.exs | 8 ++--- .../transmogrifier/video_handling_test.exs | 6 ++-- .../web/activity_pub/transmogrifier_test.exs | 2 +- test/pleroma/web/activity_pub/utils_test.exs | 14 ++++---- .../web/activity_pub/views/object_view_test.exs | 6 ++-- .../admin_api/controllers/chat_controller_test.exs | 6 ++-- test/pleroma/web/common_api_test.exs | 24 ++++++------- test/pleroma/web/feed/tag_controller_test.exs | 8 ++--- test/pleroma/web/feed/user_controller_test.exs | 2 +- .../controllers/poll_controller_test.exs | 14 ++++---- .../controllers/search_controller_test.exs | 2 +- .../controllers/status_controller_test.exs | 6 ++-- .../mastodon_api/views/notification_view_test.exs | 2 +- .../web/mastodon_api/views/poll_view_test.exs | 12 +++---- .../web/mastodon_api/views/status_view_test.exs | 6 ++-- .../web/o_status/o_status_controller_test.exs | 12 +++---- .../controllers/chat_controller_test.exs | 8 ++--- .../views/chat_message_reference_view_test.exs | 4 +-- .../web/pleroma_api/views/chat_view_test.exs | 2 +- test/pleroma/web/push/impl_test.exs | 26 +++++++------- test/pleroma/web/streamer_test.exs | 4 +-- .../workers/scheduled_activity_worker_test.exs | 2 +- test/support/factory.ex | 2 +- 77 files changed, 269 insertions(+), 246 deletions(-) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index 9d970a808..62fa9cca3 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -274,7 +274,7 @@ defp get_in_reply_to_activity_from_object(%Object{data: %{"inReplyTo" => ap_id}} defp get_in_reply_to_activity_from_object(_), do: nil def get_in_reply_to_activity(%Activity{} = activity) do - get_in_reply_to_activity_from_object(Object.normalize(activity)) + get_in_reply_to_activity_from_object(Object.normalize(activity, fetch: false)) end def normalize(obj) when is_map(obj), do: get_by_ap_id_with_object(obj["id"]) diff --git a/lib/pleroma/activity/ir/topics.ex b/lib/pleroma/activity/ir/topics.ex index fe2e8cb5c..6a26d7fdd 100644 --- a/lib/pleroma/activity/ir/topics.ex +++ b/lib/pleroma/activity/ir/topics.ex @@ -8,7 +8,7 @@ defmodule Pleroma.Activity.Ir.Topics do def get_activity_topics(activity) do activity - |> Object.normalize() + |> Object.normalize(fetch: false) |> generate_topics(activity) |> List.flatten() end diff --git a/lib/pleroma/conversation.ex b/lib/pleroma/conversation.ex index 77933f0be..e15259091 100644 --- a/lib/pleroma/conversation.ex +++ b/lib/pleroma/conversation.ex @@ -5,6 +5,7 @@ defmodule Pleroma.Conversation do alias Pleroma.Conversation.Participation alias Pleroma.Conversation.Participation.RecipientShip + alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User use Ecto.Schema @@ -58,7 +59,7 @@ def maybe_create_recipientships(participation, activity) do def create_or_bump_for(activity, opts \\ []) do with true <- Pleroma.Web.ActivityPub.Visibility.is_direct?(activity), "Create" <- activity.data["type"], - object <- Pleroma.Object.normalize(activity), + %Object{} = object <- Object.normalize(activity, fetch: false), true <- object.data["type"] in ["Note", "Question"], ap_id when is_binary(ap_id) and byte_size(ap_id) > 0 <- object.data["context"] do {:ok, conversation} = create_for_ap_id(ap_id) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index d3625dbf2..2b51d5b05 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -119,7 +119,7 @@ def digest_email(user) do notifications |> Enum.filter(&(&1.activity.data["type"] == "Create")) |> Enum.map(fn notification -> - object = Pleroma.Object.normalize(notification.activity) + object = Pleroma.Object.normalize(notification.activity, fetch: false) if not is_nil(object) do object = update_in(object.data["content"], &format_links/1) @@ -142,7 +142,7 @@ def digest_email(user) do if not is_nil(from) do %{ data: notification, - object: Pleroma.Object.normalize(notification.activity), + object: Pleroma.Object.normalize(notification.activity, fetch: false), from: User.get_by_ap_id(notification.activity.actor) } end diff --git a/lib/pleroma/gopher/server.ex b/lib/pleroma/gopher/server.ex index e9f54c4c0..8ac8d18c1 100644 --- a/lib/pleroma/gopher/server.ex +++ b/lib/pleroma/gopher/server.ex @@ -76,7 +76,7 @@ def render_activities(activities) do |> Enum.map(fn activity -> user = User.get_cached_by_ap_id(activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) like_count = object.data["like_count"] || 0 announcement_count = object.data["announcement_count"] || 0 diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index c848c782c..c5ece7350 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -59,7 +59,7 @@ def get_cached_scrubbed_html_for_activity( key = "#{key}#{generate_scrubber_signature(scrubbers)}|#{activity.id}" @cachex.fetch!(:scrubber_cache, key, fn _key -> - object = Pleroma.Object.normalize(activity) + object = Pleroma.Object.normalize(activity, fetch: false) ensure_scrubbed_html(content, scrubbers, object.data["fake"] || false, callback) end) end diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index dd7a1c824..4efea9f7d 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -358,7 +358,7 @@ def dismiss(%{id: user_id} = _user, id) do def create_notifications(activity, options \\ []) def create_notifications(%Activity{data: %{"to" => _, "type" => "Create"}} = activity, options) do - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) if object && object.data["type"] == "Answer" do {:ok, []} @@ -625,7 +625,7 @@ def skip?(:recently_followed, %Activity{data: %{"type" => "Follow"}} = activity, def skip?(:filtered, %{data: %{"type" => type}}, _) when type in ["Follow", "Move"], do: false def skip?(:filtered, activity, user) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) cond do is_nil(object) -> diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index b4a994da9..4fb4ec364 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -108,39 +108,42 @@ defp warn_on_no_object_preloaded(ap_id) do Logger.debug("Backtrace: #{inspect(Process.info(:erlang.self(), :current_stacktrace))}") end - def normalize(_, fetch_remote \\ true, options \\ []) + def normalize(_, options \\ [fetch: false]) # If we pass an Activity to Object.normalize(), we can try to use the preloaded object. # Use this whenever possible, especially when walking graphs in an O(N) loop! - def normalize(%Object{} = object, _, _), do: object - def normalize(%Activity{object: %Object{} = object}, _, _), do: object + def normalize(%Object{} = object, _), do: object + def normalize(%Activity{object: %Object{} = object}, _), do: object # A hack for fake activities - def normalize(%Activity{data: %{"object" => %{"fake" => true} = data}}, _, _) do + def normalize(%Activity{data: %{"object" => %{"fake" => true} = data}}, _) do %Object{id: "pleroma:fake_object_id", data: data} end # No preloaded object - def normalize(%Activity{data: %{"object" => %{"id" => ap_id}}}, fetch_remote, _) do + def normalize(%Activity{data: %{"object" => %{"id" => ap_id}}}, options) do warn_on_no_object_preloaded(ap_id) - normalize(ap_id, fetch_remote) + normalize(ap_id, options) end # No preloaded object - def normalize(%Activity{data: %{"object" => ap_id}}, fetch_remote, _) do + def normalize(%Activity{data: %{"object" => ap_id}}, options) do warn_on_no_object_preloaded(ap_id) - normalize(ap_id, fetch_remote) + normalize(ap_id, options) end # Old way, try fetching the object through cache. - def normalize(%{"id" => ap_id}, fetch_remote, _), do: normalize(ap_id, fetch_remote) - def normalize(ap_id, false, _) when is_binary(ap_id), do: get_cached_by_ap_id(ap_id) + def normalize(%{"id" => ap_id}, options), do: normalize(ap_id, options) - def normalize(ap_id, true, options) when is_binary(ap_id) do - Fetcher.fetch_object_from_id!(ap_id, options) + def normalize(ap_id, options) when is_binary(ap_id) do + if Keyword.get(options, :fetch) do + Fetcher.fetch_object_from_id!(ap_id, options) + else + get_cached_by_ap_id(ap_id) + end end - def normalize(_, _, _), do: nil + def normalize(_, _), do: nil # Owned objects can only be accessed by their owner def authorize_access(%Object{data: %{"actor" => actor}}, %User{ap_id: ap_id}) do @@ -285,7 +288,7 @@ def decrease_replies_count(ap_id) do end def increase_vote_count(ap_id, name, actor) do - with %Object{} = object <- Object.normalize(ap_id), + with %Object{} = object <- Object.normalize(ap_id, fetch: false), "Question" <- object.data["type"] do key = if poll_is_multiple?(object), do: "anyOf", else: "oneOf" @@ -326,7 +329,7 @@ def local?(%Object{data: %{"id" => id}}) do end def replies(object, opts \\ []) do - object = Object.normalize(object) + object = Object.normalize(object, fetch: false) query = Object diff --git a/lib/pleroma/object/fetcher.ex b/lib/pleroma/object/fetcher.ex index 20d8f687d..18c383881 100644 --- a/lib/pleroma/object/fetcher.ex +++ b/lib/pleroma/object/fetcher.ex @@ -83,13 +83,13 @@ def fetch_object_from_id(id, options \\ []) do with {_, nil} <- {:fetch_object, Object.get_cached_by_ap_id(id)}, {_, true} <- {:allowed_depth, Federator.allowed_thread_distance?(options[:depth])}, {_, {:ok, data}} <- {:fetch, fetch_and_contain_remote_object_from_id(id)}, - {_, nil} <- {:normalize, Object.normalize(data, false)}, + {_, nil} <- {:normalize, Object.normalize(data, fetch: false)}, params <- prepare_activity_params(data), {_, :ok} <- {:containment, Containment.contain_origin(id, params)}, {_, {:ok, activity}} <- {:transmogrifier, Transmogrifier.handle_incoming(params, options)}, {_, _data, %Object{} = object} <- - {:object, data, Object.normalize(activity, false)} do + {:object, data, Object.normalize(activity, fetch: false)} do {:ok, object} else {:allowed_depth, false} -> diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 7e5647f8f..8d9b69cc7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -128,7 +128,7 @@ def activity(conn, _params) do end defp maybe_set_tracking_data(conn, %Activity{data: %{"type" => "Create"}} = activity) do - object_id = Object.normalize(activity).id + object_id = Object.normalize(activity, fetch: false).id assign(conn, :tracking_fun_data, object_id) end @@ -434,7 +434,7 @@ defp handle_user_activity( end defp handle_user_activity(%User{} = user, %{"type" => "Delete"} = params) do - with %Object{} = object <- Object.normalize(params["object"]), + with %Object{} = object <- Object.normalize(params["object"], fetch: false), true <- user.is_moderator || user.ap_id == object.data["actor"], {:ok, delete_data, _} <- Builder.delete(user, object.data["id"]), {:ok, delete, _} <- Pipeline.common_pipeline(delete_data, local: true) do @@ -445,7 +445,7 @@ defp handle_user_activity(%User{} = user, %{"type" => "Delete"} = params) do end defp handle_user_activity(%User{} = user, %{"type" => "Like"} = params) do - with %Object{} = object <- Object.normalize(params["object"]), + with %Object{} = object <- Object.normalize(params["object"], fetch: false), {_, {:ok, like_object, meta}} <- {:build_object, Builder.like(user, object)}, {_, {:ok, %Activity{} = activity, _meta}} <- {:common_pipeline, diff --git a/lib/pleroma/web/activity_pub/builder.ex b/lib/pleroma/web/activity_pub/builder.ex index e99f6fd83..74ddc2506 100644 --- a/lib/pleroma/web/activity_pub/builder.ex +++ b/lib/pleroma/web/activity_pub/builder.ex @@ -80,7 +80,7 @@ def undo(actor, object) do @spec delete(User.t(), String.t()) :: {:ok, map(), keyword()} def delete(actor, object_id) do - object = Object.normalize(object_id, false) + object = Object.normalize(object_id, fetch: false) user = !object && User.get_cached_by_ap_id(object_id) diff --git a/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex b/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex index 3bf70b894..c8c40c702 100644 --- a/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex +++ b/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex @@ -31,7 +31,7 @@ def filter(%{"type" => "Create", "object" => child_object} = object) when is_map(child_object) do child = child_object["inReplyTo"] - |> Object.normalize(child_object["inReplyTo"]) + |> Object.normalize(fetch: false) |> filter_by_summary(child_object) object = Map.put(object, "object", child) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index ce8e7341b..244753c02 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -288,7 +288,7 @@ def fetch_actor(object) do def fetch_actor_and_object(object) do fetch_actor(object) - Object.normalize(object["object"], true) + Object.normalize(object["object"], fetch: true) :ok end end diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex index 5ab3562bf..dca28e5bd 100644 --- a/lib/pleroma/web/activity_pub/publisher.ex +++ b/lib/pleroma/web/activity_pub/publisher.ex @@ -129,7 +129,7 @@ defp recipients(actor, activity) do fetchers = with %Activity{data: %{"type" => "Delete"}} <- activity, - %Object{id: object_id} <- Object.normalize(activity), + %Object{id: object_id} <- Object.normalize(activity, fetch: false), fetchers <- User.get_delivered_users_by_object_id(object_id), _ <- Delivery.delete_all_by_object_id(object_id) do fetchers diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 55c99ad0c..679ea1a4d 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -268,7 +268,7 @@ def handle(%{data: %{"type" => "EmojiReact"}} = object, meta) do @impl true def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object, meta) do deleted_object = - Object.normalize(deleted_object, false) || + Object.normalize(deleted_object, fetch: false) || User.get_cached_by_ap_id(deleted_object) result = diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 565d32433..dd0e1f13c 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -653,7 +653,9 @@ def handle_incoming(_, _), do: :error @spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil def get_obj_helper(id, options \\ []) do - case Object.normalize(id, true, options) do + options = Keyword.put(options, :fetch, true) + + case Object.normalize(id, options) do %Object{} = object -> {:ok, object} _ -> nil end @@ -672,7 +674,7 @@ def get_embedded_obj_helper(%{"attributedTo" => attributed_to, "id" => object_id "actor" => attributed_to, "object" => data }) do - {:ok, Object.normalize(activity)} + {:ok, Object.normalize(activity, fetch: false)} else _ -> get_obj_helper(object_id) end @@ -763,7 +765,7 @@ def prepare_outgoing(%{"type" => activity_type, "object" => object_id} = data) when activity_type in ["Create", "Listen"] do object = object_id - |> Object.normalize() + |> Object.normalize(fetch: false) |> Map.get(:data) |> prepare_object @@ -779,7 +781,7 @@ def prepare_outgoing(%{"type" => activity_type, "object" => object_id} = data) def prepare_outgoing(%{"type" => "Announce", "actor" => ap_id, "object" => object_id} = data) do object = object_id - |> Object.normalize() + |> Object.normalize(fetch: false) data = if Visibility.is_private?(object) && object.data["actor"] == ap_id do diff --git a/lib/pleroma/web/activity_pub/views/object_view.ex b/lib/pleroma/web/activity_pub/views/object_view.ex index e555e9999..44bc5621b 100644 --- a/lib/pleroma/web/activity_pub/views/object_view.ex +++ b/lib/pleroma/web/activity_pub/views/object_view.ex @@ -18,7 +18,7 @@ def render("object.json", %{object: %Object{} = object}) do def render("object.json", %{object: %Activity{data: %{"type" => activity_type}} = activity}) when activity_type in ["Create", "Listen"] do base = Pleroma.Web.ActivityPub.Utils.make_json_ld_header() - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) additional = Transmogrifier.prepare_object(activity.data) @@ -29,7 +29,7 @@ def render("object.json", %{object: %Activity{data: %{"type" => activity_type}} def render("object.json", %{object: %Activity{} = activity}) do base = Pleroma.Web.ActivityPub.Utils.make_json_ld_header() - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) additional = Transmogrifier.prepare_object(activity.data) diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index e59254791..87343df75 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -142,7 +142,7 @@ def delete(activity_id, user) do with {_, %Activity{data: %{"object" => _, "type" => "Create"}} = activity} <- {:find_activity, Activity.get_by_id(activity_id)}, {_, %Object{} = object, _} <- - {:find_object, Object.normalize(activity, false), activity}, + {:find_object, Object.normalize(activity, fetch: false), activity}, true <- User.superuser?(user) || user.ap_id == object.data["actor"], {:ok, delete_data, _} <- Builder.delete(user, object.data["id"]), {:ok, delete, _} <- Pipeline.common_pipeline(delete_data, local: true) do @@ -173,7 +173,7 @@ def delete(activity_id, user) do def repeat(id, user, params \\ %{}) do with %Activity{data: %{"type" => "Create"}} = activity <- Activity.get_by_id(id), - object = %Object{} <- Object.normalize(activity, false), + object = %Object{} <- Object.normalize(activity, fetch: false), {_, nil} <- {:existing_announce, Utils.get_existing_announce(user.ap_id, object)}, public = public_announce?(object, params), {:ok, announce, _} <- Builder.announce(user, object, public: public), @@ -191,7 +191,7 @@ def repeat(id, user, params \\ %{}) do def unrepeat(id, user) do with {_, %Activity{data: %{"type" => "Create"}} = activity} <- {:find_activity, Activity.get_by_id(id)}, - %Object{} = note <- Object.normalize(activity, false), + %Object{} = note <- Object.normalize(activity, fetch: false), %Activity{} = announce <- Utils.get_existing_announce(user.ap_id, note), {:ok, undo, _} <- Builder.undo(user, announce), {:ok, activity, _} <- Pipeline.common_pipeline(undo, local: true) do @@ -253,7 +253,7 @@ def favorite_helper(user, id) do def unfavorite(id, user) do with {_, %Activity{data: %{"type" => "Create"}} = activity} <- {:find_activity, Activity.get_by_id(id)}, - %Object{} = note <- Object.normalize(activity, false), + %Object{} = note <- Object.normalize(activity, fetch: false), %Activity{} = like <- Utils.get_existing_like(user.ap_id, note), {:ok, undo, _} <- Builder.undo(user, like), {:ok, activity, _} <- Pipeline.common_pipeline(undo, local: true) do @@ -266,7 +266,7 @@ def unfavorite(id, user) do def react_with_emoji(id, user, emoji) do with %Activity{} = activity <- Activity.get_by_id(id), - object <- Object.normalize(activity), + object <- Object.normalize(activity, fetch: false), {:ok, emoji_react, _} <- Builder.emoji_react(user, object, emoji), {:ok, activity, _} <- Pipeline.common_pipeline(emoji_react, local: true) do {:ok, activity} @@ -377,7 +377,7 @@ def get_visibility(_, in_reply_to, _), do: {"public", get_replied_to_visibility( def get_replied_to_visibility(nil), do: nil def get_replied_to_visibility(activity) do - with %Object{} = object <- Object.normalize(activity) do + with %Object{} = object <- Object.normalize(activity, fetch: false) do Visibility.get_visibility(object) end end diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 1c74ea787..ddbdb3376 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -319,7 +319,7 @@ def make_note_data(%ActivityDraft{} = draft) do defp add_in_reply_to(object, nil), do: object defp add_in_reply_to(object, in_reply_to) do - with %Object{} = in_reply_to_object <- Object.normalize(in_reply_to) do + with %Object{} = in_reply_to_object <- Object.normalize(in_reply_to, fetch: false) do Map.put(object, "inReplyTo", in_reply_to_object.data["id"]) else _ -> object @@ -399,7 +399,7 @@ def maybe_notify_mentioned_recipients( %Activity{data: %{"to" => _to, "type" => type} = data} = activity ) when type == "Create" do - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) object_data = cond do diff --git a/lib/pleroma/web/embed_controller.ex b/lib/pleroma/web/embed_controller.ex index f6b8a5ee1..f8623d4d6 100644 --- a/lib/pleroma/web/embed_controller.ex +++ b/lib/pleroma/web/embed_controller.ex @@ -31,7 +31,7 @@ def show(conn, %{"id" => id}) do end defp get_counts(%Activity{} = activity) do - %Object{data: data} = Object.normalize(activity) + %Object{data: data} = Object.normalize(activity, fetch: false) %{ likes: Map.get(data, "like_count", 0), diff --git a/lib/pleroma/web/feed/feed_view.ex b/lib/pleroma/web/feed/feed_view.ex index 30e0a2a55..bc0114e26 100644 --- a/lib/pleroma/web/feed/feed_view.ex +++ b/lib/pleroma/web/feed/feed_view.ex @@ -23,7 +23,7 @@ def pub_date(date) when is_binary(date) do def pub_date(%DateTime{} = date), do: Timex.format!(date, "{RFC822}") def prepare_activity(activity, opts \\ []) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) actor = if opts[:actor] do diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 9e3a584f0..acca9d3b2 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -318,7 +318,7 @@ def favourited_by(%{assigns: %{user: user}} = conn, %{id: id}) do with true <- Pleroma.Config.get([:instance, :show_reactions]), %Activity{} = activity <- Activity.get_by_id_with_object(id), {:visible, true} <- {:visible, Visibility.visible_for_user?(activity, user)}, - %Object{data: %{"likes" => likes}} <- Object.normalize(activity) do + %Object{data: %{"likes" => likes}} <- Object.normalize(activity, fetch: false) do users = User |> Ecto.Query.where([u], u.ap_id in ^likes) @@ -339,7 +339,7 @@ def reblogged_by(%{assigns: %{user: user}} = conn, %{id: id}) do with %Activity{} = activity <- Activity.get_by_id_with_object(id), {:visible, true} <- {:visible, Visibility.visible_for_user?(activity, user)}, %Object{data: %{"announcements" => announces, "id" => ap_id}} <- - Object.normalize(activity) do + Object.normalize(activity, fetch: false) do announces = "Announce" |> Activity.Queries.by_type() diff --git a/lib/pleroma/web/mastodon_api/views/notification_view.ex b/lib/pleroma/web/mastodon_api/views/notification_view.ex index 5b06a6b51..9ec0f311d 100644 --- a/lib/pleroma/web/mastodon_api/views/notification_view.ex +++ b/lib/pleroma/web/mastodon_api/views/notification_view.ex @@ -139,7 +139,7 @@ defp put_emoji(response, activity) do end defp put_chat_message(response, activity, reading_user, opts) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) author = User.get_cached_by_ap_id(object.data["actor"]) chat = Pleroma.Chat.get(reading_user.id, author.ap_id) cm_ref = MessageReference.for_chat_and_object(chat, object) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 2301e21cf..b8a35cd38 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -41,7 +41,7 @@ defp get_replied_to_activities(activities) do activities |> Enum.map(fn %{data: %{"type" => "Create"}} = activity -> - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) object && object.data["inReplyTo"] != "" && object.data["inReplyTo"] _ -> @@ -51,7 +51,7 @@ defp get_replied_to_activities(activities) do |> Activity.create_by_object_ap_id_with_object() |> Repo.all() |> Enum.reduce(%{}, fn activity, acc -> - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) if object, do: Map.put(acc, object.data["id"], activity), else: acc end) end @@ -65,7 +65,7 @@ defp get_context_id(%{data: %{"context" => context}}) when is_binary(context), defp get_context_id(_), do: nil defp reblogged?(activity, user) do - object = Object.normalize(activity) || %{} + object = Object.normalize(activity, fetch: false) || %{} present?(user && user.ap_id in (object.data["announcements"] || [])) end @@ -84,7 +84,7 @@ def render("index.json", opts) do parent_activities = activities |> Enum.filter(&(&1.data["type"] == "Announce" && &1.data["object"])) - |> Enum.map(&Object.normalize(&1).data["id"]) + |> Enum.map(&Object.normalize(&1, fetch: false).data["id"]) |> Activity.create_by_object_ap_id() |> Activity.with_preloaded_object(:left) |> Activity.with_preloaded_bookmark(reading_user) @@ -124,7 +124,7 @@ def render( ) do user = CommonAPI.get_user(activity.data["actor"]) created_at = Utils.to_masto_date(activity.data["published"]) - activity_object = Object.normalize(activity) + activity_object = Object.normalize(activity, fetch: false) reblogged_parent_activity = if opts[:parent_activities] do @@ -193,7 +193,7 @@ def render( end def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} = opts) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) user = CommonAPI.get_user(activity.data["actor"]) user_follower_address = user.follower_address @@ -451,7 +451,7 @@ def render("context.json", %{activity: activity, activities: activities, user: u end def get_reply_to(activity, %{replied_to_activities: replied_to_activities}) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) with nil <- replied_to_activities[object.data["inReplyTo"]] do # If user didn't participate in the thread @@ -460,7 +460,7 @@ def get_reply_to(activity, %{replied_to_activities: replied_to_activities}) do end def get_reply_to(%{data: %{"object" => _object}} = activity, _) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) if object.data["inReplyTo"] && object.data["inReplyTo"] != "" do Activity.get_create_by_object_ap_id(object.data["inReplyTo"]) diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index 668ae0ea4..ea182d698 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -74,14 +74,14 @@ def notice(%{assigns: %{format: format}} = conn, %{"id" => id}) do cond do format in ["json", "activity+json"] -> if activity.local do - %{data: %{"id" => redirect_url}} = Object.normalize(activity) + %{data: %{"id" => redirect_url}} = Object.normalize(activity, fetch: false) redirect(conn, external: redirect_url) else {:error, :not_found} end activity.data["type"] == "Create" -> - %Object{} = object = Object.normalize(activity) + %Object{} = object = Object.normalize(activity, fetch: false) RedirectController.redirector_with_meta( conn, @@ -112,7 +112,7 @@ def notice_player(conn, %{"id" => id}) do with %Activity{data: %{"type" => "Create"}} = activity <- Activity.get_by_id_with_object(id), true <- Visibility.is_public?(activity), {_, true} <- {:visible?, Visibility.visible_for_user?(activity, _reading_user = nil)}, - %Object{} = object <- Object.normalize(activity), + %Object{} = object <- Object.normalize(activity, fetch: false), %{data: %{"attachment" => [%{"url" => [url | _]} | _]}} <- object, true <- String.starts_with?(url["mediaType"], ["audio", "video"]) do conn diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex index bfc0a1f19..1825e2168 100644 --- a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -82,7 +82,7 @@ def post_chat_message( media_id: params[:media_id], idempotency_key: idempotency_key(conn) ), - message <- Object.normalize(activity, false), + message <- Object.normalize(activity, fetch: false), cm_ref <- MessageReference.for_chat_and_object(chat, message) do conn |> put_view(MessageReferenceView) diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex index dd9c746dc..dee04f045 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex @@ -29,7 +29,7 @@ def index(%{assigns: %{user: user}} = conn, %{id: activity_id} = params) do with true <- Pleroma.Config.get([:instance, :show_reactions]), %Activity{} = activity <- Activity.get_by_id_with_object(activity_id), %Object{data: %{"reactions" => reactions}} when is_list(reactions) <- - Object.normalize(activity) do + Object.normalize(activity, fetch: false) do reactions = reactions |> filter(params) diff --git a/lib/pleroma/web/pleroma_api/views/scrobble_view.ex b/lib/pleroma/web/pleroma_api/views/scrobble_view.ex index 95bd4c368..98b95c721 100644 --- a/lib/pleroma/web/pleroma_api/views/scrobble_view.ex +++ b/lib/pleroma/web/pleroma_api/views/scrobble_view.ex @@ -15,7 +15,7 @@ defmodule Pleroma.Web.PleromaAPI.ScrobbleView do alias Pleroma.Web.MastodonAPI.AccountView def render("show.json", %{activity: %Activity{data: %{"type" => "Listen"}} = activity} = opts) do - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) user = CommonAPI.get_user(activity.data["actor"]) created_at = Utils.to_masto_date(activity.data["published"]) diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex index 82152dffa..a9c46f63a 100644 --- a/lib/pleroma/web/push/impl.ex +++ b/lib/pleroma/web/push/impl.ex @@ -32,7 +32,7 @@ def perform( mastodon_type = notification.type gcm_api_key = Application.get_env(:web_push_encryption, :gcm_api_key) avatar_url = User.avatar_url(actor) - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) user = User.get_cached_by_id(user_id) direct_conversation_id = Activity.direct_conversation_id(activity, user) diff --git a/lib/pleroma/web/rich_media/helpers.ex b/lib/pleroma/web/rich_media/helpers.ex index 442bf9995..566fc8c8a 100644 --- a/lib/pleroma/web/rich_media/helpers.ex +++ b/lib/pleroma/web/rich_media/helpers.ex @@ -69,7 +69,7 @@ def fetch_data_for_object(object) do def fetch_data_for_activity(%Activity{data: %{"type" => "Create"}} = activity) do with true <- Config.get([:rich_media, :enabled]), - %Object{} = object <- Object.normalize(activity) do + %Object{} = object <- Object.normalize(activity, fetch: false) do fetch_data_for_object(object) else _ -> %{} diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex index bdec0897a..404cb0473 100644 --- a/lib/pleroma/web/static_fe/static_fe_controller.ex +++ b/lib/pleroma/web/static_fe/static_fe_controller.ex @@ -122,7 +122,7 @@ defp not_found(conn, message) do end defp get_counts(%Activity{} = activity) do - %Object{data: data} = Object.normalize(activity) + %Object{data: data} = Object.normalize(activity, fetch: false) %{ likes: data["like_count"] || 0, diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index 7d4a1304a..1fb8ac1c5 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -151,7 +151,7 @@ def filtered_by_user?(%User{} = user, %Activity{} = item, streamed_type) do recipients = MapSet.new(item.recipients) domain_blocks = Pleroma.Web.ActivityPub.MRF.subdomains_regex(user.domain_blocks) - with parent <- Object.normalize(item) || item, + with parent <- Object.normalize(item, fetch: false) || item, true <- Enum.all?([blocked_ap_ids, muted_ap_ids], &(item.actor not in &1)), true <- item.data["type"] != "Announce" || item.actor not in reblog_muted_ap_ids, true <- diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index de8ab27e5..9f898d8f3 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -114,7 +114,7 @@ test "a remote user's create activity is deleted when the object has been pruned {:ok, post} = CommonAPI.post(user, %{status: "uguu"}) {:ok, post2} = CommonAPI.post(user2, %{status: "test"}) - obj = Object.normalize(post2) + obj = Object.normalize(post2, fetch: false) {:ok, like_object, meta} = Pleroma.Web.ActivityPub.Builder.like(user, obj) @@ -130,7 +130,7 @@ test "a remote user's create activity is deleted when the object has been pruned clear_config([:instance, :federating], true) - object = Object.normalize(post) + object = Object.normalize(post, fetch: false) Object.prune(object) with_mock Pleroma.Web.Federator, diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs index 105f9f766..acaa9adb4 100644 --- a/test/pleroma/activity_test.exs +++ b/test/pleroma/activity_test.exs @@ -25,7 +25,7 @@ test "returns an activity by it's AP id" do test "returns activities by it's objects AP ids" do activity = insert(:note_activity) - object_data = Object.normalize(activity).data + object_data = Object.normalize(activity, fetch: false).data [found_activity] = Activity.get_all_create_by_object_ap_id(object_data["id"]) @@ -34,7 +34,7 @@ test "returns activities by it's objects AP ids" do test "returns the activity that created an object" do activity = insert(:note_activity) - object_data = Object.normalize(activity).data + object_data = Object.normalize(activity, fetch: false).data found_activity = Activity.get_create_by_object_ap_id(object_data["id"]) diff --git a/test/pleroma/bbs/handler_test.exs b/test/pleroma/bbs/handler_test.exs index bba8fab0f..8033828f0 100644 --- a/test/pleroma/bbs/handler_test.exs +++ b/test/pleroma/bbs/handler_test.exs @@ -54,7 +54,7 @@ test "posting" do ) assert activity.actor == user.ap_id - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["content"] == "this is a test post" end @@ -63,7 +63,7 @@ test "replying" do another_user = insert(:user) {:ok, activity} = CommonAPI.post(another_user, %{status: "this is a test post"}) - activity_object = Object.normalize(activity) + activity_object = Object.normalize(activity, fetch: false) output = capture_io(fn -> @@ -82,7 +82,7 @@ test "replying" do assert reply.actor == user.ap_id - reply_object_data = Object.normalize(reply).data + reply_object_data = Object.normalize(reply, fetch: false).data assert reply_object_data["content"] == "this is a reply" assert reply_object_data["inReplyTo"] == activity_object.data["id"] end diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs index 122b10486..917fb2b98 100644 --- a/test/pleroma/conversation/participation_test.exs +++ b/test/pleroma/conversation/participation_test.exs @@ -175,8 +175,8 @@ test "gets all the participations for a user, ordered by updated at descending" assert [participation_one, participation_two] = Participation.for_user(user) - object2 = Pleroma.Object.normalize(activity_two) - object3 = Pleroma.Object.normalize(activity_three) + object2 = Pleroma.Object.normalize(activity_two, fetch: false) + object3 = Pleroma.Object.normalize(activity_three, fetch: false) user = Repo.get(Pleroma.User, user.id) diff --git a/test/pleroma/conversation_test.exs b/test/pleroma/conversation_test.exs index 359aa6840..4643140dc 100644 --- a/test/pleroma/conversation_test.exs +++ b/test/pleroma/conversation_test.exs @@ -48,7 +48,7 @@ test "public posts don't create conversations" do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: "Hey"}) - object = Pleroma.Object.normalize(activity) + object = Pleroma.Object.normalize(activity, fetch: false) context = object.data["context"] conversation = Conversation.get_for_ap_id(context) @@ -64,7 +64,7 @@ test "it creates or updates a conversation and participations for a given DM" do {:ok, activity} = CommonAPI.post(har, %{status: "Hey @#{jafnhar.nickname}", visibility: "direct"}) - object = Pleroma.Object.normalize(activity) + object = Pleroma.Object.normalize(activity, fetch: false) context = object.data["context"] conversation = @@ -86,7 +86,7 @@ test "it creates or updates a conversation and participations for a given DM" do in_reply_to_status_id: activity.id }) - object = Pleroma.Object.normalize(activity) + object = Pleroma.Object.normalize(activity, fetch: false) context = object.data["context"] conversation_two = @@ -110,7 +110,7 @@ test "it creates or updates a conversation and participations for a given DM" do in_reply_to_status_id: activity.id }) - object = Pleroma.Object.normalize(activity) + object = Pleroma.Object.normalize(activity, fetch: false) context = object.data["context"] conversation_three = diff --git a/test/pleroma/html_test.exs b/test/pleroma/html_test.exs index 9737f2458..3a926f077 100644 --- a/test/pleroma/html_test.exs +++ b/test/pleroma/html_test.exs @@ -175,7 +175,7 @@ test "extracts the url" do "I think I just found the best github repo https://github.com/komeiji-satori/Dress" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, url} = HTML.extract_first_external_url_from_object(object) assert url == "https://github.com/komeiji-satori/Dress" end @@ -190,7 +190,7 @@ test "skips mentions" do "@#{other_user.nickname} install misskey! https://github.com/syuilo/misskey/blob/develop/docs/setup.en.md" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, url} = HTML.extract_first_external_url_from_object(object) assert url == "https://github.com/syuilo/misskey/blob/develop/docs/setup.en.md" @@ -206,7 +206,7 @@ test "skips hashtags" do status: "#cofe https://www.pixiv.net/member_illust.php?mode=medium&illust_id=72255140" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, url} = HTML.extract_first_external_url_from_object(object) assert url == "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=72255140" @@ -222,7 +222,7 @@ test "skips microformats hashtags" do content_type: "text/html" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, url} = HTML.extract_first_external_url_from_object(object) assert url == "https://www.pixiv.net/member_illust.php?mode=medium&illust_id=72255140" @@ -233,7 +233,7 @@ test "does not crash when there is an HTML entity in a link" do {:ok, activity} = CommonAPI.post(user, %{status: "\"http://cofe.com/?boomer=ok&foo=bar\""}) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert {:ok, nil} = HTML.extract_first_external_url_from_object(object) end @@ -247,7 +247,7 @@ test "skips attachment links" do "image.png" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert {:ok, nil} = HTML.extract_first_external_url_from_object(object) end diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs index 5d4e6fb84..fe7f37e7c 100644 --- a/test/pleroma/object_test.exs +++ b/test/pleroma/object_test.exs @@ -256,23 +256,22 @@ test "With custom base_url" do end describe "normalizer" do - test "fetches unknown objects by default" do - %Object{} = - object = Object.normalize("http://mastodon.example.org/@admin/99541947525187367") - - assert object.data["url"] == "http://mastodon.example.org/@admin/99541947525187367" + @url "http://mastodon.example.org/@admin/99541947525187367" + test "does not fetch unknown objects by default" do + assert nil == Object.normalize(@url) end - test "fetches unknown objects when fetch_remote is explicitly true" do - %Object{} = - object = Object.normalize("http://mastodon.example.org/@admin/99541947525187367", true) + test "fetches unknown objects when fetch is explicitly true" do + %Object{} = object = Object.normalize(@url, fetch: true) - assert object.data["url"] == "http://mastodon.example.org/@admin/99541947525187367" + assert object.data["url"] == @url end - test "does not fetch unknown objects when fetch_remote is false" do + test "does not fetch unknown objects when fetch is false" do assert is_nil( - Object.normalize("http://mastodon.example.org/@admin/99541947525187367", false) + Object.normalize(@url, + fetch: false + ) ) end end @@ -310,7 +309,10 @@ test "refetches if the time since the last refetch is greater than the interval" mock_modified: mock_modified } do %Object{} = - object = Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d") + object = + Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d", + fetch: true + ) Object.set_cache(object) @@ -332,7 +334,10 @@ test "refetches if the time since the last refetch is greater than the interval" test "returns the old object if refetch fails", %{mock_modified: mock_modified} do %Object{} = - object = Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d") + object = + Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d", + fetch: true + ) Object.set_cache(object) @@ -355,7 +360,10 @@ test "does not refetch if the time since the last refetch is greater than the in mock_modified: mock_modified } do %Object{} = - object = Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d") + object = + Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d", + fetch: true + ) Object.set_cache(object) @@ -377,7 +385,10 @@ test "does not refetch if the time since the last refetch is greater than the in test "preserves internal fields on refetch", %{mock_modified: mock_modified} do %Object{} = - object = Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d") + object = + Object.normalize("https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d", + fetch: true + ) Object.set_cache(object) diff --git a/test/pleroma/user/welcome_chat_message_test.exs b/test/pleroma/user/welcome_chat_message_test.exs index fe26d6e4d..0b744fc1b 100644 --- a/test/pleroma/user/welcome_chat_message_test.exs +++ b/test/pleroma/user/welcome_chat_message_test.exs @@ -28,8 +28,10 @@ test "send a chat welcome message" do {:ok, %Pleroma.Activity{} = activity} = WelcomeChatMessage.post_message(user) assert user.ap_id in activity.recipients - assert Pleroma.Object.normalize(activity).data["type"] == "ChatMessage" - assert Pleroma.Object.normalize(activity).data["content"] == "Hello, welcome to Blob/Cat!" + assert Pleroma.Object.normalize(activity, fetch: false).data["type"] == "ChatMessage" + + assert Pleroma.Object.normalize(activity, fetch: false).data["content"] == + "Hello, welcome to Blob/Cat!" end end end diff --git a/test/pleroma/user/welcome_message_test.exs b/test/pleroma/user/welcome_message_test.exs index 3cd6f5cb7..a1779ddec 100644 --- a/test/pleroma/user/welcome_message_test.exs +++ b/test/pleroma/user/welcome_message_test.exs @@ -28,7 +28,9 @@ test "send a direct welcome message" do {:ok, %Pleroma.Activity{} = activity} = WelcomeMessage.post_message(user) assert user.ap_id in activity.recipients assert activity.data["directMessage"] == true - assert Pleroma.Object.normalize(activity).data["content"] =~ "Hello. Welcome to Pleroma" + + assert Pleroma.Object.normalize(activity, fetch: false).data["content"] =~ + "Hello. Welcome to Pleroma" end end end diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 40bbcad0b..f0f5d6071 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -438,7 +438,7 @@ test "it sends a welcome message if it is set" do activity = Repo.one(Pleroma.Activity) assert registered_user.ap_id in activity.recipients - assert Object.normalize(activity).data["content"] =~ "direct message" + assert Object.normalize(activity, fetch: false).data["content"] =~ "direct message" assert activity.actor == welcome_user.ap_id end @@ -454,7 +454,7 @@ test "it sends a welcome chat message if it is set" do activity = Repo.one(Pleroma.Activity) assert registered_user.ap_id in activity.recipients - assert Object.normalize(activity).data["content"] =~ "chat message" + assert Object.normalize(activity, fetch: false).data["content"] =~ "chat message" assert activity.actor == welcome_user.ap_id end @@ -493,7 +493,7 @@ test "it sends a welcome chat message when Simple policy applied to local instan activity = Repo.one(Pleroma.Activity) assert registered_user.ap_id in activity.recipients - assert Object.normalize(activity).data["content"] =~ "chat message" + assert Object.normalize(activity, fetch: false).data["content"] =~ "chat message" assert activity.actor == welcome_user.ap_id end diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 0063d0482..03aed794f 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -219,7 +219,7 @@ test "it doesn't return a local-only object", %{conn: conn} do assert Pleroma.Web.ActivityPub.Visibility.is_local_public?(post) - object = Object.normalize(post, false) + object = Object.normalize(post, fetch: false) uuid = String.split(object.data["id"], "/") |> List.last() conn = @@ -712,7 +712,7 @@ test "it rejects reads from other users", %{conn: conn} do test "it returns a note activity in a collection", %{conn: conn} do note_activity = insert(:direct_note_activity) - note_object = Object.normalize(note_activity) + note_object = Object.normalize(note_activity, fetch: false) user = User.get_cached_by_ap_id(hd(note_activity.data["to"])) conn = @@ -999,7 +999,7 @@ test "it returns 200 even if there're no activities", %{conn: conn} do test "it returns a note activity in a collection", %{conn: conn} do note_activity = insert(:note_activity) - note_object = Object.normalize(note_activity) + note_object = Object.normalize(note_activity, fetch: false) user = User.get_cached_by_ap_id(note_activity.data["actor"]) conn = @@ -1073,7 +1073,7 @@ test "it inserts an incoming create activity into the database", %{ assert Activity.get_by_ap_id(result["id"]) assert result["object"] - assert %Object{data: object} = Object.normalize(result["object"]) + assert %Object{data: object} = Object.normalize(result["object"], fetch: false) assert object["content"] == activity["object"]["content"] end @@ -1109,7 +1109,7 @@ test "it inserts an incoming sensitive activity into the database", %{ assert Activity.get_by_ap_id(response["id"]) assert response["object"] - assert %Object{data: response_object} = Object.normalize(response["object"]) + assert %Object{data: response_object} = Object.normalize(response["object"], fetch: false) assert response_object["sensitive"] == true assert response_object["content"] == activity["object"]["content"] @@ -1137,7 +1137,7 @@ test "it rejects an incoming activity with bogus type", %{conn: conn, activity: test "it erects a tombstone when receiving a delete activity", %{conn: conn} do note_activity = insert(:note_activity) - note_object = Object.normalize(note_activity) + note_object = Object.normalize(note_activity, fetch: false) user = User.get_cached_by_ap_id(note_activity.data["actor"]) data = %{ @@ -1162,7 +1162,7 @@ test "it erects a tombstone when receiving a delete activity", %{conn: conn} do test "it rejects delete activity of object from other actor", %{conn: conn} do note_activity = insert(:note_activity) - note_object = Object.normalize(note_activity) + note_object = Object.normalize(note_activity, fetch: false) user = insert(:user) data = %{ @@ -1183,7 +1183,7 @@ test "it rejects delete activity of object from other actor", %{conn: conn} do test "it increases like count when receiving a like action", %{conn: conn} do note_activity = insert(:note_activity) - note_object = Object.normalize(note_activity) + note_object = Object.normalize(note_activity, fetch: false) user = User.get_cached_by_ap_id(note_activity.data["actor"]) data = %{ @@ -1240,7 +1240,7 @@ test "it doesn't spreads faulty attributedTo or actor fields", %{ assert cirno_outbox["attributedTo"] == nil assert cirno_outbox["actor"] == cirno.ap_id - assert cirno_object = Object.normalize(cirno_outbox["object"]) + assert cirno_object = Object.normalize(cirno_outbox["object"], fetch: false) assert cirno_object.data["actor"] == cirno.ap_id assert cirno_object.data["attributedTo"] == cirno.ap_id end @@ -1503,7 +1503,7 @@ test "does not require authentication", %{conn: conn} do test "it tracks a signed object fetch", %{conn: conn} do user = insert(:user, local: false) activity = insert(:note_activity) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) object_path = String.trim_leading(object.data["id"], Pleroma.Web.Endpoint.url()) @@ -1519,7 +1519,7 @@ test "it tracks a signed object fetch", %{conn: conn} do test "it tracks a signed activity fetch", %{conn: conn} do user = insert(:user, local: false) activity = insert(:note_activity) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) activity_path = String.trim_leading(activity.data["id"], Pleroma.Web.Endpoint.url()) @@ -1536,7 +1536,7 @@ test "it tracks a signed object fetch when the json is cached", %{conn: conn} do user = insert(:user, local: false) other_user = insert(:user, local: false) activity = insert(:note_activity) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) object_path = String.trim_leading(object.data["id"], Pleroma.Web.Endpoint.url()) @@ -1560,7 +1560,7 @@ test "it tracks a signed activity fetch when the json is cached", %{conn: conn} user = insert(:user, local: false) other_user = insert(:user, local: false) activity = insert(:note_activity) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) activity_path = String.trim_leading(activity.data["id"], Pleroma.Web.Endpoint.url()) @@ -1650,7 +1650,7 @@ test "POST /api/ap/upload_media", %{conn: conn} do assert activity_response["actor"] == user.ap_id assert %Object{data: %{"attachment" => [attachment]}} = - Object.normalize(activity_response["object"]) + Object.normalize(activity_response["object"], fetch: false) assert attachment["type"] == "Document" assert attachment["name"] == desc diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 9eb7ae86b..0d30ba20b 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -321,7 +321,7 @@ test "adds a context when none is there" do } {:ok, %Activity{} = activity} = ActivityPub.insert(data) - object = Pleroma.Object.normalize(activity) + object = Pleroma.Object.normalize(activity, fetch: false) assert is_binary(activity.data["context"]) assert is_binary(object.data["context"]) @@ -344,7 +344,7 @@ test "adds an id to a given object if it lacks one and is a note and inserts it } {:ok, %Activity{} = activity} = ActivityPub.insert(data) - assert object = Object.normalize(activity) + assert object = Object.normalize(activity, fetch: false) assert is_binary(object.data["id"]) end end @@ -678,7 +678,7 @@ test "doesn't return announce activities with blocked users in 'cc'" do {:ok, activity_two} = CommonAPI.post(blockee, %{status: "hey! @#{friend.nickname}"}) - assert object = Pleroma.Object.normalize(activity_two) + assert object = Pleroma.Object.normalize(activity_two, fetch: false) data = %{ "actor" => friend.ap_id, diff --git a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs index 9613dea9b..da60ac844 100644 --- a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do announcer = insert(:user) {:ok, post_activity} = CommonAPI.post(user, %{status: "uguu"}) - object = Object.normalize(post_activity, false) + object = Object.normalize(post_activity, fetch: false) {:ok, valid_announce, []} = Builder.announce(announcer, object) %{ @@ -81,7 +81,7 @@ test "returns an error if the actor can't announce the object", %{ {:ok, post_activity} = CommonAPI.post(user, %{status: "a secret post", visibility: "private"}) - object = Object.normalize(post_activity, false) + object = Object.normalize(post_activity, fetch: false) # Another user can't announce it {:ok, announce, []} = Builder.announce(announcer, object, public: false) diff --git a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs index d7e299224..941a8a3e3 100644 --- a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs @@ -17,7 +17,7 @@ test "it is invalid if the object already exists" do user = insert(:user) recipient = insert(:user) {:ok, activity} = CommonAPI.post_chat_message(user, recipient, "hey") - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) {:ok, create_data, _} = Builder.create(user, object.data, [recipient.ap_id]) diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs index 3503d25b2..6d15e1640 100644 --- a/test/pleroma/web/activity_pub/publisher_test.exs +++ b/test/pleroma/web/activity_pub/publisher_test.exs @@ -322,7 +322,7 @@ test "publish to url with with different ports" do actor = insert(:user) note_activity = insert(:note_activity, user: actor) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) activity_path = String.trim_leading(note_activity.data["id"], Pleroma.Web.Endpoint.url()) object_path = String.trim_leading(object.data["id"], Pleroma.Web.Endpoint.url()) diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 297fc0b84..16a598002 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -139,7 +139,7 @@ test "it uses a given changeset to update", %{user: user, update: update} do {:ok, op} = CommonAPI.post(other_user, %{status: "big oof"}) {:ok, post} = CommonAPI.post(user, %{status: "hey", in_reply_to_id: op}) {:ok, favorite} = CommonAPI.favorite(user, post.id) - object = Object.normalize(post) + object = Object.normalize(post, fetch: false) {:ok, delete_data, _meta} = Builder.delete(user, object.data["id"]) {:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id) {:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true) @@ -182,7 +182,7 @@ test "it handles object deletions", %{ user = User.get_by_id(user.id) assert user.note_count == 0 - object = Object.normalize(op.data["object"], false) + object = Object.normalize(op.data["object"], fetch: false) assert object.data["repliesCount"] == 0 end @@ -211,7 +211,7 @@ test "it handles object deletions when the object itself has been pruned", %{ user = User.get_by_id(user.id) assert user.note_count == 0 - object = Object.normalize(op.data["object"], false) + object = Object.normalize(op.data["object"], fetch: false) assert object.data["repliesCount"] == 0 end diff --git a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs index c06bbc5e9..6ec7e1a0a 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs @@ -130,7 +130,7 @@ test "it works for incoming announces with an inlined activity" do assert data["id"] == "http://mastodon.example.org/users/admin/statuses/99542391527669785/activity" - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert object.data["id"] == "http://mastodon.example.org/@admin/99541947525187368" assert object.data["content"] == "this is a private toot" @@ -158,7 +158,7 @@ test "it does not clobber the addressing on announce activities" do data = File.read!("test/fixtures/mastodon-announce.json") |> Jason.decode!() - |> Map.put("object", Object.normalize(activity).data["id"]) + |> Map.put("object", Object.normalize(activity, fetch: false).data["id"]) |> Map.put("to", ["http://mastodon.example.org/users/admin/followers"]) |> Map.put("cc", []) diff --git a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs index a1c2ba28a..c6483ccaf 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs @@ -26,7 +26,7 @@ test "incoming, rewrites Note to Answer and increments vote counters" do poll: %{options: ["suya", "suya.", "suya.."], expires_in: 10} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["repliesCount"] == nil data = @@ -37,7 +37,7 @@ test "incoming, rewrites Note to Answer and increments vote counters" do |> Kernel.put_in(["object", "to"], user.ap_id) {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - answer_object = Object.normalize(activity) + answer_object = Object.normalize(activity, fetch: false) assert answer_object.data["type"] == "Answer" assert answer_object.data["inReplyTo"] == object.data["id"] @@ -62,7 +62,7 @@ test "outgoing, rewrites Answer to Note" do poll: %{options: ["suya", "suya.", "suya.."], expires_in: 10} }) - poll_object = Object.normalize(poll_activity) + poll_object = Object.normalize(poll_activity, fetch: false) # TODO: Replace with CommonAPI vote creation when implemented data = File.read!("test/fixtures/mastodon-vote.json") diff --git a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs index b0ae804c5..26216f7fc 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs @@ -25,7 +25,7 @@ test "Pterotype (Wordpress Plugin) Article" do {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert object.data["name"] == "The end is near: Mastodon plans to drop OStatus support" @@ -75,7 +75,7 @@ test "Prismo Article" do data = File.read!("test/fixtures/prismo-url-map.json") |> Jason.decode!() {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert object.data["url"] == "https://prismo.news/posts/83" end diff --git a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs index 7a2ac5d4d..ac80d0ddd 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs @@ -35,7 +35,7 @@ test "it works for incoming listens" do {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["title"] == "lain radio episode 1" assert object.data["artist"] == "lain" @@ -57,7 +57,7 @@ test "Funkwhale Audio object" do {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - assert object = Object.normalize(activity, false) + assert object = Object.normalize(activity, fetch: false) assert object.data["to"] == ["https://www.w3.org/ns/activitystreams#Public"] diff --git a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs index 1f9e73ff8..6dd508894 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs @@ -40,7 +40,7 @@ test "it works for incoming deletes" do assert actor == deleting_user.ap_id # Objects are replaced by a tombstone object. - object = Object.normalize(activity.data["object"]) + object = Object.normalize(activity.data["object"], fetch: false) assert object.data["type"] == "Tombstone" end @@ -48,7 +48,7 @@ test "it works for incoming when the object has been pruned" do activity = insert(:note_activity) {:ok, object} = - Object.normalize(activity.data["object"]) + Object.normalize(activity.data["object"], fetch: false) |> Repo.delete() # TODO: mock cachex diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index b4a006aec..b61e5013a 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -28,7 +28,7 @@ test "it works for incoming notices with tag not being an array (kroeg)" do data = File.read!("test/fixtures/kroeg-array-less-emoji.json") |> Jason.decode!() {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert object.data["emoji"] == %{ "icon_e_smile" => "https://puckipedia.com/forum/images/smilies/icon_e_smile.png" @@ -37,7 +37,7 @@ test "it works for incoming notices with tag not being an array (kroeg)" do data = File.read!("test/fixtures/kroeg-array-less-hashtag.json") |> Jason.decode!() {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert "test" in object.data["tag"] end @@ -66,7 +66,7 @@ test "it cleans up incoming notices which are not really DMs" do assert data["to"] == [] assert data["cc"] == to - object_data = Object.normalize(activity).data + object_data = Object.normalize(activity, fetch: false).data assert object_data["to"] == [] assert object_data["cc"] == to @@ -78,7 +78,7 @@ test "it ignores an incoming notice if we already have it" do data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!() - |> Map.put("object", Object.normalize(activity).data) + |> Map.put("object", Object.normalize(activity, fetch: false).data) {:ok, returned_activity} = Transmogrifier.handle_incoming(data) @@ -97,7 +97,7 @@ test "it fetches reply-to activities if we don't have them" do data = Map.put(data, "object", object) {:ok, returned_activity} = Transmogrifier.handle_incoming(data) - returned_object = Object.normalize(returned_activity, false) + returned_object = Object.normalize(returned_activity, fetch: false) assert %Activity{} = Activity.get_create_by_object_ap_id( @@ -123,7 +123,7 @@ test "it does not fetch reply-to activities beyond max replies depth limit" do allowed_thread_distance?: fn _ -> false end do {:ok, returned_activity} = Transmogrifier.handle_incoming(data) - returned_object = Object.normalize(returned_activity, false) + returned_object = Object.normalize(returned_activity, fetch: false) refute Activity.get_create_by_object_ap_id( "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment" @@ -179,7 +179,7 @@ test "it works for incoming notices" do assert data["actor"] == "http://mastodon.example.org/users/admin" - object_data = Object.normalize(data["object"]).data + object_data = Object.normalize(data["object"], fetch: false).data assert object_data["id"] == "http://mastodon.example.org/users/admin/statuses/99512778738411822" @@ -209,7 +209,7 @@ test "it works for incoming notices without the sensitive property but an nsfw h {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object_data = Object.normalize(data["object"], false).data + object_data = Object.normalize(data["object"], fetch: false).data assert object_data["sensitive"] == true end @@ -218,7 +218,7 @@ test "it works for incoming notices with hashtags" do data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Jason.decode!() {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert Enum.at(object.data["tag"], 2) == "moo" end @@ -227,7 +227,7 @@ test "it works for incoming notices with contentMap" do data = File.read!("test/fixtures/mastodon-post-activity-contentmap.json") |> Jason.decode!() {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert object.data["content"] == "

@lain

" @@ -237,7 +237,7 @@ test "it works for incoming notices with to/cc not being an array (kroeg)" do data = File.read!("test/fixtures/kroeg-post-activity.json") |> Jason.decode!() {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data) - object = Object.normalize(data["object"]) + object = Object.normalize(data["object"], fetch: false) assert object.data["content"] == "

henlo from my Psion netBook

message sent from my Psion netBook

" @@ -725,7 +725,7 @@ test "sets `replies` collection with a limited number of self-replies" do in_reply_to_status_id: id1 }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end) assert %{"type" => "Collection", "items" => ^replies_uris} = diff --git a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs index 47f92cf4d..ae470f984 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs @@ -22,7 +22,7 @@ test "Mastodon Question activity" do {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) assert object.data["url"] == "https://mastodon.sdf.org/@rinpatch/102070944809637304" @@ -65,7 +65,7 @@ test "Mastodon Question activity" do {:ok, reply_activity} = CommonAPI.post(user, %{status: "hewwo", in_reply_to_id: activity.id}) - reply_object = Object.normalize(reply_activity, false) + reply_object = Object.normalize(reply_activity, fetch: false) assert reply_object.data["context"] == object.data["context"] assert reply_object.data["context_id"] == object.data["context_id"] @@ -101,7 +101,7 @@ test "Mastodon Question activity with HTML tags in plaintext" do |> Kernel.put_in(["object", "oneOf"], options) {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) assert Enum.sort(object.data["oneOf"]) == Enum.sort(options) end @@ -147,7 +147,7 @@ test "Mastodon Question activity with custom emojis" do |> Kernel.put_in(["object", "tag"], tag) {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) assert object.data["oneOf"] == options diff --git a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs index 57411fafa..be4ac4c13 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs @@ -24,7 +24,7 @@ test "skip converting the content when it is nil" do {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - assert object = Object.normalize(activity, false) + assert object = Object.normalize(activity, fetch: false) assert object.data["content"] == nil end @@ -34,7 +34,7 @@ test "it converts content of object to html" do {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - assert object = Object.normalize(activity, false) + assert object = Object.normalize(activity, fetch: false) assert object.data["content"] == "

Après avoir mené avec un certain succès la campagne « Dégooglisons Internet » en 2014, l’association Framasoft annonce fin 2019 arrêter progressivement un certain nombre de ses services alternatifs aux GAFAM. Pourquoi ?

Transcription par @aprilorg ici : https://www.april.org/deframasoftisons-internet-pierre-yves-gosset-framasoft

" @@ -70,7 +70,7 @@ test "it remaps video URLs as attachments if necessary" do {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) - assert object = Object.normalize(activity, false) + assert object = Object.normalize(activity, fetch: false) assert object.data["attachment"] == [ %{ diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 66ea7664a..741147bf4 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -56,7 +56,7 @@ test "it accepts Flag activities" do other_user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: "test post"}) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) note_obj = %{ "type" => "Note", diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs index 2263b6091..83668caa4 100644 --- a/test/pleroma/web/activity_pub/utils_test.exs +++ b/test/pleroma/web/activity_pub/utils_test.exs @@ -165,7 +165,7 @@ test "fetches existing votes" do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, votes, object} = CommonAPI.vote(other_user, object, [0, 1]) assert Enum.sort(Utils.get_existing_votes(other_user.ap_id, object)) == Enum.sort(votes) end @@ -183,7 +183,7 @@ test "fetches only Create activities" do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, [vote], object} = CommonAPI.vote(other_user, object, [0]) {:ok, _activity} = CommonAPI.favorite(user, activity.id) [fetched_vote] = Utils.get_existing_votes(other_user.ap_id, object) @@ -242,7 +242,7 @@ test "updates the state of the given follow activity" do test "updates likes" do user = insert(:user) activity = insert(:note_activity) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert {:ok, updated_object} = Utils.update_element_in_object( @@ -302,7 +302,7 @@ test "removes ap_id from likes" do describe "get_existing_like/2" do test "fetches existing like" do note_activity = insert(:note_activity) - assert object = Object.normalize(note_activity) + assert object = Object.normalize(note_activity, fetch: false) user = insert(:user) refute Utils.get_existing_like(user.ap_id, object) @@ -320,7 +320,7 @@ test "returns nil if announce not found" do test "fetches existing announce" do note_activity = insert(:note_activity) - assert object = Object.normalize(note_activity) + assert object = Object.normalize(note_activity, fetch: false) actor = insert(:user) {:ok, announce} = CommonAPI.repeat(note_activity.id, actor) @@ -412,7 +412,7 @@ test "returns false" do describe "lazy_put_activity_defaults/2" do test "returns map with id and published data" do note_activity = insert(:note_activity) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) res = Utils.lazy_put_activity_defaults(%{"context" => object.data["id"]}) assert res["context"] == object.data["id"] assert res["context_id"] == object.id @@ -431,7 +431,7 @@ test "returns map with fake id and published data" do test "returns activity data with object" do note_activity = insert(:note_activity) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) res = Utils.lazy_put_activity_defaults(%{ diff --git a/test/pleroma/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs index f0389845d..967acad19 100644 --- a/test/pleroma/web/activity_pub/views/object_view_test.exs +++ b/test/pleroma/web/activity_pub/views/object_view_test.exs @@ -24,7 +24,7 @@ test "renders a note object" do test "renders a note activity" do note = insert(:note_activity) - object = Object.normalize(note) + object = Object.normalize(note, fetch: false) result = ObjectView.render("object.json", %{object: note}) @@ -56,7 +56,7 @@ test "renders `replies` collection for a note activity" do test "renders a like activity" do note = insert(:note_activity) - object = Object.normalize(note) + object = Object.normalize(note, fetch: false) user = insert(:user) {:ok, like_activity} = CommonAPI.favorite(user, note.id) @@ -70,7 +70,7 @@ test "renders a like activity" do test "renders an announce activity" do note = insert(:note_activity) - object = Object.normalize(note) + object = Object.normalize(note, fetch: false) user = insert(:user) {:ok, announce_activity} = CommonAPI.repeat(note.id, user) diff --git a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs index dead1c09e..00e67a91c 100644 --- a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs @@ -36,7 +36,7 @@ test "it deletes a message from the chat", %{conn: conn, admin: admin} do {:ok, message} = CommonAPI.post_chat_message(user, recipient, "Hello darkness my old friend") - object = Object.normalize(message, false) + object = Object.normalize(message, fetch: false) chat = Chat.get(user.id, recipient.ap_id) recipient_chat = Chat.get(recipient.id, user.ap_id) @@ -143,7 +143,7 @@ test "it returns a chat", %{conn: conn} do recipient = insert(:user) {:ok, message} = CommonAPI.post_chat_message(user, recipient, "Yo") - object = Object.normalize(message, false) + object = Object.normalize(message, fetch: false) chat = Chat.get(user.id, recipient.ap_id) cm_ref = MessageReference.for_chat_and_object(chat, object) @@ -183,7 +183,7 @@ test "GET /api/pleroma/admin/chats/:id", %{conn: conn, chat: chat} do recipient = insert(:user) {:ok, message} = CommonAPI.post_chat_message(user, recipient, "Yo") - object = Object.normalize(message, false) + object = Object.normalize(message, fetch: false) chat = Chat.get(user.id, recipient.ap_id) cm_ref = MessageReference.for_chat_and_object(chat, object) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 585b2c174..52d6ccd0c 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -39,7 +39,7 @@ test "it posts a poll" do poll: %{expires_in: 600, options: ["reimu", "marisa"]} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["type"] == "Question" assert object.data["oneOf"] |> length() == 2 @@ -174,7 +174,7 @@ test "it adds html newlines" do assert other_user.ap_id not in activity.recipients - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) assert object.data["content"] == "uguu
uguuu" end @@ -194,7 +194,7 @@ test "it linkifies" do assert other_user.ap_id not in activity.recipients - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) assert object.data["content"] == "https://example.org is the site of Object.prune() with_mock Pleroma.Web.Federator, @@ -491,7 +491,7 @@ test "it de-duplicates tags" do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: "#2hu #2HU"}) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["tag"] == ["2hu"] end @@ -500,7 +500,7 @@ test "it adds emoji in the object" do user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: ":firefox:"}) - assert Object.normalize(activity).data["emoji"]["firefox"] + assert Object.normalize(activity, fetch: false).data["emoji"]["firefox"] end describe "posting" do @@ -539,7 +539,7 @@ test "it filters out obviously bad tags when accepting a post as HTML" do content_type: "text/html" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["content"] == "

2hu

alert('xss')" assert object.data["source"] == post @@ -556,7 +556,7 @@ test "it filters out obviously bad tags when accepting a post as Markdown" do content_type: "text/markdown" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["content"] == "

2hu

alert('xss')" assert object.data["source"] == post @@ -1211,7 +1211,7 @@ test "does not allow to vote twice" do poll: %{options: ["Yes", "No"], expires_in: 20} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, _, object} = CommonAPI.vote(other_user, object, [0]) @@ -1231,7 +1231,7 @@ test "returns a valid activity" do length: 180_000 }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["title"] == "lain radio episode 1" @@ -1250,7 +1250,7 @@ test "respects visibility=private" do visibility: "private" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert object.data["title"] == "lain radio episode 1" diff --git a/test/pleroma/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs index b4abcf6f2..48dc3b404 100644 --- a/test/pleroma/web/feed/tag_controller_test.exs +++ b/test/pleroma/web/feed/tag_controller_test.exs @@ -24,7 +24,7 @@ test "gets a feed (ATOM)", %{conn: conn} do user = insert(:user) {:ok, activity1} = CommonAPI.post(user, %{status: "yeah #PleromaArt"}) - object = Object.normalize(activity1) + object = Object.normalize(activity1, fetch: false) object_data = Map.put(object.data, "attachment", [ @@ -91,7 +91,7 @@ test "gets a feed (RSS)", %{conn: conn} do user = insert(:user) {:ok, activity1} = CommonAPI.post(user, %{status: "yeah #PleromaArt"}) - object = Object.normalize(activity1) + object = Object.normalize(activity1, fetch: false) object_data = Map.put(object.data, "attachment", [ @@ -147,8 +147,8 @@ test "gets a feed (RSS)", %{conn: conn} do "https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4" ] - obj1 = Object.normalize(activity1) - obj2 = Object.normalize(activity2) + obj1 = Object.normalize(activity1, fetch: false) + obj2 = Object.normalize(activity2, fetch: false) assert xpath(xml, ~x"//channel/item/description/text()"sl) == [ HtmlEntities.decode(FeedView.activity_content(obj2.data)), diff --git a/test/pleroma/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs index 16f002717..50445862b 100644 --- a/test/pleroma/web/feed/user_controller_test.exs +++ b/test/pleroma/web/feed/user_controller_test.exs @@ -58,7 +58,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do ) note_activity2 = insert(:note_activity, note: note2) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) [user: user, object: object, max_id: note_activity2.id] end diff --git a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs index 95e27623d..71cea8462 100644 --- a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs @@ -20,7 +20,7 @@ test "returns poll entity for object id", %{user: user, conn: conn} do poll: %{options: ["what Mastodon't", "n't what Mastodoes"], expires_in: 20} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) conn = get(conn, "/api/v1/polls/#{object.id}") @@ -39,7 +39,7 @@ test "does not expose polls for private statuses", %{conn: conn} do visibility: "private" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) conn = get(conn, "/api/v1/polls/#{object.id}") @@ -63,7 +63,7 @@ test "votes are added to the poll", %{conn: conn} do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) conn = conn @@ -85,7 +85,7 @@ test "author can't vote", %{user: user, conn: conn} do poll: %{options: ["Yes", "No"], expires_in: 20} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert conn |> put_req_header("content-type", "application/json") @@ -106,7 +106,7 @@ test "does not allow multiple choices on a single-choice question", %{conn: conn poll: %{options: ["half empty", "half full"], expires_in: 20} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert conn |> put_req_header("content-type", "application/json") @@ -129,7 +129,7 @@ test "does not allow choice index to be greater than options count", %{conn: con poll: %{options: ["Yes", "No"], expires_in: 20} }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) conn = conn @@ -158,7 +158,7 @@ test "returns 404 when poll is private and not available for user", %{conn: conn visibility: "private" }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) conn = conn diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs index 1045ab265..664bdce01 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -309,7 +309,7 @@ test "search doesn't show statuses that it shouldn't", %{conn: conn} do }) capture_log(fn -> - q = Object.normalize(activity).data["id"] + q = Object.normalize(activity, fetch: false).data["id"] results = conn diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index de542e5df..ffff0ae9d 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -800,7 +800,7 @@ test "if user is authenticated", %{local: local, remote: remote} do test "when you created it" do %{user: author, conn: conn} = oauth_access(["write:statuses"]) activity = insert(:note_activity, user: author) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) content = object.data["content"] source = object.data["source"] @@ -1374,7 +1374,9 @@ test "Repeated posts that are replies incorrectly have in_reply_to_id null", %{c activity = Activity.get_by_id_with_object(id) - assert Object.normalize(activity).data["inReplyTo"] == Object.normalize(replied_to).data["id"] + assert Object.normalize(activity, fetch: false).data["inReplyTo"] == + Object.normalize(replied_to, fetch: false).data["id"] + assert Activity.get_in_reply_to_activity(activity).id == replied_to.id # Reblog from the third user diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 9de11a87e..79dd23a51 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -44,7 +44,7 @@ test "ChatMessage notification" do {:ok, [notification]} = Notification.create_notifications(activity) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) chat = Chat.get(recipient.id, user.ap_id) cm_ref = MessageReference.for_chat_and_object(chat, object) diff --git a/test/pleroma/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs index c655ca438..f83e5b368 100644 --- a/test/pleroma/web/mastodon_api/views/poll_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/poll_view_test.exs @@ -29,7 +29,7 @@ test "renders a poll" do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) expected = %{ emojis: [], @@ -72,7 +72,7 @@ test "detects if it is multiple choice" do voter = insert(:user) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, _votes, object} = CommonAPI.vote(voter, object, [0, 1]) @@ -98,7 +98,7 @@ test "detects emoji" do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert %{emojis: [%{shortcode: "blank"}]} = PollView.render("show.json", %{object: object}) end @@ -117,7 +117,7 @@ test "detects vote status" do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) {:ok, _, object} = CommonAPI.vote(other_user, object, [1, 2]) @@ -129,7 +129,7 @@ test "detects vote status" do end test "does not crash on polls with no end date" do - object = Object.normalize("https://skippers-bin.com/notes/7x9tmrp97i") + object = Object.normalize("https://skippers-bin.com/notes/7x9tmrp97i", fetch: true) result = PollView.render("show.json", %{object: object}) assert result[:expires_at] == nil @@ -153,7 +153,7 @@ test "doesn't strips HTML tags" do } }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert %{ options: [ 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 fa9066716..789acb487 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -61,7 +61,7 @@ test "works correctly with badly formatted emojis" do {:ok, activity} = CommonAPI.post(user, %{status: "yo"}) activity - |> Object.normalize(false) + |> Object.normalize(fetch: false) |> Object.update_data(%{"reactions" => %{"☕" => [user.ap_id], "x" => 1}}) activity = Activity.get_by_id(activity.id) @@ -204,7 +204,7 @@ test "tries to get a user by nickname if fetching by ap_id doesn't work" do test "a note with null content" do note = insert(:note_activity) - note_object = Object.normalize(note) + note_object = Object.normalize(note, fetch: false) data = note_object.data @@ -223,7 +223,7 @@ test "a note with null content" do test "a note activity" do note = insert(:note_activity) - object_data = Object.normalize(note).data + object_data = Object.normalize(note, fetch: false).data user = User.get_cached_by_ap_id(note.data["actor"]) convo_id = Utils.context_to_conversation_id(object_data["context"]) diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs index 65b2c22db..f21180a89 100644 --- a/test/pleroma/web/o_status/o_status_controller_test.exs +++ b/test/pleroma/web/o_status/o_status_controller_test.exs @@ -72,7 +72,7 @@ test "redirects to /notice/:id for html format for activity", %{ test "redirects to /notice/id for html format", %{conn: conn} do note_activity = insert(:note_activity) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"])) url = "/objects/#{uuid}" @@ -82,7 +82,7 @@ test "redirects to /notice/id for html format", %{conn: conn} do test "404s on private objects", %{conn: conn} do note_activity = insert(:direct_note_activity) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, object.data["id"])) conn @@ -133,7 +133,7 @@ test "redirects to a proper object URL when json requested and the object is loc conn: conn } do note_activity = insert(:note_activity) - expected_redirect_url = Object.normalize(note_activity).data["id"] + expected_redirect_url = Object.normalize(note_activity, fetch: false).data["id"] redirect_url = conn @@ -230,7 +230,7 @@ test "does not require authentication on non-federating instances", %{ describe "GET /notice/:id/embed_player" do setup do note_activity = insert(:note_activity) - object = Pleroma.Object.normalize(note_activity) + object = Pleroma.Object.normalize(note_activity, fetch: false) object_data = Map.put(object.data, "attachment", [ @@ -287,7 +287,7 @@ test "404s when activity is direct message", %{conn: conn} do test "404s when attachment is empty", %{conn: conn} do note_activity = insert(:note_activity) - object = Pleroma.Object.normalize(note_activity) + object = Pleroma.Object.normalize(note_activity, fetch: false) object_data = Map.put(object.data, "attachment", []) object @@ -301,7 +301,7 @@ test "404s when attachment is empty", %{conn: conn} do test "404s when attachment isn't audio or video", %{conn: conn} do note_activity = insert(:note_activity) - object = Pleroma.Object.normalize(note_activity) + object = Pleroma.Object.normalize(note_activity, fetch: false) object_data = Map.put(object.data, "attachment", [ diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index 415c3decd..24efeeb73 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -22,7 +22,7 @@ test "it marks one message as read", %{conn: conn, user: user} do {:ok, create} = CommonAPI.post_chat_message(other_user, user, "sup") {:ok, _create} = CommonAPI.post_chat_message(other_user, user, "sup part 2") {:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id) - object = Object.normalize(create, false) + object = Object.normalize(create, fetch: false) cm_ref = MessageReference.for_chat_and_object(chat, object) assert cm_ref.unread == true @@ -52,7 +52,7 @@ test "given a `last_read_id`, it marks everything until then as read", %{ {:ok, create} = CommonAPI.post_chat_message(other_user, user, "sup") {:ok, _create} = CommonAPI.post_chat_message(other_user, user, "sup part 2") {:ok, chat} = Chat.get_or_create(user.id, other_user.ap_id) - object = Object.normalize(create, false) + object = Object.normalize(create, fetch: false) cm_ref = MessageReference.for_chat_and_object(chat, object) assert cm_ref.unread == true @@ -158,7 +158,7 @@ test "it deletes a message from the chat", %{conn: conn, user: user} do {:ok, other_message} = CommonAPI.post_chat_message(recipient, user, "nico nico ni") - object = Object.normalize(message, false) + object = Object.normalize(message, fetch: false) chat = Chat.get(user.id, recipient.ap_id) @@ -176,7 +176,7 @@ test "it deletes a message from the chat", %{conn: conn, user: user} do assert %{data: %{"type" => "Tombstone"}} = Object.get_by_id(object.id) # Deleting other people's messages just removes the reference - object = Object.normalize(other_message, false) + object = Object.normalize(other_message, fetch: false) cm_ref = MessageReference.for_chat_and_object(chat, object) result = diff --git a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs index 93eef00a2..0966e9166 100644 --- a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs @@ -31,7 +31,7 @@ test "it displays a chat message" do chat = Chat.get(user.id, recipient.ap_id) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) cm_ref = MessageReference.for_chat_and_object(chat, object) @@ -58,7 +58,7 @@ test "it displays a chat message" do media_id: upload.id ) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) cm_ref = MessageReference.for_chat_and_object(chat, object) diff --git a/test/pleroma/web/pleroma_api/views/chat_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_view_test.exs index b60b597e8..1cc5f16ba 100644 --- a/test/pleroma/web/pleroma_api/views/chat_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_view_test.exs @@ -35,7 +35,7 @@ test "it represents a chat" do {:ok, chat_message_creation} = CommonAPI.post_chat_message(user, recipient, "hello") - chat_message = Object.normalize(chat_message_creation, false) + chat_message = Object.normalize(chat_message_creation, fetch: false) {:ok, chat} = Chat.get_or_create(user.id, recipient.ap_id) diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index 326a67963..d14e0bdef 100644 --- a/test/pleroma/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -118,7 +118,7 @@ test "renders title and body for create activity" do "Lorem ipsum dolor sit amet, consectetur :firefox: adipiscing elit. Fusce sagittis finibus turpis." }) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.format_body( %{ @@ -137,7 +137,7 @@ test "renders title and body for follow activity" do user = insert(:user, nickname: "Bob") other_user = insert(:user) {:ok, _, _, activity} = CommonAPI.follow(user, other_user) - object = Object.normalize(activity, false) + object = Object.normalize(activity, fetch: false) assert Impl.format_body(%{activity: activity, type: "follow"}, user, object) == "@Bob has followed you" @@ -156,7 +156,7 @@ test "renders title and body for announce activity" do }) {:ok, announce_activity} = CommonAPI.repeat(activity.id, user) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.format_body(%{activity: announce_activity}, user, object) == "@#{user.nickname} repeated: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sagittis fini..." @@ -175,7 +175,7 @@ test "renders title and body for like activity" do }) {:ok, activity} = CommonAPI.favorite(user, activity.id) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.format_body(%{activity: activity, type: "favourite"}, user, object) == "@Bob has favorited your post" @@ -193,7 +193,7 @@ test "renders title and body for pleroma:emoji_reaction activity" do }) {:ok, activity} = CommonAPI.react_with_emoji(activity.id, user, "👍") - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.format_body(%{activity: activity, type: "pleroma:emoji_reaction"}, user, object) == "@Bob reacted with 👍" @@ -221,7 +221,7 @@ test "builds content for chat messages" do recipient = insert(:user) {:ok, chat} = CommonAPI.post_chat_message(user, recipient, "hey") - object = Object.normalize(chat, false) + object = Object.normalize(chat, fetch: false) [notification] = Notification.for_user(recipient) res = Impl.build_content(notification, user, object) @@ -245,7 +245,7 @@ test "builds content for chat messages with no content" do {:ok, upload} = ActivityPub.upload(file, actor: user.ap_id) {:ok, chat} = CommonAPI.post_chat_message(user, recipient, nil, media_id: upload.id) - object = Object.normalize(chat, false) + object = Object.normalize(chat, fetch: false) [notification] = Notification.for_user(recipient) res = Impl.build_content(notification, user, object) @@ -271,7 +271,7 @@ test "hides contents of notifications when option enabled" do notif = insert(:notification, user: user2, activity: activity) actor = User.get_cached_by_ap_id(notif.activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.build_content(notif, actor, object) == %{ body: "New Direct Message" @@ -286,7 +286,7 @@ test "hides contents of notifications when option enabled" do notif = insert(:notification, user: user2, activity: activity, type: "mention") actor = User.get_cached_by_ap_id(notif.activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.build_content(notif, actor, object) == %{ body: "New Mention" @@ -297,7 +297,7 @@ test "hides contents of notifications when option enabled" do notif = insert(:notification, user: user2, activity: activity, type: "favourite") actor = User.get_cached_by_ap_id(notif.activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.build_content(notif, actor, object) == %{ body: "New Favorite" @@ -320,7 +320,7 @@ test "returns regular content when hiding contents option disabled" do notif = insert(:notification, user: user2, activity: activity) actor = User.get_cached_by_ap_id(notif.activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.build_content(notif, actor, object) == %{ body: @@ -338,7 +338,7 @@ test "returns regular content when hiding contents option disabled" do notif = insert(:notification, user: user2, activity: activity, type: "mention") actor = User.get_cached_by_ap_id(notif.activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.build_content(notif, actor, object) == %{ body: @@ -351,7 +351,7 @@ test "returns regular content when hiding contents option disabled" do notif = insert(:notification, user: user2, activity: activity, type: "favourite") actor = User.get_cached_by_ap_id(notif.activity.data["actor"]) - object = Object.normalize(activity) + object = Object.normalize(activity, fetch: false) assert Impl.build_content(notif, actor, object) == %{ body: "@Bob has favorited your post", diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index ad66ddc9d..764b799bb 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -266,7 +266,7 @@ test "it sends chat messages to the 'user:pleroma_chat' stream", %{ {:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey cirno", idempotency_key: "123") - object = Object.normalize(create_activity, false) + object = Object.normalize(create_activity, fetch: false) chat = Chat.get(user.id, other_user.ap_id) cm_ref = MessageReference.for_chat_and_object(chat, object) cm_ref = %{cm_ref | chat: chat, object: object} @@ -284,7 +284,7 @@ test "it sends chat messages to the 'user' stream", %{user: user, token: oauth_t other_user = insert(:user) {:ok, create_activity} = CommonAPI.post_chat_message(other_user, user, "hey cirno") - object = Object.normalize(create_activity, false) + object = Object.normalize(create_activity, fetch: false) chat = Chat.get(user.id, other_user.ap_id) cm_ref = MessageReference.for_chat_and_object(chat, object) cm_ref = %{cm_ref | chat: chat, object: object} diff --git a/test/pleroma/workers/scheduled_activity_worker_test.exs b/test/pleroma/workers/scheduled_activity_worker_test.exs index f3eddf7b1..c9e2091a9 100644 --- a/test/pleroma/workers/scheduled_activity_worker_test.exs +++ b/test/pleroma/workers/scheduled_activity_worker_test.exs @@ -36,7 +36,7 @@ test "creates a status from the scheduled activity" do refute Repo.get(ScheduledActivity, scheduled_activity.id) activity = Repo.all(Pleroma.Activity) |> Enum.find(&(&1.actor == user.ap_id)) - assert Pleroma.Object.normalize(activity).data["content"] == "hi" + assert Pleroma.Object.normalize(activity, fetch: false).data["content"] == "hi" end test "adds log message if ScheduledActivity isn't find" do diff --git a/test/support/factory.ex b/test/support/factory.ex index 8eb07dc3c..e02acb89b 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -259,7 +259,7 @@ def announce_activity_factory(attrs \\ %{}) do def like_activity_factory(attrs \\ %{}) do note_activity = attrs[:note_activity] || insert(:note_activity) - object = Object.normalize(note_activity) + object = Object.normalize(note_activity, fetch: false) user = insert(:user) data = -- cgit v1.2.3 From d69c78ceb969c8bef50743d03308d145f0b08a75 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 5 Jan 2021 15:06:00 -0600 Subject: Remove configurability of upload proxy opts, simplify --- config/config.exs | 8 -------- lib/pleroma/web/plugs/uploaded_media.ex | 9 ++++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/config/config.exs b/config/config.exs index d6d116314..7b14fbfe5 100644 --- a/config/config.exs +++ b/config/config.exs @@ -63,14 +63,6 @@ filters: [Pleroma.Upload.Filter.Dedupe], link_name: false, proxy_remote: false, - proxy_opts: [ - redirect_on_failure: false, - max_body_length: 25 * 1_048_576, - http: [ - follow_redirect: true, - pool: :upload - ] - ], filename_display_max_length: 30, default_description: nil diff --git a/lib/pleroma/web/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex index 402a8bb34..94b4c2177 100644 --- a/lib/pleroma/web/plugs/uploaded_media.ex +++ b/lib/pleroma/web/plugs/uploaded_media.ex @@ -87,8 +87,15 @@ defp get_media(conn, {:static_dir, directory}, _, opts) do end defp get_media(conn, {:url, url}, true, _) do + proxy_opts = [ + http: [ + follow_redirect: true, + pool: :upload + ] + ] + conn - |> Pleroma.ReverseProxy.call(url, Pleroma.Config.get([Pleroma.Upload, :proxy_opts], [])) + |> Pleroma.ReverseProxy.call(url, proxy_opts) end defp get_media(conn, {:url, url}, _, _) do -- cgit v1.2.3 From 48cd336a720086695613decc2a1a6852245c1df5 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Wed, 6 Feb 2019 18:05:34 +0100 Subject: allow external emoji --- config/emoji.txt | 1 + lib/pleroma/emoji/formatter.ex | 3 ++- test/pleroma/web/common_api_test.exs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/config/emoji.txt b/config/emoji.txt index 52b714ee5..a2c5add2e 100644 --- a/config/emoji.txt +++ b/config/emoji.txt @@ -1,3 +1,4 @@ firefox, /emoji/Firefox.gif, Gif,Fun blank, /emoji/blank.png, Fun dinosaur, /emoji/dino walking.gif, Gif +external_emoji, https://example.com/emoji.png diff --git a/lib/pleroma/emoji/formatter.ex b/lib/pleroma/emoji/formatter.ex index dc45b8a38..992b20e12 100644 --- a/lib/pleroma/emoji/formatter.ex +++ b/lib/pleroma/emoji/formatter.ex @@ -5,6 +5,7 @@ defmodule Pleroma.Emoji.Formatter do alias Pleroma.Emoji alias Pleroma.HTML + alias Pleroma.Web alias Pleroma.Web.MediaProxy def emojify(text) do @@ -43,7 +44,7 @@ def get_emoji_map(text) when is_binary(text) do Emoji.get_all() |> Enum.filter(fn {emoji, %Emoji{}} -> String.contains?(text, ":#{emoji}:") end) |> Enum.reduce(%{}, fn {name, %Emoji{file: file}}, acc -> - Map.put(acc, name, "#{Pleroma.Web.Endpoint.static_url()}#{file}") + Map.put(acc, name, to_string(URI.merge(Web.base_url(), file))) end) end diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 585b2c174..b81035a9d 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -504,6 +504,19 @@ test "it adds emoji in the object" do end describe "posting" do + test "it adds an emoji on an external site" do + user = insert(:user) + {:ok, activity} = CommonAPI.post(user, %{status: "hey :external_emoji:"}) + + assert %{"external_emoji" => url} = Object.normalize(activity).data["emoji"] + assert url == "https://example.com/emoji.png" + + {:ok, activity} = CommonAPI.post(user, %{status: "hey :blank:"}) + + assert %{"blank" => url} = Object.normalize(activity).data["emoji"] + assert url == "#{Pleroma.Web.base_url()}/emoji/blank.png" + end + test "deactivated users can't post" do user = insert(:user, deactivated: true) assert {:error, _} = CommonAPI.post(user, %{status: "ye"}) -- cgit v1.2.3 From 20af025c65dac642f664760a1428b2ab88920641 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 6 Jan 2021 11:30:32 -0600 Subject: AdminAPI: return user email --- lib/pleroma/web/admin_api/views/account_view.ex | 1 + test/pleroma/web/admin_api/controllers/user_controller_test.exs | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex index 8bac24d3e..ebf90b91b 100644 --- a/lib/pleroma/web/admin_api/views/account_view.ex +++ b/lib/pleroma/web/admin_api/views/account_view.ex @@ -69,6 +69,7 @@ def render("show.json", %{user: user}) do %{ "id" => user.id, + "email" => user.email, "avatar" => avatar, "nickname" => user.nickname, "display_name" => display_name, diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 5705306c7..67b0c578c 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -953,6 +953,7 @@ defp user_response(user, attrs \\ %{}) do %{ "deactivated" => user.deactivated, "id" => user.id, + "email" => user.email, "nickname" => user.nickname, "roles" => %{"admin" => false, "moderator" => false}, "local" => user.local, -- cgit v1.2.3 From 9f6fa5877faee2de0bbec27d434e04972ce13a96 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 6 Jan 2021 11:43:07 -0600 Subject: Add AdminAPI.AccountViewTest --- test/pleroma/web/admin_api/views/account_view_test.exs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/pleroma/web/admin_api/views/account_view_test.exs diff --git a/test/pleroma/web/admin_api/views/account_view_test.exs b/test/pleroma/web/admin_api/views/account_view_test.exs new file mode 100644 index 000000000..f54214575 --- /dev/null +++ b/test/pleroma/web/admin_api/views/account_view_test.exs @@ -0,0 +1,16 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.AdminAPI.AccountViewTest do + use Pleroma.DataCase, async: true + import Pleroma.Factory + alias Pleroma.Web.AdminAPI.AccountView + + describe "show.json" do + test "renders the user's email" do + user = insert(:user, email: "yolo@yolofam.tld") + assert %{"email" => "yolo@yolofam.tld"} = AccountView.render("show.json", %{user: user}) + end + end +end -- cgit v1.2.3 From 7b8dbaff310976e2ad081213a4b3dd28e21e7842 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 6 Jan 2021 15:15:47 -0600 Subject: Call ConfirmUserPlug from Router, not Endpoint --- lib/pleroma/web/endpoint.ex | 2 -- lib/pleroma/web/router.ex | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 705035845..f26542e88 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -169,8 +169,6 @@ def call(conn, opts) do plug(MetricsExporterCaller) - plug(Pleroma.Web.Plugs.ConfirmUserPlug) - plug(Pleroma.Web.Router) @doc """ diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index aefc9f0be..0deb64735 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -56,6 +56,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.UserEnabledPlug) plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug) + plug(Pleroma.Web.Plugs.ConfirmUserPlug) end pipeline :base_api do -- cgit v1.2.3 From 0d521022fe6157ce9a346c6915ce38292e653bb3 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 7 Jan 2021 12:20:29 +0300 Subject: [#3213] Removed PK from hashtags_objects table. Improved hashtags_transfer mix task (logging of failed ids). --- lib/mix/tasks/pleroma/database.ex | 29 +++++++++++++--------- lib/pleroma/object.ex | 4 +-- .../20201221203824_create_hashtags_objects.exs | 2 +- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index f903cf75b..918752dc2 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -139,6 +139,7 @@ def run(["transfer_hashtags"]) do Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") + # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) from( object in Object, left_join: hashtag in assoc(object, :hashtags), @@ -153,13 +154,10 @@ def run(["transfer_hashtags"]) do |> Stream.each(fn objects -> Logger.info("Processing #{length(objects)} objects starting from id #{hd(objects).id}...") - Enum.map( - objects, - fn object -> - hashtags = - object.tag - |> Jason.decode!() - |> Enum.filter(&is_bitstring(&1)) + failed_ids = + objects + |> Enum.map(fn object -> + hashtags = Object.object_data_hashtags(%{"tag" => Jason.decode!(object.tag)}) Repo.transaction(fn -> with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do @@ -169,7 +167,7 @@ def run(["transfer_hashtags"]) do "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", [hashtag_record.id, object.id] ) do - :noop + nil else {:error, e} -> error = @@ -177,18 +175,25 @@ def run(["transfer_hashtags"]) do "#{hashtag_record.id}: #{inspect(e)}" Logger.error(error) - Repo.rollback(error) + Repo.rollback(object.id) end end + + object.id else e -> error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" Logger.error(error) - Repo.rollback(error) + Repo.rollback(object.id) end end) - end - ) + end) + |> Enum.filter(&(elem(&1, 0) == :error)) + |> Enum.map(&elem(&1, 1)) + + if Enum.any?(failed_ids) do + Logger.error("ERROR: transfer_hashtags iteration failed for ids: #{inspect(failed_ids)}") + end end) |> Stream.run() diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 7e79e15ee..61f2ffa19 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -404,7 +404,7 @@ defp embedded_hashtags(%Object{data: data}) do defp embedded_hashtags(_), do: [] - defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do + def object_data_hashtags(%{"tag" => tags}) when is_list(tags) do tags |> Enum.filter(fn %{"type" => "Hashtag"} = data -> Map.has_key?(data, "name") @@ -419,5 +419,5 @@ defp object_data_hashtags(%{"tag" => tags}) when is_list(tags) do |> Enum.uniq() end - defp object_data_hashtags(_), do: [] + def object_data_hashtags(_), do: [] end diff --git a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs index b2649b4fb..214ea81c3 100644 --- a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs +++ b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs @@ -2,7 +2,7 @@ defmodule Pleroma.Repo.Migrations.CreateHashtagsObjects do use Ecto.Migration def change do - create_if_not_exists table(:hashtags_objects) do + create_if_not_exists table(:hashtags_objects, primary_key: false) do add(:hashtag_id, references(:hashtags), null: false) add(:object_id, references(:objects), null: false) end -- cgit v1.2.3 From bd788c093911d84c1615948f8711257e6a7d8974 Mon Sep 17 00:00:00 2001 From: lain Date: Thu, 7 Jan 2021 16:20:30 +0100 Subject: ActivtityPub Test: Add example for guppe actor --- test/fixtures/guppe-actor.json | 26 ++++++++++++++++++++++ .../pleroma/web/activity_pub/activity_pub_test.exs | 18 +++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 test/fixtures/guppe-actor.json diff --git a/test/fixtures/guppe-actor.json b/test/fixtures/guppe-actor.json new file mode 100644 index 000000000..d5829ee1f --- /dev/null +++ b/test/fixtures/guppe-actor.json @@ -0,0 +1,26 @@ +{ + "@context" : [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1" + ], + "followers" : "https://gup.pe/u/bernie2020/followers", + "following" : "https://gup.pe/u/bernie2020/following", + "icon" : { + "mediaType" : "image/jpeg", + "type" : "Image", + "url" : "https://gup.pe/f/guppe.png" + }, + "id" : "https://gup.pe/u/bernie2020", + "inbox" : "https://gup.pe/u/bernie2020/inbox", + "liked" : "https://gup.pe/u/bernie2020/liked", + "name" : "Bernie2020 group", + "outbox" : "https://gup.pe/u/bernie2020/outbox", + "preferredUsername" : "Bernie2020", + "publicKey" : { + "id" : "https://gup.pe/u/bernie2020#main-key", + "owner" : "https://gup.pe/u/bernie2020", + "publicKeyPem" : "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAw4J8nSrdWWxFaipgWDhR\nbTFzHUGoFy7Gjdc6gg9ZWGWDm9ZU5Ct0C/4o72dXSWdyLbQGYMbWVHLI1LHWKSiC\nVtwIYoccQBaxfi5bCxsahWhhSNPfK8tVlySHvBy73ir8KUZm93eAYh1iE9x+Dk63\nInmi7wzjsqHSlu1KxPGYcnyxs+xxhlTUSd5LsPfO1b9sHMW+X4rEky7OC90veCdD\nsoHU+nCmf+2zJSlOrU7DAzqB4Axc9oS9Q5RlT3yARJQMeu6JyjJJP9CMbpGFbUNT\n5Gsw0km1Rc1rR4tUoz8pLUYtliEUK+/0EmHi2EHAT1ueEfMoGGbCaX/mCoMmAwYJ\nwIGYXmKn2/ARIJpw2XPmrKWXqa2AndOQdb3l44Sl3ej2rC/JQmimGCn7tbfKEZyC\n6mMkOYTIeBtyW/wXFc1+GzJxtvA3C9HjilE+O/7gLHfCLP6FRIxg/9kOLhEj64Ed\n5HZ3sylvifXXubS/lLZr6sZW6d9ICoYLZpFw9AoF2zaYWpvJqBrWinnCJzvbMCYj\nfq/RAkcQYSxkDOHquiGgbRZHGAMKLnz5fMKJIzBtdQojYCUmB14OArW+ITUE9i2a\nPAJaXEGZ+BHYp/0ScFaXwp5LIgT1S+sPKxWJU//77wQfs25i7NZHSN/jtXVmsFS6\nLFVw49LcWAz3J2Im+A+uSd8CAwEAAQ==\n-----END PUBLIC KEY-----\n" + }, + "summary" : "I'm a group about Bernie2020. Follow me to get all the group posts. Tag me to share with the group. Create other groups by searching for or tagging @yourGroupName@gup.pe", + "type" : "Group" +} diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 0d30ba20b..98242ff63 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -190,6 +190,24 @@ test "it returns a user that accepts chat messages" do assert user.accepts_chat_messages end + + test "works for guppe actors" do + user_id = "https://gup.pe/u/bernie2020" + + Tesla.Mock.mock(fn + %{method: :get, url: ^user_id} -> + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/guppe-actor.json"), + headers: [{"content-type", "application/activity+json"}] + } + end) + + {:ok, user} = ActivityPub.make_user_from_ap_id(user_id) + + assert user.name == "Bernie2020 group" + assert user.actor_type == "Group" + end end test "it fetches the appropriate tag-restricted posts" do -- cgit v1.2.3 From 3342f6a7efb4a731592972bacbcecf17d0e359d0 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 7 Jan 2021 13:06:22 -0600 Subject: Backups: render ID in API --- lib/pleroma/web/pleroma_api/views/backup_view.ex | 1 + .../pleroma/web/pleroma_api/views/backup_view_test.exs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/pleroma/web/pleroma_api/views/backup_view_test.exs diff --git a/lib/pleroma/web/pleroma_api/views/backup_view.ex b/lib/pleroma/web/pleroma_api/views/backup_view.ex index af75876aa..39affe979 100644 --- a/lib/pleroma/web/pleroma_api/views/backup_view.ex +++ b/lib/pleroma/web/pleroma_api/views/backup_view.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.PleromaAPI.BackupView do def render("show.json", %{backup: %Backup{} = backup}) do %{ + id: backup.id, content_type: backup.content_type, url: download_url(backup), file_size: backup.file_size, diff --git a/test/pleroma/web/pleroma_api/views/backup_view_test.exs b/test/pleroma/web/pleroma_api/views/backup_view_test.exs new file mode 100644 index 000000000..7dda8480b --- /dev/null +++ b/test/pleroma/web/pleroma_api/views/backup_view_test.exs @@ -0,0 +1,18 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.PleromaAPI.BackupViewTest do + use Pleroma.DataCase, async: true + alias Pleroma.User.Backup + alias Pleroma.Web.PleromaAPI.BackupView + import Pleroma.Factory + + test "it renders the ID" do + user = insert(:user) + backup = Backup.new(user) + + result = BackupView.render("show.json", backup: backup) + assert result.id == backup.id + end +end -- cgit v1.2.3 From 1b98cd86104bc8ffbbb550a6770deb94b5dbbfc7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 8 Jan 2021 07:47:55 -0600 Subject: Remove ConfirmUserPlug --- lib/pleroma/web/plugs/confirm_user_plug.ex | 30 ----------------------- lib/pleroma/web/router.ex | 1 - test/pleroma/web/plugs/confirm_user_plug_test.exs | 30 ----------------------- 3 files changed, 61 deletions(-) delete mode 100644 lib/pleroma/web/plugs/confirm_user_plug.ex delete mode 100644 test/pleroma/web/plugs/confirm_user_plug_test.exs diff --git a/lib/pleroma/web/plugs/confirm_user_plug.ex b/lib/pleroma/web/plugs/confirm_user_plug.ex deleted file mode 100644 index 218068de0..000000000 --- a/lib/pleroma/web/plugs/confirm_user_plug.ex +++ /dev/null @@ -1,30 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.Plugs.ConfirmUserPlug do - @moduledoc """ - If a user has ever been granted an OAuth token, they are eligible to become - confirmed, regardless of the account_activation_required setting. This plug - will confirm a user if found. - """ - - alias Pleroma.User - import Plug.Conn - - def init(opts), do: opts - - def call(%{assigns: %{user: %User{confirmation_pending: true} = user}} = conn, _opts) do - with {:ok, user} <- confirm_user(user) do - assign(conn, :user, user) - end - end - - def call(conn, _opts), do: conn - - defp confirm_user(%User{} = user) do - user - |> User.confirmation_changeset(need_confirmation: false) - |> User.update_and_set_cache() - end -end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 0deb64735..aefc9f0be 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -56,7 +56,6 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.UserEnabledPlug) plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug) - plug(Pleroma.Web.Plugs.ConfirmUserPlug) end pipeline :base_api do diff --git a/test/pleroma/web/plugs/confirm_user_plug_test.exs b/test/pleroma/web/plugs/confirm_user_plug_test.exs deleted file mode 100644 index 43c1c28a9..000000000 --- a/test/pleroma/web/plugs/confirm_user_plug_test.exs +++ /dev/null @@ -1,30 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.Plugs.ConfirmUserPlugTest do - use Pleroma.Web.ConnCase, async: true - alias Pleroma.User - alias Pleroma.Web.Plugs.ConfirmUserPlug - import Pleroma.Factory - - test "it confirms an unconfirmed user", %{conn: conn} do - %User{id: user_id} = user = insert(:user, confirmation_pending: true) - - conn = - conn - |> assign(:user, user) - |> ConfirmUserPlug.call(%{}) - - assert %Plug.Conn{assigns: %{user: %User{id: ^user_id, confirmation_pending: false}}} = conn - assert %User{confirmation_pending: false} = User.get_by_id(user_id) - end - - test "it does nothing without an unconfirmed user", %{conn: conn} do - assert conn == ConfirmUserPlug.call(conn, %{}) - - user = insert(:user, confirmation_pending: false) - conn = assign(conn, :user, user) - assert conn == ConfirmUserPlug.call(conn, %{}) - end -end -- cgit v1.2.3 From ad7998361498b08d45ea0971f8b6ecbd8ca0740e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 7 Jan 2021 18:34:30 -0600 Subject: Fix URL generated for backup files, try to create a source of truth we can reuse throughout the codebase --- lib/pleroma/upload.ex | 26 ++++++++++++++++++++++++ lib/pleroma/web/pleroma_api/views/backup_view.ex | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index db2cc1dae..101cfec98 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -31,6 +31,7 @@ defmodule Pleroma.Upload do """ alias Ecto.UUID + alias Pleroma.Config require Logger @type source :: @@ -228,4 +229,29 @@ defp url_from_spec(%__MODULE__{name: name}, base_url, {:file, path}) do end defp url_from_spec(_upload, _base_url, {:url, url}), do: url + + def base_url do + uploader = Config.get([Pleroma.Upload, :uploader]) + upload_base_url = Config.get([Pleroma.Upload, :base_url]) + + case uploader do + Pleroma.Uploaders.Local -> + cond do + !is_nil(upload_base_url) -> + upload_base_url + + true -> + Pleroma.Web.base_url() <> "/media/" + end + + _ -> + cond do + !is_nil(Config.get([uploader, :public_endpoint])) -> + Config.get([uploader, :public_endpoint]) + + true -> + upload_base_url + end + end + end end diff --git a/lib/pleroma/web/pleroma_api/views/backup_view.ex b/lib/pleroma/web/pleroma_api/views/backup_view.ex index 39affe979..e04c8fc0f 100644 --- a/lib/pleroma/web/pleroma_api/views/backup_view.ex +++ b/lib/pleroma/web/pleroma_api/views/backup_view.ex @@ -24,6 +24,6 @@ def render("index.json", %{backups: backups}) do end def download_url(%Backup{file_name: file_name}) do - Pleroma.Web.Endpoint.url() <> "/media/backups/" <> file_name + Pleroma.Upload.base_url() <> "/backups/" <> file_name end end -- cgit v1.2.3 From 3c936061d55c1c4bd9346471bc498dd123395766 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 8 Jan 2021 10:49:12 -0600 Subject: Apply Upload.base_url for S3 --- lib/pleroma/uploaders/s3.ex | 2 +- test/pleroma/uploaders/s3_test.exs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex index 6dbef9085..5a91410d7 100644 --- a/lib/pleroma/uploaders/s3.ex +++ b/lib/pleroma/uploaders/s3.ex @@ -30,7 +30,7 @@ def get_file(file) do {:ok, {:url, Path.join([ - Keyword.fetch!(config, :public_endpoint), + Pleroma.Upload.base_url(), bucket_with_namespace, strict_encode(URI.decode(file)) ])}} diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index e7a013dd8..344cf7abe 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -11,11 +11,16 @@ defmodule Pleroma.Uploaders.S3Test do import Mock import ExUnit.CaptureLog - setup do: - clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com" - ) + setup do + clear_config(Pleroma.Upload, + uploader: Pleroma.Uploaders.S3 + ) + + clear_config(Pleroma.Uploaders.S3, + bucket: "test_bucket", + public_endpoint: "https://s3.amazonaws.com" + ) + end describe "get_file/1" do test "it returns path to local folder for files" do -- cgit v1.2.3 From 530fb5b29ebd414781c703e4b41d204135f3efe7 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 8 Jan 2021 16:43:19 -0600 Subject: Avoid duplicate Config calls --- lib/pleroma/upload.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 101cfec98..3061b2aed 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -233,6 +233,7 @@ defp url_from_spec(_upload, _base_url, {:url, url}), do: url def base_url do uploader = Config.get([Pleroma.Upload, :uploader]) upload_base_url = Config.get([Pleroma.Upload, :base_url]) + public_endpoint = Config.get([uploader, :public_endpoint]) case uploader do Pleroma.Uploaders.Local -> @@ -246,8 +247,8 @@ def base_url do _ -> cond do - !is_nil(Config.get([uploader, :public_endpoint])) -> - Config.get([uploader, :public_endpoint]) + !is_nil(public_endpoint) -> + public_endpoint true -> upload_base_url -- cgit v1.2.3 From 86dcfb4eb990dc8d06f799663264655ce04d0d5d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 8 Jan 2021 17:05:55 -0600 Subject: More places we should be using Upload.base_url --- lib/pleroma/web/media_proxy.ex | 14 ++++++++------ lib/pleroma/web/plugs/uploaded_media.ex | 2 +- lib/pleroma/workers/attachments_cleanup_worker.ex | 10 ++-------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index 2793cabc1..95e3f4231 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -69,7 +69,7 @@ def enabled?, do: Config.get([:media_proxy, :enabled], false) # non-local non-whitelisted URLs through it and be sure that body size constraint is preserved. def preview_enabled?, do: enabled?() and !!Config.get([:media_preview_proxy, :enabled]) - def local?(url), do: String.starts_with?(url, Pleroma.Web.base_url()) + def local?(url), do: String.starts_with?(url, Upload.base_url()) def whitelisted?(url) do %{host: domain} = URI.parse(url) @@ -80,11 +80,13 @@ def whitelisted?(url) do |> Enum.map(&maybe_get_domain_from_url/1) whitelist_domains = - if base_url = Config.get([Upload, :base_url]) do - %{host: base_domain} = URI.parse(base_url) - [base_domain | mediaproxy_whitelist_domains] - else - mediaproxy_whitelist_domains + cond do + Web.base_url() == Upload.base_url() -> + mediaproxy_whitelist_domains + + true -> + %{host: base_domain} = URI.parse(Upload.base_url()) + [base_domain | mediaproxy_whitelist_domains] end domain in whitelist_domains diff --git a/lib/pleroma/web/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex index 94b4c2177..175b4d87d 100644 --- a/lib/pleroma/web/plugs/uploaded_media.ex +++ b/lib/pleroma/web/plugs/uploaded_media.ex @@ -62,7 +62,7 @@ def call(%{request_path: <<"/", @path, "/", file::binary>>} = conn, opts) do def call(conn, _opts), do: conn defp media_is_banned(%{request_path: path} = _conn, {:static_dir, _}) do - MediaProxy.in_banned_urls(Pleroma.Web.base_url() <> path) + MediaProxy.in_banned_urls(Pleroma.Upload.base_url() <> path) end defp media_is_banned(_, {:url, url}), do: MediaProxy.in_banned_urls(url) diff --git a/lib/pleroma/workers/attachments_cleanup_worker.ex b/lib/pleroma/workers/attachments_cleanup_worker.ex index 58226b395..69758e8c1 100644 --- a/lib/pleroma/workers/attachments_cleanup_worker.ex +++ b/lib/pleroma/workers/attachments_cleanup_worker.ex @@ -32,21 +32,15 @@ def perform(%Job{args: %{"op" => "cleanup_attachments", "object" => _object}}), defp do_clean({object_ids, attachment_urls}) do uploader = Pleroma.Config.get([Pleroma.Upload, :uploader]) - prefix = - case Pleroma.Config.get([Pleroma.Upload, :base_url]) do - nil -> "media" - _ -> "" - end - base_url = String.trim_trailing( - Pleroma.Config.get([Pleroma.Upload, :base_url], Pleroma.Web.base_url()), + Pleroma.Upload.base_url(), "/" ) Enum.each(attachment_urls, fn href -> href - |> String.trim_leading("#{base_url}/#{prefix}") + |> String.trim_leading("#{base_url}") |> uploader.delete_file() end) -- cgit v1.2.3 From e8bf060e6e55396e7a0dbb53dacbf470d8f56beb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 8 Jan 2021 17:24:19 -0600 Subject: Move construction of S3 base URL with optional namespace and bucket to Upload.base_url/0 Now we should have a correct base URL for S3 hosted objects throughout the codebase. --- lib/pleroma/upload.ex | 23 +++++++++++++++++++++++ lib/pleroma/uploaders/s3.ex | 16 ---------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 3061b2aed..a52b698bf 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -245,6 +245,29 @@ def base_url do Pleroma.Web.base_url() <> "/media/" end + Pleroma.Uploaders.S3 -> + bucket = Config.get([Pleroma.Uploaders.S3, :bucket]) + + bucket_with_namespace = + cond do + truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) -> + truncated_namespace + + namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) -> + namespace <> ":" <> bucket + + true -> + bucket + end + + cond do + !is_nil(public_endpoint) -> + Path.join([public_endpoint, bucket_with_namespace]) + + true -> + Path.join([upload_base_url, bucket_with_namespace]) + end + _ -> cond do !is_nil(public_endpoint) -> diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex index 5a91410d7..29a1c2861 100644 --- a/lib/pleroma/uploaders/s3.ex +++ b/lib/pleroma/uploaders/s3.ex @@ -12,26 +12,10 @@ defmodule Pleroma.Uploaders.S3 do # links with less strict filenames @impl true def get_file(file) do - config = Config.get([__MODULE__]) - bucket = Keyword.fetch!(config, :bucket) - - bucket_with_namespace = - cond do - truncated_namespace = Keyword.get(config, :truncated_namespace) -> - truncated_namespace - - namespace = Keyword.get(config, :bucket_namespace) -> - namespace <> ":" <> bucket - - true -> - bucket - end - {:ok, {:url, Path.join([ Pleroma.Upload.base_url(), - bucket_with_namespace, strict_encode(URI.decode(file)) ])}} end -- cgit v1.2.3 From fa63f1b55bad4da8d1c8c51e980109ad5352f71e Mon Sep 17 00:00:00 2001 From: feld Date: Sun, 10 Jan 2021 01:34:54 +0000 Subject: Apply 4 suggestion(s) to 2 file(s) --- lib/pleroma/upload.ex | 26 ++++++-------------------- lib/pleroma/web/media_proxy.ex | 13 ++++++------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index a52b698bf..51ca97f41 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -237,13 +237,7 @@ def base_url do case uploader do Pleroma.Uploaders.Local -> - cond do - !is_nil(upload_base_url) -> - upload_base_url - - true -> - Pleroma.Web.base_url() <> "/media/" - end + upload_base_url || Pleroma.Web.base_url() <> "/media/" Pleroma.Uploaders.S3 -> bucket = Config.get([Pleroma.Uploaders.S3, :bucket]) @@ -260,22 +254,14 @@ def base_url do bucket end - cond do - !is_nil(public_endpoint) -> - Path.join([public_endpoint, bucket_with_namespace]) - - true -> - Path.join([upload_base_url, bucket_with_namespace]) + if public_endpoint do + Path.join([public_endpoint, bucket_with_namespace]) + else + Path.join([upload_base_url, bucket_with_namespace]) end _ -> - cond do - !is_nil(public_endpoint) -> - public_endpoint - - true -> - upload_base_url - end + public_endpoint || upload_base_url end end end diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index 95e3f4231..e4d7f8aa8 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -80,13 +80,12 @@ def whitelisted?(url) do |> Enum.map(&maybe_get_domain_from_url/1) whitelist_domains = - cond do - Web.base_url() == Upload.base_url() -> - mediaproxy_whitelist_domains - - true -> - %{host: base_domain} = URI.parse(Upload.base_url()) - [base_domain | mediaproxy_whitelist_domains] + base_url = Upload.base_url() + if Web.base_url() == base_url do + mediaproxy_whitelist_domains + else + %{host: base_domain} = URI.parse(base_url) + [base_domain | mediaproxy_whitelist_domains] end domain in whitelist_domains -- cgit v1.2.3 From 6284e8f4b2e9b737d1ed256e89f2ac3ba673d6f8 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sun, 10 Jan 2021 08:25:36 +0000 Subject: Add development section * I cretaed a folder 'development' * I split up the file dev.md into three parts and moved it to this folder * index.md * authentication_authorization.md * mrf.md * I also moved ap_extensions.md * I created a new file setting_up_pleroma_dev.md --- .gitignore | 2 +- docs/API/admin_api.md | 1565 -------------------- docs/API/chats.md | 255 ---- docs/API/differences_in_mastoapi_responses.md | 346 ----- docs/API/pleroma_api.md | 655 -------- docs/API/prometheus.md | 44 - docs/ap_extensions.md | 65 - docs/configuration/mrf.md | 23 + docs/dev.md | 46 - docs/development/API/admin_api.md | 1565 ++++++++++++++++++++ docs/development/API/chats.md | 255 ++++ .../API/differences_in_mastoapi_responses.md | 346 +++++ docs/development/API/pleroma_api.md | 655 ++++++++ docs/development/API/prometheus.md | 44 + docs/development/ap_extensions.md | 65 + docs/development/authentication_authorization.md | 21 + docs/development/index.md | 1 + docs/development/setting_up_pleroma_dev.md | 70 + docs/installation/alpine_linux_en.md | 2 +- docs/installation/arch_linux_en.md | 2 +- docs/installation/debian_based_en.md | 2 +- docs/installation/debian_based_jp.md | 2 +- docs/installation/freebsd_en.md | 2 +- docs/installation/netbsd_en.md | 2 +- docs/installation/openbsd_en.md | 2 +- docs/installation/openbsd_fi.md | 2 +- ...20190510135645_add_fts_index_to_objects_two.exs | 29 +- 27 files changed, 3077 insertions(+), 2991 deletions(-) delete mode 100644 docs/API/admin_api.md delete mode 100644 docs/API/chats.md delete mode 100644 docs/API/differences_in_mastoapi_responses.md delete mode 100644 docs/API/pleroma_api.md delete mode 100644 docs/API/prometheus.md delete mode 100644 docs/ap_extensions.md delete mode 100644 docs/dev.md create mode 100644 docs/development/API/admin_api.md create mode 100644 docs/development/API/chats.md create mode 100644 docs/development/API/differences_in_mastoapi_responses.md create mode 100644 docs/development/API/pleroma_api.md create mode 100644 docs/development/API/prometheus.md create mode 100644 docs/development/ap_extensions.md create mode 100644 docs/development/authentication_authorization.md create mode 100644 docs/development/index.md create mode 100644 docs/development/setting_up_pleroma_dev.md diff --git a/.gitignore b/.gitignore index 62ca61bce..4dea75e93 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,7 @@ erl_crash.dump # Database setup file, some may forget to delete it -/config/setup_db.psql +/config/setup_db*.psql .DS_Store .env diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md deleted file mode 100644 index 5253dc668..000000000 --- a/docs/API/admin_api.md +++ /dev/null @@ -1,1565 +0,0 @@ -# Admin API - -Authentication is required and the user must be an admin. - -Configuration options: - -* `[:auth, :enforce_oauth_admin_scope_usage]` — OAuth admin scope requirement toggle. - If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token (client app must support admin scopes). - If `false` and token doesn't have admin scope(s), `is_admin` user flag grants access to admin-specific actions. - Note that client app needs to explicitly support admin scopes and request them when obtaining auth token. - -## `GET /api/pleroma/admin/users` - -### List users - -- Query Params: - - *optional* `query`: **string** search term (e.g. nickname, domain, nickname@domain) - - *optional* `filters`: **string** comma-separated string of filters: - - `local`: only local users - - `external`: only external users - - `active`: only active users - - `need_approval`: only unapproved users - - `unconfirmed`: only unconfirmed users - - `deactivated`: only deactivated users - - `is_admin`: users with admin role - - `is_moderator`: users with moderator role - - *optional* `page`: **integer** page number - - *optional* `page_size`: **integer** number of users per page (default is `50`) - - *optional* `tags`: **[string]** tags list - - *optional* `actor_types`: **[string]** actor type list (`Person`, `Service`, `Application`) - - *optional* `name`: **string** user display name - - *optional* `email`: **string** user email -- Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com` -- Response: - -```json -{ - "page_size": integer, - "count": integer, - "users": [ - { - "deactivated": bool, - "id": integer, - "nickname": string, - "roles": { - "admin": bool, - "moderator": bool - }, - "local": bool, - "tags": array, - "avatar": string, - "display_name": string, - "confirmation_pending": bool, - "approval_pending": bool, - "registration_reason": string, - }, - ... - ] -} -``` - -## DEPRECATED `DELETE /api/pleroma/admin/users` - -### Remove a user - -- Params: - - `nickname` -- Response: User’s nickname - -## `DELETE /api/pleroma/admin/users` - -### Remove a user - -- Params: - - `nicknames` -- Response: Array of user nicknames - -### Create a user - -- Method: `POST` -- Params: - `users`: [ - { - `nickname`, - `email`, - `password` - } - ] -- Response: User’s nickname - -## `POST /api/pleroma/admin/users/follow` - -### Make a user follow another user - -- Params: - - `follower`: The nickname of the follower - - `followed`: The nickname of the followed -- Response: - - "ok" - -## `POST /api/pleroma/admin/users/unfollow` - -### Make a user unfollow another user - -- Params: - - `follower`: The nickname of the follower - - `followed`: The nickname of the followed -- Response: - - "ok" - -## `PATCH /api/pleroma/admin/users/:nickname/toggle_activation` - -### Toggle user activation - -- Params: - - `nickname` -- Response: User’s object - -```json -{ - "deactivated": bool, - "id": integer, - "nickname": string -} -``` - -## `PUT /api/pleroma/admin/users/tag` - -### Tag a list of users - -- Params: - - `nicknames` (array) - - `tags` (array) - -## `DELETE /api/pleroma/admin/users/tag` - -### Untag a list of users - -- Params: - - `nicknames` (array) - - `tags` (array) - -## `GET /api/pleroma/admin/users/:nickname/permission_group` - -### Get user user permission groups membership - -- Params: none -- Response: - -```json -{ - "is_moderator": bool, - "is_admin": bool -} -``` - -## `GET /api/pleroma/admin/users/:nickname/permission_group/:permission_group` - -Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist. - -### Get user user permission groups membership per permission group - -- Params: none -- Response: - -```json -{ - "is_moderator": bool, - "is_admin": bool -} -``` - -## DEPRECATED `POST /api/pleroma/admin/users/:nickname/permission_group/:permission_group` - -### Add user to permission group - -- Params: none -- Response: - - On failure: `{"error": "…"}` - - On success: JSON of the user - -## `POST /api/pleroma/admin/users/permission_group/:permission_group` - -### Add users to permission group - -- Params: - - `nicknames`: nicknames array -- Response: - - On failure: `{"error": "…"}` - - On success: JSON of the user - -## DEPRECATED `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group` - -## `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group` - -### Remove user from permission group - -- Params: none -- Response: - - On failure: `{"error": "…"}` - - On success: JSON of the user -- Note: An admin cannot revoke their own admin status. - -## `DELETE /api/pleroma/admin/users/permission_group/:permission_group` - -### Remove users from permission group - -- Params: - - `nicknames`: nicknames array -- Response: - - On failure: `{"error": "…"}` - - On success: JSON of the user -- Note: An admin cannot revoke their own admin status. - -## `PATCH /api/pleroma/admin/users/activate` - -### Activate user - -- Params: - - `nicknames`: nicknames array -- Response: - -```json -{ - users: [ - { - // user object - } - ] -} -``` - -## `PATCH /api/pleroma/admin/users/deactivate` - -### Deactivate user - -- Params: - - `nicknames`: nicknames array -- Response: - -```json -{ - users: [ - { - // user object - } - ] -} -``` - -## `PATCH /api/pleroma/admin/users/approve` - -### Approve user - -- Params: - - `nicknames`: nicknames array -- Response: - -```json -{ - users: [ - { - // user object - } - ] -} -``` - -## `GET /api/pleroma/admin/users/:nickname_or_id` - -### Retrive the details of a user - -- Params: - - `nickname` or `id` -- Response: - - On failure: `Not found` - - On success: JSON of the user - -## `GET /api/pleroma/admin/users/:nickname_or_id/statuses` - -### Retrive user's latest statuses - -- Params: - - `nickname` or `id` - - *optional* `page_size`: number of statuses to return (default is `20`) - - *optional* `godmode`: `true`/`false` – allows to see private statuses - - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) -- Response: - - On failure: `Not found` - - On success: JSON array of user's latest statuses - -## `GET /api/pleroma/admin/instances/:instance/statuses` - -### Retrive instance's latest statuses - -- Params: - - `instance`: instance name - - *optional* `page_size`: number of statuses to return (default is `20`) - - *optional* `godmode`: `true`/`false` – allows to see private statuses - - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) -- Response: - - On failure: `Not found` - - On success: JSON array of instance's latest statuses - -## `GET /api/pleroma/admin/statuses` - -### Retrives all latest statuses - -- Params: - - *optional* `page_size`: number of statuses to return (default is `20`) - - *optional* `local_only`: excludes remote statuses - - *optional* `godmode`: `true`/`false` – allows to see private statuses - - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) -- Response: - - On failure: `Not found` - - On success: JSON array of user's latest statuses - -## `GET /api/pleroma/admin/relay` - -### List Relays - -Params: none -Response: - -* On success: JSON array of relays - -```json -[ - {"actor": "https://example.com/relay", "followed_back": true}, - {"actor": "https://example2.com/relay", "followed_back": false} -] -``` - -## `POST /api/pleroma/admin/relay` - -### Follow a Relay - -Params: - -* `relay_url` - -Response: - -* On success: relay json object - -```json -{"actor": "https://example.com/relay", "followed_back": true} -``` - -## `DELETE /api/pleroma/admin/relay` - -### Unfollow a Relay - -- Params: - - `relay_url` - - *optional* `force`: forcefully unfollow a relay even when the relay is not available. (default is `false`) - -Response: - -* On success: URL of the unfollowed relay - -```json -{"https://example.com/relay"} -``` - -## `POST /api/pleroma/admin/users/invite_token` - -### Create an account registration invite token - -- Params: - - *optional* `max_use` (integer) - - *optional* `expires_at` (date string e.g. "2019-04-07") -- Response: - -```json -{ - "id": integer, - "token": string, - "used": boolean, - "expires_at": date, - "uses": integer, - "max_use": integer, - "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`) -} -``` - -## `GET /api/pleroma/admin/users/invites` - -### Get a list of generated invites - -- Params: none -- Response: - -```json -{ - - "invites": [ - { - "id": integer, - "token": string, - "used": boolean, - "expires_at": date, - "uses": integer, - "max_use": integer, - "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`) - }, - ... - ] -} -``` - -## `POST /api/pleroma/admin/users/revoke_invite` - -### Revoke invite by token - -- Params: - - `token` -- Response: - -```json -{ - "id": integer, - "token": string, - "used": boolean, - "expires_at": date, - "uses": integer, - "max_use": integer, - "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`) - -} -``` - -## `POST /api/pleroma/admin/users/email_invite` - -### Sends registration invite via email - -- Params: - - `email` - - `name`, optional - -- Response: - - On success: `204`, empty response - - On failure: - - 400 Bad Request, JSON: - - ```json - [ - { - "error": "Appropriate error message here" - } - ] - ``` - -## `GET /api/pleroma/admin/users/:nickname/password_reset` - -### Get a password reset token for a given nickname - - -- Params: none -- Response: - -```json -{ - "token": "base64 reset token", - "link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token" -} -``` - -## `PATCH /api/pleroma/admin/users/force_password_reset` - -### Force passord reset for a user with a given nickname - -- Params: - - `nicknames` -- Response: none (code `204`) - -## PUT `/api/pleroma/admin/users/disable_mfa` - -### Disable mfa for user's account. - -- Params: - - `nickname` -- Response: User’s nickname - -## `GET /api/pleroma/admin/users/:nickname/credentials` - -### Get the user's email, password, display and settings-related fields - -- Params: - - `nickname` - -- Response: - -```json -{ - "actor_type": "Person", - "allow_following_move": true, - "avatar": "https://pleroma.social/media/7e8e7508fd545ef580549b6881d80ec0ff2c81ed9ad37b9bdbbdf0e0d030159d.jpg", - "background": "https://pleroma.social/media/4de34c0bd10970d02cbdef8972bef0ebbf55f43cadc449554d4396156162fe9a.jpg", - "banner": "https://pleroma.social/media/8d92ba2bd244b613520abf557dd448adcd30f5587022813ee9dd068945986946.jpg", - "bio": "bio", - "default_scope": "public", - "discoverable": false, - "email": "user@example.com", - "fields": [ - { - "name": "example", - "value": "
https://example.com" - } - ], - "hide_favorites": false, - "hide_followers": false, - "hide_followers_count": false, - "hide_follows": false, - "hide_follows_count": false, - "id": "9oouHaEEUR54hls968", - "locked": true, - "name": "user", - "no_rich_text": true, - "pleroma_settings_store": {}, - "raw_fields": [ - { - "id": 1, - "name": "example", - "value": "https://example.com" - }, - ], - "show_role": true, - "skip_thread_containment": false -} -``` - -## `PATCH /api/pleroma/admin/users/:nickname/credentials` - -### Change the user's email, password, display and settings-related fields - -* Params: - * `email` - * `password` - * `name` - * `bio` - * `avatar` - * `locked` - * `no_rich_text` - * `default_scope` - * `banner` - * `hide_follows` - * `hide_followers` - * `hide_followers_count` - * `hide_follows_count` - * `hide_favorites` - * `allow_following_move` - * `background` - * `show_role` - * `skip_thread_containment` - * `fields` - * `is_discoverable` - * `actor_type` - -* Responses: - -Status: 200 - -```json -{"status": "success"} -``` - -Status: 400 - -```json -{"errors": - {"actor_type": "is invalid"}, - {"email": "has invalid format"}, - ... - } -``` - -Status: 404 - -```json -{"error": "Not found"} -``` - -## `GET /api/pleroma/admin/reports` - -### Get a list of reports - -- Params: - - *optional* `state`: **string** the state of reports. Valid values are `open`, `closed` and `resolved` - - *optional* `limit`: **integer** the number of records to retrieve - - *optional* `page`: **integer** page number - - *optional* `page_size`: **integer** number of log entries per page (default is `50`) -- Response: - - On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin - - On success: JSON, returns a list of reports, where: - - `account`: the user who has been reported - - `actor`: the user who has sent the report - - `statuses`: list of statuses that have been included to the report - -```json -{ - "total" : 1, - "reports": [ - { - "account": { - "acct": "user", - "avatar": "https://pleroma.example.org/images/avi.png", - "avatar_static": "https://pleroma.example.org/images/avi.png", - "bot": false, - "created_at": "2019-04-23T17:32:04.000Z", - "display_name": "User", - "emojis": [], - "fields": [], - "followers_count": 1, - "following_count": 1, - "header": "https://pleroma.example.org/images/banner.png", - "header_static": "https://pleroma.example.org/images/banner.png", - "id": "9i6dAJqSGSKMzLG2Lo", - "locked": false, - "note": "", - "pleroma": { - "confirmation_pending": false, - "hide_favorites": true, - "hide_followers": false, - "hide_follows": false, - "is_admin": false, - "is_moderator": false, - "relationship": {}, - "tags": [] - }, - "source": { - "note": "", - "pleroma": {}, - "sensitive": false - }, - "tags": ["force_unlisted"], - "statuses_count": 3, - "url": "https://pleroma.example.org/users/user", - "username": "user" - }, - "actor": { - "acct": "lain", - "avatar": "https://pleroma.example.org/images/avi.png", - "avatar_static": "https://pleroma.example.org/images/avi.png", - "bot": false, - "created_at": "2019-03-28T17:36:03.000Z", - "display_name": "Roger Braun", - "emojis": [], - "fields": [], - "followers_count": 1, - "following_count": 1, - "header": "https://pleroma.example.org/images/banner.png", - "header_static": "https://pleroma.example.org/images/banner.png", - "id": "9hEkA5JsvAdlSrocam", - "locked": false, - "note": "", - "pleroma": { - "confirmation_pending": false, - "hide_favorites": false, - "hide_followers": false, - "hide_follows": false, - "is_admin": false, - "is_moderator": false, - "relationship": {}, - "tags": [] - }, - "source": { - "note": "", - "pleroma": {}, - "sensitive": false - }, - "tags": ["force_unlisted"], - "statuses_count": 1, - "url": "https://pleroma.example.org/users/lain", - "username": "lain" - }, - "content": "Please delete it", - "created_at": "2019-04-29T19:48:15.000Z", - "id": "9iJGOv1j8hxuw19bcm", - "state": "open", - "statuses": [ - { - "account": { ... }, - "application": { - "name": "Web", - "website": null - }, - "bookmarked": false, - "card": null, - "content": "@lain click on my link https://www.google.com/", - "created_at": "2019-04-23T19:15:47.000Z", - "emojis": [], - "favourited": false, - "favourites_count": 0, - "id": "9i6mQ9uVrrOmOime8m", - "in_reply_to_account_id": null, - "in_reply_to_id": null, - "language": null, - "media_attachments": [], - "mentions": [ - { - "acct": "lain", - "id": "9hEkA5JsvAdlSrocam", - "url": "https://pleroma.example.org/users/lain", - "username": "lain" - }, - { - "acct": "user", - "id": "9i6dAJqSGSKMzLG2Lo", - "url": "https://pleroma.example.org/users/user", - "username": "user" - } - ], - "muted": false, - "pinned": false, - "pleroma": { - "content": { - "text/plain": "@lain click on my link https://www.google.com/" - }, - "conversation_id": 28, - "in_reply_to_account_acct": null, - "local": true, - "spoiler_text": { - "text/plain": "" - } - }, - "reblog": null, - "reblogged": false, - "reblogs_count": 0, - "replies_count": 0, - "sensitive": false, - "spoiler_text": "", - "tags": [], - "uri": "https://pleroma.example.org/objects/8717b90f-8e09-4b58-97b0-e3305472b396", - "url": "https://pleroma.example.org/notice/9i6mQ9uVrrOmOime8m", - "visibility": "direct" - } - ] - } - ] -} -``` - -## `GET /api/pleroma/admin/grouped_reports` - -### Get a list of reports, grouped by status - -- Params: none -- On success: JSON, returns a list of reports, where: - - `date`: date of the latest report - - `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference) - - `status`: reported status (see `/api/pleroma/admin/reports` for reference) - - `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference) - - `reports`: reports (see `/api/pleroma/admin/reports` for reference) - -```json - "reports": [ - { - "date": "2019-10-07T12:31:39.615149Z", - "account": { ... }, - "status": { ... }, - "actors": [{ ... }, { ... }], - "reports": [{ ... }] - } - ] -``` - -## `GET /api/pleroma/admin/reports/:id` - -### Get an individual report - -- Params: - - `id` -- Response: - - On failure: - - 403 Forbidden `{"error": "error_msg"}` - - 404 Not Found `"Not found"` - - On success: JSON, Report object (see above) - -## `PATCH /api/pleroma/admin/reports` - -### Change the state of one or multiple reports - -- Params: - -```json - `reports`: [ - { - `id`, // required, report id - `state` // required, the new state. Valid values are `open`, `closed` and `resolved` - }, - ... - ] -``` - -- Response: - - On failure: - - 400 Bad Request, JSON: - - ```json - [ - { - `id`, // report id - `error` // error message - } - ] - ``` - - - On success: `204`, empty response - -## `POST /api/pleroma/admin/reports/:id/notes` - -### Create report note - -- Params: - - `id`: required, report id - - `content`: required, the message -- Response: - - On failure: - - 400 Bad Request `"Invalid parameters"` when `status` is missing - - On success: `204`, empty response - -## `DELETE /api/pleroma/admin/reports/:report_id/notes/:id` - -### Delete report note - -- Params: - - `report_id`: required, report id - - `id`: required, note id -- Response: - - On failure: - - 400 Bad Request `"Invalid parameters"` when `status` is missing - - On success: `204`, empty response - -## `GET /api/pleroma/admin/statuses/:id` - -### Show status by id - -- Params: - - `id`: required, status id -- Response: - - On failure: - - 404 Not Found `"Not Found"` - - On success: JSON, Mastodon Status entity - -## `PUT /api/pleroma/admin/statuses/:id` - -### Change the scope of an individual reported status - -- Params: - - `id` - - `sensitive`: optional, valid values are `true` or `false` - - `visibility`: optional, valid values are `public`, `private` and `unlisted` -- Response: - - On failure: - - 400 Bad Request `"Unsupported visibility"` - - 403 Forbidden `{"error": "error_msg"}` - - 404 Not Found `"Not found"` - - On success: JSON, Mastodon Status entity - -## `DELETE /api/pleroma/admin/statuses/:id` - -### Delete an individual reported status - -- Params: - - `id` -- Response: - - On failure: - - 403 Forbidden `{"error": "error_msg"}` - - 404 Not Found `"Not found"` - - On success: 200 OK `{}` - -## `GET /api/pleroma/admin/restart` - -### Restarts pleroma application - -**Only works when configuration from database is enabled.** - -- Params: none -- Response: - - On failure: - - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` - -```json -{} -``` - -## `GET /api/pleroma/admin/need_reboot` - -### Returns the flag whether the pleroma should be restarted - -- Params: none -- Response: - - `need_reboot` - boolean -```json -{ - "need_reboot": false -} -``` - -## `GET /api/pleroma/admin/config` - -### Get list of merged default settings with saved in database. - -*If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.* - -**Only works when configuration from database is enabled.** - -- Params: - - `only_db`: true (*optional*, get only saved in database settings) -- Response: - - On failure: - - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` - -```json -{ - "configs": [ - { - "group": ":pleroma", - "key": "Pleroma.Upload", - "value": [] - } - ], - "need_reboot": true -} -``` - -## `POST /api/pleroma/admin/config` - -### Update config settings - -*If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.* - -**Only works when configuration from database is enabled.** - -Some modifications are necessary to save the config settings correctly: - -- strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules; -``` -"Pleroma.Upload" -> Pleroma.Upload -"Oban" -> Oban -``` -- strings starting with `:` will be converted to atoms; -``` -":pleroma" -> :pleroma -``` -- objects with `tuple` key and array value will be converted to tuples; -``` -{"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []} -``` -- arrays with *tuple objects* will be converted to keywords; -``` -[{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"] -``` - -Most of the settings will be applied in `runtime`, this means that you don't need to restart the instance. But some settings are applied in `compile time` and require a reboot of the instance, such as: -- all settings inside these keys: - - `:hackney_pools` - - `:connections_pool` - - `:pools` - - `:chat` -- partially settings inside these keys: - - `:seconds_valid` in `Pleroma.Captcha` - - `:proxy_remote` in `Pleroma.Upload` - - `:upload_limit` in `:instance` - -- Params: - - `configs` - array of config objects - - config object params: - - `group` - string (**required**) - - `key` - string (**required**) - - `value` - string, [], {} or {"tuple": []} (**required**) - - `delete` - true (*optional*, if setting must be deleted) - - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored) - -*When a value have several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.* -``` -[subkey: val1, subkey2: val2, subkey3: val3] \\ initial value -{"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion -[subkey2: val2] \\ value after deletion -``` - -*Most of the settings can be partially updated through merge old values with new values, except settings value of which is list or is not keyword.* - -Example of setting without keyword in value: -```elixir -config :tesla, :adapter, Tesla.Adapter.Hackney -``` - -List of settings which support only full update by key: -```elixir -@full_key_update [ - {:pleroma, :ecto_repos}, - {:quack, :meta}, - {:mime, :types}, - {:cors_plug, [:max_age, :methods, :expose, :headers]}, - {:auto_linker, :opts}, - {:swarm, :node_blacklist}, - {:logger, :backends} - ] -``` - -List of settings which support only full update by subkey: -```elixir -@full_subkey_update [ - {:pleroma, :assets, :mascots}, - {:pleroma, :emoji, :groups}, - {:pleroma, :workers, :retries}, - {:pleroma, :mrf_subchain, :match_actor}, - {:pleroma, :mrf_keyword, :replace} - ] -``` - -*Settings without explicit key must be sended in separate config object params.* -```elixir -config :quack, - level: :debug, - meta: [:all], - ... -``` -```json -{ - "configs": [ - {"group": ":quack", "key": ":level", "value": ":debug"}, - {"group": ":quack", "key": ":meta", "value": [":all"]}, - ... - ] -} -``` -- Request: - -```json -{ - "configs": [ - { - "group": ":pleroma", - "key": "Pleroma.Upload", - "value": [ - {"tuple": [":uploader", "Pleroma.Uploaders.Local"]}, - {"tuple": [":filters", ["Pleroma.Upload.Filter.Dedupe"]]}, - {"tuple": [":link_name", true]}, - {"tuple": [":proxy_remote", false]}, - {"tuple": [":proxy_opts", [ - {"tuple": [":redirect_on_failure", false]}, - {"tuple": [":max_body_length", 1048576]}, - {"tuple": [":http", [ - {"tuple": [":follow_redirect", true]}, - {"tuple": [":pool", ":upload"]}, - ]]} - ] - ]}, - {"tuple": [":dispatch", { - "tuple": ["/api/v1/streaming", "Pleroma.Web.MastodonAPI.WebsocketHandler", []] - }]} - ] - } - ] -} -``` - -- Response: - - On failure: - - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` -```json -{ - "configs": [ - { - "group": ":pleroma", - "key": "Pleroma.Upload", - "value": [...] - } - ], - "need_reboot": true -} -``` - -## ` GET /api/pleroma/admin/config/descriptions` - -### Get JSON with config descriptions. -Loads json generated from `config/descriptions.exs`. - -- Params: none -- Response: - -```json -[{ - "group": ":pleroma", // string - "key": "ModuleName", // string - "type": "group", // string or list with possible values, - "description": "Upload general settings", // string - "children": [ - { - "key": ":uploader", // string or module name `Pleroma.Upload` - "type": "module", - "description": "Module which will be used for uploads", - "suggestions": ["module1", "module2"] - }, - { - "key": ":filters", - "type": ["list", "module"], - "description": "List of filter modules for uploads", - "suggestions": [ - "module1", "module2", "module3" - ] - } - ] -}] -``` - -## `GET /api/pleroma/admin/moderation_log` - -### Get moderation log - -- Params: - - *optional* `page`: **integer** page number - - *optional* `page_size`: **integer** number of log entries per page (default is `50`) - - *optional* `start_date`: **datetime (ISO 8601)** filter logs by creation date, start from `start_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. `2005-08-09T18:31:42` - - *optional* `end_date`: **datetime (ISO 8601)** filter logs by creation date, end by from `end_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. 2005-08-09T18:31:42 - - *optional* `user_id`: **integer** filter logs by actor's id - - *optional* `search`: **string** search logs by the log message -- Response: - -```json -[ - { - "id": 1234, - "data": { - "actor": { - "id": 1, - "nickname": "lain" - }, - "action": "relay_follow" - }, - "time": 1502812026, // timestamp - "message": "[2017-08-15 15:47:06] @nick0 followed relay: https://example.org/relay" // log message - } -] -``` - -## `POST /api/pleroma/admin/reload_emoji` - -### Reload the instance's custom emoji - -- Authentication: required -- Params: None -- Response: JSON, "ok" and 200 status - -## `PATCH /api/pleroma/admin/users/confirm_email` - -### Confirm users' emails - -- Params: - - `nicknames` -- Response: Array of user nicknames - -## `PATCH /api/pleroma/admin/users/resend_confirmation_email` - -### Resend confirmation email - -- Params: - - `nicknames` -- Response: Array of user nicknames - -## `GET /api/pleroma/admin/stats` - -### Stats - -- Query Params: - - *optional* `instance`: **string** instance hostname (without protocol) to get stats for -- Example: `https://mypleroma.org/api/pleroma/admin/stats?instance=lain.com` - -- Response: - -```json -{ - "status_visibility": { - "direct": 739, - "private": 9, - "public": 17, - "unlisted": 14 - } -} -``` - -## `GET /api/pleroma/admin/oauth_app` - -### List OAuth app - -- Params: - - *optional* `name` - - *optional* `client_id` - - *optional* `page` - - *optional* `page_size` - - *optional* `trusted` - -- Response: - -```json -{ - "apps": [ - { - "id": 1, - "name": "App name", - "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk", - "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY", - "redirect_uri": "https://example.com/oauth-callback", - "website": "https://example.com", - "trusted": true - } - ], - "count": 17, - "page_size": 50 -} -``` - - -## `POST /api/pleroma/admin/oauth_app` - -### Create OAuth App - -- Params: - - `name` - - `redirect_uris` - - `scopes` - - *optional* `website` - - *optional* `trusted` - -- Response: - -```json -{ - "id": 1, - "name": "App name", - "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk", - "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY", - "redirect_uri": "https://example.com/oauth-callback", - "website": "https://example.com", - "trusted": true -} -``` - -- On failure: -```json -{ - "redirect_uris": "can't be blank", - "name": "can't be blank" -} -``` - -## `PATCH /api/pleroma/admin/oauth_app/:id` - -### Update OAuth App - -- Params: - - *optional* `name` - - *optional* `redirect_uris` - - *optional* `scopes` - - *optional* `website` - - *optional* `trusted` - -- Response: - -```json -{ - "id": 1, - "name": "App name", - "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk", - "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY", - "redirect_uri": "https://example.com/oauth-callback", - "website": "https://example.com", - "trusted": true -} -``` - -## `DELETE /api/pleroma/admin/oauth_app/:id` - -### Delete OAuth App - -- Params: None - -- Response: - - On success: `204`, empty response - - On failure: - - 400 Bad Request `"Invalid parameters"` when `status` is missing - -## `GET /api/pleroma/admin/media_proxy_caches` - -### Get a list of all banned MediaProxy URLs in Cachex - -- Authentication: required -- Params: -- *optional* `page`: **integer** page number -- *optional* `page_size`: **integer** number of log entries per page (default is `50`) -- *optional* `query`: **string** search term - -- Response: - -``` json -{ - "page_size": integer, - "count": integer, - "urls": [ - "http://example.com/media/a688346.jpg", - "http://example.com/media/fb1f4d.jpg" - ] -} - -``` - -## `POST /api/pleroma/admin/media_proxy_caches/delete` - -### Remove a banned MediaProxy URL from Cachex - -- Authentication: required -- Params: - - `urls` (array) - -- Response: - -``` json -{ } - -``` - -## `POST /api/pleroma/admin/media_proxy_caches/purge` - -### Purge a MediaProxy URL - -- Authentication: required -- Params: - - `urls` (array) - - `ban` (boolean) - -- Response: - -``` json -{ } - -``` - -## GET /api/pleroma/admin/users/:nickname/chats - -### List a user's chats - -- Params: None - -- Response: - -```json -[ - { - "sender": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "receiver": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "id" : "1", - "unread" : 2, - "last_message" : {...}, // The last message in that chat - "updated_at": "2020-04-21T15:11:46.000Z" - } -] -``` - -## GET /api/pleroma/admin/chats/:chat_id - -### View a single chat - -- Params: None - -- Response: - -```json -{ - "sender": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "receiver": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "id" : "1", - "unread" : 2, - "last_message" : {...}, // The last message in that chat - "updated_at": "2020-04-21T15:11:46.000Z" -} -``` - -## GET /api/pleroma/admin/chats/:chat_id/messages - -### List the messages in a chat - -- Params: `max_id`, `min_id` - -- Response: - -```json -[ - { - "account_id": "someflakeid", - "chat_id": "1", - "content": "Check this out :firefox:", - "created_at": "2020-04-21T15:11:46.000Z", - "emojis": [ - { - "shortcode": "firefox", - "static_url": "https://dontbulling.me/emoji/Firefox.gif", - "url": "https://dontbulling.me/emoji/Firefox.gif", - "visible_in_picker": false - } - ], - "id": "13", - "unread": true - }, - { - "account_id": "someflakeid", - "chat_id": "1", - "content": "Whats' up?", - "created_at": "2020-04-21T15:06:45.000Z", - "emojis": [], - "id": "12", - "unread": false - } -] -``` - -## DELETE /api/pleroma/admin/chats/:chat_id/messages/:message_id - -### Delete a single message - -- Params: None - -- Response: - -```json -{ - "account_id": "someflakeid", - "chat_id": "1", - "content": "Check this out :firefox:", - "created_at": "2020-04-21T15:11:46.000Z", - "emojis": [ - { - "shortcode": "firefox", - "static_url": "https://dontbulling.me/emoji/Firefox.gif", - "url": "https://dontbulling.me/emoji/Firefox.gif", - "visible_in_picker": false - } - ], - "id": "13", - "unread": false -} -``` - -## `GET /api/pleroma/admin/instance_document/:document_name` - -### Get an instance document - -- Authentication: required - -- Response: - -Returns the content of the document - -```html -

Instance panel

-``` - -## `PATCH /api/pleroma/admin/instance_document/:document_name` -- Params: - - `file` (the file to be uploaded, using multipart form data.) - -### Update an instance document - -- Authentication: required - -- Response: - -``` json -{ - "url": "https://example.com/instance/panel.html" -} -``` - -## `DELETE /api/pleroma/admin/instance_document/:document_name` - -### Delete an instance document - -- Response: - -``` json -{ - "url": "https://example.com/instance/panel.html" -} -``` - -## `GET /api/pleroma/admin/frontends - -### List available frontends - -- Response: - -```json -[ - { - "build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build", - "git": "https://git.pleroma.social/pleroma/fedi-fe", - "installed": true, - "name": "fedi-fe", - "ref": "master" - }, - { - "build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build", - "git": "https://git.pleroma.social/lambadalambda/kenoma", - "installed": false, - "name": "kenoma", - "ref": "master" - } -] -``` - -## `POST /api/pleroma/admin/frontends/install` - -### Install a frontend - -- Params: - - `name`: frontend name, required - - `ref`: frontend ref - - `file`: path to a frontend zip file - - `build_url`: build URL - - `build_dir`: build directory - -- Response: - -```json -[ - { - "build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build", - "git": "https://git.pleroma.social/pleroma/fedi-fe", - "installed": true, - "name": "fedi-fe", - "ref": "master" - }, - { - "build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build", - "git": "https://git.pleroma.social/lambadalambda/kenoma", - "installed": false, - "name": "kenoma", - "ref": "master" - } -] -``` - -```json -{ - "error": "Could not install frontend" -} -``` diff --git a/docs/API/chats.md b/docs/API/chats.md deleted file mode 100644 index f50144c86..000000000 --- a/docs/API/chats.md +++ /dev/null @@ -1,255 +0,0 @@ -# Chats - -Chats are a way to represent an IM-style conversation between two actors. They are not the same as direct messages and they are not `Status`es, even though they have a lot in common. - -## Why Chats? - -There are no 'visibility levels' in ActivityPub, their definition is purely a Mastodon convention. Direct Messaging between users on the fediverse has mostly been modeled by using ActivityPub addressing following Mastodon conventions on normal `Note` objects. In this case, a 'direct message' would be a message that has no followers addressed and also does not address the special public actor, but just the recipients in the `to` field. It would still be a `Note` and is presented with other `Note`s as a `Status` in the API. - -This is an awkward setup for a few reasons: - -- As DMs generally still follow the usual `Status` conventions, it is easy to accidentally pull somebody into a DM thread by mentioning them. (e.g. "I hate @badguy so much") -- It is possible to go from a publicly addressed `Status` to a DM reply, back to public, then to a 'followers only' reply, and so on. This can be become very confusing, as it is unclear which user can see which part of the conversation. -- The standard `Status` format of implicit addressing also leads to rather ugly results if you try to display the messages as a chat, because all the recipients are always mentioned by name in the message. -- As direct messages are posted with the same api call (and usually same frontend component) as public messages, accidentally making a public message private or vice versa can happen easily. Client bugs can also lead to this, accidentally making private messages public. - -As a measure to improve this situation, the `Conversation` concept and related Pleroma extensions were introduced. While it made it possible to work around a few of the issues, many of the problems remained and it didn't see much adoption because it was too complicated to use correctly. - -## Chats explained -For this reasons, Chats are a new and different entity, both in the API as well as in ActivityPub. A quick overview: - -- Chats are meant to represent an instant message conversation between two actors. For now these are only 1-on-1 conversations, but the other actor can be a group in the future. -- Chat messages have the ActivityPub type `ChatMessage`. They are not `Note`s. Servers that don't understand them will just drop them. -- The only addressing allowed in `ChatMessage`s is one single ActivityPub actor in the `to` field. -- There's always only one Chat between two actors. If you start chatting with someone and later start a 'new' Chat, the old Chat will be continued. -- `ChatMessage`s are posted with a different api, making it very hard to accidentally send a message to the wrong person. -- `ChatMessage`s don't show up in the existing timelines. -- Chats can never go from private to public. They are always private between the two actors. - -## Caveats - -- Chats are NOT E2E encrypted (yet). Security is still the same as email. - -## API - -In general, the way to send a `ChatMessage` is to first create a `Chat`, then post a message to that `Chat`. `Group`s will later be supported by making them a sub-type of `Account`. - -This is the overview of using the API. The API is also documented via OpenAPI, so you can view it and play with it by pointing SwaggerUI or a similar OpenAPI tool to `https://yourinstance.tld/api/openapi`. - -### Creating or getting a chat. - -To create or get an existing Chat for a certain recipient (identified by Account ID) -you can call: - -`POST /api/v1/pleroma/chats/by-account-id/:account_id` - -The account id is the normal FlakeId of the user -``` -POST /api/v1/pleroma/chats/by-account-id/someflakeid -``` - -If you already have the id of a chat, you can also use - -``` -GET /api/v1/pleroma/chats/:id -``` - -There will only ever be ONE Chat for you and a given recipient, so this call -will return the same Chat if you already have one with that user. - -Returned data: - -```json -{ - "account": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "id" : "1", - "unread" : 2, - "last_message" : {...}, // The last message in that chat - "updated_at": "2020-04-21T15:11:46.000Z" -} -``` - -### Marking a chat as read - -To mark a number of messages in a chat up to a certain message as read, you can use - -`POST /api/v1/pleroma/chats/:id/read` - - -Parameters: -- last_read_id: Given this id, all chat messages until this one will be marked as read. Required. - - -Returned data: - -```json -{ - "account": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "id" : "1", - "unread" : 0, - "updated_at": "2020-04-21T15:11:46.000Z" -} -``` - -### Marking a single chat message as read - -To set the `unread` property of a message to `false` - -`POST /api/v1/pleroma/chats/:id/messages/:message_id/read` - -Returned data: - -The modified chat message - -### Getting a list of Chats - -`GET /api/v1/pleroma/chats` - -This will return a list of chats that you have been involved in, sorted by their -last update (so new chats will be at the top). - -Parameters: - -- with_muted: Include chats from muted users (boolean). - -Returned data: - -```json -[ - { - "account": { - "id": "someflakeid", - "username": "somenick", - ... - }, - "id" : "1", - "unread" : 2, - "last_message" : {...}, // The last message in that chat - "updated_at": "2020-04-21T15:11:46.000Z" - } -] -``` - -The recipient of messages that are sent to this chat is given by their AP ID. -No pagination is implemented for now. - -### Getting the messages for a Chat - -For a given Chat id, you can get the associated messages with - -`GET /api/v1/pleroma/chats/:id/messages` - -This will return all messages, sorted by most recent to least recent. The usual -pagination options are implemented. - -Returned data: - -```json -[ - { - "account_id": "someflakeid", - "chat_id": "1", - "content": "Check this out :firefox:", - "created_at": "2020-04-21T15:11:46.000Z", - "emojis": [ - { - "shortcode": "firefox", - "static_url": "https://dontbulling.me/emoji/Firefox.gif", - "url": "https://dontbulling.me/emoji/Firefox.gif", - "visible_in_picker": false - } - ], - "id": "13", - "unread": true - }, - { - "account_id": "someflakeid", - "chat_id": "1", - "content": "Whats' up?", - "created_at": "2020-04-21T15:06:45.000Z", - "emojis": [], - "id": "12", - "unread": false, - "idempotency_key": "75442486-0874-440c-9db1-a7006c25a31f" - } -] -``` - -- idempotency_key: The copy of the `idempotency-key` HTTP request header that can be used for optimistic message sending. Included only during the first few minutes after the message creation. - -### Posting a chat message - -Posting a chat message for given Chat id works like this: - -`POST /api/v1/pleroma/chats/:id/messages` - -Parameters: -- content: The text content of the message. Optional if media is attached. -- media_id: The id of an upload that will be attached to the message. - -Currently, no formatting beyond basic escaping and emoji is implemented. - -Returned data: - -```json -{ - "account_id": "someflakeid", - "chat_id": "1", - "content": "Check this out :firefox:", - "created_at": "2020-04-21T15:11:46.000Z", - "emojis": [ - { - "shortcode": "firefox", - "static_url": "https://dontbulling.me/emoji/Firefox.gif", - "url": "https://dontbulling.me/emoji/Firefox.gif", - "visible_in_picker": false - } - ], - "id": "13", - "unread": false -} -``` - -### Deleting a chat message - -Deleting a chat message for given Chat id works like this: - -`DELETE /api/v1/pleroma/chats/:chat_id/messages/:message_id` - -Returned data is the deleted message. - -### Notifications - -There's a new `pleroma:chat_mention` notification, which has this form. It is not given out in the notifications endpoint by default, you need to explicitly request it with `include_types[]=pleroma:chat_mention`: - -```json -{ - "id": "someid", - "type": "pleroma:chat_mention", - "account": { ... } // User account of the sender, - "chat_message": { - "chat_id": "1", - "id": "10", - "content": "Hello", - "account_id": "someflakeid", - "unread": false - }, - "created_at": "somedate" -} -``` - -### Streaming - -There is an additional `user:pleroma_chat` stream. Incoming chat messages will make the current chat be sent to this `user` stream. The `event` of an incoming chat message is `pleroma:chat_update`. The payload is the updated chat with the incoming chat message in the `last_message` field. - -### Web Push - -If you want to receive push messages for this type, you'll need to add the `pleroma:chat_mention` type to your alerts in the push subscription. diff --git a/docs/API/differences_in_mastoapi_responses.md b/docs/API/differences_in_mastoapi_responses.md deleted file mode 100644 index 84430408b..000000000 --- a/docs/API/differences_in_mastoapi_responses.md +++ /dev/null @@ -1,346 +0,0 @@ -# Differences in Mastodon API responses from vanilla Mastodon - -A Pleroma instance can be identified by " (compatible; Pleroma )" present in `version` field in response from `/api/v1/instance` - -## Flake IDs - -Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However, just like Mastodon's ids, they are lexically sortable strings - -## Timelines - -Adding the parameter `with_muted=true` to the timeline queries will also return activities by muted (not by blocked!) users. - -Adding the parameter `exclude_visibilities` to the timeline queries will exclude the statuses with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`), e.g., `exclude_visibilities[]=direct&exclude_visibilities[]=private`. - -Adding the parameter `reply_visibility` to the public and home timelines queries will filter replies. Possible values: without parameter (default) shows all replies, `following` - replies directed to you or users you follow, `self` - replies directed to you. - -Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance). - -## Statuses - -- `visibility`: has additional possible values `list` and `local` (for local-only statuses) - -Has these additional fields under the `pleroma` object: - -- `local`: true if the post was made on the local instance -- `conversation_id`: the ID of the AP context the status is associated with (if any) -- `direct_conversation_id`: the ID of the Mastodon direct message conversation the status is associated with (if any) -- `in_reply_to_account_acct`: the `acct` property of User entity for replied user (if any) -- `content`: a map consisting of alternate representations of the `content` property with the key being its mimetype. Currently, the only alternate representation supported is `text/plain` -- `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being its mimetype. Currently, the only alternate representation supported is `text/plain` -- `expires_at`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire -- `thread_muted`: true if the thread the post belongs to is muted -- `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint. -- `parent_visible`: If the parent of this post is visible to the user or not. - -## Media Attachments - -Has these additional fields under the `pleroma` object: - -- `mime_type`: mime type of the attachment. - -### Attachment cap - -Some apps operate under the assumption that no more than 4 attachments can be returned or uploaded. Pleroma however does not enforce any limits on attachment count neither when returning the status object nor when posting. - -### Limitations - -Pleroma does not process remote images and therefore cannot include fields such as `meta` and `blurhash`. It does not support focal points or aspect ratios. The frontend is expected to handle it. - -## Accounts - -The `id` parameter can also be the `nickname` of the user. This only works in these endpoints, not the deeper nested ones for following etc. - -- `/api/v1/accounts/:id` -- `/api/v1/accounts/:id/statuses` - -Has these additional fields under the `pleroma` object: - -- `ap_id`: nullable URL string, ActivityPub id of the user -- `background_image`: nullable URL string, background image of the user -- `tags`: Lists an array of tags for the user -- `relationship` (object): Includes fields as documented for Mastodon API https://docs.joinmastodon.org/entities/relationship/ -- `is_moderator`: boolean, nullable, true if user is a moderator -- `is_admin`: boolean, nullable, true if user is an admin -- `confirmation_pending`: boolean, true if a new user account is waiting on email confirmation to be activated -- `hide_favorites`: boolean, true when the user has hiding favorites enabled -- `hide_followers`: boolean, true when the user has follower hiding enabled -- `hide_follows`: boolean, true when the user has follow hiding enabled -- `hide_followers_count`: boolean, true when the user has follower stat hiding enabled -- `hide_follows_count`: boolean, true when the user has follow stat hiding enabled -- `settings_store`: A generic map of settings for frontends. Opaque to the backend. Only returned in `/api/v1/accounts/verify_credentials` and `/api/v1/accounts/update_credentials` -- `chat_token`: The token needed for Pleroma chat. Only returned in `/api/v1/accounts/verify_credentials` -- `deactivated`: boolean, true when the user is deactivated -- `allow_following_move`: boolean, true when the user allows automatically follow moved following accounts -- `unread_conversation_count`: The count of unread conversations. Only returned to the account owner. -- `unread_notifications_count`: The count of unread notifications. Only returned to the account owner. -- `notification_settings`: object, can be absent. See `/api/pleroma/notification_settings` for the parameters/keys returned. -- `accepts_chat_messages`: boolean, but can be null if we don't have that information about a user -- `favicon`: nullable URL string, Favicon image of the user's instance - -### Source - -Has these additional fields under the `pleroma` object: - -- `show_role`: boolean, nullable, true when the user wants his role (e.g admin, moderator) to be shown -- `no_rich_text` - boolean, nullable, true when html tags are stripped from all statuses requested from the API -- `discoverable`: boolean, true when the user allows external services (search bots) etc. to index / list the account (regardless of this setting, user will still appear in regular search results) -- `actor_type`: string, the type of this account. - -## Conversations - -Has an additional field under the `pleroma` object: - -- `recipients`: The list of the recipients of this Conversation. These will be addressed when replying to this conversation. - -## GET `/api/v1/conversations` - -Accepts additional parameters: - -- `recipients`: Only return conversations with the given recipients (a list of user ids). Usage example: `GET /api/v1/conversations?recipients[]=1&recipients[]=2` - -## Account Search - -Behavior has changed: - -- `/api/v1/accounts/search`: Does not require authentication - -## Search (global) - -Unlisted posts are available in search results, they are considered to be public posts that shouldn't be shown in local/federated timeline. - -## Notifications - -Has these additional fields under the `pleroma` object: - -- `is_seen`: true if the notification was read by the user - -### Move Notification - -The `type` value is `move`. Has an additional field: - -- `target`: new account - -### EmojiReact Notification - -The `type` value is `pleroma:emoji_reaction`. Has these fields: - -- `emoji`: The used emoji -- `account`: The account of the user who reacted -- `status`: The status that was reacted on - -### ChatMention Notification (not default) - -This notification has to be requested explicitly. - -The `type` value is `pleroma:chat_mention` - -- `account`: The account who sent the message -- `chat_message`: The chat message - -### Report Notification (not default) - -This notification has to be requested explicitly. - -The `type` value is `pleroma:report` - -- `account`: The account who reported -- `report`: The report - -## GET `/api/v1/notifications` - -Accepts additional parameters: - -- `exclude_visibilities`: will exclude the notifications for activities with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`). Usage example: `GET /api/v1/notifications?exclude_visibilities[]=direct&exclude_visibilities[]=private`. -- `include_types`: will include the notifications for activities with the given types. The parameter accepts an array of types (`mention`, `follow`, `reblog`, `favourite`, `move`, `pleroma:emoji_reaction`, `pleroma:chat_mention`, `pleroma:report`). Usage example: `GET /api/v1/notifications?include_types[]=mention&include_types[]=reblog`. - -## DELETE `/api/v1/notifications/destroy_multiple` - -An endpoint to delete multiple statuses by IDs. - -Required parameters: - -- `ids`: array of activity ids - -Usage example: `DELETE /api/v1/notifications/destroy_multiple/?ids[]=1&ids[]=2`. - -Returns on success: 200 OK `{}` - -## POST `/api/v1/statuses` - -Additional parameters can be added to the JSON body/Form data: - -- `preview`: boolean, if set to `true` the post won't be actually posted, but the status entity would still be rendered back. This could be useful for previewing rich text/custom emoji, for example. -- `content_type`: string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the nodeinfo endpoint. -- `to`: A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for post visibility are not affected by this and will still apply. -- `visibility`: string, besides standard MastoAPI values (`direct`, `private`, `unlisted`, `local` or `public`) it can be used to address a List by setting it to `list:LIST_ID`. -- `expires_in`: The number of seconds the posted activity should expire in. When a posted activity expires it will be deleted from the server, and a delete request for it will be federated. This needs to be longer than an hour. -- `in_reply_to_conversation_id`: Will reply to a given conversation, addressing only the people who are part of the recipient set of that conversation. Sets the visibility to `direct`. - -## GET `/api/v1/statuses` - -An endpoint to get multiple statuses by IDs. - -Required parameters: - -- `ids`: array of activity ids - -Usage example: `GET /api/v1/statuses/?ids[]=1&ids[]=2`. - -Returns: array of Status. - -The maximum number of statuses is limited to 100 per request. - -## PATCH `/api/v1/accounts/update_credentials` - -Additional parameters can be added to the JSON body/Form data: - -- `no_rich_text` - if true, html tags are stripped from all statuses requested from the API -- `hide_followers` - if true, user's followers will be hidden -- `hide_follows` - if true, user's follows will be hidden -- `hide_followers_count` - if true, user's follower count will be hidden -- `hide_follows_count` - if true, user's follow count will be hidden -- `hide_favorites` - if true, user's favorites timeline will be hidden -- `show_role` - if true, user's role (e.g admin, moderator) will be exposed to anyone in the API -- `default_scope` - the scope returned under `privacy` key in Source subentity -- `pleroma_settings_store` - Opaque user settings to be saved on the backend. -- `skip_thread_containment` - if true, skip filtering out broken threads -- `allow_following_move` - if true, allows automatically follow moved following accounts -- `also_known_as` - array of ActivityPub IDs, needed for following move -- `pleroma_background_image` - sets the background image of the user. Can be set to "" (an empty string) to reset. -- `discoverable` - if true, external services (search bots) etc. are allowed to index / list the account (regardless of this setting, user will still appear in regular search results). -- `actor_type` - the type of this account. -- `accepts_chat_messages` - if false, this account will reject all chat messages. - -All images (avatar, banner and background) can be reset to the default by sending an empty string ("") instead of a file. - -### Pleroma Settings Store - -Pleroma has mechanism that allows frontends to save blobs of json for each user on the backend. This can be used to save frontend-specific settings for a user that the backend does not need to know about. - -The parameter should have a form of `{frontend_name: {...}}`, with `frontend_name` identifying your type of client, e.g. `pleroma_fe`. It will overwrite everything under this property, but will not overwrite other frontend's settings. - -This information is returned in the `/api/v1/accounts/verify_credentials` endpoint. - -## Authentication - -*Pleroma supports refreshing tokens.* - -`POST /oauth/token` - -Post here request with `grant_type=refresh_token` to obtain new access token. Returns an access token. - -## Account Registration - -`POST /api/v1/accounts` - -Has these additional parameters (which are the same as in Pleroma-API): - -- `fullname`: optional -- `bio`: optional -- `captcha_solution`: optional, contains provider-specific captcha solution, -- `captcha_token`: optional, contains provider-specific captcha token -- `captcha_answer_data`: optional, contains provider-specific captcha data -- `token`: invite token required when the registrations aren't public. - -## Instance - -`GET /api/v1/instance` has additional fields - -- `max_toot_chars`: The maximum characters per post -- `chat_limit`: The maximum characters per chat message -- `description_limit`: The maximum characters per image description -- `poll_limits`: The limits of polls -- `upload_limit`: The maximum upload file size -- `avatar_upload_limit`: The same for avatars -- `background_upload_limit`: The same for backgrounds -- `banner_upload_limit`: The same for banners -- `background_image`: A background image that frontends can use -- `pleroma.metadata.features`: A list of supported features -- `pleroma.metadata.federation`: The federation restrictions of this instance -- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields. -- `pleroma.metadata.post_formats`: A list of the allowed post format types -- `vapid_public_key`: The public key needed for push messages - -## Push Subscription - -`POST /api/v1/push/subscription` -`PUT /api/v1/push/subscription` - -Permits these additional alert types: - -- pleroma:chat_mention -- pleroma:emoji_reaction - -## Markers - -Has these additional fields under the `pleroma` object: - -- `unread_count`: contains number unread notifications - -## Streaming - -### Chats - -There is an additional `user:pleroma_chat` stream. Incoming chat messages will make the current chat be sent to this `user` stream. The `event` of an incoming chat message is `pleroma:chat_update`. The payload is the updated chat with the incoming chat message in the `last_message` field. - -### Remote timelines - -For viewing remote server timelines, there are `public:remote` and `public:remote:media` streams. Each of these accept a parameter like `?instance=lain.com`. - -### Follow relationships updates - -Pleroma streams follow relationships updates as `pleroma:follow_relationships_update` events to the `user` stream. - -The message payload consist of: - -- `state`: a relationship state, one of `follow_pending`, `follow_accept` or `follow_reject`. - -- `follower` and `following` maps with following fields: - - `id`: user ID - - `follower_count`: follower count - - `following_count`: following count - -## User muting and thread muting - -Both user muting and thread muting can be done for only a certain time by adding an `expires_in` parameter to the API calls and giving the expiration time in seconds. - -## Not implemented - -Pleroma is generally compatible with the Mastodon 2.7.2 API, but some newer features and non-essential features are omitted. These features usually return an HTTP 200 status code, but with an empty response. While they may be added in the future, they are considered low priority. - -### Suggestions - -*Added in Mastodon 2.4.3* - -- `GET /api/v1/suggestions`: Returns an empty array, `[]` - -### Trends - -*Added in Mastodon 3.0.0* - -- `GET /api/v1/trends`: Returns an empty array, `[]` - -### Identity proofs - -*Added in Mastodon 2.8.0* - -- `GET /api/v1/identity_proofs`: Returns an empty array, `[]` - -### Endorsements - -*Added in Mastodon 2.5.0* - -- `GET /api/v1/endorsements`: Returns an empty array, `[]` - -### Profile directory - -*Added in Mastodon 3.0.0* - -- `GET /api/v1/directory`: Returns HTTP 404 - -### Featured tags - -*Added in Mastodon 3.0.0* - -- `GET /api/v1/featured_tags`: Returns HTTP 404 diff --git a/docs/API/pleroma_api.md b/docs/API/pleroma_api.md deleted file mode 100644 index d8790ca32..000000000 --- a/docs/API/pleroma_api.md +++ /dev/null @@ -1,655 +0,0 @@ -# Pleroma API - -Requests that require it can be authenticated with [an OAuth token](https://tools.ietf.org/html/rfc6749), the `_pleroma_key` cookie, or [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization). - -Request parameters can be passed via [query strings](https://en.wikipedia.org/wiki/Query_string) or as [form data](https://www.w3.org/TR/html401/interact/forms.html). Files must be uploaded as `multipart/form-data`. - -## `/api/pleroma/emoji` -### Lists the custom emoji on that server. -* Method: `GET` -* Authentication: not required -* Params: none -* Response: JSON -* Example response: -```json -{ - "girlpower": { - "tags": [ - "Finmoji" - ], - "image_url": "/finmoji/128px/girlpower-128.png" - }, - "education": { - "tags": [ - "Finmoji" - ], - "image_url": "/finmoji/128px/education-128.png" - }, - "finnishlove": { - "tags": [ - "Finmoji" - ], - "image_url": "/finmoji/128px/finnishlove-128.png" - } -} -``` -* Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format - -## `/api/pleroma/follow_import` -### Imports your follows, for example from a Mastodon CSV file. -* Method: `POST` -* Authentication: required -* Params: - * `list`: STRING or FILE containing a whitespace-separated list of accounts to follow -* Response: HTTP 200 on success, 500 on error -* Note: Users that can't be followed are silently skipped. - -## `/api/pleroma/blocks_import` -### Imports your blocks. -* Method: `POST` -* Authentication: required -* Params: - * `list`: STRING or FILE containing a whitespace-separated list of accounts to block -* Response: HTTP 200 on success, 500 on error - -## `/api/pleroma/mutes_import` -### Imports your mutes. -* Method: `POST` -* Authentication: required -* Params: - * `list`: STRING or FILE containing a whitespace-separated list of accounts to mute -* Response: HTTP 200 on success, 500 on error - -## `/api/pleroma/captcha` -### Get a new captcha -* Method: `GET` -* Authentication: not required -* Params: none -* Response: Provider specific JSON, the only guaranteed parameter is `type` -* Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint", "seconds_valid": 300}` - -## `/api/pleroma/delete_account` -### Delete an account -* Method `POST` -* Authentication: required -* Params: - * `password`: user's password -* Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise -* Example response: `{"error": "Invalid password."}` - -## `/api/pleroma/disable_account` -### Disable an account -* Method `POST` -* Authentication: required -* Params: - * `password`: user's password -* Response: JSON. Returns `{"status": "success"}` if the account was successfully disabled, `{"error": "[error message]"}` otherwise -* Example response: `{"error": "Invalid password."}` - -## `/api/pleroma/accounts/mfa` -#### Gets current MFA settings -* method: `GET` -* Authentication: required -* OAuth scope: `read:security` -* Response: JSON. Returns `{"enabled": "false", "totp": false }` - -## `/api/pleroma/accounts/mfa/setup/totp` -#### Pre-setup the MFA/TOTP method -* method: `GET` -* Authentication: required -* OAuth scope: `write:security` -* Response: JSON. Returns `{"key": [secret_key], "provisioning_uri": "[qr code uri]" }` when successful, otherwise returns HTTP 422 `{"error": "error_msg"}` - -## `/api/pleroma/accounts/mfa/confirm/totp` -#### Confirms & enables MFA/TOTP support for user account. -* method: `POST` -* Authentication: required -* OAuth scope: `write:security` -* Params: - * `password`: user's password - * `code`: token from TOTP App -* Response: JSON. Returns `{}` if the enable was successful, HTTP 422 `{"error": "[error message]"}` otherwise - - -## `/api/pleroma/accounts/mfa/totp` -#### Disables MFA/TOTP method for user account. -* method: `DELETE` -* Authentication: required -* OAuth scope: `write:security` -* Params: - * `password`: user's password -* Response: JSON. Returns `{}` if the disable was successful, HTTP 422 `{"error": "[error message]"}` otherwise -* Example response: `{"error": "Invalid password."}` - -## `/api/pleroma/accounts/mfa/backup_codes` -#### Generstes backup codes MFA for user account. -* method: `GET` -* Authentication: required -* OAuth scope: `write:security` -* Response: JSON. Returns `{"codes": codes}`when successful, otherwise HTTP 422 `{"error": "[error message]"}` - -## `/api/pleroma/admin/` -See [Admin-API](admin_api.md) - -## `/api/v1/pleroma/notifications/read` -### Mark notifications as read -* Method `POST` -* Authentication: required -* Params (mutually exclusive): - * `id`: a single notification id to read - * `max_id`: read all notifications up to this id -* Response: Notification entity/Array of Notification entities that were read. In case of `max_id`, only the first 80 read notifications will be returned. - -## `/api/v1/pleroma/accounts/:id/subscribe` -### Subscribe to receive notifications for all statuses posted by a user -* Method `POST` -* Authentication: required -* Params: - * `id`: account id to subscribe to -* Response: JSON, returns a mastodon relationship object on success, otherwise returns `{"error": "error_msg"}` -* Example response: -```json -{ - "id": "abcdefg", - "following": true, - "followed_by": false, - "blocking": false, - "muting": false, - "muting_notifications": false, - "subscribing": true, - "requested": false, - "domain_blocking": false, - "showing_reblogs": true, - "endorsed": false -} -``` - -## `/api/v1/pleroma/accounts/:id/unsubscribe` -### Unsubscribe to stop receiving notifications from user statuses -* Method `POST` -* Authentication: required -* Params: - * `id`: account id to unsubscribe from -* Response: JSON, returns a mastodon relationship object on success, otherwise returns `{"error": "error_msg"}` -* Example response: -```json -{ - "id": "abcdefg", - "following": true, - "followed_by": false, - "blocking": false, - "muting": false, - "muting_notifications": false, - "subscribing": false, - "requested": false, - "domain_blocking": false, - "showing_reblogs": true, - "endorsed": false -} -``` - -## `/api/v1/pleroma/accounts/:id/favourites` -### Returns favorites timeline of any user -* Method `GET` -* Authentication: not required -* Params: - * `id`: the id of the account for whom to return results - * `limit`: optional, the number of records to retrieve - * `since_id`: optional, returns results that are more recent than the specified id - * `max_id`: optional, returns results that are older than the specified id -* Response: JSON, returns a list of Mastodon Status entities on success, otherwise returns `{"error": "error_msg"}` -* Example response: -```json -[ - { - "account": { - "id": "9hptFmUF3ztxYh3Svg", - "url": "https://pleroma.example.org/users/nick2", - "username": "nick2", - ... - }, - "application": {"name": "Web", "website": null}, - "bookmarked": false, - "card": null, - "content": "This is :moominmamma: note 0", - "created_at": "2019-04-15T15:42:15.000Z", - "emojis": [], - "favourited": false, - "favourites_count": 1, - "id": "9hptFmVJ02khbzYJaS", - "in_reply_to_account_id": null, - "in_reply_to_id": null, - "language": null, - "media_attachments": [], - "mentions": [], - "muted": false, - "pinned": false, - "pleroma": { - "content": {"text/plain": "This is :moominmamma: note 0"}, - "conversation_id": 13679, - "local": true, - "spoiler_text": {"text/plain": "2hu"} - }, - "reblog": null, - "reblogged": false, - "reblogs_count": 0, - "replies_count": 0, - "sensitive": false, - "spoiler_text": "2hu", - "tags": [{"name": "2hu", "url": "/tag/2hu"}], - "uri": "https://pleroma.example.org/objects/198ed2a1-7912-4482-b559-244a0369e984", - "url": "https://pleroma.example.org/notice/9hptFmVJ02khbzYJaS", - "visibility": "public" - } -] -``` - -## `/api/v1/pleroma/accounts/update_*` -### Set and clear account avatar, banner, and background - -- PATCH `/api/v1/pleroma/accounts/update_avatar`: Set/clear user avatar image -- PATCH `/api/v1/pleroma/accounts/update_banner`: Set/clear user banner image -- PATCH `/api/v1/pleroma/accounts/update_background`: Set/clear user background image - -## `/api/v1/pleroma/accounts/confirmation_resend` -### Resend confirmation email -* Method `POST` -* Params: - * `email`: email of that needs to be verified -* Authentication: not required -* Response: 204 No Content - -## `/api/v1/pleroma/mascot` -### Gets user mascot image -* Method `GET` -* Authentication: required - -* Response: JSON. Returns a mastodon media attachment entity. -* Example response: -```json -{ - "id": "abcdefg", - "url": "https://pleroma.example.org/media/abcdefg.png", - "type": "image", - "pleroma": { - "mime_type": "image/png" - } -} -``` - -### Updates user mascot image -* Method `PUT` -* Authentication: required -* Params: - * `file`: Multipart image -* Response: JSON. Returns a mastodon media attachment entity - when successful, otherwise returns HTTP 415 `{"error": "error_msg"}` -* Example response: -```json -{ - "id": "abcdefg", - "url": "https://pleroma.example.org/media/abcdefg.png", - "type": "image", - "pleroma": { - "mime_type": "image/png" - } -} -``` -* Note: Behaves exactly the same as `POST /api/v1/upload`. - Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`. - -## `/api/pleroma/notification_settings` -### Updates user notification settings -* Method `PUT` -* Authentication: required -* Params: - * `block_from_strangers`: BOOLEAN field, blocks notifications from accounts you do not follow - * `hide_notification_contents`: BOOLEAN field. When set to true, it removes the contents of a message from the push notification. -* Response: JSON. Returns `{"status": "success"}` if the update was successful, otherwise returns `{"error": "error_msg"}` - -## `/api/pleroma/healthcheck` -### Healthcheck endpoint with additional system data. -* Method `GET` -* Authentication: not required -* Params: none -* Response: JSON, statuses (200 - healthy, 503 unhealthy). -* Example response: -```json -{ - "pool_size": 0, # database connection pool - "active": 0, # active processes - "idle": 0, # idle processes - "memory_used": 0.00, # Memory used - "healthy": true, # Instance state - "job_queue_stats": {} # Job queue stats -} -``` - -## `/api/pleroma/change_email` -### Change account email -* Method `POST` -* Authentication: required -* Params: - * `password`: user's password - * `email`: new email -* Response: JSON. Returns `{"status": "success"}` if the change was successful, `{"error": "[error message]"}` otherwise -* Note: Currently, Mastodon has no API for changing email. If they add it in future it might be incompatible with Pleroma. - -# Pleroma Conversations - -Pleroma Conversations have the same general structure that Mastodon Conversations have. The behavior differs in the following ways when using these endpoints: - -1. Pleroma Conversations never add or remove recipients, unless explicitly changed by the user. -2. Pleroma Conversations statuses can be requested by Conversation id. -3. Pleroma Conversations can be replied to. - -Conversations have the additional field `recipients` under the `pleroma` key. This holds a list of all the accounts that will receive a message in this conversation. - -The status posting endpoint takes an additional parameter, `in_reply_to_conversation_id`, which, when set, will set the visiblity to direct and address only the people who are the recipients of that Conversation. - -⚠ Conversation IDs can be found in direct messages with the `pleroma.direct_conversation_id` key, do not confuse it with `pleroma.conversation_id`. - -## `GET /api/v1/pleroma/conversations/:id/statuses` -### Timeline for a given conversation -* Method `GET` -* Authentication: required -* Params: Like other timelines -* Response: JSON, statuses (200 - healthy, 503 unhealthy). - -## `GET /api/v1/pleroma/conversations/:id` -### The conversation with the given ID. -* Method `GET` -* Authentication: required -* Params: None -* Response: JSON, statuses (200 - healthy, 503 unhealthy). - -## `PATCH /api/v1/pleroma/conversations/:id` -### Update a conversation. Used to change the set of recipients. -* Method `PATCH` -* Authentication: required -* Params: - * `recipients`: A list of ids of users that should receive posts to this conversation. This will replace the current list of recipients, so submit the full list. The owner of owner of the conversation will always be part of the set of recipients, though. -* Response: JSON, statuses (200 - healthy, 503 unhealthy) - -## `POST /api/v1/pleroma/conversations/read` -### Marks all user's conversations as read. -* Method `POST` -* Authentication: required -* Params: None -* Response: JSON, returns a list of Mastodon Conversation entities that were marked as read (200 - healthy, 503 unhealthy). - -## `GET /api/pleroma/emoji/pack?name=:name` - -### Get pack.json for the pack - -* Method `GET` -* Authentication: not required -* Params: - * `page`: page number for files (default 1) - * `page_size`: page size for files (default 30) -* Response: JSON, pack json with `files`, `files_count` and `pack` keys with 200 status or 404 if the pack does not exist. - -```json -{ - "files": {...}, - "files_count": 0, // emoji count in pack - "pack": {...} -} -``` - -## `POST /api/pleroma/emoji/pack?name=:name` - -### Creates an empty pack - -* Method `POST` -* Authentication: required (admin) -* Params: - * `name`: pack name -* Response: JSON, "ok" and 200 status or 409 if the pack with that name already exists - -## `PATCH /api/pleroma/emoji/pack?name=:name` - -### Updates (replaces) pack metadata - -* Method `PATCH` -* Authentication: required (admin) -* Params: - * `name`: pack name - * `metadata`: metadata to replace the old one - * `license`: Pack license - * `homepage`: Pack home page url - * `description`: Pack description - * `fallback-src`: Fallback url to download pack from - * `fallback-src-sha256`: SHA256 encoded for fallback pack archive - * `share-files`: is pack allowed for sharing (boolean) -* Response: JSON, updated "metadata" section of the pack and 200 status or 400 if there was a - problem with the new metadata (the error is specified in the "error" part of the response JSON) - -## `DELETE /api/pleroma/emoji/pack?name=:name` - -### Delete a custom emoji pack - -* Method `DELETE` -* Authentication: required (admin) -* Params: - * `name`: pack name -* Response: JSON, "ok" and 200 status or 500 if there was an error deleting the pack - -## `GET /api/pleroma/emoji/packs/import` - -### Imports packs from filesystem - -* Method `GET` -* Authentication: required (admin) -* Params: None -* Response: JSON, returns a list of imported packs. - -## `GET /api/pleroma/emoji/packs/remote` - -### Make request to another instance for packs list - -* Method `GET` -* Authentication: required (admin) -* Params: - * `url`: url of the instance to get packs from - * `page`: page number for packs (default 1) - * `page_size`: page size for packs (default 50) -* Response: JSON with the pack list, hashmap with pack name and pack contents - -## `POST /api/pleroma/emoji/packs/download` - -### Download pack from another instance - -* Method `POST` -* Authentication: required (admin) -* Params: - * `url`: url of the instance to download from - * `name`: pack to download from that instance - * `as`: (*optional*) name how to save pack -* Response: JSON, "ok" with 200 status if the pack was downloaded, or 500 if there were - errors downloading the pack - -## `POST /api/pleroma/emoji/packs/files?name=:name` - -### Add new file to the pack - -* Method `POST` -* Authentication: required (admin) -* Params: - * `name`: pack name - * `file`: file needs to be uploaded with the multipart request or link to remote file. - * `shortcode`: (*optional*) shortcode for new emoji, must be unique for all emoji. If not sended, shortcode will be taken from original filename. - * `filename`: (*optional*) new emoji file name. If not specified will be taken from original filename. -* Response: JSON, list of files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. - -## `PATCH /api/pleroma/emoji/packs/files?name=:name` - -### Update emoji file from pack - -* Method `PATCH` -* Authentication: required (admin) -* Params: - * `name`: pack name - * `shortcode`: emoji file shortcode - * `new_shortcode`: new emoji file shortcode - * `new_filename`: new filename for emoji file - * `force`: (*optional*) with true value to overwrite existing emoji with new shortcode -* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. - -## `DELETE /api/pleroma/emoji/packs/files?name=:name` - -### Delete emoji file from pack - -* Method `DELETE` -* Authentication: required (admin) -* Params: - * `name`: pack name - * `shortcode`: emoji file shortcode -* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. - -## `GET /api/pleroma/emoji/packs` - -### Lists local custom emoji packs - -* Method `GET` -* Authentication: not required -* Params: - * `page`: page number for packs (default 1) - * `page_size`: page size for packs (default 50) -* Response: `packs` key with JSON hashmap of pack name to pack contents and `count` key for count of packs. - -```json -{ - "packs": { - "pack_name": {...}, // pack contents - ... - }, - "count": 0 // packs count -} -``` - -## `GET /api/pleroma/emoji/packs/archive?name=:name` - -### Requests a local pack archive from the instance - -* Method `GET` -* Authentication: not required -* Params: - * `name`: pack name -* Response: the archive of the pack with a 200 status code, 403 if the pack is not set as shared, - 404 if the pack does not exist - -## `GET /api/v1/pleroma/accounts/:id/scrobbles` -### Requests a list of current and recent Listen activities for an account -* Method `GET` -* Authentication: not required -* Params: None -* Response: An array of media metadata entities. -* Example response: -```json -[ - { - "account": {...}, - "id": "1234", - "title": "Some Title", - "artist": "Some Artist", - "album": "Some Album", - "length": 180000, - "created_at": "2019-09-28T12:40:45.000Z" - } -] -``` - -## `POST /api/v1/pleroma/scrobble` -### Creates a new Listen activity for an account -* Method `POST` -* Authentication: required -* Params: - * `title`: the title of the media playing - * `album`: the album of the media playing [optional] - * `artist`: the artist of the media playing [optional] - * `length`: the length of the media playing [optional] -* Response: the newly created media metadata entity representing the Listen activity - -# Emoji Reactions - -Emoji reactions work a lot like favourites do. They make it possible to react to a post with a single emoji character. To detect the presence of this feature, you can check `pleroma_emoji_reactions` entry in the features list of nodeinfo. - -## `PUT /api/v1/pleroma/statuses/:id/reactions/:emoji` -### React to a post with a unicode emoji -* Method: `PUT` -* Authentication: required -* Params: `emoji`: A unicode RGI emoji or a regional indicator -* Response: JSON, the status. - -## `DELETE /api/v1/pleroma/statuses/:id/reactions/:emoji` -### Remove a reaction to a post with a unicode emoji -* Method: `DELETE` -* Authentication: required -* Params: `emoji`: A unicode RGI emoji or a regional indicator -* Response: JSON, the status. - -## `GET /api/v1/pleroma/statuses/:id/reactions` -### Get an object of emoji to account mappings with accounts that reacted to the post -* Method: `GET` -* Authentication: optional -* Params: None -* Response: JSON, a list of emoji/account list tuples, sorted by emoji insertion date, in ascending order, e.g, the first emoji in the list is the oldest. -* Example Response: -```json -[ - {"name": "😀", "count": 2, "me": true, "accounts": [{"id" => "xyz.."...}, {"id" => "zyx..."}]}, - {"name": "☕", "count": 1, "me": false, "accounts": [{"id" => "abc..."}]} -] -``` - -## `GET /api/v1/pleroma/statuses/:id/reactions/:emoji` -### Get an object of emoji to account mappings with accounts that reacted to the post for a specific emoji -* Method: `GET` -* Authentication: optional -* Params: None -* Response: JSON, a list of emoji/account list tuples -* Example Response: -```json -[ - {"name": "😀", "count": 2, "me": true, "accounts": [{"id" => "xyz.."...}, {"id" => "zyx..."}]} -] -``` - -## `POST /api/v1/pleroma/backups` -### Create a user backup archive - -* Method: `POST` -* Authentication: required -* Params: none -* Response: JSON -* Example response: - -```json -[{ - "content_type": "application/zip", - "file_size": 0, - "inserted_at": "2020-09-10T16:18:03.000Z", - "processed": false, - "url": "https://example.com/media/backups/archive-foobar-20200910T161803-QUhx6VYDRQ2wfV0SdA2Pfj_2CLM_ATUlw-D5l5TJf4Q.zip" -}] -``` - -## `GET /api/v1/pleroma/backups` -### Lists user backups - -* Method: `GET` -* Authentication: not required -* Params: none -* Response: JSON -* Example response: - -```json -[{ - "content_type": "application/zip", - "file_size": 55457, - "inserted_at": "2020-09-10T16:18:03.000Z", - "processed": true, - "url": "https://example.com/media/backups/archive-foobar-20200910T161803-QUhx6VYDRQ2wfV0SdA2Pfj_2CLM_ATUlw-D5l5TJf4Q.zip" -}] -``` diff --git a/docs/API/prometheus.md b/docs/API/prometheus.md deleted file mode 100644 index a5158d905..000000000 --- a/docs/API/prometheus.md +++ /dev/null @@ -1,44 +0,0 @@ -# Prometheus Metrics - -Pleroma includes support for exporting metrics via the [prometheus_ex](https://github.com/deadtrickster/prometheus.ex) library. - -Config example: - -``` -config :prometheus, Pleroma.Web.Endpoint.MetricsExporter, - enabled: true, - auth: {:basic, "myusername", "mypassword"}, - ip_whitelist: ["127.0.0.1"], - path: "/api/pleroma/app_metrics", - format: :text -``` - -* `enabled` (Pleroma extension) enables the endpoint -* `ip_whitelist` (Pleroma extension) could be used to restrict access only to specified IPs -* `auth` sets the authentication (`false` for no auth; configurable to HTTP Basic Auth, see [prometheus-plugs](https://github.com/deadtrickster/prometheus-plugs#exporting) documentation) -* `format` sets the output format (`:text` or `:protobuf`) -* `path` sets the path to app metrics page - - -## `/api/pleroma/app_metrics` - -### Exports Prometheus application metrics - -* Method: `GET` -* Authentication: not required by default (see configuration options above) -* Params: none -* Response: text - -## Grafana - -### Config example - -The following is a config example to use with [Grafana](https://grafana.com) - -``` - - job_name: 'beam' - metrics_path: /api/pleroma/app_metrics - scheme: https - static_configs: - - targets: ['pleroma.soykaf.com'] -``` diff --git a/docs/ap_extensions.md b/docs/ap_extensions.md deleted file mode 100644 index 3d1caeb3e..000000000 --- a/docs/ap_extensions.md +++ /dev/null @@ -1,65 +0,0 @@ -# AP Extensions -## Actor endpoints - -The following endpoints are additionally present into our actors. - -- `oauthRegistrationEndpoint` (`http://litepub.social/ns#oauthRegistrationEndpoint`) -- `uploadMedia` (`https://www.w3.org/ns/activitystreams#uploadMedia`) - -### oauthRegistrationEndpoint - -Points to MastodonAPI `/api/v1/apps` for now. - -See - -### uploadMedia - -Inspired by , it is part of the ActivityStreams namespace because it used to be part of the ActivityPub specification and got removed from it. - -Content-Type: multipart/form-data - -Parameters: -- (required) `file`: The file being uploaded -- (optionnal) `description`: A plain-text description of the media, for accessibility purposes. - -Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id` - -The object given in the reponse should then be inserted into an Object's `attachment` field. - -## ChatMessages - -`ChatMessage`s are the messages sent in 1-on-1 chats. They are similar to -`Note`s, but the addresing is done by having a single AP actor in the `to` -field. Addressing multiple actors is not allowed. These messages are always -private, there is no public version of them. They are created with a `Create` -activity. - -They are part of the `litepub` namespace as `http://litepub.social/ns#ChatMessage`. - -Example: - -```json -{ - "actor": "http://2hu.gensokyo/users/raymoo", - "id": "http://2hu.gensokyo/objects/1", - "object": { - "attributedTo": "http://2hu.gensokyo/users/raymoo", - "content": "You expected a cute girl? Too bad.", - "id": "http://2hu.gensokyo/objects/2", - "published": "2020-02-12T14:08:20Z", - "to": [ - "http://2hu.gensokyo/users/marisa" - ], - "type": "ChatMessage" - }, - "published": "2018-02-12T14:08:20Z", - "to": [ - "http://2hu.gensokyo/users/marisa" - ], - "type": "Create" -} -``` - -This setup does not prevent multi-user chats, but these will have to go through -a `Group`, which will be the recipient of the messages and then `Announce` them -to the users in the `Group`. diff --git a/docs/configuration/mrf.md b/docs/configuration/mrf.md index 31c66e098..9e8c0a2d7 100644 --- a/docs/configuration/mrf.md +++ b/docs/configuration/mrf.md @@ -133,3 +133,26 @@ config :pleroma, :mrf, ``` Please note that the Pleroma developers consider custom MRF policy modules to fall under the purview of the AGPL. As such, you are obligated to release the sources to your custom MRF policy modules upon request. + +### MRF policies descriptions + +If MRF policy depends on config, it can be added into MRF tab to adminFE by adding `config_description/0` method, which returns a map with a specific structure. See existing MRF's like `lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex` for examples. Note that more complex inputs, like tuples or maps, may need extra changes in the adminFE and just adding it to `config_description/0` may not be enough to get these inputs working from the adminFE. + +Example: + +```elixir +%{ + key: :mrf_activity_expiration, + related_policy: "Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy", + label: "MRF Activity Expiration Policy", + description: "Adds automatic expiration to all local activities", + children: [ + %{ + key: :days, + type: :integer, + description: "Default global expiration time for all local activities (in days)", + suggestions: [90, 365] + } + ] + } +``` diff --git a/docs/dev.md b/docs/dev.md deleted file mode 100644 index 765380a58..000000000 --- a/docs/dev.md +++ /dev/null @@ -1,46 +0,0 @@ -This document contains notes and guidelines for Pleroma developers. - -# Authentication & Authorization - -## OAuth token-based authentication & authorization - -* Pleroma supports hierarchical OAuth scopes, just like Mastodon but with added granularity of admin scopes. For a reference, see [Mastodon OAuth scopes](https://docs.joinmastodon.org/api/oauth-scopes/). - -* It is important to either define OAuth scope restrictions or explicitly mark OAuth scope check as skipped, for every controller action. To define scopes, call `plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: [...]})`. To explicitly set OAuth scopes check skipped, call `plug(:skip_plug, Pleroma.Web.Plugs.OAuthScopesPlug )`. - -* In controllers, `use Pleroma.Web, :controller` will result in `action/2` (see `Pleroma.Web.controller/0` for definition) be called prior to actual controller action, and it'll perform security / privacy checks before passing control to actual controller action. - - For routes with `:authenticated_api` pipeline, authentication & authorization are expected, thus `OAuthScopesPlug` will be run unless explicitly skipped (also `EnsureAuthenticatedPlug` will be executed immediately before action even if there was an early run to give an early error, since `OAuthScopesPlug` supports `:proceed_unauthenticated` option, and other plugs may support similar options as well). - - For `:api` pipeline routes, it'll be verified whether `OAuthScopesPlug` was called or explicitly skipped, and if it was not then auth information will be dropped for request. Then `EnsurePublicOrAuthenticatedPlug` will be called to ensure that either the instance is not private or user is authenticated (unless explicitly skipped). Such automated checks help to prevent human errors and result in higher security / privacy for users. - -## Non-OAuth authentication - -* With non-OAuth authentication ([HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) or HTTP header- or params-provided auth), OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways); auth plugs invoke `Pleroma.Helpers.AuthHelper.skip_oauth(conn)` in this case. - -## Auth-related configuration, OAuth consumer mode etc. - -See `Authentication` section of [the configuration cheatsheet](configuration/cheatsheet.md#authentication). - -## MRF policies descriptions - -If MRF policy depends on config, it can be added into MRF tab to adminFE by adding `config_description/0` method, which returns map with special structure. - -Example: - -```elixir -%{ - key: :mrf_activity_expiration, - related_policy: "Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy", - label: "MRF Activity Expiration Policy", - description: "Adds automatic expiration to all local activities", - children: [ - %{ - key: :days, - type: :integer, - description: "Default global expiration time for all local activities (in days)", - suggestions: [90, 365] - } - ] - } -``` diff --git a/docs/development/API/admin_api.md b/docs/development/API/admin_api.md new file mode 100644 index 000000000..5253dc668 --- /dev/null +++ b/docs/development/API/admin_api.md @@ -0,0 +1,1565 @@ +# Admin API + +Authentication is required and the user must be an admin. + +Configuration options: + +* `[:auth, :enforce_oauth_admin_scope_usage]` — OAuth admin scope requirement toggle. + If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token (client app must support admin scopes). + If `false` and token doesn't have admin scope(s), `is_admin` user flag grants access to admin-specific actions. + Note that client app needs to explicitly support admin scopes and request them when obtaining auth token. + +## `GET /api/pleroma/admin/users` + +### List users + +- Query Params: + - *optional* `query`: **string** search term (e.g. nickname, domain, nickname@domain) + - *optional* `filters`: **string** comma-separated string of filters: + - `local`: only local users + - `external`: only external users + - `active`: only active users + - `need_approval`: only unapproved users + - `unconfirmed`: only unconfirmed users + - `deactivated`: only deactivated users + - `is_admin`: users with admin role + - `is_moderator`: users with moderator role + - *optional* `page`: **integer** page number + - *optional* `page_size`: **integer** number of users per page (default is `50`) + - *optional* `tags`: **[string]** tags list + - *optional* `actor_types`: **[string]** actor type list (`Person`, `Service`, `Application`) + - *optional* `name`: **string** user display name + - *optional* `email`: **string** user email +- Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com` +- Response: + +```json +{ + "page_size": integer, + "count": integer, + "users": [ + { + "deactivated": bool, + "id": integer, + "nickname": string, + "roles": { + "admin": bool, + "moderator": bool + }, + "local": bool, + "tags": array, + "avatar": string, + "display_name": string, + "confirmation_pending": bool, + "approval_pending": bool, + "registration_reason": string, + }, + ... + ] +} +``` + +## DEPRECATED `DELETE /api/pleroma/admin/users` + +### Remove a user + +- Params: + - `nickname` +- Response: User’s nickname + +## `DELETE /api/pleroma/admin/users` + +### Remove a user + +- Params: + - `nicknames` +- Response: Array of user nicknames + +### Create a user + +- Method: `POST` +- Params: + `users`: [ + { + `nickname`, + `email`, + `password` + } + ] +- Response: User’s nickname + +## `POST /api/pleroma/admin/users/follow` + +### Make a user follow another user + +- Params: + - `follower`: The nickname of the follower + - `followed`: The nickname of the followed +- Response: + - "ok" + +## `POST /api/pleroma/admin/users/unfollow` + +### Make a user unfollow another user + +- Params: + - `follower`: The nickname of the follower + - `followed`: The nickname of the followed +- Response: + - "ok" + +## `PATCH /api/pleroma/admin/users/:nickname/toggle_activation` + +### Toggle user activation + +- Params: + - `nickname` +- Response: User’s object + +```json +{ + "deactivated": bool, + "id": integer, + "nickname": string +} +``` + +## `PUT /api/pleroma/admin/users/tag` + +### Tag a list of users + +- Params: + - `nicknames` (array) + - `tags` (array) + +## `DELETE /api/pleroma/admin/users/tag` + +### Untag a list of users + +- Params: + - `nicknames` (array) + - `tags` (array) + +## `GET /api/pleroma/admin/users/:nickname/permission_group` + +### Get user user permission groups membership + +- Params: none +- Response: + +```json +{ + "is_moderator": bool, + "is_admin": bool +} +``` + +## `GET /api/pleroma/admin/users/:nickname/permission_group/:permission_group` + +Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist. + +### Get user user permission groups membership per permission group + +- Params: none +- Response: + +```json +{ + "is_moderator": bool, + "is_admin": bool +} +``` + +## DEPRECATED `POST /api/pleroma/admin/users/:nickname/permission_group/:permission_group` + +### Add user to permission group + +- Params: none +- Response: + - On failure: `{"error": "…"}` + - On success: JSON of the user + +## `POST /api/pleroma/admin/users/permission_group/:permission_group` + +### Add users to permission group + +- Params: + - `nicknames`: nicknames array +- Response: + - On failure: `{"error": "…"}` + - On success: JSON of the user + +## DEPRECATED `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group` + +## `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group` + +### Remove user from permission group + +- Params: none +- Response: + - On failure: `{"error": "…"}` + - On success: JSON of the user +- Note: An admin cannot revoke their own admin status. + +## `DELETE /api/pleroma/admin/users/permission_group/:permission_group` + +### Remove users from permission group + +- Params: + - `nicknames`: nicknames array +- Response: + - On failure: `{"error": "…"}` + - On success: JSON of the user +- Note: An admin cannot revoke their own admin status. + +## `PATCH /api/pleroma/admin/users/activate` + +### Activate user + +- Params: + - `nicknames`: nicknames array +- Response: + +```json +{ + users: [ + { + // user object + } + ] +} +``` + +## `PATCH /api/pleroma/admin/users/deactivate` + +### Deactivate user + +- Params: + - `nicknames`: nicknames array +- Response: + +```json +{ + users: [ + { + // user object + } + ] +} +``` + +## `PATCH /api/pleroma/admin/users/approve` + +### Approve user + +- Params: + - `nicknames`: nicknames array +- Response: + +```json +{ + users: [ + { + // user object + } + ] +} +``` + +## `GET /api/pleroma/admin/users/:nickname_or_id` + +### Retrive the details of a user + +- Params: + - `nickname` or `id` +- Response: + - On failure: `Not found` + - On success: JSON of the user + +## `GET /api/pleroma/admin/users/:nickname_or_id/statuses` + +### Retrive user's latest statuses + +- Params: + - `nickname` or `id` + - *optional* `page_size`: number of statuses to return (default is `20`) + - *optional* `godmode`: `true`/`false` – allows to see private statuses + - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) +- Response: + - On failure: `Not found` + - On success: JSON array of user's latest statuses + +## `GET /api/pleroma/admin/instances/:instance/statuses` + +### Retrive instance's latest statuses + +- Params: + - `instance`: instance name + - *optional* `page_size`: number of statuses to return (default is `20`) + - *optional* `godmode`: `true`/`false` – allows to see private statuses + - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) +- Response: + - On failure: `Not found` + - On success: JSON array of instance's latest statuses + +## `GET /api/pleroma/admin/statuses` + +### Retrives all latest statuses + +- Params: + - *optional* `page_size`: number of statuses to return (default is `20`) + - *optional* `local_only`: excludes remote statuses + - *optional* `godmode`: `true`/`false` – allows to see private statuses + - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) +- Response: + - On failure: `Not found` + - On success: JSON array of user's latest statuses + +## `GET /api/pleroma/admin/relay` + +### List Relays + +Params: none +Response: + +* On success: JSON array of relays + +```json +[ + {"actor": "https://example.com/relay", "followed_back": true}, + {"actor": "https://example2.com/relay", "followed_back": false} +] +``` + +## `POST /api/pleroma/admin/relay` + +### Follow a Relay + +Params: + +* `relay_url` + +Response: + +* On success: relay json object + +```json +{"actor": "https://example.com/relay", "followed_back": true} +``` + +## `DELETE /api/pleroma/admin/relay` + +### Unfollow a Relay + +- Params: + - `relay_url` + - *optional* `force`: forcefully unfollow a relay even when the relay is not available. (default is `false`) + +Response: + +* On success: URL of the unfollowed relay + +```json +{"https://example.com/relay"} +``` + +## `POST /api/pleroma/admin/users/invite_token` + +### Create an account registration invite token + +- Params: + - *optional* `max_use` (integer) + - *optional* `expires_at` (date string e.g. "2019-04-07") +- Response: + +```json +{ + "id": integer, + "token": string, + "used": boolean, + "expires_at": date, + "uses": integer, + "max_use": integer, + "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`) +} +``` + +## `GET /api/pleroma/admin/users/invites` + +### Get a list of generated invites + +- Params: none +- Response: + +```json +{ + + "invites": [ + { + "id": integer, + "token": string, + "used": boolean, + "expires_at": date, + "uses": integer, + "max_use": integer, + "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`) + }, + ... + ] +} +``` + +## `POST /api/pleroma/admin/users/revoke_invite` + +### Revoke invite by token + +- Params: + - `token` +- Response: + +```json +{ + "id": integer, + "token": string, + "used": boolean, + "expires_at": date, + "uses": integer, + "max_use": integer, + "invite_type": string (possible values: `one_time`, `reusable`, `date_limited`, `reusable_date_limited`) + +} +``` + +## `POST /api/pleroma/admin/users/email_invite` + +### Sends registration invite via email + +- Params: + - `email` + - `name`, optional + +- Response: + - On success: `204`, empty response + - On failure: + - 400 Bad Request, JSON: + + ```json + [ + { + "error": "Appropriate error message here" + } + ] + ``` + +## `GET /api/pleroma/admin/users/:nickname/password_reset` + +### Get a password reset token for a given nickname + + +- Params: none +- Response: + +```json +{ + "token": "base64 reset token", + "link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token" +} +``` + +## `PATCH /api/pleroma/admin/users/force_password_reset` + +### Force passord reset for a user with a given nickname + +- Params: + - `nicknames` +- Response: none (code `204`) + +## PUT `/api/pleroma/admin/users/disable_mfa` + +### Disable mfa for user's account. + +- Params: + - `nickname` +- Response: User’s nickname + +## `GET /api/pleroma/admin/users/:nickname/credentials` + +### Get the user's email, password, display and settings-related fields + +- Params: + - `nickname` + +- Response: + +```json +{ + "actor_type": "Person", + "allow_following_move": true, + "avatar": "https://pleroma.social/media/7e8e7508fd545ef580549b6881d80ec0ff2c81ed9ad37b9bdbbdf0e0d030159d.jpg", + "background": "https://pleroma.social/media/4de34c0bd10970d02cbdef8972bef0ebbf55f43cadc449554d4396156162fe9a.jpg", + "banner": "https://pleroma.social/media/8d92ba2bd244b613520abf557dd448adcd30f5587022813ee9dd068945986946.jpg", + "bio": "bio", + "default_scope": "public", + "discoverable": false, + "email": "user@example.com", + "fields": [ + { + "name": "example", + "value": "https://example.com" + } + ], + "hide_favorites": false, + "hide_followers": false, + "hide_followers_count": false, + "hide_follows": false, + "hide_follows_count": false, + "id": "9oouHaEEUR54hls968", + "locked": true, + "name": "user", + "no_rich_text": true, + "pleroma_settings_store": {}, + "raw_fields": [ + { + "id": 1, + "name": "example", + "value": "https://example.com" + }, + ], + "show_role": true, + "skip_thread_containment": false +} +``` + +## `PATCH /api/pleroma/admin/users/:nickname/credentials` + +### Change the user's email, password, display and settings-related fields + +* Params: + * `email` + * `password` + * `name` + * `bio` + * `avatar` + * `locked` + * `no_rich_text` + * `default_scope` + * `banner` + * `hide_follows` + * `hide_followers` + * `hide_followers_count` + * `hide_follows_count` + * `hide_favorites` + * `allow_following_move` + * `background` + * `show_role` + * `skip_thread_containment` + * `fields` + * `is_discoverable` + * `actor_type` + +* Responses: + +Status: 200 + +```json +{"status": "success"} +``` + +Status: 400 + +```json +{"errors": + {"actor_type": "is invalid"}, + {"email": "has invalid format"}, + ... + } +``` + +Status: 404 + +```json +{"error": "Not found"} +``` + +## `GET /api/pleroma/admin/reports` + +### Get a list of reports + +- Params: + - *optional* `state`: **string** the state of reports. Valid values are `open`, `closed` and `resolved` + - *optional* `limit`: **integer** the number of records to retrieve + - *optional* `page`: **integer** page number + - *optional* `page_size`: **integer** number of log entries per page (default is `50`) +- Response: + - On failure: 403 Forbidden error `{"error": "error_msg"}` when requested by anonymous or non-admin + - On success: JSON, returns a list of reports, where: + - `account`: the user who has been reported + - `actor`: the user who has sent the report + - `statuses`: list of statuses that have been included to the report + +```json +{ + "total" : 1, + "reports": [ + { + "account": { + "acct": "user", + "avatar": "https://pleroma.example.org/images/avi.png", + "avatar_static": "https://pleroma.example.org/images/avi.png", + "bot": false, + "created_at": "2019-04-23T17:32:04.000Z", + "display_name": "User", + "emojis": [], + "fields": [], + "followers_count": 1, + "following_count": 1, + "header": "https://pleroma.example.org/images/banner.png", + "header_static": "https://pleroma.example.org/images/banner.png", + "id": "9i6dAJqSGSKMzLG2Lo", + "locked": false, + "note": "", + "pleroma": { + "confirmation_pending": false, + "hide_favorites": true, + "hide_followers": false, + "hide_follows": false, + "is_admin": false, + "is_moderator": false, + "relationship": {}, + "tags": [] + }, + "source": { + "note": "", + "pleroma": {}, + "sensitive": false + }, + "tags": ["force_unlisted"], + "statuses_count": 3, + "url": "https://pleroma.example.org/users/user", + "username": "user" + }, + "actor": { + "acct": "lain", + "avatar": "https://pleroma.example.org/images/avi.png", + "avatar_static": "https://pleroma.example.org/images/avi.png", + "bot": false, + "created_at": "2019-03-28T17:36:03.000Z", + "display_name": "Roger Braun", + "emojis": [], + "fields": [], + "followers_count": 1, + "following_count": 1, + "header": "https://pleroma.example.org/images/banner.png", + "header_static": "https://pleroma.example.org/images/banner.png", + "id": "9hEkA5JsvAdlSrocam", + "locked": false, + "note": "", + "pleroma": { + "confirmation_pending": false, + "hide_favorites": false, + "hide_followers": false, + "hide_follows": false, + "is_admin": false, + "is_moderator": false, + "relationship": {}, + "tags": [] + }, + "source": { + "note": "", + "pleroma": {}, + "sensitive": false + }, + "tags": ["force_unlisted"], + "statuses_count": 1, + "url": "https://pleroma.example.org/users/lain", + "username": "lain" + }, + "content": "Please delete it", + "created_at": "2019-04-29T19:48:15.000Z", + "id": "9iJGOv1j8hxuw19bcm", + "state": "open", + "statuses": [ + { + "account": { ... }, + "application": { + "name": "Web", + "website": null + }, + "bookmarked": false, + "card": null, + "content": "@lain click on my link https://www.google.com/", + "created_at": "2019-04-23T19:15:47.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 0, + "id": "9i6mQ9uVrrOmOime8m", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [ + { + "acct": "lain", + "id": "9hEkA5JsvAdlSrocam", + "url": "https://pleroma.example.org/users/lain", + "username": "lain" + }, + { + "acct": "user", + "id": "9i6dAJqSGSKMzLG2Lo", + "url": "https://pleroma.example.org/users/user", + "username": "user" + } + ], + "muted": false, + "pinned": false, + "pleroma": { + "content": { + "text/plain": "@lain click on my link https://www.google.com/" + }, + "conversation_id": 28, + "in_reply_to_account_acct": null, + "local": true, + "spoiler_text": { + "text/plain": "" + } + }, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 0, + "sensitive": false, + "spoiler_text": "", + "tags": [], + "uri": "https://pleroma.example.org/objects/8717b90f-8e09-4b58-97b0-e3305472b396", + "url": "https://pleroma.example.org/notice/9i6mQ9uVrrOmOime8m", + "visibility": "direct" + } + ] + } + ] +} +``` + +## `GET /api/pleroma/admin/grouped_reports` + +### Get a list of reports, grouped by status + +- Params: none +- On success: JSON, returns a list of reports, where: + - `date`: date of the latest report + - `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference) + - `status`: reported status (see `/api/pleroma/admin/reports` for reference) + - `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference) + - `reports`: reports (see `/api/pleroma/admin/reports` for reference) + +```json + "reports": [ + { + "date": "2019-10-07T12:31:39.615149Z", + "account": { ... }, + "status": { ... }, + "actors": [{ ... }, { ... }], + "reports": [{ ... }] + } + ] +``` + +## `GET /api/pleroma/admin/reports/:id` + +### Get an individual report + +- Params: + - `id` +- Response: + - On failure: + - 403 Forbidden `{"error": "error_msg"}` + - 404 Not Found `"Not found"` + - On success: JSON, Report object (see above) + +## `PATCH /api/pleroma/admin/reports` + +### Change the state of one or multiple reports + +- Params: + +```json + `reports`: [ + { + `id`, // required, report id + `state` // required, the new state. Valid values are `open`, `closed` and `resolved` + }, + ... + ] +``` + +- Response: + - On failure: + - 400 Bad Request, JSON: + + ```json + [ + { + `id`, // report id + `error` // error message + } + ] + ``` + + - On success: `204`, empty response + +## `POST /api/pleroma/admin/reports/:id/notes` + +### Create report note + +- Params: + - `id`: required, report id + - `content`: required, the message +- Response: + - On failure: + - 400 Bad Request `"Invalid parameters"` when `status` is missing + - On success: `204`, empty response + +## `DELETE /api/pleroma/admin/reports/:report_id/notes/:id` + +### Delete report note + +- Params: + - `report_id`: required, report id + - `id`: required, note id +- Response: + - On failure: + - 400 Bad Request `"Invalid parameters"` when `status` is missing + - On success: `204`, empty response + +## `GET /api/pleroma/admin/statuses/:id` + +### Show status by id + +- Params: + - `id`: required, status id +- Response: + - On failure: + - 404 Not Found `"Not Found"` + - On success: JSON, Mastodon Status entity + +## `PUT /api/pleroma/admin/statuses/:id` + +### Change the scope of an individual reported status + +- Params: + - `id` + - `sensitive`: optional, valid values are `true` or `false` + - `visibility`: optional, valid values are `public`, `private` and `unlisted` +- Response: + - On failure: + - 400 Bad Request `"Unsupported visibility"` + - 403 Forbidden `{"error": "error_msg"}` + - 404 Not Found `"Not found"` + - On success: JSON, Mastodon Status entity + +## `DELETE /api/pleroma/admin/statuses/:id` + +### Delete an individual reported status + +- Params: + - `id` +- Response: + - On failure: + - 403 Forbidden `{"error": "error_msg"}` + - 404 Not Found `"Not found"` + - On success: 200 OK `{}` + +## `GET /api/pleroma/admin/restart` + +### Restarts pleroma application + +**Only works when configuration from database is enabled.** + +- Params: none +- Response: + - On failure: + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` + +```json +{} +``` + +## `GET /api/pleroma/admin/need_reboot` + +### Returns the flag whether the pleroma should be restarted + +- Params: none +- Response: + - `need_reboot` - boolean +```json +{ + "need_reboot": false +} +``` + +## `GET /api/pleroma/admin/config` + +### Get list of merged default settings with saved in database. + +*If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.* + +**Only works when configuration from database is enabled.** + +- Params: + - `only_db`: true (*optional*, get only saved in database settings) +- Response: + - On failure: + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` + +```json +{ + "configs": [ + { + "group": ":pleroma", + "key": "Pleroma.Upload", + "value": [] + } + ], + "need_reboot": true +} +``` + +## `POST /api/pleroma/admin/config` + +### Update config settings + +*If `need_reboot` is `true`, instance must be restarted, so reboot time settings can take effect.* + +**Only works when configuration from database is enabled.** + +Some modifications are necessary to save the config settings correctly: + +- strings which start with `Pleroma.`, `Phoenix.`, `Tesla.` or strings like `Oban`, `Ueberauth` will be converted to modules; +``` +"Pleroma.Upload" -> Pleroma.Upload +"Oban" -> Oban +``` +- strings starting with `:` will be converted to atoms; +``` +":pleroma" -> :pleroma +``` +- objects with `tuple` key and array value will be converted to tuples; +``` +{"tuple": ["string", "Pleroma.Upload", []]} -> {"string", Pleroma.Upload, []} +``` +- arrays with *tuple objects* will be converted to keywords; +``` +[{"tuple": [":key1", "value"]}, {"tuple": [":key2", "value"]}] -> [key1: "value", key2: "value"] +``` + +Most of the settings will be applied in `runtime`, this means that you don't need to restart the instance. But some settings are applied in `compile time` and require a reboot of the instance, such as: +- all settings inside these keys: + - `:hackney_pools` + - `:connections_pool` + - `:pools` + - `:chat` +- partially settings inside these keys: + - `:seconds_valid` in `Pleroma.Captcha` + - `:proxy_remote` in `Pleroma.Upload` + - `:upload_limit` in `:instance` + +- Params: + - `configs` - array of config objects + - config object params: + - `group` - string (**required**) + - `key` - string (**required**) + - `value` - string, [], {} or {"tuple": []} (**required**) + - `delete` - true (*optional*, if setting must be deleted) + - `subkeys` - array of strings (*optional*, only works when `delete=true` parameter is passed, otherwise will be ignored) + +*When a value have several nested settings, you can delete only some nested settings by passing a parameter `subkeys`, without deleting all settings by key.* +``` +[subkey: val1, subkey2: val2, subkey3: val3] \\ initial value +{"group": ":pleroma", "key": "some_key", "delete": true, "subkeys": [":subkey", ":subkey3"]} \\ passing json for deletion +[subkey2: val2] \\ value after deletion +``` + +*Most of the settings can be partially updated through merge old values with new values, except settings value of which is list or is not keyword.* + +Example of setting without keyword in value: +```elixir +config :tesla, :adapter, Tesla.Adapter.Hackney +``` + +List of settings which support only full update by key: +```elixir +@full_key_update [ + {:pleroma, :ecto_repos}, + {:quack, :meta}, + {:mime, :types}, + {:cors_plug, [:max_age, :methods, :expose, :headers]}, + {:auto_linker, :opts}, + {:swarm, :node_blacklist}, + {:logger, :backends} + ] +``` + +List of settings which support only full update by subkey: +```elixir +@full_subkey_update [ + {:pleroma, :assets, :mascots}, + {:pleroma, :emoji, :groups}, + {:pleroma, :workers, :retries}, + {:pleroma, :mrf_subchain, :match_actor}, + {:pleroma, :mrf_keyword, :replace} + ] +``` + +*Settings without explicit key must be sended in separate config object params.* +```elixir +config :quack, + level: :debug, + meta: [:all], + ... +``` +```json +{ + "configs": [ + {"group": ":quack", "key": ":level", "value": ":debug"}, + {"group": ":quack", "key": ":meta", "value": [":all"]}, + ... + ] +} +``` +- Request: + +```json +{ + "configs": [ + { + "group": ":pleroma", + "key": "Pleroma.Upload", + "value": [ + {"tuple": [":uploader", "Pleroma.Uploaders.Local"]}, + {"tuple": [":filters", ["Pleroma.Upload.Filter.Dedupe"]]}, + {"tuple": [":link_name", true]}, + {"tuple": [":proxy_remote", false]}, + {"tuple": [":proxy_opts", [ + {"tuple": [":redirect_on_failure", false]}, + {"tuple": [":max_body_length", 1048576]}, + {"tuple": [":http", [ + {"tuple": [":follow_redirect", true]}, + {"tuple": [":pool", ":upload"]}, + ]]} + ] + ]}, + {"tuple": [":dispatch", { + "tuple": ["/api/v1/streaming", "Pleroma.Web.MastodonAPI.WebsocketHandler", []] + }]} + ] + } + ] +} +``` + +- Response: + - On failure: + - 400 Bad Request `"To use this endpoint you need to enable configuration from database."` +```json +{ + "configs": [ + { + "group": ":pleroma", + "key": "Pleroma.Upload", + "value": [...] + } + ], + "need_reboot": true +} +``` + +## ` GET /api/pleroma/admin/config/descriptions` + +### Get JSON with config descriptions. +Loads json generated from `config/descriptions.exs`. + +- Params: none +- Response: + +```json +[{ + "group": ":pleroma", // string + "key": "ModuleName", // string + "type": "group", // string or list with possible values, + "description": "Upload general settings", // string + "children": [ + { + "key": ":uploader", // string or module name `Pleroma.Upload` + "type": "module", + "description": "Module which will be used for uploads", + "suggestions": ["module1", "module2"] + }, + { + "key": ":filters", + "type": ["list", "module"], + "description": "List of filter modules for uploads", + "suggestions": [ + "module1", "module2", "module3" + ] + } + ] +}] +``` + +## `GET /api/pleroma/admin/moderation_log` + +### Get moderation log + +- Params: + - *optional* `page`: **integer** page number + - *optional* `page_size`: **integer** number of log entries per page (default is `50`) + - *optional* `start_date`: **datetime (ISO 8601)** filter logs by creation date, start from `start_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. `2005-08-09T18:31:42` + - *optional* `end_date`: **datetime (ISO 8601)** filter logs by creation date, end by from `end_date`. Accepts datetime in ISO 8601 format (YYYY-MM-DDThh:mm:ss), e.g. 2005-08-09T18:31:42 + - *optional* `user_id`: **integer** filter logs by actor's id + - *optional* `search`: **string** search logs by the log message +- Response: + +```json +[ + { + "id": 1234, + "data": { + "actor": { + "id": 1, + "nickname": "lain" + }, + "action": "relay_follow" + }, + "time": 1502812026, // timestamp + "message": "[2017-08-15 15:47:06] @nick0 followed relay: https://example.org/relay" // log message + } +] +``` + +## `POST /api/pleroma/admin/reload_emoji` + +### Reload the instance's custom emoji + +- Authentication: required +- Params: None +- Response: JSON, "ok" and 200 status + +## `PATCH /api/pleroma/admin/users/confirm_email` + +### Confirm users' emails + +- Params: + - `nicknames` +- Response: Array of user nicknames + +## `PATCH /api/pleroma/admin/users/resend_confirmation_email` + +### Resend confirmation email + +- Params: + - `nicknames` +- Response: Array of user nicknames + +## `GET /api/pleroma/admin/stats` + +### Stats + +- Query Params: + - *optional* `instance`: **string** instance hostname (without protocol) to get stats for +- Example: `https://mypleroma.org/api/pleroma/admin/stats?instance=lain.com` + +- Response: + +```json +{ + "status_visibility": { + "direct": 739, + "private": 9, + "public": 17, + "unlisted": 14 + } +} +``` + +## `GET /api/pleroma/admin/oauth_app` + +### List OAuth app + +- Params: + - *optional* `name` + - *optional* `client_id` + - *optional* `page` + - *optional* `page_size` + - *optional* `trusted` + +- Response: + +```json +{ + "apps": [ + { + "id": 1, + "name": "App name", + "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk", + "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY", + "redirect_uri": "https://example.com/oauth-callback", + "website": "https://example.com", + "trusted": true + } + ], + "count": 17, + "page_size": 50 +} +``` + + +## `POST /api/pleroma/admin/oauth_app` + +### Create OAuth App + +- Params: + - `name` + - `redirect_uris` + - `scopes` + - *optional* `website` + - *optional* `trusted` + +- Response: + +```json +{ + "id": 1, + "name": "App name", + "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk", + "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY", + "redirect_uri": "https://example.com/oauth-callback", + "website": "https://example.com", + "trusted": true +} +``` + +- On failure: +```json +{ + "redirect_uris": "can't be blank", + "name": "can't be blank" +} +``` + +## `PATCH /api/pleroma/admin/oauth_app/:id` + +### Update OAuth App + +- Params: + - *optional* `name` + - *optional* `redirect_uris` + - *optional* `scopes` + - *optional* `website` + - *optional* `trusted` + +- Response: + +```json +{ + "id": 1, + "name": "App name", + "client_id": "yHoDSiWYp5mPV6AfsaVOWjdOyt5PhWRiafi6MRd1lSk", + "client_secret": "nLmis486Vqrv2o65eM9mLQx_m_4gH-Q6PcDpGIMl6FY", + "redirect_uri": "https://example.com/oauth-callback", + "website": "https://example.com", + "trusted": true +} +``` + +## `DELETE /api/pleroma/admin/oauth_app/:id` + +### Delete OAuth App + +- Params: None + +- Response: + - On success: `204`, empty response + - On failure: + - 400 Bad Request `"Invalid parameters"` when `status` is missing + +## `GET /api/pleroma/admin/media_proxy_caches` + +### Get a list of all banned MediaProxy URLs in Cachex + +- Authentication: required +- Params: +- *optional* `page`: **integer** page number +- *optional* `page_size`: **integer** number of log entries per page (default is `50`) +- *optional* `query`: **string** search term + +- Response: + +``` json +{ + "page_size": integer, + "count": integer, + "urls": [ + "http://example.com/media/a688346.jpg", + "http://example.com/media/fb1f4d.jpg" + ] +} + +``` + +## `POST /api/pleroma/admin/media_proxy_caches/delete` + +### Remove a banned MediaProxy URL from Cachex + +- Authentication: required +- Params: + - `urls` (array) + +- Response: + +``` json +{ } + +``` + +## `POST /api/pleroma/admin/media_proxy_caches/purge` + +### Purge a MediaProxy URL + +- Authentication: required +- Params: + - `urls` (array) + - `ban` (boolean) + +- Response: + +``` json +{ } + +``` + +## GET /api/pleroma/admin/users/:nickname/chats + +### List a user's chats + +- Params: None + +- Response: + +```json +[ + { + "sender": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "receiver": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "id" : "1", + "unread" : 2, + "last_message" : {...}, // The last message in that chat + "updated_at": "2020-04-21T15:11:46.000Z" + } +] +``` + +## GET /api/pleroma/admin/chats/:chat_id + +### View a single chat + +- Params: None + +- Response: + +```json +{ + "sender": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "receiver": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "id" : "1", + "unread" : 2, + "last_message" : {...}, // The last message in that chat + "updated_at": "2020-04-21T15:11:46.000Z" +} +``` + +## GET /api/pleroma/admin/chats/:chat_id/messages + +### List the messages in a chat + +- Params: `max_id`, `min_id` + +- Response: + +```json +[ + { + "account_id": "someflakeid", + "chat_id": "1", + "content": "Check this out :firefox:", + "created_at": "2020-04-21T15:11:46.000Z", + "emojis": [ + { + "shortcode": "firefox", + "static_url": "https://dontbulling.me/emoji/Firefox.gif", + "url": "https://dontbulling.me/emoji/Firefox.gif", + "visible_in_picker": false + } + ], + "id": "13", + "unread": true + }, + { + "account_id": "someflakeid", + "chat_id": "1", + "content": "Whats' up?", + "created_at": "2020-04-21T15:06:45.000Z", + "emojis": [], + "id": "12", + "unread": false + } +] +``` + +## DELETE /api/pleroma/admin/chats/:chat_id/messages/:message_id + +### Delete a single message + +- Params: None + +- Response: + +```json +{ + "account_id": "someflakeid", + "chat_id": "1", + "content": "Check this out :firefox:", + "created_at": "2020-04-21T15:11:46.000Z", + "emojis": [ + { + "shortcode": "firefox", + "static_url": "https://dontbulling.me/emoji/Firefox.gif", + "url": "https://dontbulling.me/emoji/Firefox.gif", + "visible_in_picker": false + } + ], + "id": "13", + "unread": false +} +``` + +## `GET /api/pleroma/admin/instance_document/:document_name` + +### Get an instance document + +- Authentication: required + +- Response: + +Returns the content of the document + +```html +

Instance panel

+``` + +## `PATCH /api/pleroma/admin/instance_document/:document_name` +- Params: + - `file` (the file to be uploaded, using multipart form data.) + +### Update an instance document + +- Authentication: required + +- Response: + +``` json +{ + "url": "https://example.com/instance/panel.html" +} +``` + +## `DELETE /api/pleroma/admin/instance_document/:document_name` + +### Delete an instance document + +- Response: + +``` json +{ + "url": "https://example.com/instance/panel.html" +} +``` + +## `GET /api/pleroma/admin/frontends + +### List available frontends + +- Response: + +```json +[ + { + "build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build", + "git": "https://git.pleroma.social/pleroma/fedi-fe", + "installed": true, + "name": "fedi-fe", + "ref": "master" + }, + { + "build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build", + "git": "https://git.pleroma.social/lambadalambda/kenoma", + "installed": false, + "name": "kenoma", + "ref": "master" + } +] +``` + +## `POST /api/pleroma/admin/frontends/install` + +### Install a frontend + +- Params: + - `name`: frontend name, required + - `ref`: frontend ref + - `file`: path to a frontend zip file + - `build_url`: build URL + - `build_dir`: build directory + +- Response: + +```json +[ + { + "build_url": "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build", + "git": "https://git.pleroma.social/pleroma/fedi-fe", + "installed": true, + "name": "fedi-fe", + "ref": "master" + }, + { + "build_url": "https://git.pleroma.social/lambadalambda/kenoma/-/jobs/artifacts/${ref}/download?job=build", + "git": "https://git.pleroma.social/lambadalambda/kenoma", + "installed": false, + "name": "kenoma", + "ref": "master" + } +] +``` + +```json +{ + "error": "Could not install frontend" +} +``` diff --git a/docs/development/API/chats.md b/docs/development/API/chats.md new file mode 100644 index 000000000..f50144c86 --- /dev/null +++ b/docs/development/API/chats.md @@ -0,0 +1,255 @@ +# Chats + +Chats are a way to represent an IM-style conversation between two actors. They are not the same as direct messages and they are not `Status`es, even though they have a lot in common. + +## Why Chats? + +There are no 'visibility levels' in ActivityPub, their definition is purely a Mastodon convention. Direct Messaging between users on the fediverse has mostly been modeled by using ActivityPub addressing following Mastodon conventions on normal `Note` objects. In this case, a 'direct message' would be a message that has no followers addressed and also does not address the special public actor, but just the recipients in the `to` field. It would still be a `Note` and is presented with other `Note`s as a `Status` in the API. + +This is an awkward setup for a few reasons: + +- As DMs generally still follow the usual `Status` conventions, it is easy to accidentally pull somebody into a DM thread by mentioning them. (e.g. "I hate @badguy so much") +- It is possible to go from a publicly addressed `Status` to a DM reply, back to public, then to a 'followers only' reply, and so on. This can be become very confusing, as it is unclear which user can see which part of the conversation. +- The standard `Status` format of implicit addressing also leads to rather ugly results if you try to display the messages as a chat, because all the recipients are always mentioned by name in the message. +- As direct messages are posted with the same api call (and usually same frontend component) as public messages, accidentally making a public message private or vice versa can happen easily. Client bugs can also lead to this, accidentally making private messages public. + +As a measure to improve this situation, the `Conversation` concept and related Pleroma extensions were introduced. While it made it possible to work around a few of the issues, many of the problems remained and it didn't see much adoption because it was too complicated to use correctly. + +## Chats explained +For this reasons, Chats are a new and different entity, both in the API as well as in ActivityPub. A quick overview: + +- Chats are meant to represent an instant message conversation between two actors. For now these are only 1-on-1 conversations, but the other actor can be a group in the future. +- Chat messages have the ActivityPub type `ChatMessage`. They are not `Note`s. Servers that don't understand them will just drop them. +- The only addressing allowed in `ChatMessage`s is one single ActivityPub actor in the `to` field. +- There's always only one Chat between two actors. If you start chatting with someone and later start a 'new' Chat, the old Chat will be continued. +- `ChatMessage`s are posted with a different api, making it very hard to accidentally send a message to the wrong person. +- `ChatMessage`s don't show up in the existing timelines. +- Chats can never go from private to public. They are always private between the two actors. + +## Caveats + +- Chats are NOT E2E encrypted (yet). Security is still the same as email. + +## API + +In general, the way to send a `ChatMessage` is to first create a `Chat`, then post a message to that `Chat`. `Group`s will later be supported by making them a sub-type of `Account`. + +This is the overview of using the API. The API is also documented via OpenAPI, so you can view it and play with it by pointing SwaggerUI or a similar OpenAPI tool to `https://yourinstance.tld/api/openapi`. + +### Creating or getting a chat. + +To create or get an existing Chat for a certain recipient (identified by Account ID) +you can call: + +`POST /api/v1/pleroma/chats/by-account-id/:account_id` + +The account id is the normal FlakeId of the user +``` +POST /api/v1/pleroma/chats/by-account-id/someflakeid +``` + +If you already have the id of a chat, you can also use + +``` +GET /api/v1/pleroma/chats/:id +``` + +There will only ever be ONE Chat for you and a given recipient, so this call +will return the same Chat if you already have one with that user. + +Returned data: + +```json +{ + "account": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "id" : "1", + "unread" : 2, + "last_message" : {...}, // The last message in that chat + "updated_at": "2020-04-21T15:11:46.000Z" +} +``` + +### Marking a chat as read + +To mark a number of messages in a chat up to a certain message as read, you can use + +`POST /api/v1/pleroma/chats/:id/read` + + +Parameters: +- last_read_id: Given this id, all chat messages until this one will be marked as read. Required. + + +Returned data: + +```json +{ + "account": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "id" : "1", + "unread" : 0, + "updated_at": "2020-04-21T15:11:46.000Z" +} +``` + +### Marking a single chat message as read + +To set the `unread` property of a message to `false` + +`POST /api/v1/pleroma/chats/:id/messages/:message_id/read` + +Returned data: + +The modified chat message + +### Getting a list of Chats + +`GET /api/v1/pleroma/chats` + +This will return a list of chats that you have been involved in, sorted by their +last update (so new chats will be at the top). + +Parameters: + +- with_muted: Include chats from muted users (boolean). + +Returned data: + +```json +[ + { + "account": { + "id": "someflakeid", + "username": "somenick", + ... + }, + "id" : "1", + "unread" : 2, + "last_message" : {...}, // The last message in that chat + "updated_at": "2020-04-21T15:11:46.000Z" + } +] +``` + +The recipient of messages that are sent to this chat is given by their AP ID. +No pagination is implemented for now. + +### Getting the messages for a Chat + +For a given Chat id, you can get the associated messages with + +`GET /api/v1/pleroma/chats/:id/messages` + +This will return all messages, sorted by most recent to least recent. The usual +pagination options are implemented. + +Returned data: + +```json +[ + { + "account_id": "someflakeid", + "chat_id": "1", + "content": "Check this out :firefox:", + "created_at": "2020-04-21T15:11:46.000Z", + "emojis": [ + { + "shortcode": "firefox", + "static_url": "https://dontbulling.me/emoji/Firefox.gif", + "url": "https://dontbulling.me/emoji/Firefox.gif", + "visible_in_picker": false + } + ], + "id": "13", + "unread": true + }, + { + "account_id": "someflakeid", + "chat_id": "1", + "content": "Whats' up?", + "created_at": "2020-04-21T15:06:45.000Z", + "emojis": [], + "id": "12", + "unread": false, + "idempotency_key": "75442486-0874-440c-9db1-a7006c25a31f" + } +] +``` + +- idempotency_key: The copy of the `idempotency-key` HTTP request header that can be used for optimistic message sending. Included only during the first few minutes after the message creation. + +### Posting a chat message + +Posting a chat message for given Chat id works like this: + +`POST /api/v1/pleroma/chats/:id/messages` + +Parameters: +- content: The text content of the message. Optional if media is attached. +- media_id: The id of an upload that will be attached to the message. + +Currently, no formatting beyond basic escaping and emoji is implemented. + +Returned data: + +```json +{ + "account_id": "someflakeid", + "chat_id": "1", + "content": "Check this out :firefox:", + "created_at": "2020-04-21T15:11:46.000Z", + "emojis": [ + { + "shortcode": "firefox", + "static_url": "https://dontbulling.me/emoji/Firefox.gif", + "url": "https://dontbulling.me/emoji/Firefox.gif", + "visible_in_picker": false + } + ], + "id": "13", + "unread": false +} +``` + +### Deleting a chat message + +Deleting a chat message for given Chat id works like this: + +`DELETE /api/v1/pleroma/chats/:chat_id/messages/:message_id` + +Returned data is the deleted message. + +### Notifications + +There's a new `pleroma:chat_mention` notification, which has this form. It is not given out in the notifications endpoint by default, you need to explicitly request it with `include_types[]=pleroma:chat_mention`: + +```json +{ + "id": "someid", + "type": "pleroma:chat_mention", + "account": { ... } // User account of the sender, + "chat_message": { + "chat_id": "1", + "id": "10", + "content": "Hello", + "account_id": "someflakeid", + "unread": false + }, + "created_at": "somedate" +} +``` + +### Streaming + +There is an additional `user:pleroma_chat` stream. Incoming chat messages will make the current chat be sent to this `user` stream. The `event` of an incoming chat message is `pleroma:chat_update`. The payload is the updated chat with the incoming chat message in the `last_message` field. + +### Web Push + +If you want to receive push messages for this type, you'll need to add the `pleroma:chat_mention` type to your alerts in the push subscription. diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md new file mode 100644 index 000000000..84430408b --- /dev/null +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -0,0 +1,346 @@ +# Differences in Mastodon API responses from vanilla Mastodon + +A Pleroma instance can be identified by " (compatible; Pleroma )" present in `version` field in response from `/api/v1/instance` + +## Flake IDs + +Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However, just like Mastodon's ids, they are lexically sortable strings + +## Timelines + +Adding the parameter `with_muted=true` to the timeline queries will also return activities by muted (not by blocked!) users. + +Adding the parameter `exclude_visibilities` to the timeline queries will exclude the statuses with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`), e.g., `exclude_visibilities[]=direct&exclude_visibilities[]=private`. + +Adding the parameter `reply_visibility` to the public and home timelines queries will filter replies. Possible values: without parameter (default) shows all replies, `following` - replies directed to you or users you follow, `self` - replies directed to you. + +Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance). + +## Statuses + +- `visibility`: has additional possible values `list` and `local` (for local-only statuses) + +Has these additional fields under the `pleroma` object: + +- `local`: true if the post was made on the local instance +- `conversation_id`: the ID of the AP context the status is associated with (if any) +- `direct_conversation_id`: the ID of the Mastodon direct message conversation the status is associated with (if any) +- `in_reply_to_account_acct`: the `acct` property of User entity for replied user (if any) +- `content`: a map consisting of alternate representations of the `content` property with the key being its mimetype. Currently, the only alternate representation supported is `text/plain` +- `spoiler_text`: a map consisting of alternate representations of the `spoiler_text` property with the key being its mimetype. Currently, the only alternate representation supported is `text/plain` +- `expires_at`: a datetime (iso8601) that states when the post will expire (be deleted automatically), or empty if the post won't expire +- `thread_muted`: true if the thread the post belongs to is muted +- `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint. +- `parent_visible`: If the parent of this post is visible to the user or not. + +## Media Attachments + +Has these additional fields under the `pleroma` object: + +- `mime_type`: mime type of the attachment. + +### Attachment cap + +Some apps operate under the assumption that no more than 4 attachments can be returned or uploaded. Pleroma however does not enforce any limits on attachment count neither when returning the status object nor when posting. + +### Limitations + +Pleroma does not process remote images and therefore cannot include fields such as `meta` and `blurhash`. It does not support focal points or aspect ratios. The frontend is expected to handle it. + +## Accounts + +The `id` parameter can also be the `nickname` of the user. This only works in these endpoints, not the deeper nested ones for following etc. + +- `/api/v1/accounts/:id` +- `/api/v1/accounts/:id/statuses` + +Has these additional fields under the `pleroma` object: + +- `ap_id`: nullable URL string, ActivityPub id of the user +- `background_image`: nullable URL string, background image of the user +- `tags`: Lists an array of tags for the user +- `relationship` (object): Includes fields as documented for Mastodon API https://docs.joinmastodon.org/entities/relationship/ +- `is_moderator`: boolean, nullable, true if user is a moderator +- `is_admin`: boolean, nullable, true if user is an admin +- `confirmation_pending`: boolean, true if a new user account is waiting on email confirmation to be activated +- `hide_favorites`: boolean, true when the user has hiding favorites enabled +- `hide_followers`: boolean, true when the user has follower hiding enabled +- `hide_follows`: boolean, true when the user has follow hiding enabled +- `hide_followers_count`: boolean, true when the user has follower stat hiding enabled +- `hide_follows_count`: boolean, true when the user has follow stat hiding enabled +- `settings_store`: A generic map of settings for frontends. Opaque to the backend. Only returned in `/api/v1/accounts/verify_credentials` and `/api/v1/accounts/update_credentials` +- `chat_token`: The token needed for Pleroma chat. Only returned in `/api/v1/accounts/verify_credentials` +- `deactivated`: boolean, true when the user is deactivated +- `allow_following_move`: boolean, true when the user allows automatically follow moved following accounts +- `unread_conversation_count`: The count of unread conversations. Only returned to the account owner. +- `unread_notifications_count`: The count of unread notifications. Only returned to the account owner. +- `notification_settings`: object, can be absent. See `/api/pleroma/notification_settings` for the parameters/keys returned. +- `accepts_chat_messages`: boolean, but can be null if we don't have that information about a user +- `favicon`: nullable URL string, Favicon image of the user's instance + +### Source + +Has these additional fields under the `pleroma` object: + +- `show_role`: boolean, nullable, true when the user wants his role (e.g admin, moderator) to be shown +- `no_rich_text` - boolean, nullable, true when html tags are stripped from all statuses requested from the API +- `discoverable`: boolean, true when the user allows external services (search bots) etc. to index / list the account (regardless of this setting, user will still appear in regular search results) +- `actor_type`: string, the type of this account. + +## Conversations + +Has an additional field under the `pleroma` object: + +- `recipients`: The list of the recipients of this Conversation. These will be addressed when replying to this conversation. + +## GET `/api/v1/conversations` + +Accepts additional parameters: + +- `recipients`: Only return conversations with the given recipients (a list of user ids). Usage example: `GET /api/v1/conversations?recipients[]=1&recipients[]=2` + +## Account Search + +Behavior has changed: + +- `/api/v1/accounts/search`: Does not require authentication + +## Search (global) + +Unlisted posts are available in search results, they are considered to be public posts that shouldn't be shown in local/federated timeline. + +## Notifications + +Has these additional fields under the `pleroma` object: + +- `is_seen`: true if the notification was read by the user + +### Move Notification + +The `type` value is `move`. Has an additional field: + +- `target`: new account + +### EmojiReact Notification + +The `type` value is `pleroma:emoji_reaction`. Has these fields: + +- `emoji`: The used emoji +- `account`: The account of the user who reacted +- `status`: The status that was reacted on + +### ChatMention Notification (not default) + +This notification has to be requested explicitly. + +The `type` value is `pleroma:chat_mention` + +- `account`: The account who sent the message +- `chat_message`: The chat message + +### Report Notification (not default) + +This notification has to be requested explicitly. + +The `type` value is `pleroma:report` + +- `account`: The account who reported +- `report`: The report + +## GET `/api/v1/notifications` + +Accepts additional parameters: + +- `exclude_visibilities`: will exclude the notifications for activities with the given visibilities. The parameter accepts an array of visibility types (`public`, `unlisted`, `private`, `direct`). Usage example: `GET /api/v1/notifications?exclude_visibilities[]=direct&exclude_visibilities[]=private`. +- `include_types`: will include the notifications for activities with the given types. The parameter accepts an array of types (`mention`, `follow`, `reblog`, `favourite`, `move`, `pleroma:emoji_reaction`, `pleroma:chat_mention`, `pleroma:report`). Usage example: `GET /api/v1/notifications?include_types[]=mention&include_types[]=reblog`. + +## DELETE `/api/v1/notifications/destroy_multiple` + +An endpoint to delete multiple statuses by IDs. + +Required parameters: + +- `ids`: array of activity ids + +Usage example: `DELETE /api/v1/notifications/destroy_multiple/?ids[]=1&ids[]=2`. + +Returns on success: 200 OK `{}` + +## POST `/api/v1/statuses` + +Additional parameters can be added to the JSON body/Form data: + +- `preview`: boolean, if set to `true` the post won't be actually posted, but the status entity would still be rendered back. This could be useful for previewing rich text/custom emoji, for example. +- `content_type`: string, contain the MIME type of the status, it is transformed into HTML by the backend. You can get the list of the supported MIME types with the nodeinfo endpoint. +- `to`: A list of nicknames (like `lain@soykaf.club` or `lain` on the local server) that will be used to determine who is going to be addressed by this post. Using this will disable the implicit addressing by mentioned names in the `status` body, only the people in the `to` list will be addressed. The normal rules for post visibility are not affected by this and will still apply. +- `visibility`: string, besides standard MastoAPI values (`direct`, `private`, `unlisted`, `local` or `public`) it can be used to address a List by setting it to `list:LIST_ID`. +- `expires_in`: The number of seconds the posted activity should expire in. When a posted activity expires it will be deleted from the server, and a delete request for it will be federated. This needs to be longer than an hour. +- `in_reply_to_conversation_id`: Will reply to a given conversation, addressing only the people who are part of the recipient set of that conversation. Sets the visibility to `direct`. + +## GET `/api/v1/statuses` + +An endpoint to get multiple statuses by IDs. + +Required parameters: + +- `ids`: array of activity ids + +Usage example: `GET /api/v1/statuses/?ids[]=1&ids[]=2`. + +Returns: array of Status. + +The maximum number of statuses is limited to 100 per request. + +## PATCH `/api/v1/accounts/update_credentials` + +Additional parameters can be added to the JSON body/Form data: + +- `no_rich_text` - if true, html tags are stripped from all statuses requested from the API +- `hide_followers` - if true, user's followers will be hidden +- `hide_follows` - if true, user's follows will be hidden +- `hide_followers_count` - if true, user's follower count will be hidden +- `hide_follows_count` - if true, user's follow count will be hidden +- `hide_favorites` - if true, user's favorites timeline will be hidden +- `show_role` - if true, user's role (e.g admin, moderator) will be exposed to anyone in the API +- `default_scope` - the scope returned under `privacy` key in Source subentity +- `pleroma_settings_store` - Opaque user settings to be saved on the backend. +- `skip_thread_containment` - if true, skip filtering out broken threads +- `allow_following_move` - if true, allows automatically follow moved following accounts +- `also_known_as` - array of ActivityPub IDs, needed for following move +- `pleroma_background_image` - sets the background image of the user. Can be set to "" (an empty string) to reset. +- `discoverable` - if true, external services (search bots) etc. are allowed to index / list the account (regardless of this setting, user will still appear in regular search results). +- `actor_type` - the type of this account. +- `accepts_chat_messages` - if false, this account will reject all chat messages. + +All images (avatar, banner and background) can be reset to the default by sending an empty string ("") instead of a file. + +### Pleroma Settings Store + +Pleroma has mechanism that allows frontends to save blobs of json for each user on the backend. This can be used to save frontend-specific settings for a user that the backend does not need to know about. + +The parameter should have a form of `{frontend_name: {...}}`, with `frontend_name` identifying your type of client, e.g. `pleroma_fe`. It will overwrite everything under this property, but will not overwrite other frontend's settings. + +This information is returned in the `/api/v1/accounts/verify_credentials` endpoint. + +## Authentication + +*Pleroma supports refreshing tokens.* + +`POST /oauth/token` + +Post here request with `grant_type=refresh_token` to obtain new access token. Returns an access token. + +## Account Registration + +`POST /api/v1/accounts` + +Has these additional parameters (which are the same as in Pleroma-API): + +- `fullname`: optional +- `bio`: optional +- `captcha_solution`: optional, contains provider-specific captcha solution, +- `captcha_token`: optional, contains provider-specific captcha token +- `captcha_answer_data`: optional, contains provider-specific captcha data +- `token`: invite token required when the registrations aren't public. + +## Instance + +`GET /api/v1/instance` has additional fields + +- `max_toot_chars`: The maximum characters per post +- `chat_limit`: The maximum characters per chat message +- `description_limit`: The maximum characters per image description +- `poll_limits`: The limits of polls +- `upload_limit`: The maximum upload file size +- `avatar_upload_limit`: The same for avatars +- `background_upload_limit`: The same for backgrounds +- `banner_upload_limit`: The same for banners +- `background_image`: A background image that frontends can use +- `pleroma.metadata.features`: A list of supported features +- `pleroma.metadata.federation`: The federation restrictions of this instance +- `pleroma.metadata.fields_limits`: A list of values detailing the length and count limitation for various instance-configurable fields. +- `pleroma.metadata.post_formats`: A list of the allowed post format types +- `vapid_public_key`: The public key needed for push messages + +## Push Subscription + +`POST /api/v1/push/subscription` +`PUT /api/v1/push/subscription` + +Permits these additional alert types: + +- pleroma:chat_mention +- pleroma:emoji_reaction + +## Markers + +Has these additional fields under the `pleroma` object: + +- `unread_count`: contains number unread notifications + +## Streaming + +### Chats + +There is an additional `user:pleroma_chat` stream. Incoming chat messages will make the current chat be sent to this `user` stream. The `event` of an incoming chat message is `pleroma:chat_update`. The payload is the updated chat with the incoming chat message in the `last_message` field. + +### Remote timelines + +For viewing remote server timelines, there are `public:remote` and `public:remote:media` streams. Each of these accept a parameter like `?instance=lain.com`. + +### Follow relationships updates + +Pleroma streams follow relationships updates as `pleroma:follow_relationships_update` events to the `user` stream. + +The message payload consist of: + +- `state`: a relationship state, one of `follow_pending`, `follow_accept` or `follow_reject`. + +- `follower` and `following` maps with following fields: + - `id`: user ID + - `follower_count`: follower count + - `following_count`: following count + +## User muting and thread muting + +Both user muting and thread muting can be done for only a certain time by adding an `expires_in` parameter to the API calls and giving the expiration time in seconds. + +## Not implemented + +Pleroma is generally compatible with the Mastodon 2.7.2 API, but some newer features and non-essential features are omitted. These features usually return an HTTP 200 status code, but with an empty response. While they may be added in the future, they are considered low priority. + +### Suggestions + +*Added in Mastodon 2.4.3* + +- `GET /api/v1/suggestions`: Returns an empty array, `[]` + +### Trends + +*Added in Mastodon 3.0.0* + +- `GET /api/v1/trends`: Returns an empty array, `[]` + +### Identity proofs + +*Added in Mastodon 2.8.0* + +- `GET /api/v1/identity_proofs`: Returns an empty array, `[]` + +### Endorsements + +*Added in Mastodon 2.5.0* + +- `GET /api/v1/endorsements`: Returns an empty array, `[]` + +### Profile directory + +*Added in Mastodon 3.0.0* + +- `GET /api/v1/directory`: Returns HTTP 404 + +### Featured tags + +*Added in Mastodon 3.0.0* + +- `GET /api/v1/featured_tags`: Returns HTTP 404 diff --git a/docs/development/API/pleroma_api.md b/docs/development/API/pleroma_api.md new file mode 100644 index 000000000..d8790ca32 --- /dev/null +++ b/docs/development/API/pleroma_api.md @@ -0,0 +1,655 @@ +# Pleroma API + +Requests that require it can be authenticated with [an OAuth token](https://tools.ietf.org/html/rfc6749), the `_pleroma_key` cookie, or [HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization). + +Request parameters can be passed via [query strings](https://en.wikipedia.org/wiki/Query_string) or as [form data](https://www.w3.org/TR/html401/interact/forms.html). Files must be uploaded as `multipart/form-data`. + +## `/api/pleroma/emoji` +### Lists the custom emoji on that server. +* Method: `GET` +* Authentication: not required +* Params: none +* Response: JSON +* Example response: +```json +{ + "girlpower": { + "tags": [ + "Finmoji" + ], + "image_url": "/finmoji/128px/girlpower-128.png" + }, + "education": { + "tags": [ + "Finmoji" + ], + "image_url": "/finmoji/128px/education-128.png" + }, + "finnishlove": { + "tags": [ + "Finmoji" + ], + "image_url": "/finmoji/128px/finnishlove-128.png" + } +} +``` +* Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format + +## `/api/pleroma/follow_import` +### Imports your follows, for example from a Mastodon CSV file. +* Method: `POST` +* Authentication: required +* Params: + * `list`: STRING or FILE containing a whitespace-separated list of accounts to follow +* Response: HTTP 200 on success, 500 on error +* Note: Users that can't be followed are silently skipped. + +## `/api/pleroma/blocks_import` +### Imports your blocks. +* Method: `POST` +* Authentication: required +* Params: + * `list`: STRING or FILE containing a whitespace-separated list of accounts to block +* Response: HTTP 200 on success, 500 on error + +## `/api/pleroma/mutes_import` +### Imports your mutes. +* Method: `POST` +* Authentication: required +* Params: + * `list`: STRING or FILE containing a whitespace-separated list of accounts to mute +* Response: HTTP 200 on success, 500 on error + +## `/api/pleroma/captcha` +### Get a new captcha +* Method: `GET` +* Authentication: not required +* Params: none +* Response: Provider specific JSON, the only guaranteed parameter is `type` +* Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint", "seconds_valid": 300}` + +## `/api/pleroma/delete_account` +### Delete an account +* Method `POST` +* Authentication: required +* Params: + * `password`: user's password +* Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise +* Example response: `{"error": "Invalid password."}` + +## `/api/pleroma/disable_account` +### Disable an account +* Method `POST` +* Authentication: required +* Params: + * `password`: user's password +* Response: JSON. Returns `{"status": "success"}` if the account was successfully disabled, `{"error": "[error message]"}` otherwise +* Example response: `{"error": "Invalid password."}` + +## `/api/pleroma/accounts/mfa` +#### Gets current MFA settings +* method: `GET` +* Authentication: required +* OAuth scope: `read:security` +* Response: JSON. Returns `{"enabled": "false", "totp": false }` + +## `/api/pleroma/accounts/mfa/setup/totp` +#### Pre-setup the MFA/TOTP method +* method: `GET` +* Authentication: required +* OAuth scope: `write:security` +* Response: JSON. Returns `{"key": [secret_key], "provisioning_uri": "[qr code uri]" }` when successful, otherwise returns HTTP 422 `{"error": "error_msg"}` + +## `/api/pleroma/accounts/mfa/confirm/totp` +#### Confirms & enables MFA/TOTP support for user account. +* method: `POST` +* Authentication: required +* OAuth scope: `write:security` +* Params: + * `password`: user's password + * `code`: token from TOTP App +* Response: JSON. Returns `{}` if the enable was successful, HTTP 422 `{"error": "[error message]"}` otherwise + + +## `/api/pleroma/accounts/mfa/totp` +#### Disables MFA/TOTP method for user account. +* method: `DELETE` +* Authentication: required +* OAuth scope: `write:security` +* Params: + * `password`: user's password +* Response: JSON. Returns `{}` if the disable was successful, HTTP 422 `{"error": "[error message]"}` otherwise +* Example response: `{"error": "Invalid password."}` + +## `/api/pleroma/accounts/mfa/backup_codes` +#### Generstes backup codes MFA for user account. +* method: `GET` +* Authentication: required +* OAuth scope: `write:security` +* Response: JSON. Returns `{"codes": codes}`when successful, otherwise HTTP 422 `{"error": "[error message]"}` + +## `/api/pleroma/admin/` +See [Admin-API](admin_api.md) + +## `/api/v1/pleroma/notifications/read` +### Mark notifications as read +* Method `POST` +* Authentication: required +* Params (mutually exclusive): + * `id`: a single notification id to read + * `max_id`: read all notifications up to this id +* Response: Notification entity/Array of Notification entities that were read. In case of `max_id`, only the first 80 read notifications will be returned. + +## `/api/v1/pleroma/accounts/:id/subscribe` +### Subscribe to receive notifications for all statuses posted by a user +* Method `POST` +* Authentication: required +* Params: + * `id`: account id to subscribe to +* Response: JSON, returns a mastodon relationship object on success, otherwise returns `{"error": "error_msg"}` +* Example response: +```json +{ + "id": "abcdefg", + "following": true, + "followed_by": false, + "blocking": false, + "muting": false, + "muting_notifications": false, + "subscribing": true, + "requested": false, + "domain_blocking": false, + "showing_reblogs": true, + "endorsed": false +} +``` + +## `/api/v1/pleroma/accounts/:id/unsubscribe` +### Unsubscribe to stop receiving notifications from user statuses +* Method `POST` +* Authentication: required +* Params: + * `id`: account id to unsubscribe from +* Response: JSON, returns a mastodon relationship object on success, otherwise returns `{"error": "error_msg"}` +* Example response: +```json +{ + "id": "abcdefg", + "following": true, + "followed_by": false, + "blocking": false, + "muting": false, + "muting_notifications": false, + "subscribing": false, + "requested": false, + "domain_blocking": false, + "showing_reblogs": true, + "endorsed": false +} +``` + +## `/api/v1/pleroma/accounts/:id/favourites` +### Returns favorites timeline of any user +* Method `GET` +* Authentication: not required +* Params: + * `id`: the id of the account for whom to return results + * `limit`: optional, the number of records to retrieve + * `since_id`: optional, returns results that are more recent than the specified id + * `max_id`: optional, returns results that are older than the specified id +* Response: JSON, returns a list of Mastodon Status entities on success, otherwise returns `{"error": "error_msg"}` +* Example response: +```json +[ + { + "account": { + "id": "9hptFmUF3ztxYh3Svg", + "url": "https://pleroma.example.org/users/nick2", + "username": "nick2", + ... + }, + "application": {"name": "Web", "website": null}, + "bookmarked": false, + "card": null, + "content": "This is :moominmamma: note 0", + "created_at": "2019-04-15T15:42:15.000Z", + "emojis": [], + "favourited": false, + "favourites_count": 1, + "id": "9hptFmVJ02khbzYJaS", + "in_reply_to_account_id": null, + "in_reply_to_id": null, + "language": null, + "media_attachments": [], + "mentions": [], + "muted": false, + "pinned": false, + "pleroma": { + "content": {"text/plain": "This is :moominmamma: note 0"}, + "conversation_id": 13679, + "local": true, + "spoiler_text": {"text/plain": "2hu"} + }, + "reblog": null, + "reblogged": false, + "reblogs_count": 0, + "replies_count": 0, + "sensitive": false, + "spoiler_text": "2hu", + "tags": [{"name": "2hu", "url": "/tag/2hu"}], + "uri": "https://pleroma.example.org/objects/198ed2a1-7912-4482-b559-244a0369e984", + "url": "https://pleroma.example.org/notice/9hptFmVJ02khbzYJaS", + "visibility": "public" + } +] +``` + +## `/api/v1/pleroma/accounts/update_*` +### Set and clear account avatar, banner, and background + +- PATCH `/api/v1/pleroma/accounts/update_avatar`: Set/clear user avatar image +- PATCH `/api/v1/pleroma/accounts/update_banner`: Set/clear user banner image +- PATCH `/api/v1/pleroma/accounts/update_background`: Set/clear user background image + +## `/api/v1/pleroma/accounts/confirmation_resend` +### Resend confirmation email +* Method `POST` +* Params: + * `email`: email of that needs to be verified +* Authentication: not required +* Response: 204 No Content + +## `/api/v1/pleroma/mascot` +### Gets user mascot image +* Method `GET` +* Authentication: required + +* Response: JSON. Returns a mastodon media attachment entity. +* Example response: +```json +{ + "id": "abcdefg", + "url": "https://pleroma.example.org/media/abcdefg.png", + "type": "image", + "pleroma": { + "mime_type": "image/png" + } +} +``` + +### Updates user mascot image +* Method `PUT` +* Authentication: required +* Params: + * `file`: Multipart image +* Response: JSON. Returns a mastodon media attachment entity + when successful, otherwise returns HTTP 415 `{"error": "error_msg"}` +* Example response: +```json +{ + "id": "abcdefg", + "url": "https://pleroma.example.org/media/abcdefg.png", + "type": "image", + "pleroma": { + "mime_type": "image/png" + } +} +``` +* Note: Behaves exactly the same as `POST /api/v1/upload`. + Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`. + +## `/api/pleroma/notification_settings` +### Updates user notification settings +* Method `PUT` +* Authentication: required +* Params: + * `block_from_strangers`: BOOLEAN field, blocks notifications from accounts you do not follow + * `hide_notification_contents`: BOOLEAN field. When set to true, it removes the contents of a message from the push notification. +* Response: JSON. Returns `{"status": "success"}` if the update was successful, otherwise returns `{"error": "error_msg"}` + +## `/api/pleroma/healthcheck` +### Healthcheck endpoint with additional system data. +* Method `GET` +* Authentication: not required +* Params: none +* Response: JSON, statuses (200 - healthy, 503 unhealthy). +* Example response: +```json +{ + "pool_size": 0, # database connection pool + "active": 0, # active processes + "idle": 0, # idle processes + "memory_used": 0.00, # Memory used + "healthy": true, # Instance state + "job_queue_stats": {} # Job queue stats +} +``` + +## `/api/pleroma/change_email` +### Change account email +* Method `POST` +* Authentication: required +* Params: + * `password`: user's password + * `email`: new email +* Response: JSON. Returns `{"status": "success"}` if the change was successful, `{"error": "[error message]"}` otherwise +* Note: Currently, Mastodon has no API for changing email. If they add it in future it might be incompatible with Pleroma. + +# Pleroma Conversations + +Pleroma Conversations have the same general structure that Mastodon Conversations have. The behavior differs in the following ways when using these endpoints: + +1. Pleroma Conversations never add or remove recipients, unless explicitly changed by the user. +2. Pleroma Conversations statuses can be requested by Conversation id. +3. Pleroma Conversations can be replied to. + +Conversations have the additional field `recipients` under the `pleroma` key. This holds a list of all the accounts that will receive a message in this conversation. + +The status posting endpoint takes an additional parameter, `in_reply_to_conversation_id`, which, when set, will set the visiblity to direct and address only the people who are the recipients of that Conversation. + +⚠ Conversation IDs can be found in direct messages with the `pleroma.direct_conversation_id` key, do not confuse it with `pleroma.conversation_id`. + +## `GET /api/v1/pleroma/conversations/:id/statuses` +### Timeline for a given conversation +* Method `GET` +* Authentication: required +* Params: Like other timelines +* Response: JSON, statuses (200 - healthy, 503 unhealthy). + +## `GET /api/v1/pleroma/conversations/:id` +### The conversation with the given ID. +* Method `GET` +* Authentication: required +* Params: None +* Response: JSON, statuses (200 - healthy, 503 unhealthy). + +## `PATCH /api/v1/pleroma/conversations/:id` +### Update a conversation. Used to change the set of recipients. +* Method `PATCH` +* Authentication: required +* Params: + * `recipients`: A list of ids of users that should receive posts to this conversation. This will replace the current list of recipients, so submit the full list. The owner of owner of the conversation will always be part of the set of recipients, though. +* Response: JSON, statuses (200 - healthy, 503 unhealthy) + +## `POST /api/v1/pleroma/conversations/read` +### Marks all user's conversations as read. +* Method `POST` +* Authentication: required +* Params: None +* Response: JSON, returns a list of Mastodon Conversation entities that were marked as read (200 - healthy, 503 unhealthy). + +## `GET /api/pleroma/emoji/pack?name=:name` + +### Get pack.json for the pack + +* Method `GET` +* Authentication: not required +* Params: + * `page`: page number for files (default 1) + * `page_size`: page size for files (default 30) +* Response: JSON, pack json with `files`, `files_count` and `pack` keys with 200 status or 404 if the pack does not exist. + +```json +{ + "files": {...}, + "files_count": 0, // emoji count in pack + "pack": {...} +} +``` + +## `POST /api/pleroma/emoji/pack?name=:name` + +### Creates an empty pack + +* Method `POST` +* Authentication: required (admin) +* Params: + * `name`: pack name +* Response: JSON, "ok" and 200 status or 409 if the pack with that name already exists + +## `PATCH /api/pleroma/emoji/pack?name=:name` + +### Updates (replaces) pack metadata + +* Method `PATCH` +* Authentication: required (admin) +* Params: + * `name`: pack name + * `metadata`: metadata to replace the old one + * `license`: Pack license + * `homepage`: Pack home page url + * `description`: Pack description + * `fallback-src`: Fallback url to download pack from + * `fallback-src-sha256`: SHA256 encoded for fallback pack archive + * `share-files`: is pack allowed for sharing (boolean) +* Response: JSON, updated "metadata" section of the pack and 200 status or 400 if there was a + problem with the new metadata (the error is specified in the "error" part of the response JSON) + +## `DELETE /api/pleroma/emoji/pack?name=:name` + +### Delete a custom emoji pack + +* Method `DELETE` +* Authentication: required (admin) +* Params: + * `name`: pack name +* Response: JSON, "ok" and 200 status or 500 if there was an error deleting the pack + +## `GET /api/pleroma/emoji/packs/import` + +### Imports packs from filesystem + +* Method `GET` +* Authentication: required (admin) +* Params: None +* Response: JSON, returns a list of imported packs. + +## `GET /api/pleroma/emoji/packs/remote` + +### Make request to another instance for packs list + +* Method `GET` +* Authentication: required (admin) +* Params: + * `url`: url of the instance to get packs from + * `page`: page number for packs (default 1) + * `page_size`: page size for packs (default 50) +* Response: JSON with the pack list, hashmap with pack name and pack contents + +## `POST /api/pleroma/emoji/packs/download` + +### Download pack from another instance + +* Method `POST` +* Authentication: required (admin) +* Params: + * `url`: url of the instance to download from + * `name`: pack to download from that instance + * `as`: (*optional*) name how to save pack +* Response: JSON, "ok" with 200 status if the pack was downloaded, or 500 if there were + errors downloading the pack + +## `POST /api/pleroma/emoji/packs/files?name=:name` + +### Add new file to the pack + +* Method `POST` +* Authentication: required (admin) +* Params: + * `name`: pack name + * `file`: file needs to be uploaded with the multipart request or link to remote file. + * `shortcode`: (*optional*) shortcode for new emoji, must be unique for all emoji. If not sended, shortcode will be taken from original filename. + * `filename`: (*optional*) new emoji file name. If not specified will be taken from original filename. +* Response: JSON, list of files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. + +## `PATCH /api/pleroma/emoji/packs/files?name=:name` + +### Update emoji file from pack + +* Method `PATCH` +* Authentication: required (admin) +* Params: + * `name`: pack name + * `shortcode`: emoji file shortcode + * `new_shortcode`: new emoji file shortcode + * `new_filename`: new filename for emoji file + * `force`: (*optional*) with true value to overwrite existing emoji with new shortcode +* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. + +## `DELETE /api/pleroma/emoji/packs/files?name=:name` + +### Delete emoji file from pack + +* Method `DELETE` +* Authentication: required (admin) +* Params: + * `name`: pack name + * `shortcode`: emoji file shortcode +* Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. + +## `GET /api/pleroma/emoji/packs` + +### Lists local custom emoji packs + +* Method `GET` +* Authentication: not required +* Params: + * `page`: page number for packs (default 1) + * `page_size`: page size for packs (default 50) +* Response: `packs` key with JSON hashmap of pack name to pack contents and `count` key for count of packs. + +```json +{ + "packs": { + "pack_name": {...}, // pack contents + ... + }, + "count": 0 // packs count +} +``` + +## `GET /api/pleroma/emoji/packs/archive?name=:name` + +### Requests a local pack archive from the instance + +* Method `GET` +* Authentication: not required +* Params: + * `name`: pack name +* Response: the archive of the pack with a 200 status code, 403 if the pack is not set as shared, + 404 if the pack does not exist + +## `GET /api/v1/pleroma/accounts/:id/scrobbles` +### Requests a list of current and recent Listen activities for an account +* Method `GET` +* Authentication: not required +* Params: None +* Response: An array of media metadata entities. +* Example response: +```json +[ + { + "account": {...}, + "id": "1234", + "title": "Some Title", + "artist": "Some Artist", + "album": "Some Album", + "length": 180000, + "created_at": "2019-09-28T12:40:45.000Z" + } +] +``` + +## `POST /api/v1/pleroma/scrobble` +### Creates a new Listen activity for an account +* Method `POST` +* Authentication: required +* Params: + * `title`: the title of the media playing + * `album`: the album of the media playing [optional] + * `artist`: the artist of the media playing [optional] + * `length`: the length of the media playing [optional] +* Response: the newly created media metadata entity representing the Listen activity + +# Emoji Reactions + +Emoji reactions work a lot like favourites do. They make it possible to react to a post with a single emoji character. To detect the presence of this feature, you can check `pleroma_emoji_reactions` entry in the features list of nodeinfo. + +## `PUT /api/v1/pleroma/statuses/:id/reactions/:emoji` +### React to a post with a unicode emoji +* Method: `PUT` +* Authentication: required +* Params: `emoji`: A unicode RGI emoji or a regional indicator +* Response: JSON, the status. + +## `DELETE /api/v1/pleroma/statuses/:id/reactions/:emoji` +### Remove a reaction to a post with a unicode emoji +* Method: `DELETE` +* Authentication: required +* Params: `emoji`: A unicode RGI emoji or a regional indicator +* Response: JSON, the status. + +## `GET /api/v1/pleroma/statuses/:id/reactions` +### Get an object of emoji to account mappings with accounts that reacted to the post +* Method: `GET` +* Authentication: optional +* Params: None +* Response: JSON, a list of emoji/account list tuples, sorted by emoji insertion date, in ascending order, e.g, the first emoji in the list is the oldest. +* Example Response: +```json +[ + {"name": "😀", "count": 2, "me": true, "accounts": [{"id" => "xyz.."...}, {"id" => "zyx..."}]}, + {"name": "☕", "count": 1, "me": false, "accounts": [{"id" => "abc..."}]} +] +``` + +## `GET /api/v1/pleroma/statuses/:id/reactions/:emoji` +### Get an object of emoji to account mappings with accounts that reacted to the post for a specific emoji +* Method: `GET` +* Authentication: optional +* Params: None +* Response: JSON, a list of emoji/account list tuples +* Example Response: +```json +[ + {"name": "😀", "count": 2, "me": true, "accounts": [{"id" => "xyz.."...}, {"id" => "zyx..."}]} +] +``` + +## `POST /api/v1/pleroma/backups` +### Create a user backup archive + +* Method: `POST` +* Authentication: required +* Params: none +* Response: JSON +* Example response: + +```json +[{ + "content_type": "application/zip", + "file_size": 0, + "inserted_at": "2020-09-10T16:18:03.000Z", + "processed": false, + "url": "https://example.com/media/backups/archive-foobar-20200910T161803-QUhx6VYDRQ2wfV0SdA2Pfj_2CLM_ATUlw-D5l5TJf4Q.zip" +}] +``` + +## `GET /api/v1/pleroma/backups` +### Lists user backups + +* Method: `GET` +* Authentication: not required +* Params: none +* Response: JSON +* Example response: + +```json +[{ + "content_type": "application/zip", + "file_size": 55457, + "inserted_at": "2020-09-10T16:18:03.000Z", + "processed": true, + "url": "https://example.com/media/backups/archive-foobar-20200910T161803-QUhx6VYDRQ2wfV0SdA2Pfj_2CLM_ATUlw-D5l5TJf4Q.zip" +}] +``` diff --git a/docs/development/API/prometheus.md b/docs/development/API/prometheus.md new file mode 100644 index 000000000..a5158d905 --- /dev/null +++ b/docs/development/API/prometheus.md @@ -0,0 +1,44 @@ +# Prometheus Metrics + +Pleroma includes support for exporting metrics via the [prometheus_ex](https://github.com/deadtrickster/prometheus.ex) library. + +Config example: + +``` +config :prometheus, Pleroma.Web.Endpoint.MetricsExporter, + enabled: true, + auth: {:basic, "myusername", "mypassword"}, + ip_whitelist: ["127.0.0.1"], + path: "/api/pleroma/app_metrics", + format: :text +``` + +* `enabled` (Pleroma extension) enables the endpoint +* `ip_whitelist` (Pleroma extension) could be used to restrict access only to specified IPs +* `auth` sets the authentication (`false` for no auth; configurable to HTTP Basic Auth, see [prometheus-plugs](https://github.com/deadtrickster/prometheus-plugs#exporting) documentation) +* `format` sets the output format (`:text` or `:protobuf`) +* `path` sets the path to app metrics page + + +## `/api/pleroma/app_metrics` + +### Exports Prometheus application metrics + +* Method: `GET` +* Authentication: not required by default (see configuration options above) +* Params: none +* Response: text + +## Grafana + +### Config example + +The following is a config example to use with [Grafana](https://grafana.com) + +``` + - job_name: 'beam' + metrics_path: /api/pleroma/app_metrics + scheme: https + static_configs: + - targets: ['pleroma.soykaf.com'] +``` diff --git a/docs/development/ap_extensions.md b/docs/development/ap_extensions.md new file mode 100644 index 000000000..3d1caeb3e --- /dev/null +++ b/docs/development/ap_extensions.md @@ -0,0 +1,65 @@ +# AP Extensions +## Actor endpoints + +The following endpoints are additionally present into our actors. + +- `oauthRegistrationEndpoint` (`http://litepub.social/ns#oauthRegistrationEndpoint`) +- `uploadMedia` (`https://www.w3.org/ns/activitystreams#uploadMedia`) + +### oauthRegistrationEndpoint + +Points to MastodonAPI `/api/v1/apps` for now. + +See + +### uploadMedia + +Inspired by , it is part of the ActivityStreams namespace because it used to be part of the ActivityPub specification and got removed from it. + +Content-Type: multipart/form-data + +Parameters: +- (required) `file`: The file being uploaded +- (optionnal) `description`: A plain-text description of the media, for accessibility purposes. + +Response: HTTP 201 Created with the object into the body, no `Location` header provided as it doesn't have an `id` + +The object given in the reponse should then be inserted into an Object's `attachment` field. + +## ChatMessages + +`ChatMessage`s are the messages sent in 1-on-1 chats. They are similar to +`Note`s, but the addresing is done by having a single AP actor in the `to` +field. Addressing multiple actors is not allowed. These messages are always +private, there is no public version of them. They are created with a `Create` +activity. + +They are part of the `litepub` namespace as `http://litepub.social/ns#ChatMessage`. + +Example: + +```json +{ + "actor": "http://2hu.gensokyo/users/raymoo", + "id": "http://2hu.gensokyo/objects/1", + "object": { + "attributedTo": "http://2hu.gensokyo/users/raymoo", + "content": "You expected a cute girl? Too bad.", + "id": "http://2hu.gensokyo/objects/2", + "published": "2020-02-12T14:08:20Z", + "to": [ + "http://2hu.gensokyo/users/marisa" + ], + "type": "ChatMessage" + }, + "published": "2018-02-12T14:08:20Z", + "to": [ + "http://2hu.gensokyo/users/marisa" + ], + "type": "Create" +} +``` + +This setup does not prevent multi-user chats, but these will have to go through +a `Group`, which will be the recipient of the messages and then `Announce` them +to the users in the `Group`. diff --git a/docs/development/authentication_authorization.md b/docs/development/authentication_authorization.md new file mode 100644 index 000000000..183bfc2c9 --- /dev/null +++ b/docs/development/authentication_authorization.md @@ -0,0 +1,21 @@ +# Authentication & Authorization + +## OAuth token-based authentication & authorization + +* Pleroma supports hierarchical OAuth scopes, just like Mastodon but with added granularity of admin scopes. For a reference, see [Mastodon OAuth scopes](https://docs.joinmastodon.org/api/oauth-scopes/). + +* It is important to either define OAuth scope restrictions or explicitly mark OAuth scope check as skipped, for every controller action. To define scopes, call `plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: [...]})`. To explicitly set OAuth scopes check skipped, call `plug(:skip_plug, Pleroma.Web.Plugs.OAuthScopesPlug )`. + +* In controllers, `use Pleroma.Web, :controller` will result in `action/2` (see `Pleroma.Web.controller/0` for definition) be called prior to actual controller action, and it'll perform security / privacy checks before passing control to actual controller action. + + For routes with `:authenticated_api` pipeline, authentication & authorization are expected, thus `OAuthScopesPlug` will be run unless explicitly skipped (also `EnsureAuthenticatedPlug` will be executed immediately before action even if there was an early run to give an early error, since `OAuthScopesPlug` supports `:proceed_unauthenticated` option, and other plugs may support similar options as well). + + For `:api` pipeline routes, it'll be verified whether `OAuthScopesPlug` was called or explicitly skipped, and if it was not then auth information will be dropped for request. Then `EnsurePublicOrAuthenticatedPlug` will be called to ensure that either the instance is not private or user is authenticated (unless explicitly skipped). Such automated checks help to prevent human errors and result in higher security / privacy for users. + +## Non-OAuth authentication + +* With non-OAuth authentication ([HTTP Basic Authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) or HTTP header- or params-provided auth), OAuth scopes check is _not_ performed for any action (since password is provided during the auth, requester is able to obtain a token with full permissions anyways); auth plugs invoke `Pleroma.Helpers.AuthHelper.skip_oauth(conn)` in this case. + +## Auth-related configuration, OAuth consumer mode etc. + +See `Authentication` section of [the configuration cheatsheet](../configuration/cheatsheet.md#authentication). diff --git a/docs/development/index.md b/docs/development/index.md new file mode 100644 index 000000000..01a617596 --- /dev/null +++ b/docs/development/index.md @@ -0,0 +1 @@ +This section contains notes and guidelines for developers. diff --git a/docs/development/setting_up_pleroma_dev.md b/docs/development/setting_up_pleroma_dev.md new file mode 100644 index 000000000..8da761d62 --- /dev/null +++ b/docs/development/setting_up_pleroma_dev.md @@ -0,0 +1,70 @@ +# Setting up a Pleroma development environment + +Pleroma requires some adjustments from the defaults for running the instance locally. The following should help you to get started. + +## Installing + +1. Install Pleroma as explained in [the docs](../installation/debian_based_en.md), with some exceptions: + * You can use your own fork of the repository and add pleroma as a remote `git remote add pleroma 'https://git.pleroma.social/pleroma/pleroma'` + * You can skip systemd and nginx and all that stuff + * No need to create a dedicated pleroma user, it's easier to just use your own user + * For the DB you can still choose a dedicated user, the mix tasks set it up for you so it's no extra work for you + * For domain you can use `localhost` + * instead of creating a `prod.secret.exs`, create `dev.secret.exs` + * No need to prefix with `MIX_ENV=prod`. We're using dev and that's the default MIX_ENV +2. Change the dev.secret.exs + * Change the scheme in `config :pleroma, Pleroma.Web.Endpoint` to http (see examples below) + * If you want to change other settings, you can do that too +3. You can now start the server `mix phx.server`. Once it's build and started, you can access the instance on `http://:` (e.g.http://localhost:4000 ) and should be able to do everything locally you normaly can. + +Example config to change the scheme to http. Change the port if you want to run on another port. +```elixir + config :pleroma, Pleroma.Web.Endpoint, + url: [host: "localhost", scheme: "http", port: 4000], +``` + +Example config to disable captcha. This makes it a bit easier to create test-users. +```elixir +config :pleroma, Pleroma.Captcha, + enabled: false +``` + +Example config to change the log level to info +```elixir +config :logger, :console, + # :debug :info :warning :error + level: :info +``` + +## Testing + +1. Create a `test.secret.exs` file with the content as shown below +2. Create the database user and test database. + 1. You can use the `config/setup_db.psql` as a template. Copy the file if you want and change the database name, user and password to the values for the test-database (e.g. 'pleroma_local_test' for database and user). Then run this file like you did during installation. + 2. The tests will try to create the Database, so we'll have to allow our test-database user to create databases, `sudo -Hu postgres psql -c "ALTER USER pleroma_local_test WITH CREATEDB;"` +3. Run the tests with `mix test`. The tests should succeed. + +Example content for the `test.secret.exs` file. Feel free to use another user, database name or password, just make sure the database is dedicated for the testing environment. +```elixir +# Pleroma test configuration + +# NOTE: This file should not be committed to a repo or otherwise made public +# without removing sensitive information. + +import Config + +config :pleroma, Pleroma.Repo, + username: "pleroma_local_test", + password: "mysuperduperpassword", + database: "pleroma_local_test", + hostname: "localhost" + +``` + +## Updating + +Update Pleroma as explained in [the docs](../administration/updating.md). Just make sure you pull from upstream and not from your own fork. + +## Working on multiple branches + +If you develop on a separate branch, it's possible you did migrations that aren't merged into another branch you're working on. If you have multiple things you're working on, it's probably best to set up multiple pleroma's each with their own database. If you finished with a branch and want to switch back to develop to start a new branch from there, you can drop the database and recreate the database (e.g. by using `config/setup_db.psql`). The commands to drop and recreate the database can be found in [the docs](../administration/backup.md). diff --git a/docs/installation/alpine_linux_en.md b/docs/installation/alpine_linux_en.md index 62f2fb778..2f8520a78 100644 --- a/docs/installation/alpine_linux_en.md +++ b/docs/installation/alpine_linux_en.md @@ -80,7 +80,7 @@ sudo /etc/init.d/postgresql start sudo rc-update add postgresql ``` -### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md)) +### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md)) ```shell sudo apk add ffmpeg imagemagick exiftool diff --git a/docs/installation/arch_linux_en.md b/docs/installation/arch_linux_en.md index 0eb6d2d5f..9cbd3f429 100644 --- a/docs/installation/arch_linux_en.md +++ b/docs/installation/arch_linux_en.md @@ -56,7 +56,7 @@ sudo -iu postgres initdb -D /var/lib/postgres/data sudo systemctl enable --now postgresql.service ``` -### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md)) +### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md)) ```shell sudo pacman -S ffmpeg imagemagick perl-image-exiftool diff --git a/docs/installation/debian_based_en.md b/docs/installation/debian_based_en.md index 2b1c7406f..926a85367 100644 --- a/docs/installation/debian_based_en.md +++ b/docs/installation/debian_based_en.md @@ -54,7 +54,7 @@ sudo apt update sudo apt install elixir erlang-dev erlang-nox ``` -### Optional packages: [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md) +### Optional packages: [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md) ```shell sudo apt install imagemagick ffmpeg libimage-exiftool-perl diff --git a/docs/installation/debian_based_jp.md b/docs/installation/debian_based_jp.md index 94e22325c..2613a86d9 100644 --- a/docs/installation/debian_based_jp.md +++ b/docs/installation/debian_based_jp.md @@ -54,7 +54,7 @@ sudo apt update sudo apt install elixir erlang-dev erlang-nox ``` -### オプションパッケージ: [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md) +### オプションパッケージ: [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md) ```shell sudo apt install imagemagick ffmpeg libimage-exiftool-perl diff --git a/docs/installation/freebsd_en.md b/docs/installation/freebsd_en.md index fdcb06c53..2dc466eb8 100644 --- a/docs/installation/freebsd_en.md +++ b/docs/installation/freebsd_en.md @@ -26,7 +26,7 @@ Setup the required services to automatically start at boot, using `sysrc(8)`. # service postgresql start ``` -### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md)) +### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md)) ```shell # pkg install imagemagick ffmpeg p5-Image-ExifTool diff --git a/docs/installation/netbsd_en.md b/docs/installation/netbsd_en.md index d5fa04fdf..233cf28b7 100644 --- a/docs/installation/netbsd_en.md +++ b/docs/installation/netbsd_en.md @@ -44,7 +44,7 @@ pgsql=YES First, run `# /etc/rc.d/pgsql start`. Then, `$ sudo -Hu pgsql -g pgsql createdb`. -### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md)) +### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md)) `# pkgin install ImageMagick ffmpeg4 p5-Image-ExifTool` diff --git a/docs/installation/openbsd_en.md b/docs/installation/openbsd_en.md index 8092ac379..0e1269ca5 100644 --- a/docs/installation/openbsd_en.md +++ b/docs/installation/openbsd_en.md @@ -27,7 +27,7 @@ Pleroma requires a reverse proxy, OpenBSD has relayd in base (and is used in thi #### Optional software -Per [`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md): +Per [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md): * ImageMagick * ffmpeg * exiftool diff --git a/docs/installation/openbsd_fi.md b/docs/installation/openbsd_fi.md index 01cf34ab4..a61434147 100644 --- a/docs/installation/openbsd_fi.md +++ b/docs/installation/openbsd_fi.md @@ -20,7 +20,7 @@ Asenna tarvittava ohjelmisto: #### Optional software -[`docs/installation/optional/media_graphics_packages.md`](docs/installation/optional/media_graphics_packages.md): +[`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md): * ImageMagick * ffmpeg * exiftool diff --git a/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs b/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs index 757afa129..82e02281d 100644 --- a/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs +++ b/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs @@ -3,7 +3,14 @@ defmodule Pleroma.Repo.Migrations.AddFtsIndexToObjectsTwo do def up do execute("create extension if not exists rum") - drop_if_exists index(:objects, ["(to_tsvector('english', data->>'content'))"], using: :gin, name: :objects_fts) + + drop_if_exists( + index(:objects, ["(to_tsvector('english', data->>'content'))"], + using: :gin, + name: :objects_fts + ) + ) + alter table(:objects) do add(:fts_content, :tsvector) end @@ -14,7 +21,10 @@ def up do return new; end $$ LANGUAGE plpgsql") - execute("create index if not exists objects_fts on objects using RUM (fts_content rum_tsvector_addon_ops, inserted_at) with (attach = 'inserted_at', to = 'fts_content');") + + execute( + "create index if not exists objects_fts on objects using RUM (fts_content rum_tsvector_addon_ops, inserted_at) with (attach = 'inserted_at', to = 'fts_content');" + ) execute("CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE ON objects FOR EACH ROW EXECUTE PROCEDURE objects_fts_update()") @@ -23,12 +33,19 @@ def up do end def down do - execute "drop index if exists objects_fts" - execute "drop trigger if exists tsvectorupdate on objects" - execute "drop function if exists objects_fts_update()" + execute("drop index if exists objects_fts") + execute("drop trigger if exists tsvectorupdate on objects") + execute("drop function if exists objects_fts_update()") + alter table(:objects) do remove(:fts_content, :tsvector) end - create_if_not_exists index(:objects, ["(to_tsvector('english', data->>'content'))"], using: :gin, name: :objects_fts) + + create_if_not_exists( + index(:objects, ["(to_tsvector('english', data->>'content'))"], + using: :gin, + name: :objects_fts + ) + ) end end -- cgit v1.2.3 From 6b28121897bb9e864176b47d20f5d386c23859e4 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Sun, 10 Jan 2021 11:28:41 +0300 Subject: .formatter.exs: Format optional migrations (There are no changes to optional migrations since they were manually formatted in https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3207) --- .formatter.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.formatter.exs b/.formatter.exs index 5799ac127..abd91dbbe 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,3 @@ [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}", "priv/repo/migrations/*.exs", "priv/scrubbers/*.ex"] + inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}", "priv/repo/migrations/*.exs", "priv/repo/optional_migrations/**/*.exs", "priv/scrubbers/*.ex"] ] -- cgit v1.2.3 From 8c972de0457199098c5f3378313d08a9dd2d64ce Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 10 Jan 2021 11:44:39 +0300 Subject: [#3213] transfer_hashtags mix task refactoring. --- lib/mix/tasks/pleroma/database.ex | 127 ++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 68 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 918752dc2..e9686fc1b 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -132,74 +132,6 @@ def run(["fix_likes_collections"]) do |> Stream.run() end - def run(["transfer_hashtags"]) do - import Ecto.Query - - start_pleroma() - - Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") - - # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) - from( - object in Object, - left_join: hashtag in assoc(object, :hashtags), - where: is_nil(hashtag.id), - where: fragment("(?)->>'tag' != '[]'", object.data), - select: %{ - id: object.id, - tag: fragment("(?)->>'tag'", object.data) - } - ) - |> Repo.chunk_stream(100, :batches, timeout: :infinity) - |> Stream.each(fn objects -> - Logger.info("Processing #{length(objects)} objects starting from id #{hd(objects).id}...") - - failed_ids = - objects - |> Enum.map(fn object -> - hashtags = Object.object_data_hashtags(%{"tag" => Jason.decode!(object.tag)}) - - Repo.transaction(fn -> - with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do - for hashtag_record <- hashtag_records do - with {:ok, _} <- - Repo.query( - "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", - [hashtag_record.id, object.id] - ) do - nil - else - {:error, e} -> - error = - "ERROR: could not link object #{object.id} and hashtag " <> - "#{hashtag_record.id}: #{inspect(e)}" - - Logger.error(error) - Repo.rollback(object.id) - end - end - - object.id - else - e -> - error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" - Logger.error(error) - Repo.rollback(object.id) - end - end) - end) - |> Enum.filter(&(elem(&1, 0) == :error)) - |> Enum.map(&elem(&1, 1)) - - if Enum.any?(failed_ids) do - Logger.error("ERROR: transfer_hashtags iteration failed for ids: #{inspect(failed_ids)}") - end - end) - |> Stream.run() - - Logger.info("Done transferring hashtags. Please check logs to ensure no errors.") - end - def run(["vacuum", args]) do start_pleroma() @@ -239,4 +171,63 @@ def run(["ensure_expiration"]) do end) |> Stream.run() end + + def run(["transfer_hashtags"]) do + import Ecto.Query + + start_pleroma() + + Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") + + # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) + from( + object in Object, + left_join: hashtag in assoc(object, :hashtags), + where: is_nil(hashtag.id), + where: + fragment("(?)->'tag' IS NOT NULL AND (?)->'tag' != '[]'::jsonb", object.data, object.data), + select: %{ + id: object.id, + tag: fragment("(?)->'tag'", object.data) + } + ) + |> Repo.chunk_stream(100, :one, timeout: :infinity) + |> Stream.each(&transfer_object_hashtags(&1)) + |> Stream.run() + + Logger.info("Done transferring hashtags. Please check logs to ensure no errors.") + end + + defp transfer_object_hashtags(object) do + hashtags = Object.object_data_hashtags(%{"tag" => object.tag}) + + Repo.transaction(fn -> + with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do + for hashtag_record <- hashtag_records do + with {:ok, _} <- + Repo.query( + "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", + [hashtag_record.id, object.id] + ) do + nil + else + {:error, e} -> + error = + "ERROR: could not link object #{object.id} and hashtag " <> + "#{hashtag_record.id}: #{inspect(e)}" + + Logger.error(error) + Repo.rollback(object.id) + end + end + + object.id + else + e -> + error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" + Logger.error(error) + Repo.rollback(object.id) + end + end) + end end -- cgit v1.2.3 From 9887cdf9be049ca12ea6ba45d38f9072de1b0fc0 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sun, 10 Jan 2021 09:03:42 -0600 Subject: Formatting --- lib/pleroma/web/media_proxy.ex | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index e4d7f8aa8..cbe717584 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -79,14 +79,14 @@ def whitelisted?(url) do |> Config.get() |> Enum.map(&maybe_get_domain_from_url/1) - whitelist_domains = - base_url = Upload.base_url() - if Web.base_url() == base_url do - mediaproxy_whitelist_domains - else - %{host: base_domain} = URI.parse(base_url) - [base_domain | mediaproxy_whitelist_domains] - end + whitelist_domains = base_url = Upload.base_url() + + if Web.base_url() == base_url do + mediaproxy_whitelist_domains + else + %{host: base_domain} = URI.parse(base_url) + [base_domain | mediaproxy_whitelist_domains] + end domain in whitelist_domains end -- cgit v1.2.3 From e1a547d7d3913974e1049c5dc60d46812c8abf3f Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 11 Jan 2021 15:30:40 +0100 Subject: ChatMessages: Fix pagination headers. They used to contain the path parameter `id` as query param, which would break the link. --- lib/pleroma/web/controller_helper.ex | 2 +- test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex index 69188a882..2df44309c 100644 --- a/lib/pleroma/web/controller_helper.ex +++ b/lib/pleroma/web/controller_helper.ex @@ -67,7 +67,7 @@ def add_link_headers(conn, entries, extra_params) do defp build_pagination_fields(conn, min_id, max_id, extra_params) do params = conn.params - |> Map.drop(Map.keys(conn.path_params)) + |> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_atom/1)) |> Map.merge(extra_params) |> Map.drop(@id_keys) diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index 24efeeb73..d0b520fbc 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -211,12 +211,12 @@ test "it paginates", %{conn: conn, user: user} do assert String.match?( next, - ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&max_id=.*; rel=\"next\"$) + ~r(#{api_endpoint}.*/messages\?limit=\d+&max_id=.*; rel=\"next\"$) ) assert String.match?( prev, - ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&min_id=.*; rel=\"prev\"$) + ~r(#{api_endpoint}.*/messages\?limit=\d+&min_id=.*; rel=\"prev\"$) ) assert length(result) == 20 @@ -229,12 +229,12 @@ test "it paginates", %{conn: conn, user: user} do assert String.match?( next, - ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&max_id=.*; rel=\"next\"$) + ~r(#{api_endpoint}.*/messages\?limit=\d+&max_id=.*; rel=\"next\"$) ) assert String.match?( prev, - ~r(#{api_endpoint}.*/messages\?id=.*&limit=\d+&max_id=.*&min_id=.*; rel=\"prev\"$) + ~r(#{api_endpoint}.*/messages\?limit=\d+&max_id=.*&min_id=.*; rel=\"prev\"$) ) assert length(result) == 10 -- cgit v1.2.3 From 10408810473ad211423cae49db94c33a765dbe33 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 11 Jan 2021 14:01:31 -0600 Subject: Fix regression in MediaProxy.local?/0 and appending the Upload.base_url to whitelisted domains --- lib/pleroma/web/media_proxy.ex | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index cbe717584..1dab35d2c 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -69,24 +69,24 @@ def enabled?, do: Config.get([:media_proxy, :enabled], false) # non-local non-whitelisted URLs through it and be sure that body size constraint is preserved. def preview_enabled?, do: enabled?() and !!Config.get([:media_preview_proxy, :enabled]) - def local?(url), do: String.starts_with?(url, Upload.base_url()) + def local?(url), do: String.starts_with?(url, Web.base_url()) def whitelisted?(url) do %{host: domain} = URI.parse(url) + %{host: web_domain} = Web.base_url() |> URI.parse() + %{host: upload_domain} = Upload.base_url() |> URI.parse() mediaproxy_whitelist_domains = [:media_proxy, :whitelist] |> Config.get() |> Enum.map(&maybe_get_domain_from_url/1) - whitelist_domains = base_url = Upload.base_url() - - if Web.base_url() == base_url do - mediaproxy_whitelist_domains - else - %{host: base_domain} = URI.parse(base_url) - [base_domain | mediaproxy_whitelist_domains] - end + whitelist_domains = + if web_domain == upload_domain do + mediaproxy_whitelist_domains + else + [upload_domain | mediaproxy_whitelist_domains] + end domain in whitelist_domains end -- cgit v1.2.3 From ef59d998338551f15b7fe782641bfbf443fd66f4 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 11 Jan 2021 14:19:14 -0600 Subject: Simplify. We will always have a result from Upload.base_url/0, so just add it to the list --- lib/pleroma/web/media_proxy.ex | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index 1dab35d2c..dcf3b0623 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -73,22 +73,14 @@ def local?(url), do: String.starts_with?(url, Web.base_url()) def whitelisted?(url) do %{host: domain} = URI.parse(url) - %{host: web_domain} = Web.base_url() |> URI.parse() - %{host: upload_domain} = Upload.base_url() |> URI.parse() mediaproxy_whitelist_domains = [:media_proxy, :whitelist] |> Config.get() + |> Kernel.++(["#{Upload.base_url()}"]) |> Enum.map(&maybe_get_domain_from_url/1) - whitelist_domains = - if web_domain == upload_domain do - mediaproxy_whitelist_domains - else - [upload_domain | mediaproxy_whitelist_domains] - end - - domain in whitelist_domains + domain in mediaproxy_whitelist_domains end defp maybe_get_domain_from_url("http" <> _ = url) do -- cgit v1.2.3 From 7a1cb752dd41856cfbfb2078353e5703a8ec375c Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 12 Jan 2021 12:59:50 +0100 Subject: Pagination: Don't be dos'd by random parameters. --- lib/pleroma/web/controller_helper.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex index 2df44309c..0d112a932 100644 --- a/lib/pleroma/web/controller_helper.ex +++ b/lib/pleroma/web/controller_helper.ex @@ -67,7 +67,7 @@ def add_link_headers(conn, entries, extra_params) do defp build_pagination_fields(conn, min_id, max_id, extra_params) do params = conn.params - |> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_atom/1)) + |> Map.drop(Map.keys(conn.path_params) |> Enum.map(&String.to_existing_atom/1)) |> Map.merge(extra_params) |> Map.drop(@id_keys) -- cgit v1.2.3 From 8b28dce82ac244c6c5e67d8379e68e5742bfe875 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:31:35 -0600 Subject: Deprecate Pleroma.Uploaders.S3, :public_endpoint --- config/config.exs | 15 +++++++++++--- config/description.exs | 8 +------- config/test.exs | 3 +-- docs/configuration/cheatsheet.md | 5 +---- lib/pleroma/config/deprecation_warnings.ex | 24 ++++++++++++++++++++++- priv/templates/sample_config.eex | 10 ++++++++-- test/pleroma/config/deprecation_warnings_test.exs | 9 +++++++++ 7 files changed, 55 insertions(+), 19 deletions(-) diff --git a/config/config.exs b/config/config.exs index 7b14fbfe5..2a0c6302c 100644 --- a/config/config.exs +++ b/config/config.exs @@ -64,14 +64,23 @@ link_name: false, proxy_remote: false, filename_display_max_length: 30, - default_description: nil + default_description: nil, + base_url: nil config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads" config :pleroma, Pleroma.Uploaders.S3, bucket: nil, - streaming_enabled: true, - public_endpoint: "https://s3.amazonaws.com" + bucket_namespace: nil, + truncated_namespace: false, + streaming_enabled: true + +config :ex_aws, :s3, + # host: "s3.wasabisys.com", # required if not Amazon AWS + access_key_id: nil, + secret_access_key: nil, + # region: nil, # example: "us-east-1" + scheme: "https://" config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png"], diff --git a/config/description.exs b/config/description.exs index f438a88ab..493d362d3 100644 --- a/config/description.exs +++ b/config/description.exs @@ -149,18 +149,12 @@ description: "S3 bucket namespace", suggestions: ["pleroma"] }, - %{ - key: :public_endpoint, - type: :string, - description: "S3 endpoint", - suggestions: ["https://s3.amazonaws.com"] - }, %{ key: :truncated_namespace, type: :string, description: "If you use S3 compatible service such as Digital Ocean Spaces or CDN, set folder name or \"\" etc." <> - " For example, when using CDN to S3 virtual host format, set \"\". At this time, write CNAME to CDN in public_endpoint." + " For example, when using CDN to S3 virtual host format, set \"\". At this time, write CNAME to CDN in Upload base_url." }, %{ key: :streaming_enabled, diff --git a/config/test.exs b/config/test.exs index 7fc457463..e482f38c8 100644 --- a/config/test.exs +++ b/config/test.exs @@ -117,8 +117,7 @@ config :pleroma, Pleroma.Uploaders.S3, bucket: nil, - streaming_enabled: true, - public_endpoint: nil + streaming_enabled: true config :tzdata, :autoupdate, :disabled diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 85551362c..c7d8a2dae 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -549,7 +549,7 @@ the source code is here: [kocaptcha](https://github.com/koto-bank/kocaptcha). Th * `uploader`: Which one of the [uploaders](#uploaders) to use. * `filters`: List of [upload filters](#upload-filters) to use. * `link_name`: When enabled Pleroma will add a `name` parameter to the url of the upload, for example `https://instance.tld/media/corndog.png?name=corndog.png`. This is needed to provide the correct filename in Content-Disposition headers when using filters like `Pleroma.Upload.Filter.Dedupe` -* `base_url`: The base URL to access a user-uploaded file. Useful when you want to proxy the media files via another host. +* `base_url`: The base URL to access a user-uploaded file. Useful when you want to host the media files via another domain or are using a 3rd party S3 provider. * `proxy_remote`: If you're using a remote uploader, Pleroma will proxy media requests instead of redirecting to it. * `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation. * `filename_display_max_length`: Set max length of a filename to display. 0 = no limit. Default: 30. @@ -570,10 +570,7 @@ Don't forget to configure [Ex AWS S3](#ex-aws-s3-settings) * `bucket`: S3 bucket name. * `bucket_namespace`: S3 bucket namespace. -* `public_endpoint`: S3 endpoint that the user finally accesses(ex. "https://s3.dualstack.ap-northeast-1.amazonaws.com") * `truncated_namespace`: If you use S3 compatible service such as Digital Ocean Spaces or CDN, set folder name or "" etc. -For example, when using CDN to S3 virtual host format, set "". -At this time, write CNAME to CDN in public_endpoint. * `streaming_enabled`: Enable streaming uploads, when enabled the file will be sent to the server in chunks as it's being read. This may be unsupported by some providers, try disabling this if you have upload problems. #### Ex AWS S3 settings diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index 59c6b0f58..703a5273f 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -40,7 +40,8 @@ def warn do :ok <- check_welcome_message_config(), :ok <- check_gun_pool_options(), :ok <- check_activity_expiration_config(), - :ok <- check_remote_ip_plug_name() do + :ok <- check_remote_ip_plug_name(), + :ok <- check_uploders_s3_public_endpoint() do :ok else _ -> @@ -193,4 +194,25 @@ def check_remote_ip_plug_name do warning_preface ) end + + @spec check_uploders_s3_public_endpoint() :: :ok | nil + def check_uploders_s3_public_endpoint do + s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3]) + + use_old_config = Keyword.has_key?(s3_config, :public_endpoint) + + if use_old_config do + Logger.error(""" + !!!DEPRECATION WARNING!!! + Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket.\n + Please make the following change at your earliest convenience.\n + \n* `config :pleroma, Pleroma.Uploaders.S3, public_endpoint` is now equal to: + \n* `config :pleroma, Pleroma.Upload, base_url` + """) + + :error + else + :ok + end + end end diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex index 2f5952ef1..0c2477e2c 100644 --- a/priv/templates/sample_config.eex +++ b/priv/templates/sample_config.eex @@ -49,12 +49,18 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>" # sts: true # Configure S3 support if desired. -# The public S3 endpoint is different depending on region and provider, +# The public S3 endpoint (base_url) is different depending on region and provider, # consult your S3 provider's documentation for details on what to use. # +# config :pleroma, Pleroma.Upload, +# uploader: Pleroma.Uploaders.S3, +# base_url: "https://s3.amazonaws.com" +# # config :pleroma, Pleroma.Uploaders.S3, # bucket: "some-bucket", -# public_endpoint: "https://s3.amazonaws.com" +# bucket_namespace: "my-namespace", +# truncated_namespace: false, +# streaming_enabled: true # # Configure S3 credentials: # config :ex_aws, :s3, diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index f52629f8a..161bf6e90 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -94,6 +94,15 @@ test "check_activity_expiration_config/0" do end) =~ "Your config is using old namespace for activity expiration configuration." end + test "check_uploders_s3_public_endpoint/0" do + clear_config(Pleroma.Uploaders.S3, public_endpoint: "https://fake.amazonaws.com/bucket/") + + assert capture_log(fn -> + DeprecationWarnings.check_uploders_s3_public_endpoint() + end) =~ + "Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket." + end + describe "check_gun_pool_options/0" do test "await_up_timeout" do config = Config.get(:connections_pool) -- cgit v1.2.3 From 12528edc349a6ec10b1a1d9a7daf461823fdf928 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:32:52 -0600 Subject: Fix another ad-hoc construction of the upload base_url --- lib/pleroma/upload.ex | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 51ca97f41..619a85e93 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -131,12 +131,7 @@ defp get_opts(opts) do uploader: Keyword.get(opts, :uploader, Pleroma.Config.get([__MODULE__, :uploader])), filters: Keyword.get(opts, :filters, Pleroma.Config.get([__MODULE__, :filters])), description: Keyword.get(opts, :description), - base_url: - Keyword.get( - opts, - :base_url, - Pleroma.Config.get([__MODULE__, :base_url], Pleroma.Web.base_url()) - ) + base_url: base_url() } end @@ -217,14 +212,7 @@ defp url_from_spec(%__MODULE__{name: name}, base_url, {:file, path}) do "" end - prefix = - if is_nil(Pleroma.Config.get([__MODULE__, :base_url])) do - "media" - else - "" - end - - [base_url, prefix, path] + [base_url, path] |> Path.join() end -- cgit v1.2.3 From c35e6fb51615fa3d22cfedeac2158ee62ea9b663 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:34:24 -0600 Subject: Provide a non-nil fallback for Upload.base_url/0 for tests using TestUploaderSuccess as the uploader --- lib/pleroma/upload.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 619a85e93..e714dc57b 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -249,7 +249,7 @@ def base_url do end _ -> - public_endpoint || upload_base_url + public_endpoint || upload_base_url || Pleroma.Web.base_url() <> "/media/" end end end -- cgit v1.2.3 From e87cca97e62d8464c87c7335741f54c2299cc0d6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:35:10 -0600 Subject: Fix tests relying on old behavior. Use the Upload.base_url, Luke. --- test/pleroma/upload_test.exs | 4 ++-- test/pleroma/uploaders/s3_test.exs | 13 +++++++++---- test/pleroma/user/backup_test.exs | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/test/pleroma/upload_test.exs b/test/pleroma/upload_test.exs index f52d4dff6..cea161d8c 100644 --- a/test/pleroma/upload_test.exs +++ b/test/pleroma/upload_test.exs @@ -148,8 +148,8 @@ test "copies the file to the configured folder with deduping" do {:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe]) assert List.first(data["url"])["href"] == - Pleroma.Web.base_url() <> - "/media/e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg" + Pleroma.Upload.base_url() <> + "e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg" end test "copies the file to the configured folder without deduping" do diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index 344cf7abe..f399f8ae5 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -16,9 +16,12 @@ defmodule Pleroma.Uploaders.S3Test do uploader: Pleroma.Uploaders.S3 ) + clear_config(Pleroma.Upload, + base_url: "https://s3.amazonaws.com" + ) + clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com" + bucket: "test_bucket" ) end @@ -33,10 +36,11 @@ test "it returns path to local folder for files" do test "it returns path without bucket when truncated_namespace set to ''" do Config.put([Pleroma.Uploaders.S3], bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com", truncated_namespace: "" ) + Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com") + assert S3.get_file("test_image.jpg") == { :ok, {:url, "https://s3.amazonaws.com/test_image.jpg"} @@ -46,10 +50,11 @@ test "it returns path without bucket when truncated_namespace set to ''" do test "it returns path with bucket namespace when namespace is set" do Config.put([Pleroma.Uploaders.S3], bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com", bucket_namespace: "family" ) + Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com") + assert S3.get_file("test_image.jpg") == { :ok, {:url, "https://s3.amazonaws.com/family:test_bucket/test_image.jpg"} diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index f68e4a029..01a1ed962 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -196,11 +196,11 @@ test "it creates a zip archive with user data" do describe "it uploads and deletes a backup archive" do setup do clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket", - public_endpoint: "https://s3.amazonaws.com" + bucket: "test_bucket" ) clear_config([Pleroma.Upload, :uploader]) + clear_config([Pleroma.Upload, base_url: "https://s3.amazonaws.com"]) user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"}) -- cgit v1.2.3 From 2b93351bd7b1377793256a14c0356e1dccf36d2e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:40:29 -0600 Subject: Document deprecation --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b24bf07..31d6a7561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries. - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Admin API: Reports now ordered by newest +- Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. ### Added -- cgit v1.2.3 From 67e888498c16c8bba434afe91cb3e0a83b9da8bb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 12 Jan 2021 16:42:43 -0600 Subject: Switch another test to Upload.base_url/0 --- test/pleroma/upload_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pleroma/upload_test.exs b/test/pleroma/upload_test.exs index cea161d8c..8f84a0be1 100644 --- a/test/pleroma/upload_test.exs +++ b/test/pleroma/upload_test.exs @@ -133,7 +133,7 @@ test "returns a media url" do assert %{"url" => [%{"href" => url}]} = data - assert String.starts_with?(url, Pleroma.Web.base_url() <> "/media/") + assert String.starts_with?(url, Pleroma.Upload.base_url()) end test "copies the file to the configured folder with deduping" do -- cgit v1.2.3 From c4439c630f46153c9f118d7f7e752d880206d262 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 13 Jan 2021 07:49:20 +0100 Subject: Bump Copyright to 2021 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit grep -rl '# Copyright © .* Pleroma' * | xargs sed -i 's;Copyright © .* Pleroma .*;Copyright © 2017-2021 Pleroma Authors ;' --- installation/download-mastofe-build.sh | 2 +- lib/mix/pleroma.ex | 2 +- lib/mix/tasks/pleroma/app.ex | 2 +- lib/mix/tasks/pleroma/benchmark.ex | 2 +- lib/mix/tasks/pleroma/config.ex | 2 +- lib/mix/tasks/pleroma/count_statuses.ex | 2 +- lib/mix/tasks/pleroma/database.ex | 2 +- lib/mix/tasks/pleroma/digest.ex | 2 +- lib/mix/tasks/pleroma/docs.ex | 2 +- lib/mix/tasks/pleroma/ecto.ex | 2 +- lib/mix/tasks/pleroma/ecto/migrate.ex | 2 +- lib/mix/tasks/pleroma/ecto/rollback.ex | 2 +- lib/mix/tasks/pleroma/email.ex | 2 +- lib/mix/tasks/pleroma/emoji.ex | 2 +- lib/mix/tasks/pleroma/frontend.ex | 2 +- lib/mix/tasks/pleroma/instance.ex | 2 +- lib/mix/tasks/pleroma/notification_settings.ex | 2 +- lib/mix/tasks/pleroma/refresh_counter_cache.ex | 2 +- lib/mix/tasks/pleroma/relay.ex | 2 +- lib/mix/tasks/pleroma/robots_txt.ex | 2 +- lib/mix/tasks/pleroma/uploads.ex | 2 +- lib/mix/tasks/pleroma/user.ex | 2 +- lib/phoenix/transports/web_socket/raw.ex | 2 +- lib/pleroma/activity.ex | 2 +- lib/pleroma/activity/ir/topics.ex | 2 +- lib/pleroma/activity/queries.ex | 2 +- lib/pleroma/activity/search.ex | 2 +- lib/pleroma/application.ex | 2 +- lib/pleroma/application_requirements.ex | 2 +- lib/pleroma/bbs/authenticator.ex | 2 +- lib/pleroma/bbs/handler.ex | 2 +- lib/pleroma/bookmark.ex | 2 +- lib/pleroma/caching.ex | 2 +- lib/pleroma/captcha.ex | 2 +- lib/pleroma/captcha/kocaptcha.ex | 2 +- lib/pleroma/captcha/native.ex | 2 +- lib/pleroma/captcha/service.ex | 2 +- lib/pleroma/chat.ex | 2 +- lib/pleroma/chat/message_reference.ex | 2 +- lib/pleroma/clippy.ex | 2 +- lib/pleroma/config.ex | 2 +- lib/pleroma/config/deprecation_warnings.ex | 2 +- lib/pleroma/config/getting.ex | 2 +- lib/pleroma/config/helpers.ex | 2 +- lib/pleroma/config/holder.ex | 2 +- lib/pleroma/config/loader.ex | 2 +- lib/pleroma/config/oban.ex | 2 +- lib/pleroma/config/transfer_task.ex | 2 +- lib/pleroma/config_db.ex | 2 +- lib/pleroma/constants.ex | 2 +- lib/pleroma/conversation.ex | 2 +- lib/pleroma/conversation/participation.ex | 2 +- lib/pleroma/conversation/participation/recipient_ship.ex | 2 +- lib/pleroma/counter_cache.ex | 2 +- lib/pleroma/delivery.ex | 2 +- lib/pleroma/docs/generator.ex | 2 +- lib/pleroma/docs/json.ex | 2 +- lib/pleroma/docs/markdown.ex | 2 +- lib/pleroma/earmark_renderer.ex | 2 +- lib/pleroma/ecto_enums.ex | 2 +- lib/pleroma/ecto_type/activity_pub/object_validators/date_time.ex | 2 +- lib/pleroma/ecto_type/activity_pub/object_validators/emoji.ex | 2 +- lib/pleroma/ecto_type/activity_pub/object_validators/object_id.ex | 2 +- lib/pleroma/ecto_type/activity_pub/object_validators/recipients.ex | 2 +- lib/pleroma/ecto_type/activity_pub/object_validators/safe_text.ex | 2 +- lib/pleroma/ecto_type/activity_pub/object_validators/uri.ex | 2 +- lib/pleroma/ecto_type/config/atom.ex | 2 +- lib/pleroma/ecto_type/config/binary_value.ex | 2 +- lib/pleroma/emails/admin_email.ex | 2 +- lib/pleroma/emails/mailer.ex | 2 +- lib/pleroma/emails/new_users_digest_email.ex | 2 +- lib/pleroma/emails/user_email.ex | 2 +- lib/pleroma/emoji.ex | 2 +- lib/pleroma/emoji/formatter.ex | 2 +- lib/pleroma/emoji/loader.ex | 2 +- lib/pleroma/emoji/pack.ex | 2 +- lib/pleroma/filter.ex | 2 +- lib/pleroma/following_relationship.ex | 2 +- lib/pleroma/formatter.ex | 2 +- lib/pleroma/frontend.ex | 2 +- lib/pleroma/gopher/server.ex | 2 +- lib/pleroma/gun.ex | 2 +- lib/pleroma/gun/api.ex | 2 +- lib/pleroma/gun/conn.ex | 2 +- lib/pleroma/gun/connection_pool.ex | 2 +- lib/pleroma/gun/connection_pool/reclaimer.ex | 2 +- lib/pleroma/gun/connection_pool/worker.ex | 2 +- lib/pleroma/gun/connection_pool/worker_supervisor.ex | 2 +- lib/pleroma/healthcheck.ex | 2 +- lib/pleroma/helpers/auth_helper.ex | 2 +- lib/pleroma/helpers/inet_helper.ex | 2 +- lib/pleroma/helpers/media_helper.ex | 2 +- lib/pleroma/helpers/qt_fast_start.ex | 2 +- lib/pleroma/helpers/uri_helper.ex | 2 +- lib/pleroma/html.ex | 2 +- lib/pleroma/http.ex | 2 +- lib/pleroma/http/adapter_helper.ex | 2 +- lib/pleroma/http/adapter_helper/default.ex | 2 +- lib/pleroma/http/adapter_helper/gun.ex | 2 +- lib/pleroma/http/adapter_helper/hackney.ex | 2 +- lib/pleroma/http/ex_aws.ex | 2 +- lib/pleroma/http/request.ex | 2 +- lib/pleroma/http/request_builder.ex | 2 +- lib/pleroma/http/tzdata.ex | 2 +- lib/pleroma/http/web_push.ex | 2 +- lib/pleroma/instances.ex | 2 +- lib/pleroma/instances/instance.ex | 2 +- lib/pleroma/job_queue_monitor.ex | 2 +- lib/pleroma/jwt.ex | 2 +- lib/pleroma/keys.ex | 2 +- lib/pleroma/list.ex | 2 +- lib/pleroma/logging.ex | 2 +- lib/pleroma/maintenance.ex | 2 +- lib/pleroma/maps.ex | 2 +- lib/pleroma/marker.ex | 2 +- lib/pleroma/mfa.ex | 2 +- lib/pleroma/mfa/backup_codes.ex | 2 +- lib/pleroma/mfa/changeset.ex | 2 +- lib/pleroma/mfa/settings.ex | 2 +- lib/pleroma/mfa/token.ex | 2 +- lib/pleroma/mfa/totp.ex | 2 +- lib/pleroma/migration_helper/notification_backfill.ex | 2 +- lib/pleroma/moderation_log.ex | 2 +- lib/pleroma/notification.ex | 2 +- lib/pleroma/object.ex | 2 +- lib/pleroma/object/containment.ex | 2 +- lib/pleroma/object/fetcher.ex | 2 +- lib/pleroma/object_tombstone.ex | 2 +- lib/pleroma/otp_version.ex | 2 +- lib/pleroma/pagination.ex | 2 +- lib/pleroma/password_reset_token.ex | 2 +- lib/pleroma/registration.ex | 2 +- lib/pleroma/release_tasks.ex | 2 +- lib/pleroma/repo.ex | 2 +- lib/pleroma/report_note.ex | 2 +- lib/pleroma/reverse_proxy.ex | 2 +- lib/pleroma/reverse_proxy/client.ex | 2 +- lib/pleroma/reverse_proxy/client/hackney.ex | 2 +- lib/pleroma/reverse_proxy/client/tesla.ex | 2 +- lib/pleroma/scheduled_activity.ex | 2 +- lib/pleroma/signature.ex | 2 +- lib/pleroma/stats.ex | 2 +- lib/pleroma/telemetry/logger.ex | 2 +- lib/pleroma/tesla/middleware/connection_pool.ex | 2 +- lib/pleroma/tests/auth_test_controller.ex | 2 +- lib/pleroma/thread_mute.ex | 2 +- lib/pleroma/upload.ex | 2 +- lib/pleroma/upload/filter.ex | 2 +- lib/pleroma/upload/filter/anonymize_filename.ex | 2 +- lib/pleroma/upload/filter/dedupe.ex | 2 +- lib/pleroma/upload/filter/exiftool.ex | 2 +- lib/pleroma/upload/filter/mogrifun.ex | 2 +- lib/pleroma/upload/filter/mogrify.ex | 2 +- lib/pleroma/uploaders/local.ex | 2 +- lib/pleroma/uploaders/s3.ex | 2 +- lib/pleroma/uploaders/uploader.ex | 2 +- lib/pleroma/user.ex | 2 +- lib/pleroma/user/backup.ex | 2 +- lib/pleroma/user/import.ex | 2 +- lib/pleroma/user/notification_setting.ex | 2 +- lib/pleroma/user/query.ex | 2 +- lib/pleroma/user/search.ex | 2 +- lib/pleroma/user/welcome_chat_message.ex | 2 +- lib/pleroma/user/welcome_email.ex | 2 +- lib/pleroma/user/welcome_message.ex | 2 +- lib/pleroma/user_invite_token.ex | 2 +- lib/pleroma/user_relationship.ex | 2 +- lib/pleroma/utils.ex | 2 +- lib/pleroma/web.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub/persisting.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub/streaming.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub_controller.ex | 2 +- lib/pleroma/web/activity_pub/builder.ex | 2 +- lib/pleroma/web/activity_pub/internal_fetch_actor.ex | 2 +- lib/pleroma/web/activity_pub/mrf.ex | 2 +- lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/drop_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex | 2 +- lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/keyword_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/mention_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/no_op_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/normalize_markup.ex | 2 +- lib/pleroma/web/activity_pub/mrf/object_age_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex | 2 +- lib/pleroma/web/activity_pub/mrf/reject_non_public.ex | 2 +- lib/pleroma/web/activity_pub/mrf/simple_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/subchain_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/tag_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/user_allow_list_policy.ex | 2 +- lib/pleroma/web/activity_pub/mrf/vocabulary_policy.ex | 2 +- lib/pleroma/web/activity_pub/object_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validator/validating.ex | 2 +- .../web/activity_pub/object_validators/accept_reject_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/announce_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/answer_validator.ex | 2 +- .../web/activity_pub/object_validators/article_note_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/block_validator.ex | 2 +- .../web/activity_pub/object_validators/chat_message_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/common_fixes.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/common_validations.ex | 2 +- .../web/activity_pub/object_validators/create_chat_message_validator.ex | 2 +- .../web/activity_pub/object_validators/create_generic_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/create_note_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/delete_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/event_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/follow_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/like_validator.ex | 2 +- .../web/activity_pub/object_validators/question_options_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/question_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/undo_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/update_validator.ex | 2 +- lib/pleroma/web/activity_pub/pipeline.ex | 2 +- lib/pleroma/web/activity_pub/publisher.ex | 2 +- lib/pleroma/web/activity_pub/relay.ex | 2 +- lib/pleroma/web/activity_pub/side_effects.ex | 2 +- lib/pleroma/web/activity_pub/side_effects/handling.ex | 2 +- lib/pleroma/web/activity_pub/transmogrifier.ex | 2 +- lib/pleroma/web/activity_pub/utils.ex | 2 +- lib/pleroma/web/activity_pub/views/object_view.ex | 2 +- lib/pleroma/web/activity_pub/views/user_view.ex | 2 +- lib/pleroma/web/activity_pub/visibility.ex | 2 +- lib/pleroma/web/admin_api/controllers/admin_api_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/chat_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/config_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/fallback_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/frontend_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/instance_document_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/invite_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/relay_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/report_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/status_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/user_controller.ex | 2 +- lib/pleroma/web/admin_api/report.ex | 2 +- lib/pleroma/web/admin_api/search.ex | 2 +- lib/pleroma/web/admin_api/views/account_view.ex | 2 +- lib/pleroma/web/admin_api/views/chat_view.ex | 2 +- lib/pleroma/web/admin_api/views/config_view.ex | 2 +- lib/pleroma/web/admin_api/views/frontend_view.ex | 2 +- lib/pleroma/web/admin_api/views/invite_view.ex | 2 +- lib/pleroma/web/admin_api/views/media_proxy_cache_view.ex | 2 +- lib/pleroma/web/admin_api/views/moderation_log_view.ex | 2 +- lib/pleroma/web/admin_api/views/report_view.ex | 2 +- lib/pleroma/web/admin_api/views/status_view.ex | 2 +- lib/pleroma/web/api_spec.ex | 2 +- lib/pleroma/web/api_spec/cast_and_validate.ex | 2 +- lib/pleroma/web/api_spec/helpers.ex | 2 +- lib/pleroma/web/api_spec/operations/account_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/chat_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/config_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex | 2 +- .../web/api_spec/operations/admin/instance_document_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/invite_operation.ex | 2 +- .../web/api_spec/operations/admin/media_proxy_cache_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/relay_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/report_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/admin/status_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/app_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/chat_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/conversation_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/domain_block_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/filter_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/follow_request_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/instance_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/list_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/marker_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/media_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/notification_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_backup_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/pleroma_scrobble_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/poll_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/report_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/search_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/status_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/subscription_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/timeline_operation.ex | 2 +- lib/pleroma/web/api_spec/operations/user_import_operation.ex | 2 +- lib/pleroma/web/api_spec/render_error.ex | 2 +- lib/pleroma/web/api_spec/schemas/account.ex | 2 +- lib/pleroma/web/api_spec/schemas/account_field.ex | 2 +- lib/pleroma/web/api_spec/schemas/account_relationship.ex | 2 +- lib/pleroma/web/api_spec/schemas/actor_type.ex | 2 +- lib/pleroma/web/api_spec/schemas/api_error.ex | 2 +- lib/pleroma/web/api_spec/schemas/attachment.ex | 2 +- lib/pleroma/web/api_spec/schemas/boolean_like.ex | 2 +- lib/pleroma/web/api_spec/schemas/chat.ex | 2 +- lib/pleroma/web/api_spec/schemas/chat_message.ex | 2 +- lib/pleroma/web/api_spec/schemas/conversation.ex | 2 +- lib/pleroma/web/api_spec/schemas/emoji.ex | 2 +- lib/pleroma/web/api_spec/schemas/flake_id.ex | 2 +- lib/pleroma/web/api_spec/schemas/list.ex | 2 +- lib/pleroma/web/api_spec/schemas/poll.ex | 2 +- lib/pleroma/web/api_spec/schemas/push_subscription.ex | 2 +- lib/pleroma/web/api_spec/schemas/scheduled_status.ex | 2 +- lib/pleroma/web/api_spec/schemas/status.ex | 2 +- lib/pleroma/web/api_spec/schemas/tag.ex | 2 +- lib/pleroma/web/api_spec/schemas/visibility_scope.ex | 2 +- lib/pleroma/web/auth/authenticator.ex | 2 +- lib/pleroma/web/auth/ldap_authenticator.ex | 2 +- lib/pleroma/web/auth/pleroma_authenticator.ex | 2 +- lib/pleroma/web/auth/totp_authenticator.ex | 2 +- lib/pleroma/web/channels/user_socket.ex | 2 +- lib/pleroma/web/chat_channel.ex | 2 +- lib/pleroma/web/common_api.ex | 2 +- lib/pleroma/web/common_api/activity_draft.ex | 2 +- lib/pleroma/web/common_api/utils.ex | 2 +- lib/pleroma/web/controller_helper.ex | 2 +- lib/pleroma/web/embed_controller.ex | 2 +- lib/pleroma/web/endpoint.ex | 2 +- lib/pleroma/web/fallback/redirect_controller.ex | 2 +- lib/pleroma/web/federator.ex | 2 +- lib/pleroma/web/federator/publisher.ex | 2 +- lib/pleroma/web/federator/publishing.ex | 2 +- lib/pleroma/web/feed/feed_view.ex | 2 +- lib/pleroma/web/feed/tag_controller.ex | 2 +- lib/pleroma/web/feed/user_controller.ex | 2 +- lib/pleroma/web/gettext.ex | 2 +- lib/pleroma/web/instance_document.ex | 2 +- lib/pleroma/web/mailer/subscription_controller.ex | 2 +- lib/pleroma/web/masto_fe_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/account_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/app_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/auth_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/filter_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/instance_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/list_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/marker_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/media_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/notification_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/poll_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/report_controller.ex | 2 +- .../web/mastodon_api/controllers/scheduled_activity_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/search_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex | 2 +- lib/pleroma/web/mastodon_api/mastodon_api.ex | 2 +- lib/pleroma/web/mastodon_api/views/account_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/app_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/conversation_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/custom_emoji_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/filter_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/instance_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/list_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/marker_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/notification_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/poll_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/report_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/status_view.ex | 2 +- lib/pleroma/web/mastodon_api/views/subscription_view.ex | 2 +- lib/pleroma/web/mastodon_api/websocket_handler.ex | 2 +- lib/pleroma/web/media_proxy.ex | 2 +- lib/pleroma/web/media_proxy/invalidation.ex | 2 +- lib/pleroma/web/media_proxy/invalidation/http.ex | 2 +- lib/pleroma/web/media_proxy/invalidation/script.ex | 2 +- lib/pleroma/web/media_proxy/media_proxy_controller.ex | 2 +- lib/pleroma/web/metadata.ex | 2 +- lib/pleroma/web/metadata/player_view.ex | 2 +- lib/pleroma/web/metadata/providers/feed.ex | 2 +- lib/pleroma/web/metadata/providers/open_graph.ex | 2 +- lib/pleroma/web/metadata/providers/provider.ex | 2 +- lib/pleroma/web/metadata/providers/rel_me.ex | 2 +- lib/pleroma/web/metadata/providers/restrict_indexing.ex | 2 +- lib/pleroma/web/metadata/providers/twitter_card.ex | 2 +- lib/pleroma/web/metadata/utils.ex | 2 +- lib/pleroma/web/mongoose_im/mongoose_im_controller.ex | 2 +- lib/pleroma/web/nodeinfo/nodeinfo.ex | 2 +- lib/pleroma/web/nodeinfo/nodeinfo_controller.ex | 2 +- lib/pleroma/web/o_auth.ex | 2 +- lib/pleroma/web/o_auth/app.ex | 2 +- lib/pleroma/web/o_auth/authorization.ex | 2 +- lib/pleroma/web/o_auth/fallback_controller.ex | 2 +- lib/pleroma/web/o_auth/mfa_controller.ex | 2 +- lib/pleroma/web/o_auth/mfa_view.ex | 2 +- lib/pleroma/web/o_auth/o_auth_controller.ex | 2 +- lib/pleroma/web/o_auth/o_auth_view.ex | 2 +- lib/pleroma/web/o_auth/scopes.ex | 2 +- lib/pleroma/web/o_auth/token.ex | 2 +- lib/pleroma/web/o_auth/token/query.ex | 2 +- lib/pleroma/web/o_auth/token/strategy/refresh_token.ex | 2 +- lib/pleroma/web/o_auth/token/strategy/revoke.ex | 2 +- lib/pleroma/web/o_auth/token/utils.ex | 2 +- lib/pleroma/web/o_status/o_status_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/account_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/backup_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/chat_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/instances_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/notification_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex | 2 +- .../web/pleroma_api/controllers/two_factor_authentication_controller.ex | 2 +- lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex | 2 +- lib/pleroma/web/pleroma_api/views/backup_view.ex | 2 +- lib/pleroma/web/pleroma_api/views/chat/message_reference_view.ex | 2 +- lib/pleroma/web/pleroma_api/views/chat_view.ex | 2 +- lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex | 2 +- lib/pleroma/web/pleroma_api/views/scrobble_view.ex | 2 +- lib/pleroma/web/plug.ex | 2 +- lib/pleroma/web/plugs/admin_secret_authentication_plug.ex | 2 +- lib/pleroma/web/plugs/authentication_plug.ex | 2 +- lib/pleroma/web/plugs/basic_auth_decoder_plug.ex | 2 +- lib/pleroma/web/plugs/cache.ex | 2 +- lib/pleroma/web/plugs/digest_plug.ex | 2 +- lib/pleroma/web/plugs/ensure_authenticated_plug.ex | 2 +- lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex | 2 +- lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex | 2 +- lib/pleroma/web/plugs/expect_authenticated_check_plug.ex | 2 +- lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex | 2 +- lib/pleroma/web/plugs/federating_plug.ex | 2 +- lib/pleroma/web/plugs/frontend_static.ex | 2 +- lib/pleroma/web/plugs/http_security_plug.ex | 2 +- lib/pleroma/web/plugs/http_signature_plug.ex | 2 +- lib/pleroma/web/plugs/idempotency_plug.ex | 2 +- lib/pleroma/web/plugs/instance_static.ex | 2 +- lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex | 2 +- lib/pleroma/web/plugs/o_auth_plug.ex | 2 +- lib/pleroma/web/plugs/o_auth_scopes_plug.ex | 2 +- lib/pleroma/web/plugs/plug_helper.ex | 2 +- lib/pleroma/web/plugs/rate_limiter.ex | 2 +- lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex | 2 +- lib/pleroma/web/plugs/rate_limiter/supervisor.ex | 2 +- lib/pleroma/web/plugs/remote_ip.ex | 2 +- lib/pleroma/web/plugs/set_format_plug.ex | 2 +- lib/pleroma/web/plugs/set_locale_plug.ex | 2 +- lib/pleroma/web/plugs/set_user_session_id_plug.ex | 2 +- lib/pleroma/web/plugs/static_fe_plug.ex | 2 +- lib/pleroma/web/plugs/trailing_format_plug.ex | 2 +- lib/pleroma/web/plugs/uploaded_media.ex | 2 +- lib/pleroma/web/plugs/user_enabled_plug.ex | 2 +- lib/pleroma/web/plugs/user_fetcher_plug.ex | 2 +- lib/pleroma/web/plugs/user_is_admin_plug.ex | 2 +- lib/pleroma/web/preload.ex | 2 +- lib/pleroma/web/preload/providers/instance.ex | 2 +- lib/pleroma/web/preload/providers/provider.ex | 2 +- lib/pleroma/web/preload/providers/timelines.ex | 2 +- lib/pleroma/web/preload/providers/user.ex | 2 +- lib/pleroma/web/push.ex | 2 +- lib/pleroma/web/push/impl.ex | 2 +- lib/pleroma/web/push/subscription.ex | 2 +- lib/pleroma/web/rel_me.ex | 2 +- lib/pleroma/web/rich_media/parser.ex | 2 +- lib/pleroma/web/rich_media/parser/ttl.ex | 2 +- lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex | 2 +- lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex | 2 +- lib/pleroma/web/rich_media/parsers/o_embed.ex | 2 +- lib/pleroma/web/rich_media/parsers/ogp.ex | 2 +- lib/pleroma/web/rich_media/parsers/twitter_card.ex | 2 +- lib/pleroma/web/router.ex | 2 +- lib/pleroma/web/static_fe/static_fe_controller.ex | 2 +- lib/pleroma/web/static_fe/static_fe_view.ex | 2 +- lib/pleroma/web/streamer.ex | 2 +- lib/pleroma/web/translation_helpers.ex | 2 +- lib/pleroma/web/twitter_api/controller.ex | 2 +- lib/pleroma/web/twitter_api/controllers/password_controller.ex | 2 +- lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex | 2 +- lib/pleroma/web/twitter_api/controllers/util_controller.ex | 2 +- lib/pleroma/web/twitter_api/twitter_api.ex | 2 +- lib/pleroma/web/twitter_api/views/password_view.ex | 2 +- lib/pleroma/web/twitter_api/views/remote_follow_view.ex | 2 +- lib/pleroma/web/twitter_api/views/token_view.ex | 2 +- lib/pleroma/web/twitter_api/views/util_view.ex | 2 +- lib/pleroma/web/uploader_controller.ex | 2 +- lib/pleroma/web/views/email_view.ex | 2 +- lib/pleroma/web/views/embed_view.ex | 2 +- lib/pleroma/web/views/error_helpers.ex | 2 +- lib/pleroma/web/views/error_view.ex | 2 +- lib/pleroma/web/views/layout_view.ex | 2 +- lib/pleroma/web/views/mailer/subscription_view.ex | 2 +- lib/pleroma/web/views/masto_fe_view.ex | 2 +- lib/pleroma/web/views/streamer_view.ex | 2 +- lib/pleroma/web/web_finger.ex | 2 +- lib/pleroma/web/web_finger/web_finger_controller.ex | 2 +- lib/pleroma/web/xml.ex | 2 +- lib/pleroma/workers/attachments_cleanup_worker.ex | 2 +- lib/pleroma/workers/background_worker.ex | 2 +- lib/pleroma/workers/backup_worker.ex | 2 +- lib/pleroma/workers/cron/digest_emails_worker.ex | 2 +- lib/pleroma/workers/cron/new_users_digest_worker.ex | 2 +- lib/pleroma/workers/mailer_worker.ex | 2 +- lib/pleroma/workers/mute_expire_worker.ex | 2 +- lib/pleroma/workers/publisher_worker.ex | 2 +- lib/pleroma/workers/purge_expired_activity.ex | 2 +- lib/pleroma/workers/purge_expired_token.ex | 2 +- lib/pleroma/workers/receiver_worker.ex | 2 +- lib/pleroma/workers/remote_fetcher_worker.ex | 2 +- lib/pleroma/workers/scheduled_activity_worker.ex | 2 +- lib/pleroma/workers/transmogrifier_worker.ex | 2 +- lib/pleroma/workers/web_pusher_worker.ex | 2 +- lib/pleroma/workers/worker_helper.ex | 2 +- lib/pleroma/xml_builder.ex | 2 +- priv/repo/migrations/20190408123347_create_conversations.exs | 2 +- priv/repo/migrations/20200602150528_create_chat_message_reference.exs | 2 +- priv/repo/migrations/20201013141127_refactor_locked_user_field.exs | 2 +- .../repo/migrations/20201013144052_refactor_discoverable_user_field.exs | 2 +- priv/repo/migrations/20201231185546_confirm_logged_in_users.exs | 2 +- test/credo/check/consistency/file_location.ex | 2 +- test/fixtures/config/temp.secret.exs | 2 +- test/fixtures/modules/runtime_module.ex | 2 +- test/mix/pleroma_test.exs | 2 +- test/mix/tasks/pleroma/app_test.exs | 2 +- test/mix/tasks/pleroma/config_test.exs | 2 +- test/mix/tasks/pleroma/count_statuses_test.exs | 2 +- test/mix/tasks/pleroma/database_test.exs | 2 +- test/mix/tasks/pleroma/digest_test.exs | 2 +- test/mix/tasks/pleroma/ecto/migrate_test.exs | 2 +- test/mix/tasks/pleroma/ecto/rollback_test.exs | 2 +- test/mix/tasks/pleroma/ecto_test.exs | 2 +- test/mix/tasks/pleroma/email_test.exs | 2 +- test/mix/tasks/pleroma/emoji_test.exs | 2 +- test/mix/tasks/pleroma/frontend_test.exs | 2 +- test/mix/tasks/pleroma/instance_test.exs | 2 +- test/mix/tasks/pleroma/refresh_counter_cache_test.exs | 2 +- test/mix/tasks/pleroma/relay_test.exs | 2 +- test/mix/tasks/pleroma/robots_txt_test.exs | 2 +- test/mix/tasks/pleroma/uploads_test.exs | 2 +- test/mix/tasks/pleroma/user_test.exs | 2 +- test/pleroma/activity/ir/topics_test.exs | 2 +- test/pleroma/activity/search_test.exs | 2 +- test/pleroma/activity_test.exs | 2 +- test/pleroma/application_requirements_test.exs | 2 +- test/pleroma/bbs/handler_test.exs | 2 +- test/pleroma/bookmark_test.exs | 2 +- test/pleroma/captcha_test.exs | 2 +- test/pleroma/chat/message_reference_test.exs | 2 +- test/pleroma/chat_test.exs | 2 +- test/pleroma/config/deprecation_warnings_test.exs | 2 +- test/pleroma/config/holder_test.exs | 2 +- test/pleroma/config/loader_test.exs | 2 +- test/pleroma/config/transfer_task_test.exs | 2 +- test/pleroma/config_db_test.exs | 2 +- test/pleroma/config_test.exs | 2 +- test/pleroma/conversation/participation_test.exs | 2 +- test/pleroma/conversation_test.exs | 2 +- test/pleroma/docs/generator_test.exs | 2 +- test/pleroma/earmark_renderer_test.exs | 2 +- .../pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs | 2 +- .../pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs | 2 +- .../ecto_type/activity_pub/object_validators/recipients_test.exs | 2 +- .../pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs | 2 +- test/pleroma/emails/admin_email_test.exs | 2 +- test/pleroma/emails/mailer_test.exs | 2 +- test/pleroma/emails/user_email_test.exs | 2 +- test/pleroma/emoji/formatter_test.exs | 2 +- test/pleroma/emoji/loader_test.exs | 2 +- test/pleroma/emoji/pack_test.exs | 2 +- test/pleroma/emoji_test.exs | 2 +- test/pleroma/filter_test.exs | 2 +- test/pleroma/following_relationship_test.exs | 2 +- test/pleroma/formatter_test.exs | 2 +- test/pleroma/frontend_test.exs | 2 +- test/pleroma/gun/connection_pool_test.exs | 2 +- test/pleroma/healthcheck_test.exs | 2 +- test/pleroma/html_test.exs | 2 +- test/pleroma/http/adapter_helper/gun_test.exs | 2 +- test/pleroma/http/adapter_helper/hackney_test.exs | 2 +- test/pleroma/http/adapter_helper_test.exs | 2 +- test/pleroma/http/ex_aws_test.exs | 2 +- test/pleroma/http/request_builder_test.exs | 2 +- test/pleroma/http/tzdata_test.exs | 2 +- test/pleroma/http_test.exs | 2 +- test/pleroma/instances/instance_test.exs | 2 +- test/pleroma/instances_test.exs | 2 +- test/pleroma/integration/federation_test.exs | 2 +- test/pleroma/integration/mastodon_websocket_test.exs | 2 +- test/pleroma/job_queue_monitor_test.exs | 2 +- test/pleroma/keys_test.exs | 2 +- test/pleroma/list_test.exs | 2 +- test/pleroma/marker_test.exs | 2 +- test/pleroma/mfa/backup_codes_test.exs | 2 +- test/pleroma/mfa/totp_test.exs | 2 +- test/pleroma/mfa_test.exs | 2 +- test/pleroma/migration_helper/notification_backfill_test.exs | 2 +- test/pleroma/moderation_log_test.exs | 2 +- test/pleroma/notification_test.exs | 2 +- test/pleroma/object/containment_test.exs | 2 +- test/pleroma/object/fetcher_test.exs | 2 +- test/pleroma/object_test.exs | 2 +- test/pleroma/otp_version_test.exs | 2 +- test/pleroma/pagination_test.exs | 2 +- test/pleroma/registration_test.exs | 2 +- test/pleroma/repo/migrations/autolinker_to_linkify_test.exs | 2 +- test/pleroma/repo/migrations/confirm_logged_in_users_test.exs | 2 +- test/pleroma/repo/migrations/fix_legacy_tags_test.exs | 2 +- test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs | 2 +- test/pleroma/repo/migrations/move_welcome_settings_test.exs | 2 +- test/pleroma/repo_test.exs | 2 +- test/pleroma/report_note_test.exs | 2 +- test/pleroma/reverse_proxy_test.exs | 2 +- test/pleroma/runtime_test.exs | 2 +- test/pleroma/safe_jsonb_set_test.exs | 2 +- test/pleroma/scheduled_activity_test.exs | 2 +- test/pleroma/signature_test.exs | 2 +- test/pleroma/stats_test.exs | 2 +- test/pleroma/upload/filter/anonymize_filename_test.exs | 2 +- test/pleroma/upload/filter/dedupe_test.exs | 2 +- test/pleroma/upload/filter/exiftool_test.exs | 2 +- test/pleroma/upload/filter/mogrifun_test.exs | 2 +- test/pleroma/upload/filter/mogrify_test.exs | 2 +- test/pleroma/upload/filter_test.exs | 2 +- test/pleroma/upload_test.exs | 2 +- test/pleroma/uploaders/local_test.exs | 2 +- test/pleroma/uploaders/s3_test.exs | 2 +- test/pleroma/user/backup_test.exs | 2 +- test/pleroma/user/import_test.exs | 2 +- test/pleroma/user/notification_setting_test.exs | 2 +- test/pleroma/user/query_test.exs | 2 +- test/pleroma/user/welcome_chat_message_test.exs | 2 +- test/pleroma/user/welcome_email_test.exs | 2 +- test/pleroma/user/welcome_message_test.exs | 2 +- test/pleroma/user_invite_token_test.exs | 2 +- test/pleroma/user_relationship_test.exs | 2 +- test/pleroma/user_search_test.exs | 2 +- test/pleroma/user_test.exs | 2 +- test/pleroma/utils_test.exs | 2 +- test/pleroma/web/activity_pub/activity_pub_controller_test.exs | 2 +- test/pleroma/web/activity_pub/activity_pub_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/mention_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/simple_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/tag_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf_test.exs | 2 +- .../web/activity_pub/object_validators/accept_validation_test.exs | 2 +- .../web/activity_pub/object_validators/announce_validation_test.exs | 2 +- .../web/activity_pub/object_validators/article_note_validator_test.exs | 2 +- .../web/activity_pub/object_validators/attachment_validator_test.exs | 2 +- .../web/activity_pub/object_validators/block_validation_test.exs | 2 +- .../pleroma/web/activity_pub/object_validators/chat_validation_test.exs | 2 +- .../web/activity_pub/object_validators/delete_validation_test.exs | 2 +- .../web/activity_pub/object_validators/emoji_react_handling_test.exs | 2 +- .../web/activity_pub/object_validators/follow_validation_test.exs | 2 +- .../pleroma/web/activity_pub/object_validators/like_validation_test.exs | 2 +- .../web/activity_pub/object_validators/reject_validation_test.exs | 2 +- test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs | 2 +- .../pleroma/web/activity_pub/object_validators/update_handling_test.exs | 2 +- test/pleroma/web/activity_pub/pipeline_test.exs | 2 +- test/pleroma/web/activity_pub/publisher_test.exs | 2 +- test/pleroma/web/activity_pub/relay_test.exs | 2 +- test/pleroma/web/activity_pub/side_effects/delete_test.exs | 2 +- test/pleroma/web/activity_pub/side_effects_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs | 2 +- .../web/activity_pub/transmogrifier/emoji_react_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs | 2 +- .../web/activity_pub/transmogrifier/user_update_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs | 2 +- test/pleroma/web/activity_pub/transmogrifier_test.exs | 2 +- test/pleroma/web/activity_pub/utils_test.exs | 2 +- test/pleroma/web/activity_pub/views/object_view_test.exs | 2 +- test/pleroma/web/activity_pub/views/user_view_test.exs | 2 +- test/pleroma/web/activity_pub/visibility_test.exs | 2 +- test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/chat_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/config_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/frontend_controller_test.exs | 2 +- .../web/admin_api/controllers/instance_document_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/invite_controller_test.exs | 2 +- .../web/admin_api/controllers/media_proxy_cache_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/relay_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/report_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/status_controller_test.exs | 2 +- test/pleroma/web/admin_api/controllers/user_controller_test.exs | 2 +- test/pleroma/web/admin_api/search_test.exs | 2 +- test/pleroma/web/admin_api/views/account_view_test.exs | 2 +- test/pleroma/web/admin_api/views/moderation_log_view_test.exs | 2 +- test/pleroma/web/admin_api/views/report_view_test.exs | 2 +- test/pleroma/web/api_spec/schema_examples_test.exs | 2 +- test/pleroma/web/auth/auth_controller_test.exs | 2 +- test/pleroma/web/auth/authenticator_test.exs | 2 +- test/pleroma/web/auth/basic_auth_test.exs | 2 +- test/pleroma/web/auth/pleroma_authenticator_test.exs | 2 +- test/pleroma/web/auth/totp_authenticator_test.exs | 2 +- test/pleroma/web/chat_channel_test.exs | 2 +- test/pleroma/web/common_api/utils_test.exs | 2 +- test/pleroma/web/common_api_test.exs | 2 +- test/pleroma/web/endpoint/metrics_exporter_test.exs | 2 +- test/pleroma/web/fallback_test.exs | 2 +- test/pleroma/web/federator_test.exs | 2 +- test/pleroma/web/feed/tag_controller_test.exs | 2 +- test/pleroma/web/feed/user_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/account_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/app_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs | 2 +- .../web/mastodon_api/controllers/conversation_controller_test.exs | 2 +- .../web/mastodon_api/controllers/custom_emoji_controller_test.exs | 2 +- .../web/mastodon_api/controllers/domain_block_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs | 2 +- .../web/mastodon_api/controllers/follow_request_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/list_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/media_controller_test.exs | 2 +- .../web/mastodon_api/controllers/notification_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/report_controller_test.exs | 2 +- .../web/mastodon_api/controllers/scheduled_activity_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/search_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/status_controller_test.exs | 2 +- .../web/mastodon_api/controllers/subscription_controller_test.exs | 2 +- .../pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/masto_fe_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs | 2 +- test/pleroma/web/mastodon_api/mastodon_api_test.exs | 2 +- test/pleroma/web/mastodon_api/update_credentials_test.exs | 2 +- test/pleroma/web/mastodon_api/views/account_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/conversation_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/list_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/marker_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/notification_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/poll_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/status_view_test.exs | 2 +- test/pleroma/web/mastodon_api/views/subscription_view_test.exs | 2 +- test/pleroma/web/media_proxy/invalidation/http_test.exs | 2 +- test/pleroma/web/media_proxy/invalidation/script_test.exs | 2 +- test/pleroma/web/media_proxy/invalidation_test.exs | 2 +- test/pleroma/web/media_proxy/media_proxy_controller_test.exs | 2 +- test/pleroma/web/media_proxy_test.exs | 2 +- test/pleroma/web/metadata/player_view_test.exs | 2 +- test/pleroma/web/metadata/providers/feed_test.exs | 2 +- test/pleroma/web/metadata/providers/open_graph_test.exs | 2 +- test/pleroma/web/metadata/providers/rel_me_test.exs | 2 +- test/pleroma/web/metadata/providers/restrict_indexing_test.exs | 2 +- test/pleroma/web/metadata/providers/twitter_card_test.exs | 2 +- test/pleroma/web/metadata/utils_test.exs | 2 +- test/pleroma/web/mongoose_im_controller_test.exs | 2 +- test/pleroma/web/node_info_test.exs | 2 +- test/pleroma/web/o_auth/app_test.exs | 2 +- test/pleroma/web/o_auth/authorization_test.exs | 2 +- test/pleroma/web/o_auth/ldap_authorization_test.exs | 2 +- test/pleroma/web/o_auth/mfa_controller_test.exs | 2 +- test/pleroma/web/o_auth/o_auth_controller_test.exs | 2 +- test/pleroma/web/o_auth/token/utils_test.exs | 2 +- test/pleroma/web/o_auth/token_test.exs | 2 +- test/pleroma/web/o_status/o_status_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/account_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/backup_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs | 2 +- .../web/pleroma_api/controllers/conversation_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs | 2 +- .../web/pleroma_api/controllers/emoji_reaction_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs | 2 +- .../web/pleroma_api/controllers/notification_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs | 2 +- .../controllers/two_factor_authentication_controller_test.exs | 2 +- .../pleroma/web/pleroma_api/controllers/user_import_controller_test.exs | 2 +- test/pleroma/web/pleroma_api/views/backup_view_test.exs | 2 +- test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs | 2 +- test/pleroma/web/pleroma_api/views/chat_view_test.exs | 2 +- test/pleroma/web/pleroma_api/views/scrobble_view_test.exs | 2 +- test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs | 2 +- test/pleroma/web/plugs/authentication_plug_test.exs | 2 +- test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs | 2 +- test/pleroma/web/plugs/cache_control_test.exs | 2 +- test/pleroma/web/plugs/cache_test.exs | 2 +- test/pleroma/web/plugs/ensure_authenticated_plug_test.exs | 2 +- test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs | 2 +- test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs | 2 +- test/pleroma/web/plugs/federating_plug_test.exs | 2 +- test/pleroma/web/plugs/frontend_static_plug_test.exs | 2 +- test/pleroma/web/plugs/http_security_plug_test.exs | 2 +- test/pleroma/web/plugs/http_signature_plug_test.exs | 2 +- test/pleroma/web/plugs/idempotency_plug_test.exs | 2 +- test/pleroma/web/plugs/instance_static_test.exs | 2 +- test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs | 2 +- test/pleroma/web/plugs/o_auth_plug_test.exs | 2 +- test/pleroma/web/plugs/o_auth_scopes_plug_test.exs | 2 +- test/pleroma/web/plugs/plug_helper_test.exs | 2 +- test/pleroma/web/plugs/rate_limiter_test.exs | 2 +- test/pleroma/web/plugs/remote_ip_test.exs | 2 +- test/pleroma/web/plugs/set_format_plug_test.exs | 2 +- test/pleroma/web/plugs/set_locale_plug_test.exs | 2 +- test/pleroma/web/plugs/set_user_session_id_plug_test.exs | 2 +- test/pleroma/web/plugs/uploaded_media_plug_test.exs | 2 +- test/pleroma/web/plugs/user_enabled_plug_test.exs | 2 +- test/pleroma/web/plugs/user_fetcher_plug_test.exs | 2 +- test/pleroma/web/plugs/user_is_admin_plug_test.exs | 2 +- test/pleroma/web/preload/providers/instance_test.exs | 2 +- test/pleroma/web/preload/providers/timeline_test.exs | 2 +- test/pleroma/web/preload/providers/user_test.exs | 2 +- test/pleroma/web/push/impl_test.exs | 2 +- test/pleroma/web/rel_me_test.exs | 2 +- test/pleroma/web/rich_media/helpers_test.exs | 2 +- test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs | 2 +- test/pleroma/web/rich_media/parser_test.exs | 2 +- test/pleroma/web/rich_media/parsers/twitter_card_test.exs | 2 +- test/pleroma/web/static_fe/static_fe_controller_test.exs | 2 +- test/pleroma/web/streamer_test.exs | 2 +- test/pleroma/web/twitter_api/controller_test.exs | 2 +- test/pleroma/web/twitter_api/password_controller_test.exs | 2 +- test/pleroma/web/twitter_api/remote_follow_controller_test.exs | 2 +- test/pleroma/web/twitter_api/twitter_api_test.exs | 2 +- test/pleroma/web/twitter_api/util_controller_test.exs | 2 +- test/pleroma/web/uploader_controller_test.exs | 2 +- test/pleroma/web/views/error_view_test.exs | 2 +- test/pleroma/web/web_finger/web_finger_controller_test.exs | 2 +- test/pleroma/web/web_finger_test.exs | 2 +- test/pleroma/workers/cron/digest_emails_worker_test.exs | 2 +- test/pleroma/workers/cron/new_users_digest_worker_test.exs | 2 +- test/pleroma/workers/purge_expired_activity_test.exs | 2 +- test/pleroma/workers/purge_expired_token_test.exs | 2 +- test/pleroma/workers/scheduled_activity_worker_test.exs | 2 +- test/pleroma/xml_builder_test.exs | 2 +- test/support/api_spec_helpers.ex | 2 +- test/support/cachex_proxy.ex | 2 +- test/support/captcha/mock.ex | 2 +- test/support/channel_case.ex | 2 +- test/support/conn_case.ex | 2 +- test/support/data_case.ex | 2 +- test/support/factory.ex | 2 +- test/support/helpers.ex | 2 +- test/support/http_request_mock.ex | 2 +- test/support/mocks.ex | 2 +- test/support/mrf_module_mock.ex | 2 +- test/support/null_cache.ex | 2 +- test/support/oban_helpers.ex | 2 +- test/support/websocket_client.ex | 2 +- test/test_helper.exs | 2 +- 883 files changed, 883 insertions(+), 883 deletions(-) diff --git a/installation/download-mastofe-build.sh b/installation/download-mastofe-build.sh index b8a021ef3..ee353c48c 100755 --- a/installation/download-mastofe-build.sh +++ b/installation/download-mastofe-build.sh @@ -1,6 +1,6 @@ #!/bin/sh # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only project_id="74" project_branch="rebase/glitch-soc" diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex index a33a9951c..45d0ad624 100644 --- a/lib/mix/pleroma.ex +++ b/lib/mix/pleroma.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Pleroma do diff --git a/lib/mix/tasks/pleroma/app.ex b/lib/mix/tasks/pleroma/app.ex index 463e2449f..0bf7ffabc 100644 --- a/lib/mix/tasks/pleroma/app.ex +++ b/lib/mix/tasks/pleroma/app.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.App do diff --git a/lib/mix/tasks/pleroma/benchmark.ex b/lib/mix/tasks/pleroma/benchmark.ex index a607d5d4f..fdf99747a 100644 --- a/lib/mix/tasks/pleroma/benchmark.ex +++ b/lib/mix/tasks/pleroma/benchmark.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Benchmark do diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index d7e2e97e7..1962154b9 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Config do diff --git a/lib/mix/tasks/pleroma/count_statuses.ex b/lib/mix/tasks/pleroma/count_statuses.ex index 8761d8f17..c29ea8567 100644 --- a/lib/mix/tasks/pleroma/count_statuses.ex +++ b/lib/mix/tasks/pleroma/count_statuses.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.CountStatuses do diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 22151ce08..6261910f0 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Database do diff --git a/lib/mix/tasks/pleroma/digest.ex b/lib/mix/tasks/pleroma/digest.ex index cac148b88..f34fc839e 100644 --- a/lib/mix/tasks/pleroma/digest.ex +++ b/lib/mix/tasks/pleroma/digest.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Digest do diff --git a/lib/mix/tasks/pleroma/docs.ex b/lib/mix/tasks/pleroma/docs.ex index ad5c37fc9..45cca1c74 100644 --- a/lib/mix/tasks/pleroma/docs.ex +++ b/lib/mix/tasks/pleroma/docs.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Docs do diff --git a/lib/mix/tasks/pleroma/ecto.ex b/lib/mix/tasks/pleroma/ecto.ex index 3363cd45f..69564c61a 100644 --- a/lib/mix/tasks/pleroma/ecto.ex +++ b/lib/mix/tasks/pleroma/ecto.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-onl defmodule Mix.Tasks.Pleroma.Ecto do diff --git a/lib/mix/tasks/pleroma/ecto/migrate.ex b/lib/mix/tasks/pleroma/ecto/migrate.ex index e903bd171..8d9f44e1c 100644 --- a/lib/mix/tasks/pleroma/ecto/migrate.ex +++ b/lib/mix/tasks/pleroma/ecto/migrate.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-onl defmodule Mix.Tasks.Pleroma.Ecto.Migrate do diff --git a/lib/mix/tasks/pleroma/ecto/rollback.ex b/lib/mix/tasks/pleroma/ecto/rollback.ex index 3dba952cb..2b1d48048 100644 --- a/lib/mix/tasks/pleroma/ecto/rollback.ex +++ b/lib/mix/tasks/pleroma/ecto/rollback.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-onl defmodule Mix.Tasks.Pleroma.Ecto.Rollback do diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex index bc5facc09..54f158f73 100644 --- a/lib/mix/tasks/pleroma/email.ex +++ b/lib/mix/tasks/pleroma/email.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Email do diff --git a/lib/mix/tasks/pleroma/emoji.ex b/lib/mix/tasks/pleroma/emoji.ex index 1750373f9..9ad4a7467 100644 --- a/lib/mix/tasks/pleroma/emoji.ex +++ b/lib/mix/tasks/pleroma/emoji.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Emoji do diff --git a/lib/mix/tasks/pleroma/frontend.ex b/lib/mix/tasks/pleroma/frontend.ex index f15dbc38b..8334e0049 100644 --- a/lib/mix/tasks/pleroma/frontend.ex +++ b/lib/mix/tasks/pleroma/frontend.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Frontend do diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index 853c4eaa2..f272fdb7f 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Instance do diff --git a/lib/mix/tasks/pleroma/notification_settings.ex b/lib/mix/tasks/pleroma/notification_settings.ex index f99275de1..e16866b6a 100644 --- a/lib/mix/tasks/pleroma/notification_settings.ex +++ b/lib/mix/tasks/pleroma/notification_settings.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.NotificationSettings do diff --git a/lib/mix/tasks/pleroma/refresh_counter_cache.ex b/lib/mix/tasks/pleroma/refresh_counter_cache.ex index efcbaa3b1..66eed8657 100644 --- a/lib/mix/tasks/pleroma/refresh_counter_cache.ex +++ b/lib/mix/tasks/pleroma/refresh_counter_cache.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.RefreshCounterCache do diff --git a/lib/mix/tasks/pleroma/relay.ex b/lib/mix/tasks/pleroma/relay.ex index bb808ca47..01e6b4279 100644 --- a/lib/mix/tasks/pleroma/relay.ex +++ b/lib/mix/tasks/pleroma/relay.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Relay do diff --git a/lib/mix/tasks/pleroma/robots_txt.ex b/lib/mix/tasks/pleroma/robots_txt.ex index 24f08180e..2ae430761 100644 --- a/lib/mix/tasks/pleroma/robots_txt.ex +++ b/lib/mix/tasks/pleroma/robots_txt.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.RobotsTxt do diff --git a/lib/mix/tasks/pleroma/uploads.ex b/lib/mix/tasks/pleroma/uploads.ex index c47b7531e..333e9aa8e 100644 --- a/lib/mix/tasks/pleroma/uploads.ex +++ b/lib/mix/tasks/pleroma/uploads.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Uploads do diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 20fe6c6e4..f90c045fe 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.User do diff --git a/lib/phoenix/transports/web_socket/raw.ex b/lib/phoenix/transports/web_socket/raw.ex index c3665bebe..8ed64eb16 100644 --- a/lib/phoenix/transports/web_socket/raw.ex +++ b/lib/phoenix/transports/web_socket/raw.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Phoenix.Transports.WebSocket.Raw do diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index 62fa9cca3..6542e684e 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Activity do diff --git a/lib/pleroma/activity/ir/topics.ex b/lib/pleroma/activity/ir/topics.ex index 6a26d7fdd..d94395fc1 100644 --- a/lib/pleroma/activity/ir/topics.ex +++ b/lib/pleroma/activity/ir/topics.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Activity.Ir.Topics do diff --git a/lib/pleroma/activity/queries.ex b/lib/pleroma/activity/queries.ex index c99aae44b..a6b02a889 100644 --- a/lib/pleroma/activity/queries.ex +++ b/lib/pleroma/activity/queries.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Activity.Queries do diff --git a/lib/pleroma/activity/search.ex b/lib/pleroma/activity/search.ex index babf9520b..52e7c048d 100644 --- a/lib/pleroma/activity/search.ex +++ b/lib/pleroma/activity/search.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Activity.Search do diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index bd568d858..203a95004 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Application do diff --git a/lib/pleroma/application_requirements.ex b/lib/pleroma/application_requirements.ex index e61576644..6ef65b263 100644 --- a/lib/pleroma/application_requirements.ex +++ b/lib/pleroma/application_requirements.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ApplicationRequirements do diff --git a/lib/pleroma/bbs/authenticator.ex b/lib/pleroma/bbs/authenticator.ex index 83ebb756d..241fcb53c 100644 --- a/lib/pleroma/bbs/authenticator.ex +++ b/lib/pleroma/bbs/authenticator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.BBS.Authenticator do diff --git a/lib/pleroma/bbs/handler.ex b/lib/pleroma/bbs/handler.ex index cd523cf7d..4a2e255f7 100644 --- a/lib/pleroma/bbs/handler.ex +++ b/lib/pleroma/bbs/handler.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.BBS.Handler do diff --git a/lib/pleroma/bookmark.ex b/lib/pleroma/bookmark.ex index e6ddbce1b..83cc8e7e1 100644 --- a/lib/pleroma/bookmark.ex +++ b/lib/pleroma/bookmark.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Bookmark do diff --git a/lib/pleroma/caching.ex b/lib/pleroma/caching.ex index 766d12d1b..02c18564d 100644 --- a/lib/pleroma/caching.ex +++ b/lib/pleroma/caching.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Caching do diff --git a/lib/pleroma/captcha.ex b/lib/pleroma/captcha.ex index 990003dcd..bad7b3a66 100644 --- a/lib/pleroma/captcha.ex +++ b/lib/pleroma/captcha.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha do diff --git a/lib/pleroma/captcha/kocaptcha.ex b/lib/pleroma/captcha/kocaptcha.ex index 201b55ab4..eac6dfa36 100644 --- a/lib/pleroma/captcha/kocaptcha.ex +++ b/lib/pleroma/captcha/kocaptcha.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha.Kocaptcha do diff --git a/lib/pleroma/captcha/native.ex b/lib/pleroma/captcha/native.ex index 8d604d2b2..2c6f64e66 100644 --- a/lib/pleroma/captcha/native.ex +++ b/lib/pleroma/captcha/native.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha.Native do diff --git a/lib/pleroma/captcha/service.ex b/lib/pleroma/captcha/service.ex index 959038cef..a430fafdc 100644 --- a/lib/pleroma/captcha/service.ex +++ b/lib/pleroma/captcha/service.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha.Service do diff --git a/lib/pleroma/chat.ex b/lib/pleroma/chat.ex index 28007cd9f..bacff24b5 100644 --- a/lib/pleroma/chat.ex +++ b/lib/pleroma/chat.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Chat do diff --git a/lib/pleroma/chat/message_reference.ex b/lib/pleroma/chat/message_reference.ex index 131ae0186..89537d155 100644 --- a/lib/pleroma/chat/message_reference.ex +++ b/lib/pleroma/chat/message_reference.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Chat.MessageReference do diff --git a/lib/pleroma/clippy.ex b/lib/pleroma/clippy.ex index ae96e6ad1..9c674e075 100644 --- a/lib/pleroma/clippy.ex +++ b/lib/pleroma/clippy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Clippy do diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index 86d4f6b72..f17e14128 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config do diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index 59c6b0f58..382076c31 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.DeprecationWarnings do diff --git a/lib/pleroma/config/getting.ex b/lib/pleroma/config/getting.ex index cc557674c..2cc9fe80b 100644 --- a/lib/pleroma/config/getting.ex +++ b/lib/pleroma/config/getting.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.Getting do diff --git a/lib/pleroma/config/helpers.ex b/lib/pleroma/config/helpers.ex index 3dce40ea0..9f26c3546 100644 --- a/lib/pleroma/config/helpers.ex +++ b/lib/pleroma/config/helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.Helpers do diff --git a/lib/pleroma/config/holder.ex b/lib/pleroma/config/holder.ex index a99fc0471..4d186a854 100644 --- a/lib/pleroma/config/holder.ex +++ b/lib/pleroma/config/holder.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.Holder do diff --git a/lib/pleroma/config/loader.ex b/lib/pleroma/config/loader.ex index 64e7de6df..b64d06707 100644 --- a/lib/pleroma/config/loader.ex +++ b/lib/pleroma/config/loader.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.Loader do diff --git a/lib/pleroma/config/oban.ex b/lib/pleroma/config/oban.ex index 8e0351d52..3e63bca40 100644 --- a/lib/pleroma/config/oban.ex +++ b/lib/pleroma/config/oban.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.Oban do diff --git a/lib/pleroma/config/transfer_task.ex b/lib/pleroma/config/transfer_task.ex index a0d7b7d71..aad45aab8 100644 --- a/lib/pleroma/config/transfer_task.ex +++ b/lib/pleroma/config/transfer_task.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.TransferTask do diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex index 8e8bb732f..b874e0e37 100644 --- a/lib/pleroma/config_db.ex +++ b/lib/pleroma/config_db.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ConfigDB do diff --git a/lib/pleroma/constants.ex b/lib/pleroma/constants.ex index cf8182d55..a40741ba6 100644 --- a/lib/pleroma/constants.ex +++ b/lib/pleroma/constants.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Constants do diff --git a/lib/pleroma/conversation.ex b/lib/pleroma/conversation.ex index e15259091..8812b456d 100644 --- a/lib/pleroma/conversation.ex +++ b/lib/pleroma/conversation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Conversation do diff --git a/lib/pleroma/conversation/participation.ex b/lib/pleroma/conversation/participation.ex index 4c32b273a..da5e57714 100644 --- a/lib/pleroma/conversation/participation.ex +++ b/lib/pleroma/conversation/participation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Conversation.Participation do diff --git a/lib/pleroma/conversation/participation/recipient_ship.ex b/lib/pleroma/conversation/participation/recipient_ship.ex index de40bacac..094c1a176 100644 --- a/lib/pleroma/conversation/participation/recipient_ship.ex +++ b/lib/pleroma/conversation/participation/recipient_ship.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Conversation.Participation.RecipientShip do diff --git a/lib/pleroma/counter_cache.ex b/lib/pleroma/counter_cache.ex index ebd1f603d..1e75d19ae 100644 --- a/lib/pleroma/counter_cache.ex +++ b/lib/pleroma/counter_cache.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.CounterCache do diff --git a/lib/pleroma/delivery.ex b/lib/pleroma/delivery.ex index 0ded2855c..e8d536767 100644 --- a/lib/pleroma/delivery.ex +++ b/lib/pleroma/delivery.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Delivery do diff --git a/lib/pleroma/docs/generator.ex b/lib/pleroma/docs/generator.ex index a70f83b73..e8a68fd41 100644 --- a/lib/pleroma/docs/generator.ex +++ b/lib/pleroma/docs/generator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Docs.Generator do diff --git a/lib/pleroma/docs/json.ex b/lib/pleroma/docs/json.ex index a583e2a5b..f22432ea4 100644 --- a/lib/pleroma/docs/json.ex +++ b/lib/pleroma/docs/json.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Docs.JSON do diff --git a/lib/pleroma/docs/markdown.ex b/lib/pleroma/docs/markdown.ex index eac0789a6..7e54e9d58 100644 --- a/lib/pleroma/docs/markdown.ex +++ b/lib/pleroma/docs/markdown.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Docs.Markdown do diff --git a/lib/pleroma/earmark_renderer.ex b/lib/pleroma/earmark_renderer.ex index 6211a3b4a..31cae3c72 100644 --- a/lib/pleroma/earmark_renderer.ex +++ b/lib/pleroma/earmark_renderer.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only # # This file is derived from Earmark, under the following copyright: diff --git a/lib/pleroma/ecto_enums.ex b/lib/pleroma/ecto_enums.ex index 6fc47620c..f198cccb7 100644 --- a/lib/pleroma/ecto_enums.ex +++ b/lib/pleroma/ecto_enums.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only import EctoEnum diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/date_time.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/date_time.ex index d852c0abd..8552ae73d 100644 --- a/lib/pleroma/ecto_type/activity_pub/object_validators/date_time.ex +++ b/lib/pleroma/ecto_type/activity_pub/object_validators/date_time.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime do diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/emoji.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/emoji.ex index 4aacc5c88..96674e21f 100644 --- a/lib/pleroma/ecto_type/activity_pub/object_validators/emoji.ex +++ b/lib/pleroma/ecto_type/activity_pub/object_validators/emoji.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.Emoji do diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/object_id.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/object_id.ex index 8034235b0..45bd6070a 100644 --- a/lib/pleroma/ecto_type/activity_pub/object_validators/object_id.ex +++ b/lib/pleroma/ecto_type/activity_pub/object_validators/object_id.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectID do diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/recipients.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/recipients.ex index 205527a96..af4b0e527 100644 --- a/lib/pleroma/ecto_type/activity_pub/object_validators/recipients.ex +++ b/lib/pleroma/ecto_type/activity_pub/object_validators/recipients.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.Recipients do diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/safe_text.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/safe_text.ex index 7f0405c7b..d0f5f381f 100644 --- a/lib/pleroma/ecto_type/activity_pub/object_validators/safe_text.ex +++ b/lib/pleroma/ecto_type/activity_pub/object_validators/safe_text.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.SafeText do diff --git a/lib/pleroma/ecto_type/activity_pub/object_validators/uri.ex b/lib/pleroma/ecto_type/activity_pub/object_validators/uri.ex index 2054c26be..f5b68648c 100644 --- a/lib/pleroma/ecto_type/activity_pub/object_validators/uri.ex +++ b/lib/pleroma/ecto_type/activity_pub/object_validators/uri.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.Uri do diff --git a/lib/pleroma/ecto_type/config/atom.ex b/lib/pleroma/ecto_type/config/atom.ex index df565d432..3bf0bca5b 100644 --- a/lib/pleroma/ecto_type/config/atom.ex +++ b/lib/pleroma/ecto_type/config/atom.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.Config.Atom do diff --git a/lib/pleroma/ecto_type/config/binary_value.ex b/lib/pleroma/ecto_type/config/binary_value.ex index bbd2608c5..908220a65 100644 --- a/lib/pleroma/ecto_type/config/binary_value.ex +++ b/lib/pleroma/ecto_type/config/binary_value.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.Config.BinaryValue do diff --git a/lib/pleroma/emails/admin_email.ex b/lib/pleroma/emails/admin_email.ex index d5757c12a..5fe74e2f7 100644 --- a/lib/pleroma/emails/admin_email.ex +++ b/lib/pleroma/emails/admin_email.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.AdminEmail do diff --git a/lib/pleroma/emails/mailer.ex b/lib/pleroma/emails/mailer.ex index 5108c71c8..c68550bee 100644 --- a/lib/pleroma/emails/mailer.ex +++ b/lib/pleroma/emails/mailer.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.Mailer do diff --git a/lib/pleroma/emails/new_users_digest_email.ex b/lib/pleroma/emails/new_users_digest_email.ex index 348cbac9c..3552dedae 100644 --- a/lib/pleroma/emails/new_users_digest_email.ex +++ b/lib/pleroma/emails/new_users_digest_email.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.NewUsersDigestEmail do diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index 2b51d5b05..dbd89f1c7 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.UserEmail do diff --git a/lib/pleroma/emoji.ex b/lib/pleroma/emoji.ex index 513fb59f8..f077fe5b4 100644 --- a/lib/pleroma/emoji.ex +++ b/lib/pleroma/emoji.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji do diff --git a/lib/pleroma/emoji/formatter.ex b/lib/pleroma/emoji/formatter.ex index 992b20e12..50150e951 100644 --- a/lib/pleroma/emoji/formatter.ex +++ b/lib/pleroma/emoji/formatter.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji.Formatter do diff --git a/lib/pleroma/emoji/loader.ex b/lib/pleroma/emoji/loader.ex index 03a6bca0b..028cf5ea8 100644 --- a/lib/pleroma/emoji/loader.ex +++ b/lib/pleroma/emoji/loader.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji.Loader do diff --git a/lib/pleroma/emoji/pack.ex b/lib/pleroma/emoji/pack.ex index ec97aa652..09bfcc868 100644 --- a/lib/pleroma/emoji/pack.ex +++ b/lib/pleroma/emoji/pack.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji.Pack do diff --git a/lib/pleroma/filter.ex b/lib/pleroma/filter.ex index 5d6df9530..fc531f7fc 100644 --- a/lib/pleroma/filter.ex +++ b/lib/pleroma/filter.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Filter do diff --git a/lib/pleroma/following_relationship.ex b/lib/pleroma/following_relationship.ex index 5390a58e1..147cb9df0 100644 --- a/lib/pleroma/following_relationship.ex +++ b/lib/pleroma/following_relationship.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.FollowingRelationship do diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 0c450eae4..7a08e48a9 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Formatter do diff --git a/lib/pleroma/frontend.ex b/lib/pleroma/frontend.ex index bf935a728..34b7befb8 100644 --- a/lib/pleroma/frontend.ex +++ b/lib/pleroma/frontend.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Frontend do diff --git a/lib/pleroma/gopher/server.ex b/lib/pleroma/gopher/server.ex index 8ac8d18c1..1b85c49f5 100644 --- a/lib/pleroma/gopher/server.ex +++ b/lib/pleroma/gopher/server.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gopher.Server do diff --git a/lib/pleroma/gun.ex b/lib/pleroma/gun.ex index 4043e4880..f9c828fac 100644 --- a/lib/pleroma/gun.ex +++ b/lib/pleroma/gun.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun do diff --git a/lib/pleroma/gun/api.ex b/lib/pleroma/gun/api.ex index 09be74392..24d542781 100644 --- a/lib/pleroma/gun/api.ex +++ b/lib/pleroma/gun/api.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.API do diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex index 477e19c6e..a56625699 100644 --- a/lib/pleroma/gun/conn.ex +++ b/lib/pleroma/gun/conn.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.Conn do diff --git a/lib/pleroma/gun/connection_pool.ex b/lib/pleroma/gun/connection_pool.ex index e322f192a..f9fd77ade 100644 --- a/lib/pleroma/gun/connection_pool.ex +++ b/lib/pleroma/gun/connection_pool.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.ConnectionPool do diff --git a/lib/pleroma/gun/connection_pool/reclaimer.ex b/lib/pleroma/gun/connection_pool/reclaimer.ex index 241e8b04f..c37b62bf2 100644 --- a/lib/pleroma/gun/connection_pool/reclaimer.ex +++ b/lib/pleroma/gun/connection_pool/reclaimer.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.ConnectionPool.Reclaimer do diff --git a/lib/pleroma/gun/connection_pool/worker.ex b/lib/pleroma/gun/connection_pool/worker.ex index b71816bed..02bfff274 100644 --- a/lib/pleroma/gun/connection_pool/worker.ex +++ b/lib/pleroma/gun/connection_pool/worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.ConnectionPool.Worker do diff --git a/lib/pleroma/gun/connection_pool/worker_supervisor.ex b/lib/pleroma/gun/connection_pool/worker_supervisor.ex index 4c23bcbd9..016b675f4 100644 --- a/lib/pleroma/gun/connection_pool/worker_supervisor.ex +++ b/lib/pleroma/gun/connection_pool/worker_supervisor.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor do diff --git a/lib/pleroma/healthcheck.ex b/lib/pleroma/healthcheck.ex index 92ce83cb7..c905bba3f 100644 --- a/lib/pleroma/healthcheck.ex +++ b/lib/pleroma/healthcheck.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Healthcheck do diff --git a/lib/pleroma/helpers/auth_helper.ex b/lib/pleroma/helpers/auth_helper.ex index 8f87b38be..13e4c8158 100644 --- a/lib/pleroma/helpers/auth_helper.ex +++ b/lib/pleroma/helpers/auth_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Helpers.AuthHelper do diff --git a/lib/pleroma/helpers/inet_helper.ex b/lib/pleroma/helpers/inet_helper.ex index 126f82381..5acdfaed0 100644 --- a/lib/pleroma/helpers/inet_helper.ex +++ b/lib/pleroma/helpers/inet_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Helpers.InetHelper do diff --git a/lib/pleroma/helpers/media_helper.ex b/lib/pleroma/helpers/media_helper.ex index 6b799173e..738adfcaa 100644 --- a/lib/pleroma/helpers/media_helper.ex +++ b/lib/pleroma/helpers/media_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Helpers.MediaHelper do diff --git a/lib/pleroma/helpers/qt_fast_start.ex b/lib/pleroma/helpers/qt_fast_start.ex index bb93224b5..c4d11b9dd 100644 --- a/lib/pleroma/helpers/qt_fast_start.ex +++ b/lib/pleroma/helpers/qt_fast_start.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Helpers.QtFastStart do diff --git a/lib/pleroma/helpers/uri_helper.ex b/lib/pleroma/helpers/uri_helper.ex index f1301f055..8f6a664ad 100644 --- a/lib/pleroma/helpers/uri_helper.ex +++ b/lib/pleroma/helpers/uri_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Helpers.UriHelper do diff --git a/lib/pleroma/html.ex b/lib/pleroma/html.ex index c5ece7350..2dfdca693 100644 --- a/lib/pleroma/html.ex +++ b/lib/pleroma/html.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTML do diff --git a/lib/pleroma/http.ex b/lib/pleroma/http.ex index 052597191..07b3ab0ae 100644 --- a/lib/pleroma/http.ex +++ b/lib/pleroma/http.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP do diff --git a/lib/pleroma/http/adapter_helper.ex b/lib/pleroma/http/adapter_helper.ex index 08b51578a..c667afd25 100644 --- a/lib/pleroma/http/adapter_helper.ex +++ b/lib/pleroma/http/adapter_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelper do diff --git a/lib/pleroma/http/adapter_helper/default.ex b/lib/pleroma/http/adapter_helper/default.ex index 8567a616b..a1614b9c5 100644 --- a/lib/pleroma/http/adapter_helper/default.ex +++ b/lib/pleroma/http/adapter_helper/default.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelper.Default do diff --git a/lib/pleroma/http/adapter_helper/gun.ex b/lib/pleroma/http/adapter_helper/gun.ex index 1dbb71362..82c7fd654 100644 --- a/lib/pleroma/http/adapter_helper/gun.ex +++ b/lib/pleroma/http/adapter_helper/gun.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelper.Gun do diff --git a/lib/pleroma/http/adapter_helper/hackney.ex b/lib/pleroma/http/adapter_helper/hackney.ex index ff60513fd..fe3f91a72 100644 --- a/lib/pleroma/http/adapter_helper/hackney.ex +++ b/lib/pleroma/http/adapter_helper/hackney.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelper.Hackney do diff --git a/lib/pleroma/http/ex_aws.ex b/lib/pleroma/http/ex_aws.ex index 5cac3532f..283590b18 100644 --- a/lib/pleroma/http/ex_aws.ex +++ b/lib/pleroma/http/ex_aws.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.ExAws do diff --git a/lib/pleroma/http/request.ex b/lib/pleroma/http/request.ex index 761bd6ccf..d906024de 100644 --- a/lib/pleroma/http/request.ex +++ b/lib/pleroma/http/request.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.Request do diff --git a/lib/pleroma/http/request_builder.ex b/lib/pleroma/http/request_builder.ex index 8a44a001d..631c927af 100644 --- a/lib/pleroma/http/request_builder.ex +++ b/lib/pleroma/http/request_builder.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.RequestBuilder do diff --git a/lib/pleroma/http/tzdata.ex b/lib/pleroma/http/tzdata.ex index 09cfdadf7..77e1b537e 100644 --- a/lib/pleroma/http/tzdata.ex +++ b/lib/pleroma/http/tzdata.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.Tzdata do diff --git a/lib/pleroma/http/web_push.ex b/lib/pleroma/http/web_push.ex index 78148a12e..51f72fbf8 100644 --- a/lib/pleroma/http/web_push.ex +++ b/lib/pleroma/http/web_push.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.WebPush do diff --git a/lib/pleroma/instances.ex b/lib/pleroma/instances.ex index 7315bd7cb..80addcc52 100644 --- a/lib/pleroma/instances.ex +++ b/lib/pleroma/instances.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Instances do diff --git a/lib/pleroma/instances/instance.ex b/lib/pleroma/instances/instance.ex index 2e1696fe2..4d0e8034d 100644 --- a/lib/pleroma/instances/instance.ex +++ b/lib/pleroma/instances/instance.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Instances.Instance do diff --git a/lib/pleroma/job_queue_monitor.ex b/lib/pleroma/job_queue_monitor.ex index c255a61ec..b5f124923 100644 --- a/lib/pleroma/job_queue_monitor.ex +++ b/lib/pleroma/job_queue_monitor.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.JobQueueMonitor do diff --git a/lib/pleroma/jwt.ex b/lib/pleroma/jwt.ex index faeb77781..c75c44bd1 100644 --- a/lib/pleroma/jwt.ex +++ b/lib/pleroma/jwt.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.JWT do diff --git a/lib/pleroma/keys.ex b/lib/pleroma/keys.ex index c9af79f00..413861b15 100644 --- a/lib/pleroma/keys.ex +++ b/lib/pleroma/keys.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Keys do diff --git a/lib/pleroma/list.ex b/lib/pleroma/list.ex index 89aa7b5d4..ff975e7a6 100644 --- a/lib/pleroma/list.ex +++ b/lib/pleroma/list.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.List do diff --git a/lib/pleroma/logging.ex b/lib/pleroma/logging.ex index 37b201c29..11e1c3bed 100644 --- a/lib/pleroma/logging.ex +++ b/lib/pleroma/logging.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Logging do diff --git a/lib/pleroma/maintenance.ex b/lib/pleroma/maintenance.ex index 326c17825..f1058b68a 100644 --- a/lib/pleroma/maintenance.ex +++ b/lib/pleroma/maintenance.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Maintenance do diff --git a/lib/pleroma/maps.ex b/lib/pleroma/maps.ex index ab2e32e2f..0d2e94248 100644 --- a/lib/pleroma/maps.ex +++ b/lib/pleroma/maps.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Maps do diff --git a/lib/pleroma/marker.ex b/lib/pleroma/marker.ex index 4d82860f5..9909de161 100644 --- a/lib/pleroma/marker.ex +++ b/lib/pleroma/marker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Marker do diff --git a/lib/pleroma/mfa.ex b/lib/pleroma/mfa.ex index 01b743f4f..f43e03a54 100644 --- a/lib/pleroma/mfa.ex +++ b/lib/pleroma/mfa.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA do diff --git a/lib/pleroma/mfa/backup_codes.ex b/lib/pleroma/mfa/backup_codes.ex index 9875310ff..a7a1fba2e 100644 --- a/lib/pleroma/mfa/backup_codes.ex +++ b/lib/pleroma/mfa/backup_codes.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.BackupCodes do diff --git a/lib/pleroma/mfa/changeset.ex b/lib/pleroma/mfa/changeset.ex index 77c4fa202..2d46cdf73 100644 --- a/lib/pleroma/mfa/changeset.ex +++ b/lib/pleroma/mfa/changeset.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.Changeset do diff --git a/lib/pleroma/mfa/settings.ex b/lib/pleroma/mfa/settings.ex index de6e2228f..94fbff635 100644 --- a/lib/pleroma/mfa/settings.ex +++ b/lib/pleroma/mfa/settings.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.Settings do diff --git a/lib/pleroma/mfa/token.ex b/lib/pleroma/mfa/token.ex index 69b64c0e8..76573182a 100644 --- a/lib/pleroma/mfa/token.ex +++ b/lib/pleroma/mfa/token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.Token do diff --git a/lib/pleroma/mfa/totp.ex b/lib/pleroma/mfa/totp.ex index d2ea2b3aa..f33e3a379 100644 --- a/lib/pleroma/mfa/totp.ex +++ b/lib/pleroma/mfa/totp.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.TOTP do diff --git a/lib/pleroma/migration_helper/notification_backfill.ex b/lib/pleroma/migration_helper/notification_backfill.ex index 24f4733fe..62b710f82 100644 --- a/lib/pleroma/migration_helper/notification_backfill.ex +++ b/lib/pleroma/migration_helper/notification_backfill.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MigrationHelper.NotificationBackfill do diff --git a/lib/pleroma/moderation_log.ex b/lib/pleroma/moderation_log.ex index a7f26793d..1849cacc8 100644 --- a/lib/pleroma/moderation_log.ex +++ b/lib/pleroma/moderation_log.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ModerationLog do diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 4efea9f7d..7a69dacde 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Notification do diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 4fb4ec364..aaf123840 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Object do diff --git a/lib/pleroma/object/containment.ex b/lib/pleroma/object/containment.ex index 29cb3d672..fb0398f92 100644 --- a/lib/pleroma/object/containment.ex +++ b/lib/pleroma/object/containment.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Object.Containment do diff --git a/lib/pleroma/object/fetcher.ex b/lib/pleroma/object/fetcher.ex index 18c383881..bcccf1c4c 100644 --- a/lib/pleroma/object/fetcher.ex +++ b/lib/pleroma/object/fetcher.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Object.Fetcher do diff --git a/lib/pleroma/object_tombstone.ex b/lib/pleroma/object_tombstone.ex index e26f44057..a42d2d9a0 100644 --- a/lib/pleroma/object_tombstone.ex +++ b/lib/pleroma/object_tombstone.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ObjectTombstone do diff --git a/lib/pleroma/otp_version.ex b/lib/pleroma/otp_version.ex index 114d0054f..a5ac1b072 100644 --- a/lib/pleroma/otp_version.ex +++ b/lib/pleroma/otp_version.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.OTPVersion do diff --git a/lib/pleroma/pagination.ex b/lib/pleroma/pagination.ex index 9a3795769..0d24e1010 100644 --- a/lib/pleroma/pagination.ex +++ b/lib/pleroma/pagination.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Pagination do diff --git a/lib/pleroma/password_reset_token.ex b/lib/pleroma/password_reset_token.ex index fea5b1c22..edc8ed6a0 100644 --- a/lib/pleroma/password_reset_token.ex +++ b/lib/pleroma/password_reset_token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.PasswordResetToken do diff --git a/lib/pleroma/registration.ex b/lib/pleroma/registration.ex index 9163040b4..7b49618e1 100644 --- a/lib/pleroma/registration.ex +++ b/lib/pleroma/registration.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Registration do diff --git a/lib/pleroma/release_tasks.ex b/lib/pleroma/release_tasks.ex index 02dd6c325..1e06aafe4 100644 --- a/lib/pleroma/release_tasks.ex +++ b/lib/pleroma/release_tasks.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReleaseTasks do diff --git a/lib/pleroma/repo.ex b/lib/pleroma/repo.ex index 4524bd5e2..4556352d0 100644 --- a/lib/pleroma/repo.ex +++ b/lib/pleroma/repo.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo do diff --git a/lib/pleroma/report_note.ex b/lib/pleroma/report_note.ex index a239bd361..f8bab1548 100644 --- a/lib/pleroma/report_note.ex +++ b/lib/pleroma/report_note.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReportNote do diff --git a/lib/pleroma/reverse_proxy.ex b/lib/pleroma/reverse_proxy.ex index 3ea897c95..466906f03 100644 --- a/lib/pleroma/reverse_proxy.ex +++ b/lib/pleroma/reverse_proxy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReverseProxy do diff --git a/lib/pleroma/reverse_proxy/client.ex b/lib/pleroma/reverse_proxy/client.ex index 0d13ff174..8698fa2e1 100644 --- a/lib/pleroma/reverse_proxy/client.ex +++ b/lib/pleroma/reverse_proxy/client.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReverseProxy.Client do diff --git a/lib/pleroma/reverse_proxy/client/hackney.ex b/lib/pleroma/reverse_proxy/client/hackney.ex index ad988fac3..dba946308 100644 --- a/lib/pleroma/reverse_proxy/client/hackney.ex +++ b/lib/pleroma/reverse_proxy/client/hackney.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReverseProxy.Client.Hackney do diff --git a/lib/pleroma/reverse_proxy/client/tesla.ex b/lib/pleroma/reverse_proxy/client/tesla.ex index 4b118eec2..36a0a2060 100644 --- a/lib/pleroma/reverse_proxy/client/tesla.ex +++ b/lib/pleroma/reverse_proxy/client/tesla.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReverseProxy.Client.Tesla do diff --git a/lib/pleroma/scheduled_activity.ex b/lib/pleroma/scheduled_activity.ex index 0937cb7db..2b156341f 100644 --- a/lib/pleroma/scheduled_activity.ex +++ b/lib/pleroma/scheduled_activity.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ScheduledActivity do diff --git a/lib/pleroma/signature.ex b/lib/pleroma/signature.ex index 3aa6909d2..43ab569a4 100644 --- a/lib/pleroma/signature.ex +++ b/lib/pleroma/signature.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Signature do diff --git a/lib/pleroma/stats.ex b/lib/pleroma/stats.ex index 48afe901e..77505bb04 100644 --- a/lib/pleroma/stats.ex +++ b/lib/pleroma/stats.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Stats do diff --git a/lib/pleroma/telemetry/logger.ex b/lib/pleroma/telemetry/logger.ex index 003079cf3..44d2f48dc 100644 --- a/lib/pleroma/telemetry/logger.ex +++ b/lib/pleroma/telemetry/logger.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Telemetry.Logger do diff --git a/lib/pleroma/tesla/middleware/connection_pool.ex b/lib/pleroma/tesla/middleware/connection_pool.ex index 056e736ce..906706d39 100644 --- a/lib/pleroma/tesla/middleware/connection_pool.ex +++ b/lib/pleroma/tesla/middleware/connection_pool.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tesla.Middleware.ConnectionPool do diff --git a/lib/pleroma/tests/auth_test_controller.ex b/lib/pleroma/tests/auth_test_controller.ex index b30d83567..ddf3fea4f 100644 --- a/lib/pleroma/tests/auth_test_controller.ex +++ b/lib/pleroma/tests/auth_test_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only # A test controller reachable only in :test env. diff --git a/lib/pleroma/thread_mute.ex b/lib/pleroma/thread_mute.ex index be01d541d..5d06cf030 100644 --- a/lib/pleroma/thread_mute.ex +++ b/lib/pleroma/thread_mute.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ThreadMute do diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index 51ca97f41..00b61ca80 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload do diff --git a/lib/pleroma/upload/filter.ex b/lib/pleroma/upload/filter.ex index 661135634..c677d4b9f 100644 --- a/lib/pleroma/upload/filter.ex +++ b/lib/pleroma/upload/filter.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter do diff --git a/lib/pleroma/upload/filter/anonymize_filename.ex b/lib/pleroma/upload/filter/anonymize_filename.ex index fc456e4f4..7e62b3d13 100644 --- a/lib/pleroma/upload/filter/anonymize_filename.ex +++ b/lib/pleroma/upload/filter/anonymize_filename.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.AnonymizeFilename do diff --git a/lib/pleroma/upload/filter/dedupe.ex b/lib/pleroma/upload/filter/dedupe.ex index 86cbc8996..2bf581b05 100644 --- a/lib/pleroma/upload/filter/dedupe.ex +++ b/lib/pleroma/upload/filter/dedupe.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.Dedupe do diff --git a/lib/pleroma/upload/filter/exiftool.ex b/lib/pleroma/upload/filter/exiftool.ex index 1fd0cfdaa..2dbde540d 100644 --- a/lib/pleroma/upload/filter/exiftool.ex +++ b/lib/pleroma/upload/filter/exiftool.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.Exiftool do diff --git a/lib/pleroma/upload/filter/mogrifun.ex b/lib/pleroma/upload/filter/mogrifun.ex index 363e5cf0f..9abdd2d51 100644 --- a/lib/pleroma/upload/filter/mogrifun.ex +++ b/lib/pleroma/upload/filter/mogrifun.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.Mogrifun do diff --git a/lib/pleroma/upload/filter/mogrify.ex b/lib/pleroma/upload/filter/mogrify.ex index 71968fd9c..4bca4f5ca 100644 --- a/lib/pleroma/upload/filter/mogrify.ex +++ b/lib/pleroma/upload/filter/mogrify.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.Mogrify do diff --git a/lib/pleroma/uploaders/local.ex b/lib/pleroma/uploaders/local.ex index 10b3069f4..0e1ba4b90 100644 --- a/lib/pleroma/uploaders/local.ex +++ b/lib/pleroma/uploaders/local.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Uploaders.Local do diff --git a/lib/pleroma/uploaders/s3.ex b/lib/pleroma/uploaders/s3.ex index 29a1c2861..d85c8cb2f 100644 --- a/lib/pleroma/uploaders/s3.ex +++ b/lib/pleroma/uploaders/s3.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Uploaders.S3 do diff --git a/lib/pleroma/uploaders/uploader.ex b/lib/pleroma/uploaders/uploader.ex index 6249eceb1..af99d001c 100644 --- a/lib/pleroma/uploaders/uploader.ex +++ b/lib/pleroma/uploaders/uploader.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Uploaders.Uploader do diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 52730fd8d..cd0c64acc 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User do diff --git a/lib/pleroma/user/backup.ex b/lib/pleroma/user/backup.ex index a9041fd94..cba94248f 100644 --- a/lib/pleroma/user/backup.ex +++ b/lib/pleroma/user/backup.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.Backup do diff --git a/lib/pleroma/user/import.ex b/lib/pleroma/user/import.ex index 86b49d8ae..60cd18041 100644 --- a/lib/pleroma/user/import.ex +++ b/lib/pleroma/user/import.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.Import do diff --git a/lib/pleroma/user/notification_setting.ex b/lib/pleroma/user/notification_setting.ex index 7d9e8a000..a7cd61499 100644 --- a/lib/pleroma/user/notification_setting.ex +++ b/lib/pleroma/user/notification_setting.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.NotificationSetting do diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index 7ef2a1455..ab9554bd2 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.Query do diff --git a/lib/pleroma/user/search.ex b/lib/pleroma/user/search.ex index f1761ef03..a4f6abca2 100644 --- a/lib/pleroma/user/search.ex +++ b/lib/pleroma/user/search.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.Search do diff --git a/lib/pleroma/user/welcome_chat_message.ex b/lib/pleroma/user/welcome_chat_message.ex index 3e7d1f424..0d6690e34 100644 --- a/lib/pleroma/user/welcome_chat_message.ex +++ b/lib/pleroma/user/welcome_chat_message.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.WelcomeChatMessage do diff --git a/lib/pleroma/user/welcome_email.ex b/lib/pleroma/user/welcome_email.ex index 5322000d4..295c1acc7 100644 --- a/lib/pleroma/user/welcome_email.ex +++ b/lib/pleroma/user/welcome_email.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.WelcomeEmail do diff --git a/lib/pleroma/user/welcome_message.ex b/lib/pleroma/user/welcome_message.ex index 86e1c0678..2cff05549 100644 --- a/lib/pleroma/user/welcome_message.ex +++ b/lib/pleroma/user/welcome_message.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.WelcomeMessage do diff --git a/lib/pleroma/user_invite_token.ex b/lib/pleroma/user_invite_token.ex index a08ba99f1..4cff1c515 100644 --- a/lib/pleroma/user_invite_token.ex +++ b/lib/pleroma/user_invite_token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UserInviteToken do diff --git a/lib/pleroma/user_relationship.ex b/lib/pleroma/user_relationship.ex index 6dfdd2860..a467e9b65 100644 --- a/lib/pleroma/user_relationship.ex +++ b/lib/pleroma/user_relationship.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UserRelationship do diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index fa75a8c99..c6892dec2 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Utils do diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 3ca20455d..c3aa39492 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web do diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 8c2610eeb..c5bc08153 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ActivityPub do diff --git a/lib/pleroma/web/activity_pub/activity_pub/persisting.ex b/lib/pleroma/web/activity_pub/activity_pub/persisting.ex index 3894f48e2..5ec8b7bab 100644 --- a/lib/pleroma/web/activity_pub/activity_pub/persisting.ex +++ b/lib/pleroma/web/activity_pub/activity_pub/persisting.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ActivityPub.Persisting do diff --git a/lib/pleroma/web/activity_pub/activity_pub/streaming.ex b/lib/pleroma/web/activity_pub/activity_pub/streaming.ex index 30009f2fb..983168bff 100644 --- a/lib/pleroma/web/activity_pub/activity_pub/streaming.ex +++ b/lib/pleroma/web/activity_pub/activity_pub/streaming.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ActivityPub.Streaming do diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 8d9b69cc7..eb9e119f7 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ActivityPubController do diff --git a/lib/pleroma/web/activity_pub/builder.ex b/lib/pleroma/web/activity_pub/builder.ex index 74ddc2506..f56bfc600 100644 --- a/lib/pleroma/web/activity_pub/builder.ex +++ b/lib/pleroma/web/activity_pub/builder.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Builder do diff --git a/lib/pleroma/web/activity_pub/internal_fetch_actor.ex b/lib/pleroma/web/activity_pub/internal_fetch_actor.ex index c80272b8f..ca76071e5 100644 --- a/lib/pleroma/web/activity_pub/internal_fetch_actor.ex +++ b/lib/pleroma/web/activity_pub/internal_fetch_actor.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.InternalFetchActor do diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index 02fdee5fc..ef5a09a93 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF do diff --git a/lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex b/lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex index 655a2ced0..fc347236e 100644 --- a/lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/activity_expiration_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex index b96388489..b8bfdc3ce 100644 --- a/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/anti_followbot_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex b/lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex index b22464111..40b19c3ab 100644 --- a/lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/anti_link_spam_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/drop_policy.ex b/lib/pleroma/web/activity_pub/mrf/drop_policy.ex index 5ab9844ff..378175205 100644 --- a/lib/pleroma/web/activity_pub/mrf/drop_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/drop_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.DropPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex b/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex index c8c40c702..2d3a10889 100644 --- a/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex +++ b/lib/pleroma/web/activity_pub/mrf/ensure_re_prepended.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.EnsureRePrepended do diff --git a/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex b/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex index ea9c3d3f5..51dbb1ad4 100644 --- a/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex index 3fd5c1e0a..768a669f3 100644 --- a/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex b/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex index ded0fe7f2..f91b51bcf 100644 --- a/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/keyword_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex b/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex index 816cc89bf..50d48edc8 100644 --- a/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/mention_policy.ex b/lib/pleroma/web/activity_pub/mrf/mention_policy.ex index 9c096712a..877277d4f 100644 --- a/lib/pleroma/web/activity_pub/mrf/mention_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/mention_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.MentionPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/no_op_policy.ex b/lib/pleroma/web/activity_pub/mrf/no_op_policy.ex index cc2ac9d08..2ebc0674d 100644 --- a/lib/pleroma/web/activity_pub/mrf/no_op_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/no_op_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.NoOpPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex b/lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex index fc3475048..b658d7d41 100644 --- a/lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/no_placeholder_text_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex b/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex index e00575c2a..2ad3fde0b 100644 --- a/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex +++ b/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkup do diff --git a/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex b/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex index eb0481f20..aac24c0ec 100644 --- a/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/object_age_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex b/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex index 8e0069bc5..be95e38ec 100644 --- a/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex +++ b/lib/pleroma/web/activity_pub/mrf/pipeline_filtering.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.PipelineFiltering do diff --git a/lib/pleroma/web/activity_pub/mrf/reject_non_public.ex b/lib/pleroma/web/activity_pub/mrf/reject_non_public.ex index cd7665e31..47a43c6a2 100644 --- a/lib/pleroma/web/activity_pub/mrf/reject_non_public.ex +++ b/lib/pleroma/web/activity_pub/mrf/reject_non_public.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublic do diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex index 6cd91826d..bb3838d2c 100644 --- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex index 788f21261..4c5e33619 100644 --- a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex b/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex index 2ec45260a..86965d47b 100644 --- a/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/subchain_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex index febabda08..5739cee63 100644 --- a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.TagPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/user_allow_list_policy.ex b/lib/pleroma/web/activity_pub/mrf/user_allow_list_policy.ex index e9d0d0503..65b371bf3 100644 --- a/lib/pleroma/web/activity_pub/mrf/user_allow_list_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/user_allow_list_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.UserAllowListPolicy do diff --git a/lib/pleroma/web/activity_pub/mrf/vocabulary_policy.ex b/lib/pleroma/web/activity_pub/mrf/vocabulary_policy.ex index f325cb680..ce559a239 100644 --- a/lib/pleroma/web/activity_pub/mrf/vocabulary_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/vocabulary_policy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicy do diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 244753c02..297c19cc0 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidator do diff --git a/lib/pleroma/web/activity_pub/object_validator/validating.ex b/lib/pleroma/web/activity_pub/object_validator/validating.ex index 64c0c30c5..28e8d2498 100644 --- a/lib/pleroma/web/activity_pub/object_validator/validating.ex +++ b/lib/pleroma/web/activity_pub/object_validator/validating.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidator.Validating do diff --git a/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex b/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex index 179beda58..d31e780c3 100644 --- a/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptRejectValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex b/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex index 338957db8..b08a33e68 100644 --- a/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex b/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex index b9fbaf4f6..15e4413cd 100644 --- a/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnswerValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex index 5b7dad517..b0388ef3b 100644 --- a/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex index f96fd54bf..3175427ad 100644 --- a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex index 16973e5db..b3e738d8d 100644 --- a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/block_validator.ex b/lib/pleroma/web/activity_pub/object_validators/block_validator.ex index 1dde77198..c5f77bb76 100644 --- a/lib/pleroma/web/activity_pub/object_validators/block_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/block_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.BlockValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex b/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex index 6acd4a771..1189778f2 100644 --- a/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatMessageValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/common_fixes.ex b/lib/pleroma/web/activity_pub/object_validators/common_fixes.ex index b3638cfc7..5f2c633bc 100644 --- a/lib/pleroma/web/activity_pub/object_validators/common_fixes.ex +++ b/lib/pleroma/web/activity_pub/object_validators/common_fixes.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes do diff --git a/lib/pleroma/web/activity_pub/object_validators/common_validations.ex b/lib/pleroma/web/activity_pub/object_validators/common_validations.ex index 603d87b8e..f5f87ca5d 100644 --- a/lib/pleroma/web/activity_pub/object_validators/common_validations.ex +++ b/lib/pleroma/web/activity_pub/object_validators/common_validations.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations do diff --git a/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex b/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex index 7269f9ff0..8384c16a7 100644 --- a/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only # NOTES diff --git a/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex b/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex index 422ee07be..bf56a918c 100644 --- a/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only # Code based on CreateChatMessageValidator diff --git a/lib/pleroma/web/activity_pub/object_validators/create_note_validator.ex b/lib/pleroma/web/activity_pub/object_validators/create_note_validator.ex index 9b9743c4a..a85a0298c 100644 --- a/lib/pleroma/web/activity_pub/object_validators/create_note_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/create_note_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.CreateNoteValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex b/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex index 2634e8d4d..fc1a79a72 100644 --- a/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.DeleteValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex index 336c92d35..1906e597e 100644 --- a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex index 0b4c99dc0..2e26726f8 100644 --- a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.EventValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex b/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex index ca2724616..6e428bacc 100644 --- a/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.FollowValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/like_validator.ex b/lib/pleroma/web/activity_pub/object_validators/like_validator.ex index 493e4c247..30c40b238 100644 --- a/lib/pleroma/web/activity_pub/object_validators/like_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/like_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/question_options_validator.ex b/lib/pleroma/web/activity_pub/object_validators/question_options_validator.ex index 478b3b5cf..ddcd1be7c 100644 --- a/lib/pleroma/web/activity_pub/object_validators/question_options_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/question_options_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/question_validator.ex b/lib/pleroma/web/activity_pub/object_validators/question_validator.ex index 9310485dc..6b746c997 100644 --- a/lib/pleroma/web/activity_pub/object_validators/question_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/question_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex b/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex index 8cae94467..783a79ddb 100644 --- a/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.UndoValidator do diff --git a/lib/pleroma/web/activity_pub/object_validators/update_validator.ex b/lib/pleroma/web/activity_pub/object_validators/update_validator.ex index b4ba5ede0..a66d41400 100644 --- a/lib/pleroma/web/activity_pub/object_validators/update_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/update_validator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateValidator do diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index 2715b94d4..195596f94 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Pipeline do diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex index dca28e5bd..b12b2fc24 100644 --- a/lib/pleroma/web/activity_pub/publisher.ex +++ b/lib/pleroma/web/activity_pub/publisher.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Publisher do diff --git a/lib/pleroma/web/activity_pub/relay.ex b/lib/pleroma/web/activity_pub/relay.ex index 6606e1780..6d60a074f 100644 --- a/lib/pleroma/web/activity_pub/relay.ex +++ b/lib/pleroma/web/activity_pub/relay.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Relay do diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 76287f274..0b9a9f0c5 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.SideEffects do diff --git a/lib/pleroma/web/activity_pub/side_effects/handling.ex b/lib/pleroma/web/activity_pub/side_effects/handling.ex index 9d64c0e47..a82305155 100644 --- a/lib/pleroma/web/activity_pub/side_effects/handling.ex +++ b/lib/pleroma/web/activity_pub/side_effects/handling.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.SideEffects.Handling do diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 99cdf91ab..4d9a5617e 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier do diff --git a/lib/pleroma/web/activity_pub/utils.ex b/lib/pleroma/web/activity_pub/utils.ex index ea1c3a04a..a4dc469dc 100644 --- a/lib/pleroma/web/activity_pub/utils.ex +++ b/lib/pleroma/web/activity_pub/utils.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Utils do diff --git a/lib/pleroma/web/activity_pub/views/object_view.ex b/lib/pleroma/web/activity_pub/views/object_view.ex index 44bc5621b..8a3e4d77b 100644 --- a/lib/pleroma/web/activity_pub/views/object_view.ex +++ b/lib/pleroma/web/activity_pub/views/object_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectView do diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index 241224b57..8adc9878a 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.UserView do diff --git a/lib/pleroma/web/activity_pub/visibility.ex b/lib/pleroma/web/activity_pub/visibility.ex index 2cb5a2bd0..6ef59e93f 100644 --- a/lib/pleroma/web/activity_pub/visibility.ex +++ b/lib/pleroma/web/activity_pub/visibility.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Visibility do 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 1c7c26d98..709c863ec 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.AdminAPIController do diff --git a/lib/pleroma/web/admin_api/controllers/chat_controller.ex b/lib/pleroma/web/admin_api/controllers/chat_controller.ex index af8ff8292..3761a588a 100644 --- a/lib/pleroma/web/admin_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/chat_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ChatController do diff --git a/lib/pleroma/web/admin_api/controllers/config_controller.ex b/lib/pleroma/web/admin_api/controllers/config_controller.ex index 5d155af3d..7872fe2d8 100644 --- a/lib/pleroma/web/admin_api/controllers/config_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/config_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ConfigController do diff --git a/lib/pleroma/web/admin_api/controllers/fallback_controller.ex b/lib/pleroma/web/admin_api/controllers/fallback_controller.ex index 34d90db07..45d8815b5 100644 --- a/lib/pleroma/web/admin_api/controllers/fallback_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/fallback_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.FallbackController do diff --git a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex index fac3522b8..20472a55e 100644 --- a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.FrontendController do diff --git a/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex b/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex index 37dbfeb72..ef00d3417 100644 --- a/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.InstanceDocumentController do diff --git a/lib/pleroma/web/admin_api/controllers/invite_controller.ex b/lib/pleroma/web/admin_api/controllers/invite_controller.ex index 6a9b4038a..3f233a0c4 100644 --- a/lib/pleroma/web/admin_api/controllers/invite_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/invite_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.InviteController do diff --git a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex index 2f712fb8c..3564738af 100644 --- a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.MediaProxyCacheController do diff --git a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex index 116a05a4d..2bd2b3644 100644 --- a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.OAuthAppController do diff --git a/lib/pleroma/web/admin_api/controllers/relay_controller.ex b/lib/pleroma/web/admin_api/controllers/relay_controller.ex index 611388447..18443e74e 100644 --- a/lib/pleroma/web/admin_api/controllers/relay_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/relay_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.RelayController do diff --git a/lib/pleroma/web/admin_api/controllers/report_controller.ex b/lib/pleroma/web/admin_api/controllers/report_controller.ex index cc77cbfdf..abc068a3f 100644 --- a/lib/pleroma/web/admin_api/controllers/report_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/report_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ReportController do diff --git a/lib/pleroma/web/admin_api/controllers/status_controller.ex b/lib/pleroma/web/admin_api/controllers/status_controller.ex index 2bb437cfe..903badec0 100644 --- a/lib/pleroma/web/admin_api/controllers/status_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/status_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.StatusController do diff --git a/lib/pleroma/web/admin_api/controllers/user_controller.ex b/lib/pleroma/web/admin_api/controllers/user_controller.ex index a2a1c875d..fa710c7ec 100644 --- a/lib/pleroma/web/admin_api/controllers/user_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/user_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.UserController do diff --git a/lib/pleroma/web/admin_api/report.ex b/lib/pleroma/web/admin_api/report.ex index 8660d6520..259068f04 100644 --- a/lib/pleroma/web/admin_api/report.ex +++ b/lib/pleroma/web/admin_api/report.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.Report do diff --git a/lib/pleroma/web/admin_api/search.ex b/lib/pleroma/web/admin_api/search.ex index 0bfb8f022..eeeebdf4e 100644 --- a/lib/pleroma/web/admin_api/search.ex +++ b/lib/pleroma/web/admin_api/search.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.Search do diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex index ebf90b91b..37188bfeb 100644 --- a/lib/pleroma/web/admin_api/views/account_view.ex +++ b/lib/pleroma/web/admin_api/views/account_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.AccountView do diff --git a/lib/pleroma/web/admin_api/views/chat_view.ex b/lib/pleroma/web/admin_api/views/chat_view.ex index 847df1423..2a2015ad1 100644 --- a/lib/pleroma/web/admin_api/views/chat_view.ex +++ b/lib/pleroma/web/admin_api/views/chat_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ChatView do diff --git a/lib/pleroma/web/admin_api/views/config_view.ex b/lib/pleroma/web/admin_api/views/config_view.ex index d2d8b5907..d29b4963d 100644 --- a/lib/pleroma/web/admin_api/views/config_view.ex +++ b/lib/pleroma/web/admin_api/views/config_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ConfigView do diff --git a/lib/pleroma/web/admin_api/views/frontend_view.ex b/lib/pleroma/web/admin_api/views/frontend_view.ex index 374841d0b..a3933a57d 100644 --- a/lib/pleroma/web/admin_api/views/frontend_view.ex +++ b/lib/pleroma/web/admin_api/views/frontend_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.FrontendView do diff --git a/lib/pleroma/web/admin_api/views/invite_view.ex b/lib/pleroma/web/admin_api/views/invite_view.ex index f93cb6916..c7e307bda 100644 --- a/lib/pleroma/web/admin_api/views/invite_view.ex +++ b/lib/pleroma/web/admin_api/views/invite_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.InviteView do diff --git a/lib/pleroma/web/admin_api/views/media_proxy_cache_view.ex b/lib/pleroma/web/admin_api/views/media_proxy_cache_view.ex index a803bda0b..1ec123048 100644 --- a/lib/pleroma/web/admin_api/views/media_proxy_cache_view.ex +++ b/lib/pleroma/web/admin_api/views/media_proxy_cache_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.MediaProxyCacheView do diff --git a/lib/pleroma/web/admin_api/views/moderation_log_view.ex b/lib/pleroma/web/admin_api/views/moderation_log_view.ex index 3fa778b0a..b3a9efff3 100644 --- a/lib/pleroma/web/admin_api/views/moderation_log_view.ex +++ b/lib/pleroma/web/admin_api/views/moderation_log_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ModerationLogView do diff --git a/lib/pleroma/web/admin_api/views/report_view.ex b/lib/pleroma/web/admin_api/views/report_view.ex index da949e306..1c67b2458 100644 --- a/lib/pleroma/web/admin_api/views/report_view.ex +++ b/lib/pleroma/web/admin_api/views/report_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ReportView do diff --git a/lib/pleroma/web/admin_api/views/status_view.ex b/lib/pleroma/web/admin_api/views/status_view.ex index 6042a22b6..361fa5b0d 100644 --- a/lib/pleroma/web/admin_api/views/status_view.ex +++ b/lib/pleroma/web/admin_api/views/status_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.StatusView do diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index 93a5273e3..064558597 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec do diff --git a/lib/pleroma/web/api_spec/cast_and_validate.ex b/lib/pleroma/web/api_spec/cast_and_validate.ex index 6d1a7ebbc..a3da856ff 100644 --- a/lib/pleroma/web/api_spec/cast_and_validate.ex +++ b/lib/pleroma/web/api_spec/cast_and_validate.ex @@ -1,6 +1,6 @@ # Pleroma: A lightweight social networking server # Copyright © 2019-2020 Moxley Stratton, Mike Buhot , MPL-2.0 -# Copyright © 2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.CastAndValidate do diff --git a/lib/pleroma/web/api_spec/helpers.ex b/lib/pleroma/web/api_spec/helpers.ex index 34de2ed57..6babe0b28 100644 --- a/lib/pleroma/web/api_spec/helpers.ex +++ b/lib/pleroma/web/api_spec/helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Helpers do diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index bd3a73c11..80acee2f7 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.AccountOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex b/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex index d3e5dfc1c..8062da987 100644 --- a/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.ChatOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex index 3a8380797..323539ca5 100644 --- a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.ConfigOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex b/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex index 96d4cdee7..05e2fe2be 100644 --- a/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.FrontendOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex b/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex index a120ff4e8..0e1fdec08 100644 --- a/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.InstanceDocumentOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex b/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex index 801024d75..0ce7bcc45 100644 --- a/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.InviteOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex index ab45d6633..e16356a47 100644 --- a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.MediaProxyCacheOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex index a75f3e622..f1b32343d 100644 --- a/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.OAuthAppOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex index f754bb9f5..7a17072e1 100644 --- a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.RelayOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index 3bb7ec49e..526698fc1 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.ReportOperation do diff --git a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex index c105838a4..a2319bacc 100644 --- a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Admin.StatusOperation do diff --git a/lib/pleroma/web/api_spec/operations/app_operation.ex b/lib/pleroma/web/api_spec/operations/app_operation.ex index ae01cbbec..7587e488e 100644 --- a/lib/pleroma/web/api_spec/operations/app_operation.ex +++ b/lib/pleroma/web/api_spec/operations/app_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.AppOperation do diff --git a/lib/pleroma/web/api_spec/operations/chat_operation.ex b/lib/pleroma/web/api_spec/operations/chat_operation.ex index 560b81f17..a90bc4cc9 100644 --- a/lib/pleroma/web/api_spec/operations/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/chat_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.ChatOperation do diff --git a/lib/pleroma/web/api_spec/operations/conversation_operation.ex b/lib/pleroma/web/api_spec/operations/conversation_operation.ex index 475468893..15fc3d66d 100644 --- a/lib/pleroma/web/api_spec/operations/conversation_operation.ex +++ b/lib/pleroma/web/api_spec/operations/conversation_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.ConversationOperation do diff --git a/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex b/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex index 5ff263ceb..541c1ff1b 100644 --- a/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex +++ b/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.CustomEmojiOperation do diff --git a/lib/pleroma/web/api_spec/operations/domain_block_operation.ex b/lib/pleroma/web/api_spec/operations/domain_block_operation.ex index 1e0da8209..2be54e359 100644 --- a/lib/pleroma/web/api_spec/operations/domain_block_operation.ex +++ b/lib/pleroma/web/api_spec/operations/domain_block_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.DomainBlockOperation do diff --git a/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex b/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex index 9d0e39fc7..e1aa7d4ca 100644 --- a/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex +++ b/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.EmojiReactionOperation do diff --git a/lib/pleroma/web/api_spec/operations/filter_operation.ex b/lib/pleroma/web/api_spec/operations/filter_operation.ex index 31e576f99..c5b0c035b 100644 --- a/lib/pleroma/web/api_spec/operations/filter_operation.ex +++ b/lib/pleroma/web/api_spec/operations/filter_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.FilterOperation do diff --git a/lib/pleroma/web/api_spec/operations/follow_request_operation.ex b/lib/pleroma/web/api_spec/operations/follow_request_operation.ex index ac4aee6da..fc849bcb2 100644 --- a/lib/pleroma/web/api_spec/operations/follow_request_operation.ex +++ b/lib/pleroma/web/api_spec/operations/follow_request_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.FollowRequestOperation do diff --git a/lib/pleroma/web/api_spec/operations/instance_operation.ex b/lib/pleroma/web/api_spec/operations/instance_operation.ex index bf39ae643..8ca82b95c 100644 --- a/lib/pleroma/web/api_spec/operations/instance_operation.ex +++ b/lib/pleroma/web/api_spec/operations/instance_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.InstanceOperation do diff --git a/lib/pleroma/web/api_spec/operations/list_operation.ex b/lib/pleroma/web/api_spec/operations/list_operation.ex index f6e73968a..62a67cc20 100644 --- a/lib/pleroma/web/api_spec/operations/list_operation.ex +++ b/lib/pleroma/web/api_spec/operations/list_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.ListOperation do diff --git a/lib/pleroma/web/api_spec/operations/marker_operation.ex b/lib/pleroma/web/api_spec/operations/marker_operation.ex index 714ef1f99..c5ff5984b 100644 --- a/lib/pleroma/web/api_spec/operations/marker_operation.ex +++ b/lib/pleroma/web/api_spec/operations/marker_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.MarkerOperation do diff --git a/lib/pleroma/web/api_spec/operations/media_operation.ex b/lib/pleroma/web/api_spec/operations/media_operation.ex index d9c3c42db..7de0d7da5 100644 --- a/lib/pleroma/web/api_spec/operations/media_operation.ex +++ b/lib/pleroma/web/api_spec/operations/media_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.MediaOperation do diff --git a/lib/pleroma/web/api_spec/operations/notification_operation.ex b/lib/pleroma/web/api_spec/operations/notification_operation.ex index 264a530d2..b7e391264 100644 --- a/lib/pleroma/web/api_spec/operations/notification_operation.ex +++ b/lib/pleroma/web/api_spec/operations/notification_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.NotificationOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex index 97836b2eb..caa13afee 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaAccountOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_backup_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_backup_operation.ex index 6993794db..c78e9780f 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_backup_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_backup_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaBackupOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex index e885eab20..7752f4676 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaConversationOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex index 747f17e7f..83981f4e7 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaEmojiFileOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex index e576ccbad..ceff3f67a 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaEmojiPackOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex index 2c455b0df..c9519f769 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaInstancesOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex index 8c5f37ea6..226d95054 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaMascotOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex index b0c8db863..c26fb2736 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaNotificationOperation do diff --git a/lib/pleroma/web/api_spec/operations/pleroma_scrobble_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_scrobble_operation.ex index 85a22aa0b..6a909fc85 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_scrobble_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_scrobble_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PleromaScrobbleOperation do diff --git a/lib/pleroma/web/api_spec/operations/poll_operation.ex b/lib/pleroma/web/api_spec/operations/poll_operation.ex index e15c7dc95..0d1c8d099 100644 --- a/lib/pleroma/web/api_spec/operations/poll_operation.ex +++ b/lib/pleroma/web/api_spec/operations/poll_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.PollOperation do diff --git a/lib/pleroma/web/api_spec/operations/report_operation.ex b/lib/pleroma/web/api_spec/operations/report_operation.ex index b9b4c4f79..792d5cb51 100644 --- a/lib/pleroma/web/api_spec/operations/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/report_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.ReportOperation do diff --git a/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex b/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex index fe675a923..873ed3a80 100644 --- a/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex +++ b/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.ScheduledActivityOperation do diff --git a/lib/pleroma/web/api_spec/operations/search_operation.ex b/lib/pleroma/web/api_spec/operations/search_operation.ex index 169c36d87..ff4fd0027 100644 --- a/lib/pleroma/web/api_spec/operations/search_operation.ex +++ b/lib/pleroma/web/api_spec/operations/search_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.SearchOperation do diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index 4ab918d83..765fbd67b 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.StatusOperation do diff --git a/lib/pleroma/web/api_spec/operations/subscription_operation.ex b/lib/pleroma/web/api_spec/operations/subscription_operation.ex index 67c7ea8f3..1374a6ff4 100644 --- a/lib/pleroma/web/api_spec/operations/subscription_operation.ex +++ b/lib/pleroma/web/api_spec/operations/subscription_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.SubscriptionOperation do diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index 95720df9f..e1ebdab38 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.TimelineOperation do diff --git a/lib/pleroma/web/api_spec/operations/user_import_operation.ex b/lib/pleroma/web/api_spec/operations/user_import_operation.ex index a50314fb7..859404ded 100644 --- a/lib/pleroma/web/api_spec/operations/user_import_operation.ex +++ b/lib/pleroma/web/api_spec/operations/user_import_operation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.UserImportOperation do diff --git a/lib/pleroma/web/api_spec/render_error.ex b/lib/pleroma/web/api_spec/render_error.ex index d476b8ef3..e501a6be4 100644 --- a/lib/pleroma/web/api_spec/render_error.ex +++ b/lib/pleroma/web/api_spec/render_error.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.RenderError do diff --git a/lib/pleroma/web/api_spec/schemas/account.ex b/lib/pleroma/web/api_spec/schemas/account.ex index 70437003c..35158c140 100644 --- a/lib/pleroma/web/api_spec/schemas/account.ex +++ b/lib/pleroma/web/api_spec/schemas/account.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Account do diff --git a/lib/pleroma/web/api_spec/schemas/account_field.ex b/lib/pleroma/web/api_spec/schemas/account_field.ex index fa97073a0..7c4f94001 100644 --- a/lib/pleroma/web/api_spec/schemas/account_field.ex +++ b/lib/pleroma/web/api_spec/schemas/account_field.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.AccountField do diff --git a/lib/pleroma/web/api_spec/schemas/account_relationship.ex b/lib/pleroma/web/api_spec/schemas/account_relationship.ex index 8b982669e..2cda19631 100644 --- a/lib/pleroma/web/api_spec/schemas/account_relationship.ex +++ b/lib/pleroma/web/api_spec/schemas/account_relationship.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationship do diff --git a/lib/pleroma/web/api_spec/schemas/actor_type.ex b/lib/pleroma/web/api_spec/schemas/actor_type.ex index ac9b46678..1336640a1 100644 --- a/lib/pleroma/web/api_spec/schemas/actor_type.ex +++ b/lib/pleroma/web/api_spec/schemas/actor_type.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.ActorType do diff --git a/lib/pleroma/web/api_spec/schemas/api_error.ex b/lib/pleroma/web/api_spec/schemas/api_error.ex index 5815df94c..0d6d0b75c 100644 --- a/lib/pleroma/web/api_spec/schemas/api_error.ex +++ b/lib/pleroma/web/api_spec/schemas/api_error.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.ApiError do diff --git a/lib/pleroma/web/api_spec/schemas/attachment.ex b/lib/pleroma/web/api_spec/schemas/attachment.ex index c6edf6d36..ca3659c93 100644 --- a/lib/pleroma/web/api_spec/schemas/attachment.ex +++ b/lib/pleroma/web/api_spec/schemas/attachment.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Attachment do diff --git a/lib/pleroma/web/api_spec/schemas/boolean_like.ex b/lib/pleroma/web/api_spec/schemas/boolean_like.ex index f3bfb74da..eb001c5bb 100644 --- a/lib/pleroma/web/api_spec/schemas/boolean_like.ex +++ b/lib/pleroma/web/api_spec/schemas/boolean_like.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.BooleanLike do diff --git a/lib/pleroma/web/api_spec/schemas/chat.ex b/lib/pleroma/web/api_spec/schemas/chat.ex index 65f908e33..b3912c173 100644 --- a/lib/pleroma/web/api_spec/schemas/chat.ex +++ b/lib/pleroma/web/api_spec/schemas/chat.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Chat do diff --git a/lib/pleroma/web/api_spec/schemas/chat_message.ex b/lib/pleroma/web/api_spec/schemas/chat_message.ex index 9d2799618..6986b9c17 100644 --- a/lib/pleroma/web/api_spec/schemas/chat_message.ex +++ b/lib/pleroma/web/api_spec/schemas/chat_message.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.ChatMessage do diff --git a/lib/pleroma/web/api_spec/schemas/conversation.ex b/lib/pleroma/web/api_spec/schemas/conversation.ex index d8ff5ba26..7c609965f 100644 --- a/lib/pleroma/web/api_spec/schemas/conversation.ex +++ b/lib/pleroma/web/api_spec/schemas/conversation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Conversation do diff --git a/lib/pleroma/web/api_spec/schemas/emoji.ex b/lib/pleroma/web/api_spec/schemas/emoji.ex index 26f35e648..ceb3c7186 100644 --- a/lib/pleroma/web/api_spec/schemas/emoji.ex +++ b/lib/pleroma/web/api_spec/schemas/emoji.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Emoji do diff --git a/lib/pleroma/web/api_spec/schemas/flake_id.ex b/lib/pleroma/web/api_spec/schemas/flake_id.ex index 3b5f6477a..45314d53a 100644 --- a/lib/pleroma/web/api_spec/schemas/flake_id.ex +++ b/lib/pleroma/web/api_spec/schemas/flake_id.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.FlakeID do diff --git a/lib/pleroma/web/api_spec/schemas/list.ex b/lib/pleroma/web/api_spec/schemas/list.ex index b7d1685c9..90f5ec987 100644 --- a/lib/pleroma/web/api_spec/schemas/list.ex +++ b/lib/pleroma/web/api_spec/schemas/list.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.List do diff --git a/lib/pleroma/web/api_spec/schemas/poll.ex b/lib/pleroma/web/api_spec/schemas/poll.ex index 0dfa60b97..943ad8bd4 100644 --- a/lib/pleroma/web/api_spec/schemas/poll.ex +++ b/lib/pleroma/web/api_spec/schemas/poll.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Poll do diff --git a/lib/pleroma/web/api_spec/schemas/push_subscription.ex b/lib/pleroma/web/api_spec/schemas/push_subscription.ex index cc91b95b8..20fe9f304 100644 --- a/lib/pleroma/web/api_spec/schemas/push_subscription.ex +++ b/lib/pleroma/web/api_spec/schemas/push_subscription.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.PushSubscription do diff --git a/lib/pleroma/web/api_spec/schemas/scheduled_status.ex b/lib/pleroma/web/api_spec/schemas/scheduled_status.ex index addefa9d3..dd0d9aa8f 100644 --- a/lib/pleroma/web/api_spec/schemas/scheduled_status.ex +++ b/lib/pleroma/web/api_spec/schemas/scheduled_status.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index e6890df2d..3f5870907 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Status do diff --git a/lib/pleroma/web/api_spec/schemas/tag.ex b/lib/pleroma/web/api_spec/schemas/tag.ex index e693fb83e..657b675e5 100644 --- a/lib/pleroma/web/api_spec/schemas/tag.ex +++ b/lib/pleroma/web/api_spec/schemas/tag.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.Tag do diff --git a/lib/pleroma/web/api_spec/schemas/visibility_scope.ex b/lib/pleroma/web/api_spec/schemas/visibility_scope.ex index 633269a92..25a08a0b2 100644 --- a/lib/pleroma/web/api_spec/schemas/visibility_scope.ex +++ b/lib/pleroma/web/api_spec/schemas/visibility_scope.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.VisibilityScope do diff --git a/lib/pleroma/web/auth/authenticator.ex b/lib/pleroma/web/auth/authenticator.ex index b4db312fb..84741ee11 100644 --- a/lib/pleroma/web/auth/authenticator.ex +++ b/lib/pleroma/web/auth/authenticator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.Authenticator do diff --git a/lib/pleroma/web/auth/ldap_authenticator.ex b/lib/pleroma/web/auth/ldap_authenticator.ex index 402ab428b..17e08a2a6 100644 --- a/lib/pleroma/web/auth/ldap_authenticator.ex +++ b/lib/pleroma/web/auth/ldap_authenticator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.LDAPAuthenticator do diff --git a/lib/pleroma/web/auth/pleroma_authenticator.ex b/lib/pleroma/web/auth/pleroma_authenticator.ex index d6d2a8d06..a2121e6a7 100644 --- a/lib/pleroma/web/auth/pleroma_authenticator.ex +++ b/lib/pleroma/web/auth/pleroma_authenticator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.PleromaAuthenticator do diff --git a/lib/pleroma/web/auth/totp_authenticator.ex b/lib/pleroma/web/auth/totp_authenticator.ex index edc9871ea..5947cd8c9 100644 --- a/lib/pleroma/web/auth/totp_authenticator.ex +++ b/lib/pleroma/web/auth/totp_authenticator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.TOTPAuthenticator do diff --git a/lib/pleroma/web/channels/user_socket.ex b/lib/pleroma/web/channels/user_socket.ex index 306ef1916..1c09b6768 100644 --- a/lib/pleroma/web/channels/user_socket.ex +++ b/lib/pleroma/web/channels/user_socket.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.UserSocket do diff --git a/lib/pleroma/web/chat_channel.ex b/lib/pleroma/web/chat_channel.ex index 3b1469c19..4008129e9 100644 --- a/lib/pleroma/web/chat_channel.ex +++ b/lib/pleroma/web/chat_channel.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ChatChannel do diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 87343df75..b003e30c7 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.CommonAPI do diff --git a/lib/pleroma/web/common_api/activity_draft.ex b/lib/pleroma/web/common_api/activity_draft.ex index aa2616d9e..fb059c27c 100644 --- a/lib/pleroma/web/common_api/activity_draft.ex +++ b/lib/pleroma/web/common_api/activity_draft.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.CommonAPI.ActivityDraft do diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index ddbdb3376..9587dfa25 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.CommonAPI.Utils do diff --git a/lib/pleroma/web/controller_helper.ex b/lib/pleroma/web/controller_helper.ex index 0d112a932..61d65e7a3 100644 --- a/lib/pleroma/web/controller_helper.ex +++ b/lib/pleroma/web/controller_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ControllerHelper do diff --git a/lib/pleroma/web/embed_controller.ex b/lib/pleroma/web/embed_controller.ex index f8623d4d6..c7912bb1f 100644 --- a/lib/pleroma/web/embed_controller.ex +++ b/lib/pleroma/web/embed_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.EmbedController do diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index f26542e88..94703cd05 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Endpoint do diff --git a/lib/pleroma/web/fallback/redirect_controller.ex b/lib/pleroma/web/fallback/redirect_controller.ex index 1ac1319f8..5fca290e5 100644 --- a/lib/pleroma/web/fallback/redirect_controller.ex +++ b/lib/pleroma/web/fallback/redirect_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Fallback.RedirectController do diff --git a/lib/pleroma/web/federator.ex b/lib/pleroma/web/federator.ex index 658d20954..f5ef76d32 100644 --- a/lib/pleroma/web/federator.ex +++ b/lib/pleroma/web/federator.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Federator do diff --git a/lib/pleroma/web/federator/publisher.ex b/lib/pleroma/web/federator/publisher.ex index ad0201361..b7ee56803 100644 --- a/lib/pleroma/web/federator/publisher.ex +++ b/lib/pleroma/web/federator/publisher.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Federator.Publisher do diff --git a/lib/pleroma/web/federator/publishing.ex b/lib/pleroma/web/federator/publishing.ex index d6fba8f24..fe7805be9 100644 --- a/lib/pleroma/web/federator/publishing.ex +++ b/lib/pleroma/web/federator/publishing.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Federator.Publishing do diff --git a/lib/pleroma/web/feed/feed_view.ex b/lib/pleroma/web/feed/feed_view.ex index bc0114e26..df97d2f46 100644 --- a/lib/pleroma/web/feed/feed_view.ex +++ b/lib/pleroma/web/feed/feed_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Feed.FeedView do diff --git a/lib/pleroma/web/feed/tag_controller.ex b/lib/pleroma/web/feed/tag_controller.ex index 218cdbdf3..ef9293a55 100644 --- a/lib/pleroma/web/feed/tag_controller.ex +++ b/lib/pleroma/web/feed/tag_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Feed.TagController do diff --git a/lib/pleroma/web/feed/user_controller.ex b/lib/pleroma/web/feed/user_controller.ex index a5013d2c0..58d35da1e 100644 --- a/lib/pleroma/web/feed/user_controller.ex +++ b/lib/pleroma/web/feed/user_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Feed.UserController do diff --git a/lib/pleroma/web/gettext.ex b/lib/pleroma/web/gettext.ex index 0adf428ec..c0ca4d0e9 100644 --- a/lib/pleroma/web/gettext.ex +++ b/lib/pleroma/web/gettext.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Gettext do diff --git a/lib/pleroma/web/instance_document.ex b/lib/pleroma/web/instance_document.ex index df5caebf0..a33bf605b 100644 --- a/lib/pleroma/web/instance_document.ex +++ b/lib/pleroma/web/instance_document.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.InstanceDocument do diff --git a/lib/pleroma/web/mailer/subscription_controller.ex b/lib/pleroma/web/mailer/subscription_controller.ex index ace44afd1..f89abe46a 100644 --- a/lib/pleroma/web/mailer/subscription_controller.ex +++ b/lib/pleroma/web/mailer/subscription_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Mailer.SubscriptionController do diff --git a/lib/pleroma/web/masto_fe_controller.ex b/lib/pleroma/web/masto_fe_controller.ex index 20279ff45..e788ab37a 100644 --- a/lib/pleroma/web/masto_fe_controller.ex +++ b/lib/pleroma/web/masto_fe_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastoFEController do diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index 3951d10ac..d277aeca5 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AccountController do diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex index 143dcf80c..a7e4d93f5 100644 --- a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AppController do diff --git a/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex b/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex index 93d057a79..eb6639fc5 100644 --- a/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/auth_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AuthController do diff --git a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex index 61347d8db..4526d3c7a 100644 --- a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ConversationController do diff --git a/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex index 872cb1f4d..d7e18dc92 100644 --- a/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.CustomEmojiController do diff --git a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex index 503bd7d5f..30300307d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.DomainBlockController do diff --git a/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex b/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex index 8af557b61..d25f84837 100644 --- a/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.FallbackController do diff --git a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex index c71a34b15..c8b4a3095 100644 --- a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.FilterController do diff --git a/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex b/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex index f8cd7fa9f..63d0e2c35 100644 --- a/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.FollowRequestController do diff --git a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex index 07a32491a..267d0f03b 100644 --- a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.InstanceController do diff --git a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex index f6b51bf02..b7b41f449 100644 --- a/lib/pleroma/web/mastodon_api/controllers/list_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/list_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ListController do diff --git a/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex b/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex index 0628b2b49..c745f3493 100644 --- a/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/marker_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MarkerController do diff --git a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex index 9cf682c7b..a1bcc91d9 100644 --- a/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do diff --git a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex index 161193134..d6949ed80 100644 --- a/lib/pleroma/web/mastodon_api/controllers/media_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/media_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MediaController do diff --git a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex index c3c8606f2..647ba661e 100644 --- a/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/notification_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.NotificationController do diff --git a/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex b/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex index e26ec7136..f44ff997d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/poll_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.PollController do diff --git a/lib/pleroma/web/mastodon_api/controllers/report_controller.ex b/lib/pleroma/web/mastodon_api/controllers/report_controller.ex index 156544f40..03d9a4f4f 100644 --- a/lib/pleroma/web/mastodon_api/controllers/report_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/report_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ReportController do diff --git a/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex b/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex index 322a46497..3b7a0c788 100644 --- a/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ScheduledActivityController do diff --git a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex index 0043c3a56..af93e453d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/search_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/search_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SearchController do diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index acca9d3b2..4cf2ee35c 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.StatusController do diff --git a/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex b/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex index 20138908c..fcb3d4829 100644 --- a/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SubscriptionController do diff --git a/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex b/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex index 5765271cf..01e122dd9 100644 --- a/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SuggestionController do diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 852bd0695..08e6f23b9 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.TimelineController do diff --git a/lib/pleroma/web/mastodon_api/mastodon_api.ex b/lib/pleroma/web/mastodon_api/mastodon_api.ex index 694bf5ca8..71479550e 100644 --- a/lib/pleroma/web/mastodon_api/mastodon_api.ex +++ b/lib/pleroma/web/mastodon_api/mastodon_api.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MastodonAPI do diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 948a05a6d..2768f0291 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AccountView do diff --git a/lib/pleroma/web/mastodon_api/views/app_view.ex b/lib/pleroma/web/mastodon_api/views/app_view.ex index e44272c6f..3d7131e09 100644 --- a/lib/pleroma/web/mastodon_api/views/app_view.ex +++ b/lib/pleroma/web/mastodon_api/views/app_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AppView do diff --git a/lib/pleroma/web/mastodon_api/views/conversation_view.ex b/lib/pleroma/web/mastodon_api/views/conversation_view.ex index 82fcff062..46b63b54b 100644 --- a/lib/pleroma/web/mastodon_api/views/conversation_view.ex +++ b/lib/pleroma/web/mastodon_api/views/conversation_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ConversationView do diff --git a/lib/pleroma/web/mastodon_api/views/custom_emoji_view.ex b/lib/pleroma/web/mastodon_api/views/custom_emoji_view.ex index 47a242b8e..40e314164 100644 --- a/lib/pleroma/web/mastodon_api/views/custom_emoji_view.ex +++ b/lib/pleroma/web/mastodon_api/views/custom_emoji_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.CustomEmojiView do diff --git a/lib/pleroma/web/mastodon_api/views/filter_view.ex b/lib/pleroma/web/mastodon_api/views/filter_view.ex index c37f624e0..8e8798c1e 100644 --- a/lib/pleroma/web/mastodon_api/views/filter_view.ex +++ b/lib/pleroma/web/mastodon_api/views/filter_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.FilterView do diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index c5aca5506..1edbdbe11 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.InstanceView do diff --git a/lib/pleroma/web/mastodon_api/views/list_view.ex b/lib/pleroma/web/mastodon_api/views/list_view.ex index 580596b64..931e77769 100644 --- a/lib/pleroma/web/mastodon_api/views/list_view.ex +++ b/lib/pleroma/web/mastodon_api/views/list_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ListView do diff --git a/lib/pleroma/web/mastodon_api/views/marker_view.ex b/lib/pleroma/web/mastodon_api/views/marker_view.ex index 21d535d54..0c1880935 100644 --- a/lib/pleroma/web/mastodon_api/views/marker_view.ex +++ b/lib/pleroma/web/mastodon_api/views/marker_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MarkerView do diff --git a/lib/pleroma/web/mastodon_api/views/notification_view.ex b/lib/pleroma/web/mastodon_api/views/notification_view.ex index 9ec0f311d..df9bedfed 100644 --- a/lib/pleroma/web/mastodon_api/views/notification_view.ex +++ b/lib/pleroma/web/mastodon_api/views/notification_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.NotificationView do diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex index 4101f21d0..d6b544037 100644 --- a/lib/pleroma/web/mastodon_api/views/poll_view.ex +++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.PollView do diff --git a/lib/pleroma/web/mastodon_api/views/report_view.ex b/lib/pleroma/web/mastodon_api/views/report_view.ex index 98cb581ef..0ff347ade 100644 --- a/lib/pleroma/web/mastodon_api/views/report_view.ex +++ b/lib/pleroma/web/mastodon_api/views/report_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ReportView do diff --git a/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex b/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex index 5b896bf3b..13774d237 100644 --- a/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex +++ b/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ScheduledActivityView do diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index b8a35cd38..cd1a85088 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.StatusView do diff --git a/lib/pleroma/web/mastodon_api/views/subscription_view.ex b/lib/pleroma/web/mastodon_api/views/subscription_view.ex index 7c67cc924..a07d23512 100644 --- a/lib/pleroma/web/mastodon_api/views/subscription_view.ex +++ b/lib/pleroma/web/mastodon_api/views/subscription_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SubscriptionView do diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex index 439cdd716..0d1faffbd 100644 --- a/lib/pleroma/web/mastodon_api/websocket_handler.ex +++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index dcf3b0623..27f337138 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy do diff --git a/lib/pleroma/web/media_proxy/invalidation.ex b/lib/pleroma/web/media_proxy/invalidation.ex index 4f4340478..cb2db5ce9 100644 --- a/lib/pleroma/web/media_proxy/invalidation.ex +++ b/lib/pleroma/web/media_proxy/invalidation.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.Invalidation do diff --git a/lib/pleroma/web/media_proxy/invalidation/http.ex b/lib/pleroma/web/media_proxy/invalidation/http.ex index 0b0cde68c..0b2a45518 100644 --- a/lib/pleroma/web/media_proxy/invalidation/http.ex +++ b/lib/pleroma/web/media_proxy/invalidation/http.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.Invalidation.Http do diff --git a/lib/pleroma/web/media_proxy/invalidation/script.ex b/lib/pleroma/web/media_proxy/invalidation/script.ex index d32ffc50b..0f66c2fe3 100644 --- a/lib/pleroma/web/media_proxy/invalidation/script.ex +++ b/lib/pleroma/web/media_proxy/invalidation/script.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.Invalidation.Script do diff --git a/lib/pleroma/web/media_proxy/media_proxy_controller.ex b/lib/pleroma/web/media_proxy/media_proxy_controller.ex index 90651ed9b..c74eaaf93 100644 --- a/lib/pleroma/web/media_proxy/media_proxy_controller.ex +++ b/lib/pleroma/web/media_proxy/media_proxy_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.MediaProxyController do diff --git a/lib/pleroma/web/metadata.ex b/lib/pleroma/web/metadata.ex index 0f2d8d1e7..46ef00c08 100644 --- a/lib/pleroma/web/metadata.ex +++ b/lib/pleroma/web/metadata.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata do diff --git a/lib/pleroma/web/metadata/player_view.ex b/lib/pleroma/web/metadata/player_view.ex index 5a918532a..9be5e433d 100644 --- a/lib/pleroma/web/metadata/player_view.ex +++ b/lib/pleroma/web/metadata/player_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.PlayerView do diff --git a/lib/pleroma/web/metadata/providers/feed.ex b/lib/pleroma/web/metadata/providers/feed.ex index bd1459a17..d0ab5c19e 100644 --- a/lib/pleroma/web/metadata/providers/feed.ex +++ b/lib/pleroma/web/metadata/providers/feed.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.Feed do diff --git a/lib/pleroma/web/metadata/providers/open_graph.ex b/lib/pleroma/web/metadata/providers/open_graph.ex index bb1b23208..1687b2634 100644 --- a/lib/pleroma/web/metadata/providers/open_graph.ex +++ b/lib/pleroma/web/metadata/providers/open_graph.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.OpenGraph do diff --git a/lib/pleroma/web/metadata/providers/provider.ex b/lib/pleroma/web/metadata/providers/provider.ex index 767288f9c..c91d87c6d 100644 --- a/lib/pleroma/web/metadata/providers/provider.ex +++ b/lib/pleroma/web/metadata/providers/provider.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.Provider do diff --git a/lib/pleroma/web/metadata/providers/rel_me.ex b/lib/pleroma/web/metadata/providers/rel_me.ex index 8905c9c72..f013def51 100644 --- a/lib/pleroma/web/metadata/providers/rel_me.ex +++ b/lib/pleroma/web/metadata/providers/rel_me.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.RelMe do diff --git a/lib/pleroma/web/metadata/providers/restrict_indexing.ex b/lib/pleroma/web/metadata/providers/restrict_indexing.ex index a08a04b4a..aa6511610 100644 --- a/lib/pleroma/web/metadata/providers/restrict_indexing.ex +++ b/lib/pleroma/web/metadata/providers/restrict_indexing.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.RestrictIndexing do diff --git a/lib/pleroma/web/metadata/providers/twitter_card.ex b/lib/pleroma/web/metadata/providers/twitter_card.ex index df34b033f..58fc05cf9 100644 --- a/lib/pleroma/web/metadata/providers/twitter_card.ex +++ b/lib/pleroma/web/metadata/providers/twitter_card.ex @@ -1,6 +1,6 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.TwitterCard do diff --git a/lib/pleroma/web/metadata/utils.ex b/lib/pleroma/web/metadata/utils.ex index 8a206e019..de7195435 100644 --- a/lib/pleroma/web/metadata/utils.ex +++ b/lib/pleroma/web/metadata/utils.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Utils do diff --git a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex index 2a5c7c356..e7903dde8 100644 --- a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex +++ b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MongooseIM.MongooseIMController do diff --git a/lib/pleroma/web/nodeinfo/nodeinfo.ex b/lib/pleroma/web/nodeinfo/nodeinfo.ex index 47fa46376..6a0112d2a 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Nodeinfo.Nodeinfo do diff --git a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex index 8c7a9e565..bca94d236 100644 --- a/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex +++ b/lib/pleroma/web/nodeinfo/nodeinfo_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Nodeinfo.NodeinfoController do diff --git a/lib/pleroma/web/o_auth.ex b/lib/pleroma/web/o_auth.ex index 2f1b8708d..3bc1a6ad4 100644 --- a/lib/pleroma/web/o_auth.ex +++ b/lib/pleroma/web/o_auth.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth do diff --git a/lib/pleroma/web/o_auth/app.ex b/lib/pleroma/web/o_auth/app.ex index df99472e1..382750010 100644 --- a/lib/pleroma/web/o_auth/app.ex +++ b/lib/pleroma/web/o_auth/app.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.App do diff --git a/lib/pleroma/web/o_auth/authorization.ex b/lib/pleroma/web/o_auth/authorization.ex index e766dcada..e0ecb0f4f 100644 --- a/lib/pleroma/web/o_auth/authorization.ex +++ b/lib/pleroma/web/o_auth/authorization.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Authorization do diff --git a/lib/pleroma/web/o_auth/fallback_controller.ex b/lib/pleroma/web/o_auth/fallback_controller.ex index a89ced886..df68cbfc1 100644 --- a/lib/pleroma/web/o_auth/fallback_controller.ex +++ b/lib/pleroma/web/o_auth/fallback_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.FallbackController do diff --git a/lib/pleroma/web/o_auth/mfa_controller.ex b/lib/pleroma/web/o_auth/mfa_controller.ex index 5d5ec286a..b38b00213 100644 --- a/lib/pleroma/web/o_auth/mfa_controller.ex +++ b/lib/pleroma/web/o_auth/mfa_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.MFAController do diff --git a/lib/pleroma/web/o_auth/mfa_view.ex b/lib/pleroma/web/o_auth/mfa_view.ex index 5d87db268..3d473f29c 100644 --- a/lib/pleroma/web/o_auth/mfa_view.ex +++ b/lib/pleroma/web/o_auth/mfa_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.MFAView do diff --git a/lib/pleroma/web/o_auth/o_auth_controller.ex b/lib/pleroma/web/o_auth/o_auth_controller.ex index 6e3c7e1a1..215d97b3a 100644 --- a/lib/pleroma/web/o_auth/o_auth_controller.ex +++ b/lib/pleroma/web/o_auth/o_auth_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.OAuthController do diff --git a/lib/pleroma/web/o_auth/o_auth_view.ex b/lib/pleroma/web/o_auth/o_auth_view.ex index d22b2f7fe..281bbcc3c 100644 --- a/lib/pleroma/web/o_auth/o_auth_view.ex +++ b/lib/pleroma/web/o_auth/o_auth_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.OAuthView do diff --git a/lib/pleroma/web/o_auth/scopes.ex b/lib/pleroma/web/o_auth/scopes.ex index 90b9a0471..ada43eae9 100644 --- a/lib/pleroma/web/o_auth/scopes.ex +++ b/lib/pleroma/web/o_auth/scopes.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Scopes do diff --git a/lib/pleroma/web/o_auth/token.ex b/lib/pleroma/web/o_auth/token.ex index 886117d15..9d69e9db4 100644 --- a/lib/pleroma/web/o_auth/token.ex +++ b/lib/pleroma/web/o_auth/token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token do diff --git a/lib/pleroma/web/o_auth/token/query.ex b/lib/pleroma/web/o_auth/token/query.ex index fd6d9b112..d16a759d8 100644 --- a/lib/pleroma/web/o_auth/token/query.ex +++ b/lib/pleroma/web/o_auth/token/query.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token.Query do diff --git a/lib/pleroma/web/o_auth/token/strategy/refresh_token.ex b/lib/pleroma/web/o_auth/token/strategy/refresh_token.ex index 625b0fde2..f5a0ed272 100644 --- a/lib/pleroma/web/o_auth/token/strategy/refresh_token.ex +++ b/lib/pleroma/web/o_auth/token/strategy/refresh_token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token.Strategy.RefreshToken do diff --git a/lib/pleroma/web/o_auth/token/strategy/revoke.ex b/lib/pleroma/web/o_auth/token/strategy/revoke.ex index 069c1ee21..8d6572704 100644 --- a/lib/pleroma/web/o_auth/token/strategy/revoke.ex +++ b/lib/pleroma/web/o_auth/token/strategy/revoke.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token.Strategy.Revoke do diff --git a/lib/pleroma/web/o_auth/token/utils.ex b/lib/pleroma/web/o_auth/token/utils.ex index 43aeab6b0..b572dc9cf 100644 --- a/lib/pleroma/web/o_auth/token/utils.ex +++ b/lib/pleroma/web/o_auth/token/utils.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token.Utils do diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index ea182d698..450aae042 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OStatus.OStatusController do diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index 30cf83567..bca8e679c 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.AccountController do diff --git a/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex b/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex index dd0a2e22f..315657e9c 100644 --- a/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.BackupController do diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex index 1825e2168..f3cd1fbf6 100644 --- a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ChatController do use Pleroma.Web, :controller diff --git a/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex b/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex index df52b7566..d285e4907 100644 --- a/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ConversationController do diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex index c15980ff0..6a41bbab4 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiFileController do diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex index bc4c8d840..c696241f0 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiPackController do diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex index dee04f045..da5f2474f 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiReactionController do diff --git a/lib/pleroma/web/pleroma_api/controllers/instances_controller.ex b/lib/pleroma/web/pleroma_api/controllers/instances_controller.ex index 9e97480df..01424c6ba 100644 --- a/lib/pleroma/web/pleroma_api/controllers/instances_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/instances_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.InstancesController do diff --git a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex index 15210f1e6..429ef5112 100644 --- a/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.MascotController do diff --git a/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex b/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex index fa32aaa84..257bcd550 100644 --- a/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/notification_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.NotificationController do diff --git a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex index 632d65434..ca26d80ef 100644 --- a/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ScrobbleController do diff --git a/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex b/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex index eba452300..3940ad581 100644 --- a/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationController do diff --git a/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex b/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex index 7f089af1c..6d9a11fb6 100644 --- a/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.UserImportController do diff --git a/lib/pleroma/web/pleroma_api/views/backup_view.ex b/lib/pleroma/web/pleroma_api/views/backup_view.ex index e04c8fc0f..944600c86 100644 --- a/lib/pleroma/web/pleroma_api/views/backup_view.ex +++ b/lib/pleroma/web/pleroma_api/views/backup_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.BackupView do diff --git a/lib/pleroma/web/pleroma_api/views/chat/message_reference_view.ex b/lib/pleroma/web/pleroma_api/views/chat/message_reference_view.ex index df48044e3..2e4355992 100644 --- a/lib/pleroma/web/pleroma_api/views/chat/message_reference_view.ex +++ b/lib/pleroma/web/pleroma_api/views/chat/message_reference_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.Chat.MessageReferenceView do diff --git a/lib/pleroma/web/pleroma_api/views/chat_view.ex b/lib/pleroma/web/pleroma_api/views/chat_view.ex index 04dc20d51..3794818a7 100644 --- a/lib/pleroma/web/pleroma_api/views/chat_view.ex +++ b/lib/pleroma/web/pleroma_api/views/chat_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ChatView do diff --git a/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex b/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex index 110e8a041..809ef9b40 100644 --- a/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex +++ b/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiReactionView do diff --git a/lib/pleroma/web/pleroma_api/views/scrobble_view.ex b/lib/pleroma/web/pleroma_api/views/scrobble_view.ex index 98b95c721..2bc069529 100644 --- a/lib/pleroma/web/pleroma_api/views/scrobble_view.ex +++ b/lib/pleroma/web/pleroma_api/views/scrobble_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ScrobbleView do diff --git a/lib/pleroma/web/plug.ex b/lib/pleroma/web/plug.ex index 840b35072..dffad3a06 100644 --- a/lib/pleroma/web/plug.ex +++ b/lib/pleroma/web/plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plug do diff --git a/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex index ff851a874..976e5cd92 100644 --- a/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex +++ b/lib/pleroma/web/plugs/admin_secret_authentication_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlug do diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex index a7b8a9bfe..c3e13858a 100644 --- a/lib/pleroma/web/plugs/authentication_plug.ex +++ b/lib/pleroma/web/plugs/authentication_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.AuthenticationPlug do diff --git a/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex b/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex index 97529aedb..397f26de5 100644 --- a/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex +++ b/lib/pleroma/web/plugs/basic_auth_decoder_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.BasicAuthDecoderPlug do diff --git a/lib/pleroma/web/plugs/cache.ex b/lib/pleroma/web/plugs/cache.ex index 18880716a..111854859 100644 --- a/lib/pleroma/web/plugs/cache.ex +++ b/lib/pleroma/web/plugs/cache.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.Cache do diff --git a/lib/pleroma/web/plugs/digest_plug.ex b/lib/pleroma/web/plugs/digest_plug.ex index fb2723b97..d72f8073c 100644 --- a/lib/pleroma/web/plugs/digest_plug.ex +++ b/lib/pleroma/web/plugs/digest_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.DigestPlug do diff --git a/lib/pleroma/web/plugs/ensure_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex index ea2af6881..a4b5dc257 100644 --- a/lib/pleroma/web/plugs/ensure_authenticated_plug.ex +++ b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlug do diff --git a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex index 3bebdac6d..b6dfc4f3c 100644 --- a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex +++ b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug do diff --git a/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex b/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex index 4253458b2..3a2b5dda8 100644 --- a/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex +++ b/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug do diff --git a/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex index 0925ded4d..f09cffe95 100644 --- a/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex +++ b/lib/pleroma/web/plugs/expect_authenticated_check_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug do diff --git a/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex index ace512a78..e227d5150 100644 --- a/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex +++ b/lib/pleroma/web/plugs/expect_public_or_authenticated_check_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug do diff --git a/lib/pleroma/web/plugs/federating_plug.ex b/lib/pleroma/web/plugs/federating_plug.ex index 3c90a7644..eeef7e45b 100644 --- a/lib/pleroma/web/plugs/federating_plug.ex +++ b/lib/pleroma/web/plugs/federating_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.FederatingPlug do diff --git a/lib/pleroma/web/plugs/frontend_static.ex b/lib/pleroma/web/plugs/frontend_static.ex index 1b0b36813..eecf16264 100644 --- a/lib/pleroma/web/plugs/frontend_static.ex +++ b/lib/pleroma/web/plugs/frontend_static.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.FrontendStatic do diff --git a/lib/pleroma/web/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex index 45aaf188e..4b84f575d 100644 --- a/lib/pleroma/web/plugs/http_security_plug.ex +++ b/lib/pleroma/web/plugs/http_security_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do diff --git a/lib/pleroma/web/plugs/http_signature_plug.ex b/lib/pleroma/web/plugs/http_signature_plug.ex index 036e2a773..0f7550516 100644 --- a/lib/pleroma/web/plugs/http_signature_plug.ex +++ b/lib/pleroma/web/plugs/http_signature_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do diff --git a/lib/pleroma/web/plugs/idempotency_plug.ex b/lib/pleroma/web/plugs/idempotency_plug.ex index 4f908779c..9ac8f3647 100644 --- a/lib/pleroma/web/plugs/idempotency_plug.ex +++ b/lib/pleroma/web/plugs/idempotency_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.IdempotencyPlug do diff --git a/lib/pleroma/web/plugs/instance_static.ex b/lib/pleroma/web/plugs/instance_static.ex index 54b9175df..723b25679 100644 --- a/lib/pleroma/web/plugs/instance_static.ex +++ b/lib/pleroma/web/plugs/instance_static.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.InstanceStatic do diff --git a/lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex b/lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex index a0a0c5a9b..58cb0316a 100644 --- a/lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex +++ b/lib/pleroma/web/plugs/mapped_signature_to_identity_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.MappedSignatureToIdentityPlug do diff --git a/lib/pleroma/web/plugs/o_auth_plug.ex b/lib/pleroma/web/plugs/o_auth_plug.ex index eb287318b..5e06ac3f6 100644 --- a/lib/pleroma/web/plugs/o_auth_plug.ex +++ b/lib/pleroma/web/plugs/o_auth_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.OAuthPlug do diff --git a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex index e6d398b14..0f32f70a6 100644 --- a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex +++ b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.OAuthScopesPlug do diff --git a/lib/pleroma/web/plugs/plug_helper.ex b/lib/pleroma/web/plugs/plug_helper.ex index b314e7596..d73021bf7 100644 --- a/lib/pleroma/web/plugs/plug_helper.ex +++ b/lib/pleroma/web/plugs/plug_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.PlugHelper do diff --git a/lib/pleroma/web/plugs/rate_limiter.ex b/lib/pleroma/web/plugs/rate_limiter.ex index 034a5bbe2..5bebe0ad5 100644 --- a/lib/pleroma/web/plugs/rate_limiter.ex +++ b/lib/pleroma/web/plugs/rate_limiter.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.RateLimiter do diff --git a/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex index 5642bb205..3db59bf17 100644 --- a/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex +++ b/lib/pleroma/web/plugs/rate_limiter/limiter_supervisor.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.RateLimiter.LimiterSupervisor do diff --git a/lib/pleroma/web/plugs/rate_limiter/supervisor.ex b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex index a1c84063d..0dc2aa71b 100644 --- a/lib/pleroma/web/plugs/rate_limiter/supervisor.ex +++ b/lib/pleroma/web/plugs/rate_limiter/supervisor.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.RateLimiter.Supervisor do diff --git a/lib/pleroma/web/plugs/remote_ip.ex b/lib/pleroma/web/plugs/remote_ip.ex index 401e2cbfa..4d7daca56 100644 --- a/lib/pleroma/web/plugs/remote_ip.ex +++ b/lib/pleroma/web/plugs/remote_ip.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.RemoteIp do diff --git a/lib/pleroma/web/plugs/set_format_plug.ex b/lib/pleroma/web/plugs/set_format_plug.ex index c16d2f81d..7ef88f305 100644 --- a/lib/pleroma/web/plugs/set_format_plug.ex +++ b/lib/pleroma/web/plugs/set_format_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.SetFormatPlug do diff --git a/lib/pleroma/web/plugs/set_locale_plug.ex b/lib/pleroma/web/plugs/set_locale_plug.ex index d9d24b93f..d77191cff 100644 --- a/lib/pleroma/web/plugs/set_locale_plug.ex +++ b/lib/pleroma/web/plugs/set_locale_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only # NOTE: this module is based on https://github.com/smeevil/set_locale diff --git a/lib/pleroma/web/plugs/set_user_session_id_plug.ex b/lib/pleroma/web/plugs/set_user_session_id_plug.ex index 9f4a6b6ac..a1cfa0915 100644 --- a/lib/pleroma/web/plugs/set_user_session_id_plug.ex +++ b/lib/pleroma/web/plugs/set_user_session_id_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.SetUserSessionIdPlug do diff --git a/lib/pleroma/web/plugs/static_fe_plug.ex b/lib/pleroma/web/plugs/static_fe_plug.ex index 658a1052e..9ba9dc5ff 100644 --- a/lib/pleroma/web/plugs/static_fe_plug.ex +++ b/lib/pleroma/web/plugs/static_fe_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.StaticFEPlug do diff --git a/lib/pleroma/web/plugs/trailing_format_plug.ex b/lib/pleroma/web/plugs/trailing_format_plug.ex index e3f57c14a..c5069ae0e 100644 --- a/lib/pleroma/web/plugs/trailing_format_plug.ex +++ b/lib/pleroma/web/plugs/trailing_format_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.TrailingFormatPlug do diff --git a/lib/pleroma/web/plugs/uploaded_media.ex b/lib/pleroma/web/plugs/uploaded_media.ex index 175b4d87d..2378e98d2 100644 --- a/lib/pleroma/web/plugs/uploaded_media.ex +++ b/lib/pleroma/web/plugs/uploaded_media.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UploadedMedia do diff --git a/lib/pleroma/web/plugs/user_enabled_plug.ex b/lib/pleroma/web/plugs/user_enabled_plug.ex index 4f1b163bd..1142a8dbc 100644 --- a/lib/pleroma/web/plugs/user_enabled_plug.ex +++ b/lib/pleroma/web/plugs/user_enabled_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UserEnabledPlug do diff --git a/lib/pleroma/web/plugs/user_fetcher_plug.ex b/lib/pleroma/web/plugs/user_fetcher_plug.ex index 89e16b49f..707df9bfd 100644 --- a/lib/pleroma/web/plugs/user_fetcher_plug.ex +++ b/lib/pleroma/web/plugs/user_fetcher_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UserFetcherPlug do diff --git a/lib/pleroma/web/plugs/user_is_admin_plug.ex b/lib/pleroma/web/plugs/user_is_admin_plug.ex index 531c965f0..7649912ba 100644 --- a/lib/pleroma/web/plugs/user_is_admin_plug.ex +++ b/lib/pleroma/web/plugs/user_is_admin_plug.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UserIsAdminPlug do diff --git a/lib/pleroma/web/preload.ex b/lib/pleroma/web/preload.ex index 90e454468..e8588bcc9 100644 --- a/lib/pleroma/web/preload.ex +++ b/lib/pleroma/web/preload.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload do diff --git a/lib/pleroma/web/preload/providers/instance.ex b/lib/pleroma/web/preload/providers/instance.ex index a549bb1eb..eb0254c74 100644 --- a/lib/pleroma/web/preload/providers/instance.ex +++ b/lib/pleroma/web/preload/providers/instance.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.Instance do diff --git a/lib/pleroma/web/preload/providers/provider.ex b/lib/pleroma/web/preload/providers/provider.ex index 7ef595a34..60f304f2c 100644 --- a/lib/pleroma/web/preload/providers/provider.ex +++ b/lib/pleroma/web/preload/providers/provider.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.Provider do diff --git a/lib/pleroma/web/preload/providers/timelines.ex b/lib/pleroma/web/preload/providers/timelines.ex index b279a865d..c1704ccdc 100644 --- a/lib/pleroma/web/preload/providers/timelines.ex +++ b/lib/pleroma/web/preload/providers/timelines.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.Timelines do diff --git a/lib/pleroma/web/preload/providers/user.ex b/lib/pleroma/web/preload/providers/user.ex index b3d2e9b8d..504f79ba0 100644 --- a/lib/pleroma/web/preload/providers/user.ex +++ b/lib/pleroma/web/preload/providers/user.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.User do diff --git a/lib/pleroma/web/push.ex b/lib/pleroma/web/push.ex index b80a6438d..154dae614 100644 --- a/lib/pleroma/web/push.ex +++ b/lib/pleroma/web/push.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Push do diff --git a/lib/pleroma/web/push/impl.ex b/lib/pleroma/web/push/impl.ex index a9c46f63a..83cbdc870 100644 --- a/lib/pleroma/web/push/impl.ex +++ b/lib/pleroma/web/push/impl.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Push.Impl do diff --git a/lib/pleroma/web/push/subscription.ex b/lib/pleroma/web/push/subscription.ex index 749a573ba..4f6c9bc9f 100644 --- a/lib/pleroma/web/push/subscription.ex +++ b/lib/pleroma/web/push/subscription.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Push.Subscription do diff --git a/lib/pleroma/web/rel_me.ex b/lib/pleroma/web/rel_me.ex index 650c6a3fc..7e745d07e 100644 --- a/lib/pleroma/web/rel_me.ex +++ b/lib/pleroma/web/rel_me.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RelMe do diff --git a/lib/pleroma/web/rich_media/parser.ex b/lib/pleroma/web/rich_media/parser.ex index d7a491198..d6b54943b 100644 --- a/lib/pleroma/web/rich_media/parser.ex +++ b/lib/pleroma/web/rich_media/parser.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parser do diff --git a/lib/pleroma/web/rich_media/parser/ttl.ex b/lib/pleroma/web/rich_media/parser/ttl.ex index 8353f0fff..0b7f14fb2 100644 --- a/lib/pleroma/web/rich_media/parser/ttl.ex +++ b/lib/pleroma/web/rich_media/parser/ttl.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parser.TTL do diff --git a/lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex b/lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex index fc4ef79c0..c7eb267f3 100644 --- a/lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex +++ b/lib/pleroma/web/rich_media/parser/ttl/aws_signed_url.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl do diff --git a/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex b/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex index 3d577e254..31c3d1e33 100644 --- a/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex +++ b/lib/pleroma/web/rich_media/parsers/meta_tags_parser.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parsers.MetaTagsParser do diff --git a/lib/pleroma/web/rich_media/parsers/o_embed.ex b/lib/pleroma/web/rich_media/parsers/o_embed.ex index 1fe6729c3..09eabec56 100644 --- a/lib/pleroma/web/rich_media/parsers/o_embed.ex +++ b/lib/pleroma/web/rich_media/parsers/o_embed.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parsers.OEmbed do diff --git a/lib/pleroma/web/rich_media/parsers/ogp.ex b/lib/pleroma/web/rich_media/parsers/ogp.ex index b3b3b059c..d0edf1c88 100644 --- a/lib/pleroma/web/rich_media/parsers/ogp.ex +++ b/lib/pleroma/web/rich_media/parsers/ogp.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parsers.OGP do diff --git a/lib/pleroma/web/rich_media/parsers/twitter_card.ex b/lib/pleroma/web/rich_media/parsers/twitter_card.ex index 4a04865d2..0adf84159 100644 --- a/lib/pleroma/web/rich_media/parsers/twitter_card.ex +++ b/lib/pleroma/web/rich_media/parsers/twitter_card.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parsers.TwitterCard do diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index aefc9f0be..a9e332fa1 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Router do diff --git a/lib/pleroma/web/static_fe/static_fe_controller.ex b/lib/pleroma/web/static_fe/static_fe_controller.ex index 404cb0473..fe485d10d 100644 --- a/lib/pleroma/web/static_fe/static_fe_controller.ex +++ b/lib/pleroma/web/static_fe/static_fe_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.StaticFE.StaticFEController do diff --git a/lib/pleroma/web/static_fe/static_fe_view.ex b/lib/pleroma/web/static_fe/static_fe_view.ex index b3d1d1ec8..c04715337 100644 --- a/lib/pleroma/web/static_fe/static_fe_view.ex +++ b/lib/pleroma/web/static_fe/static_fe_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.StaticFE.StaticFEView do diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex index 1fb8ac1c5..fc3bbb130 100644 --- a/lib/pleroma/web/streamer.ex +++ b/lib/pleroma/web/streamer.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Streamer do diff --git a/lib/pleroma/web/translation_helpers.ex b/lib/pleroma/web/translation_helpers.ex index 7f78ce1b9..0fe31d189 100644 --- a/lib/pleroma/web/translation_helpers.ex +++ b/lib/pleroma/web/translation_helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TranslationHelpers do diff --git a/lib/pleroma/web/twitter_api/controller.ex b/lib/pleroma/web/twitter_api/controller.ex index 16f43863c..467c19e5e 100644 --- a/lib/pleroma/web/twitter_api/controller.ex +++ b/lib/pleroma/web/twitter_api/controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.Controller do diff --git a/lib/pleroma/web/twitter_api/controllers/password_controller.ex b/lib/pleroma/web/twitter_api/controllers/password_controller.ex index b1a9d810e..bc04a4d49 100644 --- a/lib/pleroma/web/twitter_api/controllers/password_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/password_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.PasswordController do diff --git a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex index 4480a4922..6ca02fbd7 100644 --- a/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.RemoteFollowController do diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 9ead0d626..1e252f7bb 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.UtilController do diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index 8e20b0d55..f6d721da6 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.TwitterAPI do diff --git a/lib/pleroma/web/twitter_api/views/password_view.ex b/lib/pleroma/web/twitter_api/views/password_view.ex index 41462e4af..a9bb95a2c 100644 --- a/lib/pleroma/web/twitter_api/views/password_view.ex +++ b/lib/pleroma/web/twitter_api/views/password_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.PasswordView do diff --git a/lib/pleroma/web/twitter_api/views/remote_follow_view.ex b/lib/pleroma/web/twitter_api/views/remote_follow_view.ex index c05c7821c..ac3f15eec 100644 --- a/lib/pleroma/web/twitter_api/views/remote_follow_view.ex +++ b/lib/pleroma/web/twitter_api/views/remote_follow_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.RemoteFollowView do diff --git a/lib/pleroma/web/twitter_api/views/token_view.ex b/lib/pleroma/web/twitter_api/views/token_view.ex index c36303625..99884e714 100644 --- a/lib/pleroma/web/twitter_api/views/token_view.ex +++ b/lib/pleroma/web/twitter_api/views/token_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.TokenView do diff --git a/lib/pleroma/web/twitter_api/views/util_view.ex b/lib/pleroma/web/twitter_api/views/util_view.ex index 98eea1d18..9b13c09b3 100644 --- a/lib/pleroma/web/twitter_api/views/util_view.ex +++ b/lib/pleroma/web/twitter_api/views/util_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.UtilView do diff --git a/lib/pleroma/web/uploader_controller.ex b/lib/pleroma/web/uploader_controller.ex index 6533f1c0e..0d42c7ec3 100644 --- a/lib/pleroma/web/uploader_controller.ex +++ b/lib/pleroma/web/uploader_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.UploaderController do diff --git a/lib/pleroma/web/views/email_view.ex b/lib/pleroma/web/views/email_view.ex index bcdee6571..f7659b994 100644 --- a/lib/pleroma/web/views/email_view.ex +++ b/lib/pleroma/web/views/email_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.EmailView do diff --git a/lib/pleroma/web/views/embed_view.ex b/lib/pleroma/web/views/embed_view.ex index 5f50bd155..cb7600adb 100644 --- a/lib/pleroma/web/views/embed_view.ex +++ b/lib/pleroma/web/views/embed_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.EmbedView do diff --git a/lib/pleroma/web/views/error_helpers.ex b/lib/pleroma/web/views/error_helpers.ex index df657a343..d282c04b7 100644 --- a/lib/pleroma/web/views/error_helpers.ex +++ b/lib/pleroma/web/views/error_helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ErrorHelpers do diff --git a/lib/pleroma/web/views/error_view.ex b/lib/pleroma/web/views/error_view.ex index e68d55e08..c9715dc4b 100644 --- a/lib/pleroma/web/views/error_view.ex +++ b/lib/pleroma/web/views/error_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ErrorView do diff --git a/lib/pleroma/web/views/layout_view.ex b/lib/pleroma/web/views/layout_view.ex index 3e49c6549..c2da10f04 100644 --- a/lib/pleroma/web/views/layout_view.ex +++ b/lib/pleroma/web/views/layout_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.LayoutView do diff --git a/lib/pleroma/web/views/mailer/subscription_view.ex b/lib/pleroma/web/views/mailer/subscription_view.ex index 4562a9d6c..1dc80987b 100644 --- a/lib/pleroma/web/views/mailer/subscription_view.ex +++ b/lib/pleroma/web/views/mailer/subscription_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Mailer.SubscriptionView do diff --git a/lib/pleroma/web/views/masto_fe_view.ex b/lib/pleroma/web/views/masto_fe_view.ex index b1669d198..b9055cb7f 100644 --- a/lib/pleroma/web/views/masto_fe_view.ex +++ b/lib/pleroma/web/views/masto_fe_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastoFEView do diff --git a/lib/pleroma/web/views/streamer_view.ex b/lib/pleroma/web/views/streamer_view.ex index 4fc14166d..7706035e9 100644 --- a/lib/pleroma/web/views/streamer_view.ex +++ b/lib/pleroma/web/views/streamer_view.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.StreamerView do diff --git a/lib/pleroma/web/web_finger.ex b/lib/pleroma/web/web_finger.ex index a109e1acc..15002b29f 100644 --- a/lib/pleroma/web/web_finger.ex +++ b/lib/pleroma/web/web_finger.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.WebFinger do diff --git a/lib/pleroma/web/web_finger/web_finger_controller.ex b/lib/pleroma/web/web_finger/web_finger_controller.ex index 9f0938fc0..7944c50ad 100644 --- a/lib/pleroma/web/web_finger/web_finger_controller.ex +++ b/lib/pleroma/web/web_finger/web_finger_controller.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.WebFinger.WebFingerController do diff --git a/lib/pleroma/web/xml.ex b/lib/pleroma/web/xml.ex index c69a86a1e..2b34611ac 100644 --- a/lib/pleroma/web/xml.ex +++ b/lib/pleroma/web/xml.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.XML do diff --git a/lib/pleroma/workers/attachments_cleanup_worker.ex b/lib/pleroma/workers/attachments_cleanup_worker.ex index 69758e8c1..a2373ebb9 100644 --- a/lib/pleroma/workers/attachments_cleanup_worker.ex +++ b/lib/pleroma/workers/attachments_cleanup_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.AttachmentsCleanupWorker do diff --git a/lib/pleroma/workers/background_worker.ex b/lib/pleroma/workers/background_worker.ex index 0647c65ae..e24b9c175 100644 --- a/lib/pleroma/workers/background_worker.ex +++ b/lib/pleroma/workers/background_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.BackgroundWorker do diff --git a/lib/pleroma/workers/backup_worker.ex b/lib/pleroma/workers/backup_worker.ex index 5b4985983..9b763b04b 100644 --- a/lib/pleroma/workers/backup_worker.ex +++ b/lib/pleroma/workers/backup_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.BackupWorker do diff --git a/lib/pleroma/workers/cron/digest_emails_worker.ex b/lib/pleroma/workers/cron/digest_emails_worker.ex index 0c56f00fb..83dc75d60 100644 --- a/lib/pleroma/workers/cron/digest_emails_worker.ex +++ b/lib/pleroma/workers/cron/digest_emails_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.Cron.DigestEmailsWorker do diff --git a/lib/pleroma/workers/cron/new_users_digest_worker.ex b/lib/pleroma/workers/cron/new_users_digest_worker.ex index 8bbaed83d..9dfd92228 100644 --- a/lib/pleroma/workers/cron/new_users_digest_worker.ex +++ b/lib/pleroma/workers/cron/new_users_digest_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.Cron.NewUsersDigestWorker do diff --git a/lib/pleroma/workers/mailer_worker.ex b/lib/pleroma/workers/mailer_worker.ex index 32273cfa5..592230e7a 100644 --- a/lib/pleroma/workers/mailer_worker.ex +++ b/lib/pleroma/workers/mailer_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.MailerWorker do diff --git a/lib/pleroma/workers/mute_expire_worker.ex b/lib/pleroma/workers/mute_expire_worker.ex index 32a12ba85..8da903e76 100644 --- a/lib/pleroma/workers/mute_expire_worker.ex +++ b/lib/pleroma/workers/mute_expire_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.MuteExpireWorker do diff --git a/lib/pleroma/workers/publisher_worker.ex b/lib/pleroma/workers/publisher_worker.ex index e739c3cd0..6209715b3 100644 --- a/lib/pleroma/workers/publisher_worker.ex +++ b/lib/pleroma/workers/publisher_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.PublisherWorker do diff --git a/lib/pleroma/workers/purge_expired_activity.ex b/lib/pleroma/workers/purge_expired_activity.ex index c168890a2..01256831b 100644 --- a/lib/pleroma/workers/purge_expired_activity.ex +++ b/lib/pleroma/workers/purge_expired_activity.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.PurgeExpiredActivity do diff --git a/lib/pleroma/workers/purge_expired_token.ex b/lib/pleroma/workers/purge_expired_token.ex index a81e0cd28..cfdf5c6dc 100644 --- a/lib/pleroma/workers/purge_expired_token.ex +++ b/lib/pleroma/workers/purge_expired_token.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.PurgeExpiredToken do diff --git a/lib/pleroma/workers/receiver_worker.ex b/lib/pleroma/workers/receiver_worker.ex index 1b97af1a8..69125dcd0 100644 --- a/lib/pleroma/workers/receiver_worker.ex +++ b/lib/pleroma/workers/receiver_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.ReceiverWorker do diff --git a/lib/pleroma/workers/remote_fetcher_worker.ex b/lib/pleroma/workers/remote_fetcher_worker.ex index 27e2e3386..ad4d785a1 100644 --- a/lib/pleroma/workers/remote_fetcher_worker.ex +++ b/lib/pleroma/workers/remote_fetcher_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.RemoteFetcherWorker do diff --git a/lib/pleroma/workers/scheduled_activity_worker.ex b/lib/pleroma/workers/scheduled_activity_worker.ex index dd9986fe4..cf965999c 100644 --- a/lib/pleroma/workers/scheduled_activity_worker.ex +++ b/lib/pleroma/workers/scheduled_activity_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.ScheduledActivityWorker do diff --git a/lib/pleroma/workers/transmogrifier_worker.ex b/lib/pleroma/workers/transmogrifier_worker.ex index 15f36375c..b39c1ea62 100644 --- a/lib/pleroma/workers/transmogrifier_worker.ex +++ b/lib/pleroma/workers/transmogrifier_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.TransmogrifierWorker do diff --git a/lib/pleroma/workers/web_pusher_worker.ex b/lib/pleroma/workers/web_pusher_worker.ex index 0cfdc6a6f..8fc2aff26 100644 --- a/lib/pleroma/workers/web_pusher_worker.ex +++ b/lib/pleroma/workers/web_pusher_worker.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.WebPusherWorker do diff --git a/lib/pleroma/workers/worker_helper.ex b/lib/pleroma/workers/worker_helper.ex index 7d1289be2..4befbeb3b 100644 --- a/lib/pleroma/workers/worker_helper.ex +++ b/lib/pleroma/workers/worker_helper.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.WorkerHelper do diff --git a/lib/pleroma/xml_builder.ex b/lib/pleroma/xml_builder.ex index 33b63a71f..922d3f6ee 100644 --- a/lib/pleroma/xml_builder.ex +++ b/lib/pleroma/xml_builder.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.XmlBuilder do diff --git a/priv/repo/migrations/20190408123347_create_conversations.exs b/priv/repo/migrations/20190408123347_create_conversations.exs index 3eaa6136c..aab6cf802 100644 --- a/priv/repo/migrations/20190408123347_create_conversations.exs +++ b/priv/repo/migrations/20190408123347_create_conversations.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.CreateConversations do diff --git a/priv/repo/migrations/20200602150528_create_chat_message_reference.exs b/priv/repo/migrations/20200602150528_create_chat_message_reference.exs index 6f9148b7c..5e57cddcf 100644 --- a/priv/repo/migrations/20200602150528_create_chat_message_reference.exs +++ b/priv/repo/migrations/20200602150528_create_chat_message_reference.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.CreateChatMessageReference do diff --git a/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs b/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs index 6cd23dbac..3fb643372 100644 --- a/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs +++ b/priv/repo/migrations/20201013141127_refactor_locked_user_field.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.RefactorLockedUserField do diff --git a/priv/repo/migrations/20201013144052_refactor_discoverable_user_field.exs b/priv/repo/migrations/20201013144052_refactor_discoverable_user_field.exs index 3fdc190cc..6d6738e90 100644 --- a/priv/repo/migrations/20201013144052_refactor_discoverable_user_field.exs +++ b/priv/repo/migrations/20201013144052_refactor_discoverable_user_field.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.RefactorDiscoverableUserField do diff --git a/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs b/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs index de2f35169..4372d093f 100644 --- a/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs +++ b/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do diff --git a/test/credo/check/consistency/file_location.ex b/test/credo/check/consistency/file_location.ex index 500983608..abc55fffc 100644 --- a/test/credo/check/consistency/file_location.ex +++ b/test/credo/check/consistency/file_location.ex @@ -1,7 +1,7 @@ # Pleroma: A lightweight social networking server # Originally taken from # https://github.com/VeryBigThings/elixir_common/blob/master/lib/vbt/credo/check/consistency/file_location.ex -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Credo.Check.Consistency.FileLocation do diff --git a/test/fixtures/config/temp.secret.exs b/test/fixtures/config/temp.secret.exs index 621bc8cf6..4b3af39ec 100644 --- a/test/fixtures/config/temp.secret.exs +++ b/test/fixtures/config/temp.secret.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only use Mix.Config diff --git a/test/fixtures/modules/runtime_module.ex b/test/fixtures/modules/runtime_module.ex index e348c499e..940b58a1b 100644 --- a/test/fixtures/modules/runtime_module.ex +++ b/test/fixtures/modules/runtime_module.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Fixtures.Modules.RuntimeModule do diff --git a/test/mix/pleroma_test.exs b/test/mix/pleroma_test.exs index c3e47b285..af62cc1d9 100644 --- a/test/mix/pleroma_test.exs +++ b/test/mix/pleroma_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.PleromaTest do diff --git a/test/mix/tasks/pleroma/app_test.exs b/test/mix/tasks/pleroma/app_test.exs index 71a84ac8e..9eabd32af 100644 --- a/test/mix/tasks/pleroma/app_test.exs +++ b/test/mix/tasks/pleroma/app_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.AppTest do diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs index 0280d208d..21f8f2286 100644 --- a/test/mix/tasks/pleroma/config_test.exs +++ b/test/mix/tasks/pleroma/config_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.ConfigTest do diff --git a/test/mix/tasks/pleroma/count_statuses_test.exs b/test/mix/tasks/pleroma/count_statuses_test.exs index 8fe3959ea..80ec206b8 100644 --- a/test/mix/tasks/pleroma/count_statuses_test.exs +++ b/test/mix/tasks/pleroma/count_statuses_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.CountStatusesTest do diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index eefb12426..7a1a759da 100644 --- a/test/mix/tasks/pleroma/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.DatabaseTest do diff --git a/test/mix/tasks/pleroma/digest_test.exs b/test/mix/tasks/pleroma/digest_test.exs index 69dccb745..4a9e461a9 100644 --- a/test/mix/tasks/pleroma/digest_test.exs +++ b/test/mix/tasks/pleroma/digest_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.DigestTest do diff --git a/test/mix/tasks/pleroma/ecto/migrate_test.exs b/test/mix/tasks/pleroma/ecto/migrate_test.exs index 548357508..5bdfd8f30 100644 --- a/test/mix/tasks/pleroma/ecto/migrate_test.exs +++ b/test/mix/tasks/pleroma/ecto/migrate_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-onl defmodule Mix.Tasks.Pleroma.Ecto.MigrateTest do diff --git a/test/mix/tasks/pleroma/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs index 9e39db8fa..a0751acb1 100644 --- a/test/mix/tasks/pleroma/ecto/rollback_test.exs +++ b/test/mix/tasks/pleroma/ecto/rollback_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.Ecto.RollbackTest do diff --git a/test/mix/tasks/pleroma/ecto_test.exs b/test/mix/tasks/pleroma/ecto_test.exs index 3a028df83..0164da5a8 100644 --- a/test/mix/tasks/pleroma/ecto_test.exs +++ b/test/mix/tasks/pleroma/ecto_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.EctoTest do diff --git a/test/mix/tasks/pleroma/email_test.exs b/test/mix/tasks/pleroma/email_test.exs index 9523aefd8..78cdf178b 100644 --- a/test/mix/tasks/pleroma/email_test.exs +++ b/test/mix/tasks/pleroma/email_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.EmailTest do diff --git a/test/mix/tasks/pleroma/emoji_test.exs b/test/mix/tasks/pleroma/emoji_test.exs index 0fb8603ac..bd20f285c 100644 --- a/test/mix/tasks/pleroma/emoji_test.exs +++ b/test/mix/tasks/pleroma/emoji_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.EmojiTest do diff --git a/test/mix/tasks/pleroma/frontend_test.exs b/test/mix/tasks/pleroma/frontend_test.exs index 6f9ec14cd..aa4b25ebb 100644 --- a/test/mix/tasks/pleroma/frontend_test.exs +++ b/test/mix/tasks/pleroma/frontend_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.FrontendTest do diff --git a/test/mix/tasks/pleroma/instance_test.exs b/test/mix/tasks/pleroma/instance_test.exs index 1d2dde108..5a5a68053 100644 --- a/test/mix/tasks/pleroma/instance_test.exs +++ b/test/mix/tasks/pleroma/instance_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.InstanceTest do diff --git a/test/mix/tasks/pleroma/refresh_counter_cache_test.exs b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs index e79dc0632..fe9e5cfeb 100644 --- a/test/mix/tasks/pleroma/refresh_counter_cache_test.exs +++ b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.RefreshCounterCacheTest do diff --git a/test/mix/tasks/pleroma/relay_test.exs b/test/mix/tasks/pleroma/relay_test.exs index b453ed1c6..db75b3630 100644 --- a/test/mix/tasks/pleroma/relay_test.exs +++ b/test/mix/tasks/pleroma/relay_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.RelayTest do diff --git a/test/mix/tasks/pleroma/robots_txt_test.exs b/test/mix/tasks/pleroma/robots_txt_test.exs index 7040a0e4e..4b369d83c 100644 --- a/test/mix/tasks/pleroma/robots_txt_test.exs +++ b/test/mix/tasks/pleroma/robots_txt_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.RobotsTxtTest do diff --git a/test/mix/tasks/pleroma/uploads_test.exs b/test/mix/tasks/pleroma/uploads_test.exs index d69e149a8..a7d15e0fa 100644 --- a/test/mix/tasks/pleroma/uploads_test.exs +++ b/test/mix/tasks/pleroma/uploads_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.UploadsTest do diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index 9f898d8f3..7c68b8a37 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Mix.Tasks.Pleroma.UserTest do diff --git a/test/pleroma/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs index b464822d9..6b848e04d 100644 --- a/test/pleroma/activity/ir/topics_test.exs +++ b/test/pleroma/activity/ir/topics_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Activity.Ir.TopicsTest do diff --git a/test/pleroma/activity/search_test.exs b/test/pleroma/activity/search_test.exs index 49b7aa292..657fbc627 100644 --- a/test/pleroma/activity/search_test.exs +++ b/test/pleroma/activity/search_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Activity.SearchTest do diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs index acaa9adb4..83757ad56 100644 --- a/test/pleroma/activity_test.exs +++ b/test/pleroma/activity_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ActivityTest do diff --git a/test/pleroma/application_requirements_test.exs b/test/pleroma/application_requirements_test.exs index e3cca5487..d056cc817 100644 --- a/test/pleroma/application_requirements_test.exs +++ b/test/pleroma/application_requirements_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ApplicationRequirementsTest do diff --git a/test/pleroma/bbs/handler_test.exs b/test/pleroma/bbs/handler_test.exs index 8033828f0..3990f8286 100644 --- a/test/pleroma/bbs/handler_test.exs +++ b/test/pleroma/bbs/handler_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.BBS.HandlerTest do diff --git a/test/pleroma/bookmark_test.exs b/test/pleroma/bookmark_test.exs index ef090d785..9f64a01c2 100644 --- a/test/pleroma/bookmark_test.exs +++ b/test/pleroma/bookmark_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.BookmarkTest do diff --git a/test/pleroma/captcha_test.exs b/test/pleroma/captcha_test.exs index bde3c72f7..5691c9506 100644 --- a/test/pleroma/captcha_test.exs +++ b/test/pleroma/captcha_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.CaptchaTest do diff --git a/test/pleroma/chat/message_reference_test.exs b/test/pleroma/chat/message_reference_test.exs index aaa7c1ad4..c8db3b450 100644 --- a/test/pleroma/chat/message_reference_test.exs +++ b/test/pleroma/chat/message_reference_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Chat.MessageReferenceTest do diff --git a/test/pleroma/chat_test.exs b/test/pleroma/chat_test.exs index 1dd04916c..a5fd1e02e 100644 --- a/test/pleroma/chat_test.exs +++ b/test/pleroma/chat_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ChatTest do diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index f52629f8a..7dff93558 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.DeprecationWarningsTest do diff --git a/test/pleroma/config/holder_test.exs b/test/pleroma/config/holder_test.exs index abcaa27dd..ca4c38995 100644 --- a/test/pleroma/config/holder_test.exs +++ b/test/pleroma/config/holder_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.HolderTest do diff --git a/test/pleroma/config/loader_test.exs b/test/pleroma/config/loader_test.exs index 607572f4e..b34fd70da 100644 --- a/test/pleroma/config/loader_test.exs +++ b/test/pleroma/config/loader_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.LoaderTest do diff --git a/test/pleroma/config/transfer_task_test.exs b/test/pleroma/config/transfer_task_test.exs index f53829e09..8ae5d3b81 100644 --- a/test/pleroma/config/transfer_task_test.exs +++ b/test/pleroma/config/transfer_task_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Config.TransferTaskTest do diff --git a/test/pleroma/config_db_test.exs b/test/pleroma/config_db_test.exs index 3895e2cda..d42123fb4 100644 --- a/test/pleroma/config_db_test.exs +++ b/test/pleroma/config_db_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ConfigDBTest do diff --git a/test/pleroma/config_test.exs b/test/pleroma/config_test.exs index f524d90dd..e4e7f505f 100644 --- a/test/pleroma/config_test.exs +++ b/test/pleroma/config_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ConfigTest do diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs index 917fb2b98..8b039cd78 100644 --- a/test/pleroma/conversation/participation_test.exs +++ b/test/pleroma/conversation/participation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Conversation.ParticipationTest do diff --git a/test/pleroma/conversation_test.exs b/test/pleroma/conversation_test.exs index 4643140dc..1a947606d 100644 --- a/test/pleroma/conversation_test.exs +++ b/test/pleroma/conversation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ConversationTest do diff --git a/test/pleroma/docs/generator_test.exs b/test/pleroma/docs/generator_test.exs index 43877244d..a9b09e577 100644 --- a/test/pleroma/docs/generator_test.exs +++ b/test/pleroma/docs/generator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Docs.GeneratorTest do diff --git a/test/pleroma/earmark_renderer_test.exs b/test/pleroma/earmark_renderer_test.exs index 73aaec7f4..776bc496a 100644 --- a/test/pleroma/earmark_renderer_test.exs +++ b/test/pleroma/earmark_renderer_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EarmarkRendererTest do use Pleroma.DataCase, async: true diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs index a8471e2e3..259fd6a5f 100644 --- a/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.DateTimeTest do diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs index 3b6006854..1a4c2dfcb 100644 --- a/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectIDTest do diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs index b7eb59ab0..d3a2fd13f 100644 --- a/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.RecipientsTest do diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs index 154363f68..7002eca30 100644 --- a/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs +++ b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.SafeTextTest do diff --git a/test/pleroma/emails/admin_email_test.exs b/test/pleroma/emails/admin_email_test.exs index 9aaf7b04f..04c907697 100644 --- a/test/pleroma/emails/admin_email_test.exs +++ b/test/pleroma/emails/admin_email_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.AdminEmailTest do diff --git a/test/pleroma/emails/mailer_test.exs b/test/pleroma/emails/mailer_test.exs index 9e232d2a0..a8e1553e5 100644 --- a/test/pleroma/emails/mailer_test.exs +++ b/test/pleroma/emails/mailer_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.MailerTest do diff --git a/test/pleroma/emails/user_email_test.exs b/test/pleroma/emails/user_email_test.exs index bd21d8dec..21fd06ea6 100644 --- a/test/pleroma/emails/user_email_test.exs +++ b/test/pleroma/emails/user_email_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emails.UserEmailTest do diff --git a/test/pleroma/emoji/formatter_test.exs b/test/pleroma/emoji/formatter_test.exs index 096d23ca6..3942f609f 100644 --- a/test/pleroma/emoji/formatter_test.exs +++ b/test/pleroma/emoji/formatter_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji.FormatterTest do diff --git a/test/pleroma/emoji/loader_test.exs b/test/pleroma/emoji/loader_test.exs index 804039e7e..de89e3bc4 100644 --- a/test/pleroma/emoji/loader_test.exs +++ b/test/pleroma/emoji/loader_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji.LoaderTest do diff --git a/test/pleroma/emoji/pack_test.exs b/test/pleroma/emoji/pack_test.exs index 158dfee06..ac7535412 100644 --- a/test/pleroma/emoji/pack_test.exs +++ b/test/pleroma/emoji/pack_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Emoji.PackTest do diff --git a/test/pleroma/emoji_test.exs b/test/pleroma/emoji_test.exs index c99c9ef4c..027a8132f 100644 --- a/test/pleroma/emoji_test.exs +++ b/test/pleroma/emoji_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.EmojiTest do diff --git a/test/pleroma/filter_test.exs b/test/pleroma/filter_test.exs index da9515902..a9e256e8c 100644 --- a/test/pleroma/filter_test.exs +++ b/test/pleroma/filter_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.FilterTest do diff --git a/test/pleroma/following_relationship_test.exs b/test/pleroma/following_relationship_test.exs index f0d2c3846..37452996b 100644 --- a/test/pleroma/following_relationship_test.exs +++ b/test/pleroma/following_relationship_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.FollowingRelationshipTest do diff --git a/test/pleroma/formatter_test.exs b/test/pleroma/formatter_test.exs index 5781a3f01..7f54638fb 100644 --- a/test/pleroma/formatter_test.exs +++ b/test/pleroma/formatter_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.FormatterTest do diff --git a/test/pleroma/frontend_test.exs b/test/pleroma/frontend_test.exs index 223625857..1b50a031d 100644 --- a/test/pleroma/frontend_test.exs +++ b/test/pleroma/frontend_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.FrontendTest do diff --git a/test/pleroma/gun/connection_pool_test.exs b/test/pleroma/gun/connection_pool_test.exs index aea908fac..459d19b11 100644 --- a/test/pleroma/gun/connection_pool_test.exs +++ b/test/pleroma/gun/connection_pool_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Gun.ConnectionPoolTest do diff --git a/test/pleroma/healthcheck_test.exs b/test/pleroma/healthcheck_test.exs index a1bc25d25..469e5b397 100644 --- a/test/pleroma/healthcheck_test.exs +++ b/test/pleroma/healthcheck_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HealthcheckTest do diff --git a/test/pleroma/html_test.exs b/test/pleroma/html_test.exs index 3a926f077..fe1a1ed57 100644 --- a/test/pleroma/html_test.exs +++ b/test/pleroma/html_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTMLTest do diff --git a/test/pleroma/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs index 487d2e7c1..8e2fd69a6 100644 --- a/test/pleroma/http/adapter_helper/gun_test.exs +++ b/test/pleroma/http/adapter_helper/gun_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelper.GunTest do diff --git a/test/pleroma/http/adapter_helper/hackney_test.exs b/test/pleroma/http/adapter_helper/hackney_test.exs index f2361ff0b..85150a65c 100644 --- a/test/pleroma/http/adapter_helper/hackney_test.exs +++ b/test/pleroma/http/adapter_helper/hackney_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelper.HackneyTest do diff --git a/test/pleroma/http/adapter_helper_test.exs b/test/pleroma/http/adapter_helper_test.exs index 24d501ad5..3c8c89164 100644 --- a/test/pleroma/http/adapter_helper_test.exs +++ b/test/pleroma/http/adapter_helper_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.AdapterHelperTest do diff --git a/test/pleroma/http/ex_aws_test.exs b/test/pleroma/http/ex_aws_test.exs index d0b00ca26..4cbc440bd 100644 --- a/test/pleroma/http/ex_aws_test.exs +++ b/test/pleroma/http/ex_aws_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.ExAwsTest do diff --git a/test/pleroma/http/request_builder_test.exs b/test/pleroma/http/request_builder_test.exs index fab909905..e9b0c4a8a 100644 --- a/test/pleroma/http/request_builder_test.exs +++ b/test/pleroma/http/request_builder_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.RequestBuilderTest do diff --git a/test/pleroma/http/tzdata_test.exs b/test/pleroma/http/tzdata_test.exs index 3e605d33b..1161bfaef 100644 --- a/test/pleroma/http/tzdata_test.exs +++ b/test/pleroma/http/tzdata_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTP.TzdataTest do diff --git a/test/pleroma/http_test.exs b/test/pleroma/http_test.exs index d394bb942..e6a6d31b3 100644 --- a/test/pleroma/http_test.exs +++ b/test/pleroma/http_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.HTTPTest do diff --git a/test/pleroma/instances/instance_test.exs b/test/pleroma/instances/instance_test.exs index 2c6389e4f..bacc0b19b 100644 --- a/test/pleroma/instances/instance_test.exs +++ b/test/pleroma/instances/instance_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Instances.InstanceTest do diff --git a/test/pleroma/instances_test.exs b/test/pleroma/instances_test.exs index 5d0ce6237..03f9e4e97 100644 --- a/test/pleroma/instances_test.exs +++ b/test/pleroma/instances_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.InstancesTest do diff --git a/test/pleroma/integration/federation_test.exs b/test/pleroma/integration/federation_test.exs index 10d71fb88..da433e2c0 100644 --- a/test/pleroma/integration/federation_test.exs +++ b/test/pleroma/integration/federation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Integration.FederationTest do diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs index 4a7dbda71..43ec57893 100644 --- a/test/pleroma/integration/mastodon_websocket_test.exs +++ b/test/pleroma/integration/mastodon_websocket_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Integration.MastodonWebsocketTest do diff --git a/test/pleroma/job_queue_monitor_test.exs b/test/pleroma/job_queue_monitor_test.exs index 65c1e9f29..eebf602c5 100644 --- a/test/pleroma/job_queue_monitor_test.exs +++ b/test/pleroma/job_queue_monitor_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.JobQueueMonitorTest do diff --git a/test/pleroma/keys_test.exs b/test/pleroma/keys_test.exs index 55a7aa1bc..9a15bf06e 100644 --- a/test/pleroma/keys_test.exs +++ b/test/pleroma/keys_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.KeysTest do diff --git a/test/pleroma/list_test.exs b/test/pleroma/list_test.exs index 854e276f1..7e66ad385 100644 --- a/test/pleroma/list_test.exs +++ b/test/pleroma/list_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ListTest do diff --git a/test/pleroma/marker_test.exs b/test/pleroma/marker_test.exs index 3055f1ce2..5f87a1c38 100644 --- a/test/pleroma/marker_test.exs +++ b/test/pleroma/marker_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MarkerTest do diff --git a/test/pleroma/mfa/backup_codes_test.exs b/test/pleroma/mfa/backup_codes_test.exs index c3eaf40b6..59f984e32 100644 --- a/test/pleroma/mfa/backup_codes_test.exs +++ b/test/pleroma/mfa/backup_codes_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.BackupCodesTest do diff --git a/test/pleroma/mfa/totp_test.exs b/test/pleroma/mfa/totp_test.exs index 8c09bf447..828993866 100644 --- a/test/pleroma/mfa/totp_test.exs +++ b/test/pleroma/mfa/totp_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFA.TOTPTest do diff --git a/test/pleroma/mfa_test.exs b/test/pleroma/mfa_test.exs index cd1f7d0af..29e478892 100644 --- a/test/pleroma/mfa_test.exs +++ b/test/pleroma/mfa_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MFATest do diff --git a/test/pleroma/migration_helper/notification_backfill_test.exs b/test/pleroma/migration_helper/notification_backfill_test.exs index 6fe8a11ac..fd253b530 100644 --- a/test/pleroma/migration_helper/notification_backfill_test.exs +++ b/test/pleroma/migration_helper/notification_backfill_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.MigrationHelper.NotificationBackfillTest do diff --git a/test/pleroma/moderation_log_test.exs b/test/pleroma/moderation_log_test.exs index d1e0e1e6b..c6c170c45 100644 --- a/test/pleroma/moderation_log_test.exs +++ b/test/pleroma/moderation_log_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ModerationLogTest do diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs index a6558f995..0c6ebfb76 100644 --- a/test/pleroma/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.NotificationTest do diff --git a/test/pleroma/object/containment_test.exs b/test/pleroma/object/containment_test.exs index 90b6dccf2..fb2fb7d49 100644 --- a/test/pleroma/object/containment_test.exs +++ b/test/pleroma/object/containment_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Object.ContainmentTest do diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs index 7df6af7fe..d9172a3ec 100644 --- a/test/pleroma/object/fetcher_test.exs +++ b/test/pleroma/object/fetcher_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Object.FetcherTest do diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs index fe7f37e7c..4a8d80fcc 100644 --- a/test/pleroma/object_test.exs +++ b/test/pleroma/object_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ObjectTest do diff --git a/test/pleroma/otp_version_test.exs b/test/pleroma/otp_version_test.exs index 7d2538ec8..736d440af 100644 --- a/test/pleroma/otp_version_test.exs +++ b/test/pleroma/otp_version_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.OTPVersionTest do diff --git a/test/pleroma/pagination_test.exs b/test/pleroma/pagination_test.exs index 5ee1e60ae..bc26c8b46 100644 --- a/test/pleroma/pagination_test.exs +++ b/test/pleroma/pagination_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.PaginationTest do diff --git a/test/pleroma/registration_test.exs b/test/pleroma/registration_test.exs index 462ab452b..6e4ad9487 100644 --- a/test/pleroma/registration_test.exs +++ b/test/pleroma/registration_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.RegistrationTest do diff --git a/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs index 84f520fe4..b4106ef8e 100644 --- a/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs +++ b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.AutolinkerToLinkifyTest do diff --git a/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs b/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs index f1fd89113..b30faa257 100644 --- a/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs +++ b/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do diff --git a/test/pleroma/repo/migrations/fix_legacy_tags_test.exs b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs index adfed1142..0a1d1d0bb 100644 --- a/test/pleroma/repo/migrations/fix_legacy_tags_test.exs +++ b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.FixLegacyTagsTest do diff --git a/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs index 61528599a..30c77e8e6 100644 --- a/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs +++ b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.FixMalformedFormatterConfigTest do diff --git a/test/pleroma/repo/migrations/move_welcome_settings_test.exs b/test/pleroma/repo/migrations/move_welcome_settings_test.exs index 5dbe9d7b0..1da6b8a04 100644 --- a/test/pleroma/repo/migrations/move_welcome_settings_test.exs +++ b/test/pleroma/repo/migrations/move_welcome_settings_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.MoveWelcomeSettingsTest do diff --git a/test/pleroma/repo_test.exs b/test/pleroma/repo_test.exs index eaddef3a6..9e14bdbd1 100644 --- a/test/pleroma/repo_test.exs +++ b/test/pleroma/repo_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.RepoTest do diff --git a/test/pleroma/report_note_test.exs b/test/pleroma/report_note_test.exs index cc4561eea..2620560a0 100644 --- a/test/pleroma/report_note_test.exs +++ b/test/pleroma/report_note_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReportNoteTest do diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index 0a2c169ce..499d29c06 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ReverseProxyTest do diff --git a/test/pleroma/runtime_test.exs b/test/pleroma/runtime_test.exs index 010594fcd..b9e769602 100644 --- a/test/pleroma/runtime_test.exs +++ b/test/pleroma/runtime_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.RuntimeTest do diff --git a/test/pleroma/safe_jsonb_set_test.exs b/test/pleroma/safe_jsonb_set_test.exs index 6d70f1026..69d696c1b 100644 --- a/test/pleroma/safe_jsonb_set_test.exs +++ b/test/pleroma/safe_jsonb_set_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.SafeJsonbSetTest do diff --git a/test/pleroma/scheduled_activity_test.exs b/test/pleroma/scheduled_activity_test.exs index 7faa5660d..b84ddcb8e 100644 --- a/test/pleroma/scheduled_activity_test.exs +++ b/test/pleroma/scheduled_activity_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.ScheduledActivityTest do diff --git a/test/pleroma/signature_test.exs b/test/pleroma/signature_test.exs index a7a75aa4d..047c537e0 100644 --- a/test/pleroma/signature_test.exs +++ b/test/pleroma/signature_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.SignatureTest do diff --git a/test/pleroma/stats_test.exs b/test/pleroma/stats_test.exs index 6c2fd5726..fd3195969 100644 --- a/test/pleroma/stats_test.exs +++ b/test/pleroma/stats_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.StatsTest do diff --git a/test/pleroma/upload/filter/anonymize_filename_test.exs b/test/pleroma/upload/filter/anonymize_filename_test.exs index 7ef01ce91..2a067fc4b 100644 --- a/test/pleroma/upload/filter/anonymize_filename_test.exs +++ b/test/pleroma/upload/filter/anonymize_filename_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do diff --git a/test/pleroma/upload/filter/dedupe_test.exs b/test/pleroma/upload/filter/dedupe_test.exs index 6559cbb50..f00ba12f9 100644 --- a/test/pleroma/upload/filter/dedupe_test.exs +++ b/test/pleroma/upload/filter/dedupe_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.DedupeTest do diff --git a/test/pleroma/upload/filter/exiftool_test.exs b/test/pleroma/upload/filter/exiftool_test.exs index b5a5ba18d..cfbe34be8 100644 --- a/test/pleroma/upload/filter/exiftool_test.exs +++ b/test/pleroma/upload/filter/exiftool_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.ExiftoolTest do diff --git a/test/pleroma/upload/filter/mogrifun_test.exs b/test/pleroma/upload/filter/mogrifun_test.exs index fc2f68276..d2b183e90 100644 --- a/test/pleroma/upload/filter/mogrifun_test.exs +++ b/test/pleroma/upload/filter/mogrifun_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.MogrifunTest do diff --git a/test/pleroma/upload/filter/mogrify_test.exs b/test/pleroma/upload/filter/mogrify_test.exs index 6dee02e8b..d62cd83b4 100644 --- a/test/pleroma/upload/filter/mogrify_test.exs +++ b/test/pleroma/upload/filter/mogrify_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.Filter.MogrifyTest do diff --git a/test/pleroma/upload/filter_test.exs b/test/pleroma/upload/filter_test.exs index 09394929c..58c842080 100644 --- a/test/pleroma/upload/filter_test.exs +++ b/test/pleroma/upload/filter_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Upload.FilterTest do diff --git a/test/pleroma/upload_test.exs b/test/pleroma/upload_test.exs index f52d4dff6..8feb532d3 100644 --- a/test/pleroma/upload_test.exs +++ b/test/pleroma/upload_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UploadTest do diff --git a/test/pleroma/uploaders/local_test.exs b/test/pleroma/uploaders/local_test.exs index 5b377d580..0a5952f50 100644 --- a/test/pleroma/uploaders/local_test.exs +++ b/test/pleroma/uploaders/local_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Uploaders.LocalTest do diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index 344cf7abe..9c937d251 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Uploaders.S3Test do diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index f68e4a029..7fb4c5fbe 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.BackupTest do diff --git a/test/pleroma/user/import_test.exs b/test/pleroma/user/import_test.exs index e198cdc08..a84fce337 100644 --- a/test/pleroma/user/import_test.exs +++ b/test/pleroma/user/import_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.ImportTest do diff --git a/test/pleroma/user/notification_setting_test.exs b/test/pleroma/user/notification_setting_test.exs index 701130380..6cb8803d9 100644 --- a/test/pleroma/user/notification_setting_test.exs +++ b/test/pleroma/user/notification_setting_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.NotificationSettingTest do diff --git a/test/pleroma/user/query_test.exs b/test/pleroma/user/query_test.exs index e2f5c7d81..357016e3e 100644 --- a/test/pleroma/user/query_test.exs +++ b/test/pleroma/user/query_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.QueryTest do diff --git a/test/pleroma/user/welcome_chat_message_test.exs b/test/pleroma/user/welcome_chat_message_test.exs index 0b744fc1b..06b044a32 100644 --- a/test/pleroma/user/welcome_chat_message_test.exs +++ b/test/pleroma/user/welcome_chat_message_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.WelcomeChatMessageTest do diff --git a/test/pleroma/user/welcome_email_test.exs b/test/pleroma/user/welcome_email_test.exs index d005d11b2..fbfc0b45e 100644 --- a/test/pleroma/user/welcome_email_test.exs +++ b/test/pleroma/user/welcome_email_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.WelcomeEmailTest do diff --git a/test/pleroma/user/welcome_message_test.exs b/test/pleroma/user/welcome_message_test.exs index a1779ddec..cf43a0fa4 100644 --- a/test/pleroma/user/welcome_message_test.exs +++ b/test/pleroma/user/welcome_message_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.User.WelcomeMessageTest do diff --git a/test/pleroma/user_invite_token_test.exs b/test/pleroma/user_invite_token_test.exs index 63f18f13c..233d4e864 100644 --- a/test/pleroma/user_invite_token_test.exs +++ b/test/pleroma/user_invite_token_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UserInviteTokenTest do diff --git a/test/pleroma/user_relationship_test.exs b/test/pleroma/user_relationship_test.exs index da4982065..b2b074607 100644 --- a/test/pleroma/user_relationship_test.exs +++ b/test/pleroma/user_relationship_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UserRelationshipTest do diff --git a/test/pleroma/user_search_test.exs b/test/pleroma/user_search_test.exs index accb0b816..78f042e55 100644 --- a/test/pleroma/user_search_test.exs +++ b/test/pleroma/user_search_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UserSearchTest do diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index f0f5d6071..bdf17e96a 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UserTest do diff --git a/test/pleroma/utils_test.exs b/test/pleroma/utils_test.exs index 460f7e0b5..c593a9490 100644 --- a/test/pleroma/utils_test.exs +++ b/test/pleroma/utils_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.UtilsTest do diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 03aed794f..e0cd28303 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 98242ff63..24576b31a 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ActivityPubTest do diff --git a/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs b/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs index e7370d4ef..47b07fdd9 100644 --- a/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/activity_expiration_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs index 49bbc271d..d5af3a9b6 100644 --- a/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs index 6867c9853..5b990451c 100644 --- a/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/anti_link_spam_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.AntiLinkSpamPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs index 19ea491c0..89439b65f 100644 --- a/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs +++ b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.EnsureRePrependedTest do diff --git a/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs index b5f401ad2..e3325d144 100644 --- a/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs index 26f5bcdaa..2cd3e0329 100644 --- a/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs index b3d0f3d90..b44e6c60f 100644 --- a/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs index 84362ce78..96e715d0d 100644 --- a/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs index 220309cc9..b1d0f587c 100644 --- a/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.MentionPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs index d03456b34..81a6e0f50 100644 --- a/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs index 5fccf7760..edc330b6c 100644 --- a/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs +++ b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkupTest do diff --git a/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs index e8317b2af..9178ca2b1 100644 --- a/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs index e08eb3ba6..8e14b21ef 100644 --- a/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs +++ b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.RejectNonPublicTest do diff --git a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs index d7dde62c4..60a20a80e 100644 --- a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs index 7665d00d0..bae57f29a 100644 --- a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs index fff66cb7e..b3427c6fd 100644 --- a/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs index 4f289739f..66e98b7ee 100644 --- a/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs index 8e1ad5bc8..0e852731e 100644 --- a/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.UserAllowListPolicyTest do use Pleroma.DataCase diff --git a/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs index 2bceb67ee..d368d70b7 100644 --- a/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do diff --git a/test/pleroma/web/activity_pub/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs index 44a9cf086..7c1eef7e0 100644 --- a/test/pleroma/web/activity_pub/mrf_test.exs +++ b/test/pleroma/web/activity_pub/mrf_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.MRFTest do diff --git a/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs index bafa2a672..ddb302f6e 100644 --- a/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs index da60ac844..939922127 100644 --- a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs index 1f992b397..e408c85c3 100644 --- a/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidatorTest do diff --git a/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs index 45e1d8852..b775515e0 100644 --- a/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidatorTest do diff --git a/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs index d133aeb1a..ad6190892 100644 --- a/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.BlockValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs index 941a8a3e3..782f6c652 100644 --- a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.ChatValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs index 57de83c8a..7ae4399ed 100644 --- a/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.DeleteValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs index 342cfeef8..7fd98266a 100644 --- a/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactHandlingTest do diff --git a/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs index 0f77ac8df..d2a9b72a5 100644 --- a/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.FollowValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs index 4cda3742d..55f67232e 100644 --- a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs index 69f5e8ac4..562656a5f 100644 --- a/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.RejectValidationTest do diff --git a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs index dc85d1ac3..505ca2d2f 100644 --- a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.UndoHandlingTest do diff --git a/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs index 2c4a50bfd..15e4a82cd 100644 --- a/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do diff --git a/test/pleroma/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs index d568d825b..52fa933ee 100644 --- a/test/pleroma/web/activity_pub/pipeline_test.exs +++ b/test/pleroma/web/activity_pub/pipeline_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.PipelineTest do diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs index 6d15e1640..f0ce3d7f2 100644 --- a/test/pleroma/web/activity_pub/publisher_test.exs +++ b/test/pleroma/web/activity_pub/publisher_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.PublisherTest do diff --git a/test/pleroma/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs index a7cd732bb..2aa07d1b5 100644 --- a/test/pleroma/web/activity_pub/relay_test.exs +++ b/test/pleroma/web/activity_pub/relay_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.RelayTest do diff --git a/test/pleroma/web/activity_pub/side_effects/delete_test.exs b/test/pleroma/web/activity_pub/side_effects/delete_test.exs index cb11f93cd..35ced375b 100644 --- a/test/pleroma/web/activity_pub/side_effects/delete_test.exs +++ b/test/pleroma/web/activity_pub/side_effects/delete_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.SideEffects.DeleteTest do diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 50af7a507..2d94f07c9 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.SideEffectsTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs index d356fcc72..58490076d 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs index 6ec7e1a0a..1886fea3f 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnnounceHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs index c6483ccaf..9c2ef547b 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.AnswerHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs index 26216f7fc..5dbc5eb95 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.ArticleHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs index ac80d0ddd..e733f167d 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.AudioHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs index 6adad88f5..70da06d2e 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.BlockHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs index 2adaa1ade..a2d64620d 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.ChatMessageTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs index 6dd508894..33132dff6 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.DeleteHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs index 1ebf6b1e8..20424ee82 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs index d7c55cfbe..c4879fda1 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.EventHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs index 985c26def..67d441b85 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.FollowHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs index 35211b8f2..57d74349a 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.LikeHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index b61e5013a..108f27ef7 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs index ae470f984..32cf51e59 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs index 851236758..355e664d4 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs index 107121ef8..f6e40722c 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.UndoHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs index 8ed5e5e90..b1a064772 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.UserUpdateHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs index be4ac4c13..c00df6a04 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.Transmogrifier.VideoHandlingTest do diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index c32ea9ae4..7c97fa8f8 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs index 83668caa4..ee3e1014e 100644 --- a/test/pleroma/web/activity_pub/utils_test.exs +++ b/test/pleroma/web/activity_pub/utils_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.UtilsTest do diff --git a/test/pleroma/web/activity_pub/views/object_view_test.exs b/test/pleroma/web/activity_pub/views/object_view_test.exs index 967acad19..923515dec 100644 --- a/test/pleroma/web/activity_pub/views/object_view_test.exs +++ b/test/pleroma/web/activity_pub/views/object_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.ObjectViewTest do diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs index 5702c1b6f..f2de4d332 100644 --- a/test/pleroma/web/activity_pub/views/user_view_test.exs +++ b/test/pleroma/web/activity_pub/views/user_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.UserViewTest do diff --git a/test/pleroma/web/activity_pub/visibility_test.exs b/test/pleroma/web/activity_pub/visibility_test.exs index 1ec41aa19..d8544279a 100644 --- a/test/pleroma/web/activity_pub/visibility_test.exs +++ b/test/pleroma/web/activity_pub/visibility_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ActivityPub.VisibilityTest do 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 90b25b782..c54402e52 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 @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.AdminAPIControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs index 00e67a91c..0e8f7beef 100644 --- a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ChatControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index df5d74d45..75ca892aa 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs index 94873f6db..bc827cc12 100644 --- a/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs b/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs index ce867dd0e..e100f6929 100644 --- a/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/instance_document_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.InstanceDocumentControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/invite_controller_test.exs b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs index ab186c5e7..0f3ca44bc 100644 --- a/test/pleroma/web/admin_api/controllers/invite_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.InviteControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs index 62fb9592a..db935ad12 100644 --- a/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs index f388375d1..8c7b63f34 100644 --- a/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/o_auth_app_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.OAuthAppControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/relay_controller_test.exs b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs index 379067a62..11a480cc0 100644 --- a/test/pleroma/web/admin_api/controllers/relay_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.RelayControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs index 2ab2f2f6d..6a2986b5f 100644 --- a/test/pleroma/web/admin_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/report_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ReportControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs index 40714c8a4..976990d5c 100644 --- a/test/pleroma/web/admin_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.StatusControllerTest do diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 67b0c578c..40d39aae7 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.UserControllerTest do diff --git a/test/pleroma/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs index fdf22a8e6..307578ae0 100644 --- a/test/pleroma/web/admin_api/search_test.exs +++ b/test/pleroma/web/admin_api/search_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.SearchTest do diff --git a/test/pleroma/web/admin_api/views/account_view_test.exs b/test/pleroma/web/admin_api/views/account_view_test.exs index f54214575..025726c73 100644 --- a/test/pleroma/web/admin_api/views/account_view_test.exs +++ b/test/pleroma/web/admin_api/views/account_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.AccountViewTest do diff --git a/test/pleroma/web/admin_api/views/moderation_log_view_test.exs b/test/pleroma/web/admin_api/views/moderation_log_view_test.exs index a4748990e..4efe4c4c8 100644 --- a/test/pleroma/web/admin_api/views/moderation_log_view_test.exs +++ b/test/pleroma/web/admin_api/views/moderation_log_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ModerationLogViewTest do use Pleroma.DataCase, async: true diff --git a/test/pleroma/web/admin_api/views/report_view_test.exs b/test/pleroma/web/admin_api/views/report_view_test.exs index 3914751b5..093e2d95d 100644 --- a/test/pleroma/web/admin_api/views/report_view_test.exs +++ b/test/pleroma/web/admin_api/views/report_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.AdminAPI.ReportViewTest do diff --git a/test/pleroma/web/api_spec/schema_examples_test.exs b/test/pleroma/web/api_spec/schema_examples_test.exs index f00e834fc..981890d77 100644 --- a/test/pleroma/web/api_spec/schema_examples_test.exs +++ b/test/pleroma/web/api_spec/schema_examples_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.SchemaExamplesTest do diff --git a/test/pleroma/web/auth/auth_controller_test.exs b/test/pleroma/web/auth/auth_controller_test.exs index 498554060..a869389e3 100644 --- a/test/pleroma/web/auth/auth_controller_test.exs +++ b/test/pleroma/web/auth/auth_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.AuthControllerTest do diff --git a/test/pleroma/web/auth/authenticator_test.exs b/test/pleroma/web/auth/authenticator_test.exs index 862eb8051..e1f30e835 100644 --- a/test/pleroma/web/auth/authenticator_test.exs +++ b/test/pleroma/web/auth/authenticator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.AuthenticatorTest do diff --git a/test/pleroma/web/auth/basic_auth_test.exs b/test/pleroma/web/auth/basic_auth_test.exs index e56c1e1e8..f732c7e27 100644 --- a/test/pleroma/web/auth/basic_auth_test.exs +++ b/test/pleroma/web/auth/basic_auth_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.BasicAuthTest do diff --git a/test/pleroma/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs index 4539ffe87..477cf26ed 100644 --- a/test/pleroma/web/auth/pleroma_authenticator_test.exs +++ b/test/pleroma/web/auth/pleroma_authenticator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do diff --git a/test/pleroma/web/auth/totp_authenticator_test.exs b/test/pleroma/web/auth/totp_authenticator_test.exs index 7f99d62bf..583612454 100644 --- a/test/pleroma/web/auth/totp_authenticator_test.exs +++ b/test/pleroma/web/auth/totp_authenticator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Auth.TOTPAuthenticatorTest do diff --git a/test/pleroma/web/chat_channel_test.exs b/test/pleroma/web/chat_channel_test.exs index 32170873d..e8c3d965e 100644 --- a/test/pleroma/web/chat_channel_test.exs +++ b/test/pleroma/web/chat_channel_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ChatChannelTest do diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs index 4d6c9ea26..f2043e152 100644 --- a/test/pleroma/web/common_api/utils_test.exs +++ b/test/pleroma/web/common_api/utils_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.CommonAPI.UtilsTest do diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 56a3d6531..2ece92806 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.CommonAPITest do diff --git a/test/pleroma/web/endpoint/metrics_exporter_test.exs b/test/pleroma/web/endpoint/metrics_exporter_test.exs index d0cae3d42..376e82149 100644 --- a/test/pleroma/web/endpoint/metrics_exporter_test.exs +++ b/test/pleroma/web/endpoint/metrics_exporter_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Endpoint.MetricsExporterTest do diff --git a/test/pleroma/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs index 46c7bad1c..512baf813 100644 --- a/test/pleroma/web/fallback_test.exs +++ b/test/pleroma/web/fallback_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.FallbackTest do diff --git a/test/pleroma/web/federator_test.exs b/test/pleroma/web/federator_test.exs index 67001add7..1bff8d99c 100644 --- a/test/pleroma/web/federator_test.exs +++ b/test/pleroma/web/federator_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.FederatorTest do diff --git a/test/pleroma/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs index 48dc3b404..aeec89b06 100644 --- a/test/pleroma/web/feed/tag_controller_test.exs +++ b/test/pleroma/web/feed/tag_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Feed.TagControllerTest do diff --git a/test/pleroma/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs index 50445862b..66667783d 100644 --- a/test/pleroma/web/feed/user_controller_test.exs +++ b/test/pleroma/web/feed/user_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Feed.UserControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index cc7b3cf8b..7b3cc7344 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs index a0b8b126c..238fd265b 100644 --- a/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AppControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs index ce957054b..27c0fceff 100644 --- a/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AuthControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs index a03513e06..29bc4fd17 100644 --- a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs index ab0027f90..cbb1d54a6 100644 --- a/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/custom_emoji_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.CustomEmojiControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs index b10aa6966..0c3a7c0cf 100644 --- a/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.DomainBlockControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs index e639cdde1..dc6739178 100644 --- a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs index f0a466212..069ffb3d6 100644 --- a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs index 71a170240..1d0f86e87 100644 --- a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs index 01f64cfcc..cc5e1e66d 100644 --- a/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ListControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs index ee944a67c..53aebe8e4 100644 --- a/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs index d2bd57515..6c8f984d5 100644 --- a/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/media_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MediaControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs index 9ac8488f6..631e5c4fc 100644 --- a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.NotificationControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs index 71cea8462..95df48ab0 100644 --- a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.PollControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs index 322eb475c..fcfc4a48a 100644 --- a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ReportControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs index 1ff871c89..a5aa72f6f 100644 --- a/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ScheduledActivityControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs index 664bdce01..1dd0fa3b8 100644 --- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SearchControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index ffff0ae9d..8a2267099 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs index 4bb085750..5a3f93d2d 100644 --- a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs index c3471266a..168966fc9 100644 --- a/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 655e35ac6..664375fef 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.TimelineControllerTest do diff --git a/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs index b9cd050df..a8ad025c9 100644 --- a/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs +++ b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MastoFEControllerTest do diff --git a/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs index be5bf68a3..c6332bd3e 100644 --- a/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs +++ b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do diff --git a/test/pleroma/web/mastodon_api/mastodon_api_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_test.exs index cf7f464be..f14330908 100644 --- a/test/pleroma/web/mastodon_api/mastodon_api_test.exs +++ b/test/pleroma/web/mastodon_api/mastodon_api_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MastodonAPITest do diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs index e3e437a19..cfbe6cf0e 100644 --- a/test/pleroma/web/mastodon_api/update_credentials_test.exs +++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index f9afd0afc..32fe08196 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AccountViewTest do diff --git a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs index f02253b68..9639e95d2 100644 --- a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ConversationViewTest do diff --git a/test/pleroma/web/mastodon_api/views/list_view_test.exs b/test/pleroma/web/mastodon_api/views/list_view_test.exs index 377941332..a62495ebb 100644 --- a/test/pleroma/web/mastodon_api/views/list_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/list_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ListViewTest do diff --git a/test/pleroma/web/mastodon_api/views/marker_view_test.exs b/test/pleroma/web/mastodon_api/views/marker_view_test.exs index a0bec758f..8d8c16f6c 100644 --- a/test/pleroma/web/mastodon_api/views/marker_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/marker_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.MarkerViewTest do diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 79dd23a51..965044fd3 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do diff --git a/test/pleroma/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs index f83e5b368..a8600e1c2 100644 --- a/test/pleroma/web/mastodon_api/views/poll_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/poll_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.PollViewTest do diff --git a/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs index c41ac7f7f..c3b7f0f41 100644 --- a/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.ScheduledActivityViewTest do 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 789acb487..21a01658e 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.StatusViewTest do diff --git a/test/pleroma/web/mastodon_api/views/subscription_view_test.exs b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs index c2bb535c5..04b440389 100644 --- a/test/pleroma/web/mastodon_api/views/subscription_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do diff --git a/test/pleroma/web/media_proxy/invalidation/http_test.exs b/test/pleroma/web/media_proxy/invalidation/http_test.exs index c81010423..a15103c89 100644 --- a/test/pleroma/web/media_proxy/invalidation/http_test.exs +++ b/test/pleroma/web/media_proxy/invalidation/http_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.Invalidation.HttpTest do diff --git a/test/pleroma/web/media_proxy/invalidation/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs index 6940a4539..bcb6ab73c 100644 --- a/test/pleroma/web/media_proxy/invalidation/script_test.exs +++ b/test/pleroma/web/media_proxy/invalidation/script_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do diff --git a/test/pleroma/web/media_proxy/invalidation_test.exs b/test/pleroma/web/media_proxy/invalidation_test.exs index b7be36b47..8fb026847 100644 --- a/test/pleroma/web/media_proxy/invalidation_test.exs +++ b/test/pleroma/web/media_proxy/invalidation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.InvalidationTest do diff --git a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs index 65cf2a01b..56a94e09a 100644 --- a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs +++ b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do diff --git a/test/pleroma/web/media_proxy_test.exs b/test/pleroma/web/media_proxy_test.exs index 0e6df826c..7411d0a7a 100644 --- a/test/pleroma/web/media_proxy_test.exs +++ b/test/pleroma/web/media_proxy_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MediaProxyTest do diff --git a/test/pleroma/web/metadata/player_view_test.exs b/test/pleroma/web/metadata/player_view_test.exs index 6d22317d2..58caf6efd 100644 --- a/test/pleroma/web/metadata/player_view_test.exs +++ b/test/pleroma/web/metadata/player_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.PlayerViewTest do diff --git a/test/pleroma/web/metadata/providers/feed_test.exs b/test/pleroma/web/metadata/providers/feed_test.exs index c7359e00b..013d42498 100644 --- a/test/pleroma/web/metadata/providers/feed_test.exs +++ b/test/pleroma/web/metadata/providers/feed_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.FeedTest do diff --git a/test/pleroma/web/metadata/providers/open_graph_test.exs b/test/pleroma/web/metadata/providers/open_graph_test.exs index 218540e6c..e0f615785 100644 --- a/test/pleroma/web/metadata/providers/open_graph_test.exs +++ b/test/pleroma/web/metadata/providers/open_graph_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.OpenGraphTest do diff --git a/test/pleroma/web/metadata/providers/rel_me_test.exs b/test/pleroma/web/metadata/providers/rel_me_test.exs index ae449c052..0db6e7d22 100644 --- a/test/pleroma/web/metadata/providers/rel_me_test.exs +++ b/test/pleroma/web/metadata/providers/rel_me_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.RelMeTest do diff --git a/test/pleroma/web/metadata/providers/restrict_indexing_test.exs b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs index 52399fdc8..aa253e5e2 100644 --- a/test/pleroma/web/metadata/providers/restrict_indexing_test.exs +++ b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.RestrictIndexingTest do diff --git a/test/pleroma/web/metadata/providers/twitter_card_test.exs b/test/pleroma/web/metadata/providers/twitter_card_test.exs index 10931b5ba..3c70a1562 100644 --- a/test/pleroma/web/metadata/providers/twitter_card_test.exs +++ b/test/pleroma/web/metadata/providers/twitter_card_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.Providers.TwitterCardTest do diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs index 3794db766..074bd2e2f 100644 --- a/test/pleroma/web/metadata/utils_test.exs +++ b/test/pleroma/web/metadata/utils_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Metadata.UtilsTest do diff --git a/test/pleroma/web/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs index 4590e1296..031db53c8 100644 --- a/test/pleroma/web/mongoose_im_controller_test.exs +++ b/test/pleroma/web/mongoose_im_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MongooseIMControllerTest do diff --git a/test/pleroma/web/node_info_test.exs b/test/pleroma/web/node_info_test.exs index 06b33607f..888b62791 100644 --- a/test/pleroma/web/node_info_test.exs +++ b/test/pleroma/web/node_info_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.NodeInfoTest do diff --git a/test/pleroma/web/o_auth/app_test.exs b/test/pleroma/web/o_auth/app_test.exs index 24d7049f1..fc2f0d940 100644 --- a/test/pleroma/web/o_auth/app_test.exs +++ b/test/pleroma/web/o_auth/app_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.AppTest do diff --git a/test/pleroma/web/o_auth/authorization_test.exs b/test/pleroma/web/o_auth/authorization_test.exs index d1920962c..fc1c04c4c 100644 --- a/test/pleroma/web/o_auth/authorization_test.exs +++ b/test/pleroma/web/o_auth/authorization_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.AuthorizationTest do diff --git a/test/pleroma/web/o_auth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs index 63b1c0eb8..4a2e940fd 100644 --- a/test/pleroma/web/o_auth/ldap_authorization_test.exs +++ b/test/pleroma/web/o_auth/ldap_authorization_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do diff --git a/test/pleroma/web/o_auth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs index bc50d8d18..9fc1e0ec2 100644 --- a/test/pleroma/web/o_auth/mfa_controller_test.exs +++ b/test/pleroma/web/o_auth/mfa_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2018 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.MFAControllerTest do diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index ac22856ea..f01fdf660 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.OAuthControllerTest do diff --git a/test/pleroma/web/o_auth/token/utils_test.exs b/test/pleroma/web/o_auth/token/utils_test.exs index 3444692ec..d2e7a0904 100644 --- a/test/pleroma/web/o_auth/token/utils_test.exs +++ b/test/pleroma/web/o_auth/token/utils_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.Token.UtilsTest do diff --git a/test/pleroma/web/o_auth/token_test.exs b/test/pleroma/web/o_auth/token_test.exs index 866f1c00a..8c0858ebc 100644 --- a/test/pleroma/web/o_auth/token_test.exs +++ b/test/pleroma/web/o_auth/token_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OAuth.TokenTest do diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs index f21180a89..5cdca019a 100644 --- a/test/pleroma/web/o_status/o_status_controller_test.exs +++ b/test/pleroma/web/o_status/o_status_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.OStatus.OStatusControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index 07909d48b..baf2d01ab 100644 --- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/backup_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/backup_controller_test.exs index f1941f6dd..3ee660a05 100644 --- a/test/pleroma/web/pleroma_api/controllers/backup_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/backup_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.BackupControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index d0b520fbc..372613b8b 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ChatControllerTest do use Pleroma.Web.ConnCase diff --git a/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs index c8c2433ae..98a23aaaa 100644 --- a/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ConversationControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs index 6fbdaec7a..8f0da00c0 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs index d9385389b..5c2473955 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs index bda9c20c6..28483985c 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.EmojiReactionControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs index 13491ed9c..54cf9d083 100644 --- a/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/instances_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaApi.InstancesControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs index 5f8fa03f6..0011ddd54 100644 --- a/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.MascotControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs index 03af4d70c..08f374908 100644 --- a/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.NotificationControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs index 4ab6d9132..d4546f442 100644 --- a/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs index 8d4e0104a..24074f4e5 100644 --- a/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationControllerTest do diff --git a/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs index d83d33912..25a7f8374 100644 --- a/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.UserImportControllerTest do diff --git a/test/pleroma/web/pleroma_api/views/backup_view_test.exs b/test/pleroma/web/pleroma_api/views/backup_view_test.exs index 7dda8480b..9b4298dd1 100644 --- a/test/pleroma/web/pleroma_api/views/backup_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/backup_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.BackupViewTest do diff --git a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs index 0966e9166..6deaa2102 100644 --- a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ChatMessageReferenceViewTest do diff --git a/test/pleroma/web/pleroma_api/views/chat_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_view_test.exs index 1cc5f16ba..5456c2de0 100644 --- a/test/pleroma/web/pleroma_api/views/chat_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/chat_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ChatViewTest do diff --git a/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs index 113b8f690..382051f6f 100644 --- a/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs +++ b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.PleromaAPI.ScrobbleViewTest do diff --git a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs index 23498badf..665c1962e 100644 --- a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.AdminSecretAuthenticationPlugTest do diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 3dedd38b2..9d66681ce 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do diff --git a/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs index 2d6af228c..e90078eb5 100644 --- a/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs +++ b/test/pleroma/web/plugs/basic_auth_decoder_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.BasicAuthDecoderPlugTest do diff --git a/test/pleroma/web/plugs/cache_control_test.exs b/test/pleroma/web/plugs/cache_control_test.exs index c775787ca..263961897 100644 --- a/test/pleroma/web/plugs/cache_control_test.exs +++ b/test/pleroma/web/plugs/cache_control_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.CacheControlTest do diff --git a/test/pleroma/web/plugs/cache_test.exs b/test/pleroma/web/plugs/cache_test.exs index 0e5fa6f36..0ceab6cab 100644 --- a/test/pleroma/web/plugs/cache_test.exs +++ b/test/pleroma/web/plugs/cache_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.CacheTest do diff --git a/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs index 92ff19282..6b3ee3d87 100644 --- a/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_authenticated_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlugTest do diff --git a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs index 9f15f5c93..33d0f64e9 100644 --- a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do diff --git a/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs b/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs index 9592820c7..28ec67158 100644 --- a/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsureUserTokenAssignsPlugTest do diff --git a/test/pleroma/web/plugs/federating_plug_test.exs b/test/pleroma/web/plugs/federating_plug_test.exs index a4652f6c5..9c3426862 100644 --- a/test/pleroma/web/plugs/federating_plug_test.exs +++ b/test/pleroma/web/plugs/federating_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.FederatingPlugTest do diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs index 8b7b022fc..c8cfc967c 100644 --- a/test/pleroma/web/plugs/frontend_static_plug_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do diff --git a/test/pleroma/web/plugs/http_security_plug_test.exs b/test/pleroma/web/plugs/http_security_plug_test.exs index df2b5ebb3..4233e85c0 100644 --- a/test/pleroma/web/plugs/http_security_plug_test.exs +++ b/test/pleroma/web/plugs/http_security_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do diff --git a/test/pleroma/web/plugs/http_signature_plug_test.exs b/test/pleroma/web/plugs/http_signature_plug_test.exs index e6cbde803..bb3257dc9 100644 --- a/test/pleroma/web/plugs/http_signature_plug_test.exs +++ b/test/pleroma/web/plugs/http_signature_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.HTTPSignaturePlugTest do diff --git a/test/pleroma/web/plugs/idempotency_plug_test.exs b/test/pleroma/web/plugs/idempotency_plug_test.exs index ed8b3fc1a..dd8cda664 100644 --- a/test/pleroma/web/plugs/idempotency_plug_test.exs +++ b/test/pleroma/web/plugs/idempotency_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.IdempotencyPlugTest do diff --git a/test/pleroma/web/plugs/instance_static_test.exs b/test/pleroma/web/plugs/instance_static_test.exs index 5b30011d3..46f2ca6b1 100644 --- a/test/pleroma/web/plugs/instance_static_test.exs +++ b/test/pleroma/web/plugs/instance_static_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.InstanceStaticTest do diff --git a/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs b/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs index 0ad3c2929..00ce6492d 100644 --- a/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs +++ b/test/pleroma/web/plugs/mapped_signature_to_identity_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.MappedSignatureToIdentityPlugTest do diff --git a/test/pleroma/web/plugs/o_auth_plug_test.exs b/test/pleroma/web/plugs/o_auth_plug_test.exs index 1186cdb14..9e4be5559 100644 --- a/test/pleroma/web/plugs/o_auth_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.OAuthPlugTest do diff --git a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index 982a70bf9..1703830ce 100644 --- a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.OAuthScopesPlugTest do diff --git a/test/pleroma/web/plugs/plug_helper_test.exs b/test/pleroma/web/plugs/plug_helper_test.exs index 670d699f0..346113628 100644 --- a/test/pleroma/web/plugs/plug_helper_test.exs +++ b/test/pleroma/web/plugs/plug_helper_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.PlugHelperTest do diff --git a/test/pleroma/web/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs index 249c78b37..3cac10b0e 100644 --- a/test/pleroma/web/plugs/rate_limiter_test.exs +++ b/test/pleroma/web/plugs/rate_limiter_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.RateLimiterTest do diff --git a/test/pleroma/web/plugs/remote_ip_test.exs b/test/pleroma/web/plugs/remote_ip_test.exs index 0bdb4c168..b7fc24db0 100644 --- a/test/pleroma/web/plugs/remote_ip_test.exs +++ b/test/pleroma/web/plugs/remote_ip_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.RemoteIpTest do diff --git a/test/pleroma/web/plugs/set_format_plug_test.exs b/test/pleroma/web/plugs/set_format_plug_test.exs index e95d751fa..21043f698 100644 --- a/test/pleroma/web/plugs/set_format_plug_test.exs +++ b/test/pleroma/web/plugs/set_format_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.SetFormatPlugTest do diff --git a/test/pleroma/web/plugs/set_locale_plug_test.exs b/test/pleroma/web/plugs/set_locale_plug_test.exs index 773f48a5b..5261e67ae 100644 --- a/test/pleroma/web/plugs/set_locale_plug_test.exs +++ b/test/pleroma/web/plugs/set_locale_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.SetLocalePlugTest do diff --git a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs index 21417d0e7..9814c80d8 100644 --- a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs +++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do diff --git a/test/pleroma/web/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs index bae9208ec..75f313282 100644 --- a/test/pleroma/web/plugs/uploaded_media_plug_test.exs +++ b/test/pleroma/web/plugs/uploaded_media_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UploadedMediaPlugTest do diff --git a/test/pleroma/web/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs index e9c9e5f3e..bee413fbf 100644 --- a/test/pleroma/web/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UserEnabledPlugTest do diff --git a/test/pleroma/web/plugs/user_fetcher_plug_test.exs b/test/pleroma/web/plugs/user_fetcher_plug_test.exs index b4f875d2d..902bee642 100644 --- a/test/pleroma/web/plugs/user_fetcher_plug_test.exs +++ b/test/pleroma/web/plugs/user_fetcher_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UserFetcherPlugTest do diff --git a/test/pleroma/web/plugs/user_is_admin_plug_test.exs b/test/pleroma/web/plugs/user_is_admin_plug_test.exs index b550568c1..58996d5a4 100644 --- a/test/pleroma/web/plugs/user_is_admin_plug_test.exs +++ b/test/pleroma/web/plugs/user_is_admin_plug_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.UserIsAdminPlugTest do diff --git a/test/pleroma/web/preload/providers/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs index 6033899b0..a401475ee 100644 --- a/test/pleroma/web/preload/providers/instance_test.exs +++ b/test/pleroma/web/preload/providers/instance_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.InstanceTest do diff --git a/test/pleroma/web/preload/providers/timeline_test.exs b/test/pleroma/web/preload/providers/timeline_test.exs index 3b1f2f1aa..2ae2ca5fb 100644 --- a/test/pleroma/web/preload/providers/timeline_test.exs +++ b/test/pleroma/web/preload/providers/timeline_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.TimelineTest do diff --git a/test/pleroma/web/preload/providers/user_test.exs b/test/pleroma/web/preload/providers/user_test.exs index 6be03af79..b7017ac20 100644 --- a/test/pleroma/web/preload/providers/user_test.exs +++ b/test/pleroma/web/preload/providers/user_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Preload.Providers.UserTest do diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs index d14e0bdef..b3ca1a337 100644 --- a/test/pleroma/web/push/impl_test.exs +++ b/test/pleroma/web/push/impl_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Push.ImplTest do diff --git a/test/pleroma/web/rel_me_test.exs b/test/pleroma/web/rel_me_test.exs index 811cb0893..313b163b5 100644 --- a/test/pleroma/web/rel_me_test.exs +++ b/test/pleroma/web/rel_me_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RelMeTest do diff --git a/test/pleroma/web/rich_media/helpers_test.exs b/test/pleroma/web/rich_media/helpers_test.exs index 4c9ee77d0..efa4c91e4 100644 --- a/test/pleroma/web/rich_media/helpers_test.exs +++ b/test/pleroma/web/rich_media/helpers_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.HelpersTest do diff --git a/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs index 242521138..df3ea3e99 100644 --- a/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs +++ b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrlTest do diff --git a/test/pleroma/web/rich_media/parser_test.exs b/test/pleroma/web/rich_media/parser_test.exs index 6d00c2af5..2f363b012 100644 --- a/test/pleroma/web/rich_media/parser_test.exs +++ b/test/pleroma/web/rich_media/parser_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.ParserTest do diff --git a/test/pleroma/web/rich_media/parsers/twitter_card_test.exs b/test/pleroma/web/rich_media/parsers/twitter_card_test.exs index 219f005a2..2aacd29a3 100644 --- a/test/pleroma/web/rich_media/parsers/twitter_card_test.exs +++ b/test/pleroma/web/rich_media/parsers/twitter_card_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.RichMedia.Parsers.TwitterCardTest do diff --git a/test/pleroma/web/static_fe/static_fe_controller_test.exs b/test/pleroma/web/static_fe/static_fe_controller_test.exs index 19506f1d8..2af14dfeb 100644 --- a/test/pleroma/web/static_fe/static_fe_controller_test.exs +++ b/test/pleroma/web/static_fe/static_fe_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.StaticFE.StaticFEControllerTest do diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index 764b799bb..0402e59ea 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.StreamerTest do diff --git a/test/pleroma/web/twitter_api/controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs index b3ca67637..23884e223 100644 --- a/test/pleroma/web/twitter_api/controller_test.exs +++ b/test/pleroma/web/twitter_api/controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.ControllerTest do diff --git a/test/pleroma/web/twitter_api/password_controller_test.exs b/test/pleroma/web/twitter_api/password_controller_test.exs index c1f5bc5c7..a552af4c3 100644 --- a/test/pleroma/web/twitter_api/password_controller_test.exs +++ b/test/pleroma/web/twitter_api/password_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs index dfe5b02be..51db2fe5e 100644 --- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs +++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do diff --git a/test/pleroma/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs index 5586a9a13..3be4812d3 100644 --- a/test/pleroma/web/twitter_api/twitter_api_test.exs +++ b/test/pleroma/web/twitter_api/twitter_api_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.TwitterAPITest do diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 60f2fb052..882122848 100644 --- a/test/pleroma/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do diff --git a/test/pleroma/web/uploader_controller_test.exs b/test/pleroma/web/uploader_controller_test.exs index 00f9e72ec..fc278004e 100644 --- a/test/pleroma/web/uploader_controller_test.exs +++ b/test/pleroma/web/uploader_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.UploaderControllerTest do diff --git a/test/pleroma/web/views/error_view_test.exs b/test/pleroma/web/views/error_view_test.exs index 8dbbd18b4..42da8f458 100644 --- a/test/pleroma/web/views/error_view_test.exs +++ b/test/pleroma/web/views/error_view_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ErrorViewTest do diff --git a/test/pleroma/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs index ce9eb0650..7059850bd 100644 --- a/test/pleroma/web/web_finger/web_finger_controller_test.exs +++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do diff --git a/test/pleroma/web/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs index cdb84ae1e..84477d5a1 100644 --- a/test/pleroma/web/web_finger_test.exs +++ b/test/pleroma/web/web_finger_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.WebFingerTest do diff --git a/test/pleroma/workers/cron/digest_emails_worker_test.exs b/test/pleroma/workers/cron/digest_emails_worker_test.exs index 65887192e..79614212a 100644 --- a/test/pleroma/workers/cron/digest_emails_worker_test.exs +++ b/test/pleroma/workers/cron/digest_emails_worker_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.Cron.DigestEmailsWorkerTest do diff --git a/test/pleroma/workers/cron/new_users_digest_worker_test.exs b/test/pleroma/workers/cron/new_users_digest_worker_test.exs index e00ed6745..f9ef265c2 100644 --- a/test/pleroma/workers/cron/new_users_digest_worker_test.exs +++ b/test/pleroma/workers/cron/new_users_digest_worker_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do diff --git a/test/pleroma/workers/purge_expired_activity_test.exs b/test/pleroma/workers/purge_expired_activity_test.exs index b5938776d..98f30f61f 100644 --- a/test/pleroma/workers/purge_expired_activity_test.exs +++ b/test/pleroma/workers/purge_expired_activity_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.PurgeExpiredActivityTest do diff --git a/test/pleroma/workers/purge_expired_token_test.exs b/test/pleroma/workers/purge_expired_token_test.exs index fb7708c3f..00cbd40cd 100644 --- a/test/pleroma/workers/purge_expired_token_test.exs +++ b/test/pleroma/workers/purge_expired_token_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.PurgeExpiredTokenTest do diff --git a/test/pleroma/workers/scheduled_activity_worker_test.exs b/test/pleroma/workers/scheduled_activity_worker_test.exs index c9e2091a9..6786e639d 100644 --- a/test/pleroma/workers/scheduled_activity_worker_test.exs +++ b/test/pleroma/workers/scheduled_activity_worker_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Workers.ScheduledActivityWorkerTest do diff --git a/test/pleroma/xml_builder_test.exs b/test/pleroma/xml_builder_test.exs index a4c73359d..9aae32cdc 100644 --- a/test/pleroma/xml_builder_test.exs +++ b/test/pleroma/xml_builder_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.XmlBuilderTest do diff --git a/test/support/api_spec_helpers.ex b/test/support/api_spec_helpers.ex index 46388f92c..36d6a8b81 100644 --- a/test/support/api_spec_helpers.ex +++ b/test/support/api_spec_helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tests.ApiSpecHelpers do diff --git a/test/support/cachex_proxy.ex b/test/support/cachex_proxy.ex index e296b5c6a..de1f1c766 100644 --- a/test/support/cachex_proxy.ex +++ b/test/support/cachex_proxy.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.CachexProxy do diff --git a/test/support/captcha/mock.ex b/test/support/captcha/mock.ex index 2ed2ba3b4..175ade131 100644 --- a/test/support/captcha/mock.ex +++ b/test/support/captcha/mock.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Captcha.Mock do diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index f4696adb3..6888984a2 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ChannelCase do diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index f20e3d955..5b7111fd3 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ConnCase do diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 0b41f0f63..9db3478bc 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.DataCase do diff --git a/test/support/factory.ex b/test/support/factory.ex index e02acb89b..bf7121901 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Factory do diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 15e8cbd9d..4353d5254 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tests.Helpers do diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 93464ebff..7da0a8380 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule HttpRequestMock do diff --git a/test/support/mocks.ex b/test/support/mocks.ex index 442ff5b71..fd8f825b3 100644 --- a/test/support/mocks.ex +++ b/test/support/mocks.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only Mox.defmock(Pleroma.CachexMock, for: Pleroma.Caching) diff --git a/test/support/mrf_module_mock.ex b/test/support/mrf_module_mock.ex index 028ea542a..4dfdeb3b4 100644 --- a/test/support/mrf_module_mock.ex +++ b/test/support/mrf_module_mock.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule MRFModuleMock do diff --git a/test/support/null_cache.ex b/test/support/null_cache.ex index c63df6a39..47c10ebb6 100644 --- a/test/support/null_cache.ex +++ b/test/support/null_cache.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.NullCache do diff --git a/test/support/oban_helpers.ex b/test/support/oban_helpers.ex index 2468f66dc..9b6e5256e 100644 --- a/test/support/oban_helpers.ex +++ b/test/support/oban_helpers.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Tests.ObanHelpers do diff --git a/test/support/websocket_client.ex b/test/support/websocket_client.ex index 8c9d4b2b4..34b955474 100644 --- a/test/support/websocket_client.ex +++ b/test/support/websocket_client.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Integration.WebsocketClient do diff --git a/test/test_helper.exs b/test/test_helper.exs index ee880e226..0c9783076 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only os_exclude = if :os.type() == {:unix, :darwin}, do: [skip_on_mac: true], else: [] -- cgit v1.2.3 From 56ddd7d7170e583457ce2b3d82c43c495950683c Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 13 Jan 2021 07:53:44 +0100 Subject: COPYING: Bump copyright to 2021 --- COPYING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYING b/COPYING index 3140c8038..eb60dbd56 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Unless otherwise stated this repository is copyright © 2017-2020 +Unless otherwise stated this repository is copyright © 2017-2021 Pleroma Authors , and is distributed under The GNU Affero General Public License Version 3, you should have received a copy of the license file as AGPL-3. -- cgit v1.2.3 From c7cd9bd5911f8393fa758e329f8786913a5c321f Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 13 Jan 2021 15:09:01 +0100 Subject: Password: Add password module Replaces Pbkdf2. --- config/test.exs | 2 +- lib/pleroma/password.ex | 55 ++++++++++++++++++++++++++++++++++++++++++ test/pleroma/password_test.exs | 35 +++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 lib/pleroma/password.ex create mode 100644 test/pleroma/password_test.exs diff --git a/config/test.exs b/config/test.exs index 7fc457463..6f6b18558 100644 --- a/config/test.exs +++ b/config/test.exs @@ -53,7 +53,7 @@ config :pleroma, :dangerzone, override_repo_pool_size: true # Reduce hash rounds for testing -config :pbkdf2_elixir, rounds: 1 +config :pleroma, :password, iterations: 1 config :tesla, adapter: Tesla.Mock diff --git a/lib/pleroma/password.ex b/lib/pleroma/password.ex new file mode 100644 index 000000000..e96249650 --- /dev/null +++ b/lib/pleroma/password.ex @@ -0,0 +1,55 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Password do + @moduledoc """ + This module implements Pleroma.Password passwords in terms of Plug.Crypto. + """ + + alias Plug.Crypto.KeyGenerator + + def decode64(str) do + str + |> String.replace(".", "+") + |> Base.decode64!(padding: false) + end + + def encode64(bin) do + bin + |> Base.encode64(padding: false) + |> String.replace("+", ".") + end + + def verify_pass(password, hash) do + ["pbkdf2-" <> digest, iterations, salt, hash] = String.split(hash, "$", trim: true) + + salt = decode64(salt) + + iterations = String.to_integer(iterations) + + digest = String.to_atom(digest) + + binary_hash = + KeyGenerator.generate(password, salt, digest: digest, iterations: iterations, length: 64) + + encode64(binary_hash) == hash + end + + def hash_pwd_salt(password, opts \\ []) do + salt = + Keyword.get_lazy(opts, :salt, fn -> + :crypto.strong_rand_bytes(16) + end) + + digest = Keyword.get(opts, :digest, :sha512) + + iterations = + Keyword.get(opts, :iterations, Pleroma.Config.get([:password, :iterations], 160_000)) + + binary_hash = + KeyGenerator.generate(password, salt, digest: digest, iterations: iterations, length: 64) + + "$pbkdf2-#{digest}$#{iterations}$#{encode64(salt)}$#{encode64(binary_hash)}" + end +end diff --git a/test/pleroma/password_test.exs b/test/pleroma/password_test.exs new file mode 100644 index 000000000..6ed0ca826 --- /dev/null +++ b/test/pleroma/password_test.exs @@ -0,0 +1,35 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.PasswordTest do + use Pleroma.DataCase, async: true + + alias Pleroma.Password + + test "it generates the same hash as pbkd2_elixir" do + # hash = Pleroma.Password.hash_pwd_salt("password") + hash = + "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" + + # Use the same randomly generated salt + salt = Password.decode64("QJpEYw8iBKcnY.4Rm0eCVw") + + assert hash == Password.hash_pwd_salt("password", salt: salt) + end + + @tag skip: "Works when Pbkd2 is present. Source: trust me bro" + test "Pleroma.Password can verify passwords generated with it" do + hash = Password.hash_pwd_salt("password") + + assert Pleroma.Password.verify_pass("password", hash) + end + + test "it verifies pbkdf2_elixir hashes" do + # hash = Pleroma.Password.hash_pwd_salt("password") + hash = + "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" + + assert Password.verify_pass("password", hash) + end +end -- cgit v1.2.3 From 9106048c6191b4b16037980655514d9b5e430023 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 13 Jan 2021 15:11:11 +0100 Subject: Password: Replace Pbkdf2 with Password. --- benchmarks/load_testing/users.ex | 2 +- lib/pleroma/mfa.ex | 2 +- lib/pleroma/user.ex | 2 +- lib/pleroma/web/plugs/authentication_plug.ex | 2 +- mix.exs | 1 - test/pleroma/mfa_test.exs | 4 ++-- test/pleroma/web/auth/basic_auth_test.exs | 2 +- test/pleroma/web/auth/pleroma_authenticator_test.exs | 2 +- test/pleroma/web/auth/totp_authenticator_test.exs | 2 +- test/pleroma/web/mongoose_im_controller_test.exs | 4 ++-- test/pleroma/web/o_auth/ldap_authorization_test.exs | 4 ++-- test/pleroma/web/o_auth/mfa_controller_test.exs | 4 ++-- test/pleroma/web/o_auth/o_auth_controller_test.exs | 18 +++++++++--------- test/pleroma/web/plugs/authentication_plug_test.exs | 2 +- .../web/twitter_api/password_controller_test.exs | 2 +- test/pleroma/web/twitter_api/util_controller_test.exs | 2 +- test/support/builders/user_builder.ex | 2 +- test/support/factory.ex | 2 +- 18 files changed, 29 insertions(+), 30 deletions(-) diff --git a/benchmarks/load_testing/users.ex b/benchmarks/load_testing/users.ex index 34a904ac2..1815490a4 100644 --- a/benchmarks/load_testing/users.ex +++ b/benchmarks/load_testing/users.ex @@ -55,7 +55,7 @@ defp generate_user(i) do name: "Test テスト User #{i}", email: "user#{i}@example.com", nickname: "nick#{i}", - password_hash: Pbkdf2.hash_pwd_salt("test"), + password_hash: Pleroma.Password.hash_pwd_salt("test"), bio: "Tester Number #{i}", local: !remote } diff --git a/lib/pleroma/mfa.ex b/lib/pleroma/mfa.ex index f43e03a54..29488c876 100644 --- a/lib/pleroma/mfa.ex +++ b/lib/pleroma/mfa.ex @@ -71,7 +71,7 @@ def invalidate_backup_code(%User{} = user, hash_code) do @spec generate_backup_codes(User.t()) :: {:ok, list(binary)} | {:error, String.t()} def generate_backup_codes(%User{} = user) do with codes <- BackupCodes.generate(), - hashed_codes <- Enum.map(codes, &Pbkdf2.hash_pwd_salt/1), + hashed_codes <- Enum.map(codes, &Pleroma.Password.hash_pwd_salt/1), changeset <- Changeset.cast_backup_codes(user, hashed_codes), {:ok, _} <- User.update_and_set_cache(changeset) do {:ok, codes} diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index cd0c64acc..04e6ffd51 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2187,7 +2187,7 @@ def get_ap_ids_by_nicknames(nicknames) do defp put_password_hash( %Ecto.Changeset{valid?: true, changes: %{password: password}} = changeset ) do - change(changeset, password_hash: Pbkdf2.hash_pwd_salt(password)) + change(changeset, password_hash: Pleroma.Password.hash_pwd_salt(password)) end defp put_password_hash(changeset), do: changeset diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex index c3e13858a..f7a2a3ab7 100644 --- a/lib/pleroma/web/plugs/authentication_plug.ex +++ b/lib/pleroma/web/plugs/authentication_plug.ex @@ -48,7 +48,7 @@ def checkpw(password, "$2" <> _ = password_hash) do end def checkpw(password, "$pbkdf2" <> _ = password_hash) do - Pbkdf2.verify_pass(password, password_hash) + Pleroma.Password.verify_pass(password, password_hash) end def checkpw(_password, _password_hash) do diff --git a/mix.exs b/mix.exs index f26a5391a..14448f12f 100644 --- a/mix.exs +++ b/mix.exs @@ -125,7 +125,6 @@ defp deps do {:postgrex, ">= 0.15.5"}, {:oban, "~> 2.1.0"}, {:gettext, "~> 0.18"}, - {:pbkdf2_elixir, "~> 1.2"}, {:bcrypt_elixir, "~> 2.2"}, {:trailing_format_plug, "~> 0.0.7"}, {:fast_sanitize, "~> 0.2.0"}, diff --git a/test/pleroma/mfa_test.exs b/test/pleroma/mfa_test.exs index 29e478892..db68fc1ca 100644 --- a/test/pleroma/mfa_test.exs +++ b/test/pleroma/mfa_test.exs @@ -30,8 +30,8 @@ test "returns backup codes" do {:ok, [code1, code2]} = MFA.generate_backup_codes(user) updated_user = refresh_record(user) [hash1, hash2] = updated_user.multi_factor_authentication_settings.backup_codes - assert Pbkdf2.verify_pass(code1, hash1) - assert Pbkdf2.verify_pass(code2, hash2) + assert Pleroma.Password.verify_pass(code1, hash1) + assert Pleroma.Password.verify_pass(code2, hash2) end end diff --git a/test/pleroma/web/auth/basic_auth_test.exs b/test/pleroma/web/auth/basic_auth_test.exs index f732c7e27..b74516dd6 100644 --- a/test/pleroma/web/auth/basic_auth_test.exs +++ b/test/pleroma/web/auth/basic_auth_test.exs @@ -11,7 +11,7 @@ test "with HTTP Basic Auth used, grants access to OAuth scope-restricted endpoin conn: conn } do user = insert(:user) - assert Pbkdf2.verify_pass("test", user.password_hash) + assert Pleroma.Password.verify_pass("test", user.password_hash) basic_auth_contents = (URI.encode_www_form(user.nickname) <> ":" <> URI.encode_www_form("test")) diff --git a/test/pleroma/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs index 477cf26ed..ec63e2d41 100644 --- a/test/pleroma/web/auth/pleroma_authenticator_test.exs +++ b/test/pleroma/web/auth/pleroma_authenticator_test.exs @@ -11,7 +11,7 @@ defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do setup do password = "testpassword" name = "AgentSmith" - user = insert(:user, nickname: name, password_hash: Pbkdf2.hash_pwd_salt(password)) + user = insert(:user, nickname: name, password_hash: Pleroma.Password.hash_pwd_salt(password)) {:ok, [user: user, name: name, password: password]} end diff --git a/test/pleroma/web/auth/totp_authenticator_test.exs b/test/pleroma/web/auth/totp_authenticator_test.exs index 583612454..6d2646b61 100644 --- a/test/pleroma/web/auth/totp_authenticator_test.exs +++ b/test/pleroma/web/auth/totp_authenticator_test.exs @@ -34,7 +34,7 @@ test "checks backup codes" do hashed_codes = backup_codes - |> Enum.map(&Pbkdf2.hash_pwd_salt(&1)) + |> Enum.map(&Pleroma.Password.hash_pwd_salt(&1)) user = insert(:user, diff --git a/test/pleroma/web/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs index 031db53c8..183a17a02 100644 --- a/test/pleroma/web/mongoose_im_controller_test.exs +++ b/test/pleroma/web/mongoose_im_controller_test.exs @@ -41,13 +41,13 @@ test "/user_exists", %{conn: conn} do end test "/check_password", %{conn: conn} do - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt("cool")) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("cool")) _deactivated_user = insert(:user, nickname: "konata", deactivated: true, - password_hash: Pbkdf2.hash_pwd_salt("cool") + password_hash: Pleroma.Password.hash_pwd_salt("cool") ) res = diff --git a/test/pleroma/web/o_auth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs index 4a2e940fd..9ebd084a5 100644 --- a/test/pleroma/web/o_auth/ldap_authorization_test.exs +++ b/test/pleroma/web/o_auth/ldap_authorization_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do @tag @skip test "authorizes the existing user using LDAP credentials" do password = "testpassword" - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password)) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) app = insert(:oauth_app, scopes: ["read", "write"]) host = Pleroma.Config.get([:ldap, :host]) |> to_charlist @@ -101,7 +101,7 @@ test "creates a new user after successful LDAP authorization" do @tag @skip test "disallow authorization for wrong LDAP credentials" do password = "testpassword" - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password)) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) app = insert(:oauth_app, scopes: ["read", "write"]) host = Pleroma.Config.get([:ldap, :host]) |> to_charlist diff --git a/test/pleroma/web/o_auth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs index 9fc1e0ec2..dacf03b2b 100644 --- a/test/pleroma/web/o_auth/mfa_controller_test.exs +++ b/test/pleroma/web/o_auth/mfa_controller_test.exs @@ -20,7 +20,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do insert(:user, multi_factor_authentication_settings: %MFA.Settings{ enabled: true, - backup_codes: [Pbkdf2.hash_pwd_salt("test-code")], + backup_codes: [Pleroma.Password.hash_pwd_salt("test-code")], totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true} } ) @@ -246,7 +246,7 @@ test "returns access token with valid code", %{conn: conn, app: app} do hashed_codes = backup_codes - |> Enum.map(&Pbkdf2.hash_pwd_salt(&1)) + |> Enum.map(&Pleroma.Password.hash_pwd_salt(&1)) user = insert(:user, diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index f01fdf660..1c5438cc2 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -316,7 +316,7 @@ test "with valid params, POST /oauth/register?op=connect redirects to `redirect_ app: app, conn: conn } do - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt("testpassword")) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("testpassword")) registration = insert(:registration, user: nil) redirect_uri = OAuthController.default_redirect_uri(app) @@ -347,7 +347,7 @@ test "with unlisted `redirect_uri`, POST /oauth/register?op=connect results in H app: app, conn: conn } do - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt("testpassword")) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("testpassword")) registration = insert(:registration, user: nil) unlisted_redirect_uri = "http://cross-site-request.com" @@ -790,7 +790,7 @@ test "issues a token for an all-body request" do test "issues a token for `password` grant_type with valid credentials, with full permissions by default" do password = "testpassword" - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password)) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) app = insert(:oauth_app, scopes: ["read", "write"]) @@ -818,7 +818,7 @@ test "issues a mfa token for `password` grant_type, when MFA enabled" do user = insert(:user, - password_hash: Pbkdf2.hash_pwd_salt(password), + password_hash: Pleroma.Password.hash_pwd_salt(password), multi_factor_authentication_settings: %MFA.Settings{ enabled: true, totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true} @@ -927,7 +927,7 @@ test "rejects token exchange for valid credentials belonging to unconfirmed user password = "testpassword" {:ok, user} = - insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password)) + insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) |> User.confirmation_changeset(need_confirmation: true) |> User.update_and_set_cache() @@ -955,7 +955,7 @@ test "rejects token exchange for valid credentials belonging to deactivated user user = insert(:user, - password_hash: Pbkdf2.hash_pwd_salt(password), + password_hash: Pleroma.Password.hash_pwd_salt(password), deactivated: true ) @@ -983,7 +983,7 @@ test "rejects token exchange for user with password_reset_pending set to true" d user = insert(:user, - password_hash: Pbkdf2.hash_pwd_salt(password), + password_hash: Pleroma.Password.hash_pwd_salt(password), password_reset_pending: true ) @@ -1012,7 +1012,7 @@ test "rejects token exchange for user with confirmation_pending set to true" do user = insert(:user, - password_hash: Pbkdf2.hash_pwd_salt(password), + password_hash: Pleroma.Password.hash_pwd_salt(password), confirmation_pending: true ) @@ -1038,7 +1038,7 @@ test "rejects token exchange for user with confirmation_pending set to true" do test "rejects token exchange for valid credentials belonging to an unapproved user" do password = "testpassword" - user = insert(:user, password_hash: Pbkdf2.hash_pwd_salt(password), approval_pending: true) + user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password), approval_pending: true) refute Pleroma.User.account_status(user) == :active diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 9d66681ce..4a0ff6710 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -17,7 +17,7 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do user = %User{ id: 1, name: "dude", - password_hash: Pbkdf2.hash_pwd_salt("guy") + password_hash: Pleroma.Password.hash_pwd_salt("guy") } conn = diff --git a/test/pleroma/web/twitter_api/password_controller_test.exs b/test/pleroma/web/twitter_api/password_controller_test.exs index a552af4c3..880f097cb 100644 --- a/test/pleroma/web/twitter_api/password_controller_test.exs +++ b/test/pleroma/web/twitter_api/password_controller_test.exs @@ -92,7 +92,7 @@ test "it returns HTTP 200", %{conn: conn} do assert response =~ "

Password changed!

" user = refresh_record(user) - assert Pbkdf2.verify_pass("test", user.password_hash) + assert Pleroma.Password.verify_pass("test", user.password_hash) assert Enum.empty?(Token.get_user_tokens(user)) end diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 882122848..923be8fae 100644 --- a/test/pleroma/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs @@ -397,7 +397,7 @@ test "with proper permissions, valid password and matching new password and conf assert json_response(conn, 200) == %{"status" => "success"} fetched_user = User.get_cached_by_id(user.id) - assert Pbkdf2.verify_pass("newpass", fetched_user.password_hash) == true + assert Pleroma.Password.verify_pass("newpass", fetched_user.password_hash) == true end end diff --git a/test/support/builders/user_builder.ex b/test/support/builders/user_builder.ex index 0c687c029..27470498d 100644 --- a/test/support/builders/user_builder.ex +++ b/test/support/builders/user_builder.ex @@ -7,7 +7,7 @@ def build(data \\ %{}) do email: "test@example.org", name: "Test Name", nickname: "testname", - password_hash: Pbkdf2.hash_pwd_salt("test"), + password_hash: Pleroma.Password.hash_pwd_salt("test"), bio: "A tester.", ap_id: "some id", last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second), diff --git a/test/support/factory.ex b/test/support/factory.ex index bf7121901..53b1dfd09 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -29,7 +29,7 @@ def user_factory(attrs \\ %{}) do name: sequence(:name, &"Test テスト User #{&1}"), email: sequence(:email, &"user#{&1}@example.com"), nickname: sequence(:nickname, &"nick#{&1}"), - password_hash: Pbkdf2.hash_pwd_salt("test"), + password_hash: Pleroma.Password.hash_pwd_salt("test"), bio: sequence(:bio, &"Tester Number #{&1}"), is_discoverable: true, last_digest_emailed_at: NaiveDateTime.utc_now(), -- cgit v1.2.3 From aff83eb7c12b08164c29c134e619cf116127c423 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Wed, 13 Jan 2021 16:00:12 +0100 Subject: Linting --- test/pleroma/web/o_auth/o_auth_controller_test.exs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index 1c5438cc2..c6ee7b7e8 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -1038,7 +1038,11 @@ test "rejects token exchange for user with confirmation_pending set to true" do test "rejects token exchange for valid credentials belonging to an unapproved user" do password = "testpassword" - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password), approval_pending: true) + user = + insert(:user, + password_hash: Pleroma.Password.hash_pwd_salt(password), + approval_pending: true + ) refute Pleroma.User.account_status(user) == :active -- cgit v1.2.3 From f0ab60189e0749ca207b483b291c90f892dce6a3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 13 Jan 2021 11:54:00 -0600 Subject: truncated_namespace should default to nil --- config/config.exs | 2 +- lib/pleroma/upload.ex | 6 ++++-- priv/templates/sample_config.eex | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/config.exs b/config/config.exs index 2a0c6302c..ef3baed93 100644 --- a/config/config.exs +++ b/config/config.exs @@ -72,7 +72,7 @@ config :pleroma, Pleroma.Uploaders.S3, bucket: nil, bucket_namespace: nil, - truncated_namespace: false, + truncated_namespace: nil, streaming_enabled: true config :ex_aws, :s3, diff --git a/lib/pleroma/upload.ex b/lib/pleroma/upload.ex index e714dc57b..e13d40c5a 100644 --- a/lib/pleroma/upload.ex +++ b/lib/pleroma/upload.ex @@ -229,13 +229,15 @@ def base_url do Pleroma.Uploaders.S3 -> bucket = Config.get([Pleroma.Uploaders.S3, :bucket]) + truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) + namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) bucket_with_namespace = cond do - truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) -> + !is_nil(truncated_namespace) -> truncated_namespace - namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) -> + !is_nil(namespace) -> namespace <> ":" <> bucket true -> diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex index 0c2477e2c..42f496ded 100644 --- a/priv/templates/sample_config.eex +++ b/priv/templates/sample_config.eex @@ -59,7 +59,7 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>" # config :pleroma, Pleroma.Uploaders.S3, # bucket: "some-bucket", # bucket_namespace: "my-namespace", -# truncated_namespace: false, +# truncated_namespace: nil, # streaming_enabled: true # # Configure S3 credentials: -- cgit v1.2.3 From 5627f3642fd96b678bdd5c3b9f3da0dbb038d75c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 13 Jan 2021 11:54:45 -0600 Subject: Not needed in test.exs --- config/test.exs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/test.exs b/config/test.exs index e482f38c8..76c7a2c67 100644 --- a/config/test.exs +++ b/config/test.exs @@ -115,10 +115,6 @@ config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true -config :pleroma, Pleroma.Uploaders.S3, - bucket: nil, - streaming_enabled: true - config :tzdata, :autoupdate, :disabled config :pleroma, :mrf, policies: [] -- cgit v1.2.3 From 94e51808461cd5a6148c6782159fa3f0ecc14638 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 13 Jan 2021 12:00:48 -0600 Subject: Consistent style --- test/pleroma/uploaders/s3_test.exs | 9 ++------- test/pleroma/user/backup_test.exs | 9 +++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index f399f8ae5..da3a57163 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -12,13 +12,8 @@ defmodule Pleroma.Uploaders.S3Test do import ExUnit.CaptureLog setup do - clear_config(Pleroma.Upload, - uploader: Pleroma.Uploaders.S3 - ) - - clear_config(Pleroma.Upload, - base_url: "https://s3.amazonaws.com" - ) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3) + clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") clear_config(Pleroma.Uploaders.S3, bucket: "test_bucket" diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index 01a1ed962..64a92cb7d 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -195,12 +195,9 @@ test "it creates a zip archive with user data" do describe "it uploads and deletes a backup archive" do setup do - clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket" - ) - - clear_config([Pleroma.Upload, :uploader]) - clear_config([Pleroma.Upload, base_url: "https://s3.amazonaws.com"]) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3) + clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") + clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket") user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"}) -- cgit v1.2.3 From ba234d3c73ee6d6e96150928d0853c51783abd1d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 13 Jan 2021 12:01:01 -0600 Subject: Unnecessary duplication here --- test/pleroma/uploaders/s3_test.exs | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index da3a57163..30653aad2 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -48,8 +48,6 @@ test "it returns path with bucket namespace when namespace is set" do bucket_namespace: "family" ) - Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com") - assert S3.get_file("test_image.jpg") == { :ok, {:url, "https://s3.amazonaws.com/family:test_bucket/test_image.jpg"} -- cgit v1.2.3 From 3e4d84729a4ca8d9779d439a9aa2c8c23b3acd1d Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 13 Jan 2021 22:07:38 +0300 Subject: [#3213] Prototype of data migrations functionality / HashtagsTableMigrator. --- lib/mix/tasks/pleroma/database.ex | 60 ------ lib/pleroma/application.ex | 3 +- lib/pleroma/config.ex | 4 +- lib/pleroma/data_migration.ex | 46 +++++ lib/pleroma/delivery.ex | 1 - lib/pleroma/ecto_enums.ex | 8 + lib/pleroma/migrators/hashtags_table_migrator.ex | 211 +++++++++++++++++++++ lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- .../20210105195018_create_data_migrations.exs | 17 ++ ...ta_migration_create_populate_hashtags_table.exs | 14 ++ ...0111172254_create_data_migration_failed_ids.exs | 14 ++ 11 files changed, 316 insertions(+), 64 deletions(-) create mode 100644 lib/pleroma/data_migration.ex create mode 100644 lib/pleroma/migrators/hashtags_table_migrator.ex create mode 100644 priv/repo/migrations/20210105195018_create_data_migrations.exs create mode 100644 priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs create mode 100644 priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index e9686fc1b..08ede9eef 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -4,7 +4,6 @@ defmodule Mix.Tasks.Pleroma.Database do alias Pleroma.Conversation - alias Pleroma.Hashtag alias Pleroma.Maintenance alias Pleroma.Object alias Pleroma.Repo @@ -171,63 +170,4 @@ def run(["ensure_expiration"]) do end) |> Stream.run() end - - def run(["transfer_hashtags"]) do - import Ecto.Query - - start_pleroma() - - Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") - - # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) - from( - object in Object, - left_join: hashtag in assoc(object, :hashtags), - where: is_nil(hashtag.id), - where: - fragment("(?)->'tag' IS NOT NULL AND (?)->'tag' != '[]'::jsonb", object.data, object.data), - select: %{ - id: object.id, - tag: fragment("(?)->'tag'", object.data) - } - ) - |> Repo.chunk_stream(100, :one, timeout: :infinity) - |> Stream.each(&transfer_object_hashtags(&1)) - |> Stream.run() - - Logger.info("Done transferring hashtags. Please check logs to ensure no errors.") - end - - defp transfer_object_hashtags(object) do - hashtags = Object.object_data_hashtags(%{"tag" => object.tag}) - - Repo.transaction(fn -> - with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do - for hashtag_record <- hashtag_records do - with {:ok, _} <- - Repo.query( - "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", - [hashtag_record.id, object.id] - ) do - nil - else - {:error, e} -> - error = - "ERROR: could not link object #{object.id} and hashtag " <> - "#{hashtag_record.id}: #{inspect(e)}" - - Logger.error(error) - Repo.rollback(object.id) - end - end - - object.id - else - e -> - error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" - Logger.error(error) - Repo.rollback(object.id) - end - end) - end end diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index bd568d858..962529dfd 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -104,7 +104,8 @@ def start(_type, _args) do chat_child(chat_enabled?()) ++ [ Pleroma.Web.Endpoint, - Pleroma.Gopher.Server + Pleroma.Gopher.Server, + Pleroma.Migrators.HashtagsTableMigrator ] # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index ee0167f4e..dbfb114d6 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -96,7 +96,9 @@ def restrict_unauthenticated_access?(resource, kind) do end end - def object_embedded_hashtags?, do: !get([:instance, :improved_hashtag_timeline]) + def improved_hashtag_timeline_path, do: [:instance, :improved_hashtag_timeline] + def improved_hashtag_timeline, do: get(improved_hashtag_timeline_path()) + def object_embedded_hashtags?, do: !improved_hashtag_timeline() def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], []) diff --git a/lib/pleroma/data_migration.ex b/lib/pleroma/data_migration.ex new file mode 100644 index 000000000..64fa155ff --- /dev/null +++ b/lib/pleroma/data_migration.ex @@ -0,0 +1,46 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.DataMigration do + use Ecto.Schema + + alias Pleroma.DataMigration + alias Pleroma.DataMigration.State + alias Pleroma.Repo + + import Ecto.Changeset + + schema "data_migrations" do + field(:name, :string) + field(:state, State, default: :pending) + field(:feature_lock, :boolean, default: false) + field(:params, :map, default: %{}) + field(:data, :map, default: %{}) + + timestamps() + end + + def changeset(data_migration, params \\ %{}) do + data_migration + |> cast(params, [:name, :state, :feature_lock, :params, :data]) + |> validate_required([:name]) + |> unique_constraint(:name) + end + + def update(data_migration, params \\ %{}) do + data_migration + |> changeset(params) + |> Repo.update() + end + + def update_state(data_migration, new_state) do + update(data_migration, %{state: new_state}) + end + + def get_by_name(name) do + Repo.get_by(DataMigration, name: name) + end + + def populate_hashtags_table, do: get_by_name("populate_hashtags_table") +end diff --git a/lib/pleroma/delivery.ex b/lib/pleroma/delivery.ex index 0ded2855c..baf79dda7 100644 --- a/lib/pleroma/delivery.ex +++ b/lib/pleroma/delivery.ex @@ -9,7 +9,6 @@ defmodule Pleroma.Delivery do alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User - alias Pleroma.User import Ecto.Changeset import Ecto.Query diff --git a/lib/pleroma/ecto_enums.ex b/lib/pleroma/ecto_enums.ex index 6fc47620c..f0ae658a4 100644 --- a/lib/pleroma/ecto_enums.ex +++ b/lib/pleroma/ecto_enums.ex @@ -17,3 +17,11 @@ follow_accept: 2, follow_reject: 3 ) + +defenum(Pleroma.DataMigration.State, + pending: 1, + running: 2, + complete: 3, + failed: 4, + manual: 5 +) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex new file mode 100644 index 000000000..a7e3de542 --- /dev/null +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -0,0 +1,211 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Migrators.HashtagsTableMigrator do + defmodule State do + use Agent + + @init_state %{} + + def start_link(_) do + Agent.start_link(fn -> @init_state end, name: __MODULE__) + end + + def get do + Agent.get(__MODULE__, & &1) + end + + def put(key, value) do + Agent.update(__MODULE__, fn state -> + Map.put(state, key, value) + end) + end + + def increment(key, increment \\ 1) do + Agent.update(__MODULE__, fn state -> + updated_value = (state[key] || 0) + increment + Map.put(state, key, updated_value) + end) + end + end + + use GenServer + + require Logger + + import Ecto.Query + + alias Pleroma.Config + alias Pleroma.DataMigration + alias Pleroma.Hashtag + alias Pleroma.Object + alias Pleroma.Repo + + defdelegate state(), to: State, as: :get + defdelegate put_state(key, value), to: State, as: :put + defdelegate increment_state(key, increment), to: State, as: :increment + + defdelegate data_migration(), to: DataMigration, as: :populate_hashtags_table + + def start_link(_) do + GenServer.start_link(__MODULE__, nil, name: __MODULE__) + end + + @impl true + def init(_) do + {:ok, nil, {:continue, :init_state}} + end + + @impl true + def handle_continue(:init_state, _state) do + {:ok, _} = State.start_link(nil) + + put_state(:status, :init) + + dm = data_migration() + + cond do + Config.get(:env) == :test -> + put_state(:status, :noop) + + is_nil(dm) -> + put_state(:status, :halt) + put_state(:message, "Data migration does not exist.") + + dm.state == :manual -> + put_state(:status, :noop) + put_state(:message, "Data migration is in manual execution state.") + + dm.state == :complete -> + handle_success() + + true -> + send(self(), :migrate_hashtags) + end + + {:noreply, nil} + end + + @impl true + def handle_info(:migrate_hashtags, state) do + data_migration = data_migration() + + {:ok, data_migration} = DataMigration.update_state(data_migration, :running) + put_state(:status, :running) + + Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") + + max_processed_id = data_migration.data["max_processed_id"] || 0 + + # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) + from( + object in Object, + left_join: hashtag in assoc(object, :hashtags), + where: object.id > ^max_processed_id, + where: is_nil(hashtag.id), + where: + fragment("(?)->'tag' IS NOT NULL AND (?)->'tag' != '[]'::jsonb", object.data, object.data), + select: %{ + id: object.id, + tag: fragment("(?)->'tag'", object.data) + } + ) + |> Repo.chunk_stream(100, :batches, timeout: :infinity) + |> Stream.each(fn objects -> + object_ids = Enum.map(objects, & &1.id) + + failed_ids = + objects + |> Enum.map(&transfer_object_hashtags(&1)) + |> Enum.filter(&(elem(&1, 0) == :error)) + |> Enum.map(&elem(&1, 1)) + + for failed_id <- failed_ids do + _ = + Repo.query( + "INSERT INTO data_migration_failed_ids(data_migration_id, record_id) " <> + "VALUES ($1, $2) ON CONFLICT DO NOTHING;", + [data_migration.id, failed_id] + ) + end + + _ = + Repo.query( + "DELETE FROM data_migration_failed_ids WHERE id = ANY($1)", + [object_ids -- failed_ids] + ) + + max_object_id = Enum.at(object_ids, -1) + _ = DataMigration.update(data_migration, %{data: %{"max_processed_id" => max_object_id}}) + + increment_state(:processed_count, length(object_ids)) + increment_state(:failed_count, length(failed_ids)) + + # A quick and dirty approach to controlling the load this background migration imposes + sleep_interval = Config.get([:populate_hashtags_table, :sleep_interval_ms], 0) + Process.sleep(sleep_interval) + end) + |> Stream.run() + + with {:ok, %{rows: [[0]]}} <- + Repo.query( + "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", + [data_migration.id] + ) do + put_state(:status, :complete) + _ = DataMigration.update_state(data_migration, :complete) + + handle_success() + else + _ -> + put_state(:status, :failed) + put_state(:message, "Please check data_migration_failed_ids records.") + end + + {:noreply, state} + end + + defp transfer_object_hashtags(object) do + hashtags = Object.object_data_hashtags(%{"tag" => object.tag}) + + Repo.transaction(fn -> + with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do + for hashtag_record <- hashtag_records do + with {:ok, _} <- + Repo.query( + "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", + [hashtag_record.id, object.id] + ) do + nil + else + {:error, e} -> + error = + "ERROR: could not link object #{object.id} and hashtag " <> + "#{hashtag_record.id}: #{inspect(e)}" + + Logger.error(error) + Repo.rollback(object.id) + end + end + + object.id + else + e -> + error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" + Logger.error(error) + Repo.rollback(object.id) + end + end) + end + + defp handle_success do + put_state(:status, :complete) + + unless Config.improved_hashtag_timeline() do + Config.put(Config.improved_hashtag_timeline_path(), true) + end + + :ok + end +end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 339843330..6131ae85b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1276,7 +1276,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> restrict_tag_all(opts) # TODO: benchmark (initial approach preferring non-aggregate ops when possible) - Config.get([:instance, :improved_hashtag_timeline]) == :join -> + Config.improved_hashtag_timeline() == :join -> query |> distinct([activity], true) |> restrict_hashtag_any(opts) diff --git a/priv/repo/migrations/20210105195018_create_data_migrations.exs b/priv/repo/migrations/20210105195018_create_data_migrations.exs new file mode 100644 index 000000000..5f2e8d96c --- /dev/null +++ b/priv/repo/migrations/20210105195018_create_data_migrations.exs @@ -0,0 +1,17 @@ +defmodule Pleroma.Repo.Migrations.CreateDataMigrations do + use Ecto.Migration + + def change do + create_if_not_exists table(:data_migrations) do + add(:name, :string, null: false) + add(:state, :integer, default: 1) + add(:feature_lock, :boolean, default: false) + add(:params, :map, default: %{}) + add(:data, :map, default: %{}) + + timestamps() + end + + create_if_not_exists(unique_index(:data_migrations, [:name])) + end +end diff --git a/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs b/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs new file mode 100644 index 000000000..2a965f075 --- /dev/null +++ b/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs @@ -0,0 +1,14 @@ +defmodule Pleroma.Repo.Migrations.DataMigrationCreatePopulateHashtagsTable do + use Ecto.Migration + + def up do + dt = NaiveDateTime.utc_now() + + execute( + "INSERT INTO data_migrations(name, inserted_at, updated_at) " <> + "VALUES ('populate_hashtags_table', '#{dt}', '#{dt}') ON CONFLICT DO NOTHING;" + ) + end + + def down, do: :ok +end diff --git a/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs b/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs new file mode 100644 index 000000000..ba0be98af --- /dev/null +++ b/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs @@ -0,0 +1,14 @@ +defmodule Pleroma.Repo.Migrations.CreateDataMigrationFailedIds do + use Ecto.Migration + + def change do + create_if_not_exists table(:data_migration_failed_ids, primary_key: false) do + add(:data_migration_id, references(:data_migrations), null: false) + add(:record_id, :bigint, null: false) + end + + create_if_not_exists( + unique_index(:data_migration_failed_ids, [:data_migration_id, :record_id]) + ) + end +end -- cgit v1.2.3 From 87a31c5c9b903517ec0317d2a331be36f2ea5051 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Thu, 14 Jan 2021 14:49:39 +0100 Subject: Password -> Password.Pbkdf2 --- lib/pleroma/password/pbkdf2.ex | 55 +++++++++++++++++++++++++++++++++++ test/pleroma/password/pbkdf2_test.exs | 35 ++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 lib/pleroma/password/pbkdf2.ex create mode 100644 test/pleroma/password/pbkdf2_test.exs diff --git a/lib/pleroma/password/pbkdf2.ex b/lib/pleroma/password/pbkdf2.ex new file mode 100644 index 000000000..747bc1d1d --- /dev/null +++ b/lib/pleroma/password/pbkdf2.ex @@ -0,0 +1,55 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Password.Pbkdf2 do + @moduledoc """ + This module implements Pleroma.Password.Pbkdf2 passwords in terms of Plug.Crypto. + """ + + alias Plug.Crypto.KeyGenerator + + def decode64(str) do + str + |> String.replace(".", "+") + |> Base.decode64!(padding: false) + end + + def encode64(bin) do + bin + |> Base.encode64(padding: false) + |> String.replace("+", ".") + end + + def verify_pass(password, hash) do + ["pbkdf2-" <> digest, iterations, salt, hash] = String.split(hash, "$", trim: true) + + salt = decode64(salt) + + iterations = String.to_integer(iterations) + + digest = String.to_atom(digest) + + binary_hash = + KeyGenerator.generate(password, salt, digest: digest, iterations: iterations, length: 64) + + encode64(binary_hash) == hash + end + + def hash_pwd_salt(password, opts \\ []) do + salt = + Keyword.get_lazy(opts, :salt, fn -> + :crypto.strong_rand_bytes(16) + end) + + digest = Keyword.get(opts, :digest, :sha512) + + iterations = + Keyword.get(opts, :iterations, Pleroma.Config.get([:password, :iterations], 160_000)) + + binary_hash = + KeyGenerator.generate(password, salt, digest: digest, iterations: iterations, length: 64) + + "$pbkdf2-#{digest}$#{iterations}$#{encode64(salt)}$#{encode64(binary_hash)}" + end +end diff --git a/test/pleroma/password/pbkdf2_test.exs b/test/pleroma/password/pbkdf2_test.exs new file mode 100644 index 000000000..4acbda939 --- /dev/null +++ b/test/pleroma/password/pbkdf2_test.exs @@ -0,0 +1,35 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Password.Pbkdf2Test do + use Pleroma.DataCase, async: true + + alias Pleroma.Password.Pbkdf2 + + test "it generates the same hash as pbkd2_elixir" do + # hash = Pleroma.Password.Pbkdf2.hash_pwd_salt("password") + hash = + "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" + + # Use the same randomly generated salt + salt = Password.decode64("QJpEYw8iBKcnY.4Rm0eCVw") + + assert hash == Password.hash_pwd_salt("password", salt: salt) + end + + @tag skip: "Works when Pbkd2 is present. Source: trust me bro" + test "Pleroma.Password.Pbkdf2 can verify passwords generated with it" do + hash = Password.hash_pwd_salt("password") + + assert Pleroma.Password.Pbkdf2.verify_pass("password", hash) + end + + test "it verifies pbkdf2_elixir hashes" do + # hash = Pleroma.Password.Pbkdf2.hash_pwd_salt("password") + hash = + "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" + + assert Password.verify_pass("password", hash) + end +end -- cgit v1.2.3 From 39f3683a06aea3d6aed85c611b0db0f6ea21052a Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Thu, 14 Jan 2021 15:06:16 +0100 Subject: Pbkdf2: Use it everywhere. --- benchmarks/load_testing/users.ex | 2 +- lib/pleroma/mfa.ex | 2 +- lib/pleroma/password.ex | 55 ---------------------- lib/pleroma/password/pbkdf2.ex | 2 +- lib/pleroma/user.ex | 2 +- lib/pleroma/web/plugs/authentication_plug.ex | 2 +- test/pleroma/mfa_test.exs | 4 +- test/pleroma/password/pbkdf2_test.exs | 14 +++--- test/pleroma/password_test.exs | 35 -------------- test/pleroma/web/auth/basic_auth_test.exs | 2 +- .../web/auth/pleroma_authenticator_test.exs | 2 +- test/pleroma/web/auth/totp_authenticator_test.exs | 2 +- test/pleroma/web/mongoose_im_controller_test.exs | 4 +- .../pleroma/web/o_auth/ldap_authorization_test.exs | 4 +- test/pleroma/web/o_auth/mfa_controller_test.exs | 4 +- test/pleroma/web/o_auth/o_auth_controller_test.exs | 18 +++---- .../pleroma/web/plugs/authentication_plug_test.exs | 2 +- .../web/twitter_api/password_controller_test.exs | 2 +- .../web/twitter_api/util_controller_test.exs | 2 +- test/support/builders/user_builder.ex | 2 +- test/support/factory.ex | 2 +- 21 files changed, 37 insertions(+), 127 deletions(-) delete mode 100644 lib/pleroma/password.ex delete mode 100644 test/pleroma/password_test.exs diff --git a/benchmarks/load_testing/users.ex b/benchmarks/load_testing/users.ex index 1815490a4..0a33cbfdb 100644 --- a/benchmarks/load_testing/users.ex +++ b/benchmarks/load_testing/users.ex @@ -55,7 +55,7 @@ defp generate_user(i) do name: "Test テスト User #{i}", email: "user#{i}@example.com", nickname: "nick#{i}", - password_hash: Pleroma.Password.hash_pwd_salt("test"), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("test"), bio: "Tester Number #{i}", local: !remote } diff --git a/lib/pleroma/mfa.ex b/lib/pleroma/mfa.ex index 29488c876..02dce7d49 100644 --- a/lib/pleroma/mfa.ex +++ b/lib/pleroma/mfa.ex @@ -71,7 +71,7 @@ def invalidate_backup_code(%User{} = user, hash_code) do @spec generate_backup_codes(User.t()) :: {:ok, list(binary)} | {:error, String.t()} def generate_backup_codes(%User{} = user) do with codes <- BackupCodes.generate(), - hashed_codes <- Enum.map(codes, &Pleroma.Password.hash_pwd_salt/1), + hashed_codes <- Enum.map(codes, &Pleroma.Password.Pbkdf2.hash_pwd_salt/1), changeset <- Changeset.cast_backup_codes(user, hashed_codes), {:ok, _} <- User.update_and_set_cache(changeset) do {:ok, codes} diff --git a/lib/pleroma/password.ex b/lib/pleroma/password.ex deleted file mode 100644 index e96249650..000000000 --- a/lib/pleroma/password.ex +++ /dev/null @@ -1,55 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Password do - @moduledoc """ - This module implements Pleroma.Password passwords in terms of Plug.Crypto. - """ - - alias Plug.Crypto.KeyGenerator - - def decode64(str) do - str - |> String.replace(".", "+") - |> Base.decode64!(padding: false) - end - - def encode64(bin) do - bin - |> Base.encode64(padding: false) - |> String.replace("+", ".") - end - - def verify_pass(password, hash) do - ["pbkdf2-" <> digest, iterations, salt, hash] = String.split(hash, "$", trim: true) - - salt = decode64(salt) - - iterations = String.to_integer(iterations) - - digest = String.to_atom(digest) - - binary_hash = - KeyGenerator.generate(password, salt, digest: digest, iterations: iterations, length: 64) - - encode64(binary_hash) == hash - end - - def hash_pwd_salt(password, opts \\ []) do - salt = - Keyword.get_lazy(opts, :salt, fn -> - :crypto.strong_rand_bytes(16) - end) - - digest = Keyword.get(opts, :digest, :sha512) - - iterations = - Keyword.get(opts, :iterations, Pleroma.Config.get([:password, :iterations], 160_000)) - - binary_hash = - KeyGenerator.generate(password, salt, digest: digest, iterations: iterations, length: 64) - - "$pbkdf2-#{digest}$#{iterations}$#{encode64(salt)}$#{encode64(binary_hash)}" - end -end diff --git a/lib/pleroma/password/pbkdf2.ex b/lib/pleroma/password/pbkdf2.ex index 747bc1d1d..2fd5f4491 100644 --- a/lib/pleroma/password/pbkdf2.ex +++ b/lib/pleroma/password/pbkdf2.ex @@ -4,7 +4,7 @@ defmodule Pleroma.Password.Pbkdf2 do @moduledoc """ - This module implements Pleroma.Password.Pbkdf2 passwords in terms of Plug.Crypto. + This module implements Pbkdf2 passwords in terms of Plug.Crypto. """ alias Plug.Crypto.KeyGenerator diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 04e6ffd51..6a81adfd6 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2187,7 +2187,7 @@ def get_ap_ids_by_nicknames(nicknames) do defp put_password_hash( %Ecto.Changeset{valid?: true, changes: %{password: password}} = changeset ) do - change(changeset, password_hash: Pleroma.Password.hash_pwd_salt(password)) + change(changeset, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) end defp put_password_hash(changeset), do: changeset diff --git a/lib/pleroma/web/plugs/authentication_plug.ex b/lib/pleroma/web/plugs/authentication_plug.ex index f7a2a3ab7..8d58169cf 100644 --- a/lib/pleroma/web/plugs/authentication_plug.ex +++ b/lib/pleroma/web/plugs/authentication_plug.ex @@ -48,7 +48,7 @@ def checkpw(password, "$2" <> _ = password_hash) do end def checkpw(password, "$pbkdf2" <> _ = password_hash) do - Pleroma.Password.verify_pass(password, password_hash) + Pleroma.Password.Pbkdf2.verify_pass(password, password_hash) end def checkpw(_password, _password_hash) do diff --git a/test/pleroma/mfa_test.exs b/test/pleroma/mfa_test.exs index db68fc1ca..76ba1a99d 100644 --- a/test/pleroma/mfa_test.exs +++ b/test/pleroma/mfa_test.exs @@ -30,8 +30,8 @@ test "returns backup codes" do {:ok, [code1, code2]} = MFA.generate_backup_codes(user) updated_user = refresh_record(user) [hash1, hash2] = updated_user.multi_factor_authentication_settings.backup_codes - assert Pleroma.Password.verify_pass(code1, hash1) - assert Pleroma.Password.verify_pass(code2, hash2) + assert Pleroma.Password.Pbkdf2.verify_pass(code1, hash1) + assert Pleroma.Password.Pbkdf2.verify_pass(code2, hash2) end end diff --git a/test/pleroma/password/pbkdf2_test.exs b/test/pleroma/password/pbkdf2_test.exs index 4acbda939..e55348f9a 100644 --- a/test/pleroma/password/pbkdf2_test.exs +++ b/test/pleroma/password/pbkdf2_test.exs @@ -5,10 +5,10 @@ defmodule Pleroma.Password.Pbkdf2Test do use Pleroma.DataCase, async: true - alias Pleroma.Password.Pbkdf2 + alias Pleroma.Password.Pbkdf2, as: Password test "it generates the same hash as pbkd2_elixir" do - # hash = Pleroma.Password.Pbkdf2.hash_pwd_salt("password") + # hash = Pbkdf2.hash_pwd_salt("password") hash = "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" @@ -19,14 +19,14 @@ test "it generates the same hash as pbkd2_elixir" do end @tag skip: "Works when Pbkd2 is present. Source: trust me bro" - test "Pleroma.Password.Pbkdf2 can verify passwords generated with it" do - hash = Password.hash_pwd_salt("password") - - assert Pleroma.Password.Pbkdf2.verify_pass("password", hash) + test "Pbkdf2 can verify passwords generated with it" do + # Commented to prevent warnings. + # hash = Password.hash_pwd_salt("password") + # assert Pbkdf2.verify_pass("password", hash) end test "it verifies pbkdf2_elixir hashes" do - # hash = Pleroma.Password.Pbkdf2.hash_pwd_salt("password") + # hash = Pbkdf2.hash_pwd_salt("password") hash = "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" diff --git a/test/pleroma/password_test.exs b/test/pleroma/password_test.exs deleted file mode 100644 index 6ed0ca826..000000000 --- a/test/pleroma/password_test.exs +++ /dev/null @@ -1,35 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.PasswordTest do - use Pleroma.DataCase, async: true - - alias Pleroma.Password - - test "it generates the same hash as pbkd2_elixir" do - # hash = Pleroma.Password.hash_pwd_salt("password") - hash = - "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" - - # Use the same randomly generated salt - salt = Password.decode64("QJpEYw8iBKcnY.4Rm0eCVw") - - assert hash == Password.hash_pwd_salt("password", salt: salt) - end - - @tag skip: "Works when Pbkd2 is present. Source: trust me bro" - test "Pleroma.Password can verify passwords generated with it" do - hash = Password.hash_pwd_salt("password") - - assert Pleroma.Password.verify_pass("password", hash) - end - - test "it verifies pbkdf2_elixir hashes" do - # hash = Pleroma.Password.hash_pwd_salt("password") - hash = - "$pbkdf2-sha512$1$QJpEYw8iBKcnY.4Rm0eCVw$UBPeWQ91RxSv3snxsb/ZzMeG/2aa03c541bbo8vQudREGNta5t8jBQrd00fyJp8RjaqfvgdZxy2rhSwljyu21g" - - assert Password.verify_pass("password", hash) - end -end diff --git a/test/pleroma/web/auth/basic_auth_test.exs b/test/pleroma/web/auth/basic_auth_test.exs index b74516dd6..2816aae4c 100644 --- a/test/pleroma/web/auth/basic_auth_test.exs +++ b/test/pleroma/web/auth/basic_auth_test.exs @@ -11,7 +11,7 @@ test "with HTTP Basic Auth used, grants access to OAuth scope-restricted endpoin conn: conn } do user = insert(:user) - assert Pleroma.Password.verify_pass("test", user.password_hash) + assert Pleroma.Password.Pbkdf2.verify_pass("test", user.password_hash) basic_auth_contents = (URI.encode_www_form(user.nickname) <> ":" <> URI.encode_www_form("test")) diff --git a/test/pleroma/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs index ec63e2d41..edaf9eecb 100644 --- a/test/pleroma/web/auth/pleroma_authenticator_test.exs +++ b/test/pleroma/web/auth/pleroma_authenticator_test.exs @@ -11,7 +11,7 @@ defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do setup do password = "testpassword" name = "AgentSmith" - user = insert(:user, nickname: name, password_hash: Pleroma.Password.hash_pwd_salt(password)) + user = insert(:user, nickname: name, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) {:ok, [user: user, name: name, password: password]} end diff --git a/test/pleroma/web/auth/totp_authenticator_test.exs b/test/pleroma/web/auth/totp_authenticator_test.exs index 6d2646b61..ac4209f2d 100644 --- a/test/pleroma/web/auth/totp_authenticator_test.exs +++ b/test/pleroma/web/auth/totp_authenticator_test.exs @@ -34,7 +34,7 @@ test "checks backup codes" do hashed_codes = backup_codes - |> Enum.map(&Pleroma.Password.hash_pwd_salt(&1)) + |> Enum.map(&Pleroma.Password.Pbkdf2.hash_pwd_salt(&1)) user = insert(:user, diff --git a/test/pleroma/web/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs index 183a17a02..a7225d45c 100644 --- a/test/pleroma/web/mongoose_im_controller_test.exs +++ b/test/pleroma/web/mongoose_im_controller_test.exs @@ -41,13 +41,13 @@ test "/user_exists", %{conn: conn} do end test "/check_password", %{conn: conn} do - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("cool")) + user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("cool")) _deactivated_user = insert(:user, nickname: "konata", deactivated: true, - password_hash: Pleroma.Password.hash_pwd_salt("cool") + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("cool") ) res = diff --git a/test/pleroma/web/o_auth/ldap_authorization_test.exs b/test/pleroma/web/o_auth/ldap_authorization_test.exs index 9ebd084a5..61b9ce6b7 100644 --- a/test/pleroma/web/o_auth/ldap_authorization_test.exs +++ b/test/pleroma/web/o_auth/ldap_authorization_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.Web.OAuth.LDAPAuthorizationTest do @tag @skip test "authorizes the existing user using LDAP credentials" do password = "testpassword" - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) + user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) app = insert(:oauth_app, scopes: ["read", "write"]) host = Pleroma.Config.get([:ldap, :host]) |> to_charlist @@ -101,7 +101,7 @@ test "creates a new user after successful LDAP authorization" do @tag @skip test "disallow authorization for wrong LDAP credentials" do password = "testpassword" - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) + user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) app = insert(:oauth_app, scopes: ["read", "write"]) host = Pleroma.Config.get([:ldap, :host]) |> to_charlist diff --git a/test/pleroma/web/o_auth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs index dacf03b2b..17bbde85b 100644 --- a/test/pleroma/web/o_auth/mfa_controller_test.exs +++ b/test/pleroma/web/o_auth/mfa_controller_test.exs @@ -20,7 +20,7 @@ defmodule Pleroma.Web.OAuth.MFAControllerTest do insert(:user, multi_factor_authentication_settings: %MFA.Settings{ enabled: true, - backup_codes: [Pleroma.Password.hash_pwd_salt("test-code")], + backup_codes: [Pleroma.Password.Pbkdf2.hash_pwd_salt("test-code")], totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true} } ) @@ -246,7 +246,7 @@ test "returns access token with valid code", %{conn: conn, app: app} do hashed_codes = backup_codes - |> Enum.map(&Pleroma.Password.hash_pwd_salt(&1)) + |> Enum.map(&Pleroma.Password.Pbkdf2.hash_pwd_salt(&1)) user = insert(:user, diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index c6ee7b7e8..bf47afed8 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -316,7 +316,7 @@ test "with valid params, POST /oauth/register?op=connect redirects to `redirect_ app: app, conn: conn } do - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("testpassword")) + user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("testpassword")) registration = insert(:registration, user: nil) redirect_uri = OAuthController.default_redirect_uri(app) @@ -347,7 +347,7 @@ test "with unlisted `redirect_uri`, POST /oauth/register?op=connect results in H app: app, conn: conn } do - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt("testpassword")) + user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("testpassword")) registration = insert(:registration, user: nil) unlisted_redirect_uri = "http://cross-site-request.com" @@ -790,7 +790,7 @@ test "issues a token for an all-body request" do test "issues a token for `password` grant_type with valid credentials, with full permissions by default" do password = "testpassword" - user = insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) + user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) app = insert(:oauth_app, scopes: ["read", "write"]) @@ -818,7 +818,7 @@ test "issues a mfa token for `password` grant_type, when MFA enabled" do user = insert(:user, - password_hash: Pleroma.Password.hash_pwd_salt(password), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), multi_factor_authentication_settings: %MFA.Settings{ enabled: true, totp: %MFA.Settings.TOTP{secret: otp_secret, confirmed: true} @@ -927,7 +927,7 @@ test "rejects token exchange for valid credentials belonging to unconfirmed user password = "testpassword" {:ok, user} = - insert(:user, password_hash: Pleroma.Password.hash_pwd_salt(password)) + insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) |> User.confirmation_changeset(need_confirmation: true) |> User.update_and_set_cache() @@ -955,7 +955,7 @@ test "rejects token exchange for valid credentials belonging to deactivated user user = insert(:user, - password_hash: Pleroma.Password.hash_pwd_salt(password), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), deactivated: true ) @@ -983,7 +983,7 @@ test "rejects token exchange for user with password_reset_pending set to true" d user = insert(:user, - password_hash: Pleroma.Password.hash_pwd_salt(password), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), password_reset_pending: true ) @@ -1012,7 +1012,7 @@ test "rejects token exchange for user with confirmation_pending set to true" do user = insert(:user, - password_hash: Pleroma.Password.hash_pwd_salt(password), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), confirmation_pending: true ) @@ -1040,7 +1040,7 @@ test "rejects token exchange for valid credentials belonging to an unapproved us user = insert(:user, - password_hash: Pleroma.Password.hash_pwd_salt(password), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), approval_pending: true ) diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs index 4a0ff6710..118ab302a 100644 --- a/test/pleroma/web/plugs/authentication_plug_test.exs +++ b/test/pleroma/web/plugs/authentication_plug_test.exs @@ -17,7 +17,7 @@ defmodule Pleroma.Web.Plugs.AuthenticationPlugTest do user = %User{ id: 1, name: "dude", - password_hash: Pleroma.Password.hash_pwd_salt("guy") + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("guy") } conn = diff --git a/test/pleroma/web/twitter_api/password_controller_test.exs b/test/pleroma/web/twitter_api/password_controller_test.exs index 880f097cb..cf99e2434 100644 --- a/test/pleroma/web/twitter_api/password_controller_test.exs +++ b/test/pleroma/web/twitter_api/password_controller_test.exs @@ -92,7 +92,7 @@ test "it returns HTTP 200", %{conn: conn} do assert response =~ "

Password changed!

" user = refresh_record(user) - assert Pleroma.Password.verify_pass("test", user.password_hash) + assert Pleroma.Password.Pbkdf2.verify_pass("test", user.password_hash) assert Enum.empty?(Token.get_user_tokens(user)) end diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 923be8fae..6d007ab66 100644 --- a/test/pleroma/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs @@ -397,7 +397,7 @@ test "with proper permissions, valid password and matching new password and conf assert json_response(conn, 200) == %{"status" => "success"} fetched_user = User.get_cached_by_id(user.id) - assert Pleroma.Password.verify_pass("newpass", fetched_user.password_hash) == true + assert Pleroma.Password.Pbkdf2.verify_pass("newpass", fetched_user.password_hash) == true end end diff --git a/test/support/builders/user_builder.ex b/test/support/builders/user_builder.ex index 27470498d..6bccbb35a 100644 --- a/test/support/builders/user_builder.ex +++ b/test/support/builders/user_builder.ex @@ -7,7 +7,7 @@ def build(data \\ %{}) do email: "test@example.org", name: "Test Name", nickname: "testname", - password_hash: Pleroma.Password.hash_pwd_salt("test"), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("test"), bio: "A tester.", ap_id: "some id", last_digest_emailed_at: NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second), diff --git a/test/support/factory.ex b/test/support/factory.ex index 53b1dfd09..bf9592064 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -29,7 +29,7 @@ def user_factory(attrs \\ %{}) do name: sequence(:name, &"Test テスト User #{&1}"), email: sequence(:email, &"user#{&1}@example.com"), nickname: sequence(:nickname, &"nick#{&1}"), - password_hash: Pleroma.Password.hash_pwd_salt("test"), + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("test"), bio: sequence(:bio, &"Tester Number #{&1}"), is_discoverable: true, last_digest_emailed_at: NaiveDateTime.utc_now(), -- cgit v1.2.3 From c4b74c9c3fcf926de374f512e8b218e6785448e5 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Thu, 14 Jan 2021 16:01:14 +0100 Subject: Linting. --- test/pleroma/web/auth/pleroma_authenticator_test.exs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/pleroma/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs index edaf9eecb..b1397c523 100644 --- a/test/pleroma/web/auth/pleroma_authenticator_test.exs +++ b/test/pleroma/web/auth/pleroma_authenticator_test.exs @@ -11,7 +11,13 @@ defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do setup do password = "testpassword" name = "AgentSmith" - user = insert(:user, nickname: name, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) + + user = + insert(:user, + nickname: name, + password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password) + ) + {:ok, [user: user, name: name, password: password]} end -- cgit v1.2.3 From fd9a0ac32943f7869e950524d4ed7a052f609e5c Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Thu, 14 Jan 2021 20:18:45 +0100 Subject: BackupTest: Fix s3 test. --- test/pleroma/user/backup_test.exs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index 64a92cb7d..108928c09 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -195,7 +195,6 @@ test "it creates a zip archive with user data" do describe "it uploads and deletes a backup archive" do setup do - clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3) clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket") @@ -216,7 +215,8 @@ test "it creates a zip archive with user data" do end test "S3", %{path: path, backup: backup} do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3) + clear_config([Pleroma.Uploaders.S3, :streaming_enabled], false) with_mock ExAws, request: fn @@ -226,13 +226,10 @@ test "S3", %{path: path, backup: backup} do assert {:ok, %Pleroma.Upload{}} = Backup.upload(backup, path) assert {:ok, _backup} = Backup.delete(backup) end - - with_mock ExAws, request: fn %{http_method: :delete} -> {:ok, %{status_code: 204}} end do - end end test "Local", %{path: path, backup: backup} do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) assert {:ok, %Pleroma.Upload{}} = Backup.upload(backup, path) assert {:ok, _backup} = Backup.delete(backup) -- cgit v1.2.3 From f5f267fa764f53ef617bc9504c7ecb68b5d3d7ab Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 14 Jan 2021 22:41:27 +0300 Subject: [#3213] Refactoring of HashtagsTableMigrator. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 98 ++++++++++++---------- .../migrators/hashtags_table_migrator/state.ex | 26 ++++++ .../20190711042021_create_safe_jsonb_set.exs | 2 +- 3 files changed, 79 insertions(+), 47 deletions(-) create mode 100644 lib/pleroma/migrators/hashtags_table_migrator/state.ex diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index a7e3de542..9f1a00f9c 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -3,39 +3,13 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Migrators.HashtagsTableMigrator do - defmodule State do - use Agent - - @init_state %{} - - def start_link(_) do - Agent.start_link(fn -> @init_state end, name: __MODULE__) - end - - def get do - Agent.get(__MODULE__, & &1) - end - - def put(key, value) do - Agent.update(__MODULE__, fn state -> - Map.put(state, key, value) - end) - end - - def increment(key, increment \\ 1) do - Agent.update(__MODULE__, fn state -> - updated_value = (state[key] || 0) + increment - Map.put(state, key, updated_value) - end) - end - end - use GenServer require Logger import Ecto.Query + alias __MODULE__.State alias Pleroma.Config alias Pleroma.DataMigration alias Pleroma.Hashtag @@ -43,13 +17,23 @@ def increment(key, increment \\ 1) do alias Pleroma.Repo defdelegate state(), to: State, as: :get - defdelegate put_state(key, value), to: State, as: :put - defdelegate increment_state(key, increment), to: State, as: :increment + defdelegate put_stat(key, value), to: State, as: :put + defdelegate increment_stat(key, increment), to: State, as: :increment defdelegate data_migration(), to: DataMigration, as: :populate_hashtags_table + @reg_name {:global, __MODULE__} + + def whereis, do: GenServer.whereis(@reg_name) + def start_link(_) do - GenServer.start_link(__MODULE__, nil, name: __MODULE__) + case whereis() do + nil -> + GenServer.start_link(__MODULE__, nil, name: @reg_name) + + pid -> + {:ok, pid} + end end @impl true @@ -61,21 +45,22 @@ def init(_) do def handle_continue(:init_state, _state) do {:ok, _} = State.start_link(nil) - put_state(:status, :init) + put_stat(:status, :init) dm = data_migration() + manual_migrations = Config.get([:instance, :manual_data_migrations], []) cond do Config.get(:env) == :test -> - put_state(:status, :noop) + put_stat(:status, :noop) is_nil(dm) -> - put_state(:status, :halt) - put_state(:message, "Data migration does not exist.") + put_stat(:status, :halt) + put_stat(:message, "Data migration does not exist.") - dm.state == :manual -> - put_state(:status, :noop) - put_state(:message, "Data migration is in manual execution state.") + dm.state == :manual or dm.name in manual_migrations -> + put_stat(:status, :noop) + put_stat(:message, "Data migration is in manual execution state.") dm.state == :complete -> handle_success() @@ -91,8 +76,12 @@ def handle_continue(:init_state, _state) do def handle_info(:migrate_hashtags, state) do data_migration = data_migration() - {:ok, data_migration} = DataMigration.update_state(data_migration, :running) - put_state(:status, :running) + persistent_data = Map.take(data_migration.data, ["max_processed_id"]) + + {:ok, data_migration} = + DataMigration.update(data_migration, %{state: :running, data: persistent_data}) + + put_stat(:status, :running) Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") @@ -137,10 +126,12 @@ def handle_info(:migrate_hashtags, state) do ) max_object_id = Enum.at(object_ids, -1) - _ = DataMigration.update(data_migration, %{data: %{"max_processed_id" => max_object_id}}) - increment_state(:processed_count, length(object_ids)) - increment_state(:failed_count, length(failed_ids)) + put_stat(:max_processed_id, max_object_id) + increment_stat(:processed_count, length(object_ids)) + increment_stat(:failed_count, length(failed_ids)) + + persist_stats(data_migration) # A quick and dirty approach to controlling the load this background migration imposes sleep_interval = Config.get([:populate_hashtags_table, :sleep_interval_ms], 0) @@ -153,14 +144,15 @@ def handle_info(:migrate_hashtags, state) do "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", [data_migration.id] ) do - put_state(:status, :complete) _ = DataMigration.update_state(data_migration, :complete) handle_success() else _ -> - put_state(:status, :failed) - put_state(:message, "Please check data_migration_failed_ids records.") + _ = DataMigration.update_state(data_migration, :failed) + + put_stat(:status, :failed) + put_stat(:message, "Please check data_migration_failed_ids records.") end {:noreply, state} @@ -199,8 +191,13 @@ defp transfer_object_hashtags(object) do end) end + defp persist_stats(data_migration) do + runner_state = Map.drop(state(), [:status]) + _ = DataMigration.update(data_migration, %{data: runner_state}) + end + defp handle_success do - put_state(:status, :complete) + put_stat(:status, :complete) unless Config.improved_hashtag_timeline() do Config.put(Config.improved_hashtag_timeline_path(), true) @@ -208,4 +205,13 @@ defp handle_success do :ok end + + def force_continue do + send(whereis(), :migrate_hashtags) + end + + def force_restart do + {:ok, _} = DataMigration.update(data_migration(), %{state: :pending, data: %{}}) + force_continue() + end end diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex new file mode 100644 index 000000000..79926892c --- /dev/null +++ b/lib/pleroma/migrators/hashtags_table_migrator/state.ex @@ -0,0 +1,26 @@ +defmodule Pleroma.Migrators.HashtagsTableMigrator.State do + use Agent + + @init_state %{} + + def start_link(_) do + Agent.start_link(fn -> @init_state end, name: __MODULE__) + end + + def get do + Agent.get(__MODULE__, & &1) + end + + def put(key, value) do + Agent.update(__MODULE__, fn state -> + Map.put(state, key, value) + end) + end + + def increment(key, increment \\ 1) do + Agent.update(__MODULE__, fn state -> + updated_value = (state[key] || 0) + increment + Map.put(state, key, updated_value) + end) + end +end diff --git a/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs b/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs index 43d616705..bfac09f9e 100644 --- a/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs +++ b/priv/repo/migrations/20190711042021_create_safe_jsonb_set.exs @@ -9,7 +9,7 @@ def change do begin result := jsonb_set(target, path, coalesce(new_value, 'null'::jsonb), create_missing); if result is NULL then - raise 'jsonb_set tried to wipe the object, please report this incindent to Pleroma bug tracker. https://git.pleroma.social/pleroma/pleroma/issues/new'; + raise 'jsonb_set tried to wipe the object, please report this incident to Pleroma bug tracker. https://git.pleroma.social/pleroma/pleroma/issues/new'; return target; else return result; -- cgit v1.2.3 From fb47e83adc074f994714c83618b6de17915d0556 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 14 Jan 2021 13:53:35 -0600 Subject: Add ConfigDB migration --- .../20210113225652_deprecate_public_endpoint.exs | 57 ++++++++++++++++++++ .../public_endpoint_deprecation_test.exs | 60 ++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs create mode 100644 test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs diff --git a/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs b/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs new file mode 100644 index 000000000..d2e6e3c56 --- /dev/null +++ b/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs @@ -0,0 +1,57 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpoint do + use Ecto.Migration + + def up do + with %Pleroma.ConfigDB{} = s3_config <- + Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}), + %Pleroma.ConfigDB{} = upload_config <- + Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) do + public_endpoint = s3_config.value[:public_endpoint] + + if !is_nil(public_endpoint) do + upload_value = upload_config.value |> Keyword.merge(base_url: public_endpoint) + + upload_config + |> Ecto.Changeset.change(value: upload_value) + |> Pleroma.Repo.update() + + s3_value = s3_config.value |> Keyword.delete(:public_endpoint) + + s3_config + |> Ecto.Changeset.change(value: s3_value) + |> Pleroma.Repo.update() + end + else + _ -> :ok + end + end + + def down do + with %Pleroma.ConfigDB{} = upload_config <- + Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}), + %Pleroma.ConfigDB{} = s3_config <- + Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}) do + base_url = upload_config.value[:base_url] + + if !is_nil(base_url) do + s3_value = s3_config.value |> Keyword.merge(public_endpoint: base_url) + + s3_config + |> Ecto.Changeset.change(value: s3_value) + |> Pleroma.Repo.update() + + upload_value = upload_config.value |> Keyword.delete(:base_url) + + upload_config + |> Ecto.Changeset.change(value: upload_value) + |> Pleroma.Repo.update() + end + else + _ -> :ok + end + end +end diff --git a/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs b/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs new file mode 100644 index 000000000..b68d24bfc --- /dev/null +++ b/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs @@ -0,0 +1,60 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpointTest do + use Pleroma.DataCase + import Pleroma.Factory + import Pleroma.Tests.Helpers + alias Pleroma.ConfigDB + + setup do: clear_config(Pleroma.Upload) + setup do: clear_config(Pleroma.Uploaders.S3) + setup_all do: require_migration("20210113225652_deprecate_public_endpoint") + + test "up/0 migrates public_endpoint to base_url", %{migration: migration} do + s3_values = [ + public_endpoint: "https://coolhost.com/", + bucket: "secret_bucket" + ] + + insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values) + + upload_values = [ + uploader: Pleroma.Uploaders.S3 + ] + + insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values) + + migration.up() + + assert [bucket: "secret_bucket"] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value + + assert [uploader: Pleroma.Uploaders.S3, base_url: "https://coolhost.com/"] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value + end + + test "down/0 reverts base_url to public_endpoint", %{migration: migration} do + s3_values = [ + bucket: "secret_bucket" + ] + + insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values) + + upload_values = [ + uploader: Pleroma.Uploaders.S3, + base_url: "https://coolhost.com/" + ] + + insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values) + + migration.down() + + assert [bucket: "secret_bucket", public_endpoint: "https://coolhost.com/"] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value + + assert [uploader: Pleroma.Uploaders.S3] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value + end +end -- cgit v1.2.3 From 12c8ce481c1afec69a9f401bcfffae63744dfb09 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 14 Jan 2021 13:58:52 -0600 Subject: Bump Copyright year --- priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs | 2 +- test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs b/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs index d2e6e3c56..6f470a459 100644 --- a/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs +++ b/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpoint do diff --git a/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs b/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs index b68d24bfc..2ffc1b145 100644 --- a/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs +++ b/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors +# Copyright © 2017-2021 Pleroma Authors # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpointTest do -- cgit v1.2.3 From 0b725f5d216cfd2b11f81cddd792338c23161a60 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 14 Jan 2021 16:00:32 -0600 Subject: Lint --- .../migrations/deprecate_public_endpoint_test.exs | 60 ++++++++++++++++++++++ .../public_endpoint_deprecation_test.exs | 60 ---------------------- 2 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs delete mode 100644 test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs diff --git a/test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs b/test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs new file mode 100644 index 000000000..2ffc1b145 --- /dev/null +++ b/test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs @@ -0,0 +1,60 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpointTest do + use Pleroma.DataCase + import Pleroma.Factory + import Pleroma.Tests.Helpers + alias Pleroma.ConfigDB + + setup do: clear_config(Pleroma.Upload) + setup do: clear_config(Pleroma.Uploaders.S3) + setup_all do: require_migration("20210113225652_deprecate_public_endpoint") + + test "up/0 migrates public_endpoint to base_url", %{migration: migration} do + s3_values = [ + public_endpoint: "https://coolhost.com/", + bucket: "secret_bucket" + ] + + insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values) + + upload_values = [ + uploader: Pleroma.Uploaders.S3 + ] + + insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values) + + migration.up() + + assert [bucket: "secret_bucket"] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value + + assert [uploader: Pleroma.Uploaders.S3, base_url: "https://coolhost.com/"] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value + end + + test "down/0 reverts base_url to public_endpoint", %{migration: migration} do + s3_values = [ + bucket: "secret_bucket" + ] + + insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values) + + upload_values = [ + uploader: Pleroma.Uploaders.S3, + base_url: "https://coolhost.com/" + ] + + insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values) + + migration.down() + + assert [bucket: "secret_bucket", public_endpoint: "https://coolhost.com/"] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value + + assert [uploader: Pleroma.Uploaders.S3] == + ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value + end +end diff --git a/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs b/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs deleted file mode 100644 index 2ffc1b145..000000000 --- a/test/pleroma/repo/migrations/public_endpoint_deprecation_test.exs +++ /dev/null @@ -1,60 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpointTest do - use Pleroma.DataCase - import Pleroma.Factory - import Pleroma.Tests.Helpers - alias Pleroma.ConfigDB - - setup do: clear_config(Pleroma.Upload) - setup do: clear_config(Pleroma.Uploaders.S3) - setup_all do: require_migration("20210113225652_deprecate_public_endpoint") - - test "up/0 migrates public_endpoint to base_url", %{migration: migration} do - s3_values = [ - public_endpoint: "https://coolhost.com/", - bucket: "secret_bucket" - ] - - insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values) - - upload_values = [ - uploader: Pleroma.Uploaders.S3 - ] - - insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values) - - migration.up() - - assert [bucket: "secret_bucket"] == - ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value - - assert [uploader: Pleroma.Uploaders.S3, base_url: "https://coolhost.com/"] == - ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value - end - - test "down/0 reverts base_url to public_endpoint", %{migration: migration} do - s3_values = [ - bucket: "secret_bucket" - ] - - insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values) - - upload_values = [ - uploader: Pleroma.Uploaders.S3, - base_url: "https://coolhost.com/" - ] - - insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values) - - migration.down() - - assert [bucket: "secret_bucket", public_endpoint: "https://coolhost.com/"] == - ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value - - assert [uploader: Pleroma.Uploaders.S3] == - ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value - end -end -- cgit v1.2.3 From 8d6e9b25a416c0ccc551f94550071968cb76a09c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 14 Jan 2021 16:58:18 -0600 Subject: Just validate command is in PATH; forking a shell is wasteful --- lib/pleroma/utils.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index fa75a8c99..fae7657d9 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -30,7 +30,10 @@ def compile_dir(dir) when is_binary(dir) do """ @spec command_available?(String.t()) :: boolean() def command_available?(command) do - match?({_output, 0}, System.cmd("sh", ["-c", "command -v #{command}"])) + case :os.find_executable(String.to_charlist(command)) do + false -> false + _ -> true + end end @doc "creates the uniq temporary directory" -- cgit v1.2.3 From d0e0396528c55f1b61c1d48452e855ea69ec3e89 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 14 Jan 2021 17:49:37 -0600 Subject: Hack to fix tests not passing. Unclear why the filters are being set to nil. Both of these changes are needed or it doesn't work. --- lib/pleroma/upload/filter.ex | 2 ++ test/support/data_case.ex | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/upload/filter.ex b/lib/pleroma/upload/filter.ex index 661135634..367acd214 100644 --- a/lib/pleroma/upload/filter.ex +++ b/lib/pleroma/upload/filter.ex @@ -43,4 +43,6 @@ def filter([filter | rest], upload) do error end end + + def filter(nil, upload), do: filter([], upload) end diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 0b41f0f63..23c858d2a 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -107,7 +107,7 @@ def stub_pipeline do def ensure_local_uploader(context) do test_uploader = Map.get(context, :uploader, Pleroma.Uploaders.Local) uploader = Pleroma.Config.get([Pleroma.Upload, :uploader]) - filters = Pleroma.Config.get([Pleroma.Upload, :filters]) + filters = Pleroma.Config.get([Pleroma.Upload, :filters]) || [] Pleroma.Config.put([Pleroma.Upload, :uploader], test_uploader) Pleroma.Config.put([Pleroma.Upload, :filters], []) -- cgit v1.2.3 From f7e59c28ed2d4693ce177737e3878b606f1b5848 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 16 Oct 2020 21:44:25 +0000 Subject: Change user.approval_pending field to user.is_approved --- lib/pleroma/user.ex | 30 +++++++++--------- lib/pleroma/user/query.ex | 4 +-- lib/pleroma/web/admin_api/views/account_view.ex | 2 +- ...205220_refactor_approval_pending_user_field.exs | 20 ++++++++++++ test/pleroma/user_test.exs | 36 +++++++++++----------- .../admin_api/controllers/user_controller_test.exs | 26 ++++++++-------- test/pleroma/web/admin_api/search_test.exs | 2 +- .../controllers/account_controller_test.exs | 4 +-- test/pleroma/web/o_auth/o_auth_controller_test.exs | 2 +- test/pleroma/web/twitter_api/twitter_api_test.exs | 2 +- 10 files changed, 74 insertions(+), 54 deletions(-) create mode 100644 priv/repo/migrations/20201016205220_refactor_approval_pending_user_field.exs diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 6a81adfd6..83a37890a 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -112,7 +112,7 @@ defmodule Pleroma.User do field(:is_locked, :boolean, default: false) field(:confirmation_pending, :boolean, default: false) field(:password_reset_pending, :boolean, default: false) - field(:approval_pending, :boolean, default: false) + field(:is_approved, :boolean, default: true) field(:registration_reason, :string, default: nil) field(:confirmation_token, :string, default: nil) field(:default_scope, :string, default: "public") @@ -288,7 +288,7 @@ def binary_id(%User{} = user), do: binary_id(user.id) @spec account_status(User.t()) :: account_status() def account_status(%User{deactivated: true}), do: :deactivated def account_status(%User{password_reset_pending: true}), do: :password_reset_pending - def account_status(%User{local: true, approval_pending: true}), do: :approval_pending + def account_status(%User{local: true, is_approved: false}), do: :approval_pending def account_status(%User{local: true, confirmation_pending: true}) do if Config.get([:instance, :account_activation_required]) do @@ -711,16 +711,16 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do opts[:need_confirmation] end - need_approval? = - if is_nil(opts[:need_approval]) do - Config.get([:instance, :account_approval_required]) + approved? = + if is_nil(opts[:approved]) do + !Config.get([:instance, :account_approval_required]) else - opts[:need_approval] + opts[:approved] end struct |> confirmation_changeset(need_confirmation: need_confirmation?) - |> approval_changeset(need_approval: need_approval?) + |> approval_changeset(set_approval: approved?) |> cast(params, [ :bio, :raw_bio, @@ -814,14 +814,14 @@ def post_register_action(%User{confirmation_pending: true} = user) do end end - def post_register_action(%User{approval_pending: true} = user) do + def post_register_action(%User{is_approved: false} = user) do with {:ok, _} <- send_user_approval_email(user), {:ok, _} <- send_admin_approval_emails(user) do {:ok, user} end end - def post_register_action(%User{approval_pending: false, confirmation_pending: false} = user) do + def post_register_action(%User{is_approved: true, confirmation_pending: false} = user) do with {:ok, user} <- autofollow_users(user), {:ok, _} <- autofollowing_users(user), {:ok, user} <- set_cache(user), @@ -1624,8 +1624,8 @@ def approve(users) when is_list(users) do end) end - def approve(%User{approval_pending: true} = user) do - with chg <- change(user, approval_pending: false), + def approve(%User{is_approved: false} = user) do + with chg <- change(user, is_approved: true), {:ok, user} <- update_and_set_cache(chg) do post_register_action(user) {:ok, user} @@ -1684,7 +1684,7 @@ def purge_user_changeset(user) do is_locked: false, confirmation_pending: false, password_reset_pending: false, - approval_pending: false, + is_approved: true, registration_reason: nil, confirmation_token: nil, domain_blocks: [], @@ -2327,9 +2327,9 @@ def confirmation_changeset(user, need_confirmation: need_confirmation?) do end @spec approval_changeset(User.t(), keyword()) :: Changeset.t() - def approval_changeset(user, need_approval: need_approval?) do - params = if need_approval?, do: %{approval_pending: true}, else: %{approval_pending: false} - cast(user, params, [:approval_pending]) + def approval_changeset(user, set_approval: approved?) do + params = if approved?, do: %{is_approved: true}, else: %{is_approved: false} + cast(user, params, [:is_approved]) end def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index ab9554bd2..90548677f 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -138,7 +138,7 @@ defp compose_query({:external, _}, query), do: location_query(query, false) defp compose_query({:active, _}, query) do User.restrict_deactivated(query) - |> where([u], u.approval_pending == false) + |> where([u], u.is_approved == true) end defp compose_query({:legacy_active, _}, query) do @@ -159,7 +159,7 @@ defp compose_query({:confirmation_pending, bool}, query) do end defp compose_query({:need_approval, _}, query) do - where(query, [u], u.approval_pending) + where(query, [u], u.is_approved == false) end defp compose_query({:unconfirmed, _}, query) do diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex index 37188bfeb..1a876d272 100644 --- a/lib/pleroma/web/admin_api/views/account_view.ex +++ b/lib/pleroma/web/admin_api/views/account_view.ex @@ -78,7 +78,7 @@ def render("show.json", %{user: user}) do "roles" => User.roles(user), "tags" => user.tags || [], "confirmation_pending" => user.confirmation_pending, - "approval_pending" => user.approval_pending, + "is_approved" => user.is_approved, "url" => user.uri || user.ap_id, "registration_reason" => user.registration_reason, "actor_type" => user.actor_type diff --git a/priv/repo/migrations/20201016205220_refactor_approval_pending_user_field.exs b/priv/repo/migrations/20201016205220_refactor_approval_pending_user_field.exs new file mode 100644 index 000000000..944dcf8de --- /dev/null +++ b/priv/repo/migrations/20201016205220_refactor_approval_pending_user_field.exs @@ -0,0 +1,20 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.RefactorApprovalPendingUserField do + use Ecto.Migration + + def up do + # Flip the values before we change the meaning of the column + execute("UPDATE users SET approval_pending = NOT approval_pending;") + execute("ALTER TABLE users RENAME COLUMN approval_pending TO is_approved;") + execute("ALTER TABLE users ALTER COLUMN is_approved SET DEFAULT true;") + end + + def down do + execute("UPDATE users SET is_approved = NOT is_approved;") + execute("ALTER TABLE users RENAME COLUMN is_approved TO approval_pending;") + execute("ALTER TABLE users ALTER COLUMN approval_pending SET DEFAULT false;") + end +end diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index bdf17e96a..c6d8e1463 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -694,7 +694,7 @@ test "it creates unapproved user" do {:ok, user} = Repo.insert(changeset) - assert user.approval_pending + refute user.is_approved assert user.registration_reason == "I'm a cool guy :)" end @@ -1388,17 +1388,17 @@ test "hide a user's statuses from timelines and notifications" do describe "approve" do test "approves a user" do - user = insert(:user, approval_pending: true) - assert true == user.approval_pending + user = insert(:user, is_approved: false) + refute user.is_approved {:ok, user} = User.approve(user) - assert false == user.approval_pending + assert user.is_approved end test "approves a list of users" do unapproved_users = [ - insert(:user, approval_pending: true), - insert(:user, approval_pending: true), - insert(:user, approval_pending: true) + insert(:user, is_approved: false), + insert(:user, is_approved: false), + insert(:user, is_approved: false) ] {:ok, users} = User.approve(unapproved_users) @@ -1406,7 +1406,7 @@ test "approves a list of users" do assert Enum.count(users) == 3 Enum.each(users, fn user -> - assert false == user.approval_pending + assert user.is_approved end) end @@ -1414,7 +1414,7 @@ test "it sends welcome email if it is set" do clear_config([:welcome, :email, :enabled], true) clear_config([:welcome, :email, :sender], "tester@test.me") - user = insert(:user, approval_pending: true) + user = insert(:user, is_approved: false) welcome_user = insert(:user, email: "tester@test.me") instance_name = Pleroma.Config.get([:instance, :name]) @@ -1432,7 +1432,7 @@ test "it sends welcome email if it is set" do test "approving an approved user does not trigger post-register actions" do clear_config([:welcome, :email, :enabled], true) - user = insert(:user, approval_pending: false) + user = insert(:user, is_approved: true) User.approve(user) ObanHelpers.perform_all() @@ -1465,9 +1465,9 @@ test "confirms a list of users" do end) end - test "sends approval emails when `approval_pending: true`" do + test "sends approval emails when `is_approved: false`" do admin = insert(:user, is_admin: true) - user = insert(:user, confirmation_pending: true, approval_pending: true) + user = insert(:user, confirmation_pending: true, is_approved: false) User.confirm(user) ObanHelpers.perform_all() @@ -1494,7 +1494,7 @@ test "sends approval emails when `approval_pending: true`" do end test "confirming a confirmed user does not trigger post-register actions" do - user = insert(:user, confirmation_pending: false, approval_pending: true) + user = insert(:user, confirmation_pending: false, is_approved: false) User.confirm(user) ObanHelpers.perform_all() @@ -1591,7 +1591,7 @@ test "deactivates user when activation is not required", %{user: user} do end test "delete/1 when approval is pending deletes the user" do - user = insert(:user, approval_pending: true) + user = insert(:user, is_approved: false) {:ok, job} = User.delete(user) {:ok, _} = ObanHelpers.perform(job) @@ -1618,7 +1618,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do is_locked: true, confirmation_pending: true, password_reset_pending: true, - approval_pending: true, + is_approved: false, registration_reason: "ahhhhh", confirmation_token: "qqqq", domain_blocks: ["lain.com"], @@ -1660,7 +1660,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do is_locked: false, confirmation_pending: false, password_reset_pending: false, - approval_pending: false, + is_approved: true, registration_reason: nil, confirmation_token: nil, domain_blocks: [], @@ -1755,10 +1755,10 @@ test "returns :deactivated for deactivated user" do end test "returns :approval_pending for unapproved user" do - user = insert(:user, local: true, approval_pending: true) + user = insert(:user, local: true, is_approved: false) assert User.account_status(user) == :approval_pending - user = insert(:user, local: true, confirmation_pending: true, approval_pending: true) + user = insert(:user, local: true, confirmation_pending: true, is_approved: false) assert User.account_status(user) == :approval_pending end end diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 40d39aae7..ed094823b 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -429,7 +429,7 @@ test "allows to force-unfollow another user", %{admin: admin, conn: conn} do describe "GET /api/pleroma/admin/users" do test "renders users array for the first page", %{conn: conn, admin: admin} do user = insert(:user, local: false, tags: ["foo", "bar"]) - user2 = insert(:user, approval_pending: true, registration_reason: "I'm a chill dude") + user2 = insert(:user, is_approved: false, registration_reason: "I'm a chill dude") conn = get(conn, "/api/pleroma/admin/users?page=1") @@ -444,7 +444,7 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do user2, %{ "local" => true, - "approval_pending" => true, + "is_approved" => false, "registration_reason" => "I'm a chill dude", "actor_type" => "Person" } @@ -638,7 +638,7 @@ test "only unconfirmed users", %{conn: conn} do sad_user = insert(:user, nickname: "sadboy", confirmation_pending: true) old_user = insert(:user, nickname: "oldboy", confirmation_pending: true) - insert(:user, nickname: "happyboy", approval_pending: false) + insert(:user, nickname: "happyboy", is_approved: true) insert(:user, confirmation_pending: false) result = @@ -650,7 +650,7 @@ test "only unconfirmed users", %{conn: conn} do Enum.map([old_user, sad_user], fn user -> user_response(user, %{ "confirmation_pending" => true, - "approval_pending" => false + "is_approved" => true }) end) |> Enum.sort_by(& &1["nickname"]) @@ -662,18 +662,18 @@ test "only unapproved users", %{conn: conn} do user = insert(:user, nickname: "sadboy", - approval_pending: true, + is_approved: false, registration_reason: "Plz let me in!" ) - insert(:user, nickname: "happyboy", approval_pending: false) + insert(:user, nickname: "happyboy", is_approved: true) conn = get(conn, "/api/pleroma/admin/users?filters=need_approval") users = [ user_response( user, - %{"approval_pending" => true, "registration_reason" => "Plz let me in!"} + %{"is_approved" => false, "registration_reason" => "Plz let me in!"} ) ] @@ -816,8 +816,8 @@ test "load users with tags list", %{conn: conn} do end test "`active` filters out users pending approval", %{token: token} do - insert(:user, approval_pending: true) - %{id: user_id} = insert(:user, approval_pending: false) + insert(:user, is_approved: false) + %{id: user_id} = insert(:user, is_approved: true) %{id: admin_id} = token.user conn = @@ -913,8 +913,8 @@ test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do end test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do - user_one = insert(:user, approval_pending: true) - user_two = insert(:user, approval_pending: true) + user_one = insert(:user, is_approved: false) + user_two = insert(:user, is_approved: false) conn = patch( @@ -924,7 +924,7 @@ test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do ) response = json_response(conn, 200) - assert Enum.map(response["users"], & &1["approval_pending"]) == [false, false] + assert Enum.map(response["users"], & &1["is_approved"]) == [true, true] log_entry = Repo.one(ModerationLog) @@ -961,7 +961,7 @@ defp user_response(user, attrs \\ %{}) do "avatar" => User.avatar_url(user) |> MediaProxy.url(), "display_name" => HTML.strip_tags(user.name || user.nickname), "confirmation_pending" => false, - "approval_pending" => false, + "is_approved" => true, "url" => user.ap_id, "registration_reason" => nil, "actor_type" => "Person" diff --git a/test/pleroma/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs index 307578ae0..10ec227d6 100644 --- a/test/pleroma/web/admin_api/search_test.exs +++ b/test/pleroma/web/admin_api/search_test.exs @@ -182,7 +182,7 @@ test "it returns user by email" do end test "it returns unapproved user" do - unapproved = insert(:user, approval_pending: true) + unapproved = insert(:user, is_approved: false) insert(:user) insert(:user) diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 7b3cc7344..1c310bb07 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -1028,7 +1028,7 @@ test "registers and logs in without :account_activation_required / :account_appr assert user refute user.confirmation_pending - refute user.approval_pending + assert user.is_approved end test "registers but does not log in with :account_activation_required", %{conn: conn} do @@ -1150,7 +1150,7 @@ test "registers but does not log in with :account_approval_required", %{conn: co user = Repo.get_by(User, email: "lain@example.org") - assert user.approval_pending + refute user.is_approved assert user.registration_reason == "I'm a cool dude, bro" end diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index bf47afed8..646d62da4 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -1041,7 +1041,7 @@ test "rejects token exchange for valid credentials belonging to an unapproved us user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), - approval_pending: true + is_approved: false ) refute Pleroma.User.account_status(user) == :active diff --git a/test/pleroma/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs index 3be4812d3..05152ee21 100644 --- a/test/pleroma/web/twitter_api/twitter_api_test.exs +++ b/test/pleroma/web/twitter_api/twitter_api_test.exs @@ -97,7 +97,7 @@ test "it sends an admin email if :account_approval_required is specified in inst {:ok, user} = TwitterAPI.register_user(data) ObanHelpers.perform_all() - assert user.approval_pending + refute user.is_approved user_email = Pleroma.Emails.UserEmail.approval_pending_email(user) admin_email = Pleroma.Emails.AdminEmail.new_unapproved_registration(admin, user) -- cgit v1.2.3 From 63923df0a51fdae58daf71a8dd85929a29ab1546 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 16 Oct 2020 21:50:44 +0000 Subject: Further simplify changeset logic --- lib/pleroma/user.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 83a37890a..f6eca0109 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2328,8 +2328,7 @@ def confirmation_changeset(user, need_confirmation: need_confirmation?) do @spec approval_changeset(User.t(), keyword()) :: Changeset.t() def approval_changeset(user, set_approval: approved?) do - params = if approved?, do: %{is_approved: true}, else: %{is_approved: false} - cast(user, params, [:is_approved]) + cast(user, %{is_approved: approved?}, [:is_approved]) end def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do -- cgit v1.2.3 From 860b5c78048ede3597a02b6029634d74fd520204 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 12 Oct 2020 17:42:27 -0500 Subject: Change user.deactivated field to user.is_active --- lib/mix/tasks/pleroma/email.ex | 2 +- lib/mix/tasks/pleroma/user.ex | 10 +++--- lib/pleroma/following_relationship.ex | 2 +- lib/pleroma/notification.ex | 2 +- lib/pleroma/stats.ex | 2 +- lib/pleroma/user.ex | 28 ++++++++--------- lib/pleroma/user/query.ex | 2 +- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- .../object_validators/common_validations.ex | 2 +- .../web/admin_api/controllers/user_controller.ex | 4 +-- lib/pleroma/web/admin_api/views/account_view.ex | 2 +- .../api_spec/operations/admin/report_operation.ex | 2 +- .../api_spec/operations/admin/status_operation.ex | 2 +- lib/pleroma/web/mastodon_api/views/account_view.ex | 2 +- .../web/mongoose_im/mongoose_im_controller.ex | 4 +-- .../web/pleroma_api/views/emoji_reaction_view.ex | 2 +- lib/pleroma/web/twitter_api/twitter_api.ex | 2 +- ...01012173004_refactor_deactivated_user_field.exs | 18 +++++++++++ test/mix/tasks/pleroma/email_test.exs | 12 ++++---- test/mix/tasks/pleroma/user_test.exs | 12 ++++---- test/pleroma/user_test.exs | 32 +++++++++---------- .../web/activity_pub/side_effects/delete_test.exs | 2 +- .../pleroma/web/activity_pub/side_effects_test.exs | 2 +- .../transmogrifier/chat_message_test.exs | 2 +- .../transmogrifier/delete_handling_test.exs | 2 +- .../transmogrifier/note_handling_test.exs | 2 +- .../controllers/status_controller_test.exs | 2 +- .../admin_api/controllers/user_controller_test.exs | 36 +++++++++++----------- test/pleroma/web/admin_api/search_test.exs | 8 ++--- test/pleroma/web/common_api_test.exs | 2 +- .../controllers/account_controller_test.exs | 4 +-- .../controllers/auth_controller_test.exs | 2 +- .../controllers/instance_controller_test.exs | 2 +- .../pleroma/web/mastodon_api/mastodon_api_test.exs | 2 +- .../web/mastodon_api/views/account_view_test.exs | 2 +- test/pleroma/web/mongoose_im_controller_test.exs | 4 +-- test/pleroma/web/o_auth/o_auth_controller_test.exs | 2 +- test/pleroma/web/plugs/user_enabled_plug_test.exs | 2 +- .../twitter_api/remote_follow_controller_test.exs | 2 +- .../web/twitter_api/util_controller_test.exs | 6 ++-- 40 files changed, 125 insertions(+), 107 deletions(-) create mode 100644 priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex index 54f158f73..665d3b88e 100644 --- a/lib/mix/tasks/pleroma/email.ex +++ b/lib/mix/tasks/pleroma/email.ex @@ -33,7 +33,7 @@ def run(["resend_confirmation_emails"]) do Pleroma.User.Query.build(%{ local: true, - deactivated: false, + is_active: true, confirmation_pending: true, invisible: false }) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index f90c045fe..9cd74efde 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -111,10 +111,10 @@ def run(["toggle_activated", nickname]) do start_pleroma() with %User{} = user <- User.get_cached_by_nickname(nickname) do - {:ok, user} = User.deactivate(user, !user.deactivated) + {:ok, user} = User.deactivate(user, user.is_active) shell_info( - "Activation status of #{nickname}: #{if(user.deactivated, do: "de", else: "")}activated" + "Activation status of #{nickname}: #{unless(user.is_active, do: "de", else: "")}activated" ) else _ -> @@ -365,7 +365,7 @@ def run(["confirm_all"]) do Pleroma.User.Query.build(%{ local: true, - deactivated: false, + is_active: true, is_moderator: false, is_admin: false, invisible: false @@ -383,7 +383,7 @@ def run(["unconfirm_all"]) do Pleroma.User.Query.build(%{ local: true, - deactivated: false, + is_active: true, is_moderator: false, is_admin: false, invisible: false @@ -420,7 +420,7 @@ def run(["list"]) do shell_info( "#{user.nickname} moderator: #{user.is_moderator}, admin: #{user.is_admin}, locked: #{ user.is_locked - }, deactivated: #{user.deactivated}" + }, is_active: #{user.is_active}" ) end) end) diff --git a/lib/pleroma/following_relationship.ex b/lib/pleroma/following_relationship.ex index 147cb9df0..a0c7e6e39 100644 --- a/lib/pleroma/following_relationship.ex +++ b/lib/pleroma/following_relationship.ex @@ -152,7 +152,7 @@ def get_follow_requests(%User{id: id}) do |> join(:inner, [r], f in assoc(r, :follower)) |> where([r], r.state == ^:follow_pending) |> where([r], r.following_id == ^id) - |> where([r, f], f.deactivated != true) + |> where([r, f], f.is_active == true) |> select([r, f], f) |> Repo.all() end diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 7a69dacde..55b513212 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -115,7 +115,7 @@ def for_user_query(user, opts \\ %{}) do |> where( [n, a], fragment( - "? not in (SELECT ap_id FROM users WHERE deactivated = 'true')", + "? not in (SELECT ap_id FROM users WHERE is_active = 'false')", a.actor ) ) diff --git a/lib/pleroma/stats.ex b/lib/pleroma/stats.ex index 77505bb04..b096a9b1e 100644 --- a/lib/pleroma/stats.ex +++ b/lib/pleroma/stats.ex @@ -75,7 +75,7 @@ def calculate_stat_data do users_query = from(u in User, - where: u.deactivated != true, + where: u.is_active == true, where: u.local == true, where: not is_nil(u.nickname), where: not u.invisible diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 6a81adfd6..2ae95ebdd 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -117,7 +117,7 @@ defmodule Pleroma.User do field(:confirmation_token, :string, default: nil) field(:default_scope, :string, default: "public") field(:domain_blocks, {:array, :string}, default: []) - field(:deactivated, :boolean, default: false) + field(:is_active, :boolean, default: true) field(:no_rich_text, :boolean, default: false) field(:ap_enabled, :boolean, default: false) field(:is_moderator, :boolean, default: false) @@ -286,7 +286,7 @@ def binary_id(%User{} = user), do: binary_id(user.id) @doc "Returns status account" @spec account_status(User.t()) :: account_status() - def account_status(%User{deactivated: true}), do: :deactivated + def account_status(%User{is_active: false}), do: :deactivated def account_status(%User{password_reset_pending: true}), do: :password_reset_pending def account_status(%User{local: true, approval_pending: true}), do: :approval_pending @@ -388,7 +388,7 @@ def ap_following(%User{} = user), do: "#{ap_id(user)}/following" @spec restrict_deactivated(Ecto.Query.t()) :: Ecto.Query.t() def restrict_deactivated(query) do - from(u in query, where: u.deactivated != ^true) + from(u in query, where: u.is_active == ^true) end defp truncate_fields_param(params) do @@ -785,7 +785,7 @@ defp autofollow_users(user) do candidates = Config.get([:instance, :autofollowed_nicknames]) autofollowed_users = - User.Query.build(%{nickname: candidates, local: true, deactivated: false}) + User.Query.build(%{nickname: candidates, local: true, is_active: true}) |> Repo.all() follow_all(user, autofollowed_users) @@ -946,7 +946,7 @@ def follow(%User{} = follower, %User{} = followed, state \\ :follow_accept) do deny_follow_blocked = Config.get([:user, :deny_follow_blocked]) cond do - followed.deactivated -> + followed.is_active == false -> {:error, "Could not follow user: #{followed.nickname} is deactivated."} deny_follow_blocked and blocks?(followed, follower) -> @@ -1181,7 +1181,7 @@ def get_or_fetch_by_nickname(nickname) do @spec get_followers_query(User.t(), pos_integer() | nil) :: Ecto.Query.t() def get_followers_query(%User{} = user, nil) do - User.Query.build(%{followers: user, deactivated: false}) + User.Query.build(%{followers: user, is_active: true}) end def get_followers_query(%User{} = user, page) do @@ -1357,7 +1357,7 @@ def update_following_count(%User{local: true} = user) do @spec get_users_from_set([String.t()], keyword()) :: [User.t()] def get_users_from_set(ap_ids, opts \\ []) do local_only = Keyword.get(opts, :local_only, true) - criteria = %{ap_id: ap_ids, deactivated: false} + criteria = %{ap_id: ap_ids, is_active: true} criteria = if local_only, do: Map.put(criteria, :local, true), else: criteria User.Query.build(criteria) @@ -1368,7 +1368,7 @@ def get_users_from_set(ap_ids, opts \\ []) do def get_recipients_from_activity(%Activity{recipients: to, actor: actor}) do to = [actor | to] - query = User.Query.build(%{recipients_from_activity: to, local: true, deactivated: false}) + query = User.Query.build(%{recipients_from_activity: to, local: true, is_active: true}) query |> Repo.all() @@ -1600,7 +1600,7 @@ def deactivate(users, status) when is_list(users) do end def deactivate(%User{} = user, status) do - with {:ok, user} <- set_activation_status(user, status) do + with {:ok, user} <- set_activation_status(user, !status) do user |> get_followers() |> Enum.filter(& &1.local) @@ -1688,7 +1688,7 @@ def purge_user_changeset(user) do registration_reason: nil, confirmation_token: nil, domain_blocks: [], - deactivated: true, + is_active: false, ap_enabled: false, is_moderator: false, is_admin: false, @@ -2056,7 +2056,7 @@ def error_user(ap_id) do @spec all_superusers() :: [User.t()] def all_superusers do - User.Query.build(%{super_users: true, local: true, deactivated: false}) + User.Query.build(%{super_users: true, local: true, is_active: true}) |> Repo.all() end @@ -2097,7 +2097,7 @@ def list_inactive_users_query(inactivity_threshold \\ 7) do left_join: a in Pleroma.Activity, on: u.ap_id == a.actor, where: not is_nil(u.nickname), - where: u.deactivated != ^true, + where: u.is_active == ^true, where: u.id not in ^has_read_notifications, group_by: u.id, having: @@ -2218,9 +2218,9 @@ def change_email(user, email) do end # Internal function; public one is `deactivate/2` - defp set_activation_status(user, deactivated) do + defp set_activation_status(user, status) do user - |> cast(%{deactivated: deactivated}, [:deactivated]) + |> cast(%{is_active: status}, [:is_active]) |> update_and_set_cache() end diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index ab9554bd2..c3551a0aa 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -151,7 +151,7 @@ defp compose_query({:deactivated, false}, query) do end defp compose_query({:deactivated, true}, query) do - where(query, [u], u.deactivated == ^true) + where(query, [u], u.is_active == false) end defp compose_query({:confirmation_pending, bool}, query) do diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index c5bc08153..d0bb07aab 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -56,7 +56,7 @@ defp check_actor_is_active(nil), do: true defp check_actor_is_active(actor) when is_binary(actor) do case User.get_cached_by_ap_id(actor) do - %User{deactivated: deactivated} -> not deactivated + %User{is_active: true} -> true _ -> false end end diff --git a/lib/pleroma/web/activity_pub/object_validators/common_validations.ex b/lib/pleroma/web/activity_pub/object_validators/common_validations.ex index f5f87ca5d..093549a45 100644 --- a/lib/pleroma/web/activity_pub/object_validators/common_validations.ex +++ b/lib/pleroma/web/activity_pub/object_validators/common_validations.ex @@ -35,7 +35,7 @@ def validate_actor_presence(cng, options \\ []) do cng |> validate_change(field_name, fn field_name, actor -> case User.get_cached_by_ap_id(actor) do - %User{deactivated: true} -> + %User{is_active: false} -> [{field_name, "user is deactivated"}] %User{} -> diff --git a/lib/pleroma/web/admin_api/controllers/user_controller.ex b/lib/pleroma/web/admin_api/controllers/user_controller.ex index fa710c7ec..83dd3c918 100644 --- a/lib/pleroma/web/admin_api/controllers/user_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/user_controller.ex @@ -172,9 +172,9 @@ def show(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname}) do def toggle_activation(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname}) do user = User.get_cached_by_nickname(nickname) - {:ok, updated_user} = User.deactivate(user, !user.deactivated) + {:ok, updated_user} = User.deactivate(user, !user.is_active) - action = if user.deactivated, do: "activate", else: "deactivate" + action = if !user.is_active, do: "activate", else: "deactivate" ModerationLog.insert_log(%{ actor: admin, diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex index 37188bfeb..c4be096a9 100644 --- a/lib/pleroma/web/admin_api/views/account_view.ex +++ b/lib/pleroma/web/admin_api/views/account_view.ex @@ -73,7 +73,7 @@ def render("show.json", %{user: user}) do "avatar" => avatar, "nickname" => user.nickname, "display_name" => display_name, - "deactivated" => user.deactivated, + "is_active" => user.is_active, "local" => user.local, "roles" => User.roles(user), "tags" => user.tags || [], diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index 526698fc1..6395cf209 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -182,7 +182,7 @@ defp account_admin do properties: Map.merge(Account.schema().properties, %{ nickname: %Schema{type: :string}, - deactivated: %Schema{type: :boolean}, + is_active: %Schema{type: :boolean}, local: %Schema{type: :boolean}, roles: %Schema{ type: :object, diff --git a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex index a2319bacc..096e1a95c 100644 --- a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex @@ -132,7 +132,7 @@ def admin_account do avatar: %Schema{type: :string}, nickname: %Schema{type: :string}, display_name: %Schema{type: :string}, - deactivated: %Schema{type: :boolean}, + is_active: %Schema{type: :boolean}, local: %Schema{type: :boolean}, roles: %Schema{ type: :object, diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 2768f0291..bd9002620 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -376,7 +376,7 @@ defp maybe_put_allow_following_move(data, %User{id: user_id} = user, %User{id: u defp maybe_put_allow_following_move(data, _, _), do: data defp maybe_put_activation_status(data, user, %User{is_admin: true}) do - Kernel.put_in(data, [:pleroma, :deactivated], user.deactivated) + Kernel.put_in(data, [:pleroma, :deactivated], !user.is_active) end defp maybe_put_activation_status(data, _, _), do: data diff --git a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex index e7903dde8..6ace3e0b5 100644 --- a/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex +++ b/lib/pleroma/web/mongoose_im/mongoose_im_controller.ex @@ -14,7 +14,7 @@ defmodule Pleroma.Web.MongooseIM.MongooseIMController do plug(RateLimiter, [name: :authentication, params: ["user"]] when action == :check_password) def user_exists(conn, %{"user" => username}) do - with %User{} <- Repo.get_by(User, nickname: username, local: true, deactivated: false) do + with %User{} <- Repo.get_by(User, nickname: username, local: true, is_active: true) do conn |> json(true) else @@ -26,7 +26,7 @@ def user_exists(conn, %{"user" => username}) do end def check_password(conn, %{"user" => username, "pass" => password}) do - with %User{password_hash: password_hash, deactivated: false} <- + with %User{password_hash: password_hash, is_active: true} <- Repo.get_by(User, nickname: username, local: true), true <- AuthenticationPlug.checkpw(password, password_hash) do conn diff --git a/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex b/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex index 809ef9b40..c94527e6d 100644 --- a/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex +++ b/lib/pleroma/web/pleroma_api/views/emoji_reaction_view.ex @@ -26,7 +26,7 @@ defp fetch_users(user_ap_ids) do user_ap_ids |> Enum.map(&Pleroma.User.get_cached_by_ap_id/1) |> Enum.filter(fn - %{deactivated: false} -> true + %{is_active: true} -> true _ -> false end) end diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index f6d721da6..76ca82d20 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -59,7 +59,7 @@ defp create_user(params, opts) do def password_reset(nickname_or_email) do with true <- is_binary(nickname_or_email), - %User{local: true, email: email, deactivated: false} = user when is_binary(email) <- + %User{local: true, email: email, is_active: true} = user when is_binary(email) <- User.get_by_nickname_or_email(nickname_or_email), {:ok, token_record} <- Pleroma.PasswordResetToken.create_token(user) do user diff --git a/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs b/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs new file mode 100644 index 000000000..ac0afdd16 --- /dev/null +++ b/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs @@ -0,0 +1,18 @@ +defmodule Pleroma.Repo.Migrations.RefactorDeactivatedUserField do + use Ecto.Migration + + def up do + # Flip the values before we change the meaning of the column + execute("UPDATE users SET deactivated = NOT deactivated;") + execute("ALTER TABLE users RENAME COLUMN deactivated TO is_active;") + execute("ALTER TABLE users ALTER COLUMN is_active SET DEFAULT true;") + execute("ALTER INDEX users_deactivated_index RENAME TO users_is_active_index;") + end + + def down do + execute("UPDATE users SET is_active = NOT is_active;") + execute("ALTER TABLE users RENAME COLUMN is_active TO deactivated;") + execute("ALTER TABLE users ALTER COLUMN deactivated SET DEFAULT false;") + execute("ALTER INDEX users_is_active_index RENAME TO users_deactivated_index;") + end +end diff --git a/test/mix/tasks/pleroma/email_test.exs b/test/mix/tasks/pleroma/email_test.exs index 78cdf178b..f8f941b59 100644 --- a/test/mix/tasks/pleroma/email_test.exs +++ b/test/mix/tasks/pleroma/email_test.exs @@ -63,7 +63,7 @@ test "Sends confirmation emails" do insert(:user, %{ confirmation_pending: true, confirmation_token: "mytoken", - deactivated: false, + is_active: true, email: "local1@pleroma.com", local: true }) @@ -72,7 +72,7 @@ test "Sends confirmation emails" do insert(:user, %{ confirmation_pending: true, confirmation_token: "mytoken", - deactivated: false, + is_active: true, email: "local2@pleroma.com", local: true }) @@ -90,28 +90,28 @@ test "Does not send confirmation email to inappropriate users" do insert(:user, %{ confirmation_pending: false, confirmation_token: "mytoken", - deactivated: false, + is_active: true, email: "confirmed@pleroma.com", local: true }) # remote user insert(:user, %{ - deactivated: false, + is_active: true, email: "remote@not-pleroma.com", local: false }) # deactivated user = insert(:user, %{ - deactivated: true, + is_active: false, email: "deactivated@pleroma.com", local: false }) # invisible user insert(:user, %{ - deactivated: false, + is_active: true, email: "invisible@pleroma.com", local: true, invisible: true diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index 7c68b8a37..fdf2ceec4 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -102,7 +102,7 @@ test "user is deleted" do assert_received {:mix_shell, :info, [message]} assert message =~ " deleted" - assert %{deactivated: true} = User.get_by_nickname(user.nickname) + assert %{is_active: false} = User.get_by_nickname(user.nickname) assert called(Pleroma.Web.Federator.publish(:_)) end @@ -140,7 +140,7 @@ test "a remote user's create activity is deleted when the object has been pruned assert_received {:mix_shell, :info, [message]} assert message =~ " deleted" - assert %{deactivated: true} = User.get_by_nickname(user.nickname) + assert %{is_active: false} = User.get_by_nickname(user.nickname) assert called(Pleroma.Web.Federator.publish(:_)) refute Pleroma.Repo.get(Pleroma.Activity, like_activity.id) @@ -167,11 +167,11 @@ test "user is deactivated" do assert message =~ " deactivated" user = User.get_cached_by_nickname(user.nickname) - assert user.deactivated + refute user.is_active end test "user is activated" do - user = insert(:user, deactivated: true) + user = insert(:user, is_active: false) Mix.Tasks.Pleroma.User.run(["toggle_activated", user.nickname]) @@ -179,7 +179,7 @@ test "user is activated" do assert message =~ " activated" user = User.get_cached_by_nickname(user.nickname) - refute user.deactivated + assert user.is_active end test "no user to toggle" do @@ -210,7 +210,7 @@ test "user is unsubscribed" do user = User.get_cached_by_nickname(user.nickname) assert Enum.empty?(Enum.filter(User.get_friends(user), & &1.local)) - assert user.deactivated + refute user.is_active end test "no user to deactivate" do diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index bdf17e96a..42e37f0a5 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -202,11 +202,11 @@ test "doesn't return already accepted or duplicate follow requests" do test "doesn't return follow requests for deactivated accounts" do locked = insert(:user, is_locked: true) - pending_follower = insert(:user, %{deactivated: true}) + pending_follower = insert(:user, %{is_active: false}) CommonAPI.follow(pending_follower, locked) - assert true == pending_follower.deactivated + refute pending_follower.is_active assert [] = User.get_follow_requests(locked) end @@ -275,7 +275,7 @@ test "follow takes a user and another user" do test "can't follow a deactivated users" do user = insert(:user) - followed = insert(:user, %{deactivated: true}) + followed = insert(:user, %{is_active: false}) {:error, _} = User.follow(user, followed) end @@ -1316,11 +1316,11 @@ test "has following" do describe ".deactivate" do test "can de-activate then re-activate a user" do user = insert(:user) - assert false == user.deactivated + assert user.is_active {:ok, user} = User.deactivate(user) - assert true == user.deactivated + refute user.is_active {:ok, user} = User.deactivate(user, false) - assert false == user.deactivated + assert user.is_active end test "hide a user from followers" do @@ -1544,7 +1544,7 @@ test "it deactivates a user, all follow relationships and all activities", %{use follower = User.get_cached_by_id(follower.id) refute User.following?(follower, user) - assert %{deactivated: true} = User.get_by_id(user.id) + assert %{is_active: false} = User.get_by_id(user.id) assert [] == User.get_follow_requests(locked_user) @@ -1585,8 +1585,8 @@ test "deactivates user when activation is not required", %{user: user} do {:ok, job} = User.delete(user) {:ok, _} = ObanHelpers.perform(job) - assert %{deactivated: true} = User.get_cached_by_id(user.id) - assert %{deactivated: true} = User.get_by_id(user.id) + assert %{is_active: false} = User.get_cached_by_id(user.id) + assert %{is_active: false} = User.get_by_id(user.id) end end @@ -1622,7 +1622,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do registration_reason: "ahhhhh", confirmation_token: "qqqq", domain_blocks: ["lain.com"], - deactivated: true, + is_active: false, ap_enabled: true, is_moderator: true, is_admin: true, @@ -1664,7 +1664,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do registration_reason: nil, confirmation_token: nil, domain_blocks: [], - deactivated: true, + is_active: false, ap_enabled: false, is_moderator: false, is_admin: false, @@ -1750,7 +1750,7 @@ test "returns :password_reset_pending for user with reset password" do end test "returns :deactivated for deactivated user" do - user = insert(:user, local: true, confirmation_pending: false, deactivated: true) + user = insert(:user, local: true, confirmation_pending: false, is_active: false) assert User.account_status(user) == :deactivated end @@ -1908,7 +1908,7 @@ test "Users are inactive by default" do users = Enum.map(1..total, fn _ -> - insert(:user, last_digest_emailed_at: days_ago(20), deactivated: false) + insert(:user, last_digest_emailed_at: days_ago(20), is_active: true) end) inactive_users_ids = @@ -1926,7 +1926,7 @@ test "Only includes users who has no recent activity" do users = Enum.map(1..total, fn _ -> - insert(:user, last_digest_emailed_at: days_ago(20), deactivated: false) + insert(:user, last_digest_emailed_at: days_ago(20), is_active: true) end) {inactive, active} = Enum.split(users, trunc(total / 2)) @@ -1959,7 +1959,7 @@ test "Only includes users with no read notifications" do users = Enum.map(1..total, fn _ -> - insert(:user, last_digest_emailed_at: days_ago(20), deactivated: false) + insert(:user, last_digest_emailed_at: days_ago(20), is_active: true) end) [sender | recipients] = users @@ -2029,7 +2029,7 @@ test "it returns a list of AP ids for a given set of nicknames" do user1 = insert(:user, local: false, ap_id: "http://localhost:4001/users/masto_closed") user2 = insert(:user, local: false, ap_id: "http://localhost:4001/users/fuser2") insert(:user, local: true) - insert(:user, local: false, deactivated: true) + insert(:user, local: false, is_active: false) {:ok, user1: user1, user2: user2} end diff --git a/test/pleroma/web/activity_pub/side_effects/delete_test.exs b/test/pleroma/web/activity_pub/side_effects/delete_test.exs index 35ced375b..20f0d4b70 100644 --- a/test/pleroma/web/activity_pub/side_effects/delete_test.exs +++ b/test/pleroma/web/activity_pub/side_effects/delete_test.exs @@ -39,7 +39,7 @@ test "it handles user deletions", %{delete_user: delete, user: user} do {:ok, _delete, _} = SideEffects.handle(delete) ObanHelpers.perform_all() - assert User.get_cached_by_ap_id(user.ap_id).deactivated + refute User.get_cached_by_ap_id(user.ap_id).is_active end end diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 2d94f07c9..c5c771c43 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -170,7 +170,7 @@ test "when activation is not required", %{delete: delete, user: user} do {:ok, _, _} = SideEffects.handle(delete) ObanHelpers.perform_all() - assert User.get_cached_by_id(user.id).deactivated + refute User.get_cached_by_id(user.id).is_active end test "when activation is required", %{delete: delete, user: user} do diff --git a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs index a2d64620d..958675835 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs @@ -134,7 +134,7 @@ test "it doesn't work for deactivated users" do ap_id: data["actor"], local: false, last_refreshed_at: DateTime.utc_now(), - deactivated: true + is_active: false ) _recipient = insert(:user, ap_id: List.first(data["to"]), local: true) diff --git a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs index 33132dff6..b7160bf58 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs @@ -97,7 +97,7 @@ test "it works for incoming user deletes" do {:ok, _} = Transmogrifier.handle_incoming(data) ObanHelpers.perform_all() - assert User.get_cached_by_ap_id(ap_id).deactivated + refute User.get_cached_by_ap_id(ap_id).is_active end test "it fails for incoming user deletes with spoofed origin" do diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index 108f27ef7..be99ad93d 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -154,7 +154,7 @@ test "it does not crash if the object in inReplyTo can't be fetched" do test "it does not work for deactivated users" do data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!() - insert(:user, ap_id: data["actor"], deactivated: true) + insert(:user, ap_id: data["actor"], is_active: false) assert {:error, _} = Transmogrifier.handle_incoming(data) end diff --git a/test/pleroma/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs index 976990d5c..17e09a1e8 100644 --- a/test/pleroma/web/admin_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs @@ -47,7 +47,7 @@ test "shows activity", %{conn: conn} do assert account["id"] == actor.id assert account["nickname"] == actor.nickname - assert account["deactivated"] == actor.deactivated + assert account["is_active"] == actor.is_active assert account["confirmation_pending"] == actor.confirmation_pending end end diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 40d39aae7..675903217 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -169,7 +169,7 @@ test "single user", %{admin: admin, conn: conn} do assert user.note_count == 1 assert user.follower_count == 1 assert user.following_count == 1 - refute user.deactivated + assert user.is_active with_mock Pleroma.Web.Federator, publish: fn _ -> nil end, @@ -181,7 +181,7 @@ test "single user", %{admin: admin, conn: conn} do ObanHelpers.perform_all() - assert User.get_by_nickname(user.nickname).deactivated + refute User.get_by_nickname(user.nickname).is_active log_entry = Repo.one(ModerationLog) @@ -191,7 +191,7 @@ test "single user", %{admin: admin, conn: conn} do assert json_response(conn, 200) == [user.nickname] user = Repo.get(User, user.id) - assert user.deactivated + refute user.is_active assert user.avatar == %{} assert user.banner == %{} @@ -621,7 +621,7 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do "roles" => %{"admin" => true, "moderator" => false} }), user_response(old_admin, %{ - "deactivated" => false, + "is_active" => true, "roles" => %{"admin" => true, "moderator" => false} }) ] @@ -694,11 +694,11 @@ test "load only admins", %{conn: conn, admin: admin} do users = [ user_response(admin, %{ - "deactivated" => false, + "is_active" => true, "roles" => %{"admin" => true, "moderator" => false} }), user_response(second_admin, %{ - "deactivated" => false, + "is_active" => true, "roles" => %{"admin" => true, "moderator" => false} }) ] @@ -723,7 +723,7 @@ test "load only moderators", %{conn: conn} do "page_size" => 50, "users" => [ user_response(moderator, %{ - "deactivated" => false, + "is_active" => true, "roles" => %{"admin" => false, "moderator" => true} }) ] @@ -839,10 +839,10 @@ test "`active` filters out users pending approval", %{token: token} do test "it works with multiple filters" do admin = insert(:user, nickname: "john", is_admin: true) token = insert(:oauth_admin_token, user: admin) - user = insert(:user, nickname: "bob", local: false, deactivated: true) + user = insert(:user, nickname: "bob", local: false, is_active: false) - insert(:user, nickname: "ken", local: true, deactivated: true) - insert(:user, nickname: "bobb", local: false, deactivated: false) + insert(:user, nickname: "ken", local: true, is_active: false) + insert(:user, nickname: "bobb", local: false, is_active: true) conn = build_conn() @@ -873,8 +873,8 @@ test "it omits relay user", %{admin: admin, conn: conn} do end test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do - user_one = insert(:user, deactivated: true) - user_two = insert(:user, deactivated: true) + user_one = insert(:user, is_active: false) + user_two = insert(:user, is_active: false) conn = patch( @@ -884,7 +884,7 @@ test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do ) response = json_response(conn, 200) - assert Enum.map(response["users"], & &1["deactivated"]) == [false, false] + assert Enum.map(response["users"], & &1["is_active"]) == [true, true] log_entry = Repo.one(ModerationLog) @@ -893,8 +893,8 @@ test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do end test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do - user_one = insert(:user, deactivated: false) - user_two = insert(:user, deactivated: false) + user_one = insert(:user, is_active: true) + user_two = insert(:user, is_active: true) conn = patch( @@ -904,7 +904,7 @@ test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do ) response = json_response(conn, 200) - assert Enum.map(response["users"], & &1["deactivated"]) == [true, true] + assert Enum.map(response["users"], & &1["is_active"]) == [false, false] log_entry = Repo.one(ModerationLog) @@ -940,7 +940,7 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admi assert json_response(conn, 200) == user_response( user, - %{"deactivated" => !user.deactivated} + %{"is_active" => user.is_active} ) log_entry = Repo.one(ModerationLog) @@ -951,7 +951,7 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admi defp user_response(user, attrs \\ %{}) do %{ - "deactivated" => user.deactivated, + "is_active" => user.is_active, "id" => user.id, "email" => user.email, "nickname" => user.nickname, diff --git a/test/pleroma/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs index 307578ae0..e5d146256 100644 --- a/test/pleroma/web/admin_api/search_test.exs +++ b/test/pleroma/web/admin_api/search_test.exs @@ -47,9 +47,9 @@ test "it returns local/external users" do end test "it returns active/deactivated users" do - insert(:user, deactivated: true) - insert(:user, deactivated: true) - insert(:user, deactivated: false) + insert(:user, is_active: false) + insert(:user, is_active: false) + insert(:user, is_active: true) {:ok, _results, active_count} = Search.user(%{ @@ -70,7 +70,7 @@ test "it returns active/deactivated users" do test "it returns specific user" do insert(:user) insert(:user) - user = insert(:user, nickname: "bob", local: true, deactivated: false) + user = insert(:user, nickname: "bob", local: true, is_active: true) {:ok, _results, total_count} = Search.user(%{query: ""}) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 2ece92806..9d5a3d119 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -518,7 +518,7 @@ test "it adds an emoji on an external site" do end test "deactivated users can't post" do - user = insert(:user, deactivated: true) + user = insert(:user, is_active: false) assert {:error, _} = CommonAPI.post(user, %{status: "ye"}) end diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 7b3cc7344..d44b97cc7 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -126,7 +126,7 @@ test "returns 404 for internal.fetch actor", %{conn: conn} do end test "returns 404 for deactivated user", %{conn: conn} do - user = insert(:user, deactivated: true) + user = insert(:user, is_active: false) assert %{"error" => "Can't find user"} = conn @@ -256,7 +256,7 @@ test "works with announces that are just addressed to public", %{conn: conn} do end test "deactivated user", %{conn: conn} do - user = insert(:user, deactivated: true) + user = insert(:user, is_active: false) assert %{"error" => "Can't find user"} == conn diff --git a/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs index 27c0fceff..1872dfd59 100644 --- a/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs @@ -136,7 +136,7 @@ test "it returns 204 when user is not local", %{conn: conn, user: user} do end test "it returns 204 when user is deactivated", %{conn: conn, user: user} do - {:ok, user} = Repo.update(Ecto.Changeset.change(user, deactivated: true, local: true)) + {:ok, user} = Repo.update(Ecto.Changeset.change(user, is_active: false, local: true)) conn = post(conn, "/auth/password?email=#{user.email}") assert empty_json_response(conn) diff --git a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs index 1d0f86e87..d7bb0ffd8 100644 --- a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs @@ -57,7 +57,7 @@ test "get instance stats", %{conn: conn} do user = insert(:user, %{local: true}) user2 = insert(:user, %{local: true}) - {:ok, _user2} = User.deactivate(user2, !user2.deactivated) + {:ok, _user2} = User.deactivate(user2, user2.is_active) insert(:user, %{local: false, nickname: "u@peer1.com"}) insert(:user, %{local: false, nickname: "u@peer2.com"}) diff --git a/test/pleroma/web/mastodon_api/mastodon_api_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_test.exs index f14330908..402bfd76f 100644 --- a/test/pleroma/web/mastodon_api/mastodon_api_test.exs +++ b/test/pleroma/web/mastodon_api/mastodon_api_test.exs @@ -16,7 +16,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPITest do describe "follow/3" do test "returns error when followed user is deactivated" do follower = insert(:user) - user = insert(:user, local: true, deactivated: true) + user = insert(:user, local: true, is_active: false) assert {:error, _error} = MastodonAPI.follow(follower, user) end diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 32fe08196..ed8c7484d 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -211,7 +211,7 @@ test "Represent a Funkwhale channel" do test "Represent a deactivated user for an admin" do admin = insert(:user, is_admin: true) - deactivated_user = insert(:user, deactivated: true) + deactivated_user = insert(:user, is_active: false) represented = AccountView.render("show.json", %{user: deactivated_user, for: admin}) assert represented[:pleroma][:deactivated] == true end diff --git a/test/pleroma/web/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs index a7225d45c..43c4dfa33 100644 --- a/test/pleroma/web/mongoose_im_controller_test.exs +++ b/test/pleroma/web/mongoose_im_controller_test.exs @@ -9,7 +9,7 @@ defmodule Pleroma.Web.MongooseIMControllerTest do test "/user_exists", %{conn: conn} do _user = insert(:user, nickname: "lain") _remote_user = insert(:user, nickname: "alice", local: false) - _deactivated_user = insert(:user, nickname: "konata", deactivated: true) + _deactivated_user = insert(:user, nickname: "konata", is_active: false) res = conn @@ -46,7 +46,7 @@ test "/check_password", %{conn: conn} do _deactivated_user = insert(:user, nickname: "konata", - deactivated: true, + is_active: false, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt("cool") ) diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index bf47afed8..236ecad42 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -956,7 +956,7 @@ test "rejects token exchange for valid credentials belonging to deactivated user user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), - deactivated: true + is_active: false ) app = insert(:oauth_app) diff --git a/test/pleroma/web/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs index bee413fbf..9e7061189 100644 --- a/test/pleroma/web/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -33,7 +33,7 @@ test "with a user that's not confirmed and a config requiring confirmation, it r end test "with a user that is deactivated, it removes that user", %{conn: conn} do - user = insert(:user, deactivated: true) + user = insert(:user, is_active: false) conn = conn diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs index 51db2fe5e..f9d9e0525 100644 --- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs +++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs @@ -141,7 +141,7 @@ test "follows user", %{conn: conn} do end test "returns error when user is deactivated", %{conn: conn} do - user = insert(:user, deactivated: true) + user = insert(:user, is_active: false) user2 = insert(:user) response = diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 6d007ab66..283c61678 100644 --- a/test/pleroma/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs @@ -164,7 +164,7 @@ test "with valid permissions and password, it disables the account", %{conn: con user = User.get_cached_by_id(user.id) - assert user.deactivated == true + refute user.is_active end test "with valid permissions and invalid password, it returns an error", %{conn: conn} do @@ -178,7 +178,7 @@ test "with valid permissions and invalid password, it returns an error", %{conn: assert response == %{"error" => "Invalid password."} user = User.get_cached_by_id(user.id) - refute user.deactivated + assert user.is_active end end @@ -428,7 +428,7 @@ test "with proper permissions and valid password", %{conn: conn, user: user} do assert json_response(conn, 200) == %{"status" => "success"} user = User.get_by_id(user.id) - assert user.deactivated == true + refute user.is_active assert user.name == nil assert user.bio == "" assert user.password_hash == nil -- cgit v1.2.3 From cd1e5d76abbb0598a822e251a482e99ecf2b8ba2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 12 Oct 2020 18:21:46 -0500 Subject: Remove User.restrict_deactivated/1 Everything else is in User.Query, no need for this odd kludge. --- lib/pleroma/user.ex | 8 ++------ lib/pleroma/user/query.ex | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 2ae95ebdd..f002c077c 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -217,7 +217,8 @@ def unquote(:"#{outgoing_relation_target}_relation")(user, restrict_deactivated? target_users_query = assoc(user, unquote(outgoing_relation_target)) if restrict_deactivated? do - restrict_deactivated(target_users_query) + target_users_query + |> User.Query.build(%{deactivated: false}) else target_users_query end @@ -386,11 +387,6 @@ def ap_followers(%User{} = user), do: "#{ap_id(user)}/followers" def ap_following(%User{following_address: fa}) when is_binary(fa), do: fa def ap_following(%User{} = user), do: "#{ap_id(user)}/following" - @spec restrict_deactivated(Ecto.Query.t()) :: Ecto.Query.t() - def restrict_deactivated(query) do - from(u in query, where: u.is_active == ^true) - end - defp truncate_fields_param(params) do if Map.has_key?(params, :fields) do Map.put(params, :fields, Enum.map(params[:fields], &truncate_field/1)) diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index c3551a0aa..e9cf5c0e7 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -137,7 +137,7 @@ defp compose_query({:local, _}, query), do: location_query(query, true) defp compose_query({:external, _}, query), do: location_query(query, false) defp compose_query({:active, _}, query) do - User.restrict_deactivated(query) + where(query, [u], u.is_active == true) |> where([u], u.approval_pending == false) end @@ -147,7 +147,7 @@ defp compose_query({:legacy_active, _}, query) do end defp compose_query({:deactivated, false}, query) do - User.restrict_deactivated(query) + where(query, [u], u.is_active == true) end defp compose_query({:deactivated, true}, query) do -- cgit v1.2.3 From a59e32f1dda3d35539b48a27224427e6230fe912 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 12 Oct 2020 18:33:07 -0500 Subject: Add copyright header --- .../migrations/20201012173004_refactor_deactivated_user_field.exs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs b/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs index ac0afdd16..58b75b436 100644 --- a/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs +++ b/priv/repo/migrations/20201012173004_refactor_deactivated_user_field.exs @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Repo.Migrations.RefactorDeactivatedUserField do use Ecto.Migration -- cgit v1.2.3 From 75166607532723055ae24d5c9ac0e7f03160c913 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 16:44:27 -0500 Subject: Remove toggle_activation --- CHANGELOG.md | 1 + docs/administration/CLI_tasks/user.md | 15 --------------- lib/mix/tasks/pleroma/user.ex | 15 --------------- test/mix/tasks/pleroma/user_test.exs | 33 --------------------------------- 4 files changed, 1 insertion(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b24bf07..9b50d577d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed +- **Breaking:** Removed the toggle_activated mix task - Polls now always return a `voters_count`, even if they are single-choice. - Admin Emails: The ap id is used as the user link in emails now. - Improved registration workflow for email confirmation and account approval modes. diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md index b57dce0e7..9fde9631e 100644 --- a/docs/administration/CLI_tasks/user.md +++ b/docs/administration/CLI_tasks/user.md @@ -134,21 +134,6 @@ ``` -## Deactivate or activate a user - -=== "OTP" - - ```sh - ./bin/pleroma_ctl user toggle_activated - ``` - -=== "From Source" - - ```sh - mix pleroma.user toggle_activated - ``` - - ## Deactivate a user and unsubscribes local users from the user === "OTP" diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 9cd74efde..133daf0f0 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -107,21 +107,6 @@ def run(["rm", nickname]) do end end - def run(["toggle_activated", nickname]) do - start_pleroma() - - with %User{} = user <- User.get_cached_by_nickname(nickname) do - {:ok, user} = User.deactivate(user, user.is_active) - - shell_info( - "Activation status of #{nickname}: #{unless(user.is_active, do: "de", else: "")}activated" - ) - else - _ -> - shell_error("No user #{nickname}") - end - end - def run(["reset_password", nickname]) do start_pleroma() diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index fdf2ceec4..098052fe0 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -157,39 +157,6 @@ test "no user to delete" do end end - describe "running toggle_activated" do - test "user is deactivated" do - user = insert(:user) - - Mix.Tasks.Pleroma.User.run(["toggle_activated", user.nickname]) - - assert_received {:mix_shell, :info, [message]} - assert message =~ " deactivated" - - user = User.get_cached_by_nickname(user.nickname) - refute user.is_active - end - - test "user is activated" do - user = insert(:user, is_active: false) - - Mix.Tasks.Pleroma.User.run(["toggle_activated", user.nickname]) - - assert_received {:mix_shell, :info, [message]} - assert message =~ " activated" - - user = User.get_cached_by_nickname(user.nickname) - assert user.is_active - end - - test "no user to toggle" do - Mix.Tasks.Pleroma.User.run(["toggle_activated", "nonexistent"]) - - assert_received {:mix_shell, :error, [message]} - assert message =~ "No user" - end - end - describe "running deactivate" do test "user is unsubscribed" do followed = insert(:user) -- cgit v1.2.3 From ebd7d1365bccfc822b1df87f1a58c59570672a56 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 17:16:03 -0500 Subject: Make setting user activation status explicit --- lib/mix/tasks/pleroma/user.ex | 2 +- lib/pleroma/user.ex | 18 +++++++++--------- .../web/admin_api/controllers/user_controller.ex | 6 +++--- .../web/twitter_api/controllers/util_controller.ex | 2 +- lib/pleroma/workers/background_worker.ex | 4 ++-- test/pleroma/user_test.exs | 12 ++++++------ .../web/admin_api/controllers/user_controller_test.exs | 2 +- .../controllers/instance_controller_test.exs | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 133daf0f0..a1276d67b 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -146,7 +146,7 @@ def run(["deactivate", nickname]) do with %User{} = user <- User.get_cached_by_nickname(nickname) do shell_info("Deactivating #{user.nickname}") - User.deactivate(user) + User.set_activation(user, false) :timer.sleep(500) user = User.get_cached_by_id(user.id) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index f002c077c..e53a0f313 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -1583,20 +1583,20 @@ defp maybe_filter_on_ap_id(query, ap_ids) when is_list(ap_ids) do defp maybe_filter_on_ap_id(query, _ap_ids), do: query - def deactivate_async(user, status \\ true) do - BackgroundWorker.enqueue("deactivate_user", %{"user_id" => user.id, "status" => status}) + def set_activation_async(user, status \\ true) do + BackgroundWorker.enqueue("user_activation", %{"user_id" => user.id, "status" => status}) end - def deactivate(user, status \\ true) - - def deactivate(users, status) when is_list(users) do + @spec set_activation([User.t()], boolean()) :: {:ok, User.t()} | {:error, Changeset.t()} + def set_activation(users, status) when is_list(users) do Repo.transaction(fn -> - for user <- users, do: deactivate(user, status) + for user <- users, do: set_activation(user, status) end) end - def deactivate(%User{} = user, status) do - with {:ok, user} <- set_activation_status(user, !status) do + @spec set_activation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()} + def set_activation(%User{} = user, status) do + with {:ok, user} <- set_activation_status(user, status) do user |> get_followers() |> Enum.filter(& &1.local) @@ -1758,7 +1758,7 @@ def perform(:delete, %User{} = user) do delete_or_deactivate(user) end - def perform(:deactivate_async, user, status), do: deactivate(user, status) + def perform(:set_activation_async, user, status), do: set_activation(user, status) @spec external_users_query() :: Ecto.Query.t() def external_users_query do diff --git a/lib/pleroma/web/admin_api/controllers/user_controller.ex b/lib/pleroma/web/admin_api/controllers/user_controller.ex index 83dd3c918..a18b9f8d5 100644 --- a/lib/pleroma/web/admin_api/controllers/user_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/user_controller.ex @@ -172,7 +172,7 @@ def show(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname}) do def toggle_activation(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname}) do user = User.get_cached_by_nickname(nickname) - {:ok, updated_user} = User.deactivate(user, !user.is_active) + {:ok, updated_user} = User.set_activation(user, !user.is_active) action = if !user.is_active, do: "activate", else: "deactivate" @@ -189,7 +189,7 @@ def toggle_activation(%{assigns: %{user: admin}} = conn, %{"nickname" => nicknam def activate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do users = Enum.map(nicknames, &User.get_cached_by_nickname/1) - {:ok, updated_users} = User.deactivate(users, false) + {:ok, updated_users} = User.set_activation(users, true) ModerationLog.insert_log(%{ actor: admin, @@ -204,7 +204,7 @@ def activate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do def deactivate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do users = Enum.map(nicknames, &User.get_cached_by_nickname/1) - {:ok, updated_users} = User.deactivate(users, true) + {:ok, updated_users} = User.set_activation(users, false) ModerationLog.insert_log(%{ actor: admin, diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex index 1e252f7bb..940a645bb 100644 --- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex +++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex @@ -150,7 +150,7 @@ def delete_account(%{assigns: %{user: user}} = conn, params) do def disable_account(%{assigns: %{user: user}} = conn, params) do case CommonAPI.Utils.confirm_current_password(user, params["password"]) do {:ok, user} -> - User.deactivate_async(user) + User.set_activation_async(user, false) json(conn, %{status: "success"}) {:error, msg} -> diff --git a/lib/pleroma/workers/background_worker.ex b/lib/pleroma/workers/background_worker.ex index e24b9c175..1e28384cb 100644 --- a/lib/pleroma/workers/background_worker.ex +++ b/lib/pleroma/workers/background_worker.ex @@ -9,9 +9,9 @@ defmodule Pleroma.Workers.BackgroundWorker do @impl Oban.Worker - def perform(%Job{args: %{"op" => "deactivate_user", "user_id" => user_id, "status" => status}}) do + def perform(%Job{args: %{"op" => "user_activation", "user_id" => user_id, "status" => status}}) do user = User.get_cached_by_id(user_id) - User.perform(:deactivate_async, user, status) + User.perform(:set_activation_async, user, status) end def perform(%Job{args: %{"op" => "delete_user", "user_id" => user_id}}) do diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 42e37f0a5..36fe84871 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1313,13 +1313,13 @@ test "has following" do end end - describe ".deactivate" do + describe ".set_activation" do test "can de-activate then re-activate a user" do user = insert(:user) assert user.is_active - {:ok, user} = User.deactivate(user) + {:ok, user} = User.set_activation(user, false) refute user.is_active - {:ok, user} = User.deactivate(user, false) + {:ok, user} = User.set_activation(user, true) assert user.is_active end @@ -1328,7 +1328,7 @@ test "hide a user from followers" do user2 = insert(:user) {:ok, user, user2} = User.follow(user, user2) - {:ok, _user} = User.deactivate(user) + {:ok, _user} = User.set_activation(user, false) user2 = User.get_cached_by_id(user2.id) @@ -1344,7 +1344,7 @@ test "hide a user from friends" do assert user2.following_count == 1 assert User.following_count(user2) == 1 - {:ok, _user} = User.deactivate(user) + {:ok, _user} = User.set_activation(user, false) user2 = User.get_cached_by_id(user2.id) @@ -1374,7 +1374,7 @@ test "hide a user's statuses from timelines and notifications" do user: user2 }) - {:ok, _user} = User.deactivate(user) + {:ok, _user} = User.set_activation(user, false) assert [] == ActivityPub.fetch_public_activities(%{}) assert [] == Pleroma.Notification.for_user(user2) diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 675903217..42a135847 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -940,7 +940,7 @@ test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admi assert json_response(conn, 200) == user_response( user, - %{"is_active" => user.is_active} + %{"is_active" => !user.is_active} ) log_entry = Repo.one(ModerationLog) diff --git a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs index d7bb0ffd8..0d4eebb73 100644 --- a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs @@ -57,7 +57,7 @@ test "get instance stats", %{conn: conn} do user = insert(:user, %{local: true}) user2 = insert(:user, %{local: true}) - {:ok, _user2} = User.deactivate(user2, user2.is_active) + {:ok, _user2} = User.set_activation(user2, false) insert(:user, %{local: false, nickname: "u@peer1.com"}) insert(:user, %{local: false, nickname: "u@peer2.com"}) -- cgit v1.2.3 From 6c50ac1d3fb81e3fd7f0af90bab667e5e18193d6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 17:16:47 -0500 Subject: Readability --- lib/pleroma/user.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index e53a0f313..1acb9fa18 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -942,7 +942,7 @@ def follow(%User{} = follower, %User{} = followed, state \\ :follow_accept) do deny_follow_blocked = Config.get([:user, :deny_follow_blocked]) cond do - followed.is_active == false -> + not followed.is_active -> {:error, "Could not follow user: #{followed.nickname} is deactivated."} deny_follow_blocked and blocks?(followed, follower) -> -- cgit v1.2.3 From d36182c08892723b53e801a564531ee7a463052f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 14:29:34 -0500 Subject: Change user.confirmation_pending field to user.is_confirmed --- lib/mix/tasks/pleroma/email.ex | 2 +- lib/mix/tasks/pleroma/user.ex | 6 +-- lib/pleroma/user.ex | 20 ++++----- lib/pleroma/user/query.ex | 4 +- lib/pleroma/web/admin_api/views/account_view.ex | 2 +- .../api_spec/operations/admin/report_operation.ex | 2 +- .../api_spec/operations/admin/status_operation.ex | 2 +- .../web/api_spec/operations/chat_operation.ex | 2 +- lib/pleroma/web/api_spec/schemas/account.ex | 4 +- lib/pleroma/web/api_spec/schemas/chat.ex | 2 +- lib/pleroma/web/api_spec/schemas/status.ex | 2 +- lib/pleroma/web/mastodon_api/views/account_view.ex | 2 +- lib/pleroma/web/twitter_api/controller.ex | 2 +- ...00_refactor_confirmation_pending_user_field.exs | 20 +++++++++ test/mix/tasks/pleroma/email_test.exs | 6 +-- test/mix/tasks/pleroma/user_test.exs | 50 +++++++++++----------- test/pleroma/user_test.exs | 46 ++++++++++---------- .../pleroma/web/activity_pub/side_effects_test.exs | 2 +- .../controllers/admin_api_controller_test.exs | 12 +++--- .../controllers/status_controller_test.exs | 2 +- .../admin_api/controllers/user_controller_test.exs | 10 ++--- test/pleroma/web/admin_api/search_test.exs | 2 +- .../controllers/account_controller_test.exs | 4 +- .../web/mastodon_api/views/account_view_test.exs | 4 +- test/pleroma/web/o_auth/o_auth_controller_test.exs | 2 +- .../controllers/account_controller_test.exs | 2 +- test/pleroma/web/plugs/user_enabled_plug_test.exs | 2 +- test/pleroma/web/twitter_api/controller_test.exs | 4 +- test/pleroma/web/twitter_api/twitter_api_test.exs | 2 +- 29 files changed, 121 insertions(+), 101 deletions(-) create mode 100644 priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex index 54f158f73..6b7555fb8 100644 --- a/lib/mix/tasks/pleroma/email.ex +++ b/lib/mix/tasks/pleroma/email.ex @@ -34,7 +34,7 @@ def run(["resend_confirmation_emails"]) do Pleroma.User.Query.build(%{ local: true, deactivated: false, - confirmation_pending: true, + is_confirmed: false, invisible: false }) |> Pleroma.Repo.chunk_stream(500) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index f90c045fe..a397d1748 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -74,7 +74,7 @@ def run(["new", nickname, email | rest]) do bio: bio } - changeset = User.register_changeset(%User{}, params, need_confirmation: false) + changeset = User.register_changeset(%User{}, params, is_confirmed: true) {:ok, _user} = User.register(changeset) shell_info("User #{nickname} created") @@ -351,7 +351,7 @@ def run(["confirm", nickname]) do with %User{} = user <- User.get_cached_by_nickname(nickname) do {:ok, user} = User.confirm(user) - message = if user.confirmation_pending, do: "needs", else: "doesn't need" + message = if !user.is_confirmed, do: "needs", else: "doesn't need" shell_info("#{nickname} #{message} confirmation.") else @@ -457,7 +457,7 @@ defp set_locked(user, value) do defp set_confirmed(user, value) do {:ok, user} = User.need_confirmation(user, !value) - shell_info("Confirmation pending status of #{user.nickname}: #{user.confirmation_pending}") + shell_info("Confirmation status of #{user.nickname}: #{user.is_confirmed}") user end end diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 6a81adfd6..04ce1768d 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -110,7 +110,7 @@ defmodule Pleroma.User do field(:follower_count, :integer, default: 0) field(:following_count, :integer, default: 0) field(:is_locked, :boolean, default: false) - field(:confirmation_pending, :boolean, default: false) + field(:is_confirmed, :boolean, default: true) field(:password_reset_pending, :boolean, default: false) field(:approval_pending, :boolean, default: false) field(:registration_reason, :string, default: nil) @@ -290,7 +290,7 @@ def account_status(%User{deactivated: true}), do: :deactivated def account_status(%User{password_reset_pending: true}), do: :password_reset_pending def account_status(%User{local: true, approval_pending: true}), do: :approval_pending - def account_status(%User{local: true, confirmation_pending: true}) do + def account_status(%User{local: true, is_confirmed: false}) do if Config.get([:instance, :account_activation_required]) do :confirmation_pending else @@ -808,7 +808,7 @@ def register(%Ecto.Changeset{} = changeset) do end end - def post_register_action(%User{confirmation_pending: true} = user) do + def post_register_action(%User{is_confirmed: false} = user) do with {:ok, _} <- try_send_confirmation_email(user) do {:ok, user} end @@ -821,7 +821,7 @@ def post_register_action(%User{approval_pending: true} = user) do end end - def post_register_action(%User{approval_pending: false, confirmation_pending: false} = user) do + def post_register_action(%User{approval_pending: false, is_confirmed: true} = user) do with {:ok, user} <- autofollow_users(user), {:ok, _} <- autofollowing_users(user), {:ok, user} <- set_cache(user), @@ -882,7 +882,7 @@ def send_welcome_email(%User{email: email} = user) when is_binary(email) do def send_welcome_email(_), do: {:ok, :noop} @spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop} - def try_send_confirmation_email(%User{confirmation_pending: true, email: email} = user) + def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user) when is_binary(email) do if Config.get([:instance, :account_activation_required]) do send_confirmation_email(user) @@ -1642,7 +1642,7 @@ def confirm(users) when is_list(users) do end) end - def confirm(%User{confirmation_pending: true} = user) do + def confirm(%User{is_confirmed: false} = user) do with chg <- confirmation_changeset(user, need_confirmation: false), {:ok, user} <- update_and_set_cache(chg) do post_register_action(user) @@ -1682,7 +1682,7 @@ def purge_user_changeset(user) do follower_count: 0, following_count: 0, is_locked: false, - confirmation_pending: false, + is_confirmed: true, password_reset_pending: false, approval_pending: false, registration_reason: nil, @@ -2313,17 +2313,17 @@ def confirmation_changeset(user, need_confirmation: need_confirmation?) do params = if need_confirmation? do %{ - confirmation_pending: true, + is_confirmed: false, confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64() } else %{ - confirmation_pending: false, + is_confirmed: true, confirmation_token: nil } end - cast(user, params, [:confirmation_pending, :confirmation_token]) + cast(user, params, [:is_confirmed, :confirmation_token]) end @spec approval_changeset(User.t(), keyword()) :: Changeset.t() diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index ab9554bd2..481c41d8c 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -155,7 +155,7 @@ defp compose_query({:deactivated, true}, query) do end defp compose_query({:confirmation_pending, bool}, query) do - where(query, [u], u.confirmation_pending == ^bool) + where(query, [u], u.is_confirmed != ^bool) end defp compose_query({:need_approval, _}, query) do @@ -163,7 +163,7 @@ defp compose_query({:need_approval, _}, query) do end defp compose_query({:unconfirmed, _}, query) do - where(query, [u], u.confirmation_pending) + where(query, [u], u.is_confirmed == false) end defp compose_query({:followers, %User{id: id}}, query) do diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex index 37188bfeb..10d2e698b 100644 --- a/lib/pleroma/web/admin_api/views/account_view.ex +++ b/lib/pleroma/web/admin_api/views/account_view.ex @@ -77,7 +77,7 @@ def render("show.json", %{user: user}) do "local" => user.local, "roles" => User.roles(user), "tags" => user.tags || [], - "confirmation_pending" => user.confirmation_pending, + "is_confirmed" => user.is_confirmed, "approval_pending" => user.approval_pending, "url" => user.uri || user.ap_id, "registration_reason" => user.registration_reason, diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index 526698fc1..d60e84a66 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -191,7 +191,7 @@ defp account_admin do moderator: %Schema{type: :boolean} } }, - confirmation_pending: %Schema{type: :boolean} + is_confirmed: %Schema{type: :boolean} }) } end diff --git a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex index a2319bacc..fed3da27a 100644 --- a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex @@ -142,7 +142,7 @@ def admin_account do } }, tags: %Schema{type: :string}, - confirmation_pending: %Schema{type: :string} + is_confirmed: %Schema{type: :string} } } end diff --git a/lib/pleroma/web/api_spec/operations/chat_operation.ex b/lib/pleroma/web/api_spec/operations/chat_operation.ex index a90bc4cc9..e5ee6e695 100644 --- a/lib/pleroma/web/api_spec/operations/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/chat_operation.ex @@ -236,7 +236,7 @@ def chats_response do "account" => %{ "pleroma" => %{ "is_admin" => false, - "confirmation_pending" => false, + "is_confirmed" => true, "hide_followers_count" => false, "is_moderator" => false, "hide_favorites" => true, diff --git a/lib/pleroma/web/api_spec/schemas/account.ex b/lib/pleroma/web/api_spec/schemas/account.ex index 35158c140..4f9b564d1 100644 --- a/lib/pleroma/web/api_spec/schemas/account.ex +++ b/lib/pleroma/web/api_spec/schemas/account.ex @@ -48,7 +48,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do }, background_image: %Schema{type: :string, nullable: true, format: :uri}, chat_token: %Schema{type: :string}, - confirmation_pending: %Schema{ + is_confirmed: %Schema{ type: :boolean, description: "whether the user account is waiting on email confirmation to be activated" @@ -166,7 +166,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do "pleroma" => %{ "allow_following_move" => true, "background_image" => nil, - "confirmation_pending" => true, + "is_confirmed" => false, "hide_favorites" => true, "hide_followers" => false, "hide_followers_count" => false, diff --git a/lib/pleroma/web/api_spec/schemas/chat.ex b/lib/pleroma/web/api_spec/schemas/chat.ex index b3912c173..4afed910d 100644 --- a/lib/pleroma/web/api_spec/schemas/chat.ex +++ b/lib/pleroma/web/api_spec/schemas/chat.ex @@ -23,7 +23,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Chat do "account" => %{ "pleroma" => %{ "is_admin" => false, - "confirmation_pending" => false, + "is_confirmed" => true, "hide_followers_count" => false, "is_moderator" => false, "hide_favorites" => true, diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index 3f5870907..61ebd8089 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -256,7 +256,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do "note" => "Tester Number 6", "pleroma" => %{ "background_image" => nil, - "confirmation_pending" => false, + "is_confirmed" => true, "hide_favorites" => true, "hide_followers" => false, "hide_followers_count" => false, diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 2768f0291..da1221d47 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -266,7 +266,7 @@ defp do_render("show.json", %{user: user} = opts) do pleroma: %{ ap_id: user.ap_id, also_known_as: user.also_known_as, - confirmation_pending: user.confirmation_pending, + is_confirmed: user.is_confirmed, tags: user.tags, hide_followers_count: user.hide_followers_count, hide_follows_count: user.hide_follows_count, diff --git a/lib/pleroma/web/twitter_api/controller.ex b/lib/pleroma/web/twitter_api/controller.ex index 467c19e5e..077bfa70d 100644 --- a/lib/pleroma/web/twitter_api/controller.ex +++ b/lib/pleroma/web/twitter_api/controller.ex @@ -30,7 +30,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do def confirm_email(conn, %{"user_id" => uid, "token" => token}) do with %User{} = user <- User.get_cached_by_id(uid), - true <- user.local and user.confirmation_pending and user.confirmation_token == token, + true <- user.local and !user.is_confirmed and user.confirmation_token == token, {:ok, _} <- User.confirm(user) do redirect(conn, to: "/") end diff --git a/priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs b/priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs new file mode 100644 index 000000000..d0dc42827 --- /dev/null +++ b/priv/repo/migrations/20201013184200_refactor_confirmation_pending_user_field.exs @@ -0,0 +1,20 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.RefactorConfirmationPendingUserField do + use Ecto.Migration + + def up do + # Flip the values before we change the meaning of the column + execute("UPDATE users SET confirmation_pending = NOT confirmation_pending;") + execute("ALTER TABLE users RENAME COLUMN confirmation_pending TO is_confirmed;") + execute("ALTER TABLE users ALTER COLUMN is_confirmed SET DEFAULT true;") + end + + def down do + execute("UPDATE users SET is_confirmed = NOT is_confirmed;") + execute("ALTER TABLE users RENAME COLUMN is_confirmed TO confirmation_pending;") + execute("ALTER TABLE users ALTER COLUMN confirmation_pending SET DEFAULT false;") + end +end diff --git a/test/mix/tasks/pleroma/email_test.exs b/test/mix/tasks/pleroma/email_test.exs index 78cdf178b..ef26142c4 100644 --- a/test/mix/tasks/pleroma/email_test.exs +++ b/test/mix/tasks/pleroma/email_test.exs @@ -61,7 +61,7 @@ test "Sends test email with given address" do test "Sends confirmation emails" do local_user1 = insert(:user, %{ - confirmation_pending: true, + is_confirmed: false, confirmation_token: "mytoken", deactivated: false, email: "local1@pleroma.com", @@ -70,7 +70,7 @@ test "Sends confirmation emails" do local_user2 = insert(:user, %{ - confirmation_pending: true, + is_confirmed: false, confirmation_token: "mytoken", deactivated: false, email: "local2@pleroma.com", @@ -88,7 +88,7 @@ test "Sends confirmation emails" do test "Does not send confirmation email to inappropriate users" do # confirmed user insert(:user, %{ - confirmation_pending: false, + is_confirmed: true, confirmation_token: "mytoken", deactivated: false, email: "confirmed@pleroma.com", diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index 7c68b8a37..a620e5960 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -238,7 +238,7 @@ test "All statuses set" do assert message =~ ~r/Admin status .* true/ assert_received {:mix_shell, :info, [message]} - assert message =~ ~r/Confirmation pending .* false/ + assert message =~ ~r/Confirmation status.* true/ assert_received {:mix_shell, :info, [message]} assert message =~ ~r/Locked status .* true/ @@ -250,7 +250,7 @@ test "All statuses set" do assert user.is_moderator assert user.is_locked assert user.is_admin - refute user.confirmation_pending + assert user.is_confirmed end test "All statuses unset" do @@ -259,7 +259,7 @@ test "All statuses unset" do is_locked: true, is_moderator: true, is_admin: true, - confirmation_pending: true + is_confirmed: false ) Mix.Tasks.Pleroma.User.run([ @@ -275,7 +275,7 @@ test "All statuses unset" do assert message =~ ~r/Admin status .* false/ assert_received {:mix_shell, :info, [message]} - assert message =~ ~r/Confirmation pending .* true/ + assert message =~ ~r/Confirmation status.* false/ assert_received {:mix_shell, :info, [message]} assert message =~ ~r/Locked status .* false/ @@ -287,7 +287,7 @@ test "All statuses unset" do refute user.is_moderator refute user.is_locked refute user.is_admin - assert user.confirmation_pending + refute user.is_confirmed end test "no user to set status" do @@ -464,27 +464,27 @@ test "it prints an error message when user is not exist" do describe "running confirm" do test "user is confirmed" do - %{id: id, nickname: nickname} = insert(:user, confirmation_pending: false) + %{id: id, nickname: nickname} = insert(:user, is_confirmed: true) assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname]) assert_received {:mix_shell, :info, [message]} assert message == "#{nickname} doesn't need confirmation." user = Repo.get(User, id) - refute user.confirmation_pending + assert user.is_confirmed refute user.confirmation_token end test "user is not confirmed" do %{id: id, nickname: nickname} = - insert(:user, confirmation_pending: true, confirmation_token: "some token") + insert(:user, is_confirmed: false, confirmation_token: "some token") assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname]) assert_received {:mix_shell, :info, [message]} assert message == "#{nickname} doesn't need confirmation." user = Repo.get(User, id) - refute user.confirmation_pending + assert user.is_confirmed refute user.confirmation_token end @@ -579,29 +579,29 @@ test "it prints an error message when user is not exist" do describe "bulk confirm and unconfirm" do test "confirm all" do - user1 = insert(:user, confirmation_pending: true) - user2 = insert(:user, confirmation_pending: true) + user1 = insert(:user, is_confirmed: false) + user2 = insert(:user, is_confirmed: false) - assert user1.confirmation_pending - assert user2.confirmation_pending + refute user1.is_confirmed + refute user2.is_confirmed Mix.Tasks.Pleroma.User.run(["confirm_all"]) user1 = User.get_cached_by_nickname(user1.nickname) user2 = User.get_cached_by_nickname(user2.nickname) - refute user1.confirmation_pending - refute user2.confirmation_pending + assert user1.is_confirmed + assert user2.is_confirmed end test "unconfirm all" do - user1 = insert(:user, confirmation_pending: false) - user2 = insert(:user, confirmation_pending: false) - admin = insert(:user, is_admin: true, confirmation_pending: false) - mod = insert(:user, is_moderator: true, confirmation_pending: false) + user1 = insert(:user, is_confirmed: true) + user2 = insert(:user, is_confirmed: true) + admin = insert(:user, is_admin: true, is_confirmed: true) + mod = insert(:user, is_moderator: true, is_confirmed: true) - refute user1.confirmation_pending - refute user2.confirmation_pending + assert user1.is_confirmed + assert user2.is_confirmed Mix.Tasks.Pleroma.User.run(["unconfirm_all"]) @@ -610,10 +610,10 @@ test "unconfirm all" do admin = User.get_cached_by_nickname(admin.nickname) mod = User.get_cached_by_nickname(mod.nickname) - assert user1.confirmation_pending - assert user2.confirmation_pending - refute admin.confirmation_pending - refute mod.confirmation_pending + refute user1.is_confirmed + refute user2.is_confirmed + assert admin.is_confirmed + assert mod.is_confirmed end end end diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index bdf17e96a..7e50d53d3 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -640,7 +640,7 @@ test "it creates a confirmed user" do {:ok, user} = Repo.insert(changeset) - refute user.confirmation_pending + assert user.is_confirmed end end @@ -661,7 +661,7 @@ test "it creates unconfirmed user" do {:ok, user} = Repo.insert(changeset) - assert user.confirmation_pending + refute user.is_confirmed assert user.confirmation_token end @@ -671,7 +671,7 @@ test "it creates confirmed user if :confirmed option is given" do {:ok, user} = Repo.insert(changeset) - refute user.confirmation_pending + assert user.is_confirmed refute user.confirmation_token end end @@ -1443,17 +1443,17 @@ test "approving an approved user does not trigger post-register actions" do describe "confirm" do test "confirms a user" do - user = insert(:user, confirmation_pending: true) - assert true == user.confirmation_pending + user = insert(:user, is_confirmed: false) + refute user.is_confirmed {:ok, user} = User.confirm(user) - assert false == user.confirmation_pending + assert user.is_confirmed end test "confirms a list of users" do unconfirmed_users = [ - insert(:user, confirmation_pending: true), - insert(:user, confirmation_pending: true), - insert(:user, confirmation_pending: true) + insert(:user, is_confirmed: false), + insert(:user, is_confirmed: false), + insert(:user, is_confirmed: false) ] {:ok, users} = User.confirm(unconfirmed_users) @@ -1461,13 +1461,13 @@ test "confirms a list of users" do assert Enum.count(users) == 3 Enum.each(users, fn user -> - assert false == user.confirmation_pending + assert user.is_confirmed end) end test "sends approval emails when `approval_pending: true`" do admin = insert(:user, is_admin: true) - user = insert(:user, confirmation_pending: true, approval_pending: true) + user = insert(:user, is_confirmed: false, approval_pending: true) User.confirm(user) ObanHelpers.perform_all() @@ -1494,7 +1494,7 @@ test "sends approval emails when `approval_pending: true`" do end test "confirming a confirmed user does not trigger post-register actions" do - user = insert(:user, confirmation_pending: false, approval_pending: true) + user = insert(:user, is_confirmed: true, approval_pending: true) User.confirm(user) ObanHelpers.perform_all() @@ -1565,7 +1565,7 @@ test "it deactivates a user, all follow relationships and all activities", %{use describe "delete/1 when confirmation is pending" do setup do - user = insert(:user, confirmation_pending: true) + user = insert(:user, is_confirmed: false) {:ok, user: user} end @@ -1616,7 +1616,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do follower_count: 9, following_count: 9001, is_locked: true, - confirmation_pending: true, + is_confirmed: false, password_reset_pending: true, approval_pending: true, registration_reason: "ahhhhh", @@ -1658,7 +1658,7 @@ test "delete/1 purges a user when they wouldn't be fully deleted" do follower_count: 0, following_count: 0, is_locked: false, - confirmation_pending: false, + is_confirmed: true, password_reset_pending: false, approval_pending: false, registration_reason: nil, @@ -1729,13 +1729,13 @@ test "User.delete() plugs any possible zombie objects" do test "return confirmation_pending for unconfirm user" do Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, confirmation_pending: true) + user = insert(:user, is_confirmed: false) assert User.account_status(user) == :confirmation_pending end test "return active for confirmed user" do Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, confirmation_pending: false) + user = insert(:user, is_confirmed: true) assert User.account_status(user) == :active end @@ -1750,7 +1750,7 @@ test "returns :password_reset_pending for user with reset password" do end test "returns :deactivated for deactivated user" do - user = insert(:user, local: true, confirmation_pending: false, deactivated: true) + user = insert(:user, local: true, is_confirmed: true, deactivated: true) assert User.account_status(user) == :deactivated end @@ -1758,7 +1758,7 @@ test "returns :approval_pending for unapproved user" do user = insert(:user, local: true, approval_pending: true) assert User.account_status(user) == :approval_pending - user = insert(:user, local: true, confirmation_pending: true, approval_pending: true) + user = insert(:user, local: true, is_confirmed: false, approval_pending: true) assert User.account_status(user) == :approval_pending end end @@ -1815,7 +1815,7 @@ test "returns true when the account is itself" do test "returns false when the account is unconfirmed and confirmation is required" do Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, local: true, confirmation_pending: true) + user = insert(:user, local: true, is_confirmed: false) other_user = insert(:user, local: true) refute User.visible_for(user, other_user) == :visible @@ -1824,14 +1824,14 @@ test "returns false when the account is unconfirmed and confirmation is required test "returns true when the account is unconfirmed and confirmation is required but the account is remote" do Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, local: false, confirmation_pending: true) + user = insert(:user, local: false, is_confirmed: false) other_user = insert(:user, local: true) assert User.visible_for(user, other_user) == :visible end test "returns true when the account is unconfirmed and confirmation is not required" do - user = insert(:user, local: true, confirmation_pending: true) + user = insert(:user, local: true, is_confirmed: false) other_user = insert(:user, local: true) assert User.visible_for(user, other_user) == :visible @@ -1840,7 +1840,7 @@ test "returns true when the account is unconfirmed and confirmation is not requi test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, local: true, confirmation_pending: true) + user = insert(:user, local: true, is_confirmed: false) other_user = insert(:user, local: true, is_admin: true) assert User.visible_for(user, other_user) == :visible diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index 2d94f07c9..e3f45ecdb 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -159,7 +159,7 @@ test "creates a notification", %{emoji_react: emoji_react, poster: poster} do describe "delete users with confirmation pending" do setup do - user = insert(:user, confirmation_pending: true) + user = insert(:user, is_confirmed: false) {:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id) {:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true) {:ok, delete: delete_user, user: user} 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 c54402e52..65f2a124f 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 @@ -891,10 +891,10 @@ test "GET /instances/:instance/statuses", %{conn: conn} do describe "PATCH /confirm_email" do test "it confirms emails of two users", %{conn: conn, admin: admin} do - [first_user, second_user] = insert_pair(:user, confirmation_pending: true) + [first_user, second_user] = insert_pair(:user, is_confirmed: false) - assert first_user.confirmation_pending == true - assert second_user.confirmation_pending == true + refute first_user.is_confirmed + refute second_user.is_confirmed ret_conn = patch(conn, "/api/pleroma/admin/users/confirm_email", %{ @@ -906,8 +906,8 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do assert ret_conn.status == 200 - assert first_user.confirmation_pending == true - assert second_user.confirmation_pending == true + assert User.get_by_id(first_user.id).is_confirmed + assert User.get_by_id(second_user.id).is_confirmed log_entry = Repo.one(ModerationLog) @@ -920,7 +920,7 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} 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, confirmation_pending: true) + [first_user, second_user] = insert_pair(:user, is_confirmed: false) ret_conn = patch(conn, "/api/pleroma/admin/users/resend_confirmation_email", %{ diff --git a/test/pleroma/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs index 976990d5c..24e288c5f 100644 --- a/test/pleroma/web/admin_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs @@ -48,7 +48,7 @@ test "shows activity", %{conn: conn} do assert account["id"] == actor.id assert account["nickname"] == actor.nickname assert account["deactivated"] == actor.deactivated - assert account["confirmation_pending"] == actor.confirmation_pending + assert account["is_confirmed"] == actor.is_confirmed end end diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index 40d39aae7..569343ed5 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -635,11 +635,11 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do end test "only unconfirmed users", %{conn: conn} do - sad_user = insert(:user, nickname: "sadboy", confirmation_pending: true) - old_user = insert(:user, nickname: "oldboy", confirmation_pending: true) + sad_user = insert(:user, nickname: "sadboy", is_confirmed: false) + old_user = insert(:user, nickname: "oldboy", is_confirmed: false) insert(:user, nickname: "happyboy", approval_pending: false) - insert(:user, confirmation_pending: false) + insert(:user, is_confirmed: true) result = conn @@ -649,7 +649,7 @@ test "only unconfirmed users", %{conn: conn} do users = Enum.map([old_user, sad_user], fn user -> user_response(user, %{ - "confirmation_pending" => true, + "is_confirmed" => false, "approval_pending" => false }) end) @@ -960,7 +960,7 @@ defp user_response(user, attrs \\ %{}) do "tags" => [], "avatar" => User.avatar_url(user) |> MediaProxy.url(), "display_name" => HTML.strip_tags(user.name || user.nickname), - "confirmation_pending" => false, + "is_confirmed" => true, "approval_pending" => false, "url" => user.ap_id, "registration_reason" => nil, diff --git a/test/pleroma/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs index 307578ae0..913dc374a 100644 --- a/test/pleroma/web/admin_api/search_test.exs +++ b/test/pleroma/web/admin_api/search_test.exs @@ -193,7 +193,7 @@ test "it returns unapproved user" do end test "it returns unconfirmed user" do - unconfirmed = insert(:user, confirmation_pending: true) + unconfirmed = insert(:user, is_confirmed: false) insert(:user) insert(:user) diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 7b3cc7344..2d929e532 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -1027,7 +1027,7 @@ test "registers and logs in without :account_activation_required / :account_appr user = Repo.preload(token_from_db, :user).user assert user - refute user.confirmation_pending + assert user.is_confirmed refute user.approval_pending end @@ -1088,7 +1088,7 @@ test "registers but does not log in with :account_activation_required", %{conn: refute response["token_type"] user = Repo.get_by(User, email: "lain@example.org") - assert user.confirmation_pending + refute user.is_confirmed end test "registers but does not log in with :account_approval_required", %{conn: conn} do diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 32fe08196..f4e6c161e 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -79,7 +79,7 @@ test "Represent a user account" do also_known_as: ["https://shitposter.zone/users/shp"], background_image: "https://example.com/images/asuka_hospital.png", favicon: nil, - confirmation_pending: false, + is_confirmed: true, tags: [], is_admin: false, is_moderator: false, @@ -178,7 +178,7 @@ test "Represent a Service(bot) account" do also_known_as: [], background_image: nil, favicon: nil, - confirmation_pending: false, + is_confirmed: true, tags: [], is_admin: false, is_moderator: false, diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index bf47afed8..254d4e9a4 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -1013,7 +1013,7 @@ test "rejects token exchange for user with confirmation_pending set to true" do user = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password), - confirmation_pending: true + is_confirmed: false ) app = insert(:oauth_app, scopes: ["read", "write"]) diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index baf2d01ab..668bb46fb 100644 --- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs @@ -20,7 +20,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do |> User.confirmation_changeset(need_confirmation: true) |> User.update_and_set_cache() - assert user.confirmation_pending + refute user.is_confirmed [user: user] end diff --git a/test/pleroma/web/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs index bee413fbf..6d0f4fb7d 100644 --- a/test/pleroma/web/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -22,7 +22,7 @@ test "with a user that's not confirmed and a config requiring confirmation, it r %{conn: conn} do Pleroma.Config.put([:instance, :account_activation_required], true) - user = insert(:user, confirmation_pending: true) + user = insert(:user, is_confirmed: false) conn = conn diff --git a/test/pleroma/web/twitter_api/controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs index 23884e223..8f29a4f63 100644 --- a/test/pleroma/web/twitter_api/controller_test.exs +++ b/test/pleroma/web/twitter_api/controller_test.exs @@ -67,7 +67,7 @@ test "with credentials, with params" do |> User.confirmation_changeset(need_confirmation: true) |> Repo.update() - assert user.confirmation_pending + refute user.is_confirmed [user: user] end @@ -83,7 +83,7 @@ test "it confirms the user account", %{conn: conn, user: user} do user = User.get_cached_by_id(user.id) - refute user.confirmation_pending + assert user.is_confirmed refute user.confirmation_token end diff --git a/test/pleroma/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs index 3be4812d3..0ed1389f5 100644 --- a/test/pleroma/web/twitter_api/twitter_api_test.exs +++ b/test/pleroma/web/twitter_api/twitter_api_test.exs @@ -65,7 +65,7 @@ test "it sends confirmation email if :account_activation_required is specified i {:ok, user} = TwitterAPI.register_user(data) ObanHelpers.perform_all() - assert user.confirmation_pending + refute user.is_confirmed email = Pleroma.Emails.UserEmail.account_confirmation_email(user) -- cgit v1.2.3 From 2c0fe2ea9e32d01caa1bc31093a7ddfdc2793659 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 16:07:36 -0500 Subject: Remove toggle_confirmation; require explicit state change Also cosmetic changes to make the code clearer --- lib/mix/tasks/pleroma/user.ex | 10 ++++---- lib/pleroma/user.ex | 30 +++++++++++----------- lib/pleroma/web/auth/pleroma_authenticator.ex | 2 +- .../20201231185546_confirm_logged_in_users.exs | 4 +-- test/mix/tasks/pleroma/user_test.exs | 7 ----- .../migrations/confirm_logged_in_users_test.exs | 8 +++--- test/pleroma/user_test.exs | 2 +- .../controllers/admin_api_controller_test.exs | 7 +++-- test/pleroma/web/o_auth/o_auth_controller_test.exs | 2 +- .../controllers/account_controller_test.exs | 2 +- test/pleroma/web/twitter_api/controller_test.exs | 2 +- 11 files changed, 36 insertions(+), 40 deletions(-) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index a397d1748..e87f1c271 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -213,7 +213,7 @@ def run(["set", nickname | rest]) do user = case Keyword.get(options, :confirmed) do nil -> user - value -> set_confirmed(user, value) + value -> set_confirmation(user, value) end user = @@ -373,7 +373,7 @@ def run(["confirm_all"]) do |> Pleroma.Repo.chunk_stream(500, :batches) |> Stream.each(fn users -> users - |> Enum.each(fn user -> User.need_confirmation(user, false) end) + |> Enum.each(fn user -> User.set_confirmation(user, true) end) end) |> Stream.run() end @@ -391,7 +391,7 @@ def run(["unconfirm_all"]) do |> Pleroma.Repo.chunk_stream(500, :batches) |> Stream.each(fn users -> users - |> Enum.each(fn user -> User.need_confirmation(user, true) end) + |> Enum.each(fn user -> User.set_confirmation(user, false) end) end) |> Stream.run() end @@ -454,8 +454,8 @@ defp set_locked(user, value) do user end - defp set_confirmed(user, value) do - {:ok, user} = User.need_confirmation(user, !value) + defp set_confirmation(user, value) do + {:ok, user} = User.set_confirmation(user, value) shell_info("Confirmation status of #{user.nickname}: #{user.is_confirmed}") user diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 04ce1768d..9efc27887 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -704,11 +704,11 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do reason_limit = Config.get([:instance, :registration_reason_length], 500) params = Map.put_new(params, :accepts_chat_messages, true) - need_confirmation? = - if is_nil(opts[:need_confirmation]) do - Config.get([:instance, :account_activation_required]) + confirmed? = + if is_nil(opts[:confirmed]) do + !Config.get([:instance, :account_activation_required]) else - opts[:need_confirmation] + opts[:confirmed] end need_approval? = @@ -719,7 +719,7 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do end struct - |> confirmation_changeset(need_confirmation: need_confirmation?) + |> confirmation_changeset(set_confirmation: confirmed?) |> approval_changeset(need_approval: need_approval?) |> cast(params, [ :bio, @@ -1643,7 +1643,7 @@ def confirm(users) when is_list(users) do end def confirm(%User{is_confirmed: false} = user) do - with chg <- confirmation_changeset(user, need_confirmation: false), + with chg <- confirmation_changeset(user, set_confirmation: true), {:ok, user} <- update_and_set_cache(chg) do post_register_action(user) {:ok, user} @@ -2138,10 +2138,10 @@ def touch_last_digest_emailed_at(user) do updated_user end - @spec need_confirmation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()} - def need_confirmation(%User{} = user, bool) do + @spec set_confirmation(User.t(), boolean()) :: {:ok, User.t()} | {:error, Changeset.t()} + def set_confirmation(%User{} = user, bool) do user - |> confirmation_changeset(need_confirmation: bool) + |> confirmation_changeset(set_confirmation: bool) |> update_and_set_cache() end @@ -2309,17 +2309,17 @@ def mastodon_settings_update(user, settings) do end @spec confirmation_changeset(User.t(), keyword()) :: Changeset.t() - def confirmation_changeset(user, need_confirmation: need_confirmation?) do + def confirmation_changeset(user, set_confirmation: confirmed?) do params = - if need_confirmation? do + if confirmed? do %{ - is_confirmed: false, - confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64() + is_confirmed: true, + confirmation_token: nil } else %{ - is_confirmed: true, - confirmation_token: nil + is_confirmed: false, + confirmation_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64() } end diff --git a/lib/pleroma/web/auth/pleroma_authenticator.ex b/lib/pleroma/web/auth/pleroma_authenticator.ex index a2121e6a7..401f23c9f 100644 --- a/lib/pleroma/web/auth/pleroma_authenticator.ex +++ b/lib/pleroma/web/auth/pleroma_authenticator.ex @@ -84,7 +84,7 @@ def create_from_registration( password_confirmation: random_password }, external: true, - need_confirmation: false + confirmed: true ) |> Repo.insert(), {:ok, _} <- diff --git a/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs b/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs index 4372d093f..b9656c17b 100644 --- a/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs +++ b/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs @@ -11,9 +11,9 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do def up do User - |> where([u], u.confirmation_pending == true) + |> where([u], u.is_confirmed == false) |> join(:inner, [u], t in Token, on: t.user_id == u.id) - |> Repo.update_all(set: [confirmation_pending: false]) + |> Repo.update_all(set: [is_confirmed: true]) end def down do diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index a620e5960..2b5232283 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -436,13 +436,6 @@ test "invite is revoked" do assert_received {:mix_shell, :info, [message]} assert message =~ "Invite for token #{invite.token} was revoked." end - - test "it prints an error message when invite is not exist" do - Mix.Tasks.Pleroma.User.run(["revoke_invite", "foo"]) - - assert_received {:mix_shell, :error, [message]} - assert message =~ "No invite found" - end end describe "running delete_activities" do diff --git a/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs b/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs index b30faa257..99d17f62a 100644 --- a/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs +++ b/test/pleroma/repo/migrations/confirm_logged_in_users_test.exs @@ -14,12 +14,12 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsersTest do test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: migration} do insert_list(25, :oauth_token) - Repo.update_all(User, set: [confirmation_pending: true]) - insert_list(5, :user, confirmation_pending: true) + Repo.update_all(User, set: [is_confirmed: false]) + insert_list(5, :user, is_confirmed: false) count = User - |> where(confirmation_pending: true) + |> where(is_confirmed: false) |> Repo.aggregate(:count) assert count == 30 @@ -28,7 +28,7 @@ test "up/0 confirms unconfirmed but previously-logged-in users", %{migration: mi count = User - |> where(confirmation_pending: true) + |> where(is_confirmed: false) |> Repo.aggregate(:count) assert count == 5 diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 7e50d53d3..ac9db9ffb 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -666,7 +666,7 @@ test "it creates unconfirmed user" do end test "it creates confirmed user if :confirmed option is given" do - changeset = User.register_changeset(%User{}, @full_user_data, need_confirmation: false) + changeset = User.register_changeset(%User{}, @full_user_data, confirmed: true) assert changeset.valid? {:ok, user} = Repo.insert(changeset) 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 65f2a124f..23e4bc3af 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 @@ -906,8 +906,11 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do assert ret_conn.status == 200 - assert User.get_by_id(first_user.id).is_confirmed - assert User.get_by_id(second_user.id).is_confirmed + first_user = User.get_by_id(first_user.id) + second_user = User.get_by_id(second_user.id) + + assert first_user.is_confirmed + assert second_user.is_confirmed log_entry = Repo.one(ModerationLog) diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index 254d4e9a4..337d2650c 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -928,7 +928,7 @@ test "rejects token exchange for valid credentials belonging to unconfirmed user {:ok, user} = insert(:user, password_hash: Pleroma.Password.Pbkdf2.hash_pwd_salt(password)) - |> User.confirmation_changeset(need_confirmation: true) + |> User.confirmation_changeset(set_confirmation: false) |> User.update_and_set_cache() refute Pleroma.User.account_status(user) == :active diff --git a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs index 668bb46fb..9f14c5577 100644 --- a/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/account_controller_test.exs @@ -17,7 +17,7 @@ defmodule Pleroma.Web.PleromaAPI.AccountControllerTest do setup do {:ok, user} = insert(:user) - |> User.confirmation_changeset(need_confirmation: true) + |> User.confirmation_changeset(set_confirmation: false) |> User.update_and_set_cache() refute user.is_confirmed diff --git a/test/pleroma/web/twitter_api/controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs index 8f29a4f63..583c904b2 100644 --- a/test/pleroma/web/twitter_api/controller_test.exs +++ b/test/pleroma/web/twitter_api/controller_test.exs @@ -64,7 +64,7 @@ test "with credentials, with params" do setup do {:ok, user} = insert(:user) - |> User.confirmation_changeset(need_confirmation: true) + |> User.confirmation_changeset(set_confirmation: false) |> Repo.update() refute user.is_confirmed -- cgit v1.2.3 From 4c82d5e5ddc463d62ba6eb2610cb9c9c9910dc13 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Oct 2020 16:10:00 -0500 Subject: Document removal of toggle_confirmed --- docs/administration/CLI_tasks/user.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md index b57dce0e7..12def88b3 100644 --- a/docs/administration/CLI_tasks/user.md +++ b/docs/administration/CLI_tasks/user.md @@ -258,7 +258,6 @@ mix pleroma.user untag ``` - ## Toggle confirmation status of the user === "OTP" -- cgit v1.2.3 From 3e4f866f04ec1f829791996d82a6ff10b344d4bc Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 15 Jan 2021 13:40:30 -0600 Subject: Revert accidental blank line removal --- docs/administration/CLI_tasks/user.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md index 12def88b3..b57dce0e7 100644 --- a/docs/administration/CLI_tasks/user.md +++ b/docs/administration/CLI_tasks/user.md @@ -258,6 +258,7 @@ mix pleroma.user untag ``` + ## Toggle confirmation status of the user === "OTP" -- cgit v1.2.3 From f9e0c05ca443ce2525203f9819e38c036fc51ea8 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 15 Jan 2021 14:50:32 -0600 Subject: Only run one attachment cleanup job per node The previous limit of 5 was probably causing massing performance issues due to concurrent full table scans. --- config/config.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 7b14fbfe5..db45f7a3d 100644 --- a/config/config.exs +++ b/config/config.exs @@ -542,7 +542,7 @@ scheduled_activities: 10, background: 5, remote_fetcher: 2, - attachments_cleanup: 5, + attachments_cleanup: 1, new_users_digest: 1, mute_expire: 5 ], -- cgit v1.2.3 From d2382ab5f4b507b01ae7fbe6d7522e33d073419d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 15 Jan 2021 14:58:33 -0600 Subject: Update Oban to 2.3.4 --- mix.exs | 2 +- mix.lock | 8 ++++---- .../repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs | 10 ++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs diff --git a/mix.exs b/mix.exs index 14448f12f..caa86d395 100644 --- a/mix.exs +++ b/mix.exs @@ -123,7 +123,7 @@ defp deps do {:ecto_enum, "~> 1.4"}, {:ecto_sql, "~> 3.4.4"}, {:postgrex, ">= 0.15.5"}, - {:oban, "~> 2.1.0"}, + {:oban, "~> 2.3.4"}, {:gettext, "~> 0.18"}, {:bcrypt_elixir, "~> 2.2"}, {:trailing_format_plug, "~> 0.0.7"}, diff --git a/mix.lock b/mix.lock index 01caf319e..840a82555 100644 --- a/mix.lock +++ b/mix.lock @@ -15,7 +15,7 @@ "combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"}, "comeonin": {:hex, :comeonin, "5.3.1", "7fe612b739c78c9c1a75186ef2d322ce4d25032d119823269d0aa1e2f1e20025", [:mix], [], "hexpm", "d6222483060c17f0977fad1b7401ef0c5863c985a64352755f366aee3799c245"}, "concurrent_limiter": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git", "d81be41024569330f296fc472e24198d7499ba78", [ref: "d81be41024569330f296fc472e24198d7499ba78"]}, - "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"}, + "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"}, "cors_plug": {:hex, :cors_plug, "2.0.2", "2b46083af45e4bc79632bd951550509395935d3e7973275b2b743bd63cc942ce", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f0d0e13f71c51fd4ef8b2c7e051388e4dfb267522a83a22392c856de7e46465f"}, "cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"}, "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.0", "69fdb5cf92df6373e15675eb4018cf629f5d8e35e74841bb637d6596cb797bbc", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "42868c229d9a2900a1501c5d0355bfd46e24c862c322b0b4f5a6f14fe0216753"}, @@ -24,7 +24,7 @@ "crontab": {:hex, :crontab, "1.1.8", "2ce0e74777dfcadb28a1debbea707e58b879e6aa0ffbf9c9bb540887bce43617", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"}, "crypt": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/crypt.git", "cf2aa3f11632e8b0634810a15b3e612c7526f6a3", [ref: "cf2aa3f11632e8b0634810a15b3e612c7526f6a3"]}, "custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"}, - "db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"}, + "db_connection": {:hex, :db_connection, "2.3.1", "4c9f3ed1ef37471cbdd2762d6655be11e38193904d9c5c1c9389f1b891a3088e", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "abaab61780dde30301d840417890bd9f74131041afd02174cf4e10635b3a63f5"}, "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"}, @@ -81,7 +81,7 @@ "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, "nimble_pool": {:hex, :nimble_pool, "0.1.0", "ffa9d5be27eee2b00b0c634eb649aa27f97b39186fec3c493716c2a33e784ec6", [:mix], [], "hexpm", "343a1eaa620ddcf3430a83f39f2af499fe2370390d4f785cd475b4df5acaf3f9"}, "nodex": {:git, "https://git.pleroma.social/pleroma/nodex", "cb6730f943cfc6aad674c92161be23a8411f15d1", [ref: "cb6730f943cfc6aad674c92161be23a8411f15d1"]}, - "oban": {:hex, :oban, "2.1.0", "034144686f7e76a102b5d67731f098d98a9e4a52b07c25ad580a01f83a7f1cf5", [:mix], [{:ecto_sql, ">= 3.4.3", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c6f067fa3b308ed9e0e6beb2b34277c9c4e48bf95338edabd8f4a757a26e04c2"}, + "oban": {:hex, :oban, "2.3.4", "ec7509b9af2524d55f529cb7aee93d36131ae0bf0f37706f65d2fe707f4d9fd8", [:mix], [{:ecto_sql, ">= 3.4.3", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c70ca0434758fd1805422ea4446af5e910ddc697c0c861549c8f0eb0cfbd2fdf"}, "open_api_spex": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", "f296ac0924ba3cf79c7a588c4c252889df4c2edd", [ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"]}, "p1_utils": {:hex, :p1_utils, "1.0.18", "3fe224de5b2e190d730a3c5da9d6e8540c96484cf4b4692921d1e28f0c32b01c", [:rebar3], [], "hexpm", "1fc8773a71a15553b179c986b22fbeead19b28fe486c332d4929700ffeb71f88"}, "parse_trans": {:git, "https://github.com/uwiger/parse_trans.git", "76abb347c3c1d00fb0ccf9e4b43e22b3d2288484", [tag: "3.3.0"]}, @@ -97,7 +97,7 @@ "plug_static_index_html": {:hex, :plug_static_index_html, "1.0.0", "840123d4d3975585133485ea86af73cb2600afd7f2a976f9f5fd8b3808e636a0", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "79fd4fcf34d110605c26560cbae8f23c603ec4158c08298bd4360fdea90bb5cf"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"}, "poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"}, - "postgrex": {:hex, :postgrex, "0.15.6", "a464c72010a56e3214fe2b99c1a76faab4c2bb0255cabdef30dea763a3569aa2", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "f99268325ac8f66ffd6c4964faab9e70fbf721234ab2ad238c00f9530b8cdd55"}, + "postgrex": {:hex, :postgrex, "0.15.7", "724410acd48abac529d0faa6c2a379fb8ae2088e31247687b16cacc0e0883372", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "88310c010ff047cecd73d5ceca1d99205e4b1ab1b9abfdab7e00f5c9d20ef8f9"}, "pot": {:hex, :pot, "0.11.0", "61bad869a94534739dd4614a25a619bc5c47b9970e9a0ea5bef4628036fc7a16", [:rebar3], [], "hexpm", "57ee6ee6bdeb639661ffafb9acefe3c8f966e45394de6a766813bb9e1be4e54b"}, "prometheus": {:hex, :prometheus, "4.6.0", "20510f381db1ccab818b4cf2fac5fa6ab5cc91bc364a154399901c001465f46f", [:mix, :rebar3], [], "hexpm", "4905fd2992f8038eccd7aa0cd22f40637ed618c0bed1f75c05aacec15b7545de"}, "prometheus_ecto": {:hex, :prometheus_ecto, "1.4.3", "3dd4da1812b8e0dbee81ea58bb3b62ed7588f2eae0c9e97e434c46807ff82311", [:mix], [{:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.1 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}], "hexpm", "8d66289f77f913b37eda81fd287340c17e61a447549deb28efc254532b2bed82"}, diff --git a/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs b/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs new file mode 100644 index 000000000..067e62e8c --- /dev/null +++ b/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs @@ -0,0 +1,10 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.UpgradeObanJobsToV9 do + use Ecto.Migration + + defdelegate up, to: Oban.Migrations + defdelegate down, to: Oban.Migrations +end -- cgit v1.2.3 From 3607dfefcae4a941c05f9e350354226d1c5fa920 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 15 Jan 2021 16:53:55 -0600 Subject: Add mix alias to easily add copyright headers to files --- mix.exs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 14448f12f..166cbdca5 100644 --- a/mix.exs +++ b/mix.exs @@ -229,7 +229,8 @@ defp aliases do "ecto.reset": ["ecto.drop", "ecto.setup"], test: ["ecto.create --quiet", "ecto.migrate", "test"], docs: ["pleroma.docs", "docs"], - analyze: ["credo --strict --only=warnings,todo,fixme,consistency,readability"] + analyze: ["credo --strict --only=warnings,todo,fixme,consistency,readability"], + copyright: &add_copyright/1 ] end @@ -332,4 +333,20 @@ defp version(version) do |> Enum.filter(fn string -> string && string != "" end) |> Enum.join() end + + defp add_copyright(_) do + line1 = "# Pleroma: A lightweight social networking server\\n" + + line2 = + "# Copyright © 2017-#{NaiveDateTime.utc_now().year} Pleroma Authors \\n" + + line3 = "# SPDX-License-Identifier: AGPL-3.0-only\\n\\n" + template = line1 <> line2 <> line3 + + find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) -exec " + grep = "grep -L '# Copyright' {} \\; |" + xargs = "xargs -n1 sed -i '' '1s;^;#{template};'" + + :os.cmd(String.to_charlist("#{find}#{grep}#{xargs}")) + end end -- cgit v1.2.3 From 41a637c3a66cc68efddb84d3e888c6c21787c1c9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 15 Jan 2021 17:25:43 -0600 Subject: Split out year --- mix.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 166cbdca5..1bfca0b47 100644 --- a/mix.exs +++ b/mix.exs @@ -335,10 +335,10 @@ defp version(version) do end defp add_copyright(_) do + year = NaiveDateTime.utc_now().year line1 = "# Pleroma: A lightweight social networking server\\n" - line2 = - "# Copyright © 2017-#{NaiveDateTime.utc_now().year} Pleroma Authors \\n" + line2 = "# Copyright © 2017-#{year} Pleroma Authors \\n" line3 = "# SPDX-License-Identifier: AGPL-3.0-only\\n\\n" template = line1 <> line2 <> line3 -- cgit v1.2.3 From 23c6cea889658b5a03b113854f0489ee2da147c7 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 15 Jan 2021 17:26:02 -0600 Subject: Add a mix alias to bump copyright --- mix.exs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 1bfca0b47..281cca643 100644 --- a/mix.exs +++ b/mix.exs @@ -230,7 +230,8 @@ defp aliases do test: ["ecto.create --quiet", "ecto.migrate", "test"], docs: ["pleroma.docs", "docs"], analyze: ["credo --strict --only=warnings,todo,fixme,consistency,readability"], - copyright: &add_copyright/1 + copyright: &add_copyright/1, + "copyright.bump": &bump_copyright/1 ] end @@ -349,4 +350,13 @@ defp add_copyright(_) do :os.cmd(String.to_charlist("#{find}#{grep}#{xargs}")) end + + defp bump_copyright(_) do + year = NaiveDateTime.utc_now().year + find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) |" + + xargs = "xargs sed -i '' 's/# Copyright © 2017-20[0-9][0-9]/# Copyright © 2017-#{year}/'" + + :os.cmd(String.to_charlist("#{find}#{xargs}")) + end end -- cgit v1.2.3 From 99c2e8ed5c797078188911d05b693388a88ade3d Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 16 Jan 2021 02:12:41 +0100 Subject: mix.exs: GNU sed doesn't into proper getopt() --- mix.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 281cca643..5404a5c11 100644 --- a/mix.exs +++ b/mix.exs @@ -346,7 +346,7 @@ defp add_copyright(_) do find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) -exec " grep = "grep -L '# Copyright' {} \\; |" - xargs = "xargs -n1 sed -i '' '1s;^;#{template};'" + xargs = "xargs -n1 sed -i'' '1s;^;#{template};'" :os.cmd(String.to_charlist("#{find}#{grep}#{xargs}")) end @@ -355,7 +355,7 @@ defp bump_copyright(_) do year = NaiveDateTime.utc_now().year find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) |" - xargs = "xargs sed -i '' 's/# Copyright © 2017-20[0-9][0-9]/# Copyright © 2017-#{year}/'" + xargs = "xargs sed -i'' 's/# Copyright © 2017-20[0-9][0-9]/# Copyright © 2017-#{year}/'" :os.cmd(String.to_charlist("#{find}#{xargs}")) end -- cgit v1.2.3 From a17a9dcc4d5f3d8f27769d334462c54d6b457230 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 16 Jan 2021 02:17:24 +0100 Subject: mix.exs: Put template into one variable with ~s[] --- mix.exs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mix.exs b/mix.exs index 5404a5c11..79d9783c4 100644 --- a/mix.exs +++ b/mix.exs @@ -337,12 +337,12 @@ defp version(version) do defp add_copyright(_) do year = NaiveDateTime.utc_now().year - line1 = "# Pleroma: A lightweight social networking server\\n" + template = ~s[\ +# Pleroma: A lightweight social networking server +# Copyright © 2017-#{year} Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only - line2 = "# Copyright © 2017-#{year} Pleroma Authors \\n" - - line3 = "# SPDX-License-Identifier: AGPL-3.0-only\\n\\n" - template = line1 <> line2 <> line3 +] |> String.replace("\n", "\\n") find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) -exec " grep = "grep -L '# Copyright' {} \\; |" -- cgit v1.2.3 From 3e0d1588a45d1e0d6b23ad2d39050098bc445269 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 16 Jan 2021 02:38:37 +0100 Subject: mix.exs: Make copyright regexes more precise - Add copyright checks for Pleroma's not any copyright - Copyright bump fixes the whole line instead of just the year --- mix.exs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mix.exs b/mix.exs index 79d9783c4..26b52b0cb 100644 --- a/mix.exs +++ b/mix.exs @@ -345,18 +345,19 @@ defp add_copyright(_) do ] |> String.replace("\n", "\\n") find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) -exec " - grep = "grep -L '# Copyright' {} \\; |" + grep = "grep -L '# Copyright © [0-9\-]* Pleroma' {} \\;" xargs = "xargs -n1 sed -i'' '1s;^;#{template};'" - :os.cmd(String.to_charlist("#{find}#{grep}#{xargs}")) + :os.cmd(String.to_charlist("#{find}#{grep} | #{xargs}")) end defp bump_copyright(_) do year = NaiveDateTime.utc_now().year - find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) |" + find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\)" - xargs = "xargs sed -i'' 's/# Copyright © 2017-20[0-9][0-9]/# Copyright © 2017-#{year}/'" + xargs = + "xargs sed -i'' 's;# Copyright © [0-9\-]* Pleroma.*$;# Copyright © 2017-#{year} Pleroma Authors ;'" - :os.cmd(String.to_charlist("#{find}#{xargs}")) + :os.cmd(String.to_charlist("#{find} | #{xargs}")) end end -- cgit v1.2.3 From 48b399cedb7d46ea0f08181cfbe4df222861f65b Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 16 Jan 2021 20:22:14 +0300 Subject: [#3213] Refactoring of HashtagsTableMigrator. Hashtag timeline performance optimization (auto switch to non-aggregate join strategy when efficient). --- CHANGELOG.md | 1 + config/description.exs | 6 ++ lib/pleroma/migrators/hashtags_table_migrator.ex | 47 +++++++++------ .../migrators/hashtags_table_migrator/state.ex | 9 +-- lib/pleroma/web/activity_pub/activity_pub.ex | 68 +++++++++++++--------- .../pleroma/web/activity_pub/activity_pub_test.exs | 4 +- 6 files changed, 84 insertions(+), 51 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b24bf07..9a053156f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries. - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Admin API: Reports now ordered by newest +- Extracted object hashtags into separate table in order to improve hashtag timeline performance (via background migration in `Pleroma.Migrators.HashtagsTableMigrator`). ### Added diff --git a/config/description.exs b/config/description.exs index f438a88ab..c73d50f7d 100644 --- a/config/description.exs +++ b/config/description.exs @@ -941,6 +941,12 @@ key: :show_reactions, type: :boolean, description: "Let favourites and emoji reactions be viewed through the API." + }, + %{ + key: :improved_hashtag_timeline, + type: :keyword, + description: + "If `true` / `:prefer_aggregation` / `:avoid_aggregation`, hashtags table and selected strategy will be used for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." } ] }, diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 9f1a00f9c..b40578d50 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -45,25 +45,23 @@ def init(_) do def handle_continue(:init_state, _state) do {:ok, _} = State.start_link(nil) - put_stat(:status, :init) + update_status(:init) - dm = data_migration() + data_migration = data_migration() manual_migrations = Config.get([:instance, :manual_data_migrations], []) cond do Config.get(:env) == :test -> - put_stat(:status, :noop) + update_status(:noop) - is_nil(dm) -> - put_stat(:status, :halt) - put_stat(:message, "Data migration does not exist.") + is_nil(data_migration) -> + update_status(:halt, "Data migration does not exist.") - dm.state == :manual or dm.name in manual_migrations -> - put_stat(:status, :noop) - put_stat(:message, "Data migration is in manual execution state.") + data_migration.state == :manual or data_migration.name in manual_migrations -> + update_status(:noop, "Data migration is in manual execution state.") - dm.state == :complete -> - handle_success() + data_migration.state == :complete -> + handle_success(data_migration) true -> send(self(), :migrate_hashtags) @@ -81,7 +79,7 @@ def handle_info(:migrate_hashtags, state) do {:ok, data_migration} = DataMigration.update(data_migration, %{state: :running, data: persistent_data}) - put_stat(:status, :running) + update_status(:running) Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") @@ -146,13 +144,12 @@ def handle_info(:migrate_hashtags, state) do ) do _ = DataMigration.update_state(data_migration, :complete) - handle_success() + handle_success(data_migration) else _ -> _ = DataMigration.update_state(data_migration, :failed) - put_stat(:status, :failed) - put_stat(:message, "Please check data_migration_failed_ids records.") + update_status(:failed, "Please check data_migration_failed_ids records.") end {:noreply, state} @@ -196,16 +193,25 @@ defp persist_stats(data_migration) do _ = DataMigration.update(data_migration, %{data: runner_state}) end - defp handle_success do - put_stat(:status, :complete) + defp handle_success(data_migration) do + update_status(:complete) - unless Config.improved_hashtag_timeline() do + unless data_migration.feature_lock || Config.improved_hashtag_timeline() do Config.put(Config.improved_hashtag_timeline_path(), true) end :ok end + def failed_objects_query do + from(o in Object) + |> join(:inner, [o], dmf in fragment("SELECT * FROM data_migration_failed_ids"), + on: dmf.record_id == o.id + ) + |> where([_o, dmf], dmf.data_migration_id == ^data_migration().id) + |> order_by([o], asc: o.id) + end + def force_continue do send(whereis(), :migrate_hashtags) end @@ -214,4 +220,9 @@ def force_restart do {:ok, _} = DataMigration.update(data_migration(), %{state: :pending, data: %{}}) force_continue() end + + defp update_status(status, message \\ nil) do + put_stat(:status, status) + put_stat(:message, message) + end end diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex index 79926892c..c1a2709fc 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator/state.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator/state.ex @@ -2,23 +2,24 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator.State do use Agent @init_state %{} + @reg_name {:global, __MODULE__} def start_link(_) do - Agent.start_link(fn -> @init_state end, name: __MODULE__) + Agent.start_link(fn -> @init_state end, name: @reg_name) end def get do - Agent.get(__MODULE__, & &1) + Agent.get(@reg_name, & &1) end def put(key, value) do - Agent.update(__MODULE__, fn state -> + Agent.update(@reg_name, fn state -> Map.put(state, key, value) end) end def increment(key, increment \\ 1) do - Agent.update(__MODULE__, fn state -> + Agent.update(@reg_name, fn state -> updated_value = (state[key] || 0) + increment Map.put(state, key, updated_value) end) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index f5563b0fd..0609827ec 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -669,63 +669,66 @@ defp restrict_since(query, %{since_id: since_id}) do defp restrict_since(query, _), do: query - defp restrict_tag_reject(_query, %{tag_reject: _tag_reject, skip_preload: true}) do + defp restrict_embedded_tag_reject(_query, %{tag_reject: _tag_reject, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_tag_reject(query, %{tag_reject: tag_reject}) when is_list(tag_reject) do + defp restrict_embedded_tag_reject(query, %{tag_reject: tag_reject}) when is_list(tag_reject) do from( [_activity, object] in query, where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) ) end - defp restrict_tag_reject(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do - restrict_tag_reject(query, %{tag_reject: [tag_reject]}) + defp restrict_embedded_tag_reject(query, %{tag_reject: tag_reject}) + when is_binary(tag_reject) do + restrict_embedded_tag_reject(query, %{tag_reject: [tag_reject]}) end - defp restrict_tag_reject(query, _), do: query + defp restrict_embedded_tag_reject(query, _), do: query - defp restrict_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) do + defp restrict_embedded_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_tag_all(query, %{tag_all: tag_all}) when is_list(tag_all) do + defp restrict_embedded_tag_all(query, %{tag_all: tag_all}) when is_list(tag_all) do from( [_activity, object] in query, where: fragment("(?)->'tag' \\?& (?)", object.data, ^tag_all) ) end - defp restrict_tag_all(query, %{tag_all: tag}) when is_binary(tag) do - restrict_tag(query, %{tag: tag}) + defp restrict_embedded_tag_all(query, %{tag_all: tag}) when is_binary(tag) do + restrict_embedded_tag(query, %{tag: tag}) end - defp restrict_tag_all(query, _), do: query + defp restrict_embedded_tag_all(query, _), do: query - defp restrict_tag(_query, %{tag: _tag, skip_preload: true}) do + defp restrict_embedded_tag(_query, %{tag: _tag, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_tag(query, %{tag: tag}) when is_list(tag) do + defp restrict_embedded_tag(query, %{tag: tag}) when is_list(tag) do from( [_activity, object] in query, where: fragment("(?)->'tag' \\?| (?)", object.data, ^tag) ) end - defp restrict_tag(query, %{tag: tag}) when is_binary(tag) do - restrict_tag(query, %{tag: [tag]}) + defp restrict_embedded_tag(query, %{tag: tag}) when is_binary(tag) do + restrict_embedded_tag(query, %{tag: [tag]}) end - defp restrict_tag(query, _), do: query + defp restrict_embedded_tag(query, _), do: query - defp restrict_hashtag(query, opts) do - [tag_any, tag_all, tag_reject] = - [:tag, :tag_all, :tag_reject] - |> Enum.map(&opts[&1]) - |> Enum.map(&List.wrap(&1)) + defp hashtag_conditions(opts) do + [:tag, :tag_all, :tag_reject] + |> Enum.map(&opts[&1]) + |> Enum.map(&List.wrap(&1)) + end + defp restrict_hashtag_agg(query, opts) do + [tag_any, tag_all, tag_reject] = hashtag_conditions(opts) has_conditions = Enum.any?([tag_any, tag_all, tag_reject], &Enum.any?(&1)) cond do @@ -1275,15 +1278,19 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> exclude_invisible_actors(opts) |> exclude_visibility(opts) + hashtag_timeline_strategy = Config.improved_hashtag_timeline() + cond do - Config.object_embedded_hashtags?() -> + !hashtag_timeline_strategy -> query - |> restrict_tag(opts) - |> restrict_tag_reject(opts) - |> restrict_tag_all(opts) + |> restrict_embedded_tag(opts) + |> restrict_embedded_tag_reject(opts) + |> restrict_embedded_tag_all(opts) + + hashtag_timeline_strategy == :prefer_aggregation -> + restrict_hashtag_agg(query, opts) - # TODO: benchmark (initial approach preferring non-aggregate ops when possible) - Config.improved_hashtag_timeline() == :join -> + hashtag_timeline_strategy == :avoid_aggregation or avoid_hashtags_aggregation?(opts) -> query |> distinct([activity], true) |> restrict_hashtag_any(opts) @@ -1291,10 +1298,17 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> restrict_hashtag_reject_any(opts) true -> - restrict_hashtag(query, opts) + restrict_hashtag_agg(query, opts) end end + defp avoid_hashtags_aggregation?(opts) do + [tag_any, tag_all, tag_reject] = hashtag_conditions(opts) + + joins_count = length(tag_all) + if Enum.any?(tag_any), do: 1, else: 0 + Enum.empty?(tag_reject) and joins_count <= 2 + end + def fetch_activities(recipients, opts \\ %{}, pagination \\ :keyset) do list_memberships = Pleroma.List.memberships(opts[:user]) diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index f86d0a265..36fd65c76 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -217,8 +217,8 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_two} = CommonAPI.post(user, %{status: ". #essais"}) {:ok, status_three} = CommonAPI.post(user, %{status: ". #test #reject"}) - for new_timeline_enabled <- [true, false] do - clear_config([:instance, :improved_hashtag_timeline], new_timeline_enabled) + for hashtag_timeline_strategy <- [true, :prefer_aggregation, :avoid_aggregation, false] do + clear_config([:instance, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) -- cgit v1.2.3 From 3f88e33a71ce02cdea722c322f1e86672aa5ff69 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 16 Jan 2021 23:05:31 +0300 Subject: [#3251] Fixed wrong test-env config setting for [Pleroma.Upload]. Refactoring. Added warning to `clear_config/_` to minimize such issues in future. --- lib/pleroma/upload/filter.ex | 2 -- test/pleroma/object_test.exs | 24 ++++++++++++------------ test/pleroma/scheduled_activity_test.exs | 7 +++---- test/pleroma/uploaders/s3_test.exs | 8 +++----- test/support/data_case.ex | 15 +++++---------- test/support/helpers.ex | 12 ++++++++++++ 6 files changed, 35 insertions(+), 33 deletions(-) diff --git a/lib/pleroma/upload/filter.ex b/lib/pleroma/upload/filter.ex index 367acd214..661135634 100644 --- a/lib/pleroma/upload/filter.ex +++ b/lib/pleroma/upload/filter.ex @@ -43,6 +43,4 @@ def filter([filter | rest], upload) do error end end - - def filter(nil, upload), do: filter([], upload) end diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs index fe7f37e7c..3150c8e01 100644 --- a/test/pleroma/object_test.exs +++ b/test/pleroma/object_test.exs @@ -78,8 +78,8 @@ test "ensures cache is cleared for the object" do setup do: clear_config([:instance, :cleanup_attachments]) test "Disabled via config" do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) - Pleroma.Config.put([:instance, :cleanup_attachments], false) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([:instance, :cleanup_attachments], false) file = %Plug.Upload{ content_type: "image/jpeg", @@ -112,8 +112,8 @@ test "Disabled via config" do end test "in subdirectories" do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) - Pleroma.Config.put([:instance, :cleanup_attachments], true) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([:instance, :cleanup_attachments], true) file = %Plug.Upload{ content_type: "image/jpeg", @@ -146,9 +146,9 @@ test "in subdirectories" do end test "with dedupe enabled" do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) - Pleroma.Config.put([Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Dedupe]) - Pleroma.Config.put([:instance, :cleanup_attachments], true) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Dedupe]) + clear_config([:instance, :cleanup_attachments], true) uploads_dir = Pleroma.Config.get!([Pleroma.Uploaders.Local, :uploads]) @@ -184,8 +184,8 @@ test "with dedupe enabled" do end test "with objects that have legacy data.url attribute" do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) - Pleroma.Config.put([:instance, :cleanup_attachments], true) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([:instance, :cleanup_attachments], true) file = %Plug.Upload{ content_type: "image/jpeg", @@ -220,9 +220,9 @@ test "with objects that have legacy data.url attribute" do end test "With custom base_url" do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) - Pleroma.Config.put([Pleroma.Upload, :base_url], "https://sub.domain.tld/dir/") - Pleroma.Config.put([:instance, :cleanup_attachments], true) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([Pleroma.Upload, :base_url], "https://sub.domain.tld/dir/") + clear_config([:instance, :cleanup_attachments], true) file = %Plug.Upload{ content_type: "image/jpeg", diff --git a/test/pleroma/scheduled_activity_test.exs b/test/pleroma/scheduled_activity_test.exs index 7faa5660d..902d1d99c 100644 --- a/test/pleroma/scheduled_activity_test.exs +++ b/test/pleroma/scheduled_activity_test.exs @@ -4,15 +4,14 @@ defmodule Pleroma.ScheduledActivityTest do use Pleroma.DataCase - alias Pleroma.DataCase + alias Pleroma.ScheduledActivity + import Pleroma.Factory setup do: clear_config([ScheduledActivity, :enabled]) - setup context do - DataCase.ensure_local_uploader(context) - end + setup [:ensure_local_uploader] describe "creation" do test "scheduled activities with jobs when ScheduledActivity enabled" do diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index 30653aad2..242dc0d50 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -14,10 +14,8 @@ defmodule Pleroma.Uploaders.S3Test do setup do clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3) clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") - - clear_config(Pleroma.Uploaders.S3, - bucket: "test_bucket" - ) + clear_config([Pleroma.Uploaders.S3]) + clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket") end describe "get_file/1" do @@ -34,7 +32,7 @@ test "it returns path without bucket when truncated_namespace set to ''" do truncated_namespace: "" ) - Config.put([Pleroma.Upload], base_url: "https://s3.amazonaws.com") + Config.put([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") assert S3.get_file("test_image.jpg") == { :ok, diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 23c858d2a..0427682a2 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -18,6 +18,8 @@ defmodule Pleroma.DataCase do use ExUnit.CaseTemplate + import Pleroma.Tests.Helpers, only: [clear_config: 2] + using do quote do alias Pleroma.Repo @@ -105,17 +107,10 @@ def stub_pipeline do end def ensure_local_uploader(context) do - test_uploader = Map.get(context, :uploader, Pleroma.Uploaders.Local) - uploader = Pleroma.Config.get([Pleroma.Upload, :uploader]) - filters = Pleroma.Config.get([Pleroma.Upload, :filters]) || [] - - Pleroma.Config.put([Pleroma.Upload, :uploader], test_uploader) - Pleroma.Config.put([Pleroma.Upload, :filters], []) + test_uploader = Map.get(context, :uploader) || Pleroma.Uploaders.Local - on_exit(fn -> - Pleroma.Config.put([Pleroma.Upload, :uploader], uploader) - Pleroma.Config.put([Pleroma.Upload, :filters], filters) - end) + clear_config([Pleroma.Upload, :uploader], test_uploader) + clear_config([Pleroma.Upload, :filters], []) :ok end diff --git a/test/support/helpers.ex b/test/support/helpers.ex index 15e8cbd9d..db38a1e81 100644 --- a/test/support/helpers.ex +++ b/test/support/helpers.ex @@ -8,6 +8,8 @@ defmodule Pleroma.Tests.Helpers do """ alias Pleroma.Config + require Logger + defmacro clear_config(config_path) do quote do clear_config(unquote(config_path)) do @@ -18,6 +20,7 @@ defmacro clear_config(config_path) do defmacro clear_config(config_path, do: yield) do quote do initial_setting = Config.fetch(unquote(config_path)) + unquote(yield) on_exit(fn -> @@ -35,6 +38,15 @@ defmacro clear_config(config_path, do: yield) do end defmacro clear_config(config_path, temp_setting) do + # NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!) + # Displaying a warning to prevent unintentional clearing of all but one keys in section + if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do + Logger.warn( + "Please change to `clear_config([section]); clear_config([section, key], value)`: " <> + "#{inspect(config_path)}, #{inspect(temp_setting)}" + ) + end + quote do clear_config(unquote(config_path)) do Config.put(unquote(config_path), unquote(temp_setting)) -- cgit v1.2.3 From 02dbf1c51d7d12e30e279afb3b84c2141c6c6e4a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 17 Jan 2021 09:58:07 +0300 Subject: use explicitly oban migration version --- priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs b/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs index 067e62e8c..bfb405579 100644 --- a/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs +++ b/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs @@ -5,6 +5,11 @@ defmodule Pleroma.Repo.Migrations.UpgradeObanJobsToV9 do use Ecto.Migration - defdelegate up, to: Oban.Migrations - defdelegate down, to: Oban.Migrations + def up do + Oban.Migrations.up(version: 9) + end + + def down do + Oban.Migrations.down(version: 9) + end end -- cgit v1.2.3 From 0e48c80d7fd65cedaccd2ecbfbd49bb0f56d6f4d Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 17 Jan 2021 09:58:41 +0300 Subject: start oban app in migrations and mix tasks --- lib/mix/pleroma.ex | 3 ++- .../migrations/20200825061316_move_activity_expirations_to_oban.exs | 2 ++ .../migrations/20200907092050_move_tokens_expiration_into_oban.exs | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex index 45d0ad624..2b6c7d6bb 100644 --- a/lib/mix/pleroma.ex +++ b/lib/mix/pleroma.ex @@ -13,7 +13,8 @@ defmodule Mix.Pleroma do :flake_id, :swoosh, :timex, - :fast_html + :fast_html, + :oban ] @cachex_children ["object", "user", "scrubber", "web_resp"] @doc "Common functions to be reused in mix tasks" diff --git a/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs b/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs index a703af83f..096ab4ce5 100644 --- a/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs +++ b/priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs @@ -6,6 +6,8 @@ defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do def change do Pleroma.Config.Oban.warn() + Application.ensure_all_started(:oban) + Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}], strategy: :one_for_one, name: Pleroma.Supervisor diff --git a/priv/repo/migrations/20200907092050_move_tokens_expiration_into_oban.exs b/priv/repo/migrations/20200907092050_move_tokens_expiration_into_oban.exs index 9e49ddacb..725c5ab0b 100644 --- a/priv/repo/migrations/20200907092050_move_tokens_expiration_into_oban.exs +++ b/priv/repo/migrations/20200907092050_move_tokens_expiration_into_oban.exs @@ -6,6 +6,8 @@ defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do def change do Pleroma.Config.Oban.warn() + Application.ensure_all_started(:oban) + Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}], strategy: :one_for_one, name: Pleroma.Supervisor -- cgit v1.2.3 From 85f7ef4d13adea9d64d279d1395d17c6ebc20678 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 17 Jan 2021 10:57:06 +0300 Subject: [#3213] Feature lock adjustment for HashtagsTableMigrator. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index b40578d50..47de5e134 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -196,11 +196,17 @@ defp persist_stats(data_migration) do defp handle_success(data_migration) do update_status(:complete) - unless data_migration.feature_lock || Config.improved_hashtag_timeline() do - Config.put(Config.improved_hashtag_timeline_path(), true) - end + cond do + data_migration.feature_lock -> + :noop + + not is_nil(Config.improved_hashtag_timeline()) -> + :noop - :ok + true -> + Config.put(Config.improved_hashtag_timeline_path(), true) + :ok + end end def failed_objects_query do -- cgit v1.2.3 From 197606984dc828f6ccac76902171138a99945c9c Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 22 Dec 2020 17:42:23 +0300 Subject: update for retired elixir_make package version --- mix.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.lock b/mix.lock index dd8bc5d82..5af9bbce6 100644 --- a/mix.lock +++ b/mix.lock @@ -33,7 +33,7 @@ "ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"}, "ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"}, "eimp": {:hex, :eimp, "1.0.14", "fc297f0c7e2700457a95a60c7010a5f1dcb768a083b6d53f49cd94ab95a28f22", [:rebar3], [{:p1_utils, "1.0.18", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "501133f3112079b92d9e22da8b88bf4f0e13d4d67ae9c15c42c30bd25ceb83b6"}, - "elixir_make": {:hex, :elixir_make, "0.6.1", "8faa29a5597faba999aeeb72bbb9c91694ef8068f0131192fb199f98d32994ef", [:mix], [], "hexpm", "35d33270680f8d839a4003c3e9f43afb595310a592405a00afc12de4c7f55a18"}, + "elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"}, "esshd": {:hex, :esshd, "0.1.1", "d4dd4c46698093a40a56afecce8a46e246eb35463c457c246dacba2e056f31b5", [:mix], [], "hexpm", "d73e341e3009d390aa36387dc8862860bf9f874c94d9fd92ade2926376f49981"}, "eternal": {:hex, :eternal, "1.2.1", "d5b6b2499ba876c57be2581b5b999ee9bdf861c647401066d3eeed111d096bc4", [:mix], [], "hexpm", "b14f1dc204321429479c569cfbe8fb287541184ed040956c8862cb7a677b8406"}, "ex2ms": {:hex, :ex2ms, "1.5.0", "19e27f9212be9a96093fed8cdfbef0a2b56c21237196d26760f11dfcfae58e97", [:mix], [], "hexpm"}, -- cgit v1.2.3 From cbb1174cbd8858079343d0852b7dba326b7dbb47 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Sun, 17 Jan 2021 15:55:33 +0300 Subject: CHANGELOG.md: Remove wrong entries from Unreleased(patch) Webpush changes are under 2.3.0 milestone and therefore should be under Unreleased section The emoji reaction change was introduced in 2.2.1 --- CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b24bf07..2b8e8d2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute. - Admin API: An endpoint to manage frontends. - Streaming API: Add follow relationships updates. +- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types ### Fixed @@ -57,9 +58,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased (Patch) ### Fixed - -- Fix ability to update Pleroma Chat push notifications with PUT /api/v1/push/subscription and alert type pleroma:chat_mention -- Emoji Reaction activity filtering from blocked and muted accounts. - StealEmojiPolicy creates dir for emojis, if it doesn't exist. ## [2.2.1] - 2020-12-22 @@ -76,6 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Rich Media Previews sometimes showed the wrong preview due to a bug following redirects. - Fixes for the autolinker. - Forwarded reports duplication from Pleroma instances. +- Emoji Reaction activity filtering from blocked and muted accounts. -
API -- cgit v1.2.3 From 9d28a7ebfbc7bd8fb893cf1e2ad555ed71f4c812 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 17 Jan 2021 21:58:15 +0300 Subject: [#3213] Missing copyright header for HashtagsTableMigrator.State. --- lib/pleroma/migrators/hashtags_table_migrator/state.ex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex index c1a2709fc..43f7270e2 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator/state.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator/state.ex @@ -1,3 +1,7 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + defmodule Pleroma.Migrators.HashtagsTableMigrator.State do use Agent -- cgit v1.2.3 From 3dc04b9aca99fc6888e2354fa1cd3c2838ded499 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 8 Jan 2021 13:10:49 +0000 Subject: Merge branch 'fix/missing_emoji_steal_dir' into 'develop' Create dir for EmojiStealPolicy automatically See merge request pleroma/pleroma!3218 --- CHANGELOG.md | 7 ++ .../web/activity_pub/mrf/steal_emoji_policy.ex | 86 ++++++++--------- .../activity_pub/mrf/steal_emoji_policy_test.exs | 103 ++++++++++++++------- 3 files changed, 121 insertions(+), 75 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f32014f1c..07e3271da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased (Patch) + +### Fixed + +- StealEmojiPolicy creates dir for emojis, if it doesn't exist. + ## [2.2.1] - 2020-12-22 ### Changed @@ -17,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Rich Media Previews sometimes showed the wrong preview due to a bug following redirects. - Fixes for the autolinker. - Forwarded reports duplication from Pleroma instances. +- Emoji Reaction activity filtering from blocked and muted accounts. -
API diff --git a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex index 2858af9eb..788f21261 100644 --- a/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/steal_emoji_policy.ex @@ -10,73 +10,75 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do @moduledoc "Detect new emojis by their shortcode and steals them" @behaviour Pleroma.Web.ActivityPub.MRF - defp remote_host?(host), do: host != Config.get([Pleroma.Web.Endpoint, :url, :host]) - defp accept_host?(host), do: host in Config.get([:mrf_steal_emoji, :hosts], []) - defp steal_emoji({shortcode, url}) do + defp steal_emoji({shortcode, url}, emoji_dir_path) do url = Pleroma.Web.MediaProxy.url(url) - {:ok, response} = Pleroma.HTTP.get(url) - size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000) - if byte_size(response.body) <= size_limit do - emoji_dir_path = - Config.get( - [:mrf_steal_emoji, :path], - Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") + with {:ok, %{status: status} = response} when status in 200..299 <- Pleroma.HTTP.get(url) do + size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000) + + if byte_size(response.body) <= size_limit do + extension = + url + |> URI.parse() + |> Map.get(:path) + |> Path.basename() + |> Path.extname() + + file_path = Path.join(emoji_dir_path, shortcode <> (extension || ".png")) + + case File.write(file_path, response.body) do + :ok -> + shortcode + + e -> + Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}") + nil + end + else + Logger.debug( + "MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{ + size_limit + } B)" ) - extension = - url - |> URI.parse() - |> Map.get(:path) - |> Path.basename() - |> Path.extname() - - file_path = Path.join([emoji_dir_path, shortcode <> (extension || ".png")]) - - try do - :ok = File.write(file_path, response.body) - - shortcode - rescue - e -> - Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}") - nil + nil end else - Logger.debug( - "MRF.StealEmojiPolicy: :#{shortcode}: at #{url} (#{byte_size(response.body)} B) over size limit (#{ - size_limit - } B)" - ) - - nil + e -> + Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}") + nil end - rescue - e -> - Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}") - nil end @impl true def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = message) do host = URI.parse(actor).host - if remote_host?(host) and accept_host?(host) do + if host != Pleroma.Web.Endpoint.host() and accept_host?(host) do installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) + emoji_dir_path = + Config.get( + [:mrf_steal_emoji, :path], + Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") + ) + + File.mkdir_p(emoji_dir_path) + new_emojis = foreign_emojis - |> Enum.filter(fn {shortcode, _url} -> shortcode not in installed_emoji end) + |> Enum.reject(fn {shortcode, _url} -> shortcode in installed_emoji end) |> Enum.filter(fn {shortcode, _url} -> reject_emoji? = - Config.get([:mrf_steal_emoji, :rejected_shortcodes], []) + [:mrf_steal_emoji, :rejected_shortcodes] + |> Config.get([]) |> Enum.find(false, fn regex -> String.match?(shortcode, regex) end) !reject_emoji? end) - |> Enum.map(&steal_emoji(&1)) + |> Enum.map(&steal_emoji(&1, emoji_dir_path)) |> Enum.filter(& &1) if !Enum.empty?(new_emojis) do diff --git a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs index 3f8222736..7665d00d0 100644 --- a/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/steal_emoji_policy_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do use Pleroma.DataCase alias Pleroma.Config + alias Pleroma.Emoji alias Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy setup_all do @@ -14,22 +15,9 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicyTest do end setup do - emoji_path = Path.join(Config.get([:instance, :static_dir]), "emoji/stolen") - File.rm_rf!(emoji_path) - File.mkdir!(emoji_path) + emoji_path = [:instance, :static_dir] |> Config.get() |> Path.join("emoji/stolen") - Pleroma.Emoji.reload() - - on_exit(fn -> - File.rm_rf!(emoji_path) - end) - - :ok - end - - test "does nothing by default" do - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - refute "firedfox" in installed_emoji + Emoji.reload() message = %{ "type" => "Create", @@ -39,30 +27,79 @@ test "does nothing by default" do } } - assert {:ok, message} == StealEmojiPolicy.filter(message) + on_exit(fn -> + File.rm_rf!(emoji_path) + end) - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - refute "firedfox" in installed_emoji + [message: message, path: emoji_path] end - test "Steals emoji on unknown shortcode from allowed remote host" do - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - refute "firedfox" in installed_emoji + test "does nothing by default", %{message: message} do + refute "firedfox" in installed() - message = %{ - "type" => "Create", - "object" => %{ - "emoji" => [{"firedfox", "https://example.org/emoji/firedfox.png"}], - "actor" => "https://example.org/users/admin" - } - } + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "firedfox" in installed() + end - clear_config([:mrf_steal_emoji, :hosts], ["example.org"]) - clear_config([:mrf_steal_emoji, :size_limit], 284_468) + test "Steals emoji on unknown shortcode from allowed remote host", %{ + message: message, + path: path + } do + refute "firedfox" in installed() + refute File.exists?(path) - assert {:ok, message} == StealEmojiPolicy.filter(message) + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 284_468) - installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end) - assert "firedfox" in installed_emoji + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + assert "firedfox" in installed() + assert File.exists?(path) + + assert path + |> Path.join("firedfox.png") + |> File.exists?() + end + + test "reject shortcode", %{message: message} do + refute "firedfox" in installed() + + clear_config(:mrf_steal_emoji, + hosts: ["example.org"], + size_limit: 284_468, + rejected_shortcodes: [~r/firedfox/] + ) + + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "firedfox" in installed() + end + + test "reject if size is above the limit", %{message: message} do + refute "firedfox" in installed() + + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 50_000) + + assert {:ok, _message} = StealEmojiPolicy.filter(message) + + refute "firedfox" in installed() + end + + test "reject if host returns error", %{message: message} do + refute "firedfox" in installed() + + Tesla.Mock.mock(fn %{method: :get, url: "https://example.org/emoji/firedfox.png"} -> + {:ok, %Tesla.Env{status: 404, body: "Not found"}} + end) + + clear_config(:mrf_steal_emoji, hosts: ["example.org"], size_limit: 284_468) + + ExUnit.CaptureLog.capture_log(fn -> + assert {:ok, _message} = StealEmojiPolicy.filter(message) + end) =~ "MRF.StealEmojiPolicy: Failed to fetch https://example.org/emoji/firedfox.png" + + refute "firedfox" in installed() end + + defp installed, do: Emoji.get_all() |> Enum.map(fn {k, _} -> k end) end -- cgit v1.2.3 From 605f38903848efc3ea6161259f5ef244efa665cc Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 18 Jan 2021 16:20:36 +0300 Subject: CHANGELOG.md: Finalize 2.2.2 changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e3271da..2b2be4ca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## Unreleased (Patch) +## [2.2.2] - 2020-01-18 ### Fixed - StealEmojiPolicy creates dir for emojis, if it doesn't exist. +- Updated `elixir_make` to a non-retired version + +### Upgrade notes + +1. Restart Pleroma ## [2.2.1] - 2020-12-22 -- cgit v1.2.3 From 207c185dd67129654805851cf5c011d8b83c7121 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 18 Jan 2021 15:35:15 +0300 Subject: mix.exs: bump version to 2.2.2 --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 77168c91c..8d68ed8e6 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do def project do [ app: :pleroma, - version: version("2.2.1"), + version: version("2.2.2"), elixir: "~> 1.9", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), -- cgit v1.2.3 From 9b68248fd6a5ad733a547d9886da7adc5cbb4767 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 18 Jan 2021 17:04:06 +0300 Subject: pleroma-fe bundle: update to 320418d524a33c20d7d769c8d67a25be81f251ec --- priv/static/index.html | 2 +- priv/static/static/js/10.0044e0a91e709d07cc7f.js | Bin 31343 -> 0 bytes .../static/js/10.0044e0a91e709d07cc7f.js.map | Bin 113 -> 0 bytes priv/static/static/js/10.a11a612e4c1ef51ded17.js | Bin 0 -> 31550 bytes .../static/js/10.a11a612e4c1ef51ded17.js.map | Bin 0 -> 113 bytes priv/static/static/js/11.22872a1f83121e70a148.js | Bin 0 -> 16124 bytes .../static/js/11.22872a1f83121e70a148.js.map | Bin 0 -> 113 bytes priv/static/static/js/11.8ff1ed54814f2d34cb3e.js | Bin 16124 -> 0 bytes .../static/js/11.8ff1ed54814f2d34cb3e.js.map | Bin 113 -> 0 bytes priv/static/static/js/12.13204bdd0ad5703a3ea3.js | Bin 23834 -> 0 bytes .../static/js/12.13204bdd0ad5703a3ea3.js.map | Bin 113 -> 0 bytes priv/static/static/js/12.c6df5166dc6cdcf749e5.js | Bin 0 -> 23834 bytes .../static/js/12.c6df5166dc6cdcf749e5.js.map | Bin 0 -> 113 bytes priv/static/static/js/13.77214c18c6d2a9865281.js | Bin 0 -> 27059 bytes .../static/js/13.77214c18c6d2a9865281.js.map | Bin 0 -> 113 bytes priv/static/static/js/13.e27c3eeddcc4b11c1f54.js | Bin 27059 -> 0 bytes .../static/js/13.e27c3eeddcc4b11c1f54.js.map | Bin 113 -> 0 bytes priv/static/static/js/14.273855b3e4e27ce80219.js | Bin 29348 -> 0 bytes .../static/js/14.273855b3e4e27ce80219.js.map | Bin 113 -> 0 bytes priv/static/static/js/14.e560f5e2f902b9ad2d0d.js | Bin 0 -> 29348 bytes .../static/js/14.e560f5e2f902b9ad2d0d.js.map | Bin 0 -> 113 bytes priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js | Bin 0 -> 7789 bytes .../static/js/15.2893c12f1ca2bcdc3cbf.js.map | Bin 0 -> 113 bytes priv/static/static/js/15.afbe29b6665fcd015b2d.js | Bin 7789 -> 0 bytes .../static/js/15.afbe29b6665fcd015b2d.js.map | Bin 113 -> 0 bytes priv/static/static/js/16.49ae236fe0fc6a010e66.js | Bin 15802 -> 0 bytes .../static/js/16.49ae236fe0fc6a010e66.js.map | Bin 113 -> 0 bytes priv/static/static/js/16.be7f4b788716bec25023.js | Bin 0 -> 15802 bytes .../static/js/16.be7f4b788716bec25023.js.map | Bin 0 -> 113 bytes priv/static/static/js/17.44e90ef82ee2ef12dc3f.js | Bin 2086 -> 0 bytes .../static/js/17.44e90ef82ee2ef12dc3f.js.map | Bin 113 -> 0 bytes priv/static/static/js/17.4ddba89b4f8c284f6392.js | Bin 0 -> 2086 bytes .../static/js/17.4ddba89b4f8c284f6392.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.990b88b57bf3a6809098.js | Bin 0 -> 29064 bytes .../static/js/18.990b88b57bf3a6809098.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.cf36e1127e02cd2a36a4.js | Bin 28883 -> 0 bytes .../static/js/18.cf36e1127e02cd2a36a4.js.map | Bin 113 -> 0 bytes priv/static/static/js/19.1fd4da643df0abf89122.js | Bin 31472 -> 0 bytes .../static/js/19.1fd4da643df0abf89122.js.map | Bin 113 -> 0 bytes priv/static/static/js/19.783715f17e3f98e8898e.js | Bin 0 -> 31472 bytes .../static/js/19.783715f17e3f98e8898e.js.map | Bin 0 -> 113 bytes priv/static/static/js/2.9b94fcdec8b4c4dde80f.js | Bin 181933 -> 0 bytes .../static/static/js/2.9b94fcdec8b4c4dde80f.js.map | Bin 472001 -> 0 bytes priv/static/static/js/2.a91966242b7de2b214d4.js | Bin 0 -> 181989 bytes .../static/static/js/2.a91966242b7de2b214d4.js.map | Bin 0 -> 472092 bytes priv/static/static/js/20.96c40f6c9db8c08633bd.js | Bin 0 -> 26280 bytes .../static/js/20.96c40f6c9db8c08633bd.js.map | Bin 0 -> 113 bytes priv/static/static/js/20.a64fd29da59076399a27.js | Bin 26280 -> 0 bytes .../static/js/20.a64fd29da59076399a27.js.map | Bin 113 -> 0 bytes priv/static/static/js/21.243d9e6ebf469a2dc740.js | Bin 13162 -> 0 bytes .../static/js/21.243d9e6ebf469a2dc740.js.map | Bin 113 -> 0 bytes priv/static/static/js/21.5a9f8e39a7833c1aa117.js | Bin 0 -> 13162 bytes .../static/js/21.5a9f8e39a7833c1aa117.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.d65671b9e5e00a0eb625.js | Bin 0 -> 19706 bytes .../static/js/22.d65671b9e5e00a0eb625.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.e20ef7e5fefc0964cdd1.js | Bin 19706 -> 0 bytes .../static/js/22.e20ef7e5fefc0964cdd1.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.614a35f9ded445292f4a.js | Bin 27669 -> 0 bytes .../static/js/23.614a35f9ded445292f4a.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.bf697d60801d277815e0.js | Bin 0 -> 27669 bytes .../static/js/23.bf697d60801d277815e0.js.map | Bin 0 -> 113 bytes priv/static/static/js/24.6ae9ca51e51e023afbe4.js | Bin 18493 -> 0 bytes .../static/js/24.6ae9ca51e51e023afbe4.js.map | Bin 113 -> 0 bytes priv/static/static/js/24.914e51bfcfc620a93c0e.js | Bin 0 -> 18493 bytes .../static/js/24.914e51bfcfc620a93c0e.js.map | Bin 0 -> 113 bytes priv/static/static/js/25.eadae0d48ee5be52a16c.js | Bin 29722 -> 0 bytes .../static/js/25.eadae0d48ee5be52a16c.js.map | Bin 113 -> 0 bytes priv/static/static/js/25.fa8acda1a0ba7de2ab58.js | Bin 0 -> 29996 bytes .../static/js/25.fa8acda1a0ba7de2ab58.js.map | Bin 0 -> 113 bytes priv/static/static/js/26.5233739c17e00ab514f7.js | Bin 0 -> 14249 bytes .../static/js/26.5233739c17e00ab514f7.js.map | Bin 0 -> 113 bytes priv/static/static/js/26.8fd0027b982c4bcdc88f.js | Bin 14249 -> 0 bytes .../static/js/26.8fd0027b982c4bcdc88f.js.map | Bin 113 -> 0 bytes priv/static/static/js/27.6d90a54efba08d261d69.js | Bin 2022 -> 0 bytes .../static/js/27.6d90a54efba08d261d69.js.map | Bin 113 -> 0 bytes priv/static/static/js/27.79a2337abb067d8a36ce.js | Bin 0 -> 2022 bytes .../static/js/27.79a2337abb067d8a36ce.js.map | Bin 0 -> 113 bytes priv/static/static/js/28.e575fccfc5c48ba080e1.js | Bin 34288 -> 0 bytes .../static/js/28.e575fccfc5c48ba080e1.js.map | Bin 113 -> 0 bytes priv/static/static/js/28.ed355decbad274c26485.js | Bin 0 -> 35421 bytes .../static/js/28.ed355decbad274c26485.js.map | Bin 0 -> 113 bytes priv/static/static/js/29.39c1e87a689c840395b2.js | Bin 23857 -> 0 bytes .../static/js/29.39c1e87a689c840395b2.js.map | Bin 113 -> 0 bytes priv/static/static/js/29.d3d8f3c066d579644c9a.js | Bin 0 -> 23857 bytes .../static/js/29.d3d8f3c066d579644c9a.js.map | Bin 0 -> 113 bytes priv/static/static/js/3.0b1cb0c49b906b834801.js | Bin 0 -> 78760 bytes .../static/static/js/3.0b1cb0c49b906b834801.js.map | Bin 0 -> 332972 bytes priv/static/static/js/3.c16fafd37452b101b5bc.js | Bin 78760 -> 0 bytes .../static/static/js/3.c16fafd37452b101b5bc.js.map | Bin 332972 -> 0 bytes priv/static/static/js/30.04694ca04ca2fb3b9695.js | Bin 0 -> 44101 bytes .../static/js/30.04694ca04ca2fb3b9695.js.map | Bin 0 -> 113 bytes priv/static/static/js/30.b461727270655cb0f752.js | Bin 41993 -> 0 bytes .../static/js/30.b461727270655cb0f752.js.map | Bin 113 -> 0 bytes priv/static/static/js/31.554145c52128030ca625.js | Bin 26596 -> 0 bytes .../static/js/31.554145c52128030ca625.js.map | Bin 113 -> 0 bytes priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js | Bin 0 -> 26981 bytes .../static/js/31.ef44f6a2b08f7f78dd8e.js.map | Bin 0 -> 113 bytes priv/static/static/js/32.044555dd7095261d9faf.js | Bin 0 -> 25909 bytes .../static/js/32.044555dd7095261d9faf.js.map | Bin 0 -> 113 bytes priv/static/static/js/4.15e71ac865c2606c30a6.js | Bin 0 -> 2177 bytes .../static/static/js/4.15e71ac865c2606c30a6.js.map | Bin 0 -> 7940 bytes priv/static/static/js/4.e8cf78e629b76635765f.js | Bin 2177 -> 0 bytes .../static/static/js/4.e8cf78e629b76635765f.js.map | Bin 7940 -> 0 bytes priv/static/static/js/5.2e165bc072548e533dd4.js | Bin 6994 -> 0 bytes .../static/static/js/5.2e165bc072548e533dd4.js.map | Bin 112 -> 0 bytes priv/static/static/js/5.e116ac5b71f5e62029a1.js | Bin 0 -> 6994 bytes .../static/static/js/5.e116ac5b71f5e62029a1.js.map | Bin 0 -> 112 bytes priv/static/static/js/6.260ccd84f8cd2af27970.js | Bin 13285 -> 0 bytes .../static/static/js/6.260ccd84f8cd2af27970.js.map | Bin 112 -> 0 bytes priv/static/static/js/6.4e804674e0bff336a51b.js | Bin 0 -> 13285 bytes .../static/static/js/6.4e804674e0bff336a51b.js.map | Bin 0 -> 112 bytes priv/static/static/js/7.1c41eff6cfc75a00bde4.js | Bin 15617 -> 0 bytes .../static/static/js/7.1c41eff6cfc75a00bde4.js.map | Bin 112 -> 0 bytes priv/static/static/js/7.e8595e0b6e063c6d9478.js | Bin 0 -> 15617 bytes .../static/static/js/7.e8595e0b6e063c6d9478.js.map | Bin 0 -> 112 bytes priv/static/static/js/8.2d08c6fbb6b6ef23752f.js | Bin 0 -> 21604 bytes .../static/static/js/8.2d08c6fbb6b6ef23752f.js.map | Bin 0 -> 112 bytes priv/static/static/js/8.9b35c2fee24ab7481e00.js | Bin 21604 -> 0 bytes .../static/static/js/8.9b35c2fee24ab7481e00.js.map | Bin 112 -> 0 bytes priv/static/static/js/9.7d9dd95c4a1c9aa47453.js | Bin 0 -> 28695 bytes .../static/static/js/9.7d9dd95c4a1c9aa47453.js.map | Bin 0 -> 112 bytes priv/static/static/js/9.fce4dde4ce07554d517f.js | Bin 28527 -> 0 bytes .../static/static/js/9.fce4dde4ce07554d517f.js.map | Bin 112 -> 0 bytes priv/static/static/js/app.8f473d84b69949770654.js | Bin 0 -> 605506 bytes .../static/js/app.8f473d84b69949770654.js.map | Bin 0 -> 1560395 bytes priv/static/static/js/app.c4f570328dc17a633803.js | Bin 604391 -> 0 bytes .../static/js/app.c4f570328dc17a633803.js.map | Bin 1557144 -> 0 bytes .../static/js/vendors~app.4103f03e428eb765f04d.js | Bin 372447 -> 0 bytes .../js/vendors~app.4103f03e428eb765f04d.js.map | Bin 2260522 -> 0 bytes .../static/js/vendors~app.54838a79dee084ec3dad.js | Bin 0 -> 375539 bytes .../js/vendors~app.54838a79dee084ec3dad.js.map | Bin 0 -> 2277783 bytes priv/static/sw-pleroma.js | Bin 182005 -> 184640 bytes priv/static/sw-pleroma.js.map | Bin 696556 -> 714445 bytes 133 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 priv/static/static/js/10.0044e0a91e709d07cc7f.js delete mode 100644 priv/static/static/js/10.0044e0a91e709d07cc7f.js.map create mode 100644 priv/static/static/js/10.a11a612e4c1ef51ded17.js create mode 100644 priv/static/static/js/10.a11a612e4c1ef51ded17.js.map create mode 100644 priv/static/static/js/11.22872a1f83121e70a148.js create mode 100644 priv/static/static/js/11.22872a1f83121e70a148.js.map delete mode 100644 priv/static/static/js/11.8ff1ed54814f2d34cb3e.js delete mode 100644 priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map delete mode 100644 priv/static/static/js/12.13204bdd0ad5703a3ea3.js delete mode 100644 priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map create mode 100644 priv/static/static/js/12.c6df5166dc6cdcf749e5.js create mode 100644 priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map create mode 100644 priv/static/static/js/13.77214c18c6d2a9865281.js create mode 100644 priv/static/static/js/13.77214c18c6d2a9865281.js.map delete mode 100644 priv/static/static/js/13.e27c3eeddcc4b11c1f54.js delete mode 100644 priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map delete mode 100644 priv/static/static/js/14.273855b3e4e27ce80219.js delete mode 100644 priv/static/static/js/14.273855b3e4e27ce80219.js.map create mode 100644 priv/static/static/js/14.e560f5e2f902b9ad2d0d.js create mode 100644 priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map create mode 100644 priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js create mode 100644 priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map delete mode 100644 priv/static/static/js/15.afbe29b6665fcd015b2d.js delete mode 100644 priv/static/static/js/15.afbe29b6665fcd015b2d.js.map delete mode 100644 priv/static/static/js/16.49ae236fe0fc6a010e66.js delete mode 100644 priv/static/static/js/16.49ae236fe0fc6a010e66.js.map create mode 100644 priv/static/static/js/16.be7f4b788716bec25023.js create mode 100644 priv/static/static/js/16.be7f4b788716bec25023.js.map delete mode 100644 priv/static/static/js/17.44e90ef82ee2ef12dc3f.js delete mode 100644 priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map create mode 100644 priv/static/static/js/17.4ddba89b4f8c284f6392.js create mode 100644 priv/static/static/js/17.4ddba89b4f8c284f6392.js.map create mode 100644 priv/static/static/js/18.990b88b57bf3a6809098.js create mode 100644 priv/static/static/js/18.990b88b57bf3a6809098.js.map delete mode 100644 priv/static/static/js/18.cf36e1127e02cd2a36a4.js delete mode 100644 priv/static/static/js/18.cf36e1127e02cd2a36a4.js.map delete mode 100644 priv/static/static/js/19.1fd4da643df0abf89122.js delete mode 100644 priv/static/static/js/19.1fd4da643df0abf89122.js.map create mode 100644 priv/static/static/js/19.783715f17e3f98e8898e.js create mode 100644 priv/static/static/js/19.783715f17e3f98e8898e.js.map delete mode 100644 priv/static/static/js/2.9b94fcdec8b4c4dde80f.js delete mode 100644 priv/static/static/js/2.9b94fcdec8b4c4dde80f.js.map create mode 100644 priv/static/static/js/2.a91966242b7de2b214d4.js create mode 100644 priv/static/static/js/2.a91966242b7de2b214d4.js.map create mode 100644 priv/static/static/js/20.96c40f6c9db8c08633bd.js create mode 100644 priv/static/static/js/20.96c40f6c9db8c08633bd.js.map delete mode 100644 priv/static/static/js/20.a64fd29da59076399a27.js delete mode 100644 priv/static/static/js/20.a64fd29da59076399a27.js.map delete mode 100644 priv/static/static/js/21.243d9e6ebf469a2dc740.js delete mode 100644 priv/static/static/js/21.243d9e6ebf469a2dc740.js.map create mode 100644 priv/static/static/js/21.5a9f8e39a7833c1aa117.js create mode 100644 priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map create mode 100644 priv/static/static/js/22.d65671b9e5e00a0eb625.js create mode 100644 priv/static/static/js/22.d65671b9e5e00a0eb625.js.map delete mode 100644 priv/static/static/js/22.e20ef7e5fefc0964cdd1.js delete mode 100644 priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map delete mode 100644 priv/static/static/js/23.614a35f9ded445292f4a.js delete mode 100644 priv/static/static/js/23.614a35f9ded445292f4a.js.map create mode 100644 priv/static/static/js/23.bf697d60801d277815e0.js create mode 100644 priv/static/static/js/23.bf697d60801d277815e0.js.map delete mode 100644 priv/static/static/js/24.6ae9ca51e51e023afbe4.js delete mode 100644 priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map create mode 100644 priv/static/static/js/24.914e51bfcfc620a93c0e.js create mode 100644 priv/static/static/js/24.914e51bfcfc620a93c0e.js.map delete mode 100644 priv/static/static/js/25.eadae0d48ee5be52a16c.js delete mode 100644 priv/static/static/js/25.eadae0d48ee5be52a16c.js.map create mode 100644 priv/static/static/js/25.fa8acda1a0ba7de2ab58.js create mode 100644 priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map create mode 100644 priv/static/static/js/26.5233739c17e00ab514f7.js create mode 100644 priv/static/static/js/26.5233739c17e00ab514f7.js.map delete mode 100644 priv/static/static/js/26.8fd0027b982c4bcdc88f.js delete mode 100644 priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map delete mode 100644 priv/static/static/js/27.6d90a54efba08d261d69.js delete mode 100644 priv/static/static/js/27.6d90a54efba08d261d69.js.map create mode 100644 priv/static/static/js/27.79a2337abb067d8a36ce.js create mode 100644 priv/static/static/js/27.79a2337abb067d8a36ce.js.map delete mode 100644 priv/static/static/js/28.e575fccfc5c48ba080e1.js delete mode 100644 priv/static/static/js/28.e575fccfc5c48ba080e1.js.map create mode 100644 priv/static/static/js/28.ed355decbad274c26485.js create mode 100644 priv/static/static/js/28.ed355decbad274c26485.js.map delete mode 100644 priv/static/static/js/29.39c1e87a689c840395b2.js delete mode 100644 priv/static/static/js/29.39c1e87a689c840395b2.js.map create mode 100644 priv/static/static/js/29.d3d8f3c066d579644c9a.js create mode 100644 priv/static/static/js/29.d3d8f3c066d579644c9a.js.map create mode 100644 priv/static/static/js/3.0b1cb0c49b906b834801.js create mode 100644 priv/static/static/js/3.0b1cb0c49b906b834801.js.map delete mode 100644 priv/static/static/js/3.c16fafd37452b101b5bc.js delete mode 100644 priv/static/static/js/3.c16fafd37452b101b5bc.js.map create mode 100644 priv/static/static/js/30.04694ca04ca2fb3b9695.js create mode 100644 priv/static/static/js/30.04694ca04ca2fb3b9695.js.map delete mode 100644 priv/static/static/js/30.b461727270655cb0f752.js delete mode 100644 priv/static/static/js/30.b461727270655cb0f752.js.map delete mode 100644 priv/static/static/js/31.554145c52128030ca625.js delete mode 100644 priv/static/static/js/31.554145c52128030ca625.js.map create mode 100644 priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js create mode 100644 priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map create mode 100644 priv/static/static/js/32.044555dd7095261d9faf.js create mode 100644 priv/static/static/js/32.044555dd7095261d9faf.js.map create mode 100644 priv/static/static/js/4.15e71ac865c2606c30a6.js create mode 100644 priv/static/static/js/4.15e71ac865c2606c30a6.js.map delete mode 100644 priv/static/static/js/4.e8cf78e629b76635765f.js delete mode 100644 priv/static/static/js/4.e8cf78e629b76635765f.js.map delete mode 100644 priv/static/static/js/5.2e165bc072548e533dd4.js delete mode 100644 priv/static/static/js/5.2e165bc072548e533dd4.js.map create mode 100644 priv/static/static/js/5.e116ac5b71f5e62029a1.js create mode 100644 priv/static/static/js/5.e116ac5b71f5e62029a1.js.map delete mode 100644 priv/static/static/js/6.260ccd84f8cd2af27970.js delete mode 100644 priv/static/static/js/6.260ccd84f8cd2af27970.js.map create mode 100644 priv/static/static/js/6.4e804674e0bff336a51b.js create mode 100644 priv/static/static/js/6.4e804674e0bff336a51b.js.map delete mode 100644 priv/static/static/js/7.1c41eff6cfc75a00bde4.js delete mode 100644 priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map create mode 100644 priv/static/static/js/7.e8595e0b6e063c6d9478.js create mode 100644 priv/static/static/js/7.e8595e0b6e063c6d9478.js.map create mode 100644 priv/static/static/js/8.2d08c6fbb6b6ef23752f.js create mode 100644 priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map delete mode 100644 priv/static/static/js/8.9b35c2fee24ab7481e00.js delete mode 100644 priv/static/static/js/8.9b35c2fee24ab7481e00.js.map create mode 100644 priv/static/static/js/9.7d9dd95c4a1c9aa47453.js create mode 100644 priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map delete mode 100644 priv/static/static/js/9.fce4dde4ce07554d517f.js delete mode 100644 priv/static/static/js/9.fce4dde4ce07554d517f.js.map create mode 100644 priv/static/static/js/app.8f473d84b69949770654.js create mode 100644 priv/static/static/js/app.8f473d84b69949770654.js.map delete mode 100644 priv/static/static/js/app.c4f570328dc17a633803.js delete mode 100644 priv/static/static/js/app.c4f570328dc17a633803.js.map delete mode 100644 priv/static/static/js/vendors~app.4103f03e428eb765f04d.js delete mode 100644 priv/static/static/js/vendors~app.4103f03e428eb765f04d.js.map create mode 100644 priv/static/static/js/vendors~app.54838a79dee084ec3dad.js create mode 100644 priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map diff --git a/priv/static/index.html b/priv/static/index.html index a1d3e00d2..d9e9584db 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/priv/static/static/js/10.0044e0a91e709d07cc7f.js b/priv/static/static/js/10.0044e0a91e709d07cc7f.js deleted file mode 100644 index 1d9eb70f5..000000000 Binary files a/priv/static/static/js/10.0044e0a91e709d07cc7f.js and /dev/null differ diff --git a/priv/static/static/js/10.0044e0a91e709d07cc7f.js.map b/priv/static/static/js/10.0044e0a91e709d07cc7f.js.map deleted file mode 100644 index 2f816ec9d..000000000 Binary files a/priv/static/static/js/10.0044e0a91e709d07cc7f.js.map and /dev/null differ diff --git a/priv/static/static/js/10.a11a612e4c1ef51ded17.js b/priv/static/static/js/10.a11a612e4c1ef51ded17.js new file mode 100644 index 000000000..2a1ffcc2b Binary files /dev/null and b/priv/static/static/js/10.a11a612e4c1ef51ded17.js differ diff --git a/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map b/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map new file mode 100644 index 000000000..fd81b28be Binary files /dev/null and b/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map differ diff --git a/priv/static/static/js/11.22872a1f83121e70a148.js b/priv/static/static/js/11.22872a1f83121e70a148.js new file mode 100644 index 000000000..a2e9cee51 Binary files /dev/null and b/priv/static/static/js/11.22872a1f83121e70a148.js differ diff --git a/priv/static/static/js/11.22872a1f83121e70a148.js.map b/priv/static/static/js/11.22872a1f83121e70a148.js.map new file mode 100644 index 000000000..6467c58a5 Binary files /dev/null and b/priv/static/static/js/11.22872a1f83121e70a148.js.map differ diff --git a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js deleted file mode 100644 index cb57f2a65..000000000 Binary files a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js and /dev/null differ diff --git a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map deleted file mode 100644 index 4ce6d7227..000000000 Binary files a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map and /dev/null differ diff --git a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js deleted file mode 100644 index a89bfeb67..000000000 Binary files a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js and /dev/null differ diff --git a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map deleted file mode 100644 index 366ec2927..000000000 Binary files a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map and /dev/null differ diff --git a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js new file mode 100644 index 000000000..441071f37 Binary files /dev/null and b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js differ diff --git a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map new file mode 100644 index 000000000..c0bac6f0f Binary files /dev/null and b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map differ diff --git a/priv/static/static/js/13.77214c18c6d2a9865281.js b/priv/static/static/js/13.77214c18c6d2a9865281.js new file mode 100644 index 000000000..08e356de2 Binary files /dev/null and b/priv/static/static/js/13.77214c18c6d2a9865281.js differ diff --git a/priv/static/static/js/13.77214c18c6d2a9865281.js.map b/priv/static/static/js/13.77214c18c6d2a9865281.js.map new file mode 100644 index 000000000..3d7abf273 Binary files /dev/null and b/priv/static/static/js/13.77214c18c6d2a9865281.js.map differ diff --git a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js deleted file mode 100644 index 8cd482b41..000000000 Binary files a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js and /dev/null differ diff --git a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map deleted file mode 100644 index 0c61c3fca..000000000 Binary files a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map and /dev/null differ diff --git a/priv/static/static/js/14.273855b3e4e27ce80219.js b/priv/static/static/js/14.273855b3e4e27ce80219.js deleted file mode 100644 index 78c0bfebc..000000000 Binary files a/priv/static/static/js/14.273855b3e4e27ce80219.js and /dev/null differ diff --git a/priv/static/static/js/14.273855b3e4e27ce80219.js.map b/priv/static/static/js/14.273855b3e4e27ce80219.js.map deleted file mode 100644 index 9ee527eaa..000000000 Binary files a/priv/static/static/js/14.273855b3e4e27ce80219.js.map and /dev/null differ diff --git a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js new file mode 100644 index 000000000..d2d291725 Binary files /dev/null and b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js differ diff --git a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map new file mode 100644 index 000000000..f9797f1b6 Binary files /dev/null and b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map differ diff --git a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js new file mode 100644 index 000000000..82318f797 Binary files /dev/null and b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js differ diff --git a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map new file mode 100644 index 000000000..00cab138d Binary files /dev/null and b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map differ diff --git a/priv/static/static/js/15.afbe29b6665fcd015b2d.js b/priv/static/static/js/15.afbe29b6665fcd015b2d.js deleted file mode 100644 index b83752240..000000000 Binary files a/priv/static/static/js/15.afbe29b6665fcd015b2d.js and /dev/null differ diff --git a/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map b/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map deleted file mode 100644 index c7a0be582..000000000 Binary files a/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map and /dev/null differ diff --git a/priv/static/static/js/16.49ae236fe0fc6a010e66.js b/priv/static/static/js/16.49ae236fe0fc6a010e66.js deleted file mode 100644 index dc0e1b08d..000000000 Binary files a/priv/static/static/js/16.49ae236fe0fc6a010e66.js and /dev/null differ diff --git a/priv/static/static/js/16.49ae236fe0fc6a010e66.js.map b/priv/static/static/js/16.49ae236fe0fc6a010e66.js.map deleted file mode 100644 index ec00186b1..000000000 Binary files a/priv/static/static/js/16.49ae236fe0fc6a010e66.js.map and /dev/null differ diff --git a/priv/static/static/js/16.be7f4b788716bec25023.js b/priv/static/static/js/16.be7f4b788716bec25023.js new file mode 100644 index 000000000..ea5b554f1 Binary files /dev/null and b/priv/static/static/js/16.be7f4b788716bec25023.js differ diff --git a/priv/static/static/js/16.be7f4b788716bec25023.js.map b/priv/static/static/js/16.be7f4b788716bec25023.js.map new file mode 100644 index 000000000..121a49be1 Binary files /dev/null and b/priv/static/static/js/16.be7f4b788716bec25023.js.map differ diff --git a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js deleted file mode 100644 index 9b5adfd12..000000000 Binary files a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js and /dev/null differ diff --git a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map deleted file mode 100644 index 1d191b94a..000000000 Binary files a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map and /dev/null differ diff --git a/priv/static/static/js/17.4ddba89b4f8c284f6392.js b/priv/static/static/js/17.4ddba89b4f8c284f6392.js new file mode 100644 index 000000000..39283f245 Binary files /dev/null and b/priv/static/static/js/17.4ddba89b4f8c284f6392.js differ diff --git a/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map b/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map new file mode 100644 index 000000000..322db8c6b Binary files /dev/null and b/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map differ diff --git a/priv/static/static/js/18.990b88b57bf3a6809098.js b/priv/static/static/js/18.990b88b57bf3a6809098.js new file mode 100644 index 000000000..96de50c61 Binary files /dev/null and b/priv/static/static/js/18.990b88b57bf3a6809098.js differ diff --git a/priv/static/static/js/18.990b88b57bf3a6809098.js.map b/priv/static/static/js/18.990b88b57bf3a6809098.js.map new file mode 100644 index 000000000..b0fb3b629 Binary files /dev/null and b/priv/static/static/js/18.990b88b57bf3a6809098.js.map differ diff --git a/priv/static/static/js/18.cf36e1127e02cd2a36a4.js b/priv/static/static/js/18.cf36e1127e02cd2a36a4.js deleted file mode 100644 index d7c021bed..000000000 Binary files a/priv/static/static/js/18.cf36e1127e02cd2a36a4.js and /dev/null differ diff --git a/priv/static/static/js/18.cf36e1127e02cd2a36a4.js.map b/priv/static/static/js/18.cf36e1127e02cd2a36a4.js.map deleted file mode 100644 index 0431728a4..000000000 Binary files a/priv/static/static/js/18.cf36e1127e02cd2a36a4.js.map and /dev/null differ diff --git a/priv/static/static/js/19.1fd4da643df0abf89122.js b/priv/static/static/js/19.1fd4da643df0abf89122.js deleted file mode 100644 index c1ca1643b..000000000 Binary files a/priv/static/static/js/19.1fd4da643df0abf89122.js and /dev/null differ diff --git a/priv/static/static/js/19.1fd4da643df0abf89122.js.map b/priv/static/static/js/19.1fd4da643df0abf89122.js.map deleted file mode 100644 index 010c8674d..000000000 Binary files a/priv/static/static/js/19.1fd4da643df0abf89122.js.map and /dev/null differ diff --git a/priv/static/static/js/19.783715f17e3f98e8898e.js b/priv/static/static/js/19.783715f17e3f98e8898e.js new file mode 100644 index 000000000..bf4fd22fd Binary files /dev/null and b/priv/static/static/js/19.783715f17e3f98e8898e.js differ diff --git a/priv/static/static/js/19.783715f17e3f98e8898e.js.map b/priv/static/static/js/19.783715f17e3f98e8898e.js.map new file mode 100644 index 000000000..d3bd148d5 Binary files /dev/null and b/priv/static/static/js/19.783715f17e3f98e8898e.js.map differ diff --git a/priv/static/static/js/2.9b94fcdec8b4c4dde80f.js b/priv/static/static/js/2.9b94fcdec8b4c4dde80f.js deleted file mode 100644 index b85deca02..000000000 Binary files a/priv/static/static/js/2.9b94fcdec8b4c4dde80f.js and /dev/null differ diff --git a/priv/static/static/js/2.9b94fcdec8b4c4dde80f.js.map b/priv/static/static/js/2.9b94fcdec8b4c4dde80f.js.map deleted file mode 100644 index 1f5da32fe..000000000 Binary files a/priv/static/static/js/2.9b94fcdec8b4c4dde80f.js.map and /dev/null differ diff --git a/priv/static/static/js/2.a91966242b7de2b214d4.js b/priv/static/static/js/2.a91966242b7de2b214d4.js new file mode 100644 index 000000000..7d16e1088 Binary files /dev/null and b/priv/static/static/js/2.a91966242b7de2b214d4.js differ diff --git a/priv/static/static/js/2.a91966242b7de2b214d4.js.map b/priv/static/static/js/2.a91966242b7de2b214d4.js.map new file mode 100644 index 000000000..81f985148 Binary files /dev/null and b/priv/static/static/js/2.a91966242b7de2b214d4.js.map differ diff --git a/priv/static/static/js/20.96c40f6c9db8c08633bd.js b/priv/static/static/js/20.96c40f6c9db8c08633bd.js new file mode 100644 index 000000000..a3b3d7894 Binary files /dev/null and b/priv/static/static/js/20.96c40f6c9db8c08633bd.js differ diff --git a/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map b/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map new file mode 100644 index 000000000..d7d40ed07 Binary files /dev/null and b/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map differ diff --git a/priv/static/static/js/20.a64fd29da59076399a27.js b/priv/static/static/js/20.a64fd29da59076399a27.js deleted file mode 100644 index eae5b3947..000000000 Binary files a/priv/static/static/js/20.a64fd29da59076399a27.js and /dev/null differ diff --git a/priv/static/static/js/20.a64fd29da59076399a27.js.map b/priv/static/static/js/20.a64fd29da59076399a27.js.map deleted file mode 100644 index b2917fa10..000000000 Binary files a/priv/static/static/js/20.a64fd29da59076399a27.js.map and /dev/null differ diff --git a/priv/static/static/js/21.243d9e6ebf469a2dc740.js b/priv/static/static/js/21.243d9e6ebf469a2dc740.js deleted file mode 100644 index 61633519b..000000000 Binary files a/priv/static/static/js/21.243d9e6ebf469a2dc740.js and /dev/null differ diff --git a/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map b/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map deleted file mode 100644 index 3f98250fa..000000000 Binary files a/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map and /dev/null differ diff --git a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js new file mode 100644 index 000000000..4114db7db Binary files /dev/null and b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js differ diff --git a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map new file mode 100644 index 000000000..898948286 Binary files /dev/null and b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map differ diff --git a/priv/static/static/js/22.d65671b9e5e00a0eb625.js b/priv/static/static/js/22.d65671b9e5e00a0eb625.js new file mode 100644 index 000000000..3748a53b2 Binary files /dev/null and b/priv/static/static/js/22.d65671b9e5e00a0eb625.js differ diff --git a/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map b/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map new file mode 100644 index 000000000..110cadd41 Binary files /dev/null and b/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map differ diff --git a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js deleted file mode 100644 index e8f309f8a..000000000 Binary files a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js and /dev/null differ diff --git a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map deleted file mode 100644 index 7780cffe6..000000000 Binary files a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map and /dev/null differ diff --git a/priv/static/static/js/23.614a35f9ded445292f4a.js b/priv/static/static/js/23.614a35f9ded445292f4a.js deleted file mode 100644 index a35450986..000000000 Binary files a/priv/static/static/js/23.614a35f9ded445292f4a.js and /dev/null differ diff --git a/priv/static/static/js/23.614a35f9ded445292f4a.js.map b/priv/static/static/js/23.614a35f9ded445292f4a.js.map deleted file mode 100644 index 4158041f4..000000000 Binary files a/priv/static/static/js/23.614a35f9ded445292f4a.js.map and /dev/null differ diff --git a/priv/static/static/js/23.bf697d60801d277815e0.js b/priv/static/static/js/23.bf697d60801d277815e0.js new file mode 100644 index 000000000..e61cf01d7 Binary files /dev/null and b/priv/static/static/js/23.bf697d60801d277815e0.js differ diff --git a/priv/static/static/js/23.bf697d60801d277815e0.js.map b/priv/static/static/js/23.bf697d60801d277815e0.js.map new file mode 100644 index 000000000..20c74e93b Binary files /dev/null and b/priv/static/static/js/23.bf697d60801d277815e0.js.map differ diff --git a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js deleted file mode 100644 index d075f3b1f..000000000 Binary files a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js and /dev/null differ diff --git a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map deleted file mode 100644 index 7e68d5eaa..000000000 Binary files a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map and /dev/null differ diff --git a/priv/static/static/js/24.914e51bfcfc620a93c0e.js b/priv/static/static/js/24.914e51bfcfc620a93c0e.js new file mode 100644 index 000000000..abdad101e Binary files /dev/null and b/priv/static/static/js/24.914e51bfcfc620a93c0e.js differ diff --git a/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map b/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map new file mode 100644 index 000000000..1ddfced9a Binary files /dev/null and b/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map differ diff --git a/priv/static/static/js/25.eadae0d48ee5be52a16c.js b/priv/static/static/js/25.eadae0d48ee5be52a16c.js deleted file mode 100644 index a0e44e1aa..000000000 Binary files a/priv/static/static/js/25.eadae0d48ee5be52a16c.js and /dev/null differ diff --git a/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map b/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map deleted file mode 100644 index aaa5e3a57..000000000 Binary files a/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map and /dev/null differ diff --git a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js new file mode 100644 index 000000000..719148fcd Binary files /dev/null and b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js differ diff --git a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map new file mode 100644 index 000000000..ec5910108 Binary files /dev/null and b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map differ diff --git a/priv/static/static/js/26.5233739c17e00ab514f7.js b/priv/static/static/js/26.5233739c17e00ab514f7.js new file mode 100644 index 000000000..9adba8a0c Binary files /dev/null and b/priv/static/static/js/26.5233739c17e00ab514f7.js differ diff --git a/priv/static/static/js/26.5233739c17e00ab514f7.js.map b/priv/static/static/js/26.5233739c17e00ab514f7.js.map new file mode 100644 index 000000000..9aad55492 Binary files /dev/null and b/priv/static/static/js/26.5233739c17e00ab514f7.js.map differ diff --git a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js deleted file mode 100644 index 3b149915b..000000000 Binary files a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js and /dev/null differ diff --git a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map deleted file mode 100644 index d40f1979a..000000000 Binary files a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map and /dev/null differ diff --git a/priv/static/static/js/27.6d90a54efba08d261d69.js b/priv/static/static/js/27.6d90a54efba08d261d69.js deleted file mode 100644 index e8420a54f..000000000 Binary files a/priv/static/static/js/27.6d90a54efba08d261d69.js and /dev/null differ diff --git a/priv/static/static/js/27.6d90a54efba08d261d69.js.map b/priv/static/static/js/27.6d90a54efba08d261d69.js.map deleted file mode 100644 index 6685474ce..000000000 Binary files a/priv/static/static/js/27.6d90a54efba08d261d69.js.map and /dev/null differ diff --git a/priv/static/static/js/27.79a2337abb067d8a36ce.js b/priv/static/static/js/27.79a2337abb067d8a36ce.js new file mode 100644 index 000000000..07b8fbea4 Binary files /dev/null and b/priv/static/static/js/27.79a2337abb067d8a36ce.js differ diff --git a/priv/static/static/js/27.79a2337abb067d8a36ce.js.map b/priv/static/static/js/27.79a2337abb067d8a36ce.js.map new file mode 100644 index 000000000..a55aeae77 Binary files /dev/null and b/priv/static/static/js/27.79a2337abb067d8a36ce.js.map differ diff --git a/priv/static/static/js/28.e575fccfc5c48ba080e1.js b/priv/static/static/js/28.e575fccfc5c48ba080e1.js deleted file mode 100644 index 3b503347c..000000000 Binary files a/priv/static/static/js/28.e575fccfc5c48ba080e1.js and /dev/null differ diff --git a/priv/static/static/js/28.e575fccfc5c48ba080e1.js.map b/priv/static/static/js/28.e575fccfc5c48ba080e1.js.map deleted file mode 100644 index 0bfdc3fc1..000000000 Binary files a/priv/static/static/js/28.e575fccfc5c48ba080e1.js.map and /dev/null differ diff --git a/priv/static/static/js/28.ed355decbad274c26485.js b/priv/static/static/js/28.ed355decbad274c26485.js new file mode 100644 index 000000000..e4cfd3d70 Binary files /dev/null and b/priv/static/static/js/28.ed355decbad274c26485.js differ diff --git a/priv/static/static/js/28.ed355decbad274c26485.js.map b/priv/static/static/js/28.ed355decbad274c26485.js.map new file mode 100644 index 000000000..0349f2c68 Binary files /dev/null and b/priv/static/static/js/28.ed355decbad274c26485.js.map differ diff --git a/priv/static/static/js/29.39c1e87a689c840395b2.js b/priv/static/static/js/29.39c1e87a689c840395b2.js deleted file mode 100644 index ddb512279..000000000 Binary files a/priv/static/static/js/29.39c1e87a689c840395b2.js and /dev/null differ diff --git a/priv/static/static/js/29.39c1e87a689c840395b2.js.map b/priv/static/static/js/29.39c1e87a689c840395b2.js.map deleted file mode 100644 index 5901ce9b7..000000000 Binary files a/priv/static/static/js/29.39c1e87a689c840395b2.js.map and /dev/null differ diff --git a/priv/static/static/js/29.d3d8f3c066d579644c9a.js b/priv/static/static/js/29.d3d8f3c066d579644c9a.js new file mode 100644 index 000000000..8a8a3b51f Binary files /dev/null and b/priv/static/static/js/29.d3d8f3c066d579644c9a.js differ diff --git a/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map b/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map new file mode 100644 index 000000000..0ef69d368 Binary files /dev/null and b/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map differ diff --git a/priv/static/static/js/3.0b1cb0c49b906b834801.js b/priv/static/static/js/3.0b1cb0c49b906b834801.js new file mode 100644 index 000000000..5b79d06b1 Binary files /dev/null and b/priv/static/static/js/3.0b1cb0c49b906b834801.js differ diff --git a/priv/static/static/js/3.0b1cb0c49b906b834801.js.map b/priv/static/static/js/3.0b1cb0c49b906b834801.js.map new file mode 100644 index 000000000..08e6ffdfe Binary files /dev/null and b/priv/static/static/js/3.0b1cb0c49b906b834801.js.map differ diff --git a/priv/static/static/js/3.c16fafd37452b101b5bc.js b/priv/static/static/js/3.c16fafd37452b101b5bc.js deleted file mode 100644 index 8115aa69a..000000000 Binary files a/priv/static/static/js/3.c16fafd37452b101b5bc.js and /dev/null differ diff --git a/priv/static/static/js/3.c16fafd37452b101b5bc.js.map b/priv/static/static/js/3.c16fafd37452b101b5bc.js.map deleted file mode 100644 index c1258b4d6..000000000 Binary files a/priv/static/static/js/3.c16fafd37452b101b5bc.js.map and /dev/null differ diff --git a/priv/static/static/js/30.04694ca04ca2fb3b9695.js b/priv/static/static/js/30.04694ca04ca2fb3b9695.js new file mode 100644 index 000000000..cc60c675d Binary files /dev/null and b/priv/static/static/js/30.04694ca04ca2fb3b9695.js differ diff --git a/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map b/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map new file mode 100644 index 000000000..b347f4f84 Binary files /dev/null and b/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map differ diff --git a/priv/static/static/js/30.b461727270655cb0f752.js b/priv/static/static/js/30.b461727270655cb0f752.js deleted file mode 100644 index 1baa0f5b1..000000000 Binary files a/priv/static/static/js/30.b461727270655cb0f752.js and /dev/null differ diff --git a/priv/static/static/js/30.b461727270655cb0f752.js.map b/priv/static/static/js/30.b461727270655cb0f752.js.map deleted file mode 100644 index 570e88f38..000000000 Binary files a/priv/static/static/js/30.b461727270655cb0f752.js.map and /dev/null differ diff --git a/priv/static/static/js/31.554145c52128030ca625.js b/priv/static/static/js/31.554145c52128030ca625.js deleted file mode 100644 index 46cfcc376..000000000 Binary files a/priv/static/static/js/31.554145c52128030ca625.js and /dev/null differ diff --git a/priv/static/static/js/31.554145c52128030ca625.js.map b/priv/static/static/js/31.554145c52128030ca625.js.map deleted file mode 100644 index f16ddae52..000000000 Binary files a/priv/static/static/js/31.554145c52128030ca625.js.map and /dev/null differ diff --git a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js new file mode 100644 index 000000000..886c184d1 Binary files /dev/null and b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js differ diff --git a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map new file mode 100644 index 000000000..1a4bd1a0a Binary files /dev/null and b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map differ diff --git a/priv/static/static/js/32.044555dd7095261d9faf.js b/priv/static/static/js/32.044555dd7095261d9faf.js new file mode 100644 index 000000000..6ca50349e Binary files /dev/null and b/priv/static/static/js/32.044555dd7095261d9faf.js differ diff --git a/priv/static/static/js/32.044555dd7095261d9faf.js.map b/priv/static/static/js/32.044555dd7095261d9faf.js.map new file mode 100644 index 000000000..f7f4094ee Binary files /dev/null and b/priv/static/static/js/32.044555dd7095261d9faf.js.map differ diff --git a/priv/static/static/js/4.15e71ac865c2606c30a6.js b/priv/static/static/js/4.15e71ac865c2606c30a6.js new file mode 100644 index 000000000..3406cc065 Binary files /dev/null and b/priv/static/static/js/4.15e71ac865c2606c30a6.js differ diff --git a/priv/static/static/js/4.15e71ac865c2606c30a6.js.map b/priv/static/static/js/4.15e71ac865c2606c30a6.js.map new file mode 100644 index 000000000..023d90430 Binary files /dev/null and b/priv/static/static/js/4.15e71ac865c2606c30a6.js.map differ diff --git a/priv/static/static/js/4.e8cf78e629b76635765f.js b/priv/static/static/js/4.e8cf78e629b76635765f.js deleted file mode 100644 index bb655979f..000000000 Binary files a/priv/static/static/js/4.e8cf78e629b76635765f.js and /dev/null differ diff --git a/priv/static/static/js/4.e8cf78e629b76635765f.js.map b/priv/static/static/js/4.e8cf78e629b76635765f.js.map deleted file mode 100644 index 61ef570d8..000000000 Binary files a/priv/static/static/js/4.e8cf78e629b76635765f.js.map and /dev/null differ diff --git a/priv/static/static/js/5.2e165bc072548e533dd4.js b/priv/static/static/js/5.2e165bc072548e533dd4.js deleted file mode 100644 index cfd84226c..000000000 Binary files a/priv/static/static/js/5.2e165bc072548e533dd4.js and /dev/null differ diff --git a/priv/static/static/js/5.2e165bc072548e533dd4.js.map b/priv/static/static/js/5.2e165bc072548e533dd4.js.map deleted file mode 100644 index 49959c78e..000000000 Binary files a/priv/static/static/js/5.2e165bc072548e533dd4.js.map and /dev/null differ diff --git a/priv/static/static/js/5.e116ac5b71f5e62029a1.js b/priv/static/static/js/5.e116ac5b71f5e62029a1.js new file mode 100644 index 000000000..acd64094e Binary files /dev/null and b/priv/static/static/js/5.e116ac5b71f5e62029a1.js differ diff --git a/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map b/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map new file mode 100644 index 000000000..0017a3bfd Binary files /dev/null and b/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map differ diff --git a/priv/static/static/js/6.260ccd84f8cd2af27970.js b/priv/static/static/js/6.260ccd84f8cd2af27970.js deleted file mode 100644 index fb4a690f4..000000000 Binary files a/priv/static/static/js/6.260ccd84f8cd2af27970.js and /dev/null differ diff --git a/priv/static/static/js/6.260ccd84f8cd2af27970.js.map b/priv/static/static/js/6.260ccd84f8cd2af27970.js.map deleted file mode 100644 index 850fe731a..000000000 Binary files a/priv/static/static/js/6.260ccd84f8cd2af27970.js.map and /dev/null differ diff --git a/priv/static/static/js/6.4e804674e0bff336a51b.js b/priv/static/static/js/6.4e804674e0bff336a51b.js new file mode 100644 index 000000000..b33bbd652 Binary files /dev/null and b/priv/static/static/js/6.4e804674e0bff336a51b.js differ diff --git a/priv/static/static/js/6.4e804674e0bff336a51b.js.map b/priv/static/static/js/6.4e804674e0bff336a51b.js.map new file mode 100644 index 000000000..bbb049a88 Binary files /dev/null and b/priv/static/static/js/6.4e804674e0bff336a51b.js.map differ diff --git a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js deleted file mode 100644 index 317770a53..000000000 Binary files a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js and /dev/null differ diff --git a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map deleted file mode 100644 index 36f327b3f..000000000 Binary files a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map and /dev/null differ diff --git a/priv/static/static/js/7.e8595e0b6e063c6d9478.js b/priv/static/static/js/7.e8595e0b6e063c6d9478.js new file mode 100644 index 000000000..7622e0d7a Binary files /dev/null and b/priv/static/static/js/7.e8595e0b6e063c6d9478.js differ diff --git a/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map b/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map new file mode 100644 index 000000000..40327d1fd Binary files /dev/null and b/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map differ diff --git a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js new file mode 100644 index 000000000..085a9e004 Binary files /dev/null and b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js differ diff --git a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map new file mode 100644 index 000000000..50222e2be Binary files /dev/null and b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map differ diff --git a/priv/static/static/js/8.9b35c2fee24ab7481e00.js b/priv/static/static/js/8.9b35c2fee24ab7481e00.js deleted file mode 100644 index cb7844ffc..000000000 Binary files a/priv/static/static/js/8.9b35c2fee24ab7481e00.js and /dev/null differ diff --git a/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map b/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map deleted file mode 100644 index 65f4d5ae9..000000000 Binary files a/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map and /dev/null differ diff --git a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js new file mode 100644 index 000000000..41ab62b92 Binary files /dev/null and b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js differ diff --git a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map new file mode 100644 index 000000000..c215e9a03 Binary files /dev/null and b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map differ diff --git a/priv/static/static/js/9.fce4dde4ce07554d517f.js b/priv/static/static/js/9.fce4dde4ce07554d517f.js deleted file mode 100644 index ebf9272c9..000000000 Binary files a/priv/static/static/js/9.fce4dde4ce07554d517f.js and /dev/null differ diff --git a/priv/static/static/js/9.fce4dde4ce07554d517f.js.map b/priv/static/static/js/9.fce4dde4ce07554d517f.js.map deleted file mode 100644 index ac0899d25..000000000 Binary files a/priv/static/static/js/9.fce4dde4ce07554d517f.js.map and /dev/null differ diff --git a/priv/static/static/js/app.8f473d84b69949770654.js b/priv/static/static/js/app.8f473d84b69949770654.js new file mode 100644 index 000000000..1ebed8ece Binary files /dev/null and b/priv/static/static/js/app.8f473d84b69949770654.js differ diff --git a/priv/static/static/js/app.8f473d84b69949770654.js.map b/priv/static/static/js/app.8f473d84b69949770654.js.map new file mode 100644 index 000000000..2a6a034d7 Binary files /dev/null and b/priv/static/static/js/app.8f473d84b69949770654.js.map differ diff --git a/priv/static/static/js/app.c4f570328dc17a633803.js b/priv/static/static/js/app.c4f570328dc17a633803.js deleted file mode 100644 index a3cd5f5ee..000000000 Binary files a/priv/static/static/js/app.c4f570328dc17a633803.js and /dev/null differ diff --git a/priv/static/static/js/app.c4f570328dc17a633803.js.map b/priv/static/static/js/app.c4f570328dc17a633803.js.map deleted file mode 100644 index 5d215f8ac..000000000 Binary files a/priv/static/static/js/app.c4f570328dc17a633803.js.map and /dev/null differ diff --git a/priv/static/static/js/vendors~app.4103f03e428eb765f04d.js b/priv/static/static/js/vendors~app.4103f03e428eb765f04d.js deleted file mode 100644 index 8884654a1..000000000 Binary files a/priv/static/static/js/vendors~app.4103f03e428eb765f04d.js and /dev/null differ diff --git a/priv/static/static/js/vendors~app.4103f03e428eb765f04d.js.map b/priv/static/static/js/vendors~app.4103f03e428eb765f04d.js.map deleted file mode 100644 index 43c374b39..000000000 Binary files a/priv/static/static/js/vendors~app.4103f03e428eb765f04d.js.map and /dev/null differ diff --git a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js new file mode 100644 index 000000000..38dd65643 Binary files /dev/null and b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js differ diff --git a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map new file mode 100644 index 000000000..35b5fd52f Binary files /dev/null and b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map differ diff --git a/priv/static/sw-pleroma.js b/priv/static/sw-pleroma.js index e35f11e38..ddcf0260d 100644 Binary files a/priv/static/sw-pleroma.js and b/priv/static/sw-pleroma.js differ diff --git a/priv/static/sw-pleroma.js.map b/priv/static/sw-pleroma.js.map index 2e4aaeff9..112af6a0c 100644 Binary files a/priv/static/sw-pleroma.js.map and b/priv/static/sw-pleroma.js.map differ -- cgit v1.2.3 From bdfd72630f48bb891af34f1849e87cc5bbd3ff51 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Mon, 18 Jan 2021 16:28:36 +0100 Subject: ListController: Fix being unable to add / remove users. --- lib/pleroma/list.ex | 8 ++++++-- .../web/mastodon_api/controllers/list_controller_test.exs | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/list.ex b/lib/pleroma/list.ex index ff975e7a6..fe5721c34 100644 --- a/lib/pleroma/list.ex +++ b/lib/pleroma/list.ex @@ -113,11 +113,15 @@ def create(title, %User{} = creator) do end end - def follow(%Pleroma.List{following: following} = list, %User{} = followed) do + def follow(%Pleroma.List{id: id}, %User{} = followed) do + list = Repo.get(Pleroma.List, id) + %{following: following} = list update_follows(list, %{following: Enum.uniq([followed.follower_address | following])}) end - def unfollow(%Pleroma.List{following: following} = list, %User{} = unfollowed) do + def unfollow(%Pleroma.List{id: id}, %User{} = unfollowed) do + list = Repo.get(Pleroma.List, id) + %{following: following} = list update_follows(list, %{following: List.delete(following, unfollowed.follower_address)}) end diff --git a/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs index cc5e1e66d..28099837e 100644 --- a/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs @@ -55,30 +55,39 @@ test "listing a user's lists" do test "adding users to a list" do %{user: user, conn: conn} = oauth_access(["write:lists"]) other_user = insert(:user) + third_user = insert(:user) {:ok, list} = Pleroma.List.create("name", user) assert %{} == conn |> put_req_header("content-type", "application/json") - |> post("/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]}) + |> post("/api/v1/lists/#{list.id}/accounts", %{ + "account_ids" => [other_user.id, third_user.id] + }) |> json_response_and_validate_schema(:ok) %Pleroma.List{following: following} = Pleroma.List.get(list.id, user) - assert following == [other_user.follower_address] + assert length(following) == 2 + assert other_user.follower_address in following + assert third_user.follower_address in following end test "removing users from a list, body params" do %{user: user, conn: conn} = oauth_access(["write:lists"]) other_user = insert(:user) third_user = insert(:user) + fourth_user = insert(:user) {:ok, list} = Pleroma.List.create("name", user) {:ok, list} = Pleroma.List.follow(list, other_user) {:ok, list} = Pleroma.List.follow(list, third_user) + {:ok, list} = Pleroma.List.follow(list, fourth_user) assert %{} == conn |> put_req_header("content-type", "application/json") - |> delete("/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]}) + |> delete("/api/v1/lists/#{list.id}/accounts", %{ + "account_ids" => [other_user.id, fourth_user.id] + }) |> json_response_and_validate_schema(:ok) %Pleroma.List{following: following} = Pleroma.List.get(list.id, user) -- cgit v1.2.3 From 71166b30a42ad3a8988049992bcab93c7e2ed656 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Mon, 18 Jan 2021 16:29:29 +0100 Subject: Changelog: Add list fix. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b8e8d2f4..a14e03b68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). API Changes - Mastodon API: Current user is now included in conversation if it's the only participant. - Mastodon API: Fixed last_status.account being not filled with account data. + - Mastodon API: Fix not being able to add or remove multiple users at once in lists.
## Unreleased (Patch) -- cgit v1.2.3 From 1b79dce7bc53f0aa6ce07fdc178bb72b5caabe98 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Mon, 18 Jan 2021 20:15:57 +0400 Subject: Fix Reblog API Do not set visibility parameter to `public` by default and let CommonAPI to infer it from status. --- lib/pleroma/web/api_spec/operations/status_operation.ex | 2 +- test/pleroma/web/common_api_test.exs | 11 +++++++++++ .../mastodon_api/controllers/status_controller_test.exs | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index 765fbd67b..fd29f5139 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -117,7 +117,7 @@ def reblog_operation do request_body("Parameters", %Schema{ type: :object, properties: %{ - visibility: %Schema{allOf: [VisibilityScope], default: "public"} + visibility: %Schema{allOf: [VisibilityScope]} } }), responses: %{ diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 2ece92806..2f7dc38e4 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -744,6 +744,17 @@ test "repeating a status privately" do refute Visibility.visible_for_user?(announce_activity, nil) end + test "author can repeat own private statuses" do + user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"}) + + {:ok, %Activity{} = announce_activity} = CommonAPI.repeat(activity.id, user) + + assert Visibility.is_private?(announce_activity) + refute Visibility.visible_for_user?(announce_activity, nil) + end + test "favoriting a status" do user = insert(:user) other_user = insert(:user) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 8a2267099..bfb44374e 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -954,6 +954,23 @@ test "reblogged status for another user" do assert to_string(activity.id) == id end + + test "author can reblog own private status", %{conn: conn, user: user} do + {:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"}) + + conn = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses/#{activity.id}/reblog") + + assert %{ + "reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1}, + "reblogged" => true, + "visibility" => "private" + } = json_response_and_validate_schema(conn, 200) + + assert to_string(activity.id) == id + end end describe "unreblogging" do -- cgit v1.2.3 From 51d5951c022c401c767924bab97854c8f2143089 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Mon, 18 Jan 2021 21:01:00 +0400 Subject: Test that only author can reblog a private status --- test/pleroma/web/common_api_test.exs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 2f7dc38e4..7067f1b59 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -745,14 +745,19 @@ test "repeating a status privately" do end test "author can repeat own private statuses" do - user = insert(:user) + author = insert(:user) + follower = insert(:user) + CommonAPI.follow(follower, author) - {:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"}) + {:ok, activity} = CommonAPI.post(author, %{status: "cofe", visibility: "private"}) - {:ok, %Activity{} = announce_activity} = CommonAPI.repeat(activity.id, user) + {:ok, %Activity{} = announce_activity} = CommonAPI.repeat(activity.id, author) assert Visibility.is_private?(announce_activity) refute Visibility.visible_for_user?(announce_activity, nil) + + assert Visibility.visible_for_user?(activity, follower) + assert {:error, :not_found} = CommonAPI.repeat(activity.id, follower) end test "favoriting a status" do -- cgit v1.2.3 From 8a230667cc03b0a4a1ab7ff583a3a245f3ddd8fc Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 11:25:13 -0600 Subject: Update AdminFE: pleroma/admin-fe@d4c7989f05f38fd4f30c234a13a6e51cac83be57 --- priv/static/adminfe/chunk-03c5.3368e00c.css | Bin 0 -> 1270 bytes priv/static/adminfe/chunk-03c5.e6a0e2d0.css | Bin 1270 -> 0 bytes priv/static/adminfe/chunk-0492.15b0611f.css | Bin 29389 -> 0 bytes priv/static/adminfe/chunk-04b0.7e25cd78.css | Bin 4395 -> 0 bytes priv/static/adminfe/chunk-0537.76929cff.css | Bin 0 -> 6072 bytes priv/static/adminfe/chunk-0537.cd83e5d6.css | Bin 6072 -> 0 bytes priv/static/adminfe/chunk-1944.731ba892.css | Bin 5927 -> 0 bytes priv/static/adminfe/chunk-1e1e.5980e665.css | Bin 0 -> 1398 bytes priv/static/adminfe/chunk-35b1.949db050.css | Bin 0 -> 5927 bytes priv/static/adminfe/chunk-4770.20caaae1.css | Bin 0 -> 29667 bytes priv/static/adminfe/chunk-50ba.6e4bf9f4.css | Bin 0 -> 692 bytes priv/static/adminfe/chunk-606c.7c5b0a08.css | Bin 0 -> 4395 bytes priv/static/adminfe/chunk-68ea9.8331e95e.css | Bin 4748 -> 0 bytes priv/static/adminfe/chunk-68ea9.892994aa.css | Bin 0 -> 4748 bytes priv/static/adminfe/chunk-6e81.559b76f9.css | Bin 745 -> 0 bytes priv/static/adminfe/chunk-6e81.687d5046.css | Bin 0 -> 745 bytes priv/static/adminfe/chunk-7041.c5f6eab7.css | Bin 0 -> 4090 bytes priv/static/adminfe/chunk-7968.283bc086.css | Bin 5086 -> 0 bytes priv/static/adminfe/chunk-7968.613084d0.css | Bin 0 -> 5300 bytes priv/static/adminfe/chunk-8fbb.dd321643.css | Bin 1381 -> 0 bytes priv/static/adminfe/chunk-ad1e.1a3c5339.css | Bin 4090 -> 0 bytes priv/static/adminfe/chunk-e660.62c077ac.css | Bin 0 -> 2044 bytes priv/static/adminfe/chunk-e660.9e75af5b.css | Bin 2044 -> 0 bytes priv/static/adminfe/chunk-f364.4fd16c53.css | Bin 0 -> 4576 bytes priv/static/adminfe/chunk-f364.6b5f3f0d.css | Bin 3408 -> 0 bytes priv/static/adminfe/chunk-f625.bcd0ea3b.css | Bin 692 -> 0 bytes priv/static/adminfe/index.html | 2 +- priv/static/adminfe/static/js/app.3e54b198.js | Bin 0 -> 258237 bytes priv/static/adminfe/static/js/app.3e54b198.js.map | Bin 0 -> 529115 bytes priv/static/adminfe/static/js/app.c67f9a2f.js | Bin 257971 -> 0 bytes priv/static/adminfe/static/js/app.c67f9a2f.js.map | Bin 528387 -> 0 bytes priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js | Bin 0 -> 7010 bytes .../adminfe/static/js/chunk-03c5.1b0ab243.js.map | Bin 0 -> 32334 bytes priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js | Bin 7010 -> 0 bytes .../adminfe/static/js/chunk-03c5.6de0c4c7.js.map | Bin 32334 -> 0 bytes priv/static/adminfe/static/js/chunk-0492.47abe1dc.js | Bin 149458 -> 0 bytes .../adminfe/static/js/chunk-0492.47abe1dc.js.map | Bin 457387 -> 0 bytes priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js | Bin 26570 -> 0 bytes .../adminfe/static/js/chunk-04b0.90c6d24c.js.map | Bin 101680 -> 0 bytes priv/static/adminfe/static/js/chunk-0537.74db16b0.js | Bin 27878 -> 0 bytes .../adminfe/static/js/chunk-0537.74db16b0.js.map | Bin 95182 -> 0 bytes priv/static/adminfe/static/js/chunk-0537.d0eef370.js | Bin 0 -> 28337 bytes .../adminfe/static/js/chunk-0537.d0eef370.js.map | Bin 0 -> 96225 bytes priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js | Bin 29865 -> 0 bytes .../adminfe/static/js/chunk-1944.7bed0c4b.js.map | Bin 99609 -> 0 bytes priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js | Bin 0 -> 14427 bytes .../adminfe/static/js/chunk-1e1e.37f6f555.js.map | Bin 0 -> 55284 bytes priv/static/adminfe/static/js/chunk-35b1.51b3140e.js | Bin 0 -> 29851 bytes .../adminfe/static/js/chunk-35b1.51b3140e.js.map | Bin 0 -> 99571 bytes priv/static/adminfe/static/js/chunk-4770.1c1fff97.js | Bin 0 -> 150520 bytes .../adminfe/static/js/chunk-4770.1c1fff97.js.map | Bin 0 -> 460576 bytes priv/static/adminfe/static/js/chunk-50ba.afb924bf.js | Bin 0 -> 15862 bytes .../adminfe/static/js/chunk-50ba.afb924bf.js.map | Bin 0 -> 41893 bytes priv/static/adminfe/static/js/chunk-606c.f5585a4f.js | Bin 0 -> 26548 bytes .../adminfe/static/js/chunk-606c.f5585a4f.js.map | Bin 0 -> 101627 bytes priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js | Bin 7921 -> 0 bytes .../adminfe/static/js/chunk-68ea9.2b2877d5.js.map | Bin 17439 -> 0 bytes priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js | Bin 0 -> 7921 bytes .../adminfe/static/js/chunk-68ea9.5a11341a.js.map | Bin 0 -> 17439 bytes priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js | Bin 0 -> 2080 bytes .../adminfe/static/js/chunk-6e81.6c4f2ce1.js.map | Bin 0 -> 9090 bytes priv/static/adminfe/static/js/chunk-6e81.afade883.js | Bin 2080 -> 0 bytes .../adminfe/static/js/chunk-6e81.afade883.js.map | Bin 9090 -> 0 bytes priv/static/adminfe/static/js/chunk-7041.9658c334.js | Bin 0 -> 20264 bytes .../adminfe/static/js/chunk-7041.9658c334.js.map | Bin 0 -> 67908 bytes priv/static/adminfe/static/js/chunk-7968.d6317b83.js | Bin 0 -> 23109 bytes .../adminfe/static/js/chunk-7968.d6317b83.js.map | Bin 0 -> 87317 bytes priv/static/adminfe/static/js/chunk-7968.f51e3292.js | Bin 23084 -> 0 bytes .../adminfe/static/js/chunk-7968.f51e3292.js.map | Bin 87014 -> 0 bytes priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js | Bin 11558 -> 0 bytes .../adminfe/static/js/chunk-8fbb.c847ce9d.js.map | Bin 49139 -> 0 bytes priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js | Bin 20278 -> 0 bytes .../adminfe/static/js/chunk-ad1e.eba9db26.js.map | Bin 67946 -> 0 bytes priv/static/adminfe/static/js/chunk-e660.2101cafc.js | Bin 0 -> 4998 bytes .../adminfe/static/js/chunk-e660.2101cafc.js.map | Bin 0 -> 19667 bytes priv/static/adminfe/static/js/chunk-e660.feca27c4.js | Bin 4998 -> 0 bytes .../adminfe/static/js/chunk-e660.feca27c4.js.map | Bin 19667 -> 0 bytes priv/static/adminfe/static/js/chunk-f364.1122502b.js | Bin 20725 -> 0 bytes .../adminfe/static/js/chunk-f364.1122502b.js.map | Bin 72190 -> 0 bytes priv/static/adminfe/static/js/chunk-f364.f22b0eee.js | Bin 0 -> 20986 bytes .../adminfe/static/js/chunk-f364.f22b0eee.js.map | Bin 0 -> 74062 bytes priv/static/adminfe/static/js/chunk-f625.904137fd.js | Bin 15874 -> 0 bytes .../adminfe/static/js/chunk-f625.904137fd.js.map | Bin 41917 -> 0 bytes priv/static/adminfe/static/js/chunk-libs.32ea9181.js | Bin 294768 -> 0 bytes .../adminfe/static/js/chunk-libs.32ea9181.js.map | Bin 1726687 -> 0 bytes priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js | Bin 0 -> 294768 bytes .../adminfe/static/js/chunk-libs.5ca2c8e8.js.map | Bin 0 -> 1726687 bytes priv/static/adminfe/static/js/runtime.52fd11cf.js | Bin 0 -> 4469 bytes priv/static/adminfe/static/js/runtime.52fd11cf.js.map | Bin 0 -> 17827 bytes priv/static/adminfe/static/js/runtime.ba96836e.js | Bin 4469 -> 0 bytes priv/static/adminfe/static/js/runtime.ba96836e.js.map | Bin 17829 -> 0 bytes 91 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 priv/static/adminfe/chunk-03c5.3368e00c.css delete mode 100644 priv/static/adminfe/chunk-03c5.e6a0e2d0.css delete mode 100644 priv/static/adminfe/chunk-0492.15b0611f.css delete mode 100644 priv/static/adminfe/chunk-04b0.7e25cd78.css create mode 100644 priv/static/adminfe/chunk-0537.76929cff.css delete mode 100644 priv/static/adminfe/chunk-0537.cd83e5d6.css delete mode 100644 priv/static/adminfe/chunk-1944.731ba892.css create mode 100644 priv/static/adminfe/chunk-1e1e.5980e665.css create mode 100644 priv/static/adminfe/chunk-35b1.949db050.css create mode 100644 priv/static/adminfe/chunk-4770.20caaae1.css create mode 100644 priv/static/adminfe/chunk-50ba.6e4bf9f4.css create mode 100644 priv/static/adminfe/chunk-606c.7c5b0a08.css delete mode 100644 priv/static/adminfe/chunk-68ea9.8331e95e.css create mode 100644 priv/static/adminfe/chunk-68ea9.892994aa.css delete mode 100644 priv/static/adminfe/chunk-6e81.559b76f9.css create mode 100644 priv/static/adminfe/chunk-6e81.687d5046.css create mode 100644 priv/static/adminfe/chunk-7041.c5f6eab7.css delete mode 100644 priv/static/adminfe/chunk-7968.283bc086.css create mode 100644 priv/static/adminfe/chunk-7968.613084d0.css delete mode 100644 priv/static/adminfe/chunk-8fbb.dd321643.css delete mode 100644 priv/static/adminfe/chunk-ad1e.1a3c5339.css create mode 100644 priv/static/adminfe/chunk-e660.62c077ac.css delete mode 100644 priv/static/adminfe/chunk-e660.9e75af5b.css create mode 100644 priv/static/adminfe/chunk-f364.4fd16c53.css delete mode 100644 priv/static/adminfe/chunk-f364.6b5f3f0d.css delete mode 100644 priv/static/adminfe/chunk-f625.bcd0ea3b.css create mode 100644 priv/static/adminfe/static/js/app.3e54b198.js create mode 100644 priv/static/adminfe/static/js/app.3e54b198.js.map delete mode 100644 priv/static/adminfe/static/js/app.c67f9a2f.js delete mode 100644 priv/static/adminfe/static/js/app.c67f9a2f.js.map create mode 100644 priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js create mode 100644 priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js delete mode 100644 priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-0492.47abe1dc.js delete mode 100644 priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js delete mode 100644 priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-0537.74db16b0.js delete mode 100644 priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map create mode 100644 priv/static/adminfe/static/js/chunk-0537.d0eef370.js create mode 100644 priv/static/adminfe/static/js/chunk-0537.d0eef370.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js delete mode 100644 priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map create mode 100644 priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js create mode 100644 priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js.map create mode 100644 priv/static/adminfe/static/js/chunk-35b1.51b3140e.js create mode 100644 priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map create mode 100644 priv/static/adminfe/static/js/chunk-4770.1c1fff97.js create mode 100644 priv/static/adminfe/static/js/chunk-4770.1c1fff97.js.map create mode 100644 priv/static/adminfe/static/js/chunk-50ba.afb924bf.js create mode 100644 priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map create mode 100644 priv/static/adminfe/static/js/chunk-606c.f5585a4f.js create mode 100644 priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js delete mode 100644 priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map create mode 100644 priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js create mode 100644 priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js.map create mode 100644 priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js create mode 100644 priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-6e81.afade883.js delete mode 100644 priv/static/adminfe/static/js/chunk-6e81.afade883.js.map create mode 100644 priv/static/adminfe/static/js/chunk-7041.9658c334.js create mode 100644 priv/static/adminfe/static/js/chunk-7041.9658c334.js.map create mode 100644 priv/static/adminfe/static/js/chunk-7968.d6317b83.js create mode 100644 priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-7968.f51e3292.js delete mode 100644 priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js delete mode 100644 priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js delete mode 100644 priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map create mode 100644 priv/static/adminfe/static/js/chunk-e660.2101cafc.js create mode 100644 priv/static/adminfe/static/js/chunk-e660.2101cafc.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-e660.feca27c4.js delete mode 100644 priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-f364.1122502b.js delete mode 100644 priv/static/adminfe/static/js/chunk-f364.1122502b.js.map create mode 100644 priv/static/adminfe/static/js/chunk-f364.f22b0eee.js create mode 100644 priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-f625.904137fd.js delete mode 100644 priv/static/adminfe/static/js/chunk-f625.904137fd.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-libs.32ea9181.js delete mode 100644 priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map create mode 100644 priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js create mode 100644 priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js.map create mode 100644 priv/static/adminfe/static/js/runtime.52fd11cf.js create mode 100644 priv/static/adminfe/static/js/runtime.52fd11cf.js.map delete mode 100644 priv/static/adminfe/static/js/runtime.ba96836e.js delete mode 100644 priv/static/adminfe/static/js/runtime.ba96836e.js.map diff --git a/priv/static/adminfe/chunk-03c5.3368e00c.css b/priv/static/adminfe/chunk-03c5.3368e00c.css new file mode 100644 index 000000000..863f6f4f4 Binary files /dev/null and b/priv/static/adminfe/chunk-03c5.3368e00c.css differ diff --git a/priv/static/adminfe/chunk-03c5.e6a0e2d0.css b/priv/static/adminfe/chunk-03c5.e6a0e2d0.css deleted file mode 100644 index 863f6f4f4..000000000 Binary files a/priv/static/adminfe/chunk-03c5.e6a0e2d0.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-0492.15b0611f.css b/priv/static/adminfe/chunk-0492.15b0611f.css deleted file mode 100644 index 13537842a..000000000 Binary files a/priv/static/adminfe/chunk-0492.15b0611f.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-04b0.7e25cd78.css b/priv/static/adminfe/chunk-04b0.7e25cd78.css deleted file mode 100644 index 8dfdc0dcf..000000000 Binary files a/priv/static/adminfe/chunk-04b0.7e25cd78.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-0537.76929cff.css b/priv/static/adminfe/chunk-0537.76929cff.css new file mode 100644 index 000000000..5fcb223d8 Binary files /dev/null and b/priv/static/adminfe/chunk-0537.76929cff.css differ diff --git a/priv/static/adminfe/chunk-0537.cd83e5d6.css b/priv/static/adminfe/chunk-0537.cd83e5d6.css deleted file mode 100644 index 5fcb223d8..000000000 Binary files a/priv/static/adminfe/chunk-0537.cd83e5d6.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-1944.731ba892.css b/priv/static/adminfe/chunk-1944.731ba892.css deleted file mode 100644 index 6392d8e75..000000000 Binary files a/priv/static/adminfe/chunk-1944.731ba892.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-1e1e.5980e665.css b/priv/static/adminfe/chunk-1e1e.5980e665.css new file mode 100644 index 000000000..1b3a9fcab Binary files /dev/null and b/priv/static/adminfe/chunk-1e1e.5980e665.css differ diff --git a/priv/static/adminfe/chunk-35b1.949db050.css b/priv/static/adminfe/chunk-35b1.949db050.css new file mode 100644 index 000000000..6392d8e75 Binary files /dev/null and b/priv/static/adminfe/chunk-35b1.949db050.css differ diff --git a/priv/static/adminfe/chunk-4770.20caaae1.css b/priv/static/adminfe/chunk-4770.20caaae1.css new file mode 100644 index 000000000..6f2331666 Binary files /dev/null and b/priv/static/adminfe/chunk-4770.20caaae1.css differ diff --git a/priv/static/adminfe/chunk-50ba.6e4bf9f4.css b/priv/static/adminfe/chunk-50ba.6e4bf9f4.css new file mode 100644 index 000000000..db662fad6 Binary files /dev/null and b/priv/static/adminfe/chunk-50ba.6e4bf9f4.css differ diff --git a/priv/static/adminfe/chunk-606c.7c5b0a08.css b/priv/static/adminfe/chunk-606c.7c5b0a08.css new file mode 100644 index 000000000..8dfdc0dcf Binary files /dev/null and b/priv/static/adminfe/chunk-606c.7c5b0a08.css differ diff --git a/priv/static/adminfe/chunk-68ea9.8331e95e.css b/priv/static/adminfe/chunk-68ea9.8331e95e.css deleted file mode 100644 index 30bf7de23..000000000 Binary files a/priv/static/adminfe/chunk-68ea9.8331e95e.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-68ea9.892994aa.css b/priv/static/adminfe/chunk-68ea9.892994aa.css new file mode 100644 index 000000000..30bf7de23 Binary files /dev/null and b/priv/static/adminfe/chunk-68ea9.892994aa.css differ diff --git a/priv/static/adminfe/chunk-6e81.559b76f9.css b/priv/static/adminfe/chunk-6e81.559b76f9.css deleted file mode 100644 index da819ca09..000000000 Binary files a/priv/static/adminfe/chunk-6e81.559b76f9.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-6e81.687d5046.css b/priv/static/adminfe/chunk-6e81.687d5046.css new file mode 100644 index 000000000..da819ca09 Binary files /dev/null and b/priv/static/adminfe/chunk-6e81.687d5046.css differ diff --git a/priv/static/adminfe/chunk-7041.c5f6eab7.css b/priv/static/adminfe/chunk-7041.c5f6eab7.css new file mode 100644 index 000000000..e5024d666 Binary files /dev/null and b/priv/static/adminfe/chunk-7041.c5f6eab7.css differ diff --git a/priv/static/adminfe/chunk-7968.283bc086.css b/priv/static/adminfe/chunk-7968.283bc086.css deleted file mode 100644 index 5d9863d3a..000000000 Binary files a/priv/static/adminfe/chunk-7968.283bc086.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-7968.613084d0.css b/priv/static/adminfe/chunk-7968.613084d0.css new file mode 100644 index 000000000..5794e0a91 Binary files /dev/null and b/priv/static/adminfe/chunk-7968.613084d0.css differ diff --git a/priv/static/adminfe/chunk-8fbb.dd321643.css b/priv/static/adminfe/chunk-8fbb.dd321643.css deleted file mode 100644 index f50d974bd..000000000 Binary files a/priv/static/adminfe/chunk-8fbb.dd321643.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-ad1e.1a3c5339.css b/priv/static/adminfe/chunk-ad1e.1a3c5339.css deleted file mode 100644 index e5024d666..000000000 Binary files a/priv/static/adminfe/chunk-ad1e.1a3c5339.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-e660.62c077ac.css b/priv/static/adminfe/chunk-e660.62c077ac.css new file mode 100644 index 000000000..c0074e6f7 Binary files /dev/null and b/priv/static/adminfe/chunk-e660.62c077ac.css differ diff --git a/priv/static/adminfe/chunk-e660.9e75af5b.css b/priv/static/adminfe/chunk-e660.9e75af5b.css deleted file mode 100644 index c0074e6f7..000000000 Binary files a/priv/static/adminfe/chunk-e660.9e75af5b.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-f364.4fd16c53.css b/priv/static/adminfe/chunk-f364.4fd16c53.css new file mode 100644 index 000000000..abea7d536 Binary files /dev/null and b/priv/static/adminfe/chunk-f364.4fd16c53.css differ diff --git a/priv/static/adminfe/chunk-f364.6b5f3f0d.css b/priv/static/adminfe/chunk-f364.6b5f3f0d.css deleted file mode 100644 index ec665da84..000000000 Binary files a/priv/static/adminfe/chunk-f364.6b5f3f0d.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-f625.bcd0ea3b.css b/priv/static/adminfe/chunk-f625.bcd0ea3b.css deleted file mode 100644 index ac26ef0f5..000000000 Binary files a/priv/static/adminfe/chunk-f625.bcd0ea3b.css and /dev/null differ diff --git a/priv/static/adminfe/index.html b/priv/static/adminfe/index.html index e6af40e97..693b13e41 100644 --- a/priv/static/adminfe/index.html +++ b/priv/static/adminfe/index.html @@ -1 +1 @@ -Admin FE
\ No newline at end of file +Admin FE
\ No newline at end of file diff --git a/priv/static/adminfe/static/js/app.3e54b198.js b/priv/static/adminfe/static/js/app.3e54b198.js new file mode 100644 index 000000000..1bd1760ec Binary files /dev/null and b/priv/static/adminfe/static/js/app.3e54b198.js differ diff --git a/priv/static/adminfe/static/js/app.3e54b198.js.map b/priv/static/adminfe/static/js/app.3e54b198.js.map new file mode 100644 index 000000000..4c682a65c Binary files /dev/null and b/priv/static/adminfe/static/js/app.3e54b198.js.map differ diff --git a/priv/static/adminfe/static/js/app.c67f9a2f.js b/priv/static/adminfe/static/js/app.c67f9a2f.js deleted file mode 100644 index 65f9d4a29..000000000 Binary files a/priv/static/adminfe/static/js/app.c67f9a2f.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/app.c67f9a2f.js.map b/priv/static/adminfe/static/js/app.c67f9a2f.js.map deleted file mode 100644 index 41b4375aa..000000000 Binary files a/priv/static/adminfe/static/js/app.c67f9a2f.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js b/priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js new file mode 100644 index 000000000..94dfce1a8 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js differ diff --git a/priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js.map b/priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js.map new file mode 100644 index 000000000..acf1ba219 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-03c5.1b0ab243.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js b/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js deleted file mode 100644 index a89c65572..000000000 Binary files a/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map b/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map deleted file mode 100644 index 963ff6dee..000000000 Binary files a/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js b/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js deleted file mode 100644 index 243ecde70..000000000 Binary files a/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map b/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map deleted file mode 100644 index f5e0d9ebc..000000000 Binary files a/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js b/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js deleted file mode 100644 index 9d0352814..000000000 Binary files a/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map b/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map deleted file mode 100644 index a9bee3721..000000000 Binary files a/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-0537.74db16b0.js b/priv/static/adminfe/static/js/chunk-0537.74db16b0.js deleted file mode 100644 index 35231e562..000000000 Binary files a/priv/static/adminfe/static/js/chunk-0537.74db16b0.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map b/priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map deleted file mode 100644 index fa87bd76d..000000000 Binary files a/priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-0537.d0eef370.js b/priv/static/adminfe/static/js/chunk-0537.d0eef370.js new file mode 100644 index 000000000..f1b73a18a Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-0537.d0eef370.js differ diff --git a/priv/static/adminfe/static/js/chunk-0537.d0eef370.js.map b/priv/static/adminfe/static/js/chunk-0537.d0eef370.js.map new file mode 100644 index 000000000..e0a2f4d21 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-0537.d0eef370.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js b/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js deleted file mode 100644 index 87590c6ce..000000000 Binary files a/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map b/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map deleted file mode 100644 index 23229293e..000000000 Binary files a/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js b/priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js new file mode 100644 index 000000000..65d0aa926 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js differ diff --git a/priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js.map b/priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js.map new file mode 100644 index 000000000..a0b5ca3be Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-1e1e.37f6f555.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js b/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js new file mode 100644 index 000000000..525814336 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map b/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map new file mode 100644 index 000000000..92b6cece6 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-4770.1c1fff97.js b/priv/static/adminfe/static/js/chunk-4770.1c1fff97.js new file mode 100644 index 000000000..706ede69e Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-4770.1c1fff97.js differ diff --git a/priv/static/adminfe/static/js/chunk-4770.1c1fff97.js.map b/priv/static/adminfe/static/js/chunk-4770.1c1fff97.js.map new file mode 100644 index 000000000..f1303900d Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-4770.1c1fff97.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js b/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js new file mode 100644 index 000000000..34fa95e8b Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js differ diff --git a/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map b/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map new file mode 100644 index 000000000..909103765 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js b/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js new file mode 100644 index 000000000..3bd1f7001 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js differ diff --git a/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map b/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map new file mode 100644 index 000000000..48434d04e Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js b/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js deleted file mode 100644 index 60056454d..000000000 Binary files a/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map b/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map deleted file mode 100644 index 9e26519c3..000000000 Binary files a/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js b/priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js new file mode 100644 index 000000000..b11c19485 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js differ diff --git a/priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js.map b/priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js.map new file mode 100644 index 000000000..8779a5e95 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-68ea9.5a11341a.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js b/priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js new file mode 100644 index 000000000..6fd67c44f Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js differ diff --git a/priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js.map b/priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js.map new file mode 100644 index 000000000..931f7521e Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-6e81.6c4f2ce1.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-6e81.afade883.js b/priv/static/adminfe/static/js/chunk-6e81.afade883.js deleted file mode 100644 index 3b5dd6c5c..000000000 Binary files a/priv/static/adminfe/static/js/chunk-6e81.afade883.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-6e81.afade883.js.map b/priv/static/adminfe/static/js/chunk-6e81.afade883.js.map deleted file mode 100644 index a0f7fca19..000000000 Binary files a/priv/static/adminfe/static/js/chunk-6e81.afade883.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7041.9658c334.js b/priv/static/adminfe/static/js/chunk-7041.9658c334.js new file mode 100644 index 000000000..837b3a897 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7041.9658c334.js differ diff --git a/priv/static/adminfe/static/js/chunk-7041.9658c334.js.map b/priv/static/adminfe/static/js/chunk-7041.9658c334.js.map new file mode 100644 index 000000000..c02d84217 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7041.9658c334.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-7968.d6317b83.js b/priv/static/adminfe/static/js/chunk-7968.d6317b83.js new file mode 100644 index 000000000..cb6371cfe Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7968.d6317b83.js differ diff --git a/priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map b/priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map new file mode 100644 index 000000000..455fe8cb4 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-7968.f51e3292.js b/priv/static/adminfe/static/js/chunk-7968.f51e3292.js deleted file mode 100644 index dc981706f..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7968.f51e3292.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map b/priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map deleted file mode 100644 index c2f0726b7..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js b/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js deleted file mode 100644 index 74ffe9194..000000000 Binary files a/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map b/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map deleted file mode 100644 index b3c3b5fe8..000000000 Binary files a/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js b/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js deleted file mode 100644 index 82ddd4df2..000000000 Binary files a/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map b/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map deleted file mode 100644 index d74c2498f..000000000 Binary files a/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-e660.2101cafc.js b/priv/static/adminfe/static/js/chunk-e660.2101cafc.js new file mode 100644 index 000000000..20ecbb5a4 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-e660.2101cafc.js differ diff --git a/priv/static/adminfe/static/js/chunk-e660.2101cafc.js.map b/priv/static/adminfe/static/js/chunk-e660.2101cafc.js.map new file mode 100644 index 000000000..2ff5149ad Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-e660.2101cafc.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-e660.feca27c4.js b/priv/static/adminfe/static/js/chunk-e660.feca27c4.js deleted file mode 100644 index 5659d263e..000000000 Binary files a/priv/static/adminfe/static/js/chunk-e660.feca27c4.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map b/priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map deleted file mode 100644 index cfc2e08af..000000000 Binary files a/priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-f364.1122502b.js b/priv/static/adminfe/static/js/chunk-f364.1122502b.js deleted file mode 100644 index facad2ed5..000000000 Binary files a/priv/static/adminfe/static/js/chunk-f364.1122502b.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-f364.1122502b.js.map b/priv/static/adminfe/static/js/chunk-f364.1122502b.js.map deleted file mode 100644 index f89dabe30..000000000 Binary files a/priv/static/adminfe/static/js/chunk-f364.1122502b.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js b/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js new file mode 100644 index 000000000..fb1546f1f Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js differ diff --git a/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map b/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map new file mode 100644 index 000000000..79292c5d5 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-f625.904137fd.js b/priv/static/adminfe/static/js/chunk-f625.904137fd.js deleted file mode 100644 index 053590b28..000000000 Binary files a/priv/static/adminfe/static/js/chunk-f625.904137fd.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-f625.904137fd.js.map b/priv/static/adminfe/static/js/chunk-f625.904137fd.js.map deleted file mode 100644 index 59c1c274e..000000000 Binary files a/priv/static/adminfe/static/js/chunk-f625.904137fd.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-libs.32ea9181.js b/priv/static/adminfe/static/js/chunk-libs.32ea9181.js deleted file mode 100644 index 29cfb2b1d..000000000 Binary files a/priv/static/adminfe/static/js/chunk-libs.32ea9181.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map b/priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map deleted file mode 100644 index c80cf9acc..000000000 Binary files a/priv/static/adminfe/static/js/chunk-libs.32ea9181.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js b/priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js new file mode 100644 index 000000000..a496b679c Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js differ diff --git a/priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js.map b/priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js.map new file mode 100644 index 000000000..3b2db293f Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-libs.5ca2c8e8.js.map differ diff --git a/priv/static/adminfe/static/js/runtime.52fd11cf.js b/priv/static/adminfe/static/js/runtime.52fd11cf.js new file mode 100644 index 000000000..6be53974a Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.52fd11cf.js differ diff --git a/priv/static/adminfe/static/js/runtime.52fd11cf.js.map b/priv/static/adminfe/static/js/runtime.52fd11cf.js.map new file mode 100644 index 000000000..56adfca2a Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.52fd11cf.js.map differ diff --git a/priv/static/adminfe/static/js/runtime.ba96836e.js b/priv/static/adminfe/static/js/runtime.ba96836e.js deleted file mode 100644 index 245c7fe20..000000000 Binary files a/priv/static/adminfe/static/js/runtime.ba96836e.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.ba96836e.js.map b/priv/static/adminfe/static/js/runtime.ba96836e.js.map deleted file mode 100644 index f3c5a82af..000000000 Binary files a/priv/static/adminfe/static/js/runtime.ba96836e.js.map and /dev/null differ -- cgit v1.2.3 From 096e61fe935ee76c2f6b4c8154f129bad9cf5d18 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 11:30:06 -0600 Subject: Keep *Breaking* at the top --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b24bf07..3911f9b7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed +- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` - Polls now always return a `voters_count`, even if they are single-choice. - Admin Emails: The ap id is used as the user link in emails now. - Improved registration workflow for email confirmation and account approval modes. -- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries. - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Admin API: Reports now ordered by newest -- cgit v1.2.3 From a9f9fb002cde14449995079e55fa5700a5573344 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 11:31:07 -0600 Subject: Document new is_confirmed attribute --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3911f9b7c..d3b792a7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` +- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed` - Polls now always return a `voters_count`, even if they are single-choice. - Admin Emails: The ap id is used as the user link in emails now. - Improved registration workflow for email confirmation and account approval modes. -- cgit v1.2.3 From ab32ede102a93cef753eea306b3380a7f7c4fc85 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 12:07:37 -0600 Subject: Document new is_approved attribute --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff37d3021..50d5f80e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` - **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed` +- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved` - Polls now always return a `voters_count`, even if they are single-choice. - Admin Emails: The ap id is used as the user link in emails now. - Improved registration workflow for email confirmation and account approval modes. -- cgit v1.2.3 From d49387e9d20ee92bb8395eb28c1f563ff0d720fb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 18 Jan 2021 13:44:59 -0600 Subject: Update AdminFE: admin-fe@27db721e3969d9d017a70b9e16dc262d4f31202f --- priv/static/adminfe/chunk-1e46.0411a9b2.css | Bin 0 -> 692 bytes priv/static/adminfe/chunk-50ba.6e4bf9f4.css | Bin 692 -> 0 bytes priv/static/adminfe/index.html | 2 +- priv/static/adminfe/static/js/app.01bfc983.js | Bin 0 -> 258232 bytes priv/static/adminfe/static/js/app.01bfc983.js.map | Bin 0 -> 529102 bytes priv/static/adminfe/static/js/app.3e54b198.js | Bin 258237 -> 0 bytes priv/static/adminfe/static/js/app.3e54b198.js.map | Bin 529115 -> 0 bytes priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js | Bin 0 -> 15856 bytes .../adminfe/static/js/chunk-1e46.7c2ee531.js.map | Bin 0 -> 41883 bytes priv/static/adminfe/static/js/chunk-35b1.51b3140e.js | Bin 29851 -> 0 bytes .../adminfe/static/js/chunk-35b1.51b3140e.js.map | Bin 99571 -> 0 bytes priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js | Bin 0 -> 29833 bytes .../adminfe/static/js/chunk-35b1.ddb9524c.js.map | Bin 0 -> 99532 bytes priv/static/adminfe/static/js/chunk-50ba.afb924bf.js | Bin 15862 -> 0 bytes .../adminfe/static/js/chunk-50ba.afb924bf.js.map | Bin 41893 -> 0 bytes priv/static/adminfe/static/js/chunk-606c.35588dea.js | Bin 0 -> 26525 bytes .../adminfe/static/js/chunk-606c.35588dea.js.map | Bin 0 -> 101577 bytes priv/static/adminfe/static/js/chunk-606c.f5585a4f.js | Bin 26548 -> 0 bytes .../adminfe/static/js/chunk-606c.f5585a4f.js.map | Bin 101627 -> 0 bytes priv/static/adminfe/static/js/chunk-7041.1495e01c.js | Bin 0 -> 20256 bytes .../adminfe/static/js/chunk-7041.1495e01c.js.map | Bin 0 -> 67885 bytes priv/static/adminfe/static/js/chunk-7041.9658c334.js | Bin 20264 -> 0 bytes .../adminfe/static/js/chunk-7041.9658c334.js.map | Bin 67908 -> 0 bytes priv/static/adminfe/static/js/runtime.52fd11cf.js | Bin 4469 -> 0 bytes priv/static/adminfe/static/js/runtime.52fd11cf.js.map | Bin 17827 -> 0 bytes priv/static/adminfe/static/js/runtime.5c1034c4.js | Bin 0 -> 4469 bytes priv/static/adminfe/static/js/runtime.5c1034c4.js.map | Bin 0 -> 17827 bytes 27 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 priv/static/adminfe/chunk-1e46.0411a9b2.css delete mode 100644 priv/static/adminfe/chunk-50ba.6e4bf9f4.css create mode 100644 priv/static/adminfe/static/js/app.01bfc983.js create mode 100644 priv/static/adminfe/static/js/app.01bfc983.js.map delete mode 100644 priv/static/adminfe/static/js/app.3e54b198.js delete mode 100644 priv/static/adminfe/static/js/app.3e54b198.js.map create mode 100644 priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js create mode 100644 priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-35b1.51b3140e.js delete mode 100644 priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map create mode 100644 priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js create mode 100644 priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-50ba.afb924bf.js delete mode 100644 priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map create mode 100644 priv/static/adminfe/static/js/chunk-606c.35588dea.js create mode 100644 priv/static/adminfe/static/js/chunk-606c.35588dea.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-606c.f5585a4f.js delete mode 100644 priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map create mode 100644 priv/static/adminfe/static/js/chunk-7041.1495e01c.js create mode 100644 priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-7041.9658c334.js delete mode 100644 priv/static/adminfe/static/js/chunk-7041.9658c334.js.map delete mode 100644 priv/static/adminfe/static/js/runtime.52fd11cf.js delete mode 100644 priv/static/adminfe/static/js/runtime.52fd11cf.js.map create mode 100644 priv/static/adminfe/static/js/runtime.5c1034c4.js create mode 100644 priv/static/adminfe/static/js/runtime.5c1034c4.js.map diff --git a/priv/static/adminfe/chunk-1e46.0411a9b2.css b/priv/static/adminfe/chunk-1e46.0411a9b2.css new file mode 100644 index 000000000..e511ebfe2 Binary files /dev/null and b/priv/static/adminfe/chunk-1e46.0411a9b2.css differ diff --git a/priv/static/adminfe/chunk-50ba.6e4bf9f4.css b/priv/static/adminfe/chunk-50ba.6e4bf9f4.css deleted file mode 100644 index db662fad6..000000000 Binary files a/priv/static/adminfe/chunk-50ba.6e4bf9f4.css and /dev/null differ diff --git a/priv/static/adminfe/index.html b/priv/static/adminfe/index.html index 693b13e41..9f6674b5c 100644 --- a/priv/static/adminfe/index.html +++ b/priv/static/adminfe/index.html @@ -1 +1 @@ -Admin FE
\ No newline at end of file +Admin FE
\ No newline at end of file diff --git a/priv/static/adminfe/static/js/app.01bfc983.js b/priv/static/adminfe/static/js/app.01bfc983.js new file mode 100644 index 000000000..b55da9cda Binary files /dev/null and b/priv/static/adminfe/static/js/app.01bfc983.js differ diff --git a/priv/static/adminfe/static/js/app.01bfc983.js.map b/priv/static/adminfe/static/js/app.01bfc983.js.map new file mode 100644 index 000000000..19960bd78 Binary files /dev/null and b/priv/static/adminfe/static/js/app.01bfc983.js.map differ diff --git a/priv/static/adminfe/static/js/app.3e54b198.js b/priv/static/adminfe/static/js/app.3e54b198.js deleted file mode 100644 index 1bd1760ec..000000000 Binary files a/priv/static/adminfe/static/js/app.3e54b198.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/app.3e54b198.js.map b/priv/static/adminfe/static/js/app.3e54b198.js.map deleted file mode 100644 index 4c682a65c..000000000 Binary files a/priv/static/adminfe/static/js/app.3e54b198.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js b/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js new file mode 100644 index 000000000..bdd6fde97 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js differ diff --git a/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map b/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map new file mode 100644 index 000000000..305fa838d Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js b/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js deleted file mode 100644 index 525814336..000000000 Binary files a/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map b/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map deleted file mode 100644 index 92b6cece6..000000000 Binary files a/priv/static/adminfe/static/js/chunk-35b1.51b3140e.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js b/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js new file mode 100644 index 000000000..f31565f8f Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map b/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map new file mode 100644 index 000000000..7a2659f62 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js b/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js deleted file mode 100644 index 34fa95e8b..000000000 Binary files a/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map b/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map deleted file mode 100644 index 909103765..000000000 Binary files a/priv/static/adminfe/static/js/chunk-50ba.afb924bf.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-606c.35588dea.js b/priv/static/adminfe/static/js/chunk-606c.35588dea.js new file mode 100644 index 000000000..4cffaa5ce Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-606c.35588dea.js differ diff --git a/priv/static/adminfe/static/js/chunk-606c.35588dea.js.map b/priv/static/adminfe/static/js/chunk-606c.35588dea.js.map new file mode 100644 index 000000000..603c0fce4 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-606c.35588dea.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js b/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js deleted file mode 100644 index 3bd1f7001..000000000 Binary files a/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map b/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map deleted file mode 100644 index 48434d04e..000000000 Binary files a/priv/static/adminfe/static/js/chunk-606c.f5585a4f.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7041.1495e01c.js b/priv/static/adminfe/static/js/chunk-7041.1495e01c.js new file mode 100644 index 000000000..e68346c2b Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7041.1495e01c.js differ diff --git a/priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map b/priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map new file mode 100644 index 000000000..9609e9b1b Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-7041.9658c334.js b/priv/static/adminfe/static/js/chunk-7041.9658c334.js deleted file mode 100644 index 837b3a897..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7041.9658c334.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7041.9658c334.js.map b/priv/static/adminfe/static/js/chunk-7041.9658c334.js.map deleted file mode 100644 index c02d84217..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7041.9658c334.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.52fd11cf.js b/priv/static/adminfe/static/js/runtime.52fd11cf.js deleted file mode 100644 index 6be53974a..000000000 Binary files a/priv/static/adminfe/static/js/runtime.52fd11cf.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.52fd11cf.js.map b/priv/static/adminfe/static/js/runtime.52fd11cf.js.map deleted file mode 100644 index 56adfca2a..000000000 Binary files a/priv/static/adminfe/static/js/runtime.52fd11cf.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.5c1034c4.js b/priv/static/adminfe/static/js/runtime.5c1034c4.js new file mode 100644 index 000000000..7d2f6d83b Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.5c1034c4.js differ diff --git a/priv/static/adminfe/static/js/runtime.5c1034c4.js.map b/priv/static/adminfe/static/js/runtime.5c1034c4.js.map new file mode 100644 index 000000000..723da6ee7 Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.5c1034c4.js.map differ -- cgit v1.2.3 From ca114df5234c27d6668a2a993d141c637df8f37d Mon Sep 17 00:00:00 2001 From: João Rodrigues Date: Mon, 18 Jan 2021 17:19:01 +0000 Subject: Added translation using Weblate (Portuguese (Portugal)) --- priv/gettext/pt_PT/LC_MESSAGES/errors.po | 584 +++++++++++++++++++++++++++++++ 1 file changed, 584 insertions(+) create mode 100644 priv/gettext/pt_PT/LC_MESSAGES/errors.po diff --git a/priv/gettext/pt_PT/LC_MESSAGES/errors.po b/priv/gettext/pt_PT/LC_MESSAGES/errors.po new file mode 100644 index 000000000..4e66a5aa1 --- /dev/null +++ b/priv/gettext/pt_PT/LC_MESSAGES/errors.po @@ -0,0 +1,584 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-01-18 17:19+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: pt_PT\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Translate Toolkit 2.5.1\n" + +## This file is a PO Template file. +## +## `msgid`s here are often extracted from source code. +## Add new translations manually only if they're dynamic +## translations that can't be statically extracted. +## +## Run `mix gettext.extract` to bring this file up to +## date. Leave `msgstr`s empty as changing them here as no +## effect: edit them in PO (`.po`) files instead. +## From Ecto.Changeset.cast/4 +msgid "can't be blank" +msgstr "" + +## From Ecto.Changeset.unique_constraint/3 +msgid "has already been taken" +msgstr "" + +## From Ecto.Changeset.put_change/3 +msgid "is invalid" +msgstr "" + +## From Ecto.Changeset.validate_format/3 +msgid "has invalid format" +msgstr "" + +## From Ecto.Changeset.validate_subset/3 +msgid "has an invalid entry" +msgstr "" + +## From Ecto.Changeset.validate_exclusion/3 +msgid "is reserved" +msgstr "" + +## From Ecto.Changeset.validate_confirmation/3 +msgid "does not match confirmation" +msgstr "" + +## From Ecto.Changeset.no_assoc_constraint/3 +msgid "is still associated with this entry" +msgstr "" + +msgid "are still associated with this entry" +msgstr "" + +## From Ecto.Changeset.validate_length/3 +msgid "should be %{count} character(s)" +msgid_plural "should be %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have %{count} item(s)" +msgid_plural "should have %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at least %{count} character(s)" +msgid_plural "should be at least %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at least %{count} item(s)" +msgid_plural "should have at least %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should be at most %{count} character(s)" +msgid_plural "should be at most %{count} character(s)" +msgstr[0] "" +msgstr[1] "" + +msgid "should have at most %{count} item(s)" +msgid_plural "should have at most %{count} item(s)" +msgstr[0] "" +msgstr[1] "" + +## From Ecto.Changeset.validate_number/3 +msgid "must be less than %{number}" +msgstr "" + +msgid "must be greater than %{number}" +msgstr "" + +msgid "must be less than or equal to %{number}" +msgstr "" + +msgid "must be greater than or equal to %{number}" +msgstr "" + +msgid "must be equal to %{number}" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:505 +#, elixir-format +msgid "Account not found" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:339 +#, elixir-format +msgid "Already voted" +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:359 +#, elixir-format +msgid "Bad request" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:426 +#, elixir-format +msgid "Can't delete object" +msgstr "" + +#: lib/pleroma/web/controller_helper.ex:105 +#: lib/pleroma/web/controller_helper.ex:111 +#, elixir-format +msgid "Can't display this activity" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:285 +#, elixir-format +msgid "Can't find user" +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/account_controller.ex:61 +#, elixir-format +msgid "Can't get favorites" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:438 +#, elixir-format +msgid "Can't like object" +msgstr "" + +#: lib/pleroma/web/common_api/utils.ex:563 +#, elixir-format +msgid "Cannot post an empty status without attachments" +msgstr "" + +#: lib/pleroma/web/common_api/utils.ex:511 +#, elixir-format +msgid "Comment must be up to %{max_size} characters" +msgstr "" + +#: lib/pleroma/config/config_db.ex:191 +#, elixir-format +msgid "Config with params %{params} not found" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:181 +#: lib/pleroma/web/common_api/common_api.ex:185 +#, elixir-format +msgid "Could not delete" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:231 +#, elixir-format +msgid "Could not favorite" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:453 +#, elixir-format +msgid "Could not pin" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:278 +#, elixir-format +msgid "Could not unfavorite" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:463 +#, elixir-format +msgid "Could not unpin" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:216 +#, elixir-format +msgid "Could not unrepeat" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:512 +#: lib/pleroma/web/common_api/common_api.ex:521 +#, elixir-format +msgid "Could not update state" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:207 +#, elixir-format +msgid "Error." +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:106 +#, elixir-format +msgid "Invalid CAPTCHA" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:116 +#: lib/pleroma/web/oauth/oauth_controller.ex:568 +#, elixir-format +msgid "Invalid credentials" +msgstr "" + +#: lib/pleroma/plugs/ensure_authenticated_plug.ex:38 +#, elixir-format +msgid "Invalid credentials." +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:355 +#, elixir-format +msgid "Invalid indices" +msgstr "" + +#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:29 +#, elixir-format +msgid "Invalid parameters" +msgstr "" + +#: lib/pleroma/web/common_api/utils.ex:414 +#, elixir-format +msgid "Invalid password." +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:220 +#, elixir-format +msgid "Invalid request" +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:109 +#, elixir-format +msgid "Kocaptcha service unavailable" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:112 +#, elixir-format +msgid "Missing parameters" +msgstr "" + +#: lib/pleroma/web/common_api/utils.ex:547 +#, elixir-format +msgid "No such conversation" +msgstr "" + +#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:388 +#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:414 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:456 +#, elixir-format +msgid "No such permission_group" +msgstr "" + +#: lib/pleroma/plugs/uploaded_media.ex:84 +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:486 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:11 +#: lib/pleroma/web/feed/user_controller.ex:71 lib/pleroma/web/ostatus/ostatus_controller.ex:143 +#, elixir-format +msgid "Not found" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:331 +#, elixir-format +msgid "Poll's author can't vote" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:20 +#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:37 lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:49 +#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:50 lib/pleroma/web/mastodon_api/controllers/status_controller.ex:306 +#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:71 +#, elixir-format +msgid "Record not found" +msgstr "" + +#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:35 +#: lib/pleroma/web/feed/user_controller.ex:77 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:36 +#: lib/pleroma/web/ostatus/ostatus_controller.ex:149 +#, elixir-format +msgid "Something went wrong" +msgstr "" + +#: lib/pleroma/web/common_api/activity_draft.ex:107 +#, elixir-format +msgid "The message visibility must be direct" +msgstr "" + +#: lib/pleroma/web/common_api/utils.ex:573 +#, elixir-format +msgid "The status is over the character limit" +msgstr "" + +#: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31 +#, elixir-format +msgid "This resource requires authentication." +msgstr "" + +#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206 +#, elixir-format +msgid "Throttled" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:356 +#, elixir-format +msgid "Too many choices" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443 +#, elixir-format +msgid "Unhandled activity type" +msgstr "" + +#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485 +#, elixir-format +msgid "You can't revoke your own admin status." +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:221 +#: lib/pleroma/web/oauth/oauth_controller.ex:308 +#, elixir-format +msgid "Your account is currently disabled" +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:183 +#: lib/pleroma/web/oauth/oauth_controller.ex:331 +#, elixir-format +msgid "Your login is missing a confirmed e-mail address" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390 +#, elixir-format +msgid "can't read inbox of %{nickname} as %{as_nickname}" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:473 +#, elixir-format +msgid "can't update outbox of %{nickname} as %{as_nickname}" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:471 +#, elixir-format +msgid "conversation is already muted" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:314 +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:492 +#, elixir-format +msgid "error" +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32 +#, elixir-format +msgid "mascots can only be images" +msgstr "" + +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62 +#, elixir-format +msgid "not found" +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:394 +#, elixir-format +msgid "Bad OAuth request." +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:115 +#, elixir-format +msgid "CAPTCHA already used" +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:112 +#, elixir-format +msgid "CAPTCHA expired" +msgstr "" + +#: lib/pleroma/plugs/uploaded_media.ex:57 +#, elixir-format +msgid "Failed" +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:410 +#, elixir-format +msgid "Failed to authenticate: %{message}." +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:441 +#, elixir-format +msgid "Failed to set up user account." +msgstr "" + +#: lib/pleroma/plugs/oauth_scopes_plug.ex:38 +#, elixir-format +msgid "Insufficient permissions: %{permissions}." +msgstr "" + +#: lib/pleroma/plugs/uploaded_media.ex:104 +#, elixir-format +msgid "Internal Error" +msgstr "" + +#: lib/pleroma/web/oauth/fallback_controller.ex:22 +#: lib/pleroma/web/oauth/fallback_controller.ex:29 +#, elixir-format +msgid "Invalid Username/Password" +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:118 +#, elixir-format +msgid "Invalid answer data" +msgstr "" + +#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33 +#, elixir-format +msgid "Nodeinfo schema version not handled" +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:172 +#, elixir-format +msgid "This action is outside the authorized scopes" +msgstr "" + +#: lib/pleroma/web/oauth/fallback_controller.ex:14 +#, elixir-format +msgid "Unknown error, please check the details and try again." +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:119 +#: lib/pleroma/web/oauth/oauth_controller.ex:158 +#, elixir-format +msgid "Unlisted redirect_uri." +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:390 +#, elixir-format +msgid "Unsupported OAuth provider: %{provider}." +msgstr "" + +#: lib/pleroma/uploaders/uploader.ex:72 +#, elixir-format +msgid "Uploader callback timeout" +msgstr "" + +#: lib/pleroma/web/uploader_controller.ex:23 +#, elixir-format +msgid "bad request" +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:103 +#, elixir-format +msgid "CAPTCHA Error" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:290 +#, elixir-format +msgid "Could not add reaction emoji" +msgstr "" + +#: lib/pleroma/web/common_api/common_api.ex:301 +#, elixir-format +msgid "Could not remove reaction emoji" +msgstr "" + +#: lib/pleroma/web/twitter_api/twitter_api.ex:129 +#, elixir-format +msgid "Invalid CAPTCHA (Missing parameter: %{name})" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92 +#, elixir-format +msgid "List not found" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123 +#, elixir-format +msgid "Missing parameter: %{name}" +msgstr "" + +#: lib/pleroma/web/oauth/oauth_controller.ex:210 +#: lib/pleroma/web/oauth/oauth_controller.ex:321 +#, elixir-format +msgid "Password reset is required" +msgstr "" + +#: lib/pleroma/tests/auth_test_controller.ex:9 +#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:6 +#: lib/pleroma/web/admin_api/controllers/config_controller.ex:6 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:6 +#: lib/pleroma/web/admin_api/controllers/invite_controller.ex:6 lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex:6 +#: lib/pleroma/web/admin_api/controllers/oauth_app_controller.ex:6 lib/pleroma/web/admin_api/controllers/relay_controller.ex:6 +#: lib/pleroma/web/admin_api/controllers/report_controller.ex:6 lib/pleroma/web/admin_api/controllers/status_controller.ex:6 +#: lib/pleroma/web/controller_helper.ex:6 lib/pleroma/web/embed_controller.ex:6 +#: lib/pleroma/web/fallback_redirect_controller.ex:6 lib/pleroma/web/feed/tag_controller.ex:6 +#: lib/pleroma/web/feed/user_controller.ex:6 lib/pleroma/web/mailer/subscription_controller.ex:2 +#: lib/pleroma/web/masto_fe_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/account_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/app_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/auth_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/filter_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/instance_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/list_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/marker_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:14 +#: lib/pleroma/web/mastodon_api/controllers/media_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/notification_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/report_controller.ex:8 +#: lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/search_controller.ex:6 +#: lib/pleroma/web/mastodon_api/controllers/status_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:7 +#: lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:6 +#: lib/pleroma/web/media_proxy/media_proxy_controller.ex:6 lib/pleroma/web/mongooseim/mongoose_im_controller.ex:6 +#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:6 lib/pleroma/web/oauth/fallback_controller.ex:6 +#: lib/pleroma/web/oauth/mfa_controller.ex:10 lib/pleroma/web/oauth/oauth_controller.ex:6 +#: lib/pleroma/web/ostatus/ostatus_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/account_controller.ex:6 +#: lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:5 lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex:6 +#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:2 lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex:6 +#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/notification_controller.ex:6 +#: lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex:6 +#: lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex:7 lib/pleroma/web/static_fe/static_fe_controller.ex:6 +#: lib/pleroma/web/twitter_api/controllers/password_controller.ex:10 lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex:6 +#: lib/pleroma/web/twitter_api/controllers/util_controller.ex:6 lib/pleroma/web/twitter_api/twitter_api_controller.ex:6 +#: lib/pleroma/web/uploader_controller.ex:6 lib/pleroma/web/web_finger/web_finger_controller.ex:6 +#, elixir-format +msgid "Security violation: OAuth scopes check was neither handled nor explicitly skipped." +msgstr "" + +#: lib/pleroma/plugs/ensure_authenticated_plug.ex:28 +#, elixir-format +msgid "Two-factor authentication enabled, you must use a access token." +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210 +#, elixir-format +msgid "Unexpected error occurred while adding file to pack." +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138 +#, elixir-format +msgid "Unexpected error occurred while creating pack." +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278 +#, elixir-format +msgid "Unexpected error occurred while removing file from pack." +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250 +#, elixir-format +msgid "Unexpected error occurred while updating file in pack." +msgstr "" + +#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179 +#, elixir-format +msgid "Unexpected error occurred while updating pack metadata." +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61 +#, elixir-format +msgid "Web push subscription is disabled on this Pleroma instance" +msgstr "" + +#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:451 +#, elixir-format +msgid "You can't revoke your own admin/moderator status." +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126 +#, elixir-format +msgid "authorization required for timeline view" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24 +#, elixir-format +msgid "Access denied" +msgstr "" + +#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282 +#, elixir-format +msgid "This API requires an authenticated user" +msgstr "" + +#: lib/pleroma/plugs/user_is_admin_plug.ex:21 +#, elixir-format +msgid "User is not an admin." +msgstr "" -- cgit v1.2.3 From 8d1554f08b58ece96642be270f30a7944a906b19 Mon Sep 17 00:00:00 2001 From: João Rodrigues Date: Mon, 18 Jan 2021 17:19:16 +0000 Subject: Translated using Weblate (Portuguese (Portugal)) Currently translated at 100.0% (106 of 106 strings) Translation: Pleroma/Pleroma backend Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma/pt_PT/ --- priv/gettext/pt_PT/LC_MESSAGES/errors.po | 230 ++++++++++++++++--------------- 1 file changed, 120 insertions(+), 110 deletions(-) diff --git a/priv/gettext/pt_PT/LC_MESSAGES/errors.po b/priv/gettext/pt_PT/LC_MESSAGES/errors.po index 4e66a5aa1..16d8c971a 100644 --- a/priv/gettext/pt_PT/LC_MESSAGES/errors.po +++ b/priv/gettext/pt_PT/LC_MESSAGES/errors.po @@ -3,14 +3,16 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-18 17:19+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2021-01-18 17:54+0000\n" +"Last-Translator: João Rodrigues \n" +"Language-Team: Portuguese (Portugal) \n" "Language: pt_PT\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Translate Toolkit 2.5.1\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.0.4\n" ## This file is a PO Template file. ## @@ -23,252 +25,252 @@ msgstr "" ## effect: edit them in PO (`.po`) files instead. ## From Ecto.Changeset.cast/4 msgid "can't be blank" -msgstr "" +msgstr "não pode estar em branco" ## From Ecto.Changeset.unique_constraint/3 msgid "has already been taken" -msgstr "" +msgstr "já se encontra em utilização" ## From Ecto.Changeset.put_change/3 msgid "is invalid" -msgstr "" +msgstr "é inválido" ## From Ecto.Changeset.validate_format/3 msgid "has invalid format" -msgstr "" +msgstr "tem um formato inválido" ## From Ecto.Changeset.validate_subset/3 msgid "has an invalid entry" -msgstr "" +msgstr "tem uma entrada inválida" ## From Ecto.Changeset.validate_exclusion/3 msgid "is reserved" -msgstr "" +msgstr "é reservado" ## From Ecto.Changeset.validate_confirmation/3 msgid "does not match confirmation" -msgstr "" +msgstr "não corresponde à confirmação" ## From Ecto.Changeset.no_assoc_constraint/3 msgid "is still associated with this entry" -msgstr "" +msgstr "ainda se encontra associado a esta entrada" msgid "are still associated with this entry" -msgstr "" +msgstr "ainda está associado a esta entrada" ## From Ecto.Changeset.validate_length/3 msgid "should be %{count} character(s)" msgid_plural "should be %{count} character(s)" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "deve conter %{count} caracter" +msgstr[1] "deve conter %{count} caracteres" msgid "should have %{count} item(s)" msgid_plural "should have %{count} item(s)" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "deve ter %{count} item" +msgstr[1] "deve ter %{count} items" msgid "should be at least %{count} character(s)" msgid_plural "should be at least %{count} character(s)" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "deve ter pelo menos %{count} caracter" +msgstr[1] "deve ter pelo menos %{count} caracteres" msgid "should have at least %{count} item(s)" msgid_plural "should have at least %{count} item(s)" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "deve ter pelo menos %{count} item" +msgstr[1] "deve ter pelo menos %{count} items" msgid "should be at most %{count} character(s)" msgid_plural "should be at most %{count} character(s)" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "deve ter pelo menos %{count} caracter" +msgstr[1] "deve ter pelo menos %{count} caracteres" msgid "should have at most %{count} item(s)" msgid_plural "should have at most %{count} item(s)" -msgstr[0] "" -msgstr[1] "" +msgstr[0] "deve ter pelo menos %{count} item" +msgstr[1] "deve ter pelo menos %{count} items" ## From Ecto.Changeset.validate_number/3 msgid "must be less than %{number}" -msgstr "" +msgstr "deve ser menor que %{number}" msgid "must be greater than %{number}" -msgstr "" +msgstr "deve ser maior que %{number}" msgid "must be less than or equal to %{number}" -msgstr "" +msgstr "deve ser menor ou igual que %{number}" msgid "must be greater than or equal to %{number}" -msgstr "" +msgstr "deve ser maior ou igual que %{number}" msgid "must be equal to %{number}" -msgstr "" +msgstr "deve ser igual a %{number}" #: lib/pleroma/web/common_api/common_api.ex:505 #, elixir-format msgid "Account not found" -msgstr "" +msgstr "Conta não encontrada" #: lib/pleroma/web/common_api/common_api.ex:339 #, elixir-format msgid "Already voted" -msgstr "" +msgstr "Já votou" #: lib/pleroma/web/oauth/oauth_controller.ex:359 #, elixir-format msgid "Bad request" -msgstr "" +msgstr "Pedido inválido" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:426 #, elixir-format msgid "Can't delete object" -msgstr "" +msgstr "Não é possível apagar o objeto" #: lib/pleroma/web/controller_helper.ex:105 #: lib/pleroma/web/controller_helper.ex:111 #, elixir-format msgid "Can't display this activity" -msgstr "" +msgstr "Não é possível exibir esta atividade" #: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:285 #, elixir-format msgid "Can't find user" -msgstr "" +msgstr "Não foi possível encontrar o utilizador" #: lib/pleroma/web/pleroma_api/controllers/account_controller.ex:61 #, elixir-format msgid "Can't get favorites" -msgstr "" +msgstr "Não foi possível obter os favoritos" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:438 #, elixir-format msgid "Can't like object" -msgstr "" +msgstr "Não foi possível gostar do objeto" #: lib/pleroma/web/common_api/utils.ex:563 #, elixir-format msgid "Cannot post an empty status without attachments" -msgstr "" +msgstr "Não é possível publicar um estado vazio e sem ficheiro anexados" #: lib/pleroma/web/common_api/utils.ex:511 #, elixir-format msgid "Comment must be up to %{max_size} characters" -msgstr "" +msgstr "Comentários devem ter até %{max_size} caracteres" #: lib/pleroma/config/config_db.ex:191 #, elixir-format msgid "Config with params %{params} not found" -msgstr "" +msgstr "Configuração com parâmetros %{params} não encontrada" #: lib/pleroma/web/common_api/common_api.ex:181 #: lib/pleroma/web/common_api/common_api.ex:185 #, elixir-format msgid "Could not delete" -msgstr "" +msgstr "Não foi possível apagar" #: lib/pleroma/web/common_api/common_api.ex:231 #, elixir-format msgid "Could not favorite" -msgstr "" +msgstr "Não foi possível favoritar" #: lib/pleroma/web/common_api/common_api.ex:453 #, elixir-format msgid "Could not pin" -msgstr "" +msgstr "Não foi possível fixar" #: lib/pleroma/web/common_api/common_api.ex:278 #, elixir-format msgid "Could not unfavorite" -msgstr "" +msgstr "Não foi possível retirar favorito" #: lib/pleroma/web/common_api/common_api.ex:463 #, elixir-format msgid "Could not unpin" -msgstr "" +msgstr "Não foi possível desafixar" #: lib/pleroma/web/common_api/common_api.ex:216 #, elixir-format msgid "Could not unrepeat" -msgstr "" +msgstr "Não foi possível deixar de repetir" #: lib/pleroma/web/common_api/common_api.ex:512 #: lib/pleroma/web/common_api/common_api.ex:521 #, elixir-format msgid "Could not update state" -msgstr "" +msgstr "Não foi possível atualizar estado" #: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:207 #, elixir-format msgid "Error." -msgstr "" +msgstr "Erro." #: lib/pleroma/web/twitter_api/twitter_api.ex:106 #, elixir-format msgid "Invalid CAPTCHA" -msgstr "" +msgstr "CAPTCHA Inválido" #: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:116 #: lib/pleroma/web/oauth/oauth_controller.ex:568 #, elixir-format msgid "Invalid credentials" -msgstr "" +msgstr "Credenciais inválidas" #: lib/pleroma/plugs/ensure_authenticated_plug.ex:38 #, elixir-format msgid "Invalid credentials." -msgstr "" +msgstr "Credenciais inválidas." #: lib/pleroma/web/common_api/common_api.ex:355 #, elixir-format msgid "Invalid indices" -msgstr "" +msgstr "Índices inválidos" #: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:29 #, elixir-format msgid "Invalid parameters" -msgstr "" +msgstr "Parâmetros inválidos" #: lib/pleroma/web/common_api/utils.ex:414 #, elixir-format msgid "Invalid password." -msgstr "" +msgstr "Palavra-passe inválida." #: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:220 #, elixir-format msgid "Invalid request" -msgstr "" +msgstr "Pedido inválido" #: lib/pleroma/web/twitter_api/twitter_api.ex:109 #, elixir-format msgid "Kocaptcha service unavailable" -msgstr "" +msgstr "Serviço Kocaptcha indisponível" #: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:112 #, elixir-format msgid "Missing parameters" -msgstr "" +msgstr "Parâmetros em falta" #: lib/pleroma/web/common_api/utils.ex:547 #, elixir-format msgid "No such conversation" -msgstr "" +msgstr "Não existe tal conversação" #: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:388 #: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:414 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:456 #, elixir-format msgid "No such permission_group" -msgstr "" +msgstr "Não existe permission_group" #: lib/pleroma/plugs/uploaded_media.ex:84 #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:486 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:11 #: lib/pleroma/web/feed/user_controller.ex:71 lib/pleroma/web/ostatus/ostatus_controller.ex:143 #, elixir-format msgid "Not found" -msgstr "" +msgstr "Não encontrado" #: lib/pleroma/web/common_api/common_api.ex:331 #, elixir-format msgid "Poll's author can't vote" -msgstr "" +msgstr "O autor da sondagem não pode votar" #: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:20 #: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:37 lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:49 @@ -276,215 +278,218 @@ msgstr "" #: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:71 #, elixir-format msgid "Record not found" -msgstr "" +msgstr "Registo não encontrado" #: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:35 #: lib/pleroma/web/feed/user_controller.ex:77 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:36 #: lib/pleroma/web/ostatus/ostatus_controller.ex:149 #, elixir-format msgid "Something went wrong" -msgstr "" +msgstr "Algo ocorreu de errado" #: lib/pleroma/web/common_api/activity_draft.ex:107 #, elixir-format msgid "The message visibility must be direct" -msgstr "" +msgstr "A visibilidade da mensagem deve ser direta" #: lib/pleroma/web/common_api/utils.ex:573 #, elixir-format msgid "The status is over the character limit" -msgstr "" +msgstr "O estado está acima do limite de caracteres" #: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31 #, elixir-format msgid "This resource requires authentication." -msgstr "" +msgstr "Este recurso requer autenticação." #: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206 #, elixir-format msgid "Throttled" -msgstr "" +msgstr "Limitado" #: lib/pleroma/web/common_api/common_api.ex:356 #, elixir-format msgid "Too many choices" -msgstr "" +msgstr "Demasiadas opções" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443 #, elixir-format msgid "Unhandled activity type" -msgstr "" +msgstr "Tipo de atividade não controlada" #: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485 #, elixir-format msgid "You can't revoke your own admin status." -msgstr "" +msgstr "Não podes revogar o teu próprio estatuto de admin." #: lib/pleroma/web/oauth/oauth_controller.ex:221 #: lib/pleroma/web/oauth/oauth_controller.ex:308 #, elixir-format msgid "Your account is currently disabled" -msgstr "" +msgstr "A tua conta está atualmente desativada" #: lib/pleroma/web/oauth/oauth_controller.ex:183 #: lib/pleroma/web/oauth/oauth_controller.ex:331 #, elixir-format msgid "Your login is missing a confirmed e-mail address" msgstr "" +"O teu início de sessão necessita que tenhas o endereço de e-mail confirmado" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390 #, elixir-format msgid "can't read inbox of %{nickname} as %{as_nickname}" msgstr "" +"não foi possível ler a caixa de entrada de %{nickname} como %{as_nickname}" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:473 #, elixir-format msgid "can't update outbox of %{nickname} as %{as_nickname}" msgstr "" +"não foi possível atualizar caixa de saída de %{nickname} como %{as_nickname}" #: lib/pleroma/web/common_api/common_api.ex:471 #, elixir-format msgid "conversation is already muted" -msgstr "" +msgstr "conversação já silenciada" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:314 #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:492 #, elixir-format msgid "error" -msgstr "" +msgstr "erro" #: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32 #, elixir-format msgid "mascots can only be images" -msgstr "" +msgstr "mascotes apenas podem ser imagens" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62 #, elixir-format msgid "not found" -msgstr "" +msgstr "não encontrado" #: lib/pleroma/web/oauth/oauth_controller.ex:394 #, elixir-format msgid "Bad OAuth request." -msgstr "" +msgstr "Pedido OAuth inválido." #: lib/pleroma/web/twitter_api/twitter_api.ex:115 #, elixir-format msgid "CAPTCHA already used" -msgstr "" +msgstr "CPATCHA já utilizado" #: lib/pleroma/web/twitter_api/twitter_api.ex:112 #, elixir-format msgid "CAPTCHA expired" -msgstr "" +msgstr "CAPTCHA expirado" #: lib/pleroma/plugs/uploaded_media.ex:57 #, elixir-format msgid "Failed" -msgstr "" +msgstr "Falhou" #: lib/pleroma/web/oauth/oauth_controller.ex:410 #, elixir-format msgid "Failed to authenticate: %{message}." -msgstr "" +msgstr "Falha ao autenticar: %{message}." #: lib/pleroma/web/oauth/oauth_controller.ex:441 #, elixir-format msgid "Failed to set up user account." -msgstr "" +msgstr "Falha ao configurar conta de utilizador." #: lib/pleroma/plugs/oauth_scopes_plug.ex:38 #, elixir-format msgid "Insufficient permissions: %{permissions}." -msgstr "" +msgstr "Permissões insuficientes: %{permissions}." #: lib/pleroma/plugs/uploaded_media.ex:104 #, elixir-format msgid "Internal Error" -msgstr "" +msgstr "Erro Interno" #: lib/pleroma/web/oauth/fallback_controller.ex:22 #: lib/pleroma/web/oauth/fallback_controller.ex:29 #, elixir-format msgid "Invalid Username/Password" -msgstr "" +msgstr "Nome de Utilizador/Palavra-passe inválidos" #: lib/pleroma/web/twitter_api/twitter_api.ex:118 #, elixir-format msgid "Invalid answer data" -msgstr "" +msgstr "Informação de resposta inválida" #: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33 #, elixir-format msgid "Nodeinfo schema version not handled" -msgstr "" +msgstr "Versão do schema de nodeinfo não tratado" #: lib/pleroma/web/oauth/oauth_controller.ex:172 #, elixir-format msgid "This action is outside the authorized scopes" -msgstr "" +msgstr "Esta ação está fora dos escopos autorizados" #: lib/pleroma/web/oauth/fallback_controller.ex:14 #, elixir-format msgid "Unknown error, please check the details and try again." -msgstr "" +msgstr "Erro desconhecido, verifica os detalhes e tenta novamente." #: lib/pleroma/web/oauth/oauth_controller.ex:119 #: lib/pleroma/web/oauth/oauth_controller.ex:158 #, elixir-format msgid "Unlisted redirect_uri." -msgstr "" +msgstr "redirect_uri não listado." #: lib/pleroma/web/oauth/oauth_controller.ex:390 #, elixir-format msgid "Unsupported OAuth provider: %{provider}." -msgstr "" +msgstr "Portal OAuth não suportado: %{provider}." #: lib/pleroma/uploaders/uploader.ex:72 #, elixir-format msgid "Uploader callback timeout" -msgstr "" +msgstr "Tempo expirado para callback de quem envia" #: lib/pleroma/web/uploader_controller.ex:23 #, elixir-format msgid "bad request" -msgstr "" +msgstr "pedido inválido" #: lib/pleroma/web/twitter_api/twitter_api.ex:103 #, elixir-format msgid "CAPTCHA Error" -msgstr "" +msgstr "Erro de CAPTCHA" #: lib/pleroma/web/common_api/common_api.ex:290 #, elixir-format msgid "Could not add reaction emoji" -msgstr "" +msgstr "Não foi possível adicionar reação" #: lib/pleroma/web/common_api/common_api.ex:301 #, elixir-format msgid "Could not remove reaction emoji" -msgstr "" +msgstr "Não foi possível remover reação" #: lib/pleroma/web/twitter_api/twitter_api.ex:129 #, elixir-format msgid "Invalid CAPTCHA (Missing parameter: %{name})" -msgstr "" +msgstr "CAPTCHA inválido (Falta o parâmetro: %{name})" #: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92 #, elixir-format msgid "List not found" -msgstr "" +msgstr "Lista não encontrada" #: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123 #, elixir-format msgid "Missing parameter: %{name}" -msgstr "" +msgstr "Parâmetro em falta: %{name}" #: lib/pleroma/web/oauth/oauth_controller.ex:210 #: lib/pleroma/web/oauth/oauth_controller.ex:321 #, elixir-format msgid "Password reset is required" -msgstr "" +msgstr "É necessário repor palavra-passe" #: lib/pleroma/tests/auth_test_controller.ex:9 #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:6 @@ -522,63 +527,68 @@ msgstr "" #, elixir-format msgid "Security violation: OAuth scopes check was neither handled nor explicitly skipped." msgstr "" +"Violação de segurança: a verificação de escopo OAuth não foi nem tratada nem " +"explicitamente ignorada." #: lib/pleroma/plugs/ensure_authenticated_plug.ex:28 #, elixir-format msgid "Two-factor authentication enabled, you must use a access token." msgstr "" +"Autenticação de dois fatores ativada, deves utilizar uma token de acesso." #: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210 #, elixir-format msgid "Unexpected error occurred while adding file to pack." -msgstr "" +msgstr "Ocorreu um erro inesperado ao adicionar ficheiro ao pack." #: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138 #, elixir-format msgid "Unexpected error occurred while creating pack." -msgstr "" +msgstr "Ocorreu um erro inesperado ao criar o pack." #: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278 #, elixir-format msgid "Unexpected error occurred while removing file from pack." -msgstr "" +msgstr "Ocorreu um erro inesperado ao remover ficheiro do pack." #: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250 #, elixir-format msgid "Unexpected error occurred while updating file in pack." -msgstr "" +msgstr "Ocorreu um erro inesperado a atualizar ficheiro no pack." #: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179 #, elixir-format msgid "Unexpected error occurred while updating pack metadata." -msgstr "" +msgstr "Ocorreu um erro inesperado a atualizar os metadados do pack." #: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61 #, elixir-format msgid "Web push subscription is disabled on this Pleroma instance" msgstr "" +"Subscrição de notificações push no browser está desativada nesta instância " +"do Pleroma" #: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:451 #, elixir-format msgid "You can't revoke your own admin/moderator status." -msgstr "" +msgstr "Não podes revogar o teu próprio estatuto de admin/moderador." #: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126 #, elixir-format msgid "authorization required for timeline view" -msgstr "" +msgstr "autorização necessária para visualizar cronologia" #: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24 #, elixir-format msgid "Access denied" -msgstr "" +msgstr "Acesso negado" #: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282 #, elixir-format msgid "This API requires an authenticated user" -msgstr "" +msgstr "Esta API requer um utilizador autenticado" #: lib/pleroma/plugs/user_is_admin_plug.ex:21 #, elixir-format msgid "User is not an admin." -msgstr "" +msgstr "Utilizador não é um admin." -- cgit v1.2.3 From 318d6dde1c6cb0c3d6c9e31b976d71de8c721d8d Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 19 Jan 2021 00:23:39 +0300 Subject: Mox mode setup tweak; refactoring. --- test/pleroma/gun/connection_pool_test.exs | 1 - test/support/channel_case.ex | 16 +--------------- test/support/conn_case.ex | 26 +++++--------------------- test/support/data_case.ex | 15 +++++++++++++-- 4 files changed, 19 insertions(+), 39 deletions(-) diff --git a/test/pleroma/gun/connection_pool_test.exs b/test/pleroma/gun/connection_pool_test.exs index 459d19b11..9cbaf0978 100644 --- a/test/pleroma/gun/connection_pool_test.exs +++ b/test/pleroma/gun/connection_pool_test.exs @@ -19,7 +19,6 @@ defp gun_mock(_) do :ok end - setup :set_mox_from_context setup :gun_mock test "gives the same connection to 2 concurrent requests" do diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index 6888984a2..1fbf6f100 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -30,19 +30,5 @@ defmodule Pleroma.Web.ChannelCase do end end - setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo) - - if tags[:async] do - Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache) - Mox.set_mox_private() - else - Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()}) - Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy) - Mox.set_mox_global() - Pleroma.DataCase.clear_cachex() - end - - :ok - end + setup tags, do: Pleroma.DataCase.setup_multi_process_mode(tags) end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 5b7111fd3..953aa010a 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -19,6 +19,8 @@ defmodule Pleroma.Web.ConnCase do use ExUnit.CaseTemplate + alias Pleroma.DataCase + using do quote do # Import conveniences for testing with connections @@ -116,27 +118,9 @@ defp json_response_and_validate_schema(conn, _status) do end setup tags do - :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo) - - if tags[:async] do - Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache) - Mox.set_mox_private() - else - Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()}) - Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy) - Mox.set_mox_global() - Pleroma.DataCase.clear_cachex() - end - - if tags[:needs_streamer] do - start_supervised(%{ - id: Pleroma.Web.Streamer.registry(), - start: - {Registry, :start_link, [[keys: :duplicate, name: Pleroma.Web.Streamer.registry()]]} - }) - end - - Pleroma.DataCase.stub_pipeline() + DataCase.setup_multi_process_mode(tags) + DataCase.setup_streamer(tags) + DataCase.stub_pipeline() Mox.verify_on_exit!() diff --git a/test/support/data_case.ex b/test/support/data_case.ex index 9db3478bc..c309d2f41 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -62,7 +62,7 @@ def clear_cachex do end) end - setup tags do + def setup_multi_process_mode(tags) do :ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo) if tags[:async] do @@ -70,11 +70,16 @@ def clear_cachex do Mox.set_mox_private() else Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()}) - Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy) + Mox.set_mox_global() + Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy) clear_cachex() end + :ok + end + + def setup_streamer(tags) do if tags[:needs_streamer] do start_supervised(%{ id: Pleroma.Web.Streamer.registry(), @@ -83,6 +88,12 @@ def clear_cachex do }) end + :ok + end + + setup tags do + setup_multi_process_mode(tags) + setup_streamer(tags) stub_pipeline() Mox.verify_on_exit!() -- cgit v1.2.3 From e58f45abd6fe6cdb4937788c6ff5a9f4cb923d39 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 19 Jan 2021 14:15:55 +0300 Subject: Improve PostgreSQL optimization article Move query plan mode setting from OTP installation guide and try to explain what it does. --- docs/configuration/postgresql.md | 27 ++++++++++++++++++++++----- docs/installation/otp_en.md | 13 ++----------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/docs/configuration/postgresql.md b/docs/configuration/postgresql.md index 6983fb459..e251eb83b 100644 --- a/docs/configuration/postgresql.md +++ b/docs/configuration/postgresql.md @@ -1,10 +1,28 @@ -# Optimizing your PostgreSQL performance +# Optimizing PostgreSQL performance -Pleroma performance depends to a large extent on good database performance. The default PostgreSQL settings are mostly fine, but often you can get better performance by changing a few settings. +Pleroma performance is largely dependent on performance of the underlying database. Better performance can be achieved by adjusting a few settings. -You can use [PGTune](https://pgtune.leopard.in.ua) to get recommendations for your setup. If you do, set the "Number of Connections" field to 20, as Pleroma will only use 10 concurrent connections anyway. If you don't, it will give you advice that might even hurt your performance. +## PGTune -We also recommend not using the "Network Storage" option. +[PgTune](https://pgtune.leopard.in.ua) can be used to get recommended settings. Be sure to set "Number of Connections" to 20, otherwise it might produce settings hurtful to database performance. It is also recommended to not use "Network Storage" option. + +## Disable generic query plans + +When PostgreSQL receives a query, it decides on a strategy for searching the requested data, this is called a query plan. The query planner has two modes: generic and custom. Generic makes a plan for all queries of the same shape, ignoring the parameters, which is then cached and reused. Custom, on the contrary, generates a unique query plan based on query parameters. + +By default PostgreSQL has an algorithm to decide which mode is more efficient for particular query, however this algorithm has been observed to be wrong on some of the queries Pleroma sends, leading to serious performance loss. Therefore, it is recommended to disable generic mode. + + +Pleroma already avoids generic query plans by default, however the method it uses is not the most efficient because it needs to be compatible with all supported PostgreSQL versions. For PostgreSQL 12 and higher additional performance can be gained by adding the following to Pleroma configuration: +```elixir +config :pleroma, Pleroma.Repo, + prepare: :named, + parameters: [ + plan_cache_mode: "force_custom_plan" + ] +``` + +A more detailed explaination of the issue can be found at . ## Example configurations @@ -28,4 +46,3 @@ max_worker_processes = 2 max_parallel_workers_per_gather = 1 max_parallel_workers = 2 ``` - diff --git a/docs/installation/otp_en.md b/docs/installation/otp_en.md index 63eda63ca..f36b33c32 100644 --- a/docs/installation/otp_en.md +++ b/docs/installation/otp_en.md @@ -89,6 +89,8 @@ RUM indexes are an alternative indexing scheme that is not included in PostgreSQ #### (Optional) Performance configuration It is encouraged to check [Optimizing your PostgreSQL performance](../configuration/postgresql.md) document, for tips on PostgreSQL tuning. +Restart PostgreSQL to apply configuration changes: + === "Alpine" ``` rc-service postgresql restart @@ -99,17 +101,6 @@ It is encouraged to check [Optimizing your PostgreSQL performance](../configurat systemctl restart postgresql ``` -If you are using PostgreSQL 12 or higher, add this to your Ecto database configuration - -```elixir -# -config :pleroma, Pleroma.Repo, -prepare: :named, -parameters: [ - plan_cache_mode: "force_custom_plan" -] -``` - ### Installing Pleroma ```sh # Create a Pleroma user -- cgit v1.2.3 From 695dabb5da63cdc54000de5ea26006b8429feff2 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 19 Jan 2021 17:57:00 +0400 Subject: Add Reblog fix to CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e02a1beba..8080c63f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Users with `is_discoverable` field set to false (default value) will appear in in-service search results but be hidden from external services (search bots etc.). - Streaming API: Posts and notifications are not dropped, when CLI task is executing. - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers. +- Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private.
API Changes -- cgit v1.2.3 From 7f07909a7b56eb368b3f8aab4752def1551c12fe Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 19 Jan 2021 21:13:32 +0300 Subject: [#3213] Added `HashtagsTableMigrator.count/1`. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 42 ++++++++++++++++-------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 47de5e134..048f3c8ee 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -85,19 +85,8 @@ def handle_info(:migrate_hashtags, state) do max_processed_id = data_migration.data["max_processed_id"] || 0 - # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) - from( - object in Object, - left_join: hashtag in assoc(object, :hashtags), - where: object.id > ^max_processed_id, - where: is_nil(hashtag.id), - where: - fragment("(?)->'tag' IS NOT NULL AND (?)->'tag' != '[]'::jsonb", object.data, object.data), - select: %{ - id: object.id, - tag: fragment("(?)->'tag'", object.data) - } - ) + query() + |> where([object], object.id > ^max_processed_id) |> Repo.chunk_stream(100, :batches, timeout: :infinity) |> Stream.each(fn objects -> object_ids = Enum.map(objects, & &1.id) @@ -155,6 +144,21 @@ def handle_info(:migrate_hashtags, state) do {:noreply, state} end + defp query do + # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) + from( + object in Object, + left_join: hashtag in assoc(object, :hashtags), + where: is_nil(hashtag.id), + where: + fragment("(?)->'tag' IS NOT NULL AND (?)->'tag' != '[]'::jsonb", object.data, object.data), + select: %{ + id: object.id, + tag: fragment("(?)->'tag'", object.data) + } + ) + end + defp transfer_object_hashtags(object) do hashtags = Object.object_data_hashtags(%{"tag" => object.tag}) @@ -188,6 +192,18 @@ defp transfer_object_hashtags(object) do end) end + def count(force \\ false) do + stored_count = state()[:count] + + if stored_count && !force do + stored_count + else + count = Repo.aggregate(query(), :count, :id) + put_stat(:count, count) + count + end + end + defp persist_stats(data_migration) do runner_state = Map.drop(state(), [:status]) _ = DataMigration.update(data_migration, %{data: runner_state}) -- cgit v1.2.3 From f0f0f2af00e8b73a7013c1308289795961b23f4b Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 19 Jan 2021 21:17:06 +0300 Subject: [#3213] `timeout` option for `HashtagsTableMigrator.count/_`. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 048f3c8ee..6a6a7b5b8 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -192,13 +192,13 @@ defp transfer_object_hashtags(object) do end) end - def count(force \\ false) do + def count(force \\ false, timeout \\ :infinity) do stored_count = state()[:count] if stored_count && !force do stored_count else - count = Repo.aggregate(query(), :count, :id) + count = Repo.aggregate(query(), :count, :id, timeout: timeout) put_stat(:count, count) count end -- cgit v1.2.3 From b830605577f369d6b1a8730a5b3476ceea4fef5a Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 19 Jan 2021 22:03:25 +0300 Subject: [#3213] Performance-related stat in HashtagsTableMigrator. Reworked `count/_` to indicate approximate total count for current iteration. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 6a6a7b5b8..e9dd9b70c 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -80,6 +80,7 @@ def handle_info(:migrate_hashtags, state) do DataMigration.update(data_migration, %{state: :running, data: persistent_data}) update_status(:running) + put_stat(:started_at, NaiveDateTime.utc_now()) Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") @@ -118,6 +119,12 @@ def handle_info(:migrate_hashtags, state) do increment_stat(:processed_count, length(object_ids)) increment_stat(:failed_count, length(failed_ids)) + put_stat( + :records_per_second, + state()[:processed_count] / + Enum.max([NaiveDateTime.diff(NaiveDateTime.utc_now(), state()[:started_at]), 1]) + ) + persist_stats(data_migration) # A quick and dirty approach to controlling the load this background migration imposes @@ -192,13 +199,18 @@ defp transfer_object_hashtags(object) do end) end + @doc "Approximate count for current iteration (including processed records count)" def count(force \\ false, timeout \\ :infinity) do stored_count = state()[:count] if stored_count && !force do stored_count else - count = Repo.aggregate(query(), :count, :id, timeout: timeout) + processed_count = state()[:processed_count] || 0 + max_processed_id = data_migration().data["max_processed_id"] || 0 + query = where(query(), [object], object.id > ^max_processed_id) + + count = Repo.aggregate(query, :count, :id, timeout: timeout) + processed_count put_stat(:count, count) count end -- cgit v1.2.3 From e759579f9749ac4198054ddab2d3bb77cc5f04ae Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 19 Jan 2021 16:39:55 -0600 Subject: Active users must be confirmed --- lib/pleroma/user/query.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/user/query.ex b/lib/pleroma/user/query.ex index 74ef1158a..4076925aa 100644 --- a/lib/pleroma/user/query.ex +++ b/lib/pleroma/user/query.ex @@ -139,6 +139,7 @@ defp compose_query({:external, _}, query), do: location_query(query, false) defp compose_query({:active, _}, query) do User.restrict_deactivated(query) |> where([u], u.is_approved == true) + |> where([u], u.is_confirmed == true) end defp compose_query({:legacy_active, _}, query) do -- cgit v1.2.3 From 87c468f009e048634b705452abbdf2ef489cd055 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 20 Jan 2021 20:07:24 +0300 Subject: use correct versions for oban migrations --- priv/repo/migrations/20190730055101_add_oban_jobs_table.exs | 5 ++++- priv/repo/migrations/20190917100019_update_oban.exs | 2 +- priv/repo/migrations/20200402063221_update_oban_jobs_table.exs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/priv/repo/migrations/20190730055101_add_oban_jobs_table.exs b/priv/repo/migrations/20190730055101_add_oban_jobs_table.exs index 2f201bd05..5214d59cb 100644 --- a/priv/repo/migrations/20190730055101_add_oban_jobs_table.exs +++ b/priv/repo/migrations/20190730055101_add_oban_jobs_table.exs @@ -1,6 +1,9 @@ defmodule Pleroma.Repo.Migrations.AddObanJobsTable do use Ecto.Migration - defdelegate up, to: Oban.Migrations + def up do + Oban.Migrations.up(version: 2) + end + defdelegate down, to: Oban.Migrations end diff --git a/priv/repo/migrations/20190917100019_update_oban.exs b/priv/repo/migrations/20190917100019_update_oban.exs index 157dc54f9..f673675de 100644 --- a/priv/repo/migrations/20190917100019_update_oban.exs +++ b/priv/repo/migrations/20190917100019_update_oban.exs @@ -6,6 +6,6 @@ def up do end def down do - Oban.Migrations.down(version: 2) + Oban.Migrations.down(version: 3) end end diff --git a/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs b/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs index e7ff04008..ca6856798 100644 --- a/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs +++ b/priv/repo/migrations/20200402063221_update_oban_jobs_table.exs @@ -6,6 +6,6 @@ def up do end def down do - Oban.Migrations.down(version: 7) + Oban.Migrations.down(version: 8) end end -- cgit v1.2.3 From 704eef3c2d29c92316f4860c50982512824dd514 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 11:14:15 -0600 Subject: Special handling for unconfirmed users based on instance config no longer needed. --- lib/pleroma/user.ex | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index d81abbd2b..2aeacf816 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -289,15 +289,7 @@ def binary_id(%User{} = user), do: binary_id(user.id) def account_status(%User{deactivated: true}), do: :deactivated def account_status(%User{password_reset_pending: true}), do: :password_reset_pending def account_status(%User{local: true, is_approved: false}), do: :approval_pending - - def account_status(%User{local: true, is_confirmed: false}) do - if Config.get([:instance, :account_activation_required]) do - :confirmation_pending - else - :active - end - end - + def account_status(%User{local: true, is_confirmed: false}), do: :confirmation_pending def account_status(%User{}), do: :active @spec visible_for(User.t(), User.t() | nil) :: -- cgit v1.2.3 From 3cb4d40ebf9fbf58fac6f9657f799571dc7f318e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 11:17:13 -0600 Subject: This scenario no longer exists. Users are auto-confirmed if confirmation not required at time of registration. --- test/pleroma/user_test.exs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 617d9b755..a85e89a50 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1830,13 +1830,6 @@ test "returns true when the account is unconfirmed and confirmation is required assert User.visible_for(user, other_user) == :visible end - test "returns true when the account is unconfirmed and confirmation is not required" do - user = insert(:user, local: true, is_confirmed: false) - other_user = insert(:user, local: true) - - assert User.visible_for(user, other_user) == :visible - end - test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do Pleroma.Config.put([:instance, :account_activation_required], true) -- cgit v1.2.3 From 5d344e5c7965651232c4a20a3a3cc187eb79f18d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 11:26:14 -0600 Subject: Only need to test if unconfirmed users are successfully deleted It's no longer possible to have an active user account with User.is_confirmed == false --- test/pleroma/user_test.exs | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index a85e89a50..7e1e75404 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1563,31 +1563,15 @@ test "it deactivates a user, all follow relationships and all activities", %{use end end - describe "delete/1 when confirmation is pending" do - setup do - user = insert(:user, is_confirmed: false) - {:ok, user: user} - end - - test "deletes user from database when activation required", %{user: user} do - clear_config([:instance, :account_activation_required], true) - - {:ok, job} = User.delete(user) - {:ok, _} = ObanHelpers.perform(job) - - refute User.get_cached_by_id(user.id) - refute User.get_by_id(user.id) - end + test "delete/1 when confirmation is pending deletes the user" do + clear_config([:instance, :account_activation_required], true) + user = insert(:user, is_confirmed: false) - test "deactivates user when activation is not required", %{user: user} do - clear_config([:instance, :account_activation_required], false) - - {:ok, job} = User.delete(user) - {:ok, _} = ObanHelpers.perform(job) + {:ok, job} = User.delete(user) + {:ok, _} = ObanHelpers.perform(job) - assert %{deactivated: true} = User.get_cached_by_id(user.id) - assert %{deactivated: true} = User.get_by_id(user.id) - end + refute User.get_cached_by_id(user.id) + refute User.get_by_id(user.id) end test "delete/1 when approval is pending deletes the user" do -- cgit v1.2.3 From dfc4cb6ebd61754ee5865c33092c5e1b782c12cd Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 11:30:29 -0600 Subject: Special handling for unconfirmed users based on instance config no longer needed. --- test/pleroma/web/activity_pub/side_effects_test.exs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs index e3f45ecdb..13167f50a 100644 --- a/test/pleroma/web/activity_pub/side_effects_test.exs +++ b/test/pleroma/web/activity_pub/side_effects_test.exs @@ -165,14 +165,6 @@ test "creates a notification", %{emoji_react: emoji_react, poster: poster} do {:ok, delete: delete_user, user: user} end - test "when activation is not required", %{delete: delete, user: user} do - clear_config([:instance, :account_activation_required], false) - {:ok, _, _} = SideEffects.handle(delete) - ObanHelpers.perform_all() - - assert User.get_cached_by_id(user.id).deactivated - end - test "when activation is required", %{delete: delete, user: user} do clear_config([:instance, :account_activation_required], true) {:ok, _, _} = SideEffects.handle(delete) -- cgit v1.2.3 From 9988d9261c2c933ecb595d0b98790b40f3b44f52 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 16:33:00 -0600 Subject: Add bucket_namespace to be extra certain truncated_namespace works --- test/pleroma/uploaders/s3_test.exs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index 242dc0d50..991052596 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -29,6 +29,7 @@ test "it returns path to local folder for files" do test "it returns path without bucket when truncated_namespace set to ''" do Config.put([Pleroma.Uploaders.S3], bucket: "test_bucket", + bucket_namespace: "myaccount", truncated_namespace: "" ) -- cgit v1.2.3 From 086100e3b7cad827c0f377fdcc4ae9d3b66327c7 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 16:39:39 -0600 Subject: Consistent comment style for :ex_aws --- config/config.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index ef3baed93..dc5964fc9 100644 --- a/config/config.exs +++ b/config/config.exs @@ -79,7 +79,7 @@ # host: "s3.wasabisys.com", # required if not Amazon AWS access_key_id: nil, secret_access_key: nil, - # region: nil, # example: "us-east-1" + # region: "us-east-1", # may be required for Amazon AWS scheme: "https://" config :pleroma, :emoji, -- cgit v1.2.3 From b4ff63d020293bd633bc9c01af1078cacf7f90ed Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 9 Jan 2021 18:52:40 +0300 Subject: configurable limits for ConcurrentLimiter Pleroma.Web.RichMedia.Helpers & Pleroma.Web.MediaProxy --- config/config.exs | 5 +++++ config/description.exs | 48 ++++++++++++++++++++++++++++++++++++++++ docs/configuration/cheatsheet.md | 12 ++++++++++ lib/pleroma/application.ex | 11 ++++++++- 4 files changed, 75 insertions(+), 1 deletion(-) diff --git a/config/config.exs b/config/config.exs index 70d0c2c2b..e07e67de9 100644 --- a/config/config.exs +++ b/config/config.exs @@ -832,6 +832,11 @@ limit_days: 7, dir: nil +config :pleroma, ConcurrentLimiter, [ + {Pleroma.Web.RichMedia.Helpers, [max_running: 5, max_waiting: 5]}, + {Pleroma.Web.MediaProxy, [max_running: 5, max_waiting: 5]} +] + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{Mix.env()}.exs" diff --git a/config/description.exs b/config/description.exs index 493d362d3..49fea4234 100644 --- a/config/description.exs +++ b/config/description.exs @@ -3330,5 +3330,53 @@ suggestions: [:text, :protobuf] } ] + }, + %{ + group: :pleroma, + key: ConcurrentLimiter, + type: :group, + description: "Limits configuration for background tasks.", + children: [ + %{ + key: Pleroma.Web.RichMedia.Helpers, + type: :keyword, + description: "Concurrent limits configuration for getting RichMedia for activities.", + suggestions: [max_running: 5, max_waiting: 5], + children: [ + %{ + key: :max_running, + type: :integer, + description: "Max running concurrently jobs.", + suggestion: [5] + }, + %{ + key: :max_waiting, + type: :integer, + description: "Max waiting jobs.", + suggestion: [5] + } + ] + }, + %{ + key: Pleroma.Web.MediaProxy, + type: :keyword, + description: "Concurrent limits configuration for MediaProxyWarmingPolicy.", + suggestions: [max_running: 5, max_waiting: 5], + children: [ + %{ + key: :max_running, + type: :integer, + description: "Max running concurrently jobs.", + suggestion: [5] + }, + %{ + key: :max_waiting, + type: :integer, + description: "Max waiting jobs.", + suggestion: [5] + } + ] + } + ] } ] diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index c7d8a2dae..c7ff8687e 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -1110,3 +1110,15 @@ Settings to enable and configure expiration for ephemeral activities * `:enabled` - enables ephemeral activities creation * `:min_lifetime` - minimum lifetime for ephemeral activities (in seconds). Default: 10 minutes. + +## ConcurrentLimiter + +Settings allow configuring restrictions for concurrently running jobs. Jobs, which can be configured: + +* `Pleroma.Web.RichMedia.Helpers` - configuration for getting RichMedia for activities. +* `Pleroma.Web.MediaProxy` - configuration for MediaProxyWarmingPolicy. + +Each job has these settings: + +* `:max_running` - max concurrently runnings jobs +* `:max_waiting` - max waiting jobs diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 203a95004..4742a3ecb 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -297,7 +297,16 @@ defp http_children(_, _), do: [] @spec limiters_setup() :: :ok def limiters_setup do + config = Config.get(ConcurrentLimiter, []) + [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] - |> Enum.each(&ConcurrentLimiter.new(&1, 1, 0)) + |> Enum.each(fn module -> + mod_config = Keyword.get(config, module, []) + + max_running = Keyword.get(mod_config, :max_running, 5) + max_waiting = Keyword.get(mod_config, :max_waiting, 5) + + ConcurrentLimiter.new(module, max_running, max_waiting) + end) end end -- cgit v1.2.3 From 1537a4f0adfdc079d7d77dbe249c83df5c3b2eef Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 17:01:26 -0600 Subject: Document ConcurrentLimiter for RichMedia and MediaProxy --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76eab51d4..2ab432d3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - OAuth form improvements: users are remembered by their cookie, the CSS is overridable by the admin, and the style has been improved. - OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc. - Ability to set ActivityPub aliases for follower migration. +- Configurable background job limits for RichMedia (link previews) and MediaProxy +
API Changes -- cgit v1.2.3 From dece31a031b8fce5b47c61ad014aa38ae72ee685 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 20 Jan 2021 17:07:00 -0600 Subject: Update docs --- docs/configuration/cheatsheet.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index c7ff8687e..e7a1b40b1 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -1113,10 +1113,10 @@ Settings to enable and configure expiration for ephemeral activities ## ConcurrentLimiter -Settings allow configuring restrictions for concurrently running jobs. Jobs, which can be configured: +Settings to restrict concurrently running jobs. Jobs which can be configured: -* `Pleroma.Web.RichMedia.Helpers` - configuration for getting RichMedia for activities. -* `Pleroma.Web.MediaProxy` - configuration for MediaProxyWarmingPolicy. +* `Pleroma.Web.RichMedia.Helpers` - generating link previews of URLs in activities +* `Pleroma.Web.MediaProxy` - fetching remote media via MediaProxy Each job has these settings: -- cgit v1.2.3 From 6d48144a9d7273e1b6c253164af5550580a6ea9f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 21 Jan 2021 09:50:18 +0300 Subject: use proper naming for MediaProxyWarmingPolicy in ConcurrentLimiter --- config/description.exs | 2 +- docs/configuration/cheatsheet.md | 2 +- lib/pleroma/application.ex | 2 +- lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/description.exs b/config/description.exs index 49fea4234..715a0d0c3 100644 --- a/config/description.exs +++ b/config/description.exs @@ -3358,7 +3358,7 @@ ] }, %{ - key: Pleroma.Web.MediaProxy, + key: Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy, type: :keyword, description: "Concurrent limits configuration for MediaProxyWarmingPolicy.", suggestions: [max_running: 5, max_waiting: 5], diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index e7a1b40b1..5c0fd6487 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -1116,7 +1116,7 @@ Settings to enable and configure expiration for ephemeral activities Settings to restrict concurrently running jobs. Jobs which can be configured: * `Pleroma.Web.RichMedia.Helpers` - generating link previews of URLs in activities -* `Pleroma.Web.MediaProxy` - fetching remote media via MediaProxy +* `Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy` - warming remote media cache via MediaProxyWarmingPolicy Each job has these settings: diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 4742a3ecb..9e262235e 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -299,7 +299,7 @@ defp http_children(_, _), do: [] def limiters_setup do config = Config.get(ConcurrentLimiter, []) - [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.MediaProxy] + [Pleroma.Web.RichMedia.Helpers, Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy] |> Enum.each(fn module -> mod_config = Keyword.get(config, module, []) diff --git a/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex b/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex index 50d48edc8..8dbf44071 100644 --- a/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/media_proxy_warming_policy.ex @@ -27,7 +27,7 @@ defp prefetch(url) do if Pleroma.Config.get(:env) == :test do fetch(prefetch_url) else - ConcurrentLimiter.limit(MediaProxy, fn -> + ConcurrentLimiter.limit(__MODULE__, fn -> Task.start(fn -> fetch(prefetch_url) end) end) end -- cgit v1.2.3 From 5ade430e46e76543b317dc07fdbc0a3fe7367621 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 21 Jan 2021 10:12:01 +0300 Subject: changed naming in changelog --- CHANGELOG.md | 2 +- config/config.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ab432d3f..e1dfeae01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,7 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - OAuth form improvements: users are remembered by their cookie, the CSS is overridable by the admin, and the style has been improved. - OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc. - Ability to set ActivityPub aliases for follower migration. -- Configurable background job limits for RichMedia (link previews) and MediaProxy +- Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy
diff --git a/config/config.exs b/config/config.exs index e07e67de9..c4a690799 100644 --- a/config/config.exs +++ b/config/config.exs @@ -834,7 +834,7 @@ config :pleroma, ConcurrentLimiter, [ {Pleroma.Web.RichMedia.Helpers, [max_running: 5, max_waiting: 5]}, - {Pleroma.Web.MediaProxy, [max_running: 5, max_waiting: 5]} + {Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy, [max_running: 5, max_waiting: 5]} ] # Import environment specific config. This must remain at the bottom -- cgit v1.2.3 From c041e9c6300726a40a00146bba04d3ec752219d9 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 21 Jan 2021 20:19:09 +0300 Subject: [#3213] HashtagsTableMigrator: failures handling fix, retry function. Changed default hashtags filtering strategy to non-aggregate approach. --- config/description.exs | 2 +- lib/pleroma/migrators/hashtags_table_migrator.ex | 52 ++++++++++++++++++---- lib/pleroma/web/activity_pub/activity_pub.ex | 13 +----- .../pleroma/web/activity_pub/activity_pub_test.exs | 2 +- 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/config/description.exs b/config/description.exs index b48616b22..46f085c70 100644 --- a/config/description.exs +++ b/config/description.exs @@ -940,7 +940,7 @@ key: :improved_hashtag_timeline, type: :keyword, description: - "If `true` / `:prefer_aggregation` / `:avoid_aggregation`, hashtags table and selected strategy will be used for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." + "If `true` / `:prefer_aggregation`, hashtags table and selected strategy will be used for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." } ] }, diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index e9dd9b70c..8ad2c8c73 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -109,8 +109,9 @@ def handle_info(:migrate_hashtags, state) do _ = Repo.query( - "DELETE FROM data_migration_failed_ids WHERE id = ANY($1)", - [object_ids -- failed_ids] + "DELETE FROM data_migration_failed_ids " <> + "WHERE data_migration_id = $1 AND record_id = ANY($2)", + [data_migration.id, object_ids -- failed_ids] ) max_object_id = Enum.at(object_ids, -1) @@ -133,12 +134,8 @@ def handle_info(:migrate_hashtags, state) do end) |> Stream.run() - with {:ok, %{rows: [[0]]}} <- - Repo.query( - "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", - [data_migration.id] - ) do - _ = DataMigration.update_state(data_migration, :complete) + with 0 <- failures_count(data_migration.id) do + {:ok, data_migration} = DataMigration.update_state(data_migration, :complete) handle_success(data_migration) else @@ -167,7 +164,8 @@ defp query do end defp transfer_object_hashtags(object) do - hashtags = Object.object_data_hashtags(%{"tag" => object.tag}) + embedded_tags = (Map.has_key?(object, :tag) && object.tag) || object.data["tag"] + hashtags = Object.object_data_hashtags(%{"tag" => embedded_tags}) Repo.transaction(fn -> with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do @@ -246,6 +244,36 @@ def failed_objects_query do |> order_by([o], asc: o.id) end + def failures_count(data_migration_id \\ nil) do + data_migration_id = data_migration_id || data_migration().id + + with {:ok, %{rows: [[count]]}} <- + Repo.query( + "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", + [data_migration_id] + ) do + count + end + end + + def retry_failed do + data_migration = data_migration() + + failed_objects_query() + |> Repo.chunk_stream(100, :one) + |> Stream.each(fn object -> + with {:ok, _} <- transfer_object_hashtags(object) do + _ = + Repo.query( + "DELETE FROM data_migration_failed_ids " <> + "WHERE data_migration_id = $1 AND record_id = $2", + [data_migration.id, object.id] + ) + end + end) + |> Stream.run() + end + def force_continue do send(whereis(), :migrate_hashtags) end @@ -255,6 +283,12 @@ def force_restart do force_continue() end + def force_complete do + {:ok, data_migration} = DataMigration.update_state(data_migration(), :complete) + + handle_success(data_migration) + end + defp update_status(status, message \\ nil) do put_stat(:status, status) put_stat(:message, message) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 0609827ec..dbfd3839d 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -727,6 +727,7 @@ defp hashtag_conditions(opts) do |> Enum.map(&List.wrap(&1)) end + # Note: times out on larger instances (with default timeout), intended for complex queries defp restrict_hashtag_agg(query, opts) do [tag_any, tag_all, tag_reject] = hashtag_conditions(opts) has_conditions = Enum.any?([tag_any, tag_all, tag_reject], &Enum.any?(&1)) @@ -1290,25 +1291,15 @@ def fetch_activities_query(recipients, opts \\ %{}) do hashtag_timeline_strategy == :prefer_aggregation -> restrict_hashtag_agg(query, opts) - hashtag_timeline_strategy == :avoid_aggregation or avoid_hashtags_aggregation?(opts) -> + true -> query |> distinct([activity], true) |> restrict_hashtag_any(opts) |> restrict_hashtag_all(opts) |> restrict_hashtag_reject_any(opts) - - true -> - restrict_hashtag_agg(query, opts) end end - defp avoid_hashtags_aggregation?(opts) do - [tag_any, tag_all, tag_reject] = hashtag_conditions(opts) - - joins_count = length(tag_all) + if Enum.any?(tag_any), do: 1, else: 0 - Enum.empty?(tag_reject) and joins_count <= 2 - end - def fetch_activities(recipients, opts \\ %{}, pagination \\ :keyset) do list_memberships = Pleroma.List.memberships(opts[:user]) diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 36fd65c76..1fcaf74d3 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -217,7 +217,7 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_two} = CommonAPI.post(user, %{status: ". #essais"}) {:ok, status_three} = CommonAPI.post(user, %{status: ". #test #reject"}) - for hashtag_timeline_strategy <- [true, :prefer_aggregation, :avoid_aggregation, false] do + for hashtag_timeline_strategy <- [true, :prefer_aggregation, false] do clear_config([:instance, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) -- cgit v1.2.3 From ca7f24064304945587fc232325dce4b834ff6c94 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 21 Jan 2021 20:50:06 +0300 Subject: [#3213] Ignoring of blank elements from objects.data->tag. --- lib/pleroma/object.ex | 2 ++ test/pleroma/hashtag_test.exs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/pleroma/hashtag_test.exs diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 5102be1de..9b5c1bec1 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -420,6 +420,8 @@ def object_data_hashtags(%{"tag" => tags}) when is_list(tags) do hashtag when is_bitstring(hashtag) -> String.downcase(hashtag) end) |> Enum.uniq() + # Note: "" elements (plain text) might occur in `data.tag` for incoming objects + |> Enum.filter(&(&1 not in [nil, ""])) end def object_data_hashtags(_), do: [] diff --git a/test/pleroma/hashtag_test.exs b/test/pleroma/hashtag_test.exs new file mode 100644 index 000000000..0264dea0b --- /dev/null +++ b/test/pleroma/hashtag_test.exs @@ -0,0 +1,17 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.HashtagTest do + use Pleroma.DataCase + + alias Pleroma.Hashtag + + describe "changeset validations" do + test "ensure non-blank :name" do + changeset = Hashtag.changeset(%Hashtag{}, %{name: ""}) + + assert {:name, {"can't be blank", [validation: :required]}} in changeset.errors + end + end +end -- cgit v1.2.3 From 3078e62488ad1d94d1d3b83faf9f2b070e4aff06 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 12:25:18 -0600 Subject: Update Apache configuration. This has been tested. --- installation/pleroma-apache.conf | 91 ++++++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 40 deletions(-) diff --git a/installation/pleroma-apache.conf b/installation/pleroma-apache.conf index 0d627f2d7..139abe9e1 100644 --- a/installation/pleroma-apache.conf +++ b/installation/pleroma-apache.conf @@ -1,73 +1,84 @@ -# default Apache site config for Pleroma -# -# needed modules: define headers proxy proxy_http proxy_wstunnel rewrite ssl -# optional modules: cache cache_disk +# Sample Apache config for Pleroma # # Simple installation instructions: -# 1. Install your TLS certificate, possibly using Let's Encrypt. -# 2. Replace 'example.tld' with your instance's domain wherever it appears. -# 3. This assumes a Debian style Apache config. Copy this file to -# /etc/apache2/sites-available/ and then add a symlink to it in -# /etc/apache2/sites-enabled/ by running 'a2ensite pleroma-apache.conf', then restart Apache. +# 1. Install your TLS certificate. We recommend using Let's Encrypt via Certbot +# 2. Replace 'example.tld' with your instance's domain. +# 3. This assumes a Debian-style Apache config. Copy this file to +# /etc/apache2/sites-available/ and then activate the site by running +# 'a2ensite pleroma-apache.conf', then restart Apache. # # Optional: enable disk-based caching for the media proxy # For details, see https://git.pleroma.social/pleroma/pleroma/wikis/How%20to%20activate%20mediaproxy # -# 1. Create the directory listed below as the CacheRoot, and make sure +# 1. Create a directory as shown below for the CacheRoot and make sure # the Apache user can write to it. # 2. Configure Apache's htcacheclean to clean the directory periodically. -# 3. Run 'a2enmod cache cache_disk' and restart Apache. +# Your OS may provide a service you can enable to do this automatically. Define servername example.tld + + LoadModule proxy_module libexec/apache24/mod_proxy.so + + + LoadModule proxy_http_module libexec/apache24/mod_proxy_http.so + + + LoadModule proxy_wstunnel_module libexec/apache24/mod_proxy_wstunnel.so + + + LoadModule rewrite_module libexec/apache24/mod_rewrite.so + + + LoadModule ssl_module libexec/apache24/mod_ssl.so + + + LoadModule cache_module libexec/apache24/mod_cache.so + + + LoadModule cache_disk_module libexec/apache24/mod_cache_disk.so + + ServerName ${servername} ServerTokens Prod -ErrorLog ${APACHE_LOG_DIR}/error.log -CustomLog ${APACHE_LOG_DIR}/access.log combined +# If you want Pleroma-specific logs +#ErrorLog /var/log/httpd-pleroma-error.log +#CustomLog /var/log/httpd-pleroma-access.log combined - Redirect permanent / https://${servername} + RewriteEngine on + RewriteCond %{SERVER_NAME} =${servername} + RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] SSLEngine on SSLCertificateFile /etc/letsencrypt/live/${servername}/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/${servername}/privkey.pem + # Make sure you have the certbot-apache module installed + Include /etc/letsencrypt/options-ssl-apache.conf - # Mozilla modern configuration, tweak to your needs - SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1 - SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256 - SSLHonorCipherOrder on - SSLCompression off - SSLSessionTickets off - - # uncomment the following to enable mediaproxy caching on disk - # - # CacheRoot /var/cache/apache2/mod_cache_disk - # CacheDirLevels 1 - # CacheDirLength 2 - # CacheEnable disk /proxy - # CacheLock on - # + # Uncomment the following to enable MediaProxy caching on disk + #CacheRoot /tmp/pleroma-media-cache/ + #CacheDirLevels 1 + #CacheDirLength 2 + #CacheEnable disk /proxy + #CacheLock on + #CacheHeader on + #CacheDetailHeader on + ## 16MB max filesize for caching, configure as desired + #CacheMaxFileSize 16000000 + #CacheDefaultExpire 86400 RewriteEngine On RewriteCond %{HTTP:Connection} Upgrade [NC] RewriteCond %{HTTP:Upgrade} websocket [NC] - RewriteRule /(.*) ws://localhost:4000/$1 [P,L] + RewriteRule /(.*) ws://127.0.0.1:4000/$1 [P,L] + #ProxyRequests must be off or you open your server to abuse as an open proxy ProxyRequests off - # this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only - # and `localhost.` resolves to [::0] on some systems: see issue #930 ProxyPass / http://127.0.0.1:4000/ ProxyPassReverse / http://127.0.0.1:4000/ - - RequestHeader set Host ${servername} ProxyPreserveHost On - -# OCSP Stapling, only in httpd 2.3.3 and later -SSLUseStapling on -SSLStaplingResponderTimeout 5 -SSLStaplingReturnResponderErrors off -SSLStaplingCache shmcb:/var/run/ocsp(128000) -- cgit v1.2.3 From 133644dfa2e46dc48980ae6f835b7aa2758b4250 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Fri, 8 Jan 2021 12:06:04 +0300 Subject: Ability to set the Service-Worker-Allowed header --- CHANGELOG.md | 2 +- config/description.exs | 8 ++++++++ lib/pleroma/web/plugs/http_security_plug.ex | 8 ++++++++ test/pleroma/web/plugs/http_security_plug_test.exs | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dfeae01..765546941 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc. - Ability to set ActivityPub aliases for follower migration. - Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy - +- Ability to set the `Service-Worker-Allowed` header
API Changes diff --git a/config/description.exs b/config/description.exs index 715a0d0c3..0580be09a 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1749,6 +1749,14 @@ type: :string, description: "Adds the specified URL to report-uri and report-to group in CSP header", suggestions: ["https://example.com/report-uri"] + }, + %{ + key: :service_worker_allowed, + label: "The Service-Worker-Allowed header", + type: :string, + description: + "Sets the Service-Worker-Allowed header which limits the maximum allowed Service Worker scope", + suggestions: ["/"] } ] }, diff --git a/lib/pleroma/web/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex index 4b84f575d..6c959a870 100644 --- a/lib/pleroma/web/plugs/http_security_plug.ex +++ b/lib/pleroma/web/plugs/http_security_plug.ex @@ -23,6 +23,7 @@ def call(conn, _options) do defp headers do referrer_policy = Config.get([:http_security, :referrer_policy]) report_uri = Config.get([:http_security, :report_uri]) + service_worker_allowed = Config.get([:http_security, :service_worker_allowed]) headers = [ {"x-xss-protection", "1; mode=block"}, @@ -34,6 +35,13 @@ defp headers do {"content-security-policy", csp_string()} ] + headers = + if service_worker_allowed do + [{"service-worker-allowed", service_worker_allowed} | headers] + else + headers + end + if report_uri do report_group = %{ "group" => "csp-endpoint", diff --git a/test/pleroma/web/plugs/http_security_plug_test.exs b/test/pleroma/web/plugs/http_security_plug_test.exs index 4233e85c0..26c9fd317 100644 --- a/test/pleroma/web/plugs/http_security_plug_test.exs +++ b/test/pleroma/web/plugs/http_security_plug_test.exs @@ -72,6 +72,14 @@ test "default values for img-src and media-src with disabled media proxy", %{con assert csp =~ "media-src 'self' https:;" assert csp =~ "img-src 'self' data: blob: https:;" end + + test "it sets the Service-Worker-Allowed header", %{conn: conn} do + clear_config([:http_security, :enabled], true) + clear_config([:http_security, :service_worker_allowed], "/") + + conn = get(conn, "/api/v1/instance") + assert Conn.get_resp_header(conn, "service-worker-allowed") == ["/"] + end end describe "img-src and media-src" do -- cgit v1.2.3 From 7fcaa188a0be4bc8e41790ddda9b6789cb318347 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Thu, 21 Jan 2021 14:58:18 +0300 Subject: Allow to define custom HTTP headers per each frontend --- CHANGELOG.md | 2 +- config/config.exs | 5 ++++- config/description.exs | 14 ++++++------- lib/pleroma/web/plugs/http_security_plug.ex | 24 ++++++++++++++++++---- test/pleroma/web/plugs/http_security_plug_test.exs | 9 +++++++- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 765546941..d8fcab9af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,7 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - OAuth improvements and fixes: more secure session-based authentication (by token that could be revoked anytime), ability to revoke belonging OAuth token from any client etc. - Ability to set ActivityPub aliases for follower migration. - Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy -- Ability to set the `Service-Worker-Allowed` header +- Ability to define custom HTTP headers per each frontend
API Changes diff --git a/config/config.exs b/config/config.exs index c4a690799..fbaf9a7b5 100644 --- a/config/config.exs +++ b/config/config.exs @@ -723,7 +723,10 @@ "git" => "https://git.pleroma.social/pleroma/fedi-fe", "build_url" => "https://git.pleroma.social/pleroma/fedi-fe/-/jobs/artifacts/${ref}/download?job=build", - "ref" => "master" + "ref" => "master", + "custom-http-headers" => [ + {"service-worker-allowed", "/"} + ] }, "admin-fe" => %{ "name" => "admin-fe", diff --git a/config/description.exs b/config/description.exs index 0580be09a..2de2e1947 100644 --- a/config/description.exs +++ b/config/description.exs @@ -60,6 +60,12 @@ label: "Build directory", type: :string, description: "The directory inside the zip file " + }, + %{ + key: "custom-http-headers", + label: "Custom HTTP headers", + type: {:list, :string}, + description: "The custom HTTP headers for the frontend" } ] @@ -1749,14 +1755,6 @@ type: :string, description: "Adds the specified URL to report-uri and report-to group in CSP header", suggestions: ["https://example.com/report-uri"] - }, - %{ - key: :service_worker_allowed, - label: "The Service-Worker-Allowed header", - type: :string, - description: - "Sets the Service-Worker-Allowed header which limits the maximum allowed Service Worker scope", - suggestions: ["/"] } ] }, diff --git a/lib/pleroma/web/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex index 6c959a870..0025b042a 100644 --- a/lib/pleroma/web/plugs/http_security_plug.ex +++ b/lib/pleroma/web/plugs/http_security_plug.ex @@ -20,10 +20,26 @@ def call(conn, _options) do end end - defp headers do + def primary_frontend do + with %{"name" => frontend} <- Config.get([:frontends, :primary]), + available <- Config.get([:frontends, :available]), + %{} = primary_frontend <- Map.get(available, frontend) do + {:ok, primary_frontend} + end + end + + def custom_http_frontend_headers do + with {:ok, %{"custom-http-headers" => custom_headers}} <- primary_frontend() do + custom_headers + else + _ -> [] + end + end + + def headers do referrer_policy = Config.get([:http_security, :referrer_policy]) report_uri = Config.get([:http_security, :report_uri]) - service_worker_allowed = Config.get([:http_security, :service_worker_allowed]) + custom_http_frontend_headers = custom_http_frontend_headers() headers = [ {"x-xss-protection", "1; mode=block"}, @@ -36,8 +52,8 @@ defp headers do ] headers = - if service_worker_allowed do - [{"service-worker-allowed", service_worker_allowed} | headers] + if custom_http_frontend_headers do + custom_http_frontend_headers ++ headers else headers end diff --git a/test/pleroma/web/plugs/http_security_plug_test.exs b/test/pleroma/web/plugs/http_security_plug_test.exs index 26c9fd317..4e7befdd5 100644 --- a/test/pleroma/web/plugs/http_security_plug_test.exs +++ b/test/pleroma/web/plugs/http_security_plug_test.exs @@ -75,7 +75,14 @@ test "default values for img-src and media-src with disabled media proxy", %{con test "it sets the Service-Worker-Allowed header", %{conn: conn} do clear_config([:http_security, :enabled], true) - clear_config([:http_security, :service_worker_allowed], "/") + clear_config([:frontends, :primary], %{"name" => "fedi-fe", "ref" => "develop"}) + + clear_config([:frontends, :available], %{ + "fedi-fe" => %{ + "name" => "fedi-fe", + "custom-http-headers" => [{"service-worker-allowed", "/"}] + } + }) conn = get(conn, "/api/v1/instance") assert Conn.get_resp_header(conn, "service-worker-allowed") == ["/"] -- cgit v1.2.3 From 003402df401f2bbf46e47017e3b7a2ec27615ea2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 14:20:13 -0600 Subject: Add ability to invalidate cache entries for Apache --- config/config.exs | 4 +++- docs/configuration/cheatsheet.md | 5 +++-- installation/apache-cache-purge.sh.example | 25 ++++++++++++++++++++++ lib/pleroma/web/media_proxy/invalidation/script.ex | 19 ++++++++++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100755 installation/apache-cache-purge.sh.example diff --git a/config/config.exs b/config/config.exs index c4a690799..5eca250bb 100644 --- a/config/config.exs +++ b/config/config.exs @@ -438,7 +438,9 @@ headers: [], options: [] -config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, script_path: nil +config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, + script_path: nil, + url_format: nil # Note: media preview proxy depends on media proxy to be enabled config :pleroma, :media_preview_proxy, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 5c0fd6487..9d4b07bf4 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -321,9 +321,10 @@ This section describe PWA manifest instance-specific values. Currently this opti #### Pleroma.Web.MediaProxy.Invalidation.Script This strategy allow perform external shell script to purge cache. -Urls of attachments pass to script as arguments. +Urls of attachments are passed to the script as arguments. -* `script_path`: path to external script. +* `script_path`: Path to the external script. +* `url_format`: Set to `:htcacheclean` if using Apache's htcacheclean utility. Example: diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example new file mode 100755 index 000000000..be1d36841 --- /dev/null +++ b/installation/apache-cache-purge.sh.example @@ -0,0 +1,25 @@ +#!/bin/sh + +# A simple shell script to delete a media from Apache's mod_disk_cache. + +SCRIPTNAME=${0##*/} + +# mod_disk_cache directory +CACHE_DIRECTORY="/tmp/pleroma-media-cache" + +## Removes an item via the htcacheclean utility +## $1 - the filename, can be a pattern . +## $2 - the cache directory. +purge_item() { + htcacheclean -p "${2}" "${1}" +} # purge_item + +purge() { + for url in "$@" + do + echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)" + purge_item "$url" $CACHE_DIRECTORY + done +} + +purge "$@" diff --git a/lib/pleroma/web/media_proxy/invalidation/script.ex b/lib/pleroma/web/media_proxy/invalidation/script.ex index 0f66c2fe3..c447614fa 100644 --- a/lib/pleroma/web/media_proxy/invalidation/script.ex +++ b/lib/pleroma/web/media_proxy/invalidation/script.ex @@ -13,6 +13,7 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Script do def purge(urls, opts \\ []) do args = urls + |> format_urls(Keyword.get(opts, :url_format)) |> List.wrap() |> Enum.uniq() |> Enum.join(" ") @@ -40,4 +41,22 @@ defp handle_result(error, _) do Logger.error("Error while cache purge: #{inspect(error)}") {:error, inspect(error)} end + + def format_urls(urls, :htcacheclean) do + urls + |> Enum.map(fn url -> + uri = URI.parse(url) + + query = + if !is_nil(uri.query) do + "?" <> uri.query + else + "?" + end + + uri.scheme <> "://" <> uri.host <> ":#{inspect(uri.port)}" <> uri.path <> query + end) + end + + def format_urls(urls, _), do: urls end -- cgit v1.2.3 From e5b32aab92444ea1b4c5ec9e5e78cfcc909aaa73 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 14:41:28 -0600 Subject: rename function --- lib/pleroma/web/media_proxy/invalidation/script.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/media_proxy/invalidation/script.ex b/lib/pleroma/web/media_proxy/invalidation/script.ex index c447614fa..87a21166c 100644 --- a/lib/pleroma/web/media_proxy/invalidation/script.ex +++ b/lib/pleroma/web/media_proxy/invalidation/script.ex @@ -13,7 +13,7 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.Script do def purge(urls, opts \\ []) do args = urls - |> format_urls(Keyword.get(opts, :url_format)) + |> maybe_format_urls(Keyword.get(opts, :url_format)) |> List.wrap() |> Enum.uniq() |> Enum.join(" ") @@ -42,7 +42,7 @@ defp handle_result(error, _) do {:error, inspect(error)} end - def format_urls(urls, :htcacheclean) do + def maybe_format_urls(urls, :htcacheclean) do urls |> Enum.map(fn url -> uri = URI.parse(url) @@ -58,5 +58,5 @@ def format_urls(urls, :htcacheclean) do end) end - def format_urls(urls, _), do: urls + def maybe_format_urls(urls, _), do: urls end -- cgit v1.2.3 From 0c485d555583971153fd44ec6aa9256a8503b150 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 14:42:08 -0600 Subject: Improve description --- test/pleroma/web/media_proxy/invalidation/script_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pleroma/web/media_proxy/invalidation/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs index bcb6ab73c..854de8a3b 100644 --- a/test/pleroma/web/media_proxy/invalidation/script_test.exs +++ b/test/pleroma/web/media_proxy/invalidation/script_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do import ExUnit.CaptureLog - test "it logger error when script not found" do + test "it logs error when script is not found" do assert capture_log(fn -> assert Invalidation.Script.purge( ["http://example.com/media/example.jpg"], -- cgit v1.2.3 From 42e49529c24090b0cb6f92f2bba154de5feb6855 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 14:42:16 -0600 Subject: Test URL formatting --- .../web/media_proxy/invalidation/script_test.exs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/pleroma/web/media_proxy/invalidation/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs index 854de8a3b..e9629b72b 100644 --- a/test/pleroma/web/media_proxy/invalidation/script_test.exs +++ b/test/pleroma/web/media_proxy/invalidation/script_test.exs @@ -23,4 +23,30 @@ test "it logs error when script is not found" do ) == {:error, "\"not found script path\""} end) end + + describe "url formatting" do + setup do + urls = [ + "https://bikeshed.party/media/foo.png", + "http://safe.millennial.space/proxy/wheeeee.gif", + "https://lain.com/proxy/mediafile.mp4?foo&bar=true", + "http://localhost:4000/media/upload.jpeg" + ] + + [urls: urls] + end + + test "with invalid formatter", %{urls: urls} do + assert urls == Invalidation.Script.maybe_format_urls(urls, nil) + end + + test "with :htcacheclean formatter", %{urls: urls} do + assert [ + "https://bikeshed.party:443/media/foo.png?", + "http://safe.millennial.space:80/proxy/wheeeee.gif?", + "https://lain.com:443/proxy/mediafile.mp4?foo&bar=true", + "http://localhost:4000/media/upload.jpeg?" + ] == Invalidation.Script.maybe_format_urls(urls, :htcacheclean) + end + end end -- cgit v1.2.3 From e709dec2eb7b588e242f3b776761ba89484f446a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 14:52:02 -0600 Subject: Add Invalidation Script url_format setting --- config/description.exs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/description.exs b/config/description.exs index 715a0d0c3..d7dc264ee 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1627,13 +1627,20 @@ group: :pleroma, key: Pleroma.Web.MediaProxy.Invalidation.Script, type: :group, - description: "Script invalidate settings", + description: "Invalidation script settings", children: [ %{ key: :script_path, type: :string, - description: "Path to shell script. Which will run purge cache.", + description: "Path to executable script which will purge cached items.", suggestions: ["./installation/nginx-cache-purge.sh.example"] + }, + %{ + key: :url_format, + type: :string, + description: + "Optional URL format preprocessing. Only required for Apache's htcacheclean.", + suggestions: [":htcacheclean"] } ] }, -- cgit v1.2.3 From c29cf65ec7f681ffde70b44e745cf8bf660fc6c0 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 14:53:38 -0600 Subject: Document improved Apache support --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dfeae01..fea8b92de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Admin API: Reports now ordered by newest - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. +- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation now supported ### Added -- cgit v1.2.3 From 80ccdb56f623be21b3ec5b78fc55cee57bee1d2b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 21 Jan 2021 16:49:19 -0600 Subject: Make tag urls absolute --- CHANGELOG.md | 1 + lib/pleroma/web/mastodon_api/views/status_view.ex | 2 +- test/pleroma/web/mastodon_api/views/status_view_test.exs | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dfeae01..2727d1f2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Streaming API: Posts and notifications are not dropped, when CLI task is executing. - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers. - Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private. +- Tag URLs in statuses are now absolute
API Changes diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index cd1a85088..2cd6732fe 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -491,7 +491,7 @@ def render_content(object), do: object.data["content"] || "" def build_tags(object_tags) when is_list(object_tags) do object_tags |> Enum.filter(&is_binary/1) - |> Enum.map(&%{name: &1, url: "/tag/#{URI.encode(&1)}"}) + |> Enum.map(&%{name: &1, url: "#{Pleroma.Web.base_url()}/tag/#{URI.encode(&1)}"}) end def build_tags(_), do: [] 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 21a01658e..ed59cf285 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -263,7 +263,7 @@ test "a note activity" do tags: [ %{ name: "#{object_data["tag"]}", - url: "/tag/#{object_data["tag"]}" + url: "http://localhost:4001/tag/#{object_data["tag"]}" } ], application: %{ @@ -585,9 +585,9 @@ test "it returns a a dictionary tags" do ] assert StatusView.build_tags(object_tags) == [ - %{name: "fediverse", url: "/tag/fediverse"}, - %{name: "mastodon", url: "/tag/mastodon"}, - %{name: "nextcloud", url: "/tag/nextcloud"} + %{name: "fediverse", url: "http://localhost:4001/tag/fediverse"}, + %{name: "mastodon", url: "http://localhost:4001/tag/mastodon"}, + %{name: "nextcloud", url: "http://localhost:4001/tag/nextcloud"} ] end end -- cgit v1.2.3 From 6bfd497f4afeb4182cc865087e6f4863bc48a4f4 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 22 Jan 2021 09:47:59 -0600 Subject: Include own_votes in the poll data --- CHANGELOG.md | 1 + lib/pleroma/web/mastodon_api/views/poll_view.ex | 27 +++++++++++++++++----- .../web/mastodon_api/views/poll_view_test.exs | 6 ++++- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dfeae01..328a7c28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). API Changes - Mastodon API: Current user is now included in conversation if it's the only participant. - Mastodon API: Fixed last_status.account being not filled with account data. + - Mastodon API: Fixed own_votes being not returned with poll data.
## Unreleased (Patch) diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex index d6b544037..94bc1c139 100644 --- a/lib/pleroma/web/mastodon_api/views/poll_view.ex +++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.MastodonAPI.PollView do def render("show.json", %{object: object, multiple: multiple, options: options} = params) do {end_time, expired} = end_time_and_expired(object) {options, votes_count} = options_and_votes_count(options) + {voted, own_votes} = voted_and_own_votes(params, options) %{ # Mastodon uses separate ids for polls, but an object can't have @@ -21,7 +22,8 @@ def render("show.json", %{object: object, multiple: multiple, options: options} votes_count: votes_count, voters_count: voters_count(object), options: options, - voted: voted?(params), + voted: voted, + own_votes: own_votes, emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"]) } end @@ -67,12 +69,25 @@ defp voters_count(%{data: %{"voters" => [_ | _] = voters}}) do defp voters_count(_), do: 0 - defp voted?(%{object: object} = opts) do - if opts[:for] do - existing_votes = Pleroma.Web.ActivityPub.Utils.get_existing_votes(opts[:for].ap_id, object) - existing_votes != [] or opts[:for].ap_id == object.data["actor"] + defp voted_and_own_votes(%{object: object} = params, options) do + options = options |> Enum.map(fn x -> Map.get(x, :title) end) + + if params[:for] do + existing_votes = + Pleroma.Web.ActivityPub.Utils.get_existing_votes(params[:for].ap_id, object) + + own_votes = + for vote <- existing_votes do + data = Map.get(vote, :object) |> Map.get(:data) + + Enum.find_index(options, fn x -> x == data["name"] end) + end || [] + + voted = existing_votes != [] or params[:for].ap_id == object.data["actor"] + + {voted, own_votes} else - false + {false, []} end end end diff --git a/test/pleroma/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs index a8600e1c2..f087d50e8 100644 --- a/test/pleroma/web/mastodon_api/views/poll_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/poll_view_test.exs @@ -44,7 +44,8 @@ test "renders a poll" do ], voted: false, votes_count: 0, - voters_count: 0 + voters_count: 0, + own_votes: [] } result = PollView.render("show.json", %{object: object}) @@ -123,7 +124,10 @@ test "detects vote status" do result = PollView.render("show.json", %{object: object, for: other_user}) + _own_votes = result[:own_votes] + assert result[:voted] == true + assert own_votes = [1, 2] assert Enum.at(result[:options], 1)[:votes_count] == 1 assert Enum.at(result[:options], 2)[:votes_count] == 1 end -- cgit v1.2.3 From 55bf090492a0e8b90cba62763d299a4c7a3cc92e Mon Sep 17 00:00:00 2001 From: 𝑓 Date: Sat, 23 Jan 2021 16:56:11 +0000 Subject: add missing sudo prefix in install doc --- docs/installation/alpine_linux_en.md | 2 +- docs/installation/arch_linux_en.md | 2 +- docs/installation/debian_based_en.md | 2 +- docs/installation/debian_based_jp.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/installation/alpine_linux_en.md b/docs/installation/alpine_linux_en.md index 2f8520a78..7eb1718f2 100644 --- a/docs/installation/alpine_linux_en.md +++ b/docs/installation/alpine_linux_en.md @@ -125,7 +125,7 @@ sudo -Hu pleroma mix deps.get * Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances): ```shell -mv config/{generated_config.exs,prod.secret.exs} +sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs} ``` * The previous command creates also the file `config/setup_db.psql`, with which you can create the database: diff --git a/docs/installation/arch_linux_en.md b/docs/installation/arch_linux_en.md index 9cbd3f429..da78c3205 100644 --- a/docs/installation/arch_linux_en.md +++ b/docs/installation/arch_linux_en.md @@ -100,7 +100,7 @@ sudo -Hu pleroma mix deps.get * Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances): ```shell -mv config/{generated_config.exs,prod.secret.exs} +sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs} ``` * The previous command creates also the file `config/setup_db.psql`, with which you can create the database: diff --git a/docs/installation/debian_based_en.md b/docs/installation/debian_based_en.md index 926a85367..c5687a01e 100644 --- a/docs/installation/debian_based_en.md +++ b/docs/installation/debian_based_en.md @@ -98,7 +98,7 @@ sudo -Hu pleroma mix deps.get * Check the configuration and if all looks right, rename it, so Pleroma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances): ```shell -mv config/{generated_config.exs,prod.secret.exs} +sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs} ``` diff --git a/docs/installation/debian_based_jp.md b/docs/installation/debian_based_jp.md index 2613a86d9..c4bbd4780 100644 --- a/docs/installation/debian_based_jp.md +++ b/docs/installation/debian_based_jp.md @@ -98,7 +98,7 @@ sudo -Hu pleroma mix pleroma.instance gen * コンフィギュレーションを確認して、もし問題なければ、ファイル名を変更してください。 ``` -mv config/{generated_config.exs,prod.secret.exs} +sudo -Hu pleroma mv config/{generated_config.exs,prod.secret.exs} ``` * 先程のコマンドで、すでに `config/setup_db.psql` というファイルが作られています。このファイルをもとに、データベースを作成します。 -- cgit v1.2.3 From f264d930cc00c463d0f506a94f6f6b494aab7022 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 24 Jan 2021 23:27:02 +0300 Subject: [#3213] Speedup of HashtagsTableMigrator (query optimization). State handling fix. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 18 +++++++++++++++--- lib/pleroma/migrators/hashtags_table_migrator/state.ex | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 8ad2c8c73..6a1c9592c 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -72,6 +72,8 @@ def handle_continue(:init_state, _state) do @impl true def handle_info(:migrate_hashtags, state) do + State.clear() + data_migration = data_migration() persistent_data = Map.take(data_migration.data, ["max_processed_id"]) @@ -152,8 +154,6 @@ defp query do # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) from( object in Object, - left_join: hashtag in assoc(object, :hashtags), - where: is_nil(hashtag.id), where: fragment("(?)->'tag' IS NOT NULL AND (?)->'tag' != '[]'::jsonb", object.data, object.data), select: %{ @@ -161,12 +161,24 @@ defp query do tag: fragment("(?)->'tag'", object.data) } ) + |> join(:left, [o], hashtags_objects in fragment("SELECT object_id FROM hashtags_objects"), + on: hashtags_objects.object_id == o.id + ) + |> where([_o, hashtags_objects], is_nil(hashtags_objects.object_id)) end defp transfer_object_hashtags(object) do - embedded_tags = (Map.has_key?(object, :tag) && object.tag) || object.data["tag"] + embedded_tags = if Map.has_key?(object, :tag), do: object.tag, else: object.data["tag"] hashtags = Object.object_data_hashtags(%{"tag" => embedded_tags}) + if Enum.any?(hashtags) do + transfer_object_hashtags(object, hashtags) + else + {:ok, object.id} + end + end + + defp transfer_object_hashtags(object, hashtags) do Repo.transaction(fn -> with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do for hashtag_record <- hashtag_records do diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex index 43f7270e2..901563426 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator/state.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator/state.ex @@ -12,6 +12,10 @@ def start_link(_) do Agent.start_link(fn -> @init_state end, name: @reg_name) end + def clear do + Agent.update(@reg_name, fn _state -> @init_state end) + end + def get do Agent.get(@reg_name, & &1) end -- cgit v1.2.3 From 9e3fcb4b29ea79b4bbaf4c27c68fe1b5ab232c6e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 09:45:58 -0600 Subject: Update AdminFE: admin-fe@8a390584676b27b611d3363eca2a1194d94ed71f --- priv/static/adminfe/chunk-1e46.0411a9b2.css | Bin 692 -> 0 bytes priv/static/adminfe/chunk-bc60.4417dd06.css | Bin 0 -> 692 bytes priv/static/adminfe/index.html | 2 +- priv/static/adminfe/static/js/app.01bfc983.js | Bin 258232 -> 0 bytes priv/static/adminfe/static/js/app.01bfc983.js.map | Bin 529102 -> 0 bytes priv/static/adminfe/static/js/app.1428845f.js | Bin 0 -> 258216 bytes priv/static/adminfe/static/js/app.1428845f.js.map | Bin 0 -> 529091 bytes priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js | Bin 15856 -> 0 bytes .../adminfe/static/js/chunk-1e46.7c2ee531.js.map | Bin 41883 -> 0 bytes priv/static/adminfe/static/js/chunk-35b1.50c1449b.js | Bin 0 -> 29824 bytes .../adminfe/static/js/chunk-35b1.50c1449b.js.map | Bin 0 -> 99518 bytes priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js | Bin 29833 -> 0 bytes .../adminfe/static/js/chunk-35b1.ddb9524c.js.map | Bin 99532 -> 0 bytes priv/static/adminfe/static/js/chunk-606c.35588dea.js | Bin 26525 -> 0 bytes .../adminfe/static/js/chunk-606c.35588dea.js.map | Bin 101577 -> 0 bytes priv/static/adminfe/static/js/chunk-606c.8ac52179.js | Bin 0 -> 26517 bytes .../adminfe/static/js/chunk-606c.8ac52179.js.map | Bin 0 -> 101564 bytes priv/static/adminfe/static/js/chunk-7041.1495e01c.js | Bin 20256 -> 0 bytes .../adminfe/static/js/chunk-7041.1495e01c.js.map | Bin 67885 -> 0 bytes priv/static/adminfe/static/js/chunk-7041.390b2ec4.js | Bin 0 -> 20252 bytes .../adminfe/static/js/chunk-7041.390b2ec4.js.map | Bin 0 -> 67880 bytes priv/static/adminfe/static/js/chunk-7968.88218960.js | Bin 0 -> 23103 bytes .../adminfe/static/js/chunk-7968.88218960.js.map | Bin 0 -> 87311 bytes priv/static/adminfe/static/js/chunk-7968.d6317b83.js | Bin 23109 -> 0 bytes .../adminfe/static/js/chunk-7968.d6317b83.js.map | Bin 87317 -> 0 bytes priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js | Bin 0 -> 15852 bytes .../adminfe/static/js/chunk-bc60.79f8c7e7.js.map | Bin 0 -> 41877 bytes priv/static/adminfe/static/js/chunk-f364.a5927f18.js | Bin 0 -> 20980 bytes .../adminfe/static/js/chunk-f364.a5927f18.js.map | Bin 0 -> 74056 bytes priv/static/adminfe/static/js/chunk-f364.f22b0eee.js | Bin 20986 -> 0 bytes .../adminfe/static/js/chunk-f364.f22b0eee.js.map | Bin 74062 -> 0 bytes priv/static/adminfe/static/js/runtime.5c1034c4.js | Bin 4469 -> 0 bytes priv/static/adminfe/static/js/runtime.5c1034c4.js.map | Bin 17827 -> 0 bytes priv/static/adminfe/static/js/runtime.6b30c658.js | Bin 0 -> 4469 bytes priv/static/adminfe/static/js/runtime.6b30c658.js.map | Bin 0 -> 17827 bytes 35 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 priv/static/adminfe/chunk-1e46.0411a9b2.css create mode 100644 priv/static/adminfe/chunk-bc60.4417dd06.css delete mode 100644 priv/static/adminfe/static/js/app.01bfc983.js delete mode 100644 priv/static/adminfe/static/js/app.01bfc983.js.map create mode 100644 priv/static/adminfe/static/js/app.1428845f.js create mode 100644 priv/static/adminfe/static/js/app.1428845f.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js delete mode 100644 priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map create mode 100644 priv/static/adminfe/static/js/chunk-35b1.50c1449b.js create mode 100644 priv/static/adminfe/static/js/chunk-35b1.50c1449b.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js delete mode 100644 priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-606c.35588dea.js delete mode 100644 priv/static/adminfe/static/js/chunk-606c.35588dea.js.map create mode 100644 priv/static/adminfe/static/js/chunk-606c.8ac52179.js create mode 100644 priv/static/adminfe/static/js/chunk-606c.8ac52179.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-7041.1495e01c.js delete mode 100644 priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map create mode 100644 priv/static/adminfe/static/js/chunk-7041.390b2ec4.js create mode 100644 priv/static/adminfe/static/js/chunk-7041.390b2ec4.js.map create mode 100644 priv/static/adminfe/static/js/chunk-7968.88218960.js create mode 100644 priv/static/adminfe/static/js/chunk-7968.88218960.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-7968.d6317b83.js delete mode 100644 priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map create mode 100644 priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js create mode 100644 priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js.map create mode 100644 priv/static/adminfe/static/js/chunk-f364.a5927f18.js create mode 100644 priv/static/adminfe/static/js/chunk-f364.a5927f18.js.map delete mode 100644 priv/static/adminfe/static/js/chunk-f364.f22b0eee.js delete mode 100644 priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map delete mode 100644 priv/static/adminfe/static/js/runtime.5c1034c4.js delete mode 100644 priv/static/adminfe/static/js/runtime.5c1034c4.js.map create mode 100644 priv/static/adminfe/static/js/runtime.6b30c658.js create mode 100644 priv/static/adminfe/static/js/runtime.6b30c658.js.map diff --git a/priv/static/adminfe/chunk-1e46.0411a9b2.css b/priv/static/adminfe/chunk-1e46.0411a9b2.css deleted file mode 100644 index e511ebfe2..000000000 Binary files a/priv/static/adminfe/chunk-1e46.0411a9b2.css and /dev/null differ diff --git a/priv/static/adminfe/chunk-bc60.4417dd06.css b/priv/static/adminfe/chunk-bc60.4417dd06.css new file mode 100644 index 000000000..59ca45d6c Binary files /dev/null and b/priv/static/adminfe/chunk-bc60.4417dd06.css differ diff --git a/priv/static/adminfe/index.html b/priv/static/adminfe/index.html index 9f6674b5c..09915e8cd 100644 --- a/priv/static/adminfe/index.html +++ b/priv/static/adminfe/index.html @@ -1 +1 @@ -Admin FE
\ No newline at end of file +Admin FE
\ No newline at end of file diff --git a/priv/static/adminfe/static/js/app.01bfc983.js b/priv/static/adminfe/static/js/app.01bfc983.js deleted file mode 100644 index b55da9cda..000000000 Binary files a/priv/static/adminfe/static/js/app.01bfc983.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/app.01bfc983.js.map b/priv/static/adminfe/static/js/app.01bfc983.js.map deleted file mode 100644 index 19960bd78..000000000 Binary files a/priv/static/adminfe/static/js/app.01bfc983.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/app.1428845f.js b/priv/static/adminfe/static/js/app.1428845f.js new file mode 100644 index 000000000..cc9541168 Binary files /dev/null and b/priv/static/adminfe/static/js/app.1428845f.js differ diff --git a/priv/static/adminfe/static/js/app.1428845f.js.map b/priv/static/adminfe/static/js/app.1428845f.js.map new file mode 100644 index 000000000..3fba88015 Binary files /dev/null and b/priv/static/adminfe/static/js/app.1428845f.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js b/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js deleted file mode 100644 index bdd6fde97..000000000 Binary files a/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map b/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map deleted file mode 100644 index 305fa838d..000000000 Binary files a/priv/static/adminfe/static/js/chunk-1e46.7c2ee531.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.50c1449b.js b/priv/static/adminfe/static/js/chunk-35b1.50c1449b.js new file mode 100644 index 000000000..75a2bf0c2 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-35b1.50c1449b.js differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.50c1449b.js.map b/priv/static/adminfe/static/js/chunk-35b1.50c1449b.js.map new file mode 100644 index 000000000..b5e2a27b2 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-35b1.50c1449b.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js b/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js deleted file mode 100644 index f31565f8f..000000000 Binary files a/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map b/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map deleted file mode 100644 index 7a2659f62..000000000 Binary files a/priv/static/adminfe/static/js/chunk-35b1.ddb9524c.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-606c.35588dea.js b/priv/static/adminfe/static/js/chunk-606c.35588dea.js deleted file mode 100644 index 4cffaa5ce..000000000 Binary files a/priv/static/adminfe/static/js/chunk-606c.35588dea.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-606c.35588dea.js.map b/priv/static/adminfe/static/js/chunk-606c.35588dea.js.map deleted file mode 100644 index 603c0fce4..000000000 Binary files a/priv/static/adminfe/static/js/chunk-606c.35588dea.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-606c.8ac52179.js b/priv/static/adminfe/static/js/chunk-606c.8ac52179.js new file mode 100644 index 000000000..7ae3ce7b1 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-606c.8ac52179.js differ diff --git a/priv/static/adminfe/static/js/chunk-606c.8ac52179.js.map b/priv/static/adminfe/static/js/chunk-606c.8ac52179.js.map new file mode 100644 index 000000000..8c41c2755 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-606c.8ac52179.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-7041.1495e01c.js b/priv/static/adminfe/static/js/chunk-7041.1495e01c.js deleted file mode 100644 index e68346c2b..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7041.1495e01c.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map b/priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map deleted file mode 100644 index 9609e9b1b..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7041.1495e01c.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7041.390b2ec4.js b/priv/static/adminfe/static/js/chunk-7041.390b2ec4.js new file mode 100644 index 000000000..50eb1a5f5 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7041.390b2ec4.js differ diff --git a/priv/static/adminfe/static/js/chunk-7041.390b2ec4.js.map b/priv/static/adminfe/static/js/chunk-7041.390b2ec4.js.map new file mode 100644 index 000000000..401bb0b1f Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7041.390b2ec4.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-7968.88218960.js b/priv/static/adminfe/static/js/chunk-7968.88218960.js new file mode 100644 index 000000000..44348d9d1 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7968.88218960.js differ diff --git a/priv/static/adminfe/static/js/chunk-7968.88218960.js.map b/priv/static/adminfe/static/js/chunk-7968.88218960.js.map new file mode 100644 index 000000000..6fa0131fc Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7968.88218960.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-7968.d6317b83.js b/priv/static/adminfe/static/js/chunk-7968.d6317b83.js deleted file mode 100644 index cb6371cfe..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7968.d6317b83.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map b/priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map deleted file mode 100644 index 455fe8cb4..000000000 Binary files a/priv/static/adminfe/static/js/chunk-7968.d6317b83.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js b/priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js new file mode 100644 index 000000000..b2206aa11 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js differ diff --git a/priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js.map b/priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js.map new file mode 100644 index 000000000..799352270 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-bc60.79f8c7e7.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-f364.a5927f18.js b/priv/static/adminfe/static/js/chunk-f364.a5927f18.js new file mode 100644 index 000000000..9a872d819 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f364.a5927f18.js differ diff --git a/priv/static/adminfe/static/js/chunk-f364.a5927f18.js.map b/priv/static/adminfe/static/js/chunk-f364.a5927f18.js.map new file mode 100644 index 000000000..05f67d1a5 Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f364.a5927f18.js.map differ diff --git a/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js b/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js deleted file mode 100644 index fb1546f1f..000000000 Binary files a/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map b/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map deleted file mode 100644 index 79292c5d5..000000000 Binary files a/priv/static/adminfe/static/js/chunk-f364.f22b0eee.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.5c1034c4.js b/priv/static/adminfe/static/js/runtime.5c1034c4.js deleted file mode 100644 index 7d2f6d83b..000000000 Binary files a/priv/static/adminfe/static/js/runtime.5c1034c4.js and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.5c1034c4.js.map b/priv/static/adminfe/static/js/runtime.5c1034c4.js.map deleted file mode 100644 index 723da6ee7..000000000 Binary files a/priv/static/adminfe/static/js/runtime.5c1034c4.js.map and /dev/null differ diff --git a/priv/static/adminfe/static/js/runtime.6b30c658.js b/priv/static/adminfe/static/js/runtime.6b30c658.js new file mode 100644 index 000000000..ecdf93f1b Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.6b30c658.js differ diff --git a/priv/static/adminfe/static/js/runtime.6b30c658.js.map b/priv/static/adminfe/static/js/runtime.6b30c658.js.map new file mode 100644 index 000000000..67a46d4bf Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.6b30c658.js.map differ -- cgit v1.2.3 From c3dd06b5408ca1d1ede7279a1bc9e90ae1ec17a9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 09:50:26 -0600 Subject: Update PleromaFE: pleroma-fe@eb2975b64d849af6bdc327dabac34b8e6d952eae --- priv/static/index.html | 2 +- priv/static/static/emoji.json | 2398 ++++++++++++-------- priv/static/static/js/10.46f441b948010eda4403.js | Bin 31095 -> 0 bytes .../static/js/10.46f441b948010eda4403.js.map | Bin 113 -> 0 bytes priv/static/static/js/10.a11a612e4c1ef51ded17.js | Bin 0 -> 31550 bytes .../static/js/10.a11a612e4c1ef51ded17.js.map | Bin 0 -> 113 bytes priv/static/static/js/11.22872a1f83121e70a148.js | Bin 0 -> 16124 bytes .../static/js/11.22872a1f83121e70a148.js.map | Bin 0 -> 113 bytes priv/static/static/js/11.8ff1ed54814f2d34cb3e.js | Bin 16124 -> 0 bytes .../static/js/11.8ff1ed54814f2d34cb3e.js.map | Bin 113 -> 0 bytes priv/static/static/js/12.13204bdd0ad5703a3ea3.js | Bin 23834 -> 0 bytes .../static/js/12.13204bdd0ad5703a3ea3.js.map | Bin 113 -> 0 bytes priv/static/static/js/12.c6df5166dc6cdcf749e5.js | Bin 0 -> 23834 bytes .../static/js/12.c6df5166dc6cdcf749e5.js.map | Bin 0 -> 113 bytes priv/static/static/js/13.77214c18c6d2a9865281.js | Bin 0 -> 27059 bytes .../static/js/13.77214c18c6d2a9865281.js.map | Bin 0 -> 113 bytes priv/static/static/js/13.e27c3eeddcc4b11c1f54.js | Bin 27059 -> 0 bytes .../static/js/13.e27c3eeddcc4b11c1f54.js.map | Bin 113 -> 0 bytes priv/static/static/js/14.273855b3e4e27ce80219.js | Bin 29348 -> 0 bytes .../static/js/14.273855b3e4e27ce80219.js.map | Bin 113 -> 0 bytes priv/static/static/js/14.e560f5e2f902b9ad2d0d.js | Bin 0 -> 29348 bytes .../static/js/14.e560f5e2f902b9ad2d0d.js.map | Bin 0 -> 113 bytes priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js | Bin 0 -> 7789 bytes .../static/js/15.2893c12f1ca2bcdc3cbf.js.map | Bin 0 -> 113 bytes priv/static/static/js/15.afbe29b6665fcd015b2d.js | Bin 7789 -> 0 bytes .../static/js/15.afbe29b6665fcd015b2d.js.map | Bin 113 -> 0 bytes priv/static/static/js/16.5e3f20da470591d0cabf.js | Bin 15700 -> 0 bytes .../static/js/16.5e3f20da470591d0cabf.js.map | Bin 113 -> 0 bytes priv/static/static/js/16.be7f4b788716bec25023.js | Bin 0 -> 15802 bytes .../static/js/16.be7f4b788716bec25023.js.map | Bin 0 -> 113 bytes priv/static/static/js/17.44e90ef82ee2ef12dc3f.js | Bin 2086 -> 0 bytes .../static/js/17.44e90ef82ee2ef12dc3f.js.map | Bin 113 -> 0 bytes priv/static/static/js/17.4ddba89b4f8c284f6392.js | Bin 0 -> 2086 bytes .../static/js/17.4ddba89b4f8c284f6392.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.990b88b57bf3a6809098.js | Bin 0 -> 29064 bytes .../static/js/18.990b88b57bf3a6809098.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.9a5b877f94b2b53065e1.js | Bin 28773 -> 0 bytes .../static/js/18.9a5b877f94b2b53065e1.js.map | Bin 113 -> 0 bytes priv/static/static/js/19.1fd4da643df0abf89122.js | Bin 31472 -> 0 bytes .../static/js/19.1fd4da643df0abf89122.js.map | Bin 113 -> 0 bytes priv/static/static/js/19.783715f17e3f98e8898e.js | Bin 0 -> 31472 bytes .../static/js/19.783715f17e3f98e8898e.js.map | Bin 0 -> 113 bytes priv/static/static/js/2.422e6c756ac673a6fd44.js | Bin 181862 -> 0 bytes .../static/static/js/2.422e6c756ac673a6fd44.js.map | Bin 472558 -> 0 bytes priv/static/static/js/2.88fa7ac80b2020ac2b46.js | Bin 0 -> 182214 bytes .../static/static/js/2.88fa7ac80b2020ac2b46.js.map | Bin 0 -> 473015 bytes priv/static/static/js/20.96c40f6c9db8c08633bd.js | Bin 0 -> 26280 bytes .../static/js/20.96c40f6c9db8c08633bd.js.map | Bin 0 -> 113 bytes priv/static/static/js/20.a64fd29da59076399a27.js | Bin 26280 -> 0 bytes .../static/js/20.a64fd29da59076399a27.js.map | Bin 113 -> 0 bytes priv/static/static/js/21.243d9e6ebf469a2dc740.js | Bin 13162 -> 0 bytes .../static/js/21.243d9e6ebf469a2dc740.js.map | Bin 113 -> 0 bytes priv/static/static/js/21.5a9f8e39a7833c1aa117.js | Bin 0 -> 13162 bytes .../static/js/21.5a9f8e39a7833c1aa117.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.d65671b9e5e00a0eb625.js | Bin 0 -> 19706 bytes .../static/js/22.d65671b9e5e00a0eb625.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.e20ef7e5fefc0964cdd1.js | Bin 19706 -> 0 bytes .../static/js/22.e20ef7e5fefc0964cdd1.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.614a35f9ded445292f4a.js | Bin 27669 -> 0 bytes .../static/js/23.614a35f9ded445292f4a.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.bf697d60801d277815e0.js | Bin 0 -> 27669 bytes .../static/js/23.bf697d60801d277815e0.js.map | Bin 0 -> 113 bytes priv/static/static/js/24.6ae9ca51e51e023afbe4.js | Bin 18493 -> 0 bytes .../static/js/24.6ae9ca51e51e023afbe4.js.map | Bin 113 -> 0 bytes priv/static/static/js/24.914e51bfcfc620a93c0e.js | Bin 0 -> 18493 bytes .../static/js/24.914e51bfcfc620a93c0e.js.map | Bin 0 -> 113 bytes priv/static/static/js/25.eadae0d48ee5be52a16c.js | Bin 29722 -> 0 bytes .../static/js/25.eadae0d48ee5be52a16c.js.map | Bin 113 -> 0 bytes priv/static/static/js/25.fa8acda1a0ba7de2ab58.js | Bin 0 -> 29996 bytes .../static/js/25.fa8acda1a0ba7de2ab58.js.map | Bin 0 -> 113 bytes priv/static/static/js/26.5233739c17e00ab514f7.js | Bin 0 -> 14249 bytes .../static/js/26.5233739c17e00ab514f7.js.map | Bin 0 -> 113 bytes priv/static/static/js/26.8fd0027b982c4bcdc88f.js | Bin 14249 -> 0 bytes .../static/js/26.8fd0027b982c4bcdc88f.js.map | Bin 113 -> 0 bytes priv/static/static/js/27.6d90a54efba08d261d69.js | Bin 2022 -> 0 bytes .../static/js/27.6d90a54efba08d261d69.js.map | Bin 113 -> 0 bytes priv/static/static/js/27.79a2337abb067d8a36ce.js | Bin 0 -> 2022 bytes .../static/js/27.79a2337abb067d8a36ce.js.map | Bin 0 -> 113 bytes priv/static/static/js/28.ed355decbad274c26485.js | Bin 0 -> 35421 bytes .../static/js/28.ed355decbad274c26485.js.map | Bin 0 -> 113 bytes priv/static/static/js/28.f1353aa382a104262d1a.js | Bin 25311 -> 0 bytes .../static/js/28.f1353aa382a104262d1a.js.map | Bin 113 -> 0 bytes priv/static/static/js/29.39c1e87a689c840395b2.js | Bin 23857 -> 0 bytes .../static/js/29.39c1e87a689c840395b2.js.map | Bin 113 -> 0 bytes priv/static/static/js/29.d3d8f3c066d579644c9a.js | Bin 0 -> 23857 bytes .../static/js/29.d3d8f3c066d579644c9a.js.map | Bin 0 -> 113 bytes priv/static/static/js/3.0b1cb0c49b906b834801.js | Bin 0 -> 78760 bytes .../static/static/js/3.0b1cb0c49b906b834801.js.map | Bin 0 -> 332972 bytes priv/static/static/js/3.a0df8a5bcd120d1f8581.js | Bin 78760 -> 0 bytes .../static/static/js/3.a0df8a5bcd120d1f8581.js.map | Bin 332972 -> 0 bytes priv/static/static/js/30.04694ca04ca2fb3b9695.js | Bin 0 -> 44101 bytes .../static/js/30.04694ca04ca2fb3b9695.js.map | Bin 0 -> 113 bytes priv/static/static/js/30.64736585965c63c2b5d4.js | Bin 26563 -> 0 bytes .../static/js/30.64736585965c63c2b5d4.js.map | Bin 113 -> 0 bytes priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js | Bin 0 -> 26981 bytes .../static/js/31.ef44f6a2b08f7f78dd8e.js.map | Bin 0 -> 113 bytes priv/static/static/js/32.044555dd7095261d9faf.js | Bin 0 -> 25909 bytes .../static/js/32.044555dd7095261d9faf.js.map | Bin 0 -> 113 bytes priv/static/static/js/4.15e71ac865c2606c30a6.js | Bin 0 -> 2177 bytes .../static/static/js/4.15e71ac865c2606c30a6.js.map | Bin 0 -> 7940 bytes priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js | Bin 2177 -> 0 bytes .../static/static/js/4.4cde7fdd1fe6bf2a9499.js.map | Bin 7940 -> 0 bytes priv/static/static/js/5.2e165bc072548e533dd4.js | Bin 6994 -> 0 bytes .../static/static/js/5.2e165bc072548e533dd4.js.map | Bin 112 -> 0 bytes priv/static/static/js/5.e116ac5b71f5e62029a1.js | Bin 0 -> 6994 bytes .../static/static/js/5.e116ac5b71f5e62029a1.js.map | Bin 0 -> 112 bytes priv/static/static/js/6.260ccd84f8cd2af27970.js | Bin 13285 -> 0 bytes .../static/static/js/6.260ccd84f8cd2af27970.js.map | Bin 112 -> 0 bytes priv/static/static/js/6.4e804674e0bff336a51b.js | Bin 0 -> 13285 bytes .../static/static/js/6.4e804674e0bff336a51b.js.map | Bin 0 -> 112 bytes priv/static/static/js/7.1c41eff6cfc75a00bde4.js | Bin 15617 -> 0 bytes .../static/static/js/7.1c41eff6cfc75a00bde4.js.map | Bin 112 -> 0 bytes priv/static/static/js/7.e8595e0b6e063c6d9478.js | Bin 0 -> 15617 bytes .../static/static/js/7.e8595e0b6e063c6d9478.js.map | Bin 0 -> 112 bytes priv/static/static/js/8.2d08c6fbb6b6ef23752f.js | Bin 0 -> 21604 bytes .../static/static/js/8.2d08c6fbb6b6ef23752f.js.map | Bin 0 -> 112 bytes priv/static/static/js/8.9b35c2fee24ab7481e00.js | Bin 21604 -> 0 bytes .../static/static/js/8.9b35c2fee24ab7481e00.js.map | Bin 112 -> 0 bytes priv/static/static/js/9.3a29094f1886648a0af3.js | Bin 28533 -> 0 bytes .../static/static/js/9.3a29094f1886648a0af3.js.map | Bin 112 -> 0 bytes priv/static/static/js/9.7d9dd95c4a1c9aa47453.js | Bin 0 -> 28695 bytes .../static/static/js/9.7d9dd95c4a1c9aa47453.js.map | Bin 0 -> 112 bytes priv/static/static/js/app.45547c05212c403dd77c.js | Bin 597299 -> 0 bytes .../static/js/app.45547c05212c403dd77c.js.map | Bin 1546929 -> 0 bytes priv/static/static/js/app.eb8f7164fc75862a251d.js | Bin 0 -> 605400 bytes .../static/js/app.eb8f7164fc75862a251d.js.map | Bin 0 -> 1560791 bytes .../static/js/vendors~app.54838a79dee084ec3dad.js | Bin 0 -> 375539 bytes .../js/vendors~app.54838a79dee084ec3dad.js.map | Bin 0 -> 2277783 bytes .../static/js/vendors~app.952124344a84613dbac0.js | Bin 372654 -> 0 bytes .../js/vendors~app.952124344a84613dbac0.js.map | Bin 2260530 -> 0 bytes priv/static/static/themes/redmond-xx-se.json | 1 + priv/static/static/themes/redmond-xx.json | 1 + priv/static/static/themes/redmond-xxi.json | 1 + priv/static/sw-pleroma.js | Bin 181634 -> 184690 bytes priv/static/sw-pleroma.js.map | Bin 696420 -> 714735 bytes 135 files changed, 1434 insertions(+), 969 deletions(-) delete mode 100644 priv/static/static/js/10.46f441b948010eda4403.js delete mode 100644 priv/static/static/js/10.46f441b948010eda4403.js.map create mode 100644 priv/static/static/js/10.a11a612e4c1ef51ded17.js create mode 100644 priv/static/static/js/10.a11a612e4c1ef51ded17.js.map create mode 100644 priv/static/static/js/11.22872a1f83121e70a148.js create mode 100644 priv/static/static/js/11.22872a1f83121e70a148.js.map delete mode 100644 priv/static/static/js/11.8ff1ed54814f2d34cb3e.js delete mode 100644 priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map delete mode 100644 priv/static/static/js/12.13204bdd0ad5703a3ea3.js delete mode 100644 priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map create mode 100644 priv/static/static/js/12.c6df5166dc6cdcf749e5.js create mode 100644 priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map create mode 100644 priv/static/static/js/13.77214c18c6d2a9865281.js create mode 100644 priv/static/static/js/13.77214c18c6d2a9865281.js.map delete mode 100644 priv/static/static/js/13.e27c3eeddcc4b11c1f54.js delete mode 100644 priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map delete mode 100644 priv/static/static/js/14.273855b3e4e27ce80219.js delete mode 100644 priv/static/static/js/14.273855b3e4e27ce80219.js.map create mode 100644 priv/static/static/js/14.e560f5e2f902b9ad2d0d.js create mode 100644 priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map create mode 100644 priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js create mode 100644 priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map delete mode 100644 priv/static/static/js/15.afbe29b6665fcd015b2d.js delete mode 100644 priv/static/static/js/15.afbe29b6665fcd015b2d.js.map delete mode 100644 priv/static/static/js/16.5e3f20da470591d0cabf.js delete mode 100644 priv/static/static/js/16.5e3f20da470591d0cabf.js.map create mode 100644 priv/static/static/js/16.be7f4b788716bec25023.js create mode 100644 priv/static/static/js/16.be7f4b788716bec25023.js.map delete mode 100644 priv/static/static/js/17.44e90ef82ee2ef12dc3f.js delete mode 100644 priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map create mode 100644 priv/static/static/js/17.4ddba89b4f8c284f6392.js create mode 100644 priv/static/static/js/17.4ddba89b4f8c284f6392.js.map create mode 100644 priv/static/static/js/18.990b88b57bf3a6809098.js create mode 100644 priv/static/static/js/18.990b88b57bf3a6809098.js.map delete mode 100644 priv/static/static/js/18.9a5b877f94b2b53065e1.js delete mode 100644 priv/static/static/js/18.9a5b877f94b2b53065e1.js.map delete mode 100644 priv/static/static/js/19.1fd4da643df0abf89122.js delete mode 100644 priv/static/static/js/19.1fd4da643df0abf89122.js.map create mode 100644 priv/static/static/js/19.783715f17e3f98e8898e.js create mode 100644 priv/static/static/js/19.783715f17e3f98e8898e.js.map delete mode 100644 priv/static/static/js/2.422e6c756ac673a6fd44.js delete mode 100644 priv/static/static/js/2.422e6c756ac673a6fd44.js.map create mode 100644 priv/static/static/js/2.88fa7ac80b2020ac2b46.js create mode 100644 priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map create mode 100644 priv/static/static/js/20.96c40f6c9db8c08633bd.js create mode 100644 priv/static/static/js/20.96c40f6c9db8c08633bd.js.map delete mode 100644 priv/static/static/js/20.a64fd29da59076399a27.js delete mode 100644 priv/static/static/js/20.a64fd29da59076399a27.js.map delete mode 100644 priv/static/static/js/21.243d9e6ebf469a2dc740.js delete mode 100644 priv/static/static/js/21.243d9e6ebf469a2dc740.js.map create mode 100644 priv/static/static/js/21.5a9f8e39a7833c1aa117.js create mode 100644 priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map create mode 100644 priv/static/static/js/22.d65671b9e5e00a0eb625.js create mode 100644 priv/static/static/js/22.d65671b9e5e00a0eb625.js.map delete mode 100644 priv/static/static/js/22.e20ef7e5fefc0964cdd1.js delete mode 100644 priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map delete mode 100644 priv/static/static/js/23.614a35f9ded445292f4a.js delete mode 100644 priv/static/static/js/23.614a35f9ded445292f4a.js.map create mode 100644 priv/static/static/js/23.bf697d60801d277815e0.js create mode 100644 priv/static/static/js/23.bf697d60801d277815e0.js.map delete mode 100644 priv/static/static/js/24.6ae9ca51e51e023afbe4.js delete mode 100644 priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map create mode 100644 priv/static/static/js/24.914e51bfcfc620a93c0e.js create mode 100644 priv/static/static/js/24.914e51bfcfc620a93c0e.js.map delete mode 100644 priv/static/static/js/25.eadae0d48ee5be52a16c.js delete mode 100644 priv/static/static/js/25.eadae0d48ee5be52a16c.js.map create mode 100644 priv/static/static/js/25.fa8acda1a0ba7de2ab58.js create mode 100644 priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map create mode 100644 priv/static/static/js/26.5233739c17e00ab514f7.js create mode 100644 priv/static/static/js/26.5233739c17e00ab514f7.js.map delete mode 100644 priv/static/static/js/26.8fd0027b982c4bcdc88f.js delete mode 100644 priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map delete mode 100644 priv/static/static/js/27.6d90a54efba08d261d69.js delete mode 100644 priv/static/static/js/27.6d90a54efba08d261d69.js.map create mode 100644 priv/static/static/js/27.79a2337abb067d8a36ce.js create mode 100644 priv/static/static/js/27.79a2337abb067d8a36ce.js.map create mode 100644 priv/static/static/js/28.ed355decbad274c26485.js create mode 100644 priv/static/static/js/28.ed355decbad274c26485.js.map delete mode 100644 priv/static/static/js/28.f1353aa382a104262d1a.js delete mode 100644 priv/static/static/js/28.f1353aa382a104262d1a.js.map delete mode 100644 priv/static/static/js/29.39c1e87a689c840395b2.js delete mode 100644 priv/static/static/js/29.39c1e87a689c840395b2.js.map create mode 100644 priv/static/static/js/29.d3d8f3c066d579644c9a.js create mode 100644 priv/static/static/js/29.d3d8f3c066d579644c9a.js.map create mode 100644 priv/static/static/js/3.0b1cb0c49b906b834801.js create mode 100644 priv/static/static/js/3.0b1cb0c49b906b834801.js.map delete mode 100644 priv/static/static/js/3.a0df8a5bcd120d1f8581.js delete mode 100644 priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map create mode 100644 priv/static/static/js/30.04694ca04ca2fb3b9695.js create mode 100644 priv/static/static/js/30.04694ca04ca2fb3b9695.js.map delete mode 100644 priv/static/static/js/30.64736585965c63c2b5d4.js delete mode 100644 priv/static/static/js/30.64736585965c63c2b5d4.js.map create mode 100644 priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js create mode 100644 priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map create mode 100644 priv/static/static/js/32.044555dd7095261d9faf.js create mode 100644 priv/static/static/js/32.044555dd7095261d9faf.js.map create mode 100644 priv/static/static/js/4.15e71ac865c2606c30a6.js create mode 100644 priv/static/static/js/4.15e71ac865c2606c30a6.js.map delete mode 100644 priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js delete mode 100644 priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map delete mode 100644 priv/static/static/js/5.2e165bc072548e533dd4.js delete mode 100644 priv/static/static/js/5.2e165bc072548e533dd4.js.map create mode 100644 priv/static/static/js/5.e116ac5b71f5e62029a1.js create mode 100644 priv/static/static/js/5.e116ac5b71f5e62029a1.js.map delete mode 100644 priv/static/static/js/6.260ccd84f8cd2af27970.js delete mode 100644 priv/static/static/js/6.260ccd84f8cd2af27970.js.map create mode 100644 priv/static/static/js/6.4e804674e0bff336a51b.js create mode 100644 priv/static/static/js/6.4e804674e0bff336a51b.js.map delete mode 100644 priv/static/static/js/7.1c41eff6cfc75a00bde4.js delete mode 100644 priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map create mode 100644 priv/static/static/js/7.e8595e0b6e063c6d9478.js create mode 100644 priv/static/static/js/7.e8595e0b6e063c6d9478.js.map create mode 100644 priv/static/static/js/8.2d08c6fbb6b6ef23752f.js create mode 100644 priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map delete mode 100644 priv/static/static/js/8.9b35c2fee24ab7481e00.js delete mode 100644 priv/static/static/js/8.9b35c2fee24ab7481e00.js.map delete mode 100644 priv/static/static/js/9.3a29094f1886648a0af3.js delete mode 100644 priv/static/static/js/9.3a29094f1886648a0af3.js.map create mode 100644 priv/static/static/js/9.7d9dd95c4a1c9aa47453.js create mode 100644 priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map delete mode 100644 priv/static/static/js/app.45547c05212c403dd77c.js delete mode 100644 priv/static/static/js/app.45547c05212c403dd77c.js.map create mode 100644 priv/static/static/js/app.eb8f7164fc75862a251d.js create mode 100644 priv/static/static/js/app.eb8f7164fc75862a251d.js.map create mode 100644 priv/static/static/js/vendors~app.54838a79dee084ec3dad.js create mode 100644 priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map delete mode 100644 priv/static/static/js/vendors~app.952124344a84613dbac0.js delete mode 100644 priv/static/static/js/vendors~app.952124344a84613dbac0.js.map diff --git a/priv/static/index.html b/priv/static/index.html index 9b774959a..c4dcf5d37 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -1 +1 @@ -Pleroma
\ No newline at end of file +
\ No newline at end of file diff --git a/priv/static/static/emoji.json b/priv/static/static/emoji.json index ae93d17e1..12b91b3f6 100644 --- a/priv/static/static/emoji.json +++ b/priv/static/static/emoji.json @@ -1,969 +1,1431 @@ { - "womans_clothes": "\ud83d\udc5a", - "cookie": "\ud83c\udf6a", - "woman_with_headscarf": "\ud83e\uddd5", - "no_smoking": "\ud83d\udead", - "e-mail": "\ud83d\udce7", - "regional_indicator_d": "\ud83c\udde9", - "oncoming_bus": "\ud83d\ude8d", - "knife": "\ud83d\udd2a", - "person_getting_haircut": "\ud83d\udc87", - "grimacing": "\ud83d\ude2c", - "ophiuchus": "\u26ce", - "regional_indicator_q": "\ud83c\uddf6", - "thinking": "\ud83e\udd14", - "signal_strength": "\ud83d\udcf6", - "cactus": "\ud83c\udf35", - "bullettrain_front": "\ud83d\ude85", - "floppy_disk": "\ud83d\udcbe", - "doughnut": "\ud83c\udf69", - "tv": "\ud83d\udcfa", - "1234": "\ud83d\udd22", - "anguished": "\ud83d\ude27", - "clock1030": "\ud83d\udd65", - "u7533": "\ud83c\ude38", - "speak_no_evil": "\ud83d\ude4a", - "chart_with_upwards_trend": "\ud83d\udcc8", - "trophy": "\ud83c\udfc6", - "musical_score": "\ud83c\udfbc", - "chestnut": "\ud83c\udf30", - "clock1130": "\ud83d\udd66", - "abcd": "\ud83d\udd21", - "syringe": "\ud83d\udc89", - "shrimp": "\ud83e\udd90", - "pisces": "\u2653", - "left_facing_fist": "\ud83e\udd1b", - "bar_chart": "\ud83d\udcca", - "eagle": "\ud83e\udd85", - "woman": "\ud83d\udc69", - "keycap_ten": "\ud83d\udd1f", - "yellow_heart": "\ud83d\udc9b", - "croissant": "\ud83e\udd50", - "mosque": "\ud83d\udd4c", - "rice_ball": "\ud83c\udf59", - "volcano": "\ud83c\udf0b", - "baggage_claim": "\ud83d\udec4", - "family": "\ud83d\udc6a", - "beetle": "\ud83d\udc1e", - "older_adult": "\ud83e\uddd3", - "clock830": "\ud83d\udd63", - "bacon": "\ud83e\udd53", - "sound": "\ud83d\udd09", - "no_bicycles": "\ud83d\udeb3", - "rewind": "\u23ea", - "adult": "\ud83e\uddd1", - "scream_cat": "\ud83d\ude40", - "person_playing_water_polo": "\ud83e\udd3d", - "blue_car": "\ud83d\ude99", - "smiley": "\ud83d\ude03", - "kaaba": "\ud83d\udd4b", - "twisted_rightwards_arrows": "\ud83d\udd00", - "last_quarter_moon": "\ud83c\udf17", - "first_place": "\ud83e\udd47", - "joy_cat": "\ud83d\ude39", - "sleeping": "\ud83d\ude34", - "basketball": "\ud83c\udfc0", - "pray": "\ud83d\ude4f", - "trumpet": "\ud83c\udfba", - "purple_heart": "\ud83d\udc9c", - "broken_heart": "\ud83d\udc94", - "astonished": "\ud83d\ude32", - "soccer": "\u26bd", - "princess": "\ud83d\udc78", - "ant": "\ud83d\udc1c", - "pig": "\ud83d\udc37", - "vhs": "\ud83d\udcfc", - "scream": "\ud83d\ude31", - "mouse": "\ud83d\udc2d", - "field_hockey": "\ud83c\udfd1", - "ab": "\ud83c\udd8e", - "tokyo_tower": "\ud83d\uddfc", - "girl": "\ud83d\udc67", - "u55b6": "\ud83c\ude3a", - "guard": "\ud83d\udc82", - "regional_indicator_s": "\ud83c\uddf8", - "tulip": "\ud83c\udf37", - "capital_abcd": "\ud83d\udd20", - "beginner": "\ud83d\udd30", - "couplekiss": "\ud83d\udc8f", - "u5408": "\ud83c\ude34", - "black_medium_small_square": "\u25fe", - "paperclip": "\ud83d\udcce", - "hedgehog": "\ud83e\udd94", - "musical_note": "\ud83c\udfb5", - "pill": "\ud83d\udc8a", - "blue_heart": "\ud83d\udc99", - "mens": "\ud83d\udeb9", - "third_place": "\ud83e\udd49", - "stew": "\ud83c\udf72", - "prince": "\ud83e\udd34", - "mortar_board": "\ud83c\udf93", - "clock6": "\ud83d\udd55", - "beer": "\ud83c\udf7a", - "person_tipping_hand": "\ud83d\udc81", - "triangular_ruler": "\ud83d\udcd0", - "regional_indicator_y": "\ud83c\uddfe", - "person_facepalming": "\ud83e\udd26", - "steam_locomotive": "\ud83d\ude82", - "fire_engine": "\ud83d\ude92", - "horse": "\ud83d\udc34", - "ribbon": "\ud83c\udf80", - "white_large_square": "\u2b1c", - "smirk": "\ud83d\ude0f", - "genie": "\ud83e\uddde", - "tangerine": "\ud83c\udf4a", - "cl": "\ud83c\udd91", - "japanese_goblin": "\ud83d\udc7a", - "regional_indicator_u": "\ud83c\uddfa", - "ring": "\ud83d\udc8d", - "roller_coaster": "\ud83c\udfa2", - "100": "\ud83d\udcaf", - "clock12": "\ud83d\udd5b", - "two_hearts": "\ud83d\udc95", - "anger": "\ud83d\udca2", - "black_circle": "\u26ab", - "revolving_hearts": "\ud83d\udc9e", - "space_invader": "\ud83d\udc7e", - "bell": "\ud83d\udd14", - "point_up_2": "\ud83d\udc46", - "person_mountain_biking": "\ud83d\udeb5", - "flags": "\ud83c\udf8f", - "pushpin": "\ud83d\udccc", - "large_blue_diamond": "\ud83d\udd37", - "fairy": "\ud83e\uddda", - "european_post_office": "\ud83c\udfe4", - "statue_of_liberty": "\ud83d\uddfd", - "man": "\ud83d\udc68", - "microphone": "\ud83c\udfa4", - "inbox_tray": "\ud83d\udce5", - "bath": "\ud83d\udec0", - "person_gesturing_ok": "\ud83d\ude46", - "clap": "\ud83d\udc4f", - "confused": "\ud83d\ude15", - "fortune_cookie": "\ud83e\udd60", - "kissing_closed_eyes": "\ud83d\ude1a", - "kissing_heart": "\ud83d\ude18", - "tropical_fish": "\ud83d\udc20", - "taco": "\ud83c\udf2e", - "kimono": "\ud83d\udc58", - "u7a7a": "\ud83c\ude33", - "rat": "\ud83d\udc00", - "taurus": "\u2649", - "shopping_cart": "\ud83d\uded2", - "womans_hat": "\ud83d\udc52", - "blossom": "\ud83c\udf3c", - "moyai": "\ud83d\uddff", - "clock130": "\ud83d\udd5c", - "telescope": "\ud83d\udd2d", - "running_shirt_with_sash": "\ud83c\udfbd", - "person_running": "\ud83c\udfc3", - "dizzy": "\ud83d\udcab", - "crescent_moon": "\ud83c\udf19", - "boom": "\ud83d\udca5", - "restroom": "\ud83d\udebb", - "fist": "\u270a", - "white_flower": "\ud83d\udcae", - "clown": "\ud83e\udd21", - "neutral_face": "\ud83d\ude10", - "id": "\ud83c\udd94", - "carrot": "\ud83e\udd55", - "rice_scene": "\ud83c\udf91", - "foggy": "\ud83c\udf01", - "turtle": "\ud83d\udc22", - "mailbox_with_mail": "\ud83d\udcec", - "baseball": "\u26be", - "grin": "\ud83d\ude01", - "bathtub": "\ud83d\udec1", - "feet": "\ud83d\udc3e", - "small_red_triangle": "\ud83d\udd3a", - "camel": "\ud83d\udc2b", - "aquarius": "\u2652", - "face_with_symbols_over_mouth": "\ud83e\udd2c", - "handbag": "\ud83d\udc5c", - "date": "\ud83d\udcc5", - "nail_care": "\ud83d\udc85", - "satellite": "\ud83d\udce1", - "candy": "\ud83c\udf6c", - "white_medium_small_square": "\u25fd", - "clock930": "\ud83d\udd64", - "fearful": "\ud83d\ude28", - "fork_and_knife": "\ud83c\udf74", - "person_wearing_turban": "\ud83d\udc73", - "confounded": "\ud83d\ude16", - "helicopter": "\ud83d\ude81", - "arrow_double_down": "\u23ec", - "convenience_store": "\ud83c\udfea", - "ghost": "\ud83d\udc7b", - "bus": "\ud83d\ude8c", - "waning_gibbous_moon": "\ud83c\udf16", - "bank": "\ud83c\udfe6", - "department_store": "\ud83c\udfec", - "hockey": "\ud83c\udfd2", - "fingers_crossed": "\ud83e\udd1e", - "blond_haired_person": "\ud83d\udc71", - "mag": "\ud83d\udd0d", - "cut_of_meat": "\ud83e\udd69", - "wink": "\ud83d\ude09", - "railway_car": "\ud83d\ude83", - "face_vomiting": "\ud83e\udd2e", - "star_struck": "\ud83e\udd29", - "first_quarter_moon_with_face": "\ud83c\udf1b", - "octagonal_sign": "\ud83d\uded1", - "hospital": "\ud83c\udfe5", - "monkey": "\ud83d\udc12", - "curly_loop": "\u27b0", - "avocado": "\ud83e\udd51", - "earth_americas": "\ud83c\udf0e", - "flashlight": "\ud83d\udd26", - "8ball": "\ud83c\udfb1", - "clock630": "\ud83d\udd61", - "boar": "\ud83d\udc17", - "birthday": "\ud83c\udf82", - "crocodile": "\ud83d\udc0a", - "confetti_ball": "\ud83c\udf8a", - "door": "\ud83d\udeaa", - "school_satchel": "\ud83c\udf92", - "peanuts": "\ud83e\udd5c", - "regional_indicator_m": "\ud83c\uddf2", - "bust_in_silhouette": "\ud83d\udc64", - "sweat_drops": "\ud83d\udca6", - "tongue": "\ud83d\udc45", - "mag_right": "\ud83d\udd0e", - "t_rex": "\ud83e\udd96", - "post_office": "\ud83c\udfe3", - "shell": "\ud83d\udc1a", - "disappointed_relieved": "\ud83d\ude25", - "card_index": "\ud83d\udcc7", - "oncoming_automobile": "\ud83d\ude98", - "passport_control": "\ud83d\udec2", - "cherry_blossom": "\ud83c\udf38", - "shallow_pan_of_food": "\ud83e\udd58", - "heart": "\u2764\ufe0f", - "heartbeat": "\ud83d\udc93", - "crazy_face": "\ud83e\udd2a", - "grapes": "\ud83c\udf47", - "symbols": "\ud83d\udd23", - "gift": "\ud83c\udf81", - "scorpion": "\ud83e\udd82", - "wedding": "\ud83d\udc92", - "last_quarter_moon_with_face": "\ud83c\udf1c", - "love_letter": "\ud83d\udc8c", - "postal_horn": "\ud83d\udcef", - "stuffed_flatbread": "\ud83e\udd59", - "heavy_dollar_sign": "\ud83d\udcb2", - "love_hotel": "\ud83c\udfe9", - "yen": "\ud83d\udcb4", - "person_in_steamy_room": "\ud83e\uddd6", - "palm_tree": "\ud83c\udf34", - "name_badge": "\ud83d\udcdb", - "clock430": "\ud83d\udd5f", - "bike": "\ud83d\udeb2", - "snail": "\ud83d\udc0c", - "bowling": "\ud83c\udfb3", - "umbrella": "\u2614", - "sleeping_accommodation": "\ud83d\udecc", - "fireworks": "\ud83c\udf86", - "closed_book": "\ud83d\udcd5", - "city_sunset": "\ud83c\udf07", - "persevere": "\ud83d\ude23", - "bento": "\ud83c\udf71", - "nut_and_bolt": "\ud83d\udd29", - "page_facing_up": "\ud83d\udcc4", - "snowman": "\u26c4", - "two_women_holding_hands": "\ud83d\udc6d", - "regional_indicator_o": "\ud83c\uddf4", - "calling": "\ud83d\udcf2", - "person_shrugging": "\ud83e\udd37", - "sneezing_face": "\ud83e\udd27", - "arrows_clockwise": "\ud83d\udd03", - "no_pedestrians": "\ud83d\udeb7", - "potato": "\ud83e\udd54", - "cheese": "\ud83e\uddc0", - "full_moon": "\ud83c\udf15", - "mount_fuji": "\ud83d\uddfb", - "sob": "\ud83d\ude2d", - "construction": "\ud83d\udea7", - "head_bandage": "\ud83e\udd15", - "sailboat": "\u26f5", - "slight_frown": "\ud83d\ude41", - "ping_pong": "\ud83c\udfd3", - "hatched_chick": "\ud83d\udc25", - "sun_with_face": "\ud83c\udf1e", - "seedling": "\ud83c\udf31", - "repeat_one": "\ud83d\udd02", - "muscle": "\ud83d\udcaa", - "bridge_at_night": "\ud83c\udf09", - "raised_hands": "\ud83d\ude4c", - "house": "\ud83c\udfe0", - "nerd": "\ud83e\udd13", - "penguin": "\ud83d\udc27", - "peach": "\ud83c\udf51", - "dumpling": "\ud83e\udd5f", - "watch": "\u231a", - "womens": "\ud83d\udeba", - "round_pushpin": "\ud83d\udccd", - "alarm_clock": "\u23f0", - "relieved": "\ud83d\ude0c", - "sagittarius": "\u2650", - "busstop": "\ud83d\ude8f", - "regional_indicator_a": "\ud83c\udde6", - "sandal": "\ud83d\udc61", - "whale2": "\ud83d\udc0b", - "book": "\ud83d\udcd6", - "sweat": "\ud83d\ude13", - "movie_camera": "\ud83c\udfa5", - "clock230": "\ud83d\udd5d", - "tiger": "\ud83d\udc2f", - "tractor": "\ud83d\ude9c", - "smile": "\ud83d\ude04", - "vertical_traffic_light": "\ud83d\udea6", - "exploding_head": "\ud83e\udd2f", - "raised_hand": "\u270b", - "smoking": "\ud83d\udeac", - "page_with_curl": "\ud83d\udcc3", - "exclamation": "\u2757", - "fish": "\ud83d\udc1f", - "mans_shoe": "\ud83d\udc5e", - "sos": "\ud83c\udd98", - "unlock": "\ud83d\udd13", - "dolls": "\ud83c\udf8e", - "ear_of_rice": "\ud83c\udf3e", - "cat2": "\ud83d\udc08", - "u7121": "\ud83c\ude1a", - "repeat": "\ud83d\udd01", - "cool": "\ud83c\udd92", - "minibus": "\ud83d\ude90", - "aerial_tramway": "\ud83d\udea1", - "key": "\ud83d\udd11", - "child": "\ud83e\uddd2", - "camera": "\ud83d\udcf7", - "sunflower": "\ud83c\udf3b", - "white_check_mark": "\u2705", - "white_square_button": "\ud83d\udd33", - "banana": "\ud83c\udf4c", - "milky_way": "\ud83c\udf0c", - "person_gesturing_no": "\ud83d\ude45", - "sushi": "\ud83c\udf63", - "heart_eyes_cat": "\ud83d\ude3b", - "guitar": "\ud83c\udfb8", - "pie": "\ud83e\udd67", - "calendar": "\ud83d\udcc6", - "bear": "\ud83d\udc3b", - "person_in_lotus_position": "\ud83e\uddd8", - "clock10": "\ud83d\udd59", - "top": "\ud83d\udd1d", - "fuelpump": "\u26fd", - "rainbow": "\ud83c\udf08", - "snowboarder": "\ud83c\udfc2", - "drum": "\ud83e\udd41", - "leaves": "\ud83c\udf43", - "first_quarter_moon": "\ud83c\udf13", - "spoon": "\ud83e\udd44", - "pouting_cat": "\ud83d\ude3e", - "shaved_ice": "\ud83c\udf67", - "unamused": "\ud83d\ude12", - "train2": "\ud83d\ude86", - "clock1230": "\ud83d\udd67", - "regional_indicator_r": "\ud83c\uddf7", - "fast_forward": "\u23e9", - "accept": "\ud83c\ude51", - "hammer": "\ud83d\udd28", - "panda_face": "\ud83d\udc3c", - "briefcase": "\ud83d\udcbc", - "package": "\ud83d\udce6", - "flag_black": "\ud83c\udff4", - "smiling_imp": "\ud83d\ude08", - "sunrise_over_mountains": "\ud83c\udf04", - "airplane_departure": "\ud83d\udeeb", - "tiger2": "\ud83d\udc05", - "non-potable_water": "\ud83d\udeb1", - "bird": "\ud83d\udc26", - "barber": "\ud83d\udc88", - "cry": "\ud83d\ude22", - "billed_cap": "\ud83e\udde2", - "pouch": "\ud83d\udc5d", - "link": "\ud83d\udd17", - "zebra": "\ud83e\udd93", - "kiss": "\ud83d\udc8b", - "scorpius": "\u264f", - "prayer_beads": "\ud83d\udcff", - "high_brightness": "\ud83d\udd06", - "kissing_smiling_eyes": "\ud83d\ude19", - "rhino": "\ud83e\udd8f", - "left_luggage": "\ud83d\udec5", - "o": "\u2b55", - "crying_cat_face": "\ud83d\ude3f", - "clock8": "\ud83d\udd57", - "dress": "\ud83d\udc57", - "clock7": "\ud83d\udd56", - "bowl_with_spoon": "\ud83e\udd63", - "rolling_eyes": "\ud83d\ude44", - "fax": "\ud83d\udce0", - "worried": "\ud83d\ude1f", - "grey_question": "\u2754", - "saxophone": "\ud83c\udfb7", - "burrito": "\ud83c\udf2f", - "salad": "\ud83e\udd57", - "regional_indicator_z": "\ud83c\uddff", - "bikini": "\ud83d\udc59", - "milk": "\ud83e\udd5b", - "stars": "\ud83c\udf20", - "lips": "\ud83d\udc44", - "cd": "\ud83d\udcbf", - "weary": "\ud83d\ude29", - "face_with_raised_eyebrow": "\ud83e\udd28", - "lizard": "\ud83e\udd8e", - "tone1": "\ud83c\udffb", - "bullettrain_side": "\ud83d\ude84", - "nose": "\ud83d\udc43", - "innocent": "\ud83d\ude07", - "wilted_rose": "\ud83e\udd40", - "mahjong": "\ud83c\udc04", - "factory": "\ud83c\udfed", - "people_wrestling": "\ud83e\udd3c", - "mailbox": "\ud83d\udceb", - "rage": "\ud83d\ude21", - "wheelchair": "\u267f", - "x": "\u274c", - "flower_playing_cards": "\ud83c\udfb4", - "nauseated_face": "\ud83e\udd22", - "underage": "\ud83d\udd1e", - "ideograph_advantage": "\ud83c\ude50", - "high_heel": "\ud83d\udc60", - "dizzy_face": "\ud83d\ude35", - "stuck_out_tongue": "\ud83d\ude1b", - "mailbox_with_no_mail": "\ud83d\udced", - "orange_heart": "\ud83e\udde1", - "raised_back_of_hand": "\ud83e\udd1a", - "footprints": "\ud83d\udc63", - "notebook_with_decorative_cover": "\ud83d\udcd4", - "mask": "\ud83d\ude37", - "sunglasses": "\ud83d\ude0e", - "pancakes": "\ud83e\udd5e", - "regional_indicator_f": "\ud83c\uddeb", - "dog": "\ud83d\udc36", - "pig2": "\ud83d\udc16", - "ng": "\ud83c\udd96", - "unicorn": "\ud83e\udd84", - "triumph": "\ud83d\ude24", - "eggplant": "\ud83c\udf46", - "egg": "\ud83e\udd5a", - "office": "\ud83c\udfe2", - "goat": "\ud83d\udc10", - "handshake": "\ud83e\udd1d", - "star": "\u2b50", - "rugby_football": "\ud83c\udfc9", - "call_me": "\ud83e\udd19", - "rice_cracker": "\ud83c\udf58", - "droplet": "\ud83d\udca7", - "badminton": "\ud83c\udff8", - "waxing_crescent_moon": "\ud83c\udf12", - "ocean": "\ud83c\udf0a", - "slot_machine": "\ud83c\udfb0", - "wine_glass": "\ud83c\udf77", - "elephant": "\ud83d\udc18", - "blowfish": "\ud83d\udc21", - "ledger": "\ud83d\udcd2", - "money_mouth": "\ud83e\udd11", - "heart_decoration": "\ud83d\udc9f", - "arrow_down_small": "\ud83d\udd3d", - "station": "\ud83d\ude89", - "man_with_chinese_cap": "\ud83d\udc72", - "vampire": "\ud83e\udddb", - "pencil": "\ud83d\udcdd", - "cyclone": "\ud83c\udf00", - "mushroom": "\ud83c\udf44", - "sandwich": "\ud83e\udd6a", - "champagne": "\ud83c\udf7e", - "expressionless": "\ud83d\ude11", - "cold_sweat": "\ud83d\ude30", - "maple_leaf": "\ud83c\udf41", - "dromedary_camel": "\ud83d\udc2a", - "vs": "\ud83c\udd9a", - "person_fencing": "\ud83e\udd3a", - "straight_ruler": "\ud83d\udccf", - "baby_bottle": "\ud83c\udf7c", - "currency_exchange": "\ud83d\udcb1", - "regional_indicator_h": "\ud83c\udded", - "stuck_out_tongue_closed_eyes": "\ud83d\ude1d", - "closed_lock_with_key": "\ud83d\udd10", - "eyes": "\ud83d\udc40", - "water_buffalo": "\ud83d\udc03", - "lock_with_ink_pen": "\ud83d\udd0f", - "heavy_plus_sign": "\u2795", - "bookmark": "\ud83d\udd16", - "soon": "\ud83d\udd1c", - "orange_book": "\ud83d\udcd9", - "pineapple": "\ud83c\udf4d", - "clock9": "\ud83d\udd58", - "small_blue_diamond": "\ud83d\udd39", - "black_large_square": "\u2b1b", - "person_surfing": "\ud83c\udfc4", - "leo": "\u264c", - "merperson": "\ud83e\udddc", - "canoe": "\ud83d\udef6", - "rooster": "\ud83d\udc13", - "hear_no_evil": "\ud83d\ude49", - "corn": "\ud83c\udf3d", - "takeout_box": "\ud83e\udd61", - "oncoming_taxi": "\ud83d\ude96", - "taxi": "\ud83d\ude95", - "chart": "\ud83d\udcb9", - "goal": "\ud83e\udd45", - "melon": "\ud83c\udf48", - "notes": "\ud83c\udfb6", - "sparkler": "\ud83c\udf87", - "dolphin": "\ud83d\udc2c", - "speedboat": "\ud83d\udea4", - "cancer": "\u264b", - "sled": "\ud83d\udef7", - "tanabata_tree": "\ud83c\udf8b", - "train": "\ud83d\ude8b", - "christmas_tree": "\ud83c\udf84", - "two_men_holding_hands": "\ud83d\udc6c", - "back": "\ud83d\udd19", - "balloon": "\ud83c\udf88", - "checkered_flag": "\ud83c\udfc1", - "loop": "\u27bf", - "wc": "\ud83d\udebe", - "jeans": "\ud83d\udc56", - "green_apple": "\ud83c\udf4f", - "crown": "\ud83d\udc51", - "cowboy": "\ud83e\udd20", - "postbox": "\ud83d\udcee", - "volleyball": "\ud83c\udfd0", - "upside_down": "\ud83d\ude43", - "cricket": "\ud83e\udd97", - "custard": "\ud83c\udf6e", - "rose": "\ud83c\udf39", - "eyeglasses": "\ud83d\udc53", - "oncoming_police_car": "\ud83d\ude94", - "atm": "\ud83c\udfe7", - "flying_saucer": "\ud83d\udef8", - "alien": "\ud83d\udc7d", - "hamster": "\ud83d\udc39", - "trident": "\ud83d\udd31", - "disappointed": "\ud83d\ude1e", - "cow": "\ud83d\udc2e", - "police_officer": "\ud83d\udc6e", - "popcorn": "\ud83c\udf7f", - "baby_chick": "\ud83d\udc24", - "video_camera": "\ud83d\udcf9", - "zzz": "\ud83d\udca4", - "person_climbing": "\ud83e\uddd7", - "star2": "\ud83c\udf1f", - "ok": "\ud83c\udd97", - "capricorn": "\u2651", - "chicken": "\ud83d\udc14", - "arrow_double_up": "\u23eb", - "zombie": "\ud83e\udddf", - "closed_umbrella": "\ud83c\udf02", - "person_walking": "\ud83d\udeb6", - "lemon": "\ud83c\udf4b", - "heartpulse": "\ud83d\udc97", - "regional_indicator_i": "\ud83c\uddee", - "sauropod": "\ud83e\udd95", - "u7981": "\ud83c\ude32", - "regional_indicator_w": "\ud83c\uddfc", - "evergreen_tree": "\ud83c\udf32", - "mobile_phone_off": "\ud83d\udcf4", - "koko": "\ud83c\ude01", - "poop": "\ud83d\udca9", - "cup_with_straw": "\ud83e\udd64", - "leopard": "\ud83d\udc06", - "radio_button": "\ud83d\udd18", - "mega": "\ud83d\udce3", - "metal": "\ud83e\udd18", - "shushing_face": "\ud83e\udd2b", - "stuck_out_tongue_winking_eye": "\ud83d\ude1c", - "octopus": "\ud83d\udc19", - "boxing_glove": "\ud83e\udd4a", - "person_juggling": "\ud83e\udd39", - "money_with_wings": "\ud83d\udcb8", - "dollar": "\ud83d\udcb5", - "bride_with_veil": "\ud83d\udc70", - "second_place": "\ud83e\udd48", - "spaghetti": "\ud83c\udf5d", - "waning_crescent_moon": "\ud83c\udf18", - "football": "\ud83c\udfc8", - "white_circle": "\u26aa", - "full_moon_with_face": "\ud83c\udf1d", - "selfie": "\ud83e\udd33", - "tone3": "\ud83c\udffd", - "rabbit": "\ud83d\udc30", - "computer": "\ud83d\udcbb", - "clock11": "\ud83d\udd5a", - "heavy_minus_sign": "\u2796", - "synagogue": "\ud83d\udd4d", - "hourglass": "\u231b", - "gem": "\ud83d\udc8e", - "person_doing_cartwheel": "\ud83e\udd38", - "new_moon_with_face": "\ud83c\udf1a", - "sunrise": "\ud83c\udf05", - "regional_indicator_x": "\ud83c\uddfd", - "open_file_folder": "\ud83d\udcc2", - "gift_heart": "\ud83d\udc9d", - "tada": "\ud83c\udf89", - "green_heart": "\ud83d\udc9a", - "battery": "\ud83d\udd0b", - "regional_indicator_t": "\ud83c\uddf9", - "wrench": "\ud83d\udd27", - "aries": "\u2648", - "man_in_tuxedo": "\ud83e\udd35", - "regional_indicator_e": "\ud83c\uddea", - "regional_indicator_l": "\ud83c\uddf1", - "cake": "\ud83c\udf70", - "clapper": "\ud83c\udfac", - "japanese_castle": "\ud83c\udfef", - "crystal_ball": "\ud83d\udd2e", - "golf": "\u26f3", - "no_mobile_phones": "\ud83d\udcf5", - "person_biking": "\ud83d\udeb4", - "icecream": "\ud83c\udf66", - "mage": "\ud83e\uddd9", - "bookmark_tabs": "\ud83d\udcd1", - "tone4": "\ud83c\udffe", - "mountain_cableway": "\ud83d\udea0", - "person_playing_handball": "\ud83e\udd3e", - "bulb": "\ud83d\udca1", - "clock330": "\ud83d\udd5e", - "metro": "\ud83d\ude87", - "wave": "\ud83d\udc4b", - "whale": "\ud83d\udc33", - "strawberry": "\ud83c\udf53", - "hatching_chick": "\ud83d\udc23", - "trolleybus": "\ud83d\ude8e", - "lollipop": "\ud83c\udf6d", - "clipboard": "\ud83d\udccb", - "point_right": "\ud83d\udc49", - "u6307": "\ud83c\ude2f", - "santa": "\ud83c\udf85", - "hibiscus": "\ud83c\udf3a", - "green_book": "\ud83d\udcd7", - "skull": "\ud83d\udc80", - "tumbler_glass": "\ud83e\udd43", - "clock2": "\ud83d\udd51", - "open_mouth": "\ud83d\ude2e", - "bouquet": "\ud83d\udc90", - "champagne_glass": "\ud83e\udd42", - "poodle": "\ud83d\udc29", - "hushed": "\ud83d\ude2f", - "earth_asia": "\ud83c\udf0f", - "face_with_monocle": "\ud83e\uddd0", - "libra": "\u264e", - "clock5": "\ud83d\udd54", - "ambulance": "\ud83d\ude91", - "u5272": "\ud83c\ude39", - "lipstick": "\ud83d\udc84", - "apple": "\ud83c\udf4e", - "headphones": "\ud83c\udfa7", - "turkey": "\ud83e\udd83", - "pretzel": "\ud83e\udd68", - "bug": "\ud83d\udc1b", - "school": "\ud83c\udfeb", - "speaker": "\ud83d\udd08", - "boot": "\ud83d\udc62", - "cat": "\ud83d\udc31", - "dancer": "\ud83d\udc83", - "no_entry": "\u26d4", - "kissing_cat": "\ud83d\ude3d", - "art": "\ud83c\udfa8", - "coat": "\ud83e\udde5", - "credit_card": "\ud83d\udcb3", - "customs": "\ud83d\udec3", - "broccoli": "\ud83e\udd66", - "point_left": "\ud83d\udc48", - "canned_food": "\ud83e\udd6b", - "sheep": "\ud83d\udc11", - "person_bowing": "\ud83d\ude47", - "scroll": "\ud83d\udcdc", - "martial_arts_uniform": "\ud83e\udd4b", - "amphora": "\ud83c\udffa", - "thought_balloon": "\ud83d\udcad", - "no_bell": "\ud83d\udd15", - "musical_keyboard": "\ud83c\udfb9", - "people_with_bunny_ears_partying": "\ud83d\udc6f", - "european_castle": "\ud83c\udff0", - "punch": "\ud83d\udc4a", - "camera_with_flash": "\ud83d\udcf8", - "regional_indicator_p": "\ud83c\uddf5", - "red_car": "\ud83d\ude97", - "regional_indicator_j": "\ud83c\uddef", - "owl": "\ud83e\udd89", - "chart_with_downwards_trend": "\ud83d\udcc9", - "older_woman": "\ud83d\udc75", - "gemini": "\u264a", - "incoming_envelope": "\ud83d\udce8", - "waxing_gibbous_moon": "\ud83c\udf14", - "toilet": "\ud83d\udebd", - "dragon_face": "\ud83d\udc32", - "koala": "\ud83d\udc28", - "tone5": "\ud83c\udfff", - "kiwi": "\ud83e\udd5d", - "dash": "\ud83d\udca8", - "imp": "\ud83d\udc7f", - "tent": "\u26fa", - "regional_indicator_b": "\ud83c\udde7", - "monorail": "\ud83d\ude9d", - "ox": "\ud83d\udc02", - "giraffe": "\ud83e\udd92", - "new": "\ud83c\udd95", - "person_raising_hand": "\ud83d\ude4b", - "japan": "\ud83d\uddfe", - "rice": "\ud83c\udf5a", - "ticket": "\ud83c\udfab", - "rotating_light": "\ud83d\udea8", - "loudspeaker": "\ud83d\udce2", - "person_getting_massage": "\ud83d\udc86", - "loud_sound": "\ud83d\udd0a", - "hugging": "\ud83e\udd17", - "herb": "\ud83c\udf3f", - "baby": "\ud83d\udc76", - "angel": "\ud83d\udc7c", - "athletic_shoe": "\ud83d\udc5f", - "euro": "\ud83d\udcb6", - "ram": "\ud83d\udc0f", - "large_orange_diamond": "\ud83d\udd36", - "red_circle": "\ud83d\udd34", - "ferris_wheel": "\ud83c\udfa1", - "drooling_face": "\ud83e\udd24", - "microscope": "\ud83d\udd2c", - "middle_finger": "\ud83d\udd95", - "pager": "\ud83d\udcdf", - "pensive": "\ud83d\ude14", - "potable_water": "\ud83d\udeb0", - "abc": "\ud83d\udd24", - "four_leaf_clover": "\ud83c\udf40", - "vulcan": "\ud83d\udd96", - "french_bread": "\ud83e\udd56", - "motor_scooter": "\ud83d\udef5", - "moneybag": "\ud83d\udcb0", - "sparkles": "\u2728", - "gloves": "\ud83e\udde4", - "envelope_with_arrow": "\ud83d\udce9", - "thumbsdown": "\ud83d\udc4e", - "regional_indicator_g": "\ud83c\uddec", - "video_game": "\ud83c\udfae", - "on": "\ud83d\udd1b", - "open_hands": "\ud83d\udc50", - "monkey_face": "\ud83d\udc35", - "mountain_railway": "\ud83d\ude9e", - "bee": "\ud83d\udc1d", - "scooter": "\ud83d\udef4", - "fishing_pole_and_fish": "\ud83c\udfa3", - "smiley_cat": "\ud83d\ude3a", - "heart_eyes": "\ud83d\ude0d", - "horse_racing": "\ud83c\udfc7", - "ear": "\ud83d\udc42", - "blue_circle": "\ud83d\udd35", - "crossed_flags": "\ud83c\udf8c", - "black_joker": "\ud83c\udccf", - "six_pointed_star": "\ud83d\udd2f", - "fountain": "\u26f2", - "free": "\ud83c\udd93", - "tennis": "\ud83c\udfbe", - "yum": "\ud83d\ude0b", - "fried_shrimp": "\ud83c\udf64", - "dragon": "\ud83d\udc09", - "purse": "\ud83d\udc5b", - "clock1": "\ud83d\udd50", - "airplane_arriving": "\ud83d\udeec", - "cucumber": "\ud83e\udd52", - "man_dancing": "\ud83d\udd7a", - "clock730": "\ud83d\udd62", - "deer": "\ud83e\udd8c", - "meat_on_bone": "\ud83c\udf56", - "bomb": "\ud83d\udca3", - "night_with_stars": "\ud83c\udf03", - "snake": "\ud83d\udc0d", - "ramen": "\ud83c\udf5c", - "end": "\ud83d\udd1a", - "do_not_litter": "\ud83d\udeaf", - "joy": "\ud83d\ude02", - "light_rail": "\ud83d\ude88", - "game_die": "\ud83c\udfb2", - "violin": "\ud83c\udfbb", - "tone2": "\ud83c\udffc", - "tropical_drink": "\ud83c\udf79", - "love_you_gesture": "\ud83e\udd1f", - "cherries": "\ud83c\udf52", - "traffic_light": "\ud83d\udea5", - "iphone": "\ud83d\udcf1", - "socks": "\ud83e\udde6", - "wind_chime": "\ud83c\udf90", - "no_entry_sign": "\ud83d\udeab", - "elf": "\ud83e\udddd", - "squid": "\ud83e\udd91", - "person_pouting": "\ud83d\ude4e", - "smile_cat": "\ud83d\ude38", - "beers": "\ud83c\udf7b", - "minidisc": "\ud83d\udcbd", - "clock4": "\ud83d\udd53", - "ice_cream": "\ud83c\udf68", - "cocktail": "\ud83c\udf78", - "clock3": "\ud83d\udd52", - "frowning": "\ud83d\ude26", - "hamburger": "\ud83c\udf54", - "brain": "\ud83e\udde0", - "heavy_division_sign": "\u2797", - "tophat": "\ud83c\udfa9", - "no_mouth": "\ud83d\ude36", - "ski": "\ud83c\udfbf", - "right_facing_fist": "\ud83e\udd1c", - "mailbox_closed": "\ud83d\udcea", - "chocolate_bar": "\ud83c\udf6b", - "rabbit2": "\ud83d\udc07", - "honey_pot": "\ud83c\udf6f", - "izakaya_lantern": "\ud83c\udfee", - "articulated_lorry": "\ud83d\ude9b", - "face_with_hand_over_mouth": "\ud83e\udd2d", - "japanese_ogre": "\ud83d\udc79", - "zap": "\u26a1", - "rocket": "\ud83d\ude80", - "pizza": "\ud83c\udf55", - "pound": "\ud83d\udcb7", - "person_swimming": "\ud83c\udfca", - "anchor": "\u2693", - "coconut": "\ud83e\udd65", - "sparkling_heart": "\ud83d\udc96", - "older_man": "\ud83d\udc74", - "mouse2": "\ud83d\udc01", - "angry": "\ud83d\ude20", - "up": "\ud83c\udd99", - "gorilla": "\ud83e\udd8d", - "children_crossing": "\ud83d\udeb8", - "smirk_cat": "\ud83d\ude3c", - "pregnant_woman": "\ud83e\udd30", - "electric_plug": "\ud83d\udd0c", - "dog2": "\ud83d\udc15", - "question": "\u2753", - "carousel_horse": "\ud83c\udfa0", - "church": "\u26ea", - "outbox_tray": "\ud83d\udce4", - "cinema": "\ud83c\udfa6", - "flushed": "\ud83d\ude33", - "blush": "\ud83d\ude0a", - "medal": "\ud83c\udfc5", - "coffee": "\u2615", - "gun": "\ud83d\udd2b", - "city_dusk": "\ud83c\udf06", - "watermelon": "\ud83c\udf49", - "cricket_game": "\ud83c\udfcf", - "shower": "\ud83d\udebf", - "mute": "\ud83d\udd07", - "breast_feeding": "\ud83e\udd31", - "sweat_smile": "\ud83d\ude05", - "construction_worker": "\ud83d\udc77", - "cow2": "\ud83d\udc04", - "arrows_counterclockwise": "\ud83d\udd04", - "u6e80": "\ud83c\ude35", - "grinning": "\ud83d\ude00", - "globe_with_meridians": "\ud83c\udf10", - "diamond_shape_with_a_dot_inside": "\ud83d\udca0", - "deciduous_tree": "\ud83c\udf33", - "shark": "\ud83e\udd88", - "tram": "\ud83d\ude8a", - "person_rowing_boat": "\ud83d\udea3", - "chopsticks": "\ud83e\udd62", - "black_heart": "\ud83d\udda4", - "seat": "\ud83d\udcba", - "kissing": "\ud83d\ude17", - "laughing": "\ud83d\ude06", - "slight_smile": "\ud83d\ude42", - "radio": "\ud83d\udcfb", - "arrow_up_small": "\ud83d\udd3c", - "dango": "\ud83c\udf61", - "rofl": "\ud83e\udd23", - "see_no_evil": "\ud83d\ude48", - "thermometer_face": "\ud83e\udd12", - "hotdog": "\ud83c\udf2d", - "virgo": "\u264d", - "poultry_leg": "\ud83c\udf57", - "hotel": "\ud83c\udfe8", - "wolf": "\ud83d\udc3a", - "curry": "\ud83c\udf5b", - "regional_indicator_v": "\ud83c\uddfb", - "crab": "\ud83e\udd80", - "tired_face": "\ud83d\ude2b", - "place_of_worship": "\ud83d\uded0", - "ok_hand": "\ud83d\udc4c", - "speech_balloon": "\ud83d\udcac", - "sleepy": "\ud83d\ude2a", - "earth_africa": "\ud83c\udf0d", - "police_car": "\ud83d\ude93", - "small_red_triangle_down": "\ud83d\udd3b", - "bearded_person": "\ud83e\uddd4", - "curling_stone": "\ud83e\udd4c", - "scarf": "\ud83e\udde3", - "fire": "\ud83d\udd25", - "file_folder": "\ud83d\udcc1", - "zipper_mouth": "\ud83e\udd10", - "new_moon": "\ud83c\udf11", - "regional_indicator_n": "\ud83c\uddf3", - "negative_squared_cross_mark": "\u274e", - "newspaper": "\ud83d\udcf0", - "dvd": "\ud83d\udcc0", - "pear": "\ud83c\udf50", - "partly_sunny": "\u26c5", - "black_square_button": "\ud83d\udd32", - "low_brightness": "\ud83d\udd05", - "sake": "\ud83c\udf76", - "bow_and_arrow": "\ud83c\udff9", - "cooking": "\ud83c\udf73", - "fish_cake": "\ud83c\udf65", - "tomato": "\ud83c\udf45", - "couple_with_heart": "\ud83d\udc91", - "telephone_receiver": "\ud83d\udcde", - "triangular_flag_on_post": "\ud83d\udea9", - "jack_o_lantern": "\ud83c\udf83", - "blue_book": "\ud83d\udcd8", - "clock530": "\ud83d\udd60", - "u6709": "\ud83c\ude36", - "palms_up_together": "\ud83e\udd32", - "lion_face": "\ud83e\udd81", - "lock": "\ud83d\udd12", - "duck": "\ud83e\udd86", - "truck": "\ud83d\ude9a", - "oden": "\ud83c\udf62", - "busts_in_silhouette": "\ud83d\udc65", - "hourglass_flowing_sand": "\u23f3", - "frog": "\ud83d\udc38", - "fox": "\ud83e\udd8a", - "bread": "\ud83c\udf5e", - "put_litter_in_its_place": "\ud83d\udeae", - "couple": "\ud83d\udc6b", - "bamboo": "\ud83c\udf8d", - "regional_indicator_c": "\ud83c\udde8", - "menorah": "\ud83d\udd4e", - "circus_tent": "\ud83c\udfaa", - "lying_face": "\ud83e\udd25", - "small_orange_diamond": "\ud83d\udd38", - "ship": "\ud83d\udea2", - "person_frowning": "\ud83d\ude4d", - "racehorse": "\ud83d\udc0e", - "thumbsup": "\ud83d\udc4d", - "cupid": "\ud83d\udc98", - "robot": "\ud83e\udd16", - "fallen_leaf": "\ud83c\udf42", - "pig_nose": "\ud83d\udc3d", - "vibration_mode": "\ud83d\udcf3", - "necktie": "\ud83d\udc54", - "boy": "\ud83d\udc66", - "house_with_garden": "\ud83c\udfe1", - "point_down": "\ud83d\udc47", - "grey_exclamation": "\u2755", - "books": "\ud83d\udcda", - "regional_indicator_k": "\ud83c\uddf0", - "shirt": "\ud83d\udc55", - "fries": "\ud83c\udf5f", - "dart": "\ud83c\udfaf", - "tea": "\ud83c\udf75", - "mrs_claus": "\ud83e\udd36", - "suspension_railway": "\ud83d\ude9f", - "baby_symbol": "\ud83d\udebc", - "sweet_potato": "\ud83c\udf60", - "butterfly": "\ud83e\udd8b", - "performing_arts": "\ud83c\udfad", - "notebook": "\ud83d\udcd3", - "bat": "\ud83e\udd87" -} + "100": "💯", + "1234": "🔢", + "1st_place_medal": "🥇", + "2nd_place_medal": "🥈", + "3rd_place_medal": "🥉", + "8ball": "🎱", + "a_button_blood_type": "🅰", + "ab": "🆎", + "abacus": "🧮", + "abc": "🔤", + "abcd": "🔡", + "accept": "🉑", + "adhesive_bandage": "🩹", + "admission_tickets": "🎟", + "adult": "🧑", + "aerial_tramway": "🚡", + "airplane": "✈", + "airplane_arriving": "🛬", + "airplane_departure": "🛫", + "alarm_clock": "⏰", + "alembic": "⚗️", + "alien": "👽", + "ambulance": "🚑", + "amphora": "🏺", + "anchor": "⚓", + "angel": "👼", + "anger": "💢", + "anger_right": "🗯", + "angry": "😠", + "anguished": "😧", + "ant": "🐜", + "apple": "🍎", + "aquarius": "♒", + "aries": "♈", + "arrow_backward": "◀️", + "arrow_double_down": "⏬", + "arrow_double_up": "⏫", + "arrow_down": "⬇️", + "arrow_down_small": "🔽", + "arrow_forward": "▶️", + "arrow_heading_down": "⤵️", + "arrow_heading_up": "⤴️", + "arrow_left": "⬅️", + "arrow_lower_left": "↙️", + "arrow_lower_right": "↘️", + "arrow_right": "➡", + "arrow_right_hook": "↪️", + "arrow_up": "⬆️", + "arrow_up_down": "↕", + "arrow_up_small": "🔼", + "arrow_upper_left": "↖", + "arrow_upper_right": "↗️", + "arrows_clockwise": "🔃", + "arrows_counterclockwise": "🔄", + "art": "🎨", + "articulated_lorry": "🚛", + "artist_palette": "🎨", + "asterisk": "*⃣", + "astonished": "😲", + "athletic_shoe": "👟", + "atm": "🏧", + "atom": "⚛", + "atom_symbol": "⚛️", + "auto_rickshaw": "🛺", + "automobile": "🚗", + "avocado": "🥑", + "axe": "🪓", + "b_button_blood_type": "🅱", + "baby": "👶", + "baby_bottle": "🍼", + "baby_chick": "🐤", + "baby_symbol": "🚼", + "back": "🔙", + "bacon": "🥓", + "badger": "🦡", + "badminton": "🏸", + "bagel": "🥯", + "baggage_claim": "🛄", + "baguette_bread": "🥖", + "balance_scale": "⚖️", + "bald": "🦲", + "ballet_shoes": "🩰", + "balloon": "🎈", + "ballot_box": "🗳", + "ballot_box_with_check": "☑️", + "bamboo": "🎍", + "banana": "🍌", + "bangbang": "‼️", + "banjo": "🪕", + "bank": "🏦", + "bar_chart": "📊", + "barber": "💈", + "baseball": "⚾", + "basket": "🧺", + "basketball": "🏀", + "basketballer": "⛹", + "bat": "🦇", + "bath": "🛀", + "bathtub": "🛁", + "battery": "🔋", + "beach_umbrella": "⛱", + "beach_with_umbrella": "🏖", + "bear": "🐻", + "beard": "🧔", + "bearded_person": "🧔", + "bed": "🛏", + "bee": "🐝", + "beer": "🍺", + "beers": "🍻", + "beetle": "🐞", + "beginner": "🔰", + "bell": "🔔", + "bellhop_bell": "🛎", + "bento": "🍱", + "beverage_box": "🧃", + "bicyclist": "🚴", + "bike": "🚲", + "bikini": "👙", + "billed_cap": "🧢", + "biohazard": "☣️", + "bird": "🐦", + "birthday": "🎂", + "black_circle": "⚫", + "black_heart": "🖤", + "black_joker": "🃏", + "black_large_square": "⬛", + "black_medium_small_square": "◾", + "black_medium_square": "◼", + "black_nib": "✒️", + "black_small_square": "▪", + "black_square_button": "🔲", + "blond_haired_person": "👱", + "blossom": "🌼", + "blowfish": "🐡", + "blue_book": "📘", + "blue_car": "🚙", + "blue_circle": "🔵", + "blue_heart": "💙", + "blue_square": "🟦", + "blush": "😊", + "boar": "🐗", + "bomb": "💣", + "bone": "🦴", + "book": "📖", + "bookmark": "🔖", + "bookmark_tabs": "📑", + "books": "📚", + "boom": "💥", + "boot": "👢", + "bouquet": "💐", + "bow": "🙇", + "bow_and_arrow": "🏹", + "bowl_with_spoon": "🥣", + "bowling": "🎳", + "boxing_glove": "🥊", + "boy": "👦", + "brain": "🧠", + "bread": "🍞", + "breast_feeding": "🤱", + "breastfeeding": "🤱", + "brick": "🧱", + "bride_with_veil": "👰", + "bridge_at_night": "🌉", + "briefcase": "💼", + "briefs": "🩲", + "broccoli": "🥦", + "broken_heart": "💔", + "broom": "🧹", + "brown_circle": "🟤", + "brown_heart": "🤎", + "bug": "🐛", + "building_construction": "🏗", + "bulb": "💡", + "bullettrain_front": "🚅", + "bullettrain_side": "🚄", + "burrito": "🌯", + "bus": "🚌", + "busstop": "🚏", + "bust_in_silhouette": "👤", + "busts_in_silhouette": "👥", + "butter": "🧈", + "butterfly": "🦋", + "cactus": "🌵", + "cake": "🍰", + "calendar": "📆", + "call_me": "🤙", + "call_me_hand": "🤙", + "calling": "📲", + "camel": "🐫", + "camera": "📷", + "camera_with_flash": "📸", + "camping": "🏕", + "cancer": "♋", + "candle": "🕯", + "candy": "🍬", + "canned_food": "🥫", + "canoe": "🛶", + "capital_abcd": "🔠", + "capricorn": "♑", + "card_file_box": "🗃", + "card_index": "📇", + "card_index_dividers": "🗂", + "carousel_horse": "🎠", + "carrot": "🥕", + "cat": "🐱", + "cat2": "🐈", + "cd": "💿", + "chains": "⛓️", + "chair": "🪑", + "champagne": "🍾", + "champagne_glass": "🥂", + "chart": "💹", + "chart_with_downwards_trend": "📉", + "chart_with_upwards_trend": "📈", + "check_box_with_check": "☑", + "check_mark": "✔", + "checkered_flag": "🏁", + "cheese": "🧀", + "cheese_wedge": "🧀", + "cherries": "🍒", + "cherry_blossom": "🌸", + "chess_pawn": "♟", + "chestnut": "🌰", + "chicken": "🐔", + "child": "🧒", + "children_crossing": "🚸", + "chipmunk": "🐿", + "chocolate_bar": "🍫", + "chopsticks": "🥢", + "christmas_tree": "🎄", + "church": "⛪", + "cinema": "🎦", + "circled_m": "Ⓜ", + "circus_tent": "🎪", + "city_dusk": "🌆", + "city_sunset": "🌇", + "cityscape": "🏙", + "cityscape_at_dusk": "🌆", + "cl": "🆑", + "clap": "👏", + "clapper": "🎬", + "classical_building": "🏛", + "clinking_glasses": "🥂", + "clipboard": "📋", + "clock1": "🕐", + "clock10": "🕙", + "clock1030": "🕥", + "clock11": "🕚", + "clock1130": "🕦", + "clock12": "🕛", + "clock1230": "🕧", + "clock130": "🕜", + "clock2": "🕑", + "clock230": "🕝", + "clock3": "🕒", + "clock330": "🕞", + "clock4": "🕓", + "clock430": "🕟", + "clock5": "🕔", + "clock530": "🕠", + "clock6": "🕕", + "clock630": "🕡", + "clock7": "🕖", + "clock730": "🕢", + "clock8": "🕗", + "clock830": "🕣", + "clock9": "🕘", + "clock930": "🕤", + "closed_book": "📕", + "closed_lock_with_key": "🔐", + "closed_umbrella": "🌂", + "cloud": "☁️", + "cloud_with_lightning": "🌩", + "cloud_with_lightning_and_rain": "⛈️", + "cloud_with_rain": "🌧", + "cloud_with_snow": "🌨", + "clown": "🤡", + "clown_face": "🤡", + "club_suit": "♣️", + "clubs": "♣", + "coat": "🧥", + "cocktail": "🍸", + "coconut": "🥥", + "coffee": "☕", + "coffin": "⚰️", + "cold_face": "🥶", + "cold_sweat": "😰", + "comet": "☄️", + "compass": "🧭", + "compression": "🗜", + "computer": "💻", + "computer_mouse": "🖱", + "confetti_ball": "🎊", + "confounded": "😖", + "confused": "😕", + "congratulations": "㊗", + "construction": "🚧", + "construction_worker": "👷", + "control_knobs": "🎛", + "convenience_store": "🏪", + "cookie": "🍪", + "cooking": "🍳", + "cool": "🆒", + "cop": "👮", + "copyright": "©", + "corn": "🌽", + "couch_and_lamp": "🛋", + "couple": "👫", + "couple_with_heart": "💑", + "couplekiss": "💏", + "cow": "🐮", + "cow2": "🐄", + "cowboy": "🤠", + "cowboy_hat_face": "🤠", + "crab": "🦀", + "crayon": "🖍", + "crazy_face": "🤪", + "credit_card": "💳", + "crescent_moon": "🌙", + "cricket": "🦗", + "cricket_game": "🏏", + "crocodile": "🐊", + "croissant": "🥐", + "cross": "✝️", + "crossed_fingers": "🤞", + "crossed_flags": "🎌", + "crossed_swords": "⚔️", + "crown": "👑", + "cry": "😢", + "crying_cat_face": "😿", + "crystal_ball": "🔮", + "cucumber": "🥒", + "cup_with_straw": "🥤", + "cupcake": "🧁", + "cupid": "💘", + "curling_stone": "🥌", + "curly_hair": "🦱", + "curly_loop": "➰", + "currency_exchange": "💱", + "curry": "🍛", + "custard": "🍮", + "customs": "🛃", + "cut_of_meat": "🥩", + "cyclone": "🌀", + "dagger": "🗡", + "dancer": "💃", + "dancers": "👯", + "dango": "🍡", + "dark_skin_tone": "🏿", + "dark_sunglasses": "🕶", + "dart": "🎯", + "dash": "💨", + "date": "📅", + "deaf_person": "🧏", + "deciduous_tree": "🌳", + "deer": "🦌", + "department_store": "🏬", + "derelict_house": "🏚", + "desert": "🏜", + "desert_island": "🏝", + "desktop_computer": "🖥", + "detective": "🕵", + "diamond_shape_with_a_dot_inside": "💠", + "diamond_suit": "♦️", + "diamonds": "♦", + "disappointed": "😞", + "disappointed_relieved": "😥", + "diving_mask": "🤿", + "diya_lamp": "🪔", + "dizzy": "💫", + "dizzy_face": "😵", + "dna": "🧬", + "do_not_litter": "🚯", + "dog": "🐶", + "dog2": "🐕", + "dollar": "💵", + "dolls": "🎎", + "dolphin": "🐬", + "door": "🚪", + "double_exclamation_mark": "‼", + "doughnut": "🍩", + "dove": "🕊", + "down_arrow": "⬇", + "downleft_arrow": "↙", + "downright_arrow": "↘", + "dragon": "🐉", + "dragon_face": "🐲", + "dress": "👗", + "dromedary_camel": "🐪", + "drooling_face": "🤤", + "drop_of_blood": "🩸", + "droplet": "💧", + "drum": "🥁", + "duck": "🦆", + "dumpling": "🥟", + "dvd": "📀", + "e-mail": "📧", + "eagle": "🦅", + "ear": "👂", + "ear_of_rice": "🌾", + "ear_with_hearing_aid": "🦻", + "earth_africa": "🌍", + "earth_americas": "🌎", + "earth_asia": "🌏", + "egg": "🥚", + "eggplant": "🍆", + "eight": "8⃣", + "eight_pointed_black_star": "✴️", + "eight_spoked_asterisk": "✳️", + "eightpointed_star": "✴", + "eightspoked_asterisk": "✳", + "eject_button": "⏏", + "electric_plug": "🔌", + "elephant": "🐘", + "elf": "🧝", + "end": "🔚", + "envelope": "✉", + "envelope_with_arrow": "📩", + "euro": "💶", + "european_castle": "🏰", + "european_post_office": "🏤", + "evergreen_tree": "🌲", + "exclamation": "❗", + "exclamation_question_mark": "⁉", + "exploding_head": "🤯", + "expressionless": "😑", + "eye": "👁", + "eyeglasses": "👓", + "eyes": "👀", + "face_vomiting": "🤮", + "face_with_hand_over_mouth": "🤭", + "face_with_headbandage": "🤕", + "face_with_monocle": "🧐", + "face_with_raised_eyebrow": "🤨", + "face_with_symbols_on_mouth": "🤬", + "face_with_symbols_over_mouth": "🤬", + "face_with_thermometer": "🤒", + "factory": "🏭", + "fairy": "🧚", + "falafel": "🧆", + "fallen_leaf": "🍂", + "family": "👪", + "fast_forward": "⏩", + "fax": "📠", + "fearful": "😨", + "feet": "🐾", + "female_sign": "♀", + "ferris_wheel": "🎡", + "ferry": "⛴️", + "field_hockey": "🏑", + "file_cabinet": "🗄", + "file_folder": "📁", + "film_frames": "🎞", + "film_projector": "📽", + "fingers_crossed": "🤞", + "fire": "🔥", + "fire_engine": "🚒", + "fire_extinguisher": "🧯", + "firecracker": "🧨", + "fireworks": "🎆", + "first_place": "🥇", + "first_quarter_moon": "🌓", + "first_quarter_moon_with_face": "🌛", + "fish": "🐟", + "fish_cake": "🍥", + "fishing_pole_and_fish": "🎣", + "fist": "✊", + "five": "5⃣", + "flag_black": "🏴", + "flag_white": "🏳", + "flags": "🎏", + "flamingo": "🦩", + "flashlight": "🔦", + "flat_shoe": "🥿", + "fleur-de-lis": "⚜", + "fleurde-lis": "⚜️", + "floppy_disk": "💾", + "flower_playing_cards": "🎴", + "flushed": "😳", + "flying_disc": "🥏", + "flying_saucer": "🛸", + "fog": "🌫", + "foggy": "🌁", + "foot": "🦶", + "football": "🏈", + "footprints": "👣", + "fork_and_knife": "🍴", + "fork_and_knife_with_plate": "🍽", + "fortune_cookie": "🥠", + "fountain": "⛲", + "fountain_pen": "🖋", + "four": "4⃣", + "four_leaf_clover": "🍀", + "fox": "🦊", + "framed_picture": "🖼", + "free": "🆓", + "french_bread": "🥖", + "fried_shrimp": "🍤", + "fries": "🍟", + "frog": "🐸", + "frowning": "😦", + "frowning_face": "☹️", + "fuelpump": "⛽", + "full_moon": "🌕", + "full_moon_with_face": "🌝", + "funeral_urn": "⚱️", + "game_die": "🎲", + "garlic": "🧄", + "gear": "⚙️", + "gem": "💎", + "gemini": "♊", + "genie": "🧞", + "ghost": "👻", + "gift": "🎁", + "gift_heart": "💝", + "giraffe": "🦒", + "girl": "👧", + "glass_of_milk": "🥛", + "globe_with_meridians": "🌐", + "gloves": "🧤", + "goal": "🥅", + "goal_net": "🥅", + "goat": "🐐", + "goggles": "🥽", + "golf": "⛳", + "golfer": "🏌", + "gorilla": "🦍", + "grapes": "🍇", + "green_apple": "🍏", + "green_book": "📗", + "green_circle": "🟢", + "green_heart": "💚", + "green_salad": "🥗", + "green_square": "🟩", + "grey_exclamation": "❕", + "grey_question": "❔", + "grimacing": "😬", + "grin": "😁", + "grinning": "😀", + "guard": "💂", + "guardsman": "💂", + "guide_dog": "🦮", + "guitar": "🎸", + "gun": "🔫", + "haircut": "💇", + "hamburger": "🍔", + "hammer": "🔨", + "hammer_and_pick": "⚒️", + "hammer_and_wrench": "🛠", + "hamster": "🐹", + "hand_with_fingers_splayed": "🖐", + "handbag": "👜", + "handshake": "🤝", + "hash": "#⃣", + "hatched_chick": "🐥", + "hatching_chick": "🐣", + "head_bandage": "🤕", + "headphones": "🎧", + "hear_no_evil": "🙉", + "heart": "❤️", + "heart_decoration": "💟", + "heart_exclamation": "❣", + "heart_eyes": "😍", + "heart_eyes_cat": "😻", + "heart_suit": "♥️", + "heartbeat": "💓", + "heartpulse": "💗", + "hearts": "♥", + "heavy_check_mark": "✔️", + "heavy_division_sign": "➗", + "heavy_dollar_sign": "💲", + "heavy_minus_sign": "➖", + "heavy_multiplication_x": "✖️", + "heavy_plus_sign": "➕", + "hedgehog": "🦔", + "helicopter": "🚁", + "herb": "🌿", + "hibiscus": "🌺", + "high_brightness": "🔆", + "high_heel": "👠", + "hiking_boot": "🥾", + "hindu_temple": "🛕", + "hippopotamus": "🦛", + "hockey": "🏒", + "hole": "🕳", + "honey_pot": "🍯", + "horse": "🐴", + "horse_racing": "🏇", + "hospital": "🏥", + "hot_face": "🥵", + "hot_pepper": "🌶", + "hot_springs": "♨", + "hotdog": "🌭", + "hotel": "🏨", + "hotsprings": "♨️", + "hourglass": "⌛", + "hourglass_flowing_sand": "⏳", + "house": "🏠", + "house_with_garden": "🏡", + "houses": "🏘", + "hugging": "🤗", + "hundred_points": "💯", + "hushed": "😯", + "ice": "🧊", + "ice_cream": "🍨", + "ice_hockey": "🏒", + "ice_skate": "⛸️", + "icecream": "🍦", + "id": "🆔", + "ideograph_advantage": "🉐", + "imp": "👿", + "inbox_tray": "📥", + "incoming_envelope": "📨", + "index_pointing_up": "☝", + "infinity": "♾", + "information": "ℹ️", + "information_desk_person": "💁", + "information_source": "ℹ", + "innocent": "😇", + "input_numbers": "🔢", + "interrobang": "⁉️", + "iphone": "📱", + "izakaya_lantern": "🏮", + "jack_o_lantern": "🎃", + "japan": "🗾", + "japanese_castle": "🏯", + "japanese_congratulations_button": "㊗️", + "japanese_free_of_charge_button": "🈚", + "japanese_goblin": "👺", + "japanese_ogre": "👹", + "japanese_reserved_button": "🈯", + "japanese_secret_button": "㊙️", + "japanese_service_charge_button": "🈂", + "jeans": "👖", + "joy": "😂", + "joy_cat": "😹", + "joystick": "🕹", + "kaaba": "🕋", + "kangaroo": "🦘", + "key": "🔑", + "keyboard": "⌨️", + "keycap_ten": "🔟", + "kick_scooter": "🛴", + "kimono": "👘", + "kiss": "💋", + "kissing": "😗", + "kissing_cat": "😽", + "kissing_closed_eyes": "😚", + "kissing_heart": "😘", + "kissing_smiling_eyes": "😙", + "kitchen_knife": "🔪", + "kite": "🪁", + "kiwi": "🥝", + "kiwi_fruit": "🥝", + "knife": "🔪", + "koala": "🐨", + "koko": "🈁", + "lab_coat": "🥼", + "label": "🏷", + "lacrosse": "🥍", + "large_blue_diamond": "🔷", + "large_orange_diamond": "🔶", + "last_quarter_moon": "🌗", + "last_quarter_moon_with_face": "🌜", + "last_track_button": "⏮️", + "latin_cross": "✝", + "laughing": "😆", + "leafy_green": "🥬", + "leaves": "🍃", + "ledger": "📒", + "left_arrow": "⬅", + "left_arrow_curving_right": "↪", + "left_facing_fist": "🤛", + "left_luggage": "🛅", + "left_right_arrow": "↔", + "leftfacing_fist": "🤛", + "leftright_arrow": "↔️", + "leftwards_arrow_with_hook": "↩️", + "leg": "🦵", + "lemon": "🍋", + "leo": "♌", + "leopard": "🐆", + "level_slider": "🎚", + "libra": "♎", + "light_rail": "🚈", + "light_skin_tone": "🏻", + "link": "🔗", + "linked_paperclips": "🖇", + "lion_face": "🦁", + "lips": "👄", + "lipstick": "💄", + "lizard": "🦎", + "llama": "🦙", + "lobster": "🦞", + "lock": "🔒", + "lock_with_ink_pen": "🔏", + "lollipop": "🍭", + "loop": "➿", + "lotion_bottle": "🧴", + "loud_sound": "🔊", + "loudspeaker": "📢", + "love_hotel": "🏩", + "love_letter": "💌", + "love_you_gesture": "🤟", + "loveyou_gesture": "🤟", + "low_brightness": "🔅", + "luggage": "🧳", + "lying_face": "🤥", + "m": "Ⓜ️", + "mag": "🔍", + "mag_right": "🔎", + "mage": "🧙", + "magnet": "🧲", + "mahjong": "🀄", + "mailbox": "📫", + "mailbox_closed": "📪", + "mailbox_with_mail": "📬", + "mailbox_with_no_mail": "📭", + "male_sign": "♂", + "man": "👨", + "man_dancing": "🕺", + "man_in_suit": "🕴", + "man_in_tuxedo": "🤵", + "man_with_chinese_cap": "👲", + "man_with_gua_pi_mao": "👲", + "man_with_turban": "👳", + "mango": "🥭", + "mans_shoe": "👞", + "mantelpiece_clock": "🕰", + "manual_wheelchair": "🦽", + "maple_leaf": "🍁", + "martial_arts_uniform": "🥋", + "mask": "😷", + "massage": "💆", + "mate": "🧉", + "meat_on_bone": "🍖", + "mechanical_arm": "🦾", + "mechanical_leg": "🦿", + "medal": "🏅", + "medical_symbol": "⚕", + "medium_skin_tone": "🏽", + "mediumdark_skin_tone": "🏾", + "mediumlight_skin_tone": "🏼", + "mega": "📣", + "melon": "🍈", + "memo": "📝", + "menorah": "🕎", + "mens": "🚹", + "merperson": "🧜", + "metal": "🤘", + "metro": "🚇", + "microbe": "🦠", + "microphone": "🎤", + "microscope": "🔬", + "middle_finger": "🖕", + "military_medal": "🎖", + "milk": "🥛", + "milky_way": "🌌", + "minibus": "🚐", + "minidisc": "💽", + "mobile_phone_off": "📴", + "money_mouth": "🤑", + "money_with_wings": "💸", + "moneybag": "💰", + "moneymouth_face": "🤑", + "monkey": "🐒", + "monkey_face": "🐵", + "monorail": "🚝", + "moon_cake": "🥮", + "mortar_board": "🎓", + "mosque": "🕌", + "mosquito": "🦟", + "motor_boat": "🛥", + "motor_scooter": "🛵", + "motorcycle": "🏍", + "motorized_wheelchair": "🦼", + "motorway": "🛣", + "mount_fuji": "🗻", + "mountain": "⛰️", + "mountain_bicyclist": "🚵", + "mountain_cableway": "🚠", + "mountain_railway": "🚞", + "mouse": "🐭", + "mouse2": "🐁", + "movie_camera": "🎥", + "moyai": "🗿", + "mrs_claus": "🤶", + "multiplication_sign": "✖", + "muscle": "💪", + "mushroom": "🍄", + "musical_keyboard": "🎹", + "musical_note": "🎵", + "musical_score": "🎼", + "mute": "🔇", + "nail_care": "💅", + "name_badge": "📛", + "national_park": "🏞", + "nauseated_face": "🤢", + "nazar_amulet": "🧿", + "necktie": "👔", + "negative_squared_cross_mark": "❎", + "nerd": "🤓", + "neutral_face": "😐", + "new": "🆕", + "new_moon": "🌑", + "new_moon_with_face": "🌚", + "newspaper": "📰", + "next_track_button": "⏭️", + "ng": "🆖", + "night_with_stars": "🌃", + "nine": "9⃣", + "no_bell": "🔕", + "no_bicycles": "🚳", + "no_entry": "⛔", + "no_entry_sign": "🚫", + "no_good": "🙅", + "no_mobile_phones": "📵", + "no_mouth": "😶", + "no_pedestrians": "🚷", + "no_smoking": "🚭", + "non-potable_water": "🚱", + "nose": "👃", + "notebook": "📓", + "notebook_with_decorative_cover": "📔", + "notes": "🎶", + "nut_and_bolt": "🔩", + "o": "⭕", + "o_button_blood_type": "🅾", + "ocean": "🌊", + "octagonal_sign": "🛑", + "octopus": "🐙", + "oden": "🍢", + "office": "🏢", + "oil_drum": "🛢", + "ok": "🆗", + "ok_hand": "👌", + "ok_woman": "🙆", + "old_key": "🗝", + "older_adult": "🧓", + "older_man": "👴", + "older_person": "🧓", + "older_woman": "👵", + "om_symbol": "🕉", + "on": "🔛", + "oncoming_automobile": "🚘", + "oncoming_bus": "🚍", + "oncoming_fist": "👊", + "oncoming_police_car": "🚔", + "oncoming_taxi": "🚖", + "one": "1⃣", + "onepiece_swimsuit": "🩱", + "onion": "🧅", + "open_file_folder": "📂", + "open_hands": "👐", + "open_mouth": "😮", + "ophiuchus": "⛎", + "orange_book": "📙", + "orange_circle": "🟠", + "orange_heart": "🧡", + "orange_square": "🟧", + "orangutan": "🦧", + "orthodox_cross": "☦️", + "otter": "🦦", + "outbox_tray": "📤", + "owl": "🦉", + "ox": "🐂", + "oyster": "🦪", + "p_button": "🅿", + "package": "📦", + "page_facing_up": "📄", + "page_with_curl": "📃", + "pager": "📟", + "paintbrush": "🖌", + "palm_tree": "🌴", + "palms_up_together": "🤲", + "pancakes": "🥞", + "panda_face": "🐼", + "paperclip": "📎", + "parachute": "🪂", + "parrot": "🦜", + "part_alternation_mark": "〽", + "partly_sunny": "⛅", + "partying_face": "🥳", + "passenger_ship": "🛳", + "passport_control": "🛂", + "pause_button": "⏸️", + "peace": "☮", + "peace_symbol": "☮️", + "peach": "🍑", + "peacock": "🦚", + "peanuts": "🥜", + "pear": "🍐", + "pen": "🖊", + "pencil": "📝", + "pencil2": "✏", + "penguin": "🐧", + "pensive": "😔", + "people_with_bunny_ears_partying": "👯", + "people_wrestling": "🤼", + "performing_arts": "🎭", + "persevere": "😣", + "person": "🧑", + "person_biking": "🚴", + "person_bouncing_ball": "⛹️", + "person_bowing": "🙇", + "person_cartwheeling": "🤸", + "person_climbing": "🧗", + "person_doing_cartwheel": "🤸", + "person_facepalming": "🤦", + "person_fencing": "🤺", + "person_frowning": "🙍", + "person_gesturing_no": "🙅", + "person_gesturing_ok": "🙆", + "person_getting_haircut": "💇", + "person_getting_massage": "💆", + "person_in_lotus_position": "🧘", + "person_in_steamy_room": "🧖", + "person_juggling": "🤹", + "person_kneeling": "🧎", + "person_mountain_biking": "🚵", + "person_playing_handball": "🤾", + "person_playing_water_polo": "🤽", + "person_pouting": "🙎", + "person_raising_hand": "🙋", + "person_rowing_boat": "🚣", + "person_running": "🏃", + "person_shrugging": "🤷", + "person_standing": "🧍", + "person_surfing": "🏄", + "person_swimming": "🏊", + "person_tipping_hand": "💁", + "person_walking": "🚶", + "person_wearing_turban": "👳", + "person_with_blond_hair": "👱", + "person_with_pouting_face": "🙎", + "petri_dish": "🧫", + "pick": "⛏️", + "pie": "🥧", + "pig": "🐷", + "pig2": "🐖", + "pig_nose": "🐽", + "pill": "💊", + "pinching_hand": "🤏", + "pineapple": "🍍", + "ping_pong": "🏓", + "pisces": "♓", + "pizza": "🍕", + "place_of_worship": "🛐", + "play_button": "▶", + "play_or_pause_button": "⏯️", + "play_pause": "⏯", + "pleading_face": "🥺", + "point_down": "👇", + "point_left": "👈", + "point_right": "👉", + "point_up": "☝️", + "point_up_2": "👆", + "police_car": "🚓", + "police_officer": "👮", + "poodle": "🐩", + "poop": "💩", + "popcorn": "🍿", + "post_office": "🏣", + "postal_horn": "📯", + "postbox": "📮", + "potable_water": "🚰", + "potato": "🥔", + "pouch": "👝", + "poultry_leg": "🍗", + "pound": "💷", + "pouting_cat": "😾", + "pray": "🙏", + "prayer_beads": "📿", + "pregnant_woman": "🤰", + "pretzel": "🥨", + "prince": "🤴", + "princess": "👸", + "printer": "🖨", + "probing_cane": "🦯", + "punch": "👊", + "purple_circle": "🟣", + "purple_heart": "💜", + "purse": "👛", + "pushpin": "📌", + "put_litter_in_its_place": "🚮", + "puzzle_piece": "🧩", + "question": "❓", + "rabbit": "🐰", + "rabbit2": "🐇", + "raccoon": "🦝", + "racehorse": "🐎", + "racing_car": "🏎", + "radio": "📻", + "radio_button": "🔘", + "radioactive": "☢️", + "rage": "😡", + "railway_car": "🚃", + "railway_track": "🛤", + "rainbow": "🌈", + "raised_back_of_hand": "🤚", + "raised_hand": "✋", + "raised_hands": "🙌", + "raising_hand": "🙋", + "ram": "🐏", + "ramen": "🍜", + "rat": "🐀", + "razor": "🪒", + "receipt": "🧾", + "record_button": "⏺️", + "recycle": "♻", + "recycling_symbol": "♻️", + "red_car": "🚗", + "red_circle": "🔴", + "red_envelope": "🧧", + "red_hair": "🦰", + "red_heart": "❤", + "red_square": "🟥", + "regional_indicator_a": "🇦", + "regional_indicator_b": "🇧", + "regional_indicator_c": "🇨", + "regional_indicator_d": "🇩", + "regional_indicator_e": "🇪", + "regional_indicator_f": "🇫", + "regional_indicator_g": "🇬", + "regional_indicator_h": "🇭", + "regional_indicator_i": "🇮", + "regional_indicator_j": "🇯", + "regional_indicator_k": "🇰", + "regional_indicator_l": "🇱", + "regional_indicator_m": "🇲", + "regional_indicator_n": "🇳", + "regional_indicator_o": "🇴", + "regional_indicator_p": "🇵", + "regional_indicator_q": "🇶", + "regional_indicator_r": "🇷", + "regional_indicator_s": "🇸", + "regional_indicator_t": "🇹", + "regional_indicator_u": "🇺", + "regional_indicator_v": "🇻", + "regional_indicator_w": "🇼", + "regional_indicator_x": "🇽", + "regional_indicator_y": "🇾", + "regional_indicator_z": "🇿", + "registered": "®", + "relieved": "😌", + "reminder_ribbon": "🎗", + "repeat": "🔁", + "repeat_one": "🔂", + "rescue_worker’s_helmet": "⛑️", + "restroom": "🚻", + "reverse_button": "◀", + "revolving_hearts": "💞", + "rewind": "⏪", + "rhino": "🦏", + "rhinoceros": "🦏", + "ribbon": "🎀", + "rice": "🍚", + "rice_ball": "🍙", + "rice_cracker": "🍘", + "rice_scene": "🎑", + "right_arrow": "➡️", + "right_arrow_curving_down": "⤵", + "right_arrow_curving_left": "↩", + "right_arrow_curving_up": "⤴", + "right_facing_fist": "🤜", + "rightfacing_fist": "🤜", + "ring": "💍", + "ringed_planet": "🪐", + "robot": "🤖", + "rocket": "🚀", + "rofl": "🤣", + "roll_of_paper": "🧻", + "rolledup_newspaper": "🗞", + "roller_coaster": "🎢", + "rolling_eyes": "🙄", + "rolling_on_the_floor_laughing": "🤣", + "rooster": "🐓", + "rose": "🌹", + "rosette": "🏵", + "rotating_light": "🚨", + "round_pushpin": "📍", + "rowboat": "🚣", + "rugby_football": "🏉", + "runner": "🏃", + "running_shirt_with_sash": "🎽", + "safety_pin": "🧷", + "safety_vest": "🦺", + "sagittarius": "♐", + "sailboat": "⛵", + "sake": "🍶", + "salad": "🥗", + "salt": "🧂", + "sandal": "👡", + "sandwich": "🥪", + "santa": "🎅", + "sari": "🥻", + "satellite": "📡", + "sauropod": "🦕", + "saxophone": "🎷", + "scales": "⚖", + "scarf": "🧣", + "school": "🏫", + "school_satchel": "🎒", + "scissors": "✂", + "scooter": "🛴", + "scorpion": "🦂", + "scorpius": "♏", + "scream": "😱", + "scream_cat": "🙀", + "scroll": "📜", + "seat": "💺", + "second_place": "🥈", + "secret": "㊙", + "see_no_evil": "🙈", + "seedling": "🌱", + "selfie": "🤳", + "seven": "7⃣", + "shallow_pan_of_food": "🥘", + "shamrock": "☘️", + "shark": "🦈", + "shaved_ice": "🍧", + "sheep": "🐑", + "shell": "🐚", + "shield": "🛡", + "shinto_shrine": "⛩️", + "ship": "🚢", + "shirt": "👕", + "shopping_bags": "🛍", + "shopping_cart": "🛒", + "shorts": "🩳", + "shower": "🚿", + "shrimp": "🦐", + "shushing_face": "🤫", + "sign_of_the_horns": "🤘", + "signal_strength": "📶", + "six": "6⃣", + "six_pointed_star": "🔯", + "skateboard": "🛹", + "ski": "🎿", + "skier": "⛷️", + "skull": "💀", + "skull_and_crossbones": "☠️", + "skull_crossbones": "☠", + "skunk": "🦨", + "sled": "🛷", + "sleeping": "😴", + "sleeping_accommodation": "🛌", + "sleepy": "😪", + "slight_frown": "🙁", + "slight_smile": "🙂", + "slightly_frowning_face": "🙁", + "slot_machine": "🎰", + "sloth": "🦥", + "small_airplane": "🛩", + "small_blue_diamond": "🔹", + "small_orange_diamond": "🔸", + "small_red_triangle": "🔺", + "small_red_triangle_down": "🔻", + "smile": "😄", + "smile_cat": "😸", + "smiley": "😃", + "smiley_cat": "😺", + "smiling": "☺️", + "smiling_face": "☺", + "smiling_face_with_hearts": "🥰", + "smiling_imp": "😈", + "smirk": "😏", + "smirk_cat": "😼", + "smoking": "🚬", + "snail": "🐌", + "snake": "🐍", + "sneezing_face": "🤧", + "snowboarder": "🏂", + "snowcapped_mountain": "🏔", + "snowflake": "❄", + "snowman": "⛄", + "soap": "🧼", + "sob": "😭", + "soccer": "⚽", + "socks": "🧦", + "softball": "🥎", + "soon": "🔜", + "sos": "🆘", + "sound": "🔉", + "space_invader": "👾", + "spade_suit": "♠️", + "spades": "♠", + "spaghetti": "🍝", + "sparkle": "❇", + "sparkler": "🎇", + "sparkles": "✨", + "sparkling_heart": "💖", + "speak_no_evil": "🙊", + "speaker": "🔈", + "speaking_head": "🗣", + "speech_balloon": "💬", + "speech_left": "🗨", + "speedboat": "🚤", + "spider": "🕷", + "spider_web": "🕸", + "spiral_calendar": "🗓", + "spiral_notepad": "🗒", + "sponge": "🧽", + "spoon": "🥄", + "squid": "🦑", + "stadium": "🏟", + "star": "⭐", + "star2": "🌟", + "star_and_crescent": "☪️", + "star_of_david": "✡", + "star_struck": "🤩", + "stars": "🌠", + "starstruck": "🤩", + "station": "🚉", + "statue_of_liberty": "🗽", + "steam_locomotive": "🚂", + "stethoscope": "🩺", + "stew": "🍲", + "stop_button": "⏹️", + "stopwatch": "⏱️", + "straight_ruler": "📏", + "strawberry": "🍓", + "stuck_out_tongue": "😛", + "stuck_out_tongue_closed_eyes": "😝", + "stuck_out_tongue_winking_eye": "😜", + "studio_microphone": "🎙", + "stuffed_flatbread": "🥙", + "sun": "☀", + "sun_behind_large_cloud": "🌥", + "sun_behind_rain_cloud": "🌦", + "sun_behind_small_cloud": "🌤", + "sun_with_face": "🌞", + "sunflower": "🌻", + "sunglasses": "😎", + "sunny": "☀️", + "sunrise": "🌅", + "sunrise_over_mountains": "🌄", + "superhero": "🦸", + "supervillain": "🦹", + "surfer": "🏄", + "sushi": "🍣", + "suspension_railway": "🚟", + "swan": "🦢", + "sweat": "😓", + "sweat_drops": "💦", + "sweat_smile": "😅", + "sweet_potato": "🍠", + "swimmer": "🏊", + "symbols": "🔣", + "synagogue": "🕍", + "syringe": "💉", + "t_rex": "🦖", + "taco": "🌮", + "tada": "🎉", + "takeout_box": "🥡", + "tanabata_tree": "🎋", + "tangerine": "🍊", + "taurus": "♉", + "taxi": "🚕", + "tea": "🍵", + "teddy_bear": "🧸", + "telephone": "☎", + "telephone_receiver": "📞", + "telescope": "🔭", + "tennis": "🎾", + "tent": "⛺", + "test_tube": "🧪", + "thermometer": "🌡", + "thermometer_face": "🤒", + "thinking": "🤔", + "third_place": "🥉", + "thought_balloon": "💭", + "thread": "🧵", + "three": "3⃣", + "thumbsdown": "👎", + "thumbsup": "👍", + "ticket": "🎫", + "tiger": "🐯", + "tiger2": "🐅", + "timer_clock": "⏲️", + "tired_face": "😫", + "tm": "™", + "toilet": "🚽", + "tokyo_tower": "🗼", + "tomato": "🍅", + "tone1": "🏻", + "tone2": "🏼", + "tone3": "🏽", + "tone4": "🏾", + "tone5": "🏿", + "tongue": "👅", + "toolbox": "🧰", + "tooth": "🦷", + "top": "🔝", + "tophat": "🎩", + "tornado": "🌪", + "track_next": "⏭", + "track_previous": "⏮", + "trackball": "🖲", + "tractor": "🚜", + "trade_mark": "™️", + "traffic_light": "🚥", + "train": "🚋", + "train2": "🚆", + "tram": "🚊", + "trex": "🦖", + "triangular_flag_on_post": "🚩", + "triangular_ruler": "📐", + "trident": "🔱", + "triumph": "😤", + "trolleybus": "🚎", + "trophy": "🏆", + "tropical_drink": "🍹", + "tropical_fish": "🐠", + "truck": "🚚", + "trumpet": "🎺", + "tulip": "🌷", + "tumbler_glass": "🥃", + "turkey": "🦃", + "turtle": "🐢", + "tv": "📺", + "twisted_rightwards_arrows": "🔀", + "two": "2⃣", + "two_hearts": "💕", + "two_men_holding_hands": "👬", + "two_women_holding_hands": "👭", + "u5272": "🈹", + "u5408": "🈴", + "u55b6": "🈺", + "u6307": "🈯", + "u6708": "🈷", + "u6709": "🈶", + "u6e80": "🈵", + "u7121": "🈚", + "u7533": "🈸", + "u7981": "🈲", + "u7a7a": "🈳", + "umbrella": "☔", + "umbrella_on_ground": "⛱️", + "unamused": "😒", + "underage": "🔞", + "unicorn": "🦄", + "unlock": "🔓", + "up": "🆙", + "up_arrow": "⬆", + "updown_arrow": "↕️", + "upleft_arrow": "↖️", + "upright_arrow": "↗", + "upside_down": "🙃", + "v": "✌️", + "vampire": "🧛", + "vertical_traffic_light": "🚦", + "vhs": "📼", + "vibration_mode": "📳", + "victory_hand": "✌", + "video_camera": "📹", + "video_game": "🎮", + "violin": "🎻", + "virgo": "♍", + "volcano": "🌋", + "volleyball": "🏐", + "vs": "🆚", + "vulcan": "🖖", + "vulcan_salute": "🖖", + "waffle": "🧇", + "walking": "🚶", + "waning_crescent_moon": "🌘", + "waning_gibbous_moon": "🌖", + "warning": "⚠", + "wastebasket": "🗑", + "watch": "⌚", + "water_buffalo": "🐃", + "watermelon": "🍉", + "wave": "👋", + "wavy_dash": "〰️", + "waxing_crescent_moon": "🌒", + "waxing_gibbous_moon": "🌔", + "wc": "🚾", + "weary": "😩", + "wedding": "💒", + "weightlifter": "🏋", + "whale": "🐳", + "whale2": "🐋", + "wheel_of_dharma": "☸️", + "wheelchair": "♿", + "white_check_mark": "✅", + "white_circle": "⚪", + "white_flower": "💮", + "white_hair": "🦳", + "white_heart": "🤍", + "white_large_square": "⬜", + "white_medium_small_square": "◽", + "white_medium_square": "◻️", + "white_small_square": "▫️", + "white_square_button": "🔳", + "wilted_flower": "🥀", + "wilted_rose": "🥀", + "wind_blowing_face": "🌬", + "wind_chime": "🎐", + "wine_glass": "🍷", + "wink": "😉", + "wolf": "🐺", + "woman": "👩", + "woman_with_headscarf": "🧕", + "womans_clothes": "👚", + "womans_hat": "👒", + "womens": "🚺", + "woozy_face": "🥴", + "world_map": "🗺", + "worried": "😟", + "wrench": "🔧", + "writing_hand": "✍️", + "x": "❌", + "yarn": "🧶", + "yawning_face": "🥱", + "yellow_circle": "🟡", + "yellow_heart": "💛", + "yellow_square": "🟨", + "yen": "💴", + "yin_yang": "☯️", + "yoyo": "🪀", + "yum": "😋", + "zany_face": "🤪", + "zap": "⚡", + "zebra": "🦓", + "zero": "0⃣", + "zipper_mouth": "🤐", + "zombie": "🧟", + "zzz": "💤" +} \ No newline at end of file diff --git a/priv/static/static/js/10.46f441b948010eda4403.js b/priv/static/static/js/10.46f441b948010eda4403.js deleted file mode 100644 index 308d124c0..000000000 Binary files a/priv/static/static/js/10.46f441b948010eda4403.js and /dev/null differ diff --git a/priv/static/static/js/10.46f441b948010eda4403.js.map b/priv/static/static/js/10.46f441b948010eda4403.js.map deleted file mode 100644 index e0623e6bf..000000000 Binary files a/priv/static/static/js/10.46f441b948010eda4403.js.map and /dev/null differ diff --git a/priv/static/static/js/10.a11a612e4c1ef51ded17.js b/priv/static/static/js/10.a11a612e4c1ef51ded17.js new file mode 100644 index 000000000..2a1ffcc2b Binary files /dev/null and b/priv/static/static/js/10.a11a612e4c1ef51ded17.js differ diff --git a/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map b/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map new file mode 100644 index 000000000..fd81b28be Binary files /dev/null and b/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map differ diff --git a/priv/static/static/js/11.22872a1f83121e70a148.js b/priv/static/static/js/11.22872a1f83121e70a148.js new file mode 100644 index 000000000..a2e9cee51 Binary files /dev/null and b/priv/static/static/js/11.22872a1f83121e70a148.js differ diff --git a/priv/static/static/js/11.22872a1f83121e70a148.js.map b/priv/static/static/js/11.22872a1f83121e70a148.js.map new file mode 100644 index 000000000..6467c58a5 Binary files /dev/null and b/priv/static/static/js/11.22872a1f83121e70a148.js.map differ diff --git a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js deleted file mode 100644 index cb57f2a65..000000000 Binary files a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js and /dev/null differ diff --git a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map deleted file mode 100644 index 4ce6d7227..000000000 Binary files a/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map and /dev/null differ diff --git a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js deleted file mode 100644 index a89bfeb67..000000000 Binary files a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js and /dev/null differ diff --git a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map deleted file mode 100644 index 366ec2927..000000000 Binary files a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map and /dev/null differ diff --git a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js new file mode 100644 index 000000000..441071f37 Binary files /dev/null and b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js differ diff --git a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map new file mode 100644 index 000000000..c0bac6f0f Binary files /dev/null and b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map differ diff --git a/priv/static/static/js/13.77214c18c6d2a9865281.js b/priv/static/static/js/13.77214c18c6d2a9865281.js new file mode 100644 index 000000000..08e356de2 Binary files /dev/null and b/priv/static/static/js/13.77214c18c6d2a9865281.js differ diff --git a/priv/static/static/js/13.77214c18c6d2a9865281.js.map b/priv/static/static/js/13.77214c18c6d2a9865281.js.map new file mode 100644 index 000000000..3d7abf273 Binary files /dev/null and b/priv/static/static/js/13.77214c18c6d2a9865281.js.map differ diff --git a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js deleted file mode 100644 index 8cd482b41..000000000 Binary files a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js and /dev/null differ diff --git a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map deleted file mode 100644 index 0c61c3fca..000000000 Binary files a/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map and /dev/null differ diff --git a/priv/static/static/js/14.273855b3e4e27ce80219.js b/priv/static/static/js/14.273855b3e4e27ce80219.js deleted file mode 100644 index 78c0bfebc..000000000 Binary files a/priv/static/static/js/14.273855b3e4e27ce80219.js and /dev/null differ diff --git a/priv/static/static/js/14.273855b3e4e27ce80219.js.map b/priv/static/static/js/14.273855b3e4e27ce80219.js.map deleted file mode 100644 index 9ee527eaa..000000000 Binary files a/priv/static/static/js/14.273855b3e4e27ce80219.js.map and /dev/null differ diff --git a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js new file mode 100644 index 000000000..d2d291725 Binary files /dev/null and b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js differ diff --git a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map new file mode 100644 index 000000000..f9797f1b6 Binary files /dev/null and b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map differ diff --git a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js new file mode 100644 index 000000000..82318f797 Binary files /dev/null and b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js differ diff --git a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map new file mode 100644 index 000000000..00cab138d Binary files /dev/null and b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map differ diff --git a/priv/static/static/js/15.afbe29b6665fcd015b2d.js b/priv/static/static/js/15.afbe29b6665fcd015b2d.js deleted file mode 100644 index b83752240..000000000 Binary files a/priv/static/static/js/15.afbe29b6665fcd015b2d.js and /dev/null differ diff --git a/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map b/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map deleted file mode 100644 index c7a0be582..000000000 Binary files a/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map and /dev/null differ diff --git a/priv/static/static/js/16.5e3f20da470591d0cabf.js b/priv/static/static/js/16.5e3f20da470591d0cabf.js deleted file mode 100644 index e90ed4ca1..000000000 Binary files a/priv/static/static/js/16.5e3f20da470591d0cabf.js and /dev/null differ diff --git a/priv/static/static/js/16.5e3f20da470591d0cabf.js.map b/priv/static/static/js/16.5e3f20da470591d0cabf.js.map deleted file mode 100644 index 0c4d0e385..000000000 Binary files a/priv/static/static/js/16.5e3f20da470591d0cabf.js.map and /dev/null differ diff --git a/priv/static/static/js/16.be7f4b788716bec25023.js b/priv/static/static/js/16.be7f4b788716bec25023.js new file mode 100644 index 000000000..ea5b554f1 Binary files /dev/null and b/priv/static/static/js/16.be7f4b788716bec25023.js differ diff --git a/priv/static/static/js/16.be7f4b788716bec25023.js.map b/priv/static/static/js/16.be7f4b788716bec25023.js.map new file mode 100644 index 000000000..121a49be1 Binary files /dev/null and b/priv/static/static/js/16.be7f4b788716bec25023.js.map differ diff --git a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js deleted file mode 100644 index 9b5adfd12..000000000 Binary files a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js and /dev/null differ diff --git a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map deleted file mode 100644 index 1d191b94a..000000000 Binary files a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map and /dev/null differ diff --git a/priv/static/static/js/17.4ddba89b4f8c284f6392.js b/priv/static/static/js/17.4ddba89b4f8c284f6392.js new file mode 100644 index 000000000..39283f245 Binary files /dev/null and b/priv/static/static/js/17.4ddba89b4f8c284f6392.js differ diff --git a/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map b/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map new file mode 100644 index 000000000..322db8c6b Binary files /dev/null and b/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map differ diff --git a/priv/static/static/js/18.990b88b57bf3a6809098.js b/priv/static/static/js/18.990b88b57bf3a6809098.js new file mode 100644 index 000000000..96de50c61 Binary files /dev/null and b/priv/static/static/js/18.990b88b57bf3a6809098.js differ diff --git a/priv/static/static/js/18.990b88b57bf3a6809098.js.map b/priv/static/static/js/18.990b88b57bf3a6809098.js.map new file mode 100644 index 000000000..b0fb3b629 Binary files /dev/null and b/priv/static/static/js/18.990b88b57bf3a6809098.js.map differ diff --git a/priv/static/static/js/18.9a5b877f94b2b53065e1.js b/priv/static/static/js/18.9a5b877f94b2b53065e1.js deleted file mode 100644 index c4aea5b25..000000000 Binary files a/priv/static/static/js/18.9a5b877f94b2b53065e1.js and /dev/null differ diff --git a/priv/static/static/js/18.9a5b877f94b2b53065e1.js.map b/priv/static/static/js/18.9a5b877f94b2b53065e1.js.map deleted file mode 100644 index 61d9a7d41..000000000 Binary files a/priv/static/static/js/18.9a5b877f94b2b53065e1.js.map and /dev/null differ diff --git a/priv/static/static/js/19.1fd4da643df0abf89122.js b/priv/static/static/js/19.1fd4da643df0abf89122.js deleted file mode 100644 index c1ca1643b..000000000 Binary files a/priv/static/static/js/19.1fd4da643df0abf89122.js and /dev/null differ diff --git a/priv/static/static/js/19.1fd4da643df0abf89122.js.map b/priv/static/static/js/19.1fd4da643df0abf89122.js.map deleted file mode 100644 index 010c8674d..000000000 Binary files a/priv/static/static/js/19.1fd4da643df0abf89122.js.map and /dev/null differ diff --git a/priv/static/static/js/19.783715f17e3f98e8898e.js b/priv/static/static/js/19.783715f17e3f98e8898e.js new file mode 100644 index 000000000..bf4fd22fd Binary files /dev/null and b/priv/static/static/js/19.783715f17e3f98e8898e.js differ diff --git a/priv/static/static/js/19.783715f17e3f98e8898e.js.map b/priv/static/static/js/19.783715f17e3f98e8898e.js.map new file mode 100644 index 000000000..d3bd148d5 Binary files /dev/null and b/priv/static/static/js/19.783715f17e3f98e8898e.js.map differ diff --git a/priv/static/static/js/2.422e6c756ac673a6fd44.js b/priv/static/static/js/2.422e6c756ac673a6fd44.js deleted file mode 100644 index 9fb47e2bf..000000000 Binary files a/priv/static/static/js/2.422e6c756ac673a6fd44.js and /dev/null differ diff --git a/priv/static/static/js/2.422e6c756ac673a6fd44.js.map b/priv/static/static/js/2.422e6c756ac673a6fd44.js.map deleted file mode 100644 index 92fdb4d2c..000000000 Binary files a/priv/static/static/js/2.422e6c756ac673a6fd44.js.map and /dev/null differ diff --git a/priv/static/static/js/2.88fa7ac80b2020ac2b46.js b/priv/static/static/js/2.88fa7ac80b2020ac2b46.js new file mode 100644 index 000000000..b2c2eeb25 Binary files /dev/null and b/priv/static/static/js/2.88fa7ac80b2020ac2b46.js differ diff --git a/priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map b/priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map new file mode 100644 index 000000000..f6aafd426 Binary files /dev/null and b/priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map differ diff --git a/priv/static/static/js/20.96c40f6c9db8c08633bd.js b/priv/static/static/js/20.96c40f6c9db8c08633bd.js new file mode 100644 index 000000000..a3b3d7894 Binary files /dev/null and b/priv/static/static/js/20.96c40f6c9db8c08633bd.js differ diff --git a/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map b/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map new file mode 100644 index 000000000..d7d40ed07 Binary files /dev/null and b/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map differ diff --git a/priv/static/static/js/20.a64fd29da59076399a27.js b/priv/static/static/js/20.a64fd29da59076399a27.js deleted file mode 100644 index eae5b3947..000000000 Binary files a/priv/static/static/js/20.a64fd29da59076399a27.js and /dev/null differ diff --git a/priv/static/static/js/20.a64fd29da59076399a27.js.map b/priv/static/static/js/20.a64fd29da59076399a27.js.map deleted file mode 100644 index b2917fa10..000000000 Binary files a/priv/static/static/js/20.a64fd29da59076399a27.js.map and /dev/null differ diff --git a/priv/static/static/js/21.243d9e6ebf469a2dc740.js b/priv/static/static/js/21.243d9e6ebf469a2dc740.js deleted file mode 100644 index 61633519b..000000000 Binary files a/priv/static/static/js/21.243d9e6ebf469a2dc740.js and /dev/null differ diff --git a/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map b/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map deleted file mode 100644 index 3f98250fa..000000000 Binary files a/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map and /dev/null differ diff --git a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js new file mode 100644 index 000000000..4114db7db Binary files /dev/null and b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js differ diff --git a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map new file mode 100644 index 000000000..898948286 Binary files /dev/null and b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map differ diff --git a/priv/static/static/js/22.d65671b9e5e00a0eb625.js b/priv/static/static/js/22.d65671b9e5e00a0eb625.js new file mode 100644 index 000000000..3748a53b2 Binary files /dev/null and b/priv/static/static/js/22.d65671b9e5e00a0eb625.js differ diff --git a/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map b/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map new file mode 100644 index 000000000..110cadd41 Binary files /dev/null and b/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map differ diff --git a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js deleted file mode 100644 index e8f309f8a..000000000 Binary files a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js and /dev/null differ diff --git a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map deleted file mode 100644 index 7780cffe6..000000000 Binary files a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map and /dev/null differ diff --git a/priv/static/static/js/23.614a35f9ded445292f4a.js b/priv/static/static/js/23.614a35f9ded445292f4a.js deleted file mode 100644 index a35450986..000000000 Binary files a/priv/static/static/js/23.614a35f9ded445292f4a.js and /dev/null differ diff --git a/priv/static/static/js/23.614a35f9ded445292f4a.js.map b/priv/static/static/js/23.614a35f9ded445292f4a.js.map deleted file mode 100644 index 4158041f4..000000000 Binary files a/priv/static/static/js/23.614a35f9ded445292f4a.js.map and /dev/null differ diff --git a/priv/static/static/js/23.bf697d60801d277815e0.js b/priv/static/static/js/23.bf697d60801d277815e0.js new file mode 100644 index 000000000..e61cf01d7 Binary files /dev/null and b/priv/static/static/js/23.bf697d60801d277815e0.js differ diff --git a/priv/static/static/js/23.bf697d60801d277815e0.js.map b/priv/static/static/js/23.bf697d60801d277815e0.js.map new file mode 100644 index 000000000..20c74e93b Binary files /dev/null and b/priv/static/static/js/23.bf697d60801d277815e0.js.map differ diff --git a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js deleted file mode 100644 index d075f3b1f..000000000 Binary files a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js and /dev/null differ diff --git a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map deleted file mode 100644 index 7e68d5eaa..000000000 Binary files a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map and /dev/null differ diff --git a/priv/static/static/js/24.914e51bfcfc620a93c0e.js b/priv/static/static/js/24.914e51bfcfc620a93c0e.js new file mode 100644 index 000000000..abdad101e Binary files /dev/null and b/priv/static/static/js/24.914e51bfcfc620a93c0e.js differ diff --git a/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map b/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map new file mode 100644 index 000000000..1ddfced9a Binary files /dev/null and b/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map differ diff --git a/priv/static/static/js/25.eadae0d48ee5be52a16c.js b/priv/static/static/js/25.eadae0d48ee5be52a16c.js deleted file mode 100644 index a0e44e1aa..000000000 Binary files a/priv/static/static/js/25.eadae0d48ee5be52a16c.js and /dev/null differ diff --git a/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map b/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map deleted file mode 100644 index aaa5e3a57..000000000 Binary files a/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map and /dev/null differ diff --git a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js new file mode 100644 index 000000000..719148fcd Binary files /dev/null and b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js differ diff --git a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map new file mode 100644 index 000000000..ec5910108 Binary files /dev/null and b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map differ diff --git a/priv/static/static/js/26.5233739c17e00ab514f7.js b/priv/static/static/js/26.5233739c17e00ab514f7.js new file mode 100644 index 000000000..9adba8a0c Binary files /dev/null and b/priv/static/static/js/26.5233739c17e00ab514f7.js differ diff --git a/priv/static/static/js/26.5233739c17e00ab514f7.js.map b/priv/static/static/js/26.5233739c17e00ab514f7.js.map new file mode 100644 index 000000000..9aad55492 Binary files /dev/null and b/priv/static/static/js/26.5233739c17e00ab514f7.js.map differ diff --git a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js deleted file mode 100644 index 3b149915b..000000000 Binary files a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js and /dev/null differ diff --git a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map deleted file mode 100644 index d40f1979a..000000000 Binary files a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map and /dev/null differ diff --git a/priv/static/static/js/27.6d90a54efba08d261d69.js b/priv/static/static/js/27.6d90a54efba08d261d69.js deleted file mode 100644 index e8420a54f..000000000 Binary files a/priv/static/static/js/27.6d90a54efba08d261d69.js and /dev/null differ diff --git a/priv/static/static/js/27.6d90a54efba08d261d69.js.map b/priv/static/static/js/27.6d90a54efba08d261d69.js.map deleted file mode 100644 index 6685474ce..000000000 Binary files a/priv/static/static/js/27.6d90a54efba08d261d69.js.map and /dev/null differ diff --git a/priv/static/static/js/27.79a2337abb067d8a36ce.js b/priv/static/static/js/27.79a2337abb067d8a36ce.js new file mode 100644 index 000000000..07b8fbea4 Binary files /dev/null and b/priv/static/static/js/27.79a2337abb067d8a36ce.js differ diff --git a/priv/static/static/js/27.79a2337abb067d8a36ce.js.map b/priv/static/static/js/27.79a2337abb067d8a36ce.js.map new file mode 100644 index 000000000..a55aeae77 Binary files /dev/null and b/priv/static/static/js/27.79a2337abb067d8a36ce.js.map differ diff --git a/priv/static/static/js/28.ed355decbad274c26485.js b/priv/static/static/js/28.ed355decbad274c26485.js new file mode 100644 index 000000000..e4cfd3d70 Binary files /dev/null and b/priv/static/static/js/28.ed355decbad274c26485.js differ diff --git a/priv/static/static/js/28.ed355decbad274c26485.js.map b/priv/static/static/js/28.ed355decbad274c26485.js.map new file mode 100644 index 000000000..0349f2c68 Binary files /dev/null and b/priv/static/static/js/28.ed355decbad274c26485.js.map differ diff --git a/priv/static/static/js/28.f1353aa382a104262d1a.js b/priv/static/static/js/28.f1353aa382a104262d1a.js deleted file mode 100644 index a253284f0..000000000 Binary files a/priv/static/static/js/28.f1353aa382a104262d1a.js and /dev/null differ diff --git a/priv/static/static/js/28.f1353aa382a104262d1a.js.map b/priv/static/static/js/28.f1353aa382a104262d1a.js.map deleted file mode 100644 index 3421c9511..000000000 Binary files a/priv/static/static/js/28.f1353aa382a104262d1a.js.map and /dev/null differ diff --git a/priv/static/static/js/29.39c1e87a689c840395b2.js b/priv/static/static/js/29.39c1e87a689c840395b2.js deleted file mode 100644 index ddb512279..000000000 Binary files a/priv/static/static/js/29.39c1e87a689c840395b2.js and /dev/null differ diff --git a/priv/static/static/js/29.39c1e87a689c840395b2.js.map b/priv/static/static/js/29.39c1e87a689c840395b2.js.map deleted file mode 100644 index 5901ce9b7..000000000 Binary files a/priv/static/static/js/29.39c1e87a689c840395b2.js.map and /dev/null differ diff --git a/priv/static/static/js/29.d3d8f3c066d579644c9a.js b/priv/static/static/js/29.d3d8f3c066d579644c9a.js new file mode 100644 index 000000000..8a8a3b51f Binary files /dev/null and b/priv/static/static/js/29.d3d8f3c066d579644c9a.js differ diff --git a/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map b/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map new file mode 100644 index 000000000..0ef69d368 Binary files /dev/null and b/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map differ diff --git a/priv/static/static/js/3.0b1cb0c49b906b834801.js b/priv/static/static/js/3.0b1cb0c49b906b834801.js new file mode 100644 index 000000000..5b79d06b1 Binary files /dev/null and b/priv/static/static/js/3.0b1cb0c49b906b834801.js differ diff --git a/priv/static/static/js/3.0b1cb0c49b906b834801.js.map b/priv/static/static/js/3.0b1cb0c49b906b834801.js.map new file mode 100644 index 000000000..08e6ffdfe Binary files /dev/null and b/priv/static/static/js/3.0b1cb0c49b906b834801.js.map differ diff --git a/priv/static/static/js/3.a0df8a5bcd120d1f8581.js b/priv/static/static/js/3.a0df8a5bcd120d1f8581.js deleted file mode 100644 index 423121114..000000000 Binary files a/priv/static/static/js/3.a0df8a5bcd120d1f8581.js and /dev/null differ diff --git a/priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map b/priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map deleted file mode 100644 index 653727d10..000000000 Binary files a/priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map and /dev/null differ diff --git a/priv/static/static/js/30.04694ca04ca2fb3b9695.js b/priv/static/static/js/30.04694ca04ca2fb3b9695.js new file mode 100644 index 000000000..cc60c675d Binary files /dev/null and b/priv/static/static/js/30.04694ca04ca2fb3b9695.js differ diff --git a/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map b/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map new file mode 100644 index 000000000..b347f4f84 Binary files /dev/null and b/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map differ diff --git a/priv/static/static/js/30.64736585965c63c2b5d4.js b/priv/static/static/js/30.64736585965c63c2b5d4.js deleted file mode 100644 index 4fdbe8c3e..000000000 Binary files a/priv/static/static/js/30.64736585965c63c2b5d4.js and /dev/null differ diff --git a/priv/static/static/js/30.64736585965c63c2b5d4.js.map b/priv/static/static/js/30.64736585965c63c2b5d4.js.map deleted file mode 100644 index 376920946..000000000 Binary files a/priv/static/static/js/30.64736585965c63c2b5d4.js.map and /dev/null differ diff --git a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js new file mode 100644 index 000000000..886c184d1 Binary files /dev/null and b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js differ diff --git a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map new file mode 100644 index 000000000..1a4bd1a0a Binary files /dev/null and b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map differ diff --git a/priv/static/static/js/32.044555dd7095261d9faf.js b/priv/static/static/js/32.044555dd7095261d9faf.js new file mode 100644 index 000000000..6ca50349e Binary files /dev/null and b/priv/static/static/js/32.044555dd7095261d9faf.js differ diff --git a/priv/static/static/js/32.044555dd7095261d9faf.js.map b/priv/static/static/js/32.044555dd7095261d9faf.js.map new file mode 100644 index 000000000..f7f4094ee Binary files /dev/null and b/priv/static/static/js/32.044555dd7095261d9faf.js.map differ diff --git a/priv/static/static/js/4.15e71ac865c2606c30a6.js b/priv/static/static/js/4.15e71ac865c2606c30a6.js new file mode 100644 index 000000000..3406cc065 Binary files /dev/null and b/priv/static/static/js/4.15e71ac865c2606c30a6.js differ diff --git a/priv/static/static/js/4.15e71ac865c2606c30a6.js.map b/priv/static/static/js/4.15e71ac865c2606c30a6.js.map new file mode 100644 index 000000000..023d90430 Binary files /dev/null and b/priv/static/static/js/4.15e71ac865c2606c30a6.js.map differ diff --git a/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js b/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js deleted file mode 100644 index 4da4c56fa..000000000 Binary files a/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js and /dev/null differ diff --git a/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map b/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map deleted file mode 100644 index bc040ab9b..000000000 Binary files a/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map and /dev/null differ diff --git a/priv/static/static/js/5.2e165bc072548e533dd4.js b/priv/static/static/js/5.2e165bc072548e533dd4.js deleted file mode 100644 index cfd84226c..000000000 Binary files a/priv/static/static/js/5.2e165bc072548e533dd4.js and /dev/null differ diff --git a/priv/static/static/js/5.2e165bc072548e533dd4.js.map b/priv/static/static/js/5.2e165bc072548e533dd4.js.map deleted file mode 100644 index 49959c78e..000000000 Binary files a/priv/static/static/js/5.2e165bc072548e533dd4.js.map and /dev/null differ diff --git a/priv/static/static/js/5.e116ac5b71f5e62029a1.js b/priv/static/static/js/5.e116ac5b71f5e62029a1.js new file mode 100644 index 000000000..acd64094e Binary files /dev/null and b/priv/static/static/js/5.e116ac5b71f5e62029a1.js differ diff --git a/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map b/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map new file mode 100644 index 000000000..0017a3bfd Binary files /dev/null and b/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map differ diff --git a/priv/static/static/js/6.260ccd84f8cd2af27970.js b/priv/static/static/js/6.260ccd84f8cd2af27970.js deleted file mode 100644 index fb4a690f4..000000000 Binary files a/priv/static/static/js/6.260ccd84f8cd2af27970.js and /dev/null differ diff --git a/priv/static/static/js/6.260ccd84f8cd2af27970.js.map b/priv/static/static/js/6.260ccd84f8cd2af27970.js.map deleted file mode 100644 index 850fe731a..000000000 Binary files a/priv/static/static/js/6.260ccd84f8cd2af27970.js.map and /dev/null differ diff --git a/priv/static/static/js/6.4e804674e0bff336a51b.js b/priv/static/static/js/6.4e804674e0bff336a51b.js new file mode 100644 index 000000000..b33bbd652 Binary files /dev/null and b/priv/static/static/js/6.4e804674e0bff336a51b.js differ diff --git a/priv/static/static/js/6.4e804674e0bff336a51b.js.map b/priv/static/static/js/6.4e804674e0bff336a51b.js.map new file mode 100644 index 000000000..bbb049a88 Binary files /dev/null and b/priv/static/static/js/6.4e804674e0bff336a51b.js.map differ diff --git a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js deleted file mode 100644 index 317770a53..000000000 Binary files a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js and /dev/null differ diff --git a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map deleted file mode 100644 index 36f327b3f..000000000 Binary files a/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map and /dev/null differ diff --git a/priv/static/static/js/7.e8595e0b6e063c6d9478.js b/priv/static/static/js/7.e8595e0b6e063c6d9478.js new file mode 100644 index 000000000..7622e0d7a Binary files /dev/null and b/priv/static/static/js/7.e8595e0b6e063c6d9478.js differ diff --git a/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map b/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map new file mode 100644 index 000000000..40327d1fd Binary files /dev/null and b/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map differ diff --git a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js new file mode 100644 index 000000000..085a9e004 Binary files /dev/null and b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js differ diff --git a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map new file mode 100644 index 000000000..50222e2be Binary files /dev/null and b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map differ diff --git a/priv/static/static/js/8.9b35c2fee24ab7481e00.js b/priv/static/static/js/8.9b35c2fee24ab7481e00.js deleted file mode 100644 index cb7844ffc..000000000 Binary files a/priv/static/static/js/8.9b35c2fee24ab7481e00.js and /dev/null differ diff --git a/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map b/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map deleted file mode 100644 index 65f4d5ae9..000000000 Binary files a/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map and /dev/null differ diff --git a/priv/static/static/js/9.3a29094f1886648a0af3.js b/priv/static/static/js/9.3a29094f1886648a0af3.js deleted file mode 100644 index eb3516dcd..000000000 Binary files a/priv/static/static/js/9.3a29094f1886648a0af3.js and /dev/null differ diff --git a/priv/static/static/js/9.3a29094f1886648a0af3.js.map b/priv/static/static/js/9.3a29094f1886648a0af3.js.map deleted file mode 100644 index 1b6224a6a..000000000 Binary files a/priv/static/static/js/9.3a29094f1886648a0af3.js.map and /dev/null differ diff --git a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js new file mode 100644 index 000000000..41ab62b92 Binary files /dev/null and b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js differ diff --git a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map new file mode 100644 index 000000000..c215e9a03 Binary files /dev/null and b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map differ diff --git a/priv/static/static/js/app.45547c05212c403dd77c.js b/priv/static/static/js/app.45547c05212c403dd77c.js deleted file mode 100644 index 219a59493..000000000 Binary files a/priv/static/static/js/app.45547c05212c403dd77c.js and /dev/null differ diff --git a/priv/static/static/js/app.45547c05212c403dd77c.js.map b/priv/static/static/js/app.45547c05212c403dd77c.js.map deleted file mode 100644 index e1dd6c992..000000000 Binary files a/priv/static/static/js/app.45547c05212c403dd77c.js.map and /dev/null differ diff --git a/priv/static/static/js/app.eb8f7164fc75862a251d.js b/priv/static/static/js/app.eb8f7164fc75862a251d.js new file mode 100644 index 000000000..55414d124 Binary files /dev/null and b/priv/static/static/js/app.eb8f7164fc75862a251d.js differ diff --git a/priv/static/static/js/app.eb8f7164fc75862a251d.js.map b/priv/static/static/js/app.eb8f7164fc75862a251d.js.map new file mode 100644 index 000000000..f1dbb68bb Binary files /dev/null and b/priv/static/static/js/app.eb8f7164fc75862a251d.js.map differ diff --git a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js new file mode 100644 index 000000000..38dd65643 Binary files /dev/null and b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js differ diff --git a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map new file mode 100644 index 000000000..35b5fd52f Binary files /dev/null and b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map differ diff --git a/priv/static/static/js/vendors~app.952124344a84613dbac0.js b/priv/static/static/js/vendors~app.952124344a84613dbac0.js deleted file mode 100644 index f7943c122..000000000 Binary files a/priv/static/static/js/vendors~app.952124344a84613dbac0.js and /dev/null differ diff --git a/priv/static/static/js/vendors~app.952124344a84613dbac0.js.map b/priv/static/static/js/vendors~app.952124344a84613dbac0.js.map deleted file mode 100644 index 05fc07c18..000000000 Binary files a/priv/static/static/js/vendors~app.952124344a84613dbac0.js.map and /dev/null differ diff --git a/priv/static/static/themes/redmond-xx-se.json b/priv/static/static/themes/redmond-xx-se.json index 24480d2c7..b62769dbc 100644 --- a/priv/static/static/themes/redmond-xx-se.json +++ b/priv/static/static/themes/redmond-xx-se.json @@ -267,6 +267,7 @@ }, "colors": { "bg": "#c0c0c0", + "wallpaper": "#008080", "text": "#000000", "link": "#0000ff", "accent": "#000080", diff --git a/priv/static/static/themes/redmond-xx.json b/priv/static/static/themes/redmond-xx.json index cf9010fe2..83b591091 100644 --- a/priv/static/static/themes/redmond-xx.json +++ b/priv/static/static/themes/redmond-xx.json @@ -258,6 +258,7 @@ }, "colors": { "bg": "#c0c0c0", + "wallpaper": "#008080", "text": "#000000", "link": "#0000ff", "accent": "#000080", diff --git a/priv/static/static/themes/redmond-xxi.json b/priv/static/static/themes/redmond-xxi.json index 7fdc4a6d6..60ceae7c2 100644 --- a/priv/static/static/themes/redmond-xxi.json +++ b/priv/static/static/themes/redmond-xxi.json @@ -240,6 +240,7 @@ }, "colors": { "bg": "#d6d6ce", + "wallpaper": "#396ba5", "text": "#000000", "link": "#0000ff", "accent": "#0a246a", diff --git a/priv/static/sw-pleroma.js b/priv/static/sw-pleroma.js index 385ee2f0c..25879eb45 100644 Binary files a/priv/static/sw-pleroma.js and b/priv/static/sw-pleroma.js differ diff --git a/priv/static/sw-pleroma.js.map b/priv/static/sw-pleroma.js.map index 0b6a76c2f..62cea8c08 100644 Binary files a/priv/static/sw-pleroma.js.map and b/priv/static/sw-pleroma.js.map differ -- cgit v1.2.3 From fe63b48c8fbf1177569c048e8edfe98c5e63c57e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 10:05:38 -0600 Subject: Document removal of toggle_activated --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea70b8df5..66c235713 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed -- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` +- **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` +- **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate` - **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed` - **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved` - **Breaking**: AdminAPI changed User field `deactivated` to `is_active` -- cgit v1.2.3 From 5e8da27e14243ea40dd7dbf14138df598615c95b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 10:36:51 -0600 Subject: Provide pleroma.user mix task for both activate and deactivate --- CHANGELOG.md | 2 +- lib/mix/tasks/pleroma/user.ex | 18 ++++++++++++++++++ test/mix/tasks/pleroma/user_test.exs | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66c235713..0ea649111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` -- **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate` +- **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate/deactivate` - **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed` - **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved` - **Breaking**: AdminAPI changed User field `deactivated` to `is_active` diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 1f7eb9375..bb9a080a4 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -141,6 +141,24 @@ def run(["reset_mfa", nickname]) do end end + def run(["activate", nickname]) do + start_pleroma() + + with %User{} = user <- User.get_cached_by_nickname(nickname), + false <- user.is_active do + User.set_activation(user, true) + :timer.sleep(500) + + shell_info("Successfully activated #{nickname}") + else + true -> + shell_info("User #{nickname} already activated") + + _ -> + shell_error("No user #{nickname}") + end + end + def run(["deactivate", nickname]) do start_pleroma() diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index fddef1d28..768beb0a6 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -456,6 +456,37 @@ test "it prints an error message when user is not exist" do end end + describe "running activate" do + test "user is activated" do + %{id: id, nickname: nickname} = insert(:user, is_active: true) + + assert :ok = Mix.Tasks.Pleroma.User.run(["activate", nickname]) + assert_received {:mix_shell, :info, [message]} + assert message == "User #{nickname} already activated" + + user = Repo.get(User, id) + assert user.is_active + end + + test "user is not activated" do + %{id: id, nickname: nickname} = insert(:user, is_active: false) + + assert :ok = Mix.Tasks.Pleroma.User.run(["activate", nickname]) + assert_received {:mix_shell, :info, [message]} + assert message == "Successfully activated #{nickname}" + + user = Repo.get(User, id) + assert user.is_active + end + + test "it prints an error message when user is not exist" do + Mix.Tasks.Pleroma.User.run(["activate", "foo"]) + + assert_received {:mix_shell, :error, [message]} + assert message =~ "No user" + end + end + describe "search" do test "it returns users matching" do user = insert(:user) -- cgit v1.2.3 From 6e51d7264bf5def49795494f35e023d7e19b9ac9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 10:38:08 -0600 Subject: Document pleroma.user activate mix task --- docs/administration/CLI_tasks/user.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/administration/CLI_tasks/user.md b/docs/administration/CLI_tasks/user.md index 9fde9631e..24fdaeab4 100644 --- a/docs/administration/CLI_tasks/user.md +++ b/docs/administration/CLI_tasks/user.md @@ -133,6 +133,19 @@ mix pleroma.user sign_out ``` +## Activate a user + +=== "OTP" + + ```sh + ./bin/pleroma_ctl user activate NICKNAME + ``` + +=== "From Source" + + ```sh + mix pleroma.user activate NICKNAME + ``` ## Deactivate a user and unsubscribes local users from the user -- cgit v1.2.3 From 3f3d64acbfe0f8219911cb053e7fdab25137a23a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Mon, 25 Jan 2021 19:46:36 +0300 Subject: little refactor and tests for voted & own_votes fields in polls --- lib/pleroma/web/mastodon_api/views/poll_view.ex | 35 ++++++---- .../controllers/poll_controller_test.exs | 81 ++++++++++++++++++++-- .../web/mastodon_api/views/poll_view_test.exs | 9 +-- 3 files changed, 101 insertions(+), 24 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex index 94bc1c139..de536c8fb 100644 --- a/lib/pleroma/web/mastodon_api/views/poll_view.ex +++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex @@ -10,9 +10,8 @@ defmodule Pleroma.Web.MastodonAPI.PollView do def render("show.json", %{object: object, multiple: multiple, options: options} = params) do {end_time, expired} = end_time_and_expired(object) {options, votes_count} = options_and_votes_count(options) - {voted, own_votes} = voted_and_own_votes(params, options) - %{ + poll = %{ # Mastodon uses separate ids for polls, but an object can't have # more than one poll embedded so object id is fine id: to_string(object.id), @@ -22,10 +21,16 @@ def render("show.json", %{object: object, multiple: multiple, options: options} votes_count: votes_count, voters_count: voters_count(object), options: options, - voted: voted, - own_votes: own_votes, emojis: Pleroma.Web.MastodonAPI.StatusView.build_emojis(object.data["emoji"]) } + + if params[:for] do + # if a user is not authenticated Mastodon doesn't include `voted` & `own_votes` keys in response + {voted, own_votes} = voted_and_own_votes(params, options) + Map.merge(poll, %{voted: voted, own_votes: own_votes}) + else + poll + end end def render("show.json", %{object: object} = params) do @@ -70,21 +75,25 @@ defp voters_count(%{data: %{"voters" => [_ | _] = voters}}) do defp voters_count(_), do: 0 defp voted_and_own_votes(%{object: object} = params, options) do - options = options |> Enum.map(fn x -> Map.get(x, :title) end) - if params[:for] do existing_votes = Pleroma.Web.ActivityPub.Utils.get_existing_votes(params[:for].ap_id, object) - own_votes = - for vote <- existing_votes do - data = Map.get(vote, :object) |> Map.get(:data) - - Enum.find_index(options, fn x -> x == data["name"] end) - end || [] - voted = existing_votes != [] or params[:for].ap_id == object.data["actor"] + own_votes = + if voted do + titles = Enum.map(options, & &1[:title]) + + Enum.reduce(existing_votes, [], fn vote, acc -> + data = vote |> Map.get(:object) |> Map.get(:data) + index = Enum.find_index(titles, &(&1 == data["name"])) + [index | acc] + end) + else + [] + end + {voted, own_votes} else {false, []} diff --git a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs index 95df48ab0..da0a631a9 100644 --- a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs @@ -47,6 +47,78 @@ test "does not expose polls for private statuses", %{conn: conn} do end end + test "own_votes" do + %{conn: conn} = oauth_access(["write:statuses", "read:statuses"]) + + other_user = insert(:user) + + {:ok, activity} = + CommonAPI.post(other_user, %{ + status: "A very delicious sandwich", + poll: %{ + options: ["Lettuce", "Grilled Bacon", "Tomato"], + expires_in: 20, + multiple: true + } + }) + + object = Object.normalize(activity, fetch: false) + + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/polls/#{object.id}/votes", %{"choices" => [0, 2]}) + |> json_response_and_validate_schema(200) + + object = Object.get_by_id(object.id) + + assert [ + %{ + "name" => "Lettuce", + "replies" => %{"totalItems" => 1, "type" => "Collection"}, + "type" => "Note" + }, + %{ + "name" => "Grilled Bacon", + "replies" => %{"totalItems" => 0, "type" => "Collection"}, + "type" => "Note" + }, + %{ + "name" => "Tomato", + "replies" => %{"totalItems" => 1, "type" => "Collection"}, + "type" => "Note" + } + ] == object.data["anyOf"] + + assert %{"replies" => %{"totalItems" => 0}} = + Enum.find(object.data["anyOf"], fn %{"name" => name} -> name == "Grilled Bacon" end) + + Enum.each(["Lettuce", "Tomato"], fn title -> + %{"replies" => %{"totalItems" => total_items}} = + Enum.find(object.data["anyOf"], fn %{"name" => name} -> name == title end) + + assert total_items == 1 + end) + + assert %{ + "own_votes" => own_votes, + "voted" => true + } = + conn + |> get("/api/v1/polls/#{object.id}") + |> json_response_and_validate_schema(200) + + assert 0 in own_votes + assert 2 in own_votes + # for non authenticated user + response = + build_conn() + |> get("/api/v1/polls/#{object.id}") + |> json_response_and_validate_schema(200) + + refute Map.has_key?(response, "own_votes") + refute Map.has_key?(response, "voted") + end + describe "POST /api/v1/polls/:id/votes" do setup do: oauth_access(["write:statuses"]) @@ -65,12 +137,11 @@ test "votes are added to the poll", %{conn: conn} do object = Object.normalize(activity, fetch: false) - conn = - conn - |> put_req_header("content-type", "application/json") - |> post("/api/v1/polls/#{object.id}/votes", %{"choices" => [0, 1, 2]}) + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/polls/#{object.id}/votes", %{"choices" => [0, 1, 2]}) + |> json_response_and_validate_schema(200) - assert json_response_and_validate_schema(conn, 200) object = Object.get_by_id(object.id) assert Enum.all?(object.data["anyOf"], fn %{"replies" => %{"totalItems" => total_items}} -> diff --git a/test/pleroma/web/mastodon_api/views/poll_view_test.exs b/test/pleroma/web/mastodon_api/views/poll_view_test.exs index f087d50e8..224b26cb9 100644 --- a/test/pleroma/web/mastodon_api/views/poll_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/poll_view_test.exs @@ -42,10 +42,8 @@ test "renders a poll" do %{title: "yes", votes_count: 0}, %{title: "why are you even asking?", votes_count: 0} ], - voted: false, votes_count: 0, - voters_count: 0, - own_votes: [] + voters_count: 0 } result = PollView.render("show.json", %{object: object}) @@ -124,10 +122,9 @@ test "detects vote status" do result = PollView.render("show.json", %{object: object, for: other_user}) - _own_votes = result[:own_votes] - assert result[:voted] == true - assert own_votes = [1, 2] + assert 1 in result[:own_votes] + assert 2 in result[:own_votes] assert Enum.at(result[:options], 1)[:votes_count] == 1 assert Enum.at(result[:options], 2)[:votes_count] == 1 end -- cgit v1.2.3 From f868dcf3acc0fd687a4a74e74f6e150ef565f787 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 10:48:28 -0600 Subject: Ensure consistent behavior between pleroma.user activate/deactivate mix tasks --- lib/mix/tasks/pleroma/user.ex | 9 ++++++--- test/mix/tasks/pleroma/user_test.exs | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index bb9a080a4..53d5fc6d9 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -162,17 +162,20 @@ def run(["activate", nickname]) do def run(["deactivate", nickname]) do start_pleroma() - with %User{} = user <- User.get_cached_by_nickname(nickname) do - shell_info("Deactivating #{user.nickname}") + with %User{} = user <- User.get_cached_by_nickname(nickname), + true <- user.is_active do User.set_activation(user, false) :timer.sleep(500) user = User.get_cached_by_id(user.id) if Enum.empty?(Enum.filter(User.get_friends(user), & &1.local)) do - shell_info("Successfully unsubscribed all local followers from #{user.nickname}") + shell_info("Successfully deactivated #{nickname} and unsubscribed all local followers") end else + false -> + shell_info("User #{nickname} already deactivated") + _ -> shell_error("No user #{nickname}") end diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs index 768beb0a6..a2178bbd1 100644 --- a/test/mix/tasks/pleroma/user_test.exs +++ b/test/mix/tasks/pleroma/user_test.exs @@ -158,7 +158,7 @@ test "no user to delete" do end describe "running deactivate" do - test "user is unsubscribed" do + test "active user is deactivated and unsubscribed" do followed = insert(:user) remote_followed = insert(:user, local: false) user = insert(:user) @@ -168,18 +168,28 @@ test "user is unsubscribed" do Mix.Tasks.Pleroma.User.run(["deactivate", user.nickname]) - assert_received {:mix_shell, :info, [message]} - assert message =~ "Deactivating" - # Note that the task has delay :timer.sleep(500) assert_received {:mix_shell, :info, [message]} - assert message =~ "Successfully unsubscribed" + + assert message == + "Successfully deactivated #{user.nickname} and unsubscribed all local followers" user = User.get_cached_by_nickname(user.nickname) assert Enum.empty?(Enum.filter(User.get_friends(user), & &1.local)) refute user.is_active end + test "user is deactivated" do + %{id: id, nickname: nickname} = insert(:user, is_active: false) + + assert :ok = Mix.Tasks.Pleroma.User.run(["deactivate", nickname]) + assert_received {:mix_shell, :info, [message]} + assert message == "User #{nickname} already deactivated" + + user = Repo.get(User, id) + refute user.is_active + end + test "no user to deactivate" do Mix.Tasks.Pleroma.User.run(["deactivate", "nonexistent"]) @@ -479,7 +489,7 @@ test "user is not activated" do assert user.is_active end - test "it prints an error message when user is not exist" do + test "no user to activate" do Mix.Tasks.Pleroma.User.run(["activate", "foo"]) assert_received {:mix_shell, :error, [message]} -- cgit v1.2.3 From ea4785213a449f3bcd68bcb4ecb3bb6d794736b1 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 25 Jan 2021 20:12:09 +0300 Subject: [#3213] Switched to using embedded hashtags in Object.hashtags/1 (to avoid extra joins / preload in timeline queries). --- lib/pleroma/config.ex | 1 - lib/pleroma/object.ex | 18 +++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index ceb8c8b5a..0a6ac0ad0 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -98,7 +98,6 @@ def restrict_unauthenticated_access?(resource, kind) do def improved_hashtag_timeline_path, do: [:instance, :improved_hashtag_timeline] def improved_hashtag_timeline, do: get(improved_hashtag_timeline_path()) - def object_embedded_hashtags?, do: !improved_hashtag_timeline() def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], []) diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 9b5c1bec1..9edf43e04 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -388,24 +388,16 @@ def tags(%Object{data: %{"tag" => tags}}) when is_list(tags), do: tags def tags(_), do: [] def hashtags(%Object{} = object) do - cond do - Config.object_embedded_hashtags?() -> - embedded_hashtags(object) - - object.id == "pleroma:fake_object_id" -> - [] - - true -> - hashtag_records = Repo.preload(object, :hashtags).hashtags - Enum.map(hashtag_records, & &1.name) - end + # Note: always using embedded hashtags regardless whether they are migrated to hashtags table + # (embedded hashtags stay in sync anyways, and we avoid extra joins and preload hassle) + embedded_hashtags(object) end - defp embedded_hashtags(%Object{data: data}) do + def embedded_hashtags(%Object{data: data}) do object_data_hashtags(data) end - defp embedded_hashtags(_), do: [] + def embedded_hashtags(_), do: [] def object_data_hashtags(%{"tag" => tags}) when is_list(tags) do tags -- cgit v1.2.3 From e7864a32d7c9930e5f6c62bd77cef64c68f1eb21 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 25 Jan 2021 22:31:23 +0300 Subject: [#3213] Removed DISTINCT clause from ActivityPub.fetch_activities_query/2. --- lib/pleroma/web/activity_pub/activity_pub.ex | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index fbda89a25..be81e0833 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1293,7 +1293,6 @@ def fetch_activities_query(recipients, opts \\ %{}) do true -> query - |> distinct([activity], true) |> restrict_hashtag_any(opts) |> restrict_hashtag_all(opts) |> restrict_hashtag_reject_any(opts) -- cgit v1.2.3 From 8373cb645b7f357eedbc3a45a2e75a81376e6ef8 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 18:15:04 -0600 Subject: Add sudo rule, remove quoting that breaks the for loop --- installation/apache-cache-purge.sh.example | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example index be1d36841..62997038d 100755 --- a/installation/apache-cache-purge.sh.example +++ b/installation/apache-cache-purge.sh.example @@ -1,6 +1,10 @@ #!/bin/sh # A simple shell script to delete a media from Apache's mod_disk_cache. +# You will likely need to setup a sudo rule like the following: +# +# Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean +# pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN SCRIPTNAME=${0##*/} @@ -11,15 +15,15 @@ CACHE_DIRECTORY="/tmp/pleroma-media-cache" ## $1 - the filename, can be a pattern . ## $2 - the cache directory. purge_item() { - htcacheclean -p "${2}" "${1}" + sudo htcacheclean -v -p "${2}" "${1}" } # purge_item purge() { - for url in "$@" + for url in $@ do echo "$SCRIPTNAME delete \`$url\` from cache ($CACHE_DIRECTORY)" purge_item "$url" $CACHE_DIRECTORY done } -purge "$@" +purge $@ -- cgit v1.2.3 From c6ef87d585b63e9e26b16176b65a67d10e4b706b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 18:20:07 -0600 Subject: Note the requirement for the url_format parameter --- installation/apache-cache-purge.sh.example | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/installation/apache-cache-purge.sh.example b/installation/apache-cache-purge.sh.example index 62997038d..7b4262875 100755 --- a/installation/apache-cache-purge.sh.example +++ b/installation/apache-cache-purge.sh.example @@ -5,6 +5,13 @@ # # Cmnd_Alias HTCACHECLEAN = /usr/local/sbin/htcacheclean # pleroma ALL=HTCACHECLEAN, NOPASSWD: HTCACHECLEAN +# +# Please also ensure you have enabled: +# +# config :pleroma, Pleroma.Web.MediaProxy.Invalidation.Script, url_format: :htcacheclean +# +# which will correctly format the URLs passed to this script for the htcacheclean utility. +# SCRIPTNAME=${0##*/} -- cgit v1.2.3 From 01fc7d809d33ea546abded0d1540e3b41dbb0e6a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 18:23:05 -0600 Subject: Clarify the state of mediaproxy cache invalidation for Apache --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6522fbdcd..66427764c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. - Admin API: Reports now ordered by newest - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. -- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation now supported +- Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script ### Added -- cgit v1.2.3 From 2cb5c16723b7e65e6e1bfae6bf8319f62d667def Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 25 Jan 2021 18:25:53 -0600 Subject: Credo --- lib/pleroma/web/mastodon_api/views/poll_view.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/views/poll_view.ex b/lib/pleroma/web/mastodon_api/views/poll_view.ex index de536c8fb..71bc8b949 100644 --- a/lib/pleroma/web/mastodon_api/views/poll_view.ex +++ b/lib/pleroma/web/mastodon_api/views/poll_view.ex @@ -25,7 +25,7 @@ def render("show.json", %{object: object, multiple: multiple, options: options} } if params[:for] do - # if a user is not authenticated Mastodon doesn't include `voted` & `own_votes` keys in response + # when unauthenticated Mastodon doesn't include `voted` & `own_votes` keys in response {voted, own_votes} = voted_and_own_votes(params, options) Map.merge(poll, %{voted: voted, own_votes: own_votes}) else -- cgit v1.2.3 From 875fbaae35fe73f01d7fd55c255043dda929e365 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Mon, 25 Jan 2021 15:34:59 +0300 Subject: support for expires_in/expires_at in filters --- CHANGELOG.md | 1 + benchmarks/load_testing/fetcher.ex | 5 +- config/config.exs | 1 + lib/pleroma/filter.ex | 124 +++++- .../web/api_spec/operations/filter_operation.ex | 33 +- .../mastodon_api/controllers/filter_controller.ex | 61 +-- lib/pleroma/workers/purge_expired_filter.ex | 43 ++ test/pleroma/filter_test.exs | 179 ++++---- .../controllers/filter_controller_test.exs | 465 ++++++++++++++++----- test/pleroma/workers/purge_expired_filter_test.exs | 30 ++ test/support/factory.ex | 3 +- 11 files changed, 710 insertions(+), 235 deletions(-) create mode 100644 lib/pleroma/workers/purge_expired_filter.ex create mode 100644 test/pleroma/workers/purge_expired_filter_test.exs diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ea242e11..226fa2bbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: Current user is now included in conversation if it's the only participant. - Mastodon API: Fixed last_status.account being not filled with account data. - Mastodon API: Fixed own_votes being not returned with poll data. + - Mastodon API: Support for expires_in/expires_at in the Filters.
## Unreleased (Patch) diff --git a/benchmarks/load_testing/fetcher.ex b/benchmarks/load_testing/fetcher.ex index dfbd916be..607b7d4cb 100644 --- a/benchmarks/load_testing/fetcher.ex +++ b/benchmarks/load_testing/fetcher.ex @@ -33,10 +33,11 @@ defp fetch_user(user) do end defp create_filter(user) do - Pleroma.Filter.create(%Pleroma.Filter{ + Pleroma.Filter.create(%{ user_id: user.id, phrase: "must be filtered", - hide: true + hide: true, + context: ["home"] }) end diff --git a/config/config.exs b/config/config.exs index 5eca250bb..715524e84 100644 --- a/config/config.exs +++ b/config/config.exs @@ -543,6 +543,7 @@ queues: [ activity_expiration: 10, token_expiration: 5, + filter_expiration: 1, backup: 1, federator_incoming: 50, federator_outgoing: 50, diff --git a/lib/pleroma/filter.ex b/lib/pleroma/filter.ex index fc531f7fc..82b9caf9b 100644 --- a/lib/pleroma/filter.ex +++ b/lib/pleroma/filter.ex @@ -11,6 +11,9 @@ defmodule Pleroma.Filter do alias Pleroma.Repo alias Pleroma.User + @type t() :: %__MODULE__{} + @type format() :: :postgres | :re + schema "filters" do belongs_to(:user, User, type: FlakeId.Ecto.CompatType) field(:filter_id, :integer) @@ -18,15 +21,16 @@ defmodule Pleroma.Filter do field(:whole_word, :boolean, default: true) field(:phrase, :string) field(:context, {:array, :string}) - field(:expires_at, :utc_datetime) + field(:expires_at, :naive_datetime) timestamps() end + @spec get(integer() | String.t(), User.t()) :: t() | nil def get(id, %{id: user_id} = _user) do query = from( - f in Pleroma.Filter, + f in __MODULE__, where: f.filter_id == ^id, where: f.user_id == ^user_id ) @@ -34,14 +38,17 @@ def get(id, %{id: user_id} = _user) do Repo.one(query) end + @spec get_active(Ecto.Query.t() | module()) :: Ecto.Query.t() def get_active(query) do from(f in query, where: is_nil(f.expires_at) or f.expires_at > ^NaiveDateTime.utc_now()) end + @spec get_irreversible(Ecto.Query.t()) :: Ecto.Query.t() def get_irreversible(query) do from(f in query, where: f.hide) end + @spec get_filters(Ecto.Query.t() | module(), User.t()) :: [t()] def get_filters(query \\ __MODULE__, %User{id: user_id}) do query = from( @@ -53,7 +60,32 @@ def get_filters(query \\ __MODULE__, %User{id: user_id}) do Repo.all(query) end - def create(%Pleroma.Filter{user_id: user_id, filter_id: nil} = filter) do + @spec create(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()} + def create(attrs \\ %{}) do + Repo.transaction(fn -> create_with_expiration(attrs) end) + end + + defp create_with_expiration(attrs) do + with {:ok, filter} <- do_create(attrs), + {:ok, _} <- maybe_add_expiration_job(filter) do + filter + else + {:error, error} -> Repo.rollback(error) + end + end + + defp do_create(attrs) do + %__MODULE__{} + |> cast(attrs, [:phrase, :context, :hide, :expires_at, :whole_word, :user_id, :filter_id]) + |> maybe_add_filter_id() + |> validate_required([:phrase, :context, :user_id, :filter_id]) + |> maybe_add_expires_at(attrs) + |> Repo.insert() + end + + defp maybe_add_filter_id(%{changes: %{filter_id: _}} = changeset), do: changeset + + defp maybe_add_filter_id(%{changes: %{user_id: user_id}} = changeset) do # If filter_id wasn't given, use the max filter_id for this user plus 1. # XXX This could result in a race condition if a user tries to add two # different filters for their account from two different clients at the @@ -61,7 +93,7 @@ def create(%Pleroma.Filter{user_id: user_id, filter_id: nil} = filter) do max_id_query = from( - f in Pleroma.Filter, + f in __MODULE__, where: f.user_id == ^user_id, select: max(f.filter_id) ) @@ -76,34 +108,92 @@ def create(%Pleroma.Filter{user_id: user_id, filter_id: nil} = filter) do max_id + 1 end - filter - |> Map.put(:filter_id, filter_id) - |> Repo.insert() + change(changeset, filter_id: filter_id) + end + + # don't override expires_at, if passed expires_at and expires_in + defp maybe_add_expires_at(%{changes: %{expires_at: %NaiveDateTime{} = _}} = changeset, _) do + changeset end - def create(%Pleroma.Filter{} = filter) do - Repo.insert(filter) + defp maybe_add_expires_at(changeset, %{expires_in: expires_in}) + when is_integer(expires_in) and expires_in > 0 do + expires_at = + NaiveDateTime.utc_now() + |> NaiveDateTime.add(expires_in) + |> NaiveDateTime.truncate(:second) + + change(changeset, expires_at: expires_at) end - def delete(%Pleroma.Filter{id: filter_key} = filter) when is_number(filter_key) do - Repo.delete(filter) + defp maybe_add_expires_at(changeset, %{expires_in: nil}) do + change(changeset, expires_at: nil) end - def delete(%Pleroma.Filter{id: filter_key} = filter) when is_nil(filter_key) do - %Pleroma.Filter{id: id} = get(filter.filter_id, %{id: filter.user_id}) + defp maybe_add_expires_at(changeset, _), do: changeset - filter - |> Map.put(:id, id) - |> Repo.delete() + defp maybe_add_expiration_job(%{expires_at: %NaiveDateTime{} = expires_at} = filter) do + Pleroma.Workers.PurgeExpiredFilter.enqueue(%{ + filter_id: filter.id, + expires_at: DateTime.from_naive!(expires_at, "Etc/UTC") + }) end - def update(%Pleroma.Filter{} = filter, params) do + defp maybe_add_expiration_job(_), do: {:ok, nil} + + @spec delete(t()) :: {:ok, t()} | {:error, Ecto.Changeset.t()} + def delete(%__MODULE__{} = filter) do + Repo.transaction(fn -> delete_with_expiration(filter) end) + end + + defp delete_with_expiration(filter) do + with {:ok, _} <- maybe_delete_old_expiration_job(filter, nil), + {:ok, filter} <- Repo.delete(filter) do + filter + else + {:error, error} -> Repo.rollback(error) + end + end + + @spec update(t(), map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()} + def update(%__MODULE__{} = filter, params) do + Repo.transaction(fn -> update_with_expiration(filter, params) end) + end + + defp update_with_expiration(filter, params) do + with {:ok, updated} <- do_update(filter, params), + {:ok, _} <- maybe_delete_old_expiration_job(filter, updated), + {:ok, _} <- + maybe_add_expiration_job(updated) do + updated + else + {:error, error} -> Repo.rollback(error) + end + end + + defp do_update(filter, params) do filter |> cast(params, [:phrase, :context, :hide, :expires_at, :whole_word]) |> validate_required([:phrase, :context]) + |> maybe_add_expires_at(params) |> Repo.update() end + defp maybe_delete_old_expiration_job(%{expires_at: nil}, _), do: {:ok, nil} + + defp maybe_delete_old_expiration_job(%{expires_at: expires_at}, %{expires_at: expires_at}) do + {:ok, nil} + end + + defp maybe_delete_old_expiration_job(%{id: id}, _) do + with %Oban.Job{} = job <- Pleroma.Workers.PurgeExpiredFilter.get_expiration(id) do + Repo.delete(job) + else + nil -> {:ok, nil} + end + end + + @spec compose_regex(User.t() | [t()], format()) :: String.t() | Regex.t() | nil def compose_regex(user_or_filters, format \\ :postgres) def compose_regex(%User{} = user, format) do diff --git a/lib/pleroma/web/api_spec/operations/filter_operation.ex b/lib/pleroma/web/api_spec/operations/filter_operation.ex index c5b0c035b..9374a7868 100644 --- a/lib/pleroma/web/api_spec/operations/filter_operation.ex +++ b/lib/pleroma/web/api_spec/operations/filter_operation.ex @@ -6,6 +6,7 @@ defmodule Pleroma.Web.ApiSpec.FilterOperation do alias OpenApiSpex.Operation alias OpenApiSpex.Schema alias Pleroma.Web.ApiSpec.Helpers + alias Pleroma.Web.ApiSpec.Schemas.ApiError alias Pleroma.Web.ApiSpec.Schemas.BooleanLike def open_api_operation(action) do @@ -20,7 +21,8 @@ def index_operation do operationId: "FilterController.index", security: [%{"oAuth" => ["read:filters"]}], responses: %{ - 200 => Operation.response("Filters", "application/json", array_of_filters()) + 200 => Operation.response("Filters", "application/json", array_of_filters()), + 403 => Operation.response("Error", "application/json", ApiError) } } end @@ -32,7 +34,10 @@ def create_operation do operationId: "FilterController.create", requestBody: Helpers.request_body("Parameters", create_request(), required: true), security: [%{"oAuth" => ["write:filters"]}], - responses: %{200 => Operation.response("Filter", "application/json", filter())} + responses: %{ + 200 => Operation.response("Filter", "application/json", filter()), + 403 => Operation.response("Error", "application/json", ApiError) + } } end @@ -44,7 +49,9 @@ def show_operation do operationId: "FilterController.show", security: [%{"oAuth" => ["read:filters"]}], responses: %{ - 200 => Operation.response("Filter", "application/json", filter()) + 200 => Operation.response("Filter", "application/json", filter()), + 403 => Operation.response("Error", "application/json", ApiError), + 404 => Operation.response("Error", "application/json", ApiError) } } end @@ -58,7 +65,8 @@ def update_operation do requestBody: Helpers.request_body("Parameters", update_request(), required: true), security: [%{"oAuth" => ["write:filters"]}], responses: %{ - 200 => Operation.response("Filter", "application/json", filter()) + 200 => Operation.response("Filter", "application/json", filter()), + 403 => Operation.response("Error", "application/json", ApiError) } } end @@ -75,7 +83,8 @@ def delete_operation do Operation.response("Filter", "application/json", %Schema{ type: :object, description: "Empty object" - }) + }), + 403 => Operation.response("Error", "application/json", ApiError) } } end @@ -210,15 +219,13 @@ defp update_request do nullable: true, description: "Consider word boundaries?", default: true + }, + expires_in: %Schema{ + nullable: true, + type: :integer, + description: + "Number of seconds from now the filter should expire. Otherwise, null for a filter that doesn't expire." } - # TODO: probably should implement filter expiration - # expires_in: %Schema{ - # type: :string, - # format: :"date-time", - # description: - # "ISO 8601 Datetime for when the filter expires. Otherwise, - # null for a filter that doesn't expire." - # } }, required: [:phrase, :context], example: %{ diff --git a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex index c8b4a3095..9b1ae809d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/filter_controller.ex @@ -20,6 +20,8 @@ defmodule Pleroma.Web.MastodonAPI.FilterController do defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.FilterOperation + action_fallback(Pleroma.Web.MastodonAPI.FallbackController) + @doc "GET /api/v1/filters" def index(%{assigns: %{user: user}} = conn, _) do filters = Filter.get_filters(user) @@ -29,25 +31,23 @@ def index(%{assigns: %{user: user}} = conn, _) do @doc "POST /api/v1/filters" def create(%{assigns: %{user: user}, body_params: params} = conn, _) do - query = %Filter{ - user_id: user.id, - phrase: params.phrase, - context: params.context, - hide: params.irreversible, - whole_word: params.whole_word - # TODO: support `expires_in` parameter (as in Mastodon API) - } - - {:ok, response} = Filter.create(query) - - render(conn, "show.json", filter: response) + with {:ok, response} <- + params + |> Map.put(:user_id, user.id) + |> Map.put(:hide, params[:irreversible]) + |> Map.delete(:irreversible) + |> Filter.create() do + render(conn, "show.json", filter: response) + end end @doc "GET /api/v1/filters/:id" def show(%{assigns: %{user: user}} = conn, %{id: filter_id}) do - filter = Filter.get(filter_id, user) - - render(conn, "show.json", filter: filter) + with %Filter{} = filter <- Filter.get(filter_id, user) do + render(conn, "show.json", filter: filter) + else + nil -> {:error, :not_found} + end end @doc "PUT /api/v1/filters/:id" @@ -56,28 +56,31 @@ def update( %{id: filter_id} ) do params = - params - |> Map.delete(:irreversible) - |> Map.put(:hide, params[:irreversible]) - |> Enum.reject(fn {_key, value} -> is_nil(value) end) - |> Map.new() - - # TODO: support `expires_in` parameter (as in Mastodon API) + if is_boolean(params[:irreversible]) do + params + |> Map.put(:hide, params[:irreversible]) + |> Map.delete(:irreversible) + else + params + end with %Filter{} = filter <- Filter.get(filter_id, user), {:ok, %Filter{} = filter} <- Filter.update(filter, params) do render(conn, "show.json", filter: filter) + else + nil -> {:error, :not_found} + error -> error end end @doc "DELETE /api/v1/filters/:id" def delete(%{assigns: %{user: user}} = conn, %{id: filter_id}) do - query = %Filter{ - user_id: user.id, - filter_id: filter_id - } - - {:ok, _} = Filter.delete(query) - json(conn, %{}) + with %Filter{} = filter <- Filter.get(filter_id, user), + {:ok, _} <- Filter.delete(filter) do + json(conn, %{}) + else + nil -> {:error, :not_found} + error -> error + end end end diff --git a/lib/pleroma/workers/purge_expired_filter.ex b/lib/pleroma/workers/purge_expired_filter.ex new file mode 100644 index 000000000..9c3db8af2 --- /dev/null +++ b/lib/pleroma/workers/purge_expired_filter.ex @@ -0,0 +1,43 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Workers.PurgeExpiredFilter do + @moduledoc """ + Worker which purges expired filters + """ + + use Oban.Worker, queue: :filter_expiration, max_attempts: 1, unique: [fields: [:args]] + + import Ecto.Query + + alias Oban.Job + alias Pleroma.Repo + + @spec enqueue(%{filter_id: integer(), expires_at: DateTime.t()}) :: + {:ok, Job.t()} | {:error, Ecto.Changeset.t()} + def enqueue(args) do + {scheduled_at, args} = Map.pop(args, :expires_at) + + args + |> new(scheduled_at: scheduled_at) + |> Oban.insert() + end + + @impl true + def perform(%Job{args: %{"filter_id" => id}}) do + Pleroma.Filter + |> Repo.get(id) + |> Repo.delete() + end + + @spec get_expiration(pos_integer()) :: Job.t() | nil + def get_expiration(id) do + from(j in Job, + where: j.state == "scheduled", + where: j.queue == "filter_expiration", + where: fragment("?->'filter_id' = ?", j.args, ^id) + ) + |> Repo.one() + end +end diff --git a/test/pleroma/filter_test.exs b/test/pleroma/filter_test.exs index a9e256e8c..19ad6b8c0 100644 --- a/test/pleroma/filter_test.exs +++ b/test/pleroma/filter_test.exs @@ -7,81 +7,120 @@ defmodule Pleroma.FilterTest do import Pleroma.Factory + alias Oban.Job alias Pleroma.Filter - alias Pleroma.Repo + + setup do + [user: insert(:user)] + end describe "creating filters" do - test "creating one filter" do - user = insert(:user) + test "creation validation error", %{user: user} do + attrs = %{ + user_id: user.id, + expires_in: 60 + } + + {:error, _} = Filter.create(attrs) + + assert Repo.all(Job) == [] + end - query = %Filter{ + test "use passed expires_at instead expires_in", %{user: user} do + now = NaiveDateTime.utc_now() + + attrs = %{ user_id: user.id, - filter_id: 42, + expires_at: now, phrase: "knights", - context: ["home"] + context: ["home"], + expires_in: 600 } - {:ok, %Filter{} = filter} = Filter.create(query) + {:ok, %Filter{} = filter} = Filter.create(attrs) + result = Filter.get(filter.filter_id, user) - assert query.phrase == result.phrase - end + assert result.expires_at == NaiveDateTime.truncate(now, :second) - test "creating one filter without a pre-defined filter_id" do - user = insert(:user) + [job] = Repo.all(Job) - query = %Filter{ + assert DateTime.truncate(job.scheduled_at, :second) == + now |> NaiveDateTime.truncate(:second) |> DateTime.from_naive!("Etc/UTC") + end + + test "creating one filter", %{user: user} do + attrs = %{ user_id: user.id, + filter_id: 42, phrase: "knights", context: ["home"] } - {:ok, %Filter{} = filter} = Filter.create(query) - # Should start at 1 - assert filter.filter_id == 1 + {:ok, %Filter{} = filter} = Filter.create(attrs) + result = Filter.get(filter.filter_id, user) + assert attrs.phrase == result.phrase end - test "creating additional filters uses previous highest filter_id + 1" do - user = insert(:user) - - query_one = %Filter{ + test "creating with expired_at", %{user: user} do + attrs = %{ user_id: user.id, filter_id: 42, phrase: "knights", + context: ["home"], + expires_in: 60 + } + + {:ok, %Filter{} = filter} = Filter.create(attrs) + result = Filter.get(filter.filter_id, user) + assert attrs.phrase == result.phrase + + assert [_] = Repo.all(Job) + end + + test "creating one filter without a pre-defined filter_id", %{user: user} do + attrs = %{ + user_id: user.id, + phrase: "knights", context: ["home"] } - {:ok, %Filter{} = filter_one} = Filter.create(query_one) + {:ok, %Filter{} = filter} = Filter.create(attrs) + # Should start at 1 + assert filter.filter_id == 1 + end + + test "creating additional filters uses previous highest filter_id + 1", %{user: user} do + filter1 = insert(:filter, user: user) - query_two = %Filter{ + attrs = %{ user_id: user.id, # No filter_id phrase: "who", context: ["home"] } - {:ok, %Filter{} = filter_two} = Filter.create(query_two) - assert filter_two.filter_id == filter_one.filter_id + 1 + {:ok, %Filter{} = filter2} = Filter.create(attrs) + assert filter2.filter_id == filter1.filter_id + 1 end - test "filter_id is unique per user" do - user_one = insert(:user) + test "filter_id is unique per user", %{user: user_one} do user_two = insert(:user) - query_one = %Filter{ + attrs1 = %{ user_id: user_one.id, phrase: "knights", context: ["home"] } - {:ok, %Filter{} = filter_one} = Filter.create(query_one) + {:ok, %Filter{} = filter_one} = Filter.create(attrs1) - query_two = %Filter{ + attrs2 = %{ user_id: user_two.id, phrase: "who", context: ["home"] } - {:ok, %Filter{} = filter_two} = Filter.create(query_two) + {:ok, %Filter{} = filter_two} = Filter.create(attrs2) assert filter_one.filter_id == 1 assert filter_two.filter_id == 1 @@ -94,65 +133,61 @@ test "filter_id is unique per user" do end end - test "deleting a filter" do - user = insert(:user) + test "deleting a filter", %{user: user} do + filter = insert(:filter, user: user) - query = %Filter{ - user_id: user.id, - filter_id: 0, - phrase: "knights", - context: ["home"] - } - - {:ok, _filter} = Filter.create(query) - {:ok, filter} = Filter.delete(query) - assert is_nil(Repo.get(Filter, filter.filter_id)) + assert Repo.get(Filter, filter.id) + {:ok, filter} = Filter.delete(filter) + refute Repo.get(Filter, filter.id) end - test "getting all filters by an user" do - user = insert(:user) - - query_one = %Filter{ + test "deleting a filter with expires_at is removing Oban job too", %{user: user} do + attrs = %{ user_id: user.id, - filter_id: 1, - phrase: "knights", - context: ["home"] + phrase: "cofe", + context: ["home"], + expires_in: 600 } - query_two = %Filter{ - user_id: user.id, - filter_id: 2, - phrase: "who", - context: ["home"] - } + {:ok, filter} = Filter.create(attrs) + assert %Job{id: job_id} = Pleroma.Workers.PurgeExpiredFilter.get_expiration(filter.id) + {:ok, _} = Filter.delete(filter) - {:ok, filter_one} = Filter.create(query_one) - {:ok, filter_two} = Filter.create(query_two) - filters = Filter.get_filters(user) - assert filter_one in filters - assert filter_two in filters + assert Repo.get(Job, job_id) == nil end - test "updating a filter" do - user = insert(:user) + test "getting all filters by an user", %{user: user} do + filter1 = insert(:filter, user: user) + filter2 = insert(:filter, user: user) - query_one = %Filter{ - user_id: user.id, - filter_id: 1, - phrase: "knights", - context: ["home"] - } + filter_ids = user |> Filter.get_filters() |> collect_ids() + + assert filter1.id in filter_ids + assert filter2.id in filter_ids + end + + test "updating a filter", %{user: user} do + filter = insert(:filter, user: user) changes = %{ phrase: "who", context: ["home", "timeline"] } - {:ok, filter_one} = Filter.create(query_one) - {:ok, filter_two} = Filter.update(filter_one, changes) + {:ok, updated_filter} = Filter.update(filter, changes) + + assert filter != updated_filter + assert updated_filter.phrase == changes.phrase + assert updated_filter.context == changes.context + end + + test "updating with error", %{user: user} do + filter = insert(:filter, user: user) + + changes = %{ + phrase: nil + } - assert filter_one != filter_two - assert filter_two.phrase == changes.phrase - assert filter_two.context == changes.context + {:error, _} = Filter.update(filter, changes) end end diff --git a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs index dc6739178..98ab9e717 100644 --- a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs @@ -4,149 +4,412 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do use Pleroma.Web.ConnCase, async: true + use Oban.Testing, repo: Pleroma.Repo - alias Pleroma.Web.MastodonAPI.FilterView + import Pleroma.Factory - test "creating a filter" do - %{conn: conn} = oauth_access(["write:filters"]) + alias Pleroma.Filter + alias Pleroma.Repo + alias Pleroma.Workers.PurgeExpiredFilter - filter = %Pleroma.Filter{ - phrase: "knights", - context: ["home"] - } - - conn = + test "non authenticated creation request", %{conn: conn} do + response = conn |> put_req_header("content-type", "application/json") - |> post("/api/v1/filters", %{"phrase" => filter.phrase, context: filter.context}) - - assert response = json_response_and_validate_schema(conn, 200) - assert response["phrase"] == filter.phrase - assert response["context"] == filter.context - assert response["irreversible"] == false - assert response["id"] != nil - assert response["id"] != "" + |> post("/api/v1/filters", %{"phrase" => "knights", context: ["home"]}) + |> json_response(403) + + assert response["error"] == "Invalid credentials." + end + + describe "creating" do + setup do: oauth_access(["write:filters"]) + + test "a common filter", %{conn: conn, user: user} do + params = %{ + phrase: "knights", + context: ["home"], + irreversible: true + } + + response = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/filters", params) + |> json_response_and_validate_schema(200) + + assert response["phrase"] == params.phrase + assert response["context"] == params.context + assert response["irreversible"] == true + assert response["id"] != nil + assert response["id"] != "" + assert response["expires_at"] == nil + + filter = Filter.get(response["id"], user) + assert filter.hide == true + end + + test "a filter with expires_in", %{conn: conn, user: user} do + in_seconds = 600 + + response = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/filters", %{ + "phrase" => "knights", + context: ["home"], + expires_in: in_seconds + }) + |> json_response_and_validate_schema(200) + + assert response["irreversible"] == false + + expires_at = + NaiveDateTime.utc_now() + |> NaiveDateTime.add(in_seconds) + |> Pleroma.Web.CommonAPI.Utils.to_masto_date() + + assert response["expires_at"] == expires_at + + filter = Filter.get(response["id"], user) + + id = filter.id + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + assert {:ok, %{id: ^id}} = + perform_job(PurgeExpiredFilter, %{ + filter_id: filter.id + }) + + assert Repo.aggregate(Filter, :count, :id) == 0 + end end test "fetching a list of filters" do %{user: user, conn: conn} = oauth_access(["read:filters"]) - query_one = %Pleroma.Filter{ - user_id: user.id, - filter_id: 1, - phrase: "knights", - context: ["home"] - } + %{filter_id: id1} = insert(:filter, user: user) + %{filter_id: id2} = insert(:filter, user: user) - query_two = %Pleroma.Filter{ - user_id: user.id, - filter_id: 2, - phrase: "who", - context: ["home"] - } + id1 = to_string(id1) + id2 = to_string(id2) - {:ok, filter_one} = Pleroma.Filter.create(query_one) - {:ok, filter_two} = Pleroma.Filter.create(query_two) + assert [%{"id" => ^id2}, %{"id" => ^id1}] = + conn + |> get("/api/v1/filters") + |> json_response_and_validate_schema(200) + end + + test "fetching a list of filters without token", %{conn: conn} do + insert(:filter) response = conn |> get("/api/v1/filters") - |> json_response_and_validate_schema(200) - - assert response == - render_json( - FilterView, - "index.json", - filters: [filter_two, filter_one] - ) + |> json_response(403) + + assert response["error"] == "Invalid credentials." end test "get a filter" do %{user: user, conn: conn} = oauth_access(["read:filters"]) # check whole_word false - query = %Pleroma.Filter{ - user_id: user.id, - filter_id: 2, - phrase: "knight", - context: ["home"], - whole_word: false - } - - {:ok, filter} = Pleroma.Filter.create(query) + filter = insert(:filter, user: user, whole_word: false) - conn = get(conn, "/api/v1/filters/#{filter.filter_id}") + resp1 = + conn |> get("/api/v1/filters/#{filter.filter_id}") |> json_response_and_validate_schema(200) - assert response = json_response_and_validate_schema(conn, 200) - assert response["whole_word"] == false + assert resp1["whole_word"] == false # check whole_word true - %{user: user, conn: conn} = oauth_access(["read:filters"]) - - query = %Pleroma.Filter{ - user_id: user.id, - filter_id: 3, - phrase: "knight", - context: ["home"], - whole_word: true - } + filter = insert(:filter, user: user, whole_word: true) - {:ok, filter} = Pleroma.Filter.create(query) + resp2 = + conn |> get("/api/v1/filters/#{filter.filter_id}") |> json_response_and_validate_schema(200) - conn = get(conn, "/api/v1/filters/#{filter.filter_id}") - - assert response = json_response_and_validate_schema(conn, 200) - assert response["whole_word"] == true + assert resp2["whole_word"] == true end - test "update a filter" do - %{user: user, conn: conn} = oauth_access(["write:filters"]) + test "get a filter not_found error" do + filter = insert(:filter) + %{conn: conn} = oauth_access(["read:filters"]) - query = %Pleroma.Filter{ - user_id: user.id, - filter_id: 2, - phrase: "knight", - context: ["home"], - hide: true, - whole_word: true - } + response = + conn |> get("/api/v1/filters/#{filter.filter_id}") |> json_response_and_validate_schema(404) - {:ok, _filter} = Pleroma.Filter.create(query) + assert response["error"] == "Record not found" + end + + describe "updating a filter" do + setup do: oauth_access(["write:filters"]) + + test "common" do + %{conn: conn, user: user} = oauth_access(["write:filters"]) + + filter = + insert(:filter, + user: user, + hide: true, + whole_word: true + ) + + params = %{ + phrase: "nii", + context: ["public"], + irreversible: false + } + + response = + conn + |> put_req_header("content-type", "application/json") + |> put("/api/v1/filters/#{filter.filter_id}", params) + |> json_response_and_validate_schema(200) + + assert response["phrase"] == params.phrase + assert response["context"] == params.context + assert response["irreversible"] == false + assert response["whole_word"] == true + end + + test "with adding expires_at", %{conn: conn, user: user} do + filter = insert(:filter, user: user) + in_seconds = 600 + + response = + conn + |> put_req_header("content-type", "application/json") + |> put("/api/v1/filters/#{filter.filter_id}", %{ + phrase: "nii", + context: ["public"], + expires_in: in_seconds, + irreversible: true + }) + |> json_response_and_validate_schema(200) + + assert response["irreversible"] == true + + assert response["expires_at"] == + NaiveDateTime.utc_now() + |> NaiveDateTime.add(in_seconds) + |> Pleroma.Web.CommonAPI.Utils.to_masto_date() + + filter = Filter.get(response["id"], user) + + id = filter.id + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: id} + ) + + assert {:ok, %{id: ^id}} = + perform_job(PurgeExpiredFilter, %{ + filter_id: id + }) + + assert Repo.aggregate(Filter, :count, :id) == 0 + end + + test "with removing expires_at", %{conn: conn, user: user} do + response = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/filters", %{ + phrase: "cofe", + context: ["home"], + expires_in: 600 + }) + |> json_response_and_validate_schema(200) + + filter = Filter.get(response["id"], user) + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + response = + conn + |> put_req_header("content-type", "application/json") + |> put("/api/v1/filters/#{filter.filter_id}", %{ + phrase: "nii", + context: ["public"], + expires_in: nil, + whole_word: true + }) + |> json_response_and_validate_schema(200) + + refute_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + assert response["irreversible"] == false + assert response["whole_word"] == true + assert response["expires_at"] == nil + end + + test "expires_at is the same in create and update so job is in db", %{conn: conn, user: user} do + resp1 = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/filters", %{ + phrase: "cofe", + context: ["home"], + expires_in: 600 + }) + |> json_response_and_validate_schema(200) + + filter = Filter.get(resp1["id"], user) + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + job = PurgeExpiredFilter.get_expiration(filter.id) + + resp2 = + conn + |> put_req_header("content-type", "application/json") + |> put("/api/v1/filters/#{filter.filter_id}", %{ + phrase: "nii", + context: ["public"] + }) + |> json_response_and_validate_schema(200) + + updated_filter = Filter.get(resp2["id"], user) + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: updated_filter.id} + ) + + after_update = PurgeExpiredFilter.get_expiration(updated_filter.id) + + assert resp1["expires_at"] == resp2["expires_at"] + + assert job.scheduled_at == after_update.scheduled_at + end + + test "updating expires_at updates oban job too", %{conn: conn, user: user} do + resp1 = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/filters", %{ + phrase: "cofe", + context: ["home"], + expires_in: 600 + }) + |> json_response_and_validate_schema(200) + + filter = Filter.get(resp1["id"], user) + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + job = PurgeExpiredFilter.get_expiration(filter.id) + + resp2 = + conn + |> put_req_header("content-type", "application/json") + |> put("/api/v1/filters/#{filter.filter_id}", %{ + phrase: "nii", + context: ["public"], + expires_in: 300 + }) + |> json_response_and_validate_schema(200) + + updated_filter = Filter.get(resp2["id"], user) + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: updated_filter.id} + ) + + after_update = PurgeExpiredFilter.get_expiration(updated_filter.id) + + refute resp1["expires_at"] == resp2["expires_at"] + + refute job.scheduled_at == after_update.scheduled_at + end + end - new = %Pleroma.Filter{ - phrase: "nii", - context: ["home"] - } + test "update filter without token", %{conn: conn} do + filter = insert(:filter) - conn = + response = conn |> put_req_header("content-type", "application/json") - |> put("/api/v1/filters/#{query.filter_id}", %{ - phrase: new.phrase, - context: new.context + |> put("/api/v1/filters/#{filter.filter_id}", %{ + phrase: "nii", + context: ["public"] }) + |> json_response(403) - assert response = json_response_and_validate_schema(conn, 200) - assert response["phrase"] == new.phrase - assert response["context"] == new.context - assert response["irreversible"] == true - assert response["whole_word"] == true + assert response["error"] == "Invalid credentials." end - test "delete a filter" do - %{user: user, conn: conn} = oauth_access(["write:filters"]) - - query = %Pleroma.Filter{ - user_id: user.id, - filter_id: 2, - phrase: "knight", - context: ["home"] - } + describe "delete a filter" do + setup do: oauth_access(["write:filters"]) + + test "common", %{conn: conn, user: user} do + filter = insert(:filter, user: user) + + assert conn + |> delete("/api/v1/filters/#{filter.filter_id}") + |> json_response_and_validate_schema(200) == %{} + + assert Repo.all(Filter) == [] + end + + test "with expires_at", %{conn: conn, user: user} do + response = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/filters", %{ + phrase: "cofe", + context: ["home"], + expires_in: 600 + }) + |> json_response_and_validate_schema(200) + + filter = Filter.get(response["id"], user) + + assert_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + assert conn + |> delete("/api/v1/filters/#{filter.filter_id}") + |> json_response_and_validate_schema(200) == %{} + + refute_enqueued( + worker: PurgeExpiredFilter, + args: %{filter_id: filter.id} + ) + + assert Repo.all(Filter) == [] + assert Repo.all(Oban.Job) == [] + end + end - {:ok, filter} = Pleroma.Filter.create(query) + test "delete a filter without token", %{conn: conn} do + filter = insert(:filter) - conn = delete(conn, "/api/v1/filters/#{filter.filter_id}") + response = + conn + |> delete("/api/v1/filters/#{filter.filter_id}") + |> json_response(403) - assert json_response_and_validate_schema(conn, 200) == %{} + assert response["error"] == "Invalid credentials." end end diff --git a/test/pleroma/workers/purge_expired_filter_test.exs b/test/pleroma/workers/purge_expired_filter_test.exs new file mode 100644 index 000000000..d10586be9 --- /dev/null +++ b/test/pleroma/workers/purge_expired_filter_test.exs @@ -0,0 +1,30 @@ +defmodule Pleroma.Workers.PurgeExpiredFilterTest do + use Pleroma.DataCase, async: true + use Oban.Testing, repo: Repo + + import Pleroma.Factory + + test "purges expired filter" do + %{id: user_id} = insert(:user) + + {:ok, %{id: id}} = + Pleroma.Filter.create(%{ + user_id: user_id, + phrase: "cofe", + context: ["home"], + expires_in: 600 + }) + + assert_enqueued( + worker: Pleroma.Workers.PurgeExpiredFilter, + args: %{filter_id: id} + ) + + assert {:ok, %{id: ^id}} = + perform_job(Pleroma.Workers.PurgeExpiredFilter, %{ + filter_id: id + }) + + assert Repo.aggregate(Pleroma.Filter, :count, :id) == 0 + end +end diff --git a/test/support/factory.ex b/test/support/factory.ex index bf9592064..284d573f9 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -455,7 +455,8 @@ def filter_factory do %Pleroma.Filter{ user: build(:user), filter_id: sequence(:filter_id, & &1), - phrase: "cofe" + phrase: "cofe", + context: ["home"] } end end -- cgit v1.2.3 From e854c35e652ce51821116cc7032099cd5534f7a6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 26 Jan 2021 11:58:43 -0600 Subject: Convert tests to all use clear_config instead of Pleroma.Config.put --- test/mix/tasks/pleroma/robots_txt_test.exs | 4 +- test/pleroma/activity_test.exs | 4 +- test/pleroma/application_requirements_test.exs | 27 ++++---- test/pleroma/captcha_test.exs | 6 +- test/pleroma/config_test.exs | 36 +++++----- test/pleroma/gun/connection_pool_test.exs | 3 +- test/pleroma/http/adapter_helper/gun_test.exs | 13 +--- test/pleroma/object/fetcher_test.exs | 11 ++- .../repo/migrations/autolinker_to_linkify_test.exs | 2 +- .../fix_malformed_formatter_config_test.exs | 2 +- test/pleroma/scheduled_activity_test.exs | 4 +- .../upload/filter/anonymize_filename_test.exs | 5 +- test/pleroma/upload/filter_test.exs | 3 +- test/pleroma/uploaders/s3_test.exs | 7 +- test/pleroma/user/backup_test.exs | 8 +-- test/pleroma/user/welcome_chat_message_test.exs | 7 +- test/pleroma/user/welcome_email_test.exs | 10 +-- test/pleroma/user/welcome_message_test.exs | 7 +- test/pleroma/user_search_test.exs | 6 +- test/pleroma/user_test.exs | 76 ++++++++++---------- .../activity_pub/activity_pub_controller_test.exs | 19 +++-- .../pleroma/web/activity_pub/activity_pub_test.exs | 6 +- .../activity_pub/mrf/hellthread_policy_test.exs | 12 ++-- .../web/activity_pub/mrf/keyword_policy_test.exs | 26 +++---- .../web/activity_pub/mrf/mention_policy_test.exs | 12 ++-- .../activity_pub/mrf/object_age_policy_test.exs | 19 +++-- .../activity_pub/mrf/reject_non_public_test.exs | 8 +-- .../web/activity_pub/mrf/simple_policy_test.exs | 81 +++++++++++----------- .../web/activity_pub/mrf/subchain_policy_test.exs | 4 +- .../mrf/user_allow_list_policy_test.exs | 4 +- .../activity_pub/mrf/vocabulary_policy_test.exs | 14 ++-- .../object_validators/chat_validation_test.exs | 2 +- .../transmogrifier/follow_handling_test.exs | 2 +- .../transmogrifier/note_handling_test.exs | 12 ++-- .../controllers/config_controller_test.exs | 9 +-- .../controllers/invite_controller_test.exs | 9 ++- .../media_proxy_cache_controller_test.exs | 6 +- test/pleroma/web/chat_channel_test.exs | 2 +- test/pleroma/web/common_api_test.exs | 8 +-- test/pleroma/web/federator_test.exs | 6 +- test/pleroma/web/feed/tag_controller_test.exs | 5 +- test/pleroma/web/feed/user_controller_test.exs | 5 +- .../controllers/account_controller_test.exs | 2 +- .../scheduled_activity_controller_test.exs | 4 +- .../controllers/status_controller_test.exs | 9 ++- .../web/mastodon_api/masto_fe_controller_test.exs | 3 +- .../web/mastodon_api/views/account_view_test.exs | 3 +- test/pleroma/web/media_proxy/invalidation_test.exs | 17 +++-- .../media_proxy/media_proxy_controller_test.exs | 4 +- .../web/metadata/providers/open_graph_test.exs | 2 +- .../web/metadata/providers/twitter_card_test.exs | 2 +- test/pleroma/web/node_info_test.exs | 8 +-- test/pleroma/web/o_auth/o_auth_controller_test.exs | 8 +-- .../controllers/emoji_pack_controller_test.exs | 2 +- .../admin_secret_authentication_plug_test.exs | 4 +- .../ensure_public_or_authenticated_plug_test.exs | 7 +- test/pleroma/web/plugs/federating_plug_test.exs | 4 +- .../pleroma/web/plugs/http_signature_plug_test.exs | 6 +- test/pleroma/web/plugs/o_auth_scopes_plug_test.exs | 4 +- test/pleroma/web/plugs/rate_limiter_test.exs | 37 +++++----- test/pleroma/web/plugs/remote_ip_test.exs | 12 ++-- test/pleroma/web/plugs/user_enabled_plug_test.exs | 2 +- test/pleroma/web/rich_media/helpers_test.exs | 9 ++- test/pleroma/web/streamer_test.exs | 6 +- .../twitter_api/remote_follow_controller_test.exs | 4 +- test/pleroma/web/twitter_api/twitter_api_test.exs | 7 +- .../web/twitter_api/util_controller_test.exs | 9 ++- .../workers/cron/digest_emails_worker_test.exs | 2 +- .../workers/scheduled_activity_worker_test.exs | 4 +- 69 files changed, 325 insertions(+), 368 deletions(-) diff --git a/test/mix/tasks/pleroma/robots_txt_test.exs b/test/mix/tasks/pleroma/robots_txt_test.exs index 4b369d83c..028aa4ccc 100644 --- a/test/mix/tasks/pleroma/robots_txt_test.exs +++ b/test/mix/tasks/pleroma/robots_txt_test.exs @@ -12,7 +12,7 @@ defmodule Mix.Tasks.Pleroma.RobotsTxtTest do test "creates new dir" do path = "test/fixtures/new_dir/" file_path = path <> "robots.txt" - Pleroma.Config.put([:instance, :static_dir], path) + clear_config([:instance, :static_dir], path) on_exit(fn -> {:ok, ["test/fixtures/new_dir/", "test/fixtures/new_dir/robots.txt"]} = File.rm_rf(path) @@ -29,7 +29,7 @@ test "creates new dir" do test "to existance folder" do path = "test/fixtures/" file_path = path <> "robots.txt" - Pleroma.Config.put([:instance, :static_dir], path) + clear_config([:instance, :static_dir], path) on_exit(fn -> :ok = File.rm(file_path) diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs index 83757ad56..390a06344 100644 --- a/test/pleroma/activity_test.exs +++ b/test/pleroma/activity_test.exs @@ -168,7 +168,7 @@ test "find only local statuses for unauthenticated users", %{local_activity: loc test "find only local statuses for unauthenticated users when `limit_to_local_content` is `:all`", %{local_activity: local_activity} do - Pleroma.Config.put([:instance, :limit_to_local_content], :all) + clear_config([:instance, :limit_to_local_content], :all) assert [^local_activity] = Activity.search(nil, "find me") end @@ -177,7 +177,7 @@ test "find all statuses for unauthenticated users when `limit_to_local_content` local_activity: local_activity, remote_activity: remote_activity } do - Pleroma.Config.put([:instance, :limit_to_local_content], false) + clear_config([:instance, :limit_to_local_content], false) activities = Enum.sort_by(Activity.search(nil, "find me"), & &1.id) diff --git a/test/pleroma/application_requirements_test.exs b/test/pleroma/application_requirements_test.exs index d056cc817..683ac8c96 100644 --- a/test/pleroma/application_requirements_test.exs +++ b/test/pleroma/application_requirements_test.exs @@ -9,7 +9,6 @@ defmodule Pleroma.ApplicationRequirementsTest do import Mock alias Pleroma.ApplicationRequirements - alias Pleroma.Config alias Pleroma.Repo describe "check_repo_pool_size!/1" do @@ -37,8 +36,8 @@ test "doesn't raise if the pool size is unexpected but the respective flag is se setup do: clear_config([Pleroma.Emails.Mailer]) test "raises if welcome email enabled but mail disabled" do - Pleroma.Config.put([:welcome, :email, :enabled], true) - Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false) + clear_config([:welcome, :email, :enabled], true) + clear_config([Pleroma.Emails.Mailer, :enabled], false) assert_raise Pleroma.ApplicationRequirements.VerifyError, "The mail disabled.", fn -> capture_log(&Pleroma.ApplicationRequirements.verify!/0) @@ -59,8 +58,8 @@ test "raises if welcome email enabled but mail disabled" do setup do: clear_config([:instance, :account_activation_required]) test "raises if account confirmation is required but mailer isn't enable" do - Pleroma.Config.put([:instance, :account_activation_required], true) - Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false) + clear_config([:instance, :account_activation_required], true) + clear_config([Pleroma.Emails.Mailer, :enabled], false) assert_raise Pleroma.ApplicationRequirements.VerifyError, "Account activation enabled, but Mailer is disabled. Cannot send confirmation emails.", @@ -70,14 +69,14 @@ test "raises if account confirmation is required but mailer isn't enable" do end test "doesn't do anything if account confirmation is disabled" do - Pleroma.Config.put([:instance, :account_activation_required], false) - Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false) + clear_config([:instance, :account_activation_required], false) + clear_config([Pleroma.Emails.Mailer, :enabled], false) assert Pleroma.ApplicationRequirements.verify!() == :ok end test "doesn't do anything if account confirmation is required and mailer is enabled" do - Pleroma.Config.put([:instance, :account_activation_required], true) - Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], true) + clear_config([:instance, :account_activation_required], true) + clear_config([Pleroma.Emails.Mailer, :enabled], true) assert Pleroma.ApplicationRequirements.verify!() == :ok end end @@ -93,7 +92,7 @@ test "doesn't do anything if account confirmation is required and mailer is enab setup do: clear_config([:database, :rum_enabled]) test "raises if rum is enabled and detects unapplied rum migrations" do - Config.put([:database, :rum_enabled], true) + clear_config([:database, :rum_enabled], true) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> false end]}]) do assert_raise ApplicationRequirements.VerifyError, @@ -105,7 +104,7 @@ test "raises if rum is enabled and detects unapplied rum migrations" do end test "raises if rum is disabled and detects rum migrations" do - Config.put([:database, :rum_enabled], false) + clear_config([:database, :rum_enabled], false) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> true end]}]) do assert_raise ApplicationRequirements.VerifyError, @@ -117,7 +116,7 @@ test "raises if rum is disabled and detects rum migrations" do end test "doesn't do anything if rum enabled and applied migrations" do - Config.put([:database, :rum_enabled], true) + clear_config([:database, :rum_enabled], true) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> true end]}]) do assert ApplicationRequirements.verify!() == :ok @@ -125,7 +124,7 @@ test "doesn't do anything if rum enabled and applied migrations" do end test "doesn't do anything if rum disabled" do - Config.put([:database, :rum_enabled], false) + clear_config([:database, :rum_enabled], false) with_mocks([{Repo, [:passthrough], [exists?: fn _, _ -> false end]}]) do assert ApplicationRequirements.verify!() == :ok @@ -161,7 +160,7 @@ test "raises if it detects unapplied migrations" do end test "doesn't do anything if disabled" do - Config.put([:i_am_aware_this_may_cause_data_loss, :disable_migration_check], true) + clear_config([:i_am_aware_this_may_cause_data_loss, :disable_migration_check], true) assert :ok == ApplicationRequirements.verify!() end diff --git a/test/pleroma/captcha_test.exs b/test/pleroma/captcha_test.exs index 5691c9506..fcb585112 100644 --- a/test/pleroma/captcha_test.exs +++ b/test/pleroma/captcha_test.exs @@ -69,7 +69,7 @@ test "new and validate" do describe "Captcha Wrapper" do test "validate" do - Pleroma.Config.put([Pleroma.Captcha, :enabled], true) + clear_config([Pleroma.Captcha, :enabled], true) new = Captcha.new() @@ -83,7 +83,7 @@ test "validate" do end test "doesn't validate invalid answer" do - Pleroma.Config.put([Pleroma.Captcha, :enabled], true) + clear_config([Pleroma.Captcha, :enabled], true) new = Captcha.new() @@ -99,7 +99,7 @@ test "doesn't validate invalid answer" do end test "nil answer_data" do - Pleroma.Config.put([Pleroma.Captcha, :enabled], true) + clear_config([Pleroma.Captcha, :enabled], true) new = Captcha.new() diff --git a/test/pleroma/config_test.exs b/test/pleroma/config_test.exs index e4e7f505f..3158a2ec8 100644 --- a/test/pleroma/config_test.exs +++ b/test/pleroma/config_test.exs @@ -30,9 +30,9 @@ test "get/1 with a list of keys" do describe "nil values" do setup do - Pleroma.Config.put(:lorem, nil) - Pleroma.Config.put(:ipsum, %{dolor: [sit: nil]}) - Pleroma.Config.put(:dolor, sit: %{amet: nil}) + clear_config(:lorem, nil) + clear_config(:ipsum, %{dolor: [sit: nil]}) + clear_config(:dolor, sit: %{amet: nil}) on_exit(fn -> Enum.each(~w(lorem ipsum dolor)a, &Pleroma.Config.delete/1) end) end @@ -57,9 +57,9 @@ test "get/2 with a list of keys for nil value" do end test "get/1 when value is false" do - Pleroma.Config.put([:instance, :false_test], false) - Pleroma.Config.put([:instance, :nested], []) - Pleroma.Config.put([:instance, :nested, :false_test], false) + clear_config([:instance, :false_test], false) + clear_config([:instance, :nested], []) + clear_config([:instance, :nested, :false_test], false) assert Pleroma.Config.get([:instance, :false_test]) == false assert Pleroma.Config.get([:instance, :nested, :false_test]) == false @@ -81,40 +81,40 @@ test "get!/1" do end test "get!/1 when value is false" do - Pleroma.Config.put([:instance, :false_test], false) - Pleroma.Config.put([:instance, :nested], []) - Pleroma.Config.put([:instance, :nested, :false_test], false) + clear_config([:instance, :false_test], false) + clear_config([:instance, :nested], []) + clear_config([:instance, :nested, :false_test], false) assert Pleroma.Config.get!([:instance, :false_test]) == false assert Pleroma.Config.get!([:instance, :nested, :false_test]) == false end test "put/2 with a key" do - Pleroma.Config.put(:config_test, true) + clear_config(:config_test, true) assert Pleroma.Config.get(:config_test) == true end test "put/2 with a list of keys" do - Pleroma.Config.put([:instance, :config_test], true) - Pleroma.Config.put([:instance, :config_nested_test], []) - Pleroma.Config.put([:instance, :config_nested_test, :x], true) + clear_config([:instance, :config_test], true) + clear_config([:instance, :config_nested_test], []) + clear_config([:instance, :config_nested_test, :x], true) assert Pleroma.Config.get([:instance, :config_test]) == true assert Pleroma.Config.get([:instance, :config_nested_test, :x]) == true end test "delete/1 with a key" do - Pleroma.Config.put([:delete_me], :delete_me) + clear_config([:delete_me], :delete_me) Pleroma.Config.delete([:delete_me]) assert Pleroma.Config.get([:delete_me]) == nil end test "delete/2 with a list of keys" do - Pleroma.Config.put([:delete_me], hello: "world", world: "Hello") + clear_config([:delete_me], hello: "world", world: "Hello") Pleroma.Config.delete([:delete_me, :world]) assert Pleroma.Config.get([:delete_me]) == [hello: "world"] - Pleroma.Config.put([:delete_me, :delete_me], hello: "world", world: "Hello") + clear_config([:delete_me, :delete_me], hello: "world", world: "Hello") Pleroma.Config.delete([:delete_me, :delete_me, :world]) assert Pleroma.Config.get([:delete_me, :delete_me]) == [hello: "world"] @@ -123,8 +123,8 @@ test "delete/2 with a list of keys" do end test "fetch/1" do - Pleroma.Config.put([:lorem], :ipsum) - Pleroma.Config.put([:ipsum], dolor: :sit) + clear_config([:lorem], :ipsum) + clear_config([:ipsum], dolor: :sit) assert Pleroma.Config.fetch([:lorem]) == {:ok, :ipsum} assert Pleroma.Config.fetch(:lorem) == {:ok, :ipsum} diff --git a/test/pleroma/gun/connection_pool_test.exs b/test/pleroma/gun/connection_pool_test.exs index 9cbaf0978..4b3158625 100644 --- a/test/pleroma/gun/connection_pool_test.exs +++ b/test/pleroma/gun/connection_pool_test.exs @@ -7,7 +7,6 @@ defmodule Pleroma.Gun.ConnectionPoolTest do import Mox import ExUnit.CaptureLog - alias Pleroma.Config alias Pleroma.Gun.ConnectionPool defp gun_mock(_) do @@ -49,7 +48,7 @@ test "gives the same connection to 2 concurrent requests" do test "connection limit is respected with concurrent requests" do clear_config([:connections_pool, :max_connections]) do - Config.put([:connections_pool, :max_connections], 1) + clear_config([:connections_pool, :max_connections], 1) # The supervisor needs a reboot to apply the new config setting Process.exit(Process.whereis(Pleroma.Gun.ConnectionPool.WorkerSupervisor), :kill) diff --git a/test/pleroma/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs index 8e2fd69a6..cfb68557d 100644 --- a/test/pleroma/http/adapter_helper/gun_test.exs +++ b/test/pleroma/http/adapter_helper/gun_test.exs @@ -8,7 +8,6 @@ defmodule Pleroma.HTTP.AdapterHelper.GunTest do import Mox - alias Pleroma.Config alias Pleroma.HTTP.AdapterHelper.Gun setup :verify_on_exit! @@ -52,9 +51,7 @@ test "merges with defaul http adapter config" do end test "parses string proxy host & port" do - proxy = Config.get([:http, :proxy_url]) - Config.put([:http, :proxy_url], "localhost:8123") - on_exit(fn -> Config.put([:http, :proxy_url], proxy) end) + clear_config([:http, :proxy_url], "localhost:8123") uri = URI.parse("https://some-domain.com") opts = Gun.options([receive_conn: false], uri) @@ -62,9 +59,7 @@ test "parses string proxy host & port" do end test "parses tuple proxy scheme host and port" do - proxy = Config.get([:http, :proxy_url]) - Config.put([:http, :proxy_url], {:socks, 'localhost', 1234}) - on_exit(fn -> Config.put([:http, :proxy_url], proxy) end) + clear_config([:http, :proxy_url], {:socks, 'localhost', 1234}) uri = URI.parse("https://some-domain.com") opts = Gun.options([receive_conn: false], uri) @@ -72,9 +67,7 @@ test "parses tuple proxy scheme host and port" do end test "passed opts have more weight than defaults" do - proxy = Config.get([:http, :proxy_url]) - Config.put([:http, :proxy_url], {:socks5, 'localhost', 1234}) - on_exit(fn -> Config.put([:http, :proxy_url], proxy) end) + clear_config([:http, :proxy_url], {:socks5, 'localhost', 1234}) uri = URI.parse("https://some-domain.com") opts = Gun.options([receive_conn: false, proxy: {'example.com', 4321}], uri) diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs index d9172a3ec..a7ac90348 100644 --- a/test/pleroma/object/fetcher_test.exs +++ b/test/pleroma/object/fetcher_test.exs @@ -6,7 +6,6 @@ defmodule Pleroma.Object.FetcherTest do use Pleroma.DataCase alias Pleroma.Activity - alias Pleroma.Config alias Pleroma.Object alias Pleroma.Object.Fetcher @@ -87,20 +86,20 @@ test "it works when fetching the OP actor errors out" do setup do: clear_config([:instance, :federation_incoming_replies_max_depth]) test "it returns thread depth exceeded error if thread depth is exceeded" do - Config.put([:instance, :federation_incoming_replies_max_depth], 0) + clear_config([:instance, :federation_incoming_replies_max_depth], 0) assert {:error, "Max thread distance exceeded."} = Fetcher.fetch_object_from_id(@ap_id, depth: 1) end test "it fetches object if max thread depth is restricted to 0 and depth is not specified" do - Config.put([:instance, :federation_incoming_replies_max_depth], 0) + clear_config([:instance, :federation_incoming_replies_max_depth], 0) assert {:ok, _} = Fetcher.fetch_object_from_id(@ap_id) end test "it fetches object if requested depth does not exceed max thread depth" do - Config.put([:instance, :federation_incoming_replies_max_depth], 10) + clear_config([:instance, :federation_incoming_replies_max_depth], 10) assert {:ok, _} = Fetcher.fetch_object_from_id(@ap_id, depth: 10) end @@ -245,7 +244,7 @@ test "it can refetch pruned objects" do Pleroma.Signature, [:passthrough], [] do - Config.put([:activitypub, :sign_object_fetches], true) + clear_config([:activitypub, :sign_object_fetches], true) Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367") @@ -256,7 +255,7 @@ test "it can refetch pruned objects" do Pleroma.Signature, [:passthrough], [] do - Config.put([:activitypub, :sign_object_fetches], false) + clear_config([:activitypub, :sign_object_fetches], false) Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367") diff --git a/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs index b4106ef8e..a7d4d493c 100644 --- a/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs +++ b/test/pleroma/repo/migrations/autolinker_to_linkify_test.exs @@ -37,7 +37,7 @@ test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: mi strip_prefix: false ] - Pleroma.Config.put(Pleroma.Formatter, new_opts) + clear_config(Pleroma.Formatter, new_opts) assert new_opts == Pleroma.Config.get(Pleroma.Formatter) {text, _mentions, []} = diff --git a/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs index 30c77e8e6..65c9961b0 100644 --- a/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs +++ b/test/pleroma/repo/migrations/fix_malformed_formatter_config_test.exs @@ -34,7 +34,7 @@ test "change/0 converts a map into a list", %{migration: migration} do strip_prefix: false ] - Pleroma.Config.put(Pleroma.Formatter, new_opts) + clear_config(Pleroma.Formatter, new_opts) assert new_opts == Pleroma.Config.get(Pleroma.Formatter) {text, _mentions, []} = diff --git a/test/pleroma/scheduled_activity_test.exs b/test/pleroma/scheduled_activity_test.exs index 10188d116..ef91e9bce 100644 --- a/test/pleroma/scheduled_activity_test.exs +++ b/test/pleroma/scheduled_activity_test.exs @@ -15,7 +15,7 @@ defmodule Pleroma.ScheduledActivityTest do describe "creation" do test "scheduled activities with jobs when ScheduledActivity enabled" do - Pleroma.Config.put([ScheduledActivity, :enabled], true) + clear_config([ScheduledActivity, :enabled], true) user = insert(:user) today = @@ -34,7 +34,7 @@ test "scheduled activities with jobs when ScheduledActivity enabled" do end test "scheduled activities without jobs when ScheduledActivity disabled" do - Pleroma.Config.put([ScheduledActivity, :enabled], false) + clear_config([ScheduledActivity, :enabled], false) user = insert(:user) today = diff --git a/test/pleroma/upload/filter/anonymize_filename_test.exs b/test/pleroma/upload/filter/anonymize_filename_test.exs index 2a067fc4b..9387c1abc 100644 --- a/test/pleroma/upload/filter/anonymize_filename_test.exs +++ b/test/pleroma/upload/filter/anonymize_filename_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.Upload setup do @@ -23,13 +22,13 @@ defmodule Pleroma.Upload.Filter.AnonymizeFilenameTest do setup do: clear_config([Pleroma.Upload.Filter.AnonymizeFilename, :text]) test "it replaces filename on pre-defined text", %{upload_file: upload_file} do - Config.put([Upload.Filter.AnonymizeFilename, :text], "custom-file.png") + clear_config([Upload.Filter.AnonymizeFilename, :text], "custom-file.png") {:ok, :filtered, %Upload{name: name}} = Upload.Filter.AnonymizeFilename.filter(upload_file) assert name == "custom-file.png" end test "it replaces filename on pre-defined text expression", %{upload_file: upload_file} do - Config.put([Upload.Filter.AnonymizeFilename, :text], "custom-file.{extension}") + clear_config([Upload.Filter.AnonymizeFilename, :text], "custom-file.{extension}") {:ok, :filtered, %Upload{name: name}} = Upload.Filter.AnonymizeFilename.filter(upload_file) assert name == "custom-file.jpg" end diff --git a/test/pleroma/upload/filter_test.exs b/test/pleroma/upload/filter_test.exs index 58c842080..f0053ed9b 100644 --- a/test/pleroma/upload/filter_test.exs +++ b/test/pleroma/upload/filter_test.exs @@ -5,13 +5,12 @@ defmodule Pleroma.Upload.FilterTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.Upload.Filter setup do: clear_config([Pleroma.Upload.Filter.AnonymizeFilename, :text]) test "applies filters" do - Config.put([Pleroma.Upload.Filter.AnonymizeFilename, :text], "custom-file.png") + clear_config([Pleroma.Upload.Filter.AnonymizeFilename, :text], "custom-file.png") File.cp!( "test/fixtures/image.jpg", diff --git a/test/pleroma/uploaders/s3_test.exs b/test/pleroma/uploaders/s3_test.exs index 709631a6a..2711e2c8d 100644 --- a/test/pleroma/uploaders/s3_test.exs +++ b/test/pleroma/uploaders/s3_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Uploaders.S3Test do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.Uploaders.S3 import Mock @@ -27,13 +26,13 @@ test "it returns path to local folder for files" do end test "it returns path without bucket when truncated_namespace set to ''" do - Config.put([Pleroma.Uploaders.S3], + clear_config([Pleroma.Uploaders.S3], bucket: "test_bucket", bucket_namespace: "myaccount", truncated_namespace: "" ) - Config.put([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") + clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com") assert S3.get_file("test_image.jpg") == { :ok, @@ -42,7 +41,7 @@ test "it returns path without bucket when truncated_namespace set to ''" do end test "it returns path with bucket namespace when namespace is set" do - Config.put([Pleroma.Uploaders.S3], + clear_config([Pleroma.Uploaders.S3], bucket: "test_bucket", bucket_namespace: "family" ) diff --git a/test/pleroma/user/backup_test.exs b/test/pleroma/user/backup_test.exs index 1aab25ba6..b16152876 100644 --- a/test/pleroma/user/backup_test.exs +++ b/test/pleroma/user/backup_test.exs @@ -23,7 +23,7 @@ defmodule Pleroma.User.BackupTest do end test "it requries enabled email" do - Pleroma.Config.put([Pleroma.Emails.Mailer, :enabled], false) + clear_config([Pleroma.Emails.Mailer, :enabled], false) user = insert(:user) assert {:error, "Backups require enabled email"} == Backup.create(user) end @@ -53,7 +53,7 @@ test "it return an error if the export limit is over" do end test "it process a backup record" do - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) %{id: user_id} = user = insert(:user) assert {:ok, %Oban.Job{args: %{"backup_id" => backup_id} = args}} = Backup.create(user) @@ -76,8 +76,8 @@ test "it process a backup record" do end test "it removes outdated backups after creating a fresh one" do - Pleroma.Config.put([Backup, :limit_days], -1) - Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) + clear_config([Backup, :limit_days], -1) + clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local) user = insert(:user) assert {:ok, job1} = Backup.create(user) diff --git a/test/pleroma/user/welcome_chat_message_test.exs b/test/pleroma/user/welcome_chat_message_test.exs index 06b044a32..42a45fa19 100644 --- a/test/pleroma/user/welcome_chat_message_test.exs +++ b/test/pleroma/user/welcome_chat_message_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.User.WelcomeChatMessageTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.User.WelcomeChatMessage import Pleroma.Factory @@ -17,10 +16,10 @@ test "send a chat welcome message" do welcome_user = insert(:user, name: "mewmew") user = insert(:user) - Config.put([:welcome, :chat_message, :enabled], true) - Config.put([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) + clear_config([:welcome, :chat_message, :enabled], true) + clear_config([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) - Config.put( + clear_config( [:welcome, :chat_message, :message], "Hello, welcome to Blob/Cat!" ) diff --git a/test/pleroma/user/welcome_email_test.exs b/test/pleroma/user/welcome_email_test.exs index fbfc0b45e..c3d383a7f 100644 --- a/test/pleroma/user/welcome_email_test.exs +++ b/test/pleroma/user/welcome_email_test.exs @@ -18,15 +18,15 @@ defmodule Pleroma.User.WelcomeEmailTest do test "send a welcome email" do user = insert(:user, name: "Jimm") - Config.put([:welcome, :email, :enabled], true) - Config.put([:welcome, :email, :sender], "welcome@pleroma.app") + clear_config([:welcome, :email, :enabled], true) + clear_config([:welcome, :email, :sender], "welcome@pleroma.app") - Config.put( + clear_config( [:welcome, :email, :subject], "Hello, welcome to pleroma: <%= instance_name %>" ) - Config.put( + clear_config( [:welcome, :email, :html], "

Hello <%= user.name %>.

Welcome to <%= instance_name %>

" ) @@ -44,7 +44,7 @@ test "send a welcome email" do html_body: "

Hello #{user.name}.

Welcome to #{instance_name}

" ) - Config.put([:welcome, :email, :sender], {"Pleroma App", "welcome@pleroma.app"}) + clear_config([:welcome, :email, :sender], {"Pleroma App", "welcome@pleroma.app"}) {:ok, _job} = WelcomeEmail.send_email(user) diff --git a/test/pleroma/user/welcome_message_test.exs b/test/pleroma/user/welcome_message_test.exs index cf43a0fa4..28afde943 100644 --- a/test/pleroma/user/welcome_message_test.exs +++ b/test/pleroma/user/welcome_message_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.User.WelcomeMessageTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.User.WelcomeMessage import Pleroma.Factory @@ -17,10 +16,10 @@ test "send a direct welcome message" do welcome_user = insert(:user) user = insert(:user, name: "Jimm") - Config.put([:welcome, :direct_message, :enabled], true) - Config.put([:welcome, :direct_message, :sender_nickname], welcome_user.nickname) + clear_config([:welcome, :direct_message, :enabled], true) + clear_config([:welcome, :direct_message, :sender_nickname], welcome_user.nickname) - Config.put( + clear_config( [:welcome, :direct_message, :message], "Hello. Welcome to Pleroma" ) diff --git a/test/pleroma/user_search_test.exs b/test/pleroma/user_search_test.exs index 78f042e55..69167bb0c 100644 --- a/test/pleroma/user_search_test.exs +++ b/test/pleroma/user_search_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.UserSearchTest do setup do: clear_config([:instance, :limit_to_local_content]) test "returns a resolved user as the first result" do - Pleroma.Config.put([:instance, :limit_to_local_content], false) + clear_config([:instance, :limit_to_local_content], false) user = insert(:user, %{nickname: "no_relation", ap_id: "https://lain.com/users/lain"}) _user = insert(:user, %{nickname: "com_user"}) @@ -199,7 +199,7 @@ test "find only local users for unauthenticated users" do end test "find only local users for authenticated users when `limit_to_local_content` is `:all`" do - Pleroma.Config.put([:instance, :limit_to_local_content], :all) + clear_config([:instance, :limit_to_local_content], :all) %{id: id} = insert(:user, %{name: "lain"}) insert(:user, %{name: "ebn", nickname: "lain@mastodon.social", local: false}) @@ -209,7 +209,7 @@ test "find only local users for authenticated users when `limit_to_local_content end test "find all users for unauthenticated users when `limit_to_local_content` is `false`" do - Pleroma.Config.put([:instance, :limit_to_local_content], false) + clear_config([:instance, :limit_to_local_content], false) u1 = insert(:user, %{name: "lain"}) u2 = insert(:user, %{name: "ebn", nickname: "lain@mastodon.social", local: false}) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 90fef34bd..b4df22c2c 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -311,7 +311,7 @@ test "local users do not automatically follow local locked accounts" do setup do: clear_config([:instance, :external_user_synchronization]) test "unfollow with syncronizes external user" do - Pleroma.Config.put([:instance, :external_user_synchronization], true) + clear_config([:instance, :external_user_synchronization], true) followed = insert(:user, @@ -396,7 +396,7 @@ test "it autofollows accounts that are set for it" do user = insert(:user) remote_user = insert(:user, %{local: false}) - Pleroma.Config.put([:instance, :autofollowed_nicknames], [ + clear_config([:instance, :autofollowed_nicknames], [ user.nickname, remote_user.nickname ]) @@ -413,7 +413,7 @@ test "it adds automatic followers for new registered accounts" do user1 = insert(:user) user2 = insert(:user) - Pleroma.Config.put([:instance, :autofollowing_nicknames], [ + clear_config([:instance, :autofollowing_nicknames], [ user1.nickname, user2.nickname ]) @@ -428,9 +428,9 @@ test "it adds automatic followers for new registered accounts" do test "it sends a welcome message if it is set" do welcome_user = insert(:user) - Pleroma.Config.put([:welcome, :direct_message, :enabled], true) - Pleroma.Config.put([:welcome, :direct_message, :sender_nickname], welcome_user.nickname) - Pleroma.Config.put([:welcome, :direct_message, :message], "Hello, this is a direct message") + clear_config([:welcome, :direct_message, :enabled], true) + clear_config([:welcome, :direct_message, :sender_nickname], welcome_user.nickname) + clear_config([:welcome, :direct_message, :message], "Hello, this is a direct message") cng = User.register_changeset(%User{}, @full_user_data) {:ok, registered_user} = User.register(cng) @@ -444,9 +444,9 @@ test "it sends a welcome message if it is set" do test "it sends a welcome chat message if it is set" do welcome_user = insert(:user) - Pleroma.Config.put([:welcome, :chat_message, :enabled], true) - Pleroma.Config.put([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) - Pleroma.Config.put([:welcome, :chat_message, :message], "Hello, this is a chat message") + clear_config([:welcome, :chat_message, :enabled], true) + clear_config([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) + clear_config([:welcome, :chat_message, :message], "Hello, this is a chat message") cng = User.register_changeset(%User{}, @full_user_data) {:ok, registered_user} = User.register(cng) @@ -480,12 +480,12 @@ test "it sends a welcome chat message if it is set" do ) test "it sends a welcome chat message when Simple policy applied to local instance" do - Pleroma.Config.put([:mrf_simple, :media_nsfw], ["localhost"]) + clear_config([:mrf_simple, :media_nsfw], ["localhost"]) welcome_user = insert(:user) - Pleroma.Config.put([:welcome, :chat_message, :enabled], true) - Pleroma.Config.put([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) - Pleroma.Config.put([:welcome, :chat_message, :message], "Hello, this is a chat message") + clear_config([:welcome, :chat_message, :enabled], true) + clear_config([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) + clear_config([:welcome, :chat_message, :message], "Hello, this is a chat message") cng = User.register_changeset(%User{}, @full_user_data) {:ok, registered_user} = User.register(cng) @@ -499,10 +499,10 @@ test "it sends a welcome chat message when Simple policy applied to local instan test "it sends a welcome email message if it is set" do welcome_user = insert(:user) - Pleroma.Config.put([:welcome, :email, :enabled], true) - Pleroma.Config.put([:welcome, :email, :sender], welcome_user.email) + clear_config([:welcome, :email, :enabled], true) + clear_config([:welcome, :email, :sender], welcome_user.email) - Pleroma.Config.put( + clear_config( [:welcome, :email, :subject], "Hello, welcome to cool site: <%= instance_name %>" ) @@ -522,7 +522,7 @@ test "it sends a welcome email message if it is set" do end test "it sends a confirm email" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) cng = User.register_changeset(%User{}, @full_user_data) {:ok, registered_user} = User.register(cng) @@ -552,7 +552,7 @@ test "sends a pending approval email" do end test "it requires an email, name, nickname and password, bio is optional when account_activation_required is enabled" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) @full_user_data |> Map.keys() @@ -565,7 +565,7 @@ test "it requires an email, name, nickname and password, bio is optional when ac end test "it requires an name, nickname and password, bio and email are optional when account_activation_required is disabled" do - Pleroma.Config.put([:instance, :account_activation_required], false) + clear_config([:instance, :account_activation_required], false) @full_user_data |> Map.keys() @@ -1712,13 +1712,13 @@ test "User.delete() plugs any possible zombie objects" do setup do: clear_config([:instance, :account_activation_required]) test "return confirmation_pending for unconfirm user" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) user = insert(:user, is_confirmed: false) assert User.account_status(user) == :confirmation_pending end test "return active for confirmed user" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) user = insert(:user, is_confirmed: true) assert User.account_status(user) == :active end @@ -1797,7 +1797,7 @@ test "returns true when the account is itself" do end test "returns false when the account is unconfirmed and confirmation is required" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) user = insert(:user, local: true, is_confirmed: false) other_user = insert(:user, local: true) @@ -1806,7 +1806,7 @@ test "returns false when the account is unconfirmed and confirmation is required end test "returns true when the account is unconfirmed and confirmation is required but the account is remote" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) user = insert(:user, local: false, is_confirmed: false) other_user = insert(:user, local: true) @@ -1815,7 +1815,7 @@ test "returns true when the account is unconfirmed and confirmation is required end test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) user = insert(:user, local: true, is_confirmed: false) other_user = insert(:user, local: true, is_admin: true) @@ -2072,7 +2072,7 @@ test "performs update cache if user updated" do setup do: clear_config([:instance, :external_user_synchronization]) test "updates the counters normally on following/getting a follow when disabled" do - Pleroma.Config.put([:instance, :external_user_synchronization], false) + clear_config([:instance, :external_user_synchronization], false) user = insert(:user) other_user = @@ -2093,7 +2093,7 @@ test "updates the counters normally on following/getting a follow when disabled" end test "syncronizes the counters with the remote instance for the followed when enabled" do - Pleroma.Config.put([:instance, :external_user_synchronization], false) + clear_config([:instance, :external_user_synchronization], false) user = insert(:user) @@ -2108,14 +2108,14 @@ test "syncronizes the counters with the remote instance for the followed when en assert other_user.following_count == 0 assert other_user.follower_count == 0 - Pleroma.Config.put([:instance, :external_user_synchronization], true) + clear_config([:instance, :external_user_synchronization], true) {:ok, _user, other_user} = User.follow(user, other_user) assert other_user.follower_count == 437 end test "syncronizes the counters with the remote instance for the follower when enabled" do - Pleroma.Config.put([:instance, :external_user_synchronization], false) + clear_config([:instance, :external_user_synchronization], false) user = insert(:user) @@ -2130,7 +2130,7 @@ test "syncronizes the counters with the remote instance for the follower when en assert other_user.following_count == 0 assert other_user.follower_count == 0 - Pleroma.Config.put([:instance, :external_user_synchronization], true) + clear_config([:instance, :external_user_synchronization], true) {:ok, other_user, _user} = User.follow(other_user, user) assert other_user.following_count == 152 @@ -2177,43 +2177,43 @@ test "changes email", %{user: user} do test "allows getting remote users by id no matter what :limit_to_local_content is set to", %{ remote_user: remote_user } do - Pleroma.Config.put([:instance, :limit_to_local_content], false) + clear_config([:instance, :limit_to_local_content], false) assert %User{} = User.get_cached_by_nickname_or_id(remote_user.id) - Pleroma.Config.put([:instance, :limit_to_local_content], true) + clear_config([:instance, :limit_to_local_content], true) assert %User{} = User.get_cached_by_nickname_or_id(remote_user.id) - Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated) + clear_config([:instance, :limit_to_local_content], :unauthenticated) assert %User{} = User.get_cached_by_nickname_or_id(remote_user.id) end test "disallows getting remote users by nickname without authentication when :limit_to_local_content is set to :unauthenticated", %{remote_user: remote_user} do - Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated) + clear_config([:instance, :limit_to_local_content], :unauthenticated) assert nil == User.get_cached_by_nickname_or_id(remote_user.nickname) end test "allows getting remote users by nickname with authentication when :limit_to_local_content is set to :unauthenticated", %{remote_user: remote_user, local_user: local_user} do - Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated) + clear_config([:instance, :limit_to_local_content], :unauthenticated) assert %User{} = User.get_cached_by_nickname_or_id(remote_user.nickname, for: local_user) end test "disallows getting remote users by nickname when :limit_to_local_content is set to true", %{remote_user: remote_user} do - Pleroma.Config.put([:instance, :limit_to_local_content], true) + clear_config([:instance, :limit_to_local_content], true) assert nil == User.get_cached_by_nickname_or_id(remote_user.nickname) end test "allows getting local users by nickname no matter what :limit_to_local_content is set to", %{local_user: local_user} do - Pleroma.Config.put([:instance, :limit_to_local_content], false) + clear_config([:instance, :limit_to_local_content], false) assert %User{} = User.get_cached_by_nickname_or_id(local_user.nickname) - Pleroma.Config.put([:instance, :limit_to_local_content], true) + clear_config([:instance, :limit_to_local_content], true) assert %User{} = User.get_cached_by_nickname_or_id(local_user.nickname) - Pleroma.Config.put([:instance, :limit_to_local_content], :unauthenticated) + clear_config([:instance, :limit_to_local_content], :unauthenticated) assert %User{} = User.get_cached_by_nickname_or_id(local_user.nickname) end end diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index e0cd28303..f7417de31 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -7,7 +7,6 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubControllerTest do use Oban.Testing, repo: Pleroma.Repo alias Pleroma.Activity - alias Pleroma.Config alias Pleroma.Delivery alias Pleroma.Instances alias Pleroma.Object @@ -46,7 +45,7 @@ test "with the relay active, it returns the relay user", %{conn: conn} do end test "with the relay disabled, it returns 404", %{conn: conn} do - Config.put([:instance, :allow_relay], false) + clear_config([:instance, :allow_relay], false) conn |> get(activity_pub_path(conn, :relay)) @@ -54,7 +53,7 @@ test "with the relay disabled, it returns 404", %{conn: conn} do end test "on non-federating instance, it returns 404", %{conn: conn} do - Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) user = insert(:user) conn @@ -75,7 +74,7 @@ test "it returns the internal fetch user", %{conn: conn} do end test "on non-federating instance, it returns 404", %{conn: conn} do - Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) user = insert(:user) conn @@ -493,7 +492,7 @@ test "it clears `unreachable` federation status of the sender", %{conn: conn} do end test "accept follow activity", %{conn: conn} do - Pleroma.Config.put([:instance, :federating], true) + clear_config([:instance, :federating], true) relay = Relay.get_actor() assert {:ok, %Activity{} = activity} = Relay.follow("https://relay.mastodon.host/actor") @@ -539,7 +538,7 @@ test "without valid signature, " <> conn = put_req_header(conn, "content-type", "application/activity+json") - Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) conn |> post("/inbox", data) @@ -549,7 +548,7 @@ test "without valid signature, " <> |> post("/inbox", non_create_data) |> json_response(403) - Config.put([:instance, :federating], true) + clear_config([:instance, :federating], true) ret_conn = post(conn, "/inbox", data) assert "ok" == json_response(ret_conn, 200) @@ -1246,7 +1245,7 @@ test "it doesn't spreads faulty attributedTo or actor fields", %{ end test "Character limitation", %{conn: conn, activity: activity} do - Pleroma.Config.put([:instance, :limit], 5) + clear_config([:instance, :limit], 5) user = insert(:user) result = @@ -1275,7 +1274,7 @@ test "it returns relay followers", %{conn: conn} do end test "on non-federating instance, it returns 404", %{conn: conn} do - Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) user = insert(:user) conn @@ -1296,7 +1295,7 @@ test "it returns relay following", %{conn: conn} do end test "on non-federating instance, it returns 404", %{conn: conn} do - Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) user = insert(:user) conn diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 24576b31a..f4023856c 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -1079,15 +1079,15 @@ test "sets a description if given", %{test_file: file} do test "it sets the default description depending on the configuration", %{test_file: file} do clear_config([Pleroma.Upload, :default_description]) - Pleroma.Config.put([Pleroma.Upload, :default_description], nil) + clear_config([Pleroma.Upload, :default_description], nil) {:ok, %Object{} = object} = ActivityPub.upload(file) assert object.data["name"] == "" - Pleroma.Config.put([Pleroma.Upload, :default_description], :filename) + clear_config([Pleroma.Upload, :default_description], :filename) {:ok, %Object{} = object} = ActivityPub.upload(file) assert object.data["name"] == "an_image.jpg" - Pleroma.Config.put([Pleroma.Upload, :default_description], "unnamed attachment") + clear_config([Pleroma.Upload, :default_description], "unnamed attachment") {:ok, %Object{} = object} = ActivityPub.upload(file) assert object.data["name"] == "unnamed attachment" end diff --git a/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs index 2cd3e0329..439672479 100644 --- a/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/hellthread_policy_test.exs @@ -34,7 +34,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.HellthreadPolicyTest do setup do: clear_config(:mrf_hellthread) test "doesn't die on chat messages" do - Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 2, reject_threshold: 0}) + clear_config([:mrf_hellthread], %{delist_threshold: 2, reject_threshold: 0}) user = insert(:user) other_user = insert(:user) @@ -48,7 +48,7 @@ test "doesn't die on chat messages" do test "rejects the message if the recipient count is above reject_threshold", %{ message: message } do - Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 2}) + clear_config([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 2}) assert {:reject, "[HellthreadPolicy] 3 recipients is over the limit of 2"} == filter(message) @@ -57,7 +57,7 @@ test "rejects the message if the recipient count is above reject_threshold", %{ test "does not reject the message if the recipient count is below reject_threshold", %{ message: message } do - Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 3}) + clear_config([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 3}) assert {:ok, ^message} = filter(message) end @@ -68,7 +68,7 @@ test "delists the message if the recipient count is above delist_threshold", %{ user: user, message: message } do - Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 2, reject_threshold: 0}) + clear_config([:mrf_hellthread], %{delist_threshold: 2, reject_threshold: 0}) {:ok, message} = filter(message) assert user.follower_address in message["to"] @@ -78,14 +78,14 @@ test "delists the message if the recipient count is above delist_threshold", %{ test "does not delist the message if the recipient count is below delist_threshold", %{ message: message } do - Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 4, reject_threshold: 0}) + clear_config([:mrf_hellthread], %{delist_threshold: 4, reject_threshold: 0}) assert {:ok, ^message} = filter(message) end end test "excludes follower collection and public URI from threshold count", %{message: message} do - Pleroma.Config.put([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 3}) + clear_config([:mrf_hellthread], %{delist_threshold: 0, reject_threshold: 3}) assert {:ok, ^message} = filter(message) end diff --git a/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs index b44e6c60f..8af4c5efa 100644 --- a/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/keyword_policy_test.exs @@ -10,12 +10,12 @@ defmodule Pleroma.Web.ActivityPub.MRF.KeywordPolicyTest do setup do: clear_config(:mrf_keyword) setup do - Pleroma.Config.put([:mrf_keyword], %{reject: [], federated_timeline_removal: [], replace: []}) + clear_config([:mrf_keyword], %{reject: [], federated_timeline_removal: [], replace: []}) end describe "rejecting based on keywords" do test "rejects if string matches in content" do - Pleroma.Config.put([:mrf_keyword, :reject], ["pun"]) + clear_config([:mrf_keyword, :reject], ["pun"]) message = %{ "type" => "Create", @@ -30,7 +30,7 @@ test "rejects if string matches in content" do end test "rejects if string matches in summary" do - Pleroma.Config.put([:mrf_keyword, :reject], ["pun"]) + clear_config([:mrf_keyword, :reject], ["pun"]) message = %{ "type" => "Create", @@ -45,7 +45,7 @@ test "rejects if string matches in summary" do end test "rejects if regex matches in content" do - Pleroma.Config.put([:mrf_keyword, :reject], [~r/comp[lL][aA][iI][nN]er/]) + clear_config([:mrf_keyword, :reject], [~r/comp[lL][aA][iI][nN]er/]) assert true == Enum.all?(["complainer", "compLainer", "compLAiNer", "compLAINer"], fn content -> @@ -63,7 +63,7 @@ test "rejects if regex matches in content" do end test "rejects if regex matches in summary" do - Pleroma.Config.put([:mrf_keyword, :reject], [~r/comp[lL][aA][iI][nN]er/]) + clear_config([:mrf_keyword, :reject], [~r/comp[lL][aA][iI][nN]er/]) assert true == Enum.all?(["complainer", "compLainer", "compLAiNer", "compLAINer"], fn content -> @@ -83,7 +83,7 @@ test "rejects if regex matches in summary" do describe "delisting from ftl based on keywords" do test "delists if string matches in content" do - Pleroma.Config.put([:mrf_keyword, :federated_timeline_removal], ["pun"]) + clear_config([:mrf_keyword, :federated_timeline_removal], ["pun"]) message = %{ "to" => ["https://www.w3.org/ns/activitystreams#Public"], @@ -100,7 +100,7 @@ test "delists if string matches in content" do end test "delists if string matches in summary" do - Pleroma.Config.put([:mrf_keyword, :federated_timeline_removal], ["pun"]) + clear_config([:mrf_keyword, :federated_timeline_removal], ["pun"]) message = %{ "to" => ["https://www.w3.org/ns/activitystreams#Public"], @@ -117,7 +117,7 @@ test "delists if string matches in summary" do end test "delists if regex matches in content" do - Pleroma.Config.put([:mrf_keyword, :federated_timeline_removal], [~r/comp[lL][aA][iI][nN]er/]) + clear_config([:mrf_keyword, :federated_timeline_removal], [~r/comp[lL][aA][iI][nN]er/]) assert true == Enum.all?(["complainer", "compLainer", "compLAiNer", "compLAINer"], fn content -> @@ -138,7 +138,7 @@ test "delists if regex matches in content" do end test "delists if regex matches in summary" do - Pleroma.Config.put([:mrf_keyword, :federated_timeline_removal], [~r/comp[lL][aA][iI][nN]er/]) + clear_config([:mrf_keyword, :federated_timeline_removal], [~r/comp[lL][aA][iI][nN]er/]) assert true == Enum.all?(["complainer", "compLainer", "compLAiNer", "compLAINer"], fn content -> @@ -161,7 +161,7 @@ test "delists if regex matches in summary" do describe "replacing keywords" do test "replaces keyword if string matches in content" do - Pleroma.Config.put([:mrf_keyword, :replace], [{"opensource", "free software"}]) + clear_config([:mrf_keyword, :replace], [{"opensource", "free software"}]) message = %{ "type" => "Create", @@ -174,7 +174,7 @@ test "replaces keyword if string matches in content" do end test "replaces keyword if string matches in summary" do - Pleroma.Config.put([:mrf_keyword, :replace], [{"opensource", "free software"}]) + clear_config([:mrf_keyword, :replace], [{"opensource", "free software"}]) message = %{ "type" => "Create", @@ -187,7 +187,7 @@ test "replaces keyword if string matches in summary" do end test "replaces keyword if regex matches in content" do - Pleroma.Config.put([:mrf_keyword, :replace], [ + clear_config([:mrf_keyword, :replace], [ {~r/open(-|\s)?source\s?(software)?/, "free software"} ]) @@ -205,7 +205,7 @@ test "replaces keyword if regex matches in content" do end test "replaces keyword if regex matches in summary" do - Pleroma.Config.put([:mrf_keyword, :replace], [ + clear_config([:mrf_keyword, :replace], [ {~r/open(-|\s)?source\s?(software)?/, "free software"} ]) diff --git a/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs index b1d0f587c..80ddcacbe 100644 --- a/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/mention_policy_test.exs @@ -23,7 +23,7 @@ test "pass filter if allow list is empty" do describe "allow" do test "empty" do - Pleroma.Config.put([:mrf_mention], %{actors: ["https://example.com/blocked"]}) + clear_config([:mrf_mention], %{actors: ["https://example.com/blocked"]}) message = %{ "type" => "Create" @@ -33,7 +33,7 @@ test "empty" do end test "to" do - Pleroma.Config.put([:mrf_mention], %{actors: ["https://example.com/blocked"]}) + clear_config([:mrf_mention], %{actors: ["https://example.com/blocked"]}) message = %{ "type" => "Create", @@ -44,7 +44,7 @@ test "to" do end test "cc" do - Pleroma.Config.put([:mrf_mention], %{actors: ["https://example.com/blocked"]}) + clear_config([:mrf_mention], %{actors: ["https://example.com/blocked"]}) message = %{ "type" => "Create", @@ -55,7 +55,7 @@ test "cc" do end test "both" do - Pleroma.Config.put([:mrf_mention], %{actors: ["https://example.com/blocked"]}) + clear_config([:mrf_mention], %{actors: ["https://example.com/blocked"]}) message = %{ "type" => "Create", @@ -69,7 +69,7 @@ test "both" do describe "deny" do test "to" do - Pleroma.Config.put([:mrf_mention], %{actors: ["https://example.com/blocked"]}) + clear_config([:mrf_mention], %{actors: ["https://example.com/blocked"]}) message = %{ "type" => "Create", @@ -81,7 +81,7 @@ test "to" do end test "cc" do - Pleroma.Config.put([:mrf_mention], %{actors: ["https://example.com/blocked"]}) + clear_config([:mrf_mention], %{actors: ["https://example.com/blocked"]}) message = %{ "type" => "Create", diff --git a/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs index 9178ca2b1..137aafd39 100644 --- a/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs @@ -4,7 +4,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.User alias Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy alias Pleroma.Web.ActivityPub.Visibility @@ -39,7 +38,7 @@ defp get_new_message do describe "with reject action" do test "works with objects with empty to or cc fields" do - Config.put([:mrf_object_age, :actions], [:reject]) + clear_config([:mrf_object_age, :actions], [:reject]) data = get_old_message() @@ -50,7 +49,7 @@ test "works with objects with empty to or cc fields" do end test "it rejects an old post" do - Config.put([:mrf_object_age, :actions], [:reject]) + clear_config([:mrf_object_age, :actions], [:reject]) data = get_old_message() @@ -58,7 +57,7 @@ test "it rejects an old post" do end test "it allows a new post" do - Config.put([:mrf_object_age, :actions], [:reject]) + clear_config([:mrf_object_age, :actions], [:reject]) data = get_new_message() @@ -68,7 +67,7 @@ test "it allows a new post" do describe "with delist action" do test "works with objects with empty to or cc fields" do - Config.put([:mrf_object_age, :actions], [:delist]) + clear_config([:mrf_object_age, :actions], [:delist]) data = get_old_message() @@ -83,7 +82,7 @@ test "works with objects with empty to or cc fields" do end test "it delists an old post" do - Config.put([:mrf_object_age, :actions], [:delist]) + clear_config([:mrf_object_age, :actions], [:delist]) data = get_old_message() @@ -95,7 +94,7 @@ test "it delists an old post" do end test "it allows a new post" do - Config.put([:mrf_object_age, :actions], [:delist]) + clear_config([:mrf_object_age, :actions], [:delist]) data = get_new_message() @@ -107,7 +106,7 @@ test "it allows a new post" do describe "with strip_followers action" do test "works with objects with empty to or cc fields" do - Config.put([:mrf_object_age, :actions], [:strip_followers]) + clear_config([:mrf_object_age, :actions], [:strip_followers]) data = get_old_message() @@ -123,7 +122,7 @@ test "works with objects with empty to or cc fields" do end test "it strips followers collections from an old post" do - Config.put([:mrf_object_age, :actions], [:strip_followers]) + clear_config([:mrf_object_age, :actions], [:strip_followers]) data = get_old_message() @@ -136,7 +135,7 @@ test "it strips followers collections from an old post" do end test "it allows a new post" do - Config.put([:mrf_object_age, :actions], [:strip_followers]) + clear_config([:mrf_object_age, :actions], [:strip_followers]) data = get_new_message() diff --git a/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs index 8e14b21ef..63c68d798 100644 --- a/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs +++ b/test/pleroma/web/activity_pub/mrf/reject_non_public_test.exs @@ -49,7 +49,7 @@ test "it's allowed when addrer of message in the follower addresses of user and "type" => "Create" } - Pleroma.Config.put([:mrf_rejectnonpublic, :allow_followersonly], true) + clear_config([:mrf_rejectnonpublic, :allow_followersonly], true) assert {:ok, _message} = RejectNonPublic.filter(message) end @@ -63,7 +63,7 @@ test "it's rejected when addrer of message in the follower addresses of user and "type" => "Create" } - Pleroma.Config.put([:mrf_rejectnonpublic, :allow_followersonly], false) + clear_config([:mrf_rejectnonpublic, :allow_followersonly], false) assert {:reject, _} = RejectNonPublic.filter(message) end end @@ -79,7 +79,7 @@ test "it's allows when direct messages are allow" do "type" => "Create" } - Pleroma.Config.put([:mrf_rejectnonpublic, :allow_direct], true) + clear_config([:mrf_rejectnonpublic, :allow_direct], true) assert {:ok, _message} = RejectNonPublic.filter(message) end @@ -93,7 +93,7 @@ test "it's reject when direct messages aren't allow" do "type" => "Create" } - Pleroma.Config.put([:mrf_rejectnonpublic, :allow_direct], false) + clear_config([:mrf_rejectnonpublic, :allow_direct], false) assert {:reject, _} = RejectNonPublic.filter(message) end end diff --git a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs index 60a20a80e..f48e5b39b 100644 --- a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do use Pleroma.DataCase import Pleroma.Factory - alias Pleroma.Config alias Pleroma.Web.ActivityPub.MRF.SimplePolicy alias Pleroma.Web.CommonAPI @@ -25,7 +24,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SimplePolicyTest do describe "when :media_removal" do test "is empty" do - Config.put([:mrf_simple, :media_removal], []) + clear_config([:mrf_simple, :media_removal], []) media_message = build_media_message() local_message = build_local_message() @@ -34,7 +33,7 @@ test "is empty" do end test "has a matching host" do - Config.put([:mrf_simple, :media_removal], ["remote.instance"]) + clear_config([:mrf_simple, :media_removal], ["remote.instance"]) media_message = build_media_message() local_message = build_local_message() @@ -47,7 +46,7 @@ test "has a matching host" do end test "match with wildcard domain" do - Config.put([:mrf_simple, :media_removal], ["*.remote.instance"]) + clear_config([:mrf_simple, :media_removal], ["*.remote.instance"]) media_message = build_media_message() local_message = build_local_message() @@ -62,7 +61,7 @@ test "match with wildcard domain" do describe "when :media_nsfw" do test "is empty" do - Config.put([:mrf_simple, :media_nsfw], []) + clear_config([:mrf_simple, :media_nsfw], []) media_message = build_media_message() local_message = build_local_message() @@ -71,7 +70,7 @@ test "is empty" do end test "has a matching host" do - Config.put([:mrf_simple, :media_nsfw], ["remote.instance"]) + clear_config([:mrf_simple, :media_nsfw], ["remote.instance"]) media_message = build_media_message() local_message = build_local_message() @@ -85,7 +84,7 @@ test "has a matching host" do end test "match with wildcard domain" do - Config.put([:mrf_simple, :media_nsfw], ["*.remote.instance"]) + clear_config([:mrf_simple, :media_nsfw], ["*.remote.instance"]) media_message = build_media_message() local_message = build_local_message() @@ -113,7 +112,7 @@ defp build_media_message do describe "when :report_removal" do test "is empty" do - Config.put([:mrf_simple, :report_removal], []) + clear_config([:mrf_simple, :report_removal], []) report_message = build_report_message() local_message = build_local_message() @@ -122,7 +121,7 @@ test "is empty" do end test "has a matching host" do - Config.put([:mrf_simple, :report_removal], ["remote.instance"]) + clear_config([:mrf_simple, :report_removal], ["remote.instance"]) report_message = build_report_message() local_message = build_local_message() @@ -131,7 +130,7 @@ test "has a matching host" do end test "match with wildcard domain" do - Config.put([:mrf_simple, :report_removal], ["*.remote.instance"]) + clear_config([:mrf_simple, :report_removal], ["*.remote.instance"]) report_message = build_report_message() local_message = build_local_message() @@ -149,7 +148,7 @@ defp build_report_message do describe "when :federated_timeline_removal" do test "is empty" do - Config.put([:mrf_simple, :federated_timeline_removal], []) + clear_config([:mrf_simple, :federated_timeline_removal], []) {_, ftl_message} = build_ftl_actor_and_message() local_message = build_local_message() @@ -166,7 +165,7 @@ test "has a matching host" do |> URI.parse() |> Map.fetch!(:host) - Config.put([:mrf_simple, :federated_timeline_removal], [ftl_message_actor_host]) + clear_config([:mrf_simple, :federated_timeline_removal], [ftl_message_actor_host]) local_message = build_local_message() assert {:ok, ftl_message} = SimplePolicy.filter(ftl_message) @@ -187,7 +186,7 @@ test "match with wildcard domain" do |> URI.parse() |> Map.fetch!(:host) - Config.put([:mrf_simple, :federated_timeline_removal], ["*." <> ftl_message_actor_host]) + clear_config([:mrf_simple, :federated_timeline_removal], ["*." <> ftl_message_actor_host]) local_message = build_local_message() assert {:ok, ftl_message} = SimplePolicy.filter(ftl_message) @@ -210,7 +209,7 @@ test "has a matching host but only as:Public in to" do ftl_message = Map.put(ftl_message, "cc", []) - Config.put([:mrf_simple, :federated_timeline_removal], [ftl_message_actor_host]) + clear_config([:mrf_simple, :federated_timeline_removal], [ftl_message_actor_host]) assert {:ok, ftl_message} = SimplePolicy.filter(ftl_message) refute "https://www.w3.org/ns/activitystreams#Public" in ftl_message["to"] @@ -231,7 +230,7 @@ defp build_ftl_actor_and_message do describe "when :reject" do test "is empty" do - Config.put([:mrf_simple, :reject], []) + clear_config([:mrf_simple, :reject], []) remote_message = build_remote_message() @@ -239,7 +238,7 @@ test "is empty" do end test "activity has a matching host" do - Config.put([:mrf_simple, :reject], ["remote.instance"]) + clear_config([:mrf_simple, :reject], ["remote.instance"]) remote_message = build_remote_message() @@ -247,7 +246,7 @@ test "activity has a matching host" do end test "activity matches with wildcard domain" do - Config.put([:mrf_simple, :reject], ["*.remote.instance"]) + clear_config([:mrf_simple, :reject], ["*.remote.instance"]) remote_message = build_remote_message() @@ -255,7 +254,7 @@ test "activity matches with wildcard domain" do end test "actor has a matching host" do - Config.put([:mrf_simple, :reject], ["remote.instance"]) + clear_config([:mrf_simple, :reject], ["remote.instance"]) remote_user = build_remote_user() @@ -265,7 +264,7 @@ test "actor has a matching host" do describe "when :followers_only" do test "is empty" do - Config.put([:mrf_simple, :followers_only], []) + clear_config([:mrf_simple, :followers_only], []) {_, ftl_message} = build_ftl_actor_and_message() local_message = build_local_message() @@ -305,7 +304,7 @@ test "has a matching host" do |> URI.parse() |> Map.fetch!(:host) - Config.put([:mrf_simple, :followers_only], [actor_domain]) + clear_config([:mrf_simple, :followers_only], [actor_domain]) assert {:ok, new_activity} = SimplePolicy.filter(activity) assert actor.follower_address in new_activity["cc"] @@ -323,7 +322,7 @@ test "has a matching host" do describe "when :accept" do test "is empty" do - Config.put([:mrf_simple, :accept], []) + clear_config([:mrf_simple, :accept], []) local_message = build_local_message() remote_message = build_remote_message() @@ -333,7 +332,7 @@ test "is empty" do end test "is not empty but activity doesn't have a matching host" do - Config.put([:mrf_simple, :accept], ["non.matching.remote"]) + clear_config([:mrf_simple, :accept], ["non.matching.remote"]) local_message = build_local_message() remote_message = build_remote_message() @@ -343,7 +342,7 @@ test "is not empty but activity doesn't have a matching host" do end test "activity has a matching host" do - Config.put([:mrf_simple, :accept], ["remote.instance"]) + clear_config([:mrf_simple, :accept], ["remote.instance"]) local_message = build_local_message() remote_message = build_remote_message() @@ -353,7 +352,7 @@ test "activity has a matching host" do end test "activity matches with wildcard domain" do - Config.put([:mrf_simple, :accept], ["*.remote.instance"]) + clear_config([:mrf_simple, :accept], ["*.remote.instance"]) local_message = build_local_message() remote_message = build_remote_message() @@ -363,7 +362,7 @@ test "activity matches with wildcard domain" do end test "actor has a matching host" do - Config.put([:mrf_simple, :accept], ["remote.instance"]) + clear_config([:mrf_simple, :accept], ["remote.instance"]) remote_user = build_remote_user() @@ -373,7 +372,7 @@ test "actor has a matching host" do describe "when :avatar_removal" do test "is empty" do - Config.put([:mrf_simple, :avatar_removal], []) + clear_config([:mrf_simple, :avatar_removal], []) remote_user = build_remote_user() @@ -381,7 +380,7 @@ test "is empty" do end test "is not empty but it doesn't have a matching host" do - Config.put([:mrf_simple, :avatar_removal], ["non.matching.remote"]) + clear_config([:mrf_simple, :avatar_removal], ["non.matching.remote"]) remote_user = build_remote_user() @@ -389,7 +388,7 @@ test "is not empty but it doesn't have a matching host" do end test "has a matching host" do - Config.put([:mrf_simple, :avatar_removal], ["remote.instance"]) + clear_config([:mrf_simple, :avatar_removal], ["remote.instance"]) remote_user = build_remote_user() {:ok, filtered} = SimplePolicy.filter(remote_user) @@ -398,7 +397,7 @@ test "has a matching host" do end test "match with wildcard domain" do - Config.put([:mrf_simple, :avatar_removal], ["*.remote.instance"]) + clear_config([:mrf_simple, :avatar_removal], ["*.remote.instance"]) remote_user = build_remote_user() {:ok, filtered} = SimplePolicy.filter(remote_user) @@ -409,7 +408,7 @@ test "match with wildcard domain" do describe "when :banner_removal" do test "is empty" do - Config.put([:mrf_simple, :banner_removal], []) + clear_config([:mrf_simple, :banner_removal], []) remote_user = build_remote_user() @@ -417,7 +416,7 @@ test "is empty" do end test "is not empty but it doesn't have a matching host" do - Config.put([:mrf_simple, :banner_removal], ["non.matching.remote"]) + clear_config([:mrf_simple, :banner_removal], ["non.matching.remote"]) remote_user = build_remote_user() @@ -425,7 +424,7 @@ test "is not empty but it doesn't have a matching host" do end test "has a matching host" do - Config.put([:mrf_simple, :banner_removal], ["remote.instance"]) + clear_config([:mrf_simple, :banner_removal], ["remote.instance"]) remote_user = build_remote_user() {:ok, filtered} = SimplePolicy.filter(remote_user) @@ -434,7 +433,7 @@ test "has a matching host" do end test "match with wildcard domain" do - Config.put([:mrf_simple, :banner_removal], ["*.remote.instance"]) + clear_config([:mrf_simple, :banner_removal], ["*.remote.instance"]) remote_user = build_remote_user() {:ok, filtered} = SimplePolicy.filter(remote_user) @@ -444,10 +443,10 @@ test "match with wildcard domain" do end describe "when :reject_deletes is empty" do - setup do: Config.put([:mrf_simple, :reject_deletes], []) + setup do: clear_config([:mrf_simple, :reject_deletes], []) test "it accepts deletions even from rejected servers" do - Config.put([:mrf_simple, :reject], ["remote.instance"]) + clear_config([:mrf_simple, :reject], ["remote.instance"]) deletion_message = build_remote_deletion_message() @@ -455,7 +454,7 @@ test "it accepts deletions even from rejected servers" do end test "it accepts deletions even from non-whitelisted servers" do - Config.put([:mrf_simple, :accept], ["non.matching.remote"]) + clear_config([:mrf_simple, :accept], ["non.matching.remote"]) deletion_message = build_remote_deletion_message() @@ -464,10 +463,10 @@ test "it accepts deletions even from non-whitelisted servers" do end describe "when :reject_deletes is not empty but it doesn't have a matching host" do - setup do: Config.put([:mrf_simple, :reject_deletes], ["non.matching.remote"]) + setup do: clear_config([:mrf_simple, :reject_deletes], ["non.matching.remote"]) test "it accepts deletions even from rejected servers" do - Config.put([:mrf_simple, :reject], ["remote.instance"]) + clear_config([:mrf_simple, :reject], ["remote.instance"]) deletion_message = build_remote_deletion_message() @@ -475,7 +474,7 @@ test "it accepts deletions even from rejected servers" do end test "it accepts deletions even from non-whitelisted servers" do - Config.put([:mrf_simple, :accept], ["non.matching.remote"]) + clear_config([:mrf_simple, :accept], ["non.matching.remote"]) deletion_message = build_remote_deletion_message() @@ -484,7 +483,7 @@ test "it accepts deletions even from non-whitelisted servers" do end describe "when :reject_deletes has a matching host" do - setup do: Config.put([:mrf_simple, :reject_deletes], ["remote.instance"]) + setup do: clear_config([:mrf_simple, :reject_deletes], ["remote.instance"]) test "it rejects the deletion" do deletion_message = build_remote_deletion_message() @@ -494,7 +493,7 @@ test "it rejects the deletion" do end describe "when :reject_deletes match with wildcard domain" do - setup do: Config.put([:mrf_simple, :reject_deletes], ["*.remote.instance"]) + setup do: clear_config([:mrf_simple, :reject_deletes], ["*.remote.instance"]) test "it rejects the deletion" do deletion_message = build_remote_deletion_message() diff --git a/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs index b3427c6fd..4f5cc466c 100644 --- a/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/subchain_policy_test.exs @@ -16,7 +16,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.SubchainPolicyTest do setup do: clear_config([:mrf_subchain, :match_actor]) test "it matches and processes subchains when the actor matches a configured target" do - Pleroma.Config.put([:mrf_subchain, :match_actor], %{ + clear_config([:mrf_subchain, :match_actor], %{ ~r/^https:\/\/banned.com/s => [DropPolicy] }) @@ -24,7 +24,7 @@ test "it matches and processes subchains when the actor matches a configured tar end test "it doesn't match and process subchains when the actor doesn't match a configured target" do - Pleroma.Config.put([:mrf_subchain, :match_actor], %{ + clear_config([:mrf_subchain, :match_actor], %{ ~r/^https:\/\/borked.com/s => [DropPolicy] }) diff --git a/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs index 0e852731e..f0432ea42 100644 --- a/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/user_allow_list_policy_test.exs @@ -17,14 +17,14 @@ test "pass filter if allow list is empty" do test "pass filter if allow list isn't empty and user in allow list" do actor = insert(:user) - Pleroma.Config.put([:mrf_user_allowlist], %{"localhost" => [actor.ap_id, "test-ap-id"]}) + clear_config([:mrf_user_allowlist], %{"localhost" => [actor.ap_id, "test-ap-id"]}) message = %{"actor" => actor.ap_id} assert UserAllowListPolicy.filter(message) == {:ok, message} end test "rejected if allow list isn't empty and user not in allow list" do actor = insert(:user) - Pleroma.Config.put([:mrf_user_allowlist], %{"localhost" => ["test-ap-id"]}) + clear_config([:mrf_user_allowlist], %{"localhost" => ["test-ap-id"]}) message = %{"actor" => actor.ap_id} assert {:reject, _} = UserAllowListPolicy.filter(message) end diff --git a/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs index d368d70b7..87d1d79b5 100644 --- a/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/vocabulary_policy_test.exs @@ -11,7 +11,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.VocabularyPolicyTest do setup do: clear_config([:mrf_vocabulary, :accept]) test "it accepts based on parent activity type" do - Pleroma.Config.put([:mrf_vocabulary, :accept], ["Like"]) + clear_config([:mrf_vocabulary, :accept], ["Like"]) message = %{ "type" => "Like", @@ -22,7 +22,7 @@ test "it accepts based on parent activity type" do end test "it accepts based on child object type" do - Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"]) + clear_config([:mrf_vocabulary, :accept], ["Create", "Note"]) message = %{ "type" => "Create", @@ -36,7 +36,7 @@ test "it accepts based on child object type" do end test "it does not accept disallowed child objects" do - Pleroma.Config.put([:mrf_vocabulary, :accept], ["Create", "Note"]) + clear_config([:mrf_vocabulary, :accept], ["Create", "Note"]) message = %{ "type" => "Create", @@ -50,7 +50,7 @@ test "it does not accept disallowed child objects" do end test "it does not accept disallowed parent types" do - Pleroma.Config.put([:mrf_vocabulary, :accept], ["Announce", "Note"]) + clear_config([:mrf_vocabulary, :accept], ["Announce", "Note"]) message = %{ "type" => "Create", @@ -68,7 +68,7 @@ test "it does not accept disallowed parent types" do setup do: clear_config([:mrf_vocabulary, :reject]) test "it rejects based on parent activity type" do - Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"]) + clear_config([:mrf_vocabulary, :reject], ["Like"]) message = %{ "type" => "Like", @@ -79,7 +79,7 @@ test "it rejects based on parent activity type" do end test "it rejects based on child object type" do - Pleroma.Config.put([:mrf_vocabulary, :reject], ["Note"]) + clear_config([:mrf_vocabulary, :reject], ["Note"]) message = %{ "type" => "Create", @@ -93,7 +93,7 @@ test "it rejects based on child object type" do end test "it passes through objects that aren't disallowed" do - Pleroma.Config.put([:mrf_vocabulary, :reject], ["Like"]) + clear_config([:mrf_vocabulary, :reject], ["Like"]) message = %{ "type" => "Announce", diff --git a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs index 782f6c652..320854187 100644 --- a/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/chat_validation_test.exs @@ -149,7 +149,7 @@ test "does not validate if the message has no content", %{ test "does not validate if the message is longer than the remote_limit", %{ valid_chat_message: valid_chat_message } do - Pleroma.Config.put([:instance, :remote_limit], 2) + clear_config([:instance, :remote_limit], 2) refute match?({:ok, _object, _meta}, ObjectValidator.validate(valid_chat_message, [])) end diff --git a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs index 67d441b85..604444a4c 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs @@ -133,7 +133,7 @@ test "it works for follow requests when you are already followed, creating a new end test "it rejects incoming follow requests from blocked users when deny_follow_blocked is enabled" do - Pleroma.Config.put([:user, :deny_follow_blocked], true) + clear_config([:user, :deny_follow_blocked], true) user = insert(:user) {:ok, target} = User.get_or_fetch("http://mastodon.example.org/users/admin") diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs index be99ad93d..31586abc9 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs @@ -415,7 +415,7 @@ test "schedules background fetching of `replies` items if max thread depth limit data: data, items: items } do - Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10) + clear_config([:instance, :federation_incoming_replies_max_depth], 10) {:ok, _activity} = Transmogrifier.handle_incoming(data) @@ -427,7 +427,7 @@ test "schedules background fetching of `replies` items if max thread depth limit test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows", %{data: data} do - Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + clear_config([:instance, :federation_incoming_replies_max_depth], 0) {:ok, _activity} = Transmogrifier.handle_incoming(data) @@ -464,7 +464,7 @@ test "schedules background fetching of `replies` items if max thread depth limit federation_output: federation_output, replies_uris: replies_uris } do - Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 1) + clear_config([:instance, :federation_incoming_replies_max_depth], 1) {:ok, _activity} = Transmogrifier.handle_incoming(federation_output) @@ -476,7 +476,7 @@ test "schedules background fetching of `replies` items if max thread depth limit test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows", %{federation_output: federation_output} do - Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + clear_config([:instance, :federation_incoming_replies_max_depth], 0) {:ok, _activity} = Transmogrifier.handle_incoming(federation_output) @@ -551,7 +551,7 @@ test "returns not modified object when hasn't containts inReplyTo field", %{data end test "returns object with inReplyTo when denied incoming reply", %{data: data} do - Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0) + clear_config([:instance, :federation_incoming_replies_max_depth], 0) object_with_reply = Map.put(data["object"], "inReplyTo", "https://shitposter.club/notice/2827873") @@ -585,7 +585,7 @@ test "returns modified object when allowed incoming reply", %{data: data} do "https://mstdn.io/users/mayuutann/statuses/99568293732299394" ) - Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 5) + clear_config([:instance, :federation_incoming_replies_max_depth], 5) modified_object = Transmogrifier.fix_in_reply_to(object_with_reply) assert modified_object["inReplyTo"] == diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 75ca892aa..77688c7a3 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -8,7 +8,6 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do import ExUnit.CaptureLog import Pleroma.Factory - alias Pleroma.Config alias Pleroma.ConfigDB setup do @@ -27,7 +26,7 @@ defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do setup do: clear_config(:configurable_from_database, true) test "when configuration from database is off", %{conn: conn} do - Config.put(:configurable_from_database, false) + clear_config(:configurable_from_database, false) conn = get(conn, "/api/pleroma/admin/config") assert json_response_and_validate_schema(conn, 400) == @@ -410,8 +409,7 @@ test "saving config with partial update", %{conn: conn} do end test "saving config which need pleroma reboot", %{conn: conn} do - chat = Config.get(:chat) - on_exit(fn -> Config.put(:chat, chat) end) + clear_config([:chat, :enabled], true) assert conn |> put_req_header("content-type", "application/json") @@ -456,8 +454,7 @@ test "saving config which need pleroma reboot", %{conn: conn} do end test "update setting which need reboot, don't change reboot flag until reboot", %{conn: conn} do - chat = Config.get(:chat) - on_exit(fn -> Config.put(:chat, chat) end) + clear_config([:chat, :enabled], true) assert conn |> put_req_header("content-type", "application/json") diff --git a/test/pleroma/web/admin_api/controllers/invite_controller_test.exs b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs index 0f3ca44bc..6366061c8 100644 --- a/test/pleroma/web/admin_api/controllers/invite_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/invite_controller_test.exs @@ -7,7 +7,6 @@ defmodule Pleroma.Web.AdminAPI.InviteControllerTest do import Pleroma.Factory - alias Pleroma.Config alias Pleroma.Repo alias Pleroma.UserInviteToken @@ -119,8 +118,8 @@ test "email with +", %{conn: conn, admin: admin} do setup do: clear_config([:instance, :invites_enabled]) test "it returns 500 if `invites_enabled` is not enabled", %{conn: conn} do - Config.put([:instance, :registrations_open], false) - Config.put([:instance, :invites_enabled], false) + clear_config([:instance, :registrations_open], false) + clear_config([:instance, :invites_enabled], false) conn = conn @@ -138,8 +137,8 @@ test "it returns 500 if `invites_enabled` is not enabled", %{conn: conn} do end test "it returns 500 if `registrations_open` is enabled", %{conn: conn} do - Config.put([:instance, :registrations_open], true) - Config.put([:instance, :invites_enabled], true) + clear_config([:instance, :registrations_open], true) + clear_config([:instance, :invites_enabled], true) conn = conn diff --git a/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs index db935ad12..5d872901e 100644 --- a/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs @@ -21,9 +21,9 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do |> assign(:user, admin) |> assign(:token, token) - Config.put([:media_proxy, :enabled], true) - Config.put([:media_proxy, :invalidation, :enabled], true) - Config.put([:media_proxy, :invalidation, :provider], MediaProxy.Invalidation.Script) + clear_config([:media_proxy, :enabled], true) + clear_config([:media_proxy, :invalidation, :enabled], true) + clear_config([:media_proxy, :invalidation, :provider], MediaProxy.Invalidation.Script) {:ok, %{admin: admin, token: token, conn: conn}} end diff --git a/test/pleroma/web/chat_channel_test.exs b/test/pleroma/web/chat_channel_test.exs index e8c3d965e..29999701c 100644 --- a/test/pleroma/web/chat_channel_test.exs +++ b/test/pleroma/web/chat_channel_test.exs @@ -33,7 +33,7 @@ test "it ignores messages of length zero", %{socket: socket} do end test "it ignores messages above a certain length", %{socket: socket} do - Pleroma.Config.put([:instance, :chat_limit], 2) + clear_config([:instance, :chat_limit], 2) push(socket, "new_msg", %{"text" => "123"}) refute_broadcast("new_msg", %{text: "123"}) end diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index c996766ea..adfe58def 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -234,7 +234,7 @@ test "it posts a chat message" do end test "it reject messages over the local limit" do - Pleroma.Config.put([:instance, :chat_limit], 2) + clear_config([:instance, :chat_limit], 2) author = insert(:user) recipient = insert(:user) @@ -475,7 +475,7 @@ test "with the safe_dm_mention option set, it does not mention people beyond the jafnhar = insert(:user) tridi = insert(:user) - Pleroma.Config.put([:instance, :safe_dm_mentions], true) + clear_config([:instance, :safe_dm_mentions], true) {:ok, activity} = CommonAPI.post(har, %{ @@ -642,7 +642,7 @@ test "it returns error when status is empty and no attachments" do end test "it validates character limits are correctly enforced" do - Pleroma.Config.put([:instance, :limit], 5) + clear_config([:instance, :limit], 5) user = insert(:user) @@ -793,7 +793,7 @@ test "favoriting a status twice returns ok, but without the like activity" do describe "pinned statuses" do setup do - Pleroma.Config.put([:instance, :max_pinned_statuses], 1) + clear_config([:instance, :max_pinned_statuses], 1) user = insert(:user) {:ok, activity} = CommonAPI.post(user, %{status: "HI!!!"}) diff --git a/test/pleroma/web/federator_test.exs b/test/pleroma/web/federator_test.exs index 1bff8d99c..532ee6d30 100644 --- a/test/pleroma/web/federator_test.exs +++ b/test/pleroma/web/federator_test.exs @@ -56,7 +56,7 @@ test "with relays deactivated, it does not publish to the relay", %{ activity: activity, relay_mock: relay_mock } do - Pleroma.Config.put([:instance, :allow_relay], false) + clear_config([:instance, :allow_relay], false) with_mocks([relay_mock]) do Federator.publish(activity) @@ -155,9 +155,9 @@ test "rejects incoming AP docs with incorrect origin" do end test "it does not crash if MRF rejects the post" do - Pleroma.Config.put([:mrf_keyword, :reject], ["lain"]) + clear_config([:mrf_keyword, :reject], ["lain"]) - Pleroma.Config.put( + clear_config( [:mrf, :policies], Pleroma.Web.ActivityPub.MRF.KeywordPolicy ) diff --git a/test/pleroma/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs index aeec89b06..5c9201de1 100644 --- a/test/pleroma/web/feed/tag_controller_test.exs +++ b/test/pleroma/web/feed/tag_controller_test.exs @@ -8,7 +8,6 @@ defmodule Pleroma.Web.Feed.TagControllerTest do import Pleroma.Factory import SweetXml - alias Pleroma.Config alias Pleroma.Object alias Pleroma.Web.CommonAPI alias Pleroma.Web.Feed.FeedView @@ -16,7 +15,7 @@ defmodule Pleroma.Web.Feed.TagControllerTest do setup do: clear_config([:feed]) test "gets a feed (ATOM)", %{conn: conn} do - Config.put( + clear_config( [:feed, :post_title], %{max_length: 25, omission: "..."} ) @@ -83,7 +82,7 @@ test "gets a feed (ATOM)", %{conn: conn} do end test "gets a feed (RSS)", %{conn: conn} do - Config.put( + clear_config( [:feed, :post_title], %{max_length: 25, omission: "..."} ) diff --git a/test/pleroma/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs index 66667783d..408653d92 100644 --- a/test/pleroma/web/feed/user_controller_test.exs +++ b/test/pleroma/web/feed/user_controller_test.exs @@ -8,7 +8,6 @@ defmodule Pleroma.Web.Feed.UserControllerTest do import Pleroma.Factory import SweetXml - alias Pleroma.Config alias Pleroma.Object alias Pleroma.User alias Pleroma.Web.CommonAPI @@ -20,7 +19,7 @@ defmodule Pleroma.Web.Feed.UserControllerTest do setup do: clear_config([:feed]) setup do - Config.put( + clear_config( [:feed, :post_title], %{max_length: 15, omission: "..."} ) @@ -236,7 +235,7 @@ test "with non-html / non-json format, it returns error when user is not found", setup do: clear_config([:instance, :public]) test "returns 404 for user feed", %{conn: conn} do - Config.put([:instance, :public], false) + clear_config([:instance, :public], false) user = insert(:user) {:ok, _} = CommonAPI.post(user, %{status: "test"}) diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 1276597a4..b7a3edd4b 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -1007,7 +1007,7 @@ test "registers and logs in without :account_activation_required / :account_appr assert %{"error" => "{\"email\":[\"Invalid email\"]}"} = json_response_and_validate_schema(conn, 400) - Pleroma.Config.put([User, :email_blacklist], []) + clear_config([User, :email_blacklist], []) conn = build_conn() diff --git a/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs index a5aa72f6f..b28e3df56 100644 --- a/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/scheduled_activity_controller_test.exs @@ -55,7 +55,7 @@ test "shows a scheduled activity" do end test "updates a scheduled activity" do - Pleroma.Config.put([ScheduledActivity, :enabled], true) + clear_config([ScheduledActivity, :enabled], true) %{user: user, conn: conn} = oauth_access(["write:statuses"]) scheduled_at = Timex.shift(NaiveDateTime.utc_now(), minutes: 60) @@ -103,7 +103,7 @@ test "updates a scheduled activity" do end test "deletes a scheduled activity" do - Pleroma.Config.put([ScheduledActivity, :enabled], true) + clear_config([ScheduledActivity, :enabled], true) %{user: user, conn: conn} = oauth_access(["write:statuses"]) scheduled_at = Timex.shift(NaiveDateTime.utc_now(), minutes: 60) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index bfb44374e..a647cd57f 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -7,7 +7,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do use Oban.Testing, repo: Pleroma.Repo alias Pleroma.Activity - alias Pleroma.Config alias Pleroma.Conversation.Participation alias Pleroma.Object alias Pleroma.Repo @@ -29,7 +28,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do setup do: oauth_access(["write:statuses"]) test "posting a status does not increment reblog_count when relaying", %{conn: conn} do - Config.put([:instance, :federating], true) + clear_config([:instance, :federating], true) Config.get([:instance, :allow_relay], true) response = @@ -151,8 +150,8 @@ test "it fails to create a status if `expires_in` is less or equal than an hour" end test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do - Config.put([:mrf_keyword, :reject], ["GNO"]) - Config.put([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy]) + clear_config([:mrf_keyword, :reject], ["GNO"]) + clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy]) assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} = conn @@ -1204,7 +1203,7 @@ test "on pin removes deletion job, on unpin reschedule deletion" do describe "cards" do setup do - Config.put([:rich_media, :enabled], true) + clear_config([:rich_media, :enabled], true) oauth_access(["read:statuses"]) end diff --git a/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs index a8ad025c9..ea66c708f 100644 --- a/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs +++ b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Web.MastodonAPI.MastoFEControllerTest do use Pleroma.Web.ConnCase - alias Pleroma.Config alias Pleroma.User import Pleroma.Factory @@ -55,7 +54,7 @@ test "redirects not logged-in users to the login page on private instances", %{ conn: conn, path: path } do - Config.put([:instance, :public], false) + clear_config([:instance, :public], false) conn = get(conn, path) diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 6de5dc859..999bde474 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.User alias Pleroma.UserRelationship alias Pleroma.Web.CommonAPI @@ -556,7 +555,7 @@ test "uses mediaproxy urls when it's enabled (regardless of media preview proxy ) with media_preview_enabled <- [false, true] do - Config.put([:media_preview_proxy, :enabled], media_preview_enabled) + clear_config([:media_preview_proxy, :enabled], media_preview_enabled) AccountView.render("show.json", %{user: user, skip_visibility_check: true}) |> Enum.all?(fn diff --git a/test/pleroma/web/media_proxy/invalidation_test.exs b/test/pleroma/web/media_proxy/invalidation_test.exs index 8fb026847..c77b8c94a 100644 --- a/test/pleroma/web/media_proxy/invalidation_test.exs +++ b/test/pleroma/web/media_proxy/invalidation_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.Web.MediaProxy.Invalidation import ExUnit.CaptureLog @@ -16,11 +15,11 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do describe "Invalidation.Http" do test "perform request to clear cache" do - Config.put([:media_proxy, :enabled], false) - Config.put([:media_proxy, :invalidation, :enabled], true) - Config.put([:media_proxy, :invalidation, :provider], Invalidation.Http) + clear_config([:media_proxy, :enabled], false) + clear_config([:media_proxy, :invalidation, :enabled], true) + clear_config([:media_proxy, :invalidation, :provider], Invalidation.Http) - Config.put([Invalidation.Http], method: :purge, headers: [{"x-refresh", 1}]) + clear_config([Invalidation.Http], method: :purge, headers: [{"x-refresh", 1}]) image_url = "http://example.com/media/example.jpg" Pleroma.Web.MediaProxy.put_in_banned_urls(image_url) @@ -43,10 +42,10 @@ test "perform request to clear cache" do describe "Invalidation.Script" do test "run script to clear cache" do - Config.put([:media_proxy, :enabled], false) - Config.put([:media_proxy, :invalidation, :enabled], true) - Config.put([:media_proxy, :invalidation, :provider], Invalidation.Script) - Config.put([Invalidation.Script], script_path: "purge-nginx") + clear_config([:media_proxy, :enabled], false) + clear_config([:media_proxy, :invalidation, :enabled], true) + clear_config([:media_proxy, :invalidation, :provider], Invalidation.Script) + clear_config([Invalidation.Script], script_path: "purge-nginx") image_url = "http://example.com/media/example.jpg" Pleroma.Web.MediaProxy.put_in_banned_urls(image_url) diff --git a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs index 56a94e09a..2a449e56d 100644 --- a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs +++ b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs @@ -33,7 +33,7 @@ test "it returns 404 when disabled", %{conn: conn} do end test "it returns 403 for invalid signature", %{conn: conn, url: url} do - Pleroma.Config.put([Pleroma.Web.Endpoint, :secret_key_base], "000") + clear_config([Pleroma.Web.Endpoint, :secret_key_base], "000") %{path: path} = URI.parse(url) assert %Conn{ @@ -128,7 +128,7 @@ test "returns 404 when disabled", %{conn: conn} do end test "it returns 403 for invalid signature", %{conn: conn, url: url} do - Pleroma.Config.put([Pleroma.Web.Endpoint, :secret_key_base], "000") + clear_config([Pleroma.Web.Endpoint, :secret_key_base], "000") %{path: path} = URI.parse(url) assert %Conn{ diff --git a/test/pleroma/web/metadata/providers/open_graph_test.exs b/test/pleroma/web/metadata/providers/open_graph_test.exs index e0f615785..fc44b3cbd 100644 --- a/test/pleroma/web/metadata/providers/open_graph_test.exs +++ b/test/pleroma/web/metadata/providers/open_graph_test.exs @@ -66,7 +66,7 @@ test "it renders all supported types of attachments and skips unknown types" do end test "it does not render attachments if post is nsfw" do - Pleroma.Config.put([Pleroma.Web.Metadata, :unfurl_nsfw], false) + clear_config([Pleroma.Web.Metadata, :unfurl_nsfw], false) user = insert(:user, avatar: %{"url" => [%{"href" => "https://pleroma.gov/tenshi.png"}]}) note = diff --git a/test/pleroma/web/metadata/providers/twitter_card_test.exs b/test/pleroma/web/metadata/providers/twitter_card_test.exs index 3c70a1562..a35e44356 100644 --- a/test/pleroma/web/metadata/providers/twitter_card_test.exs +++ b/test/pleroma/web/metadata/providers/twitter_card_test.exs @@ -54,7 +54,7 @@ test "it uses summary twittercard if post has no attachment" do end test "it renders avatar not attachment if post is nsfw and unfurl_nsfw is disabled" do - Pleroma.Config.put([Pleroma.Web.Metadata, :unfurl_nsfw], false) + clear_config([Pleroma.Web.Metadata, :unfurl_nsfw], false) user = insert(:user, name: "Jimmy Hendriks", bio: "born 19 March 1994") {:ok, activity} = CommonAPI.post(user, %{status: "HI"}) diff --git a/test/pleroma/web/node_info_test.exs b/test/pleroma/web/node_info_test.exs index 888b62791..ee6fdaae8 100644 --- a/test/pleroma/web/node_info_test.exs +++ b/test/pleroma/web/node_info_test.exs @@ -7,8 +7,6 @@ defmodule Pleroma.Web.NodeInfoTest do import Pleroma.Factory - alias Pleroma.Config - setup do: clear_config([:mrf_simple]) setup do: clear_config(:instance) @@ -93,7 +91,7 @@ test "it returns the safe_dm_mentions feature if enabled", %{conn: conn} do assert "safe_dm_mentions" in response["metadata"]["features"] - Config.put([:instance, :safe_dm_mentions], false) + clear_config([:instance, :safe_dm_mentions], false) response = conn @@ -107,7 +105,7 @@ test "it returns the safe_dm_mentions feature if enabled", %{conn: conn} do setup do: clear_config([:instance, :federating]) test "it shows if federation is enabled/disabled", %{conn: conn} do - Config.put([:instance, :federating], true) + clear_config([:instance, :federating], true) response = conn @@ -116,7 +114,7 @@ test "it shows if federation is enabled/disabled", %{conn: conn} do assert response["metadata"]["federation"]["enabled"] == true - Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) response = conn diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs index 9c7c57d48..312500feb 100644 --- a/test/pleroma/web/o_auth/o_auth_controller_test.exs +++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs @@ -923,7 +923,7 @@ test "rejects token exchange with invalid client credentials" do end test "rejects token exchange for valid credentials belonging to unconfirmed user and confirmation is required" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) password = "testpassword" {:ok, user} = @@ -1007,7 +1007,7 @@ test "rejects token exchange for user with password_reset_pending set to true" d end test "rejects token exchange for user with confirmation_pending set to true" do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) password = "testpassword" user = @@ -1086,7 +1086,7 @@ test "rejects an invalid authorization code" do setup do: clear_config([:oauth2, :issue_new_refresh_token]) test "issues a new access token with keep fresh token" do - Pleroma.Config.put([:oauth2, :issue_new_refresh_token], true) + clear_config([:oauth2, :issue_new_refresh_token], true) user = insert(:user) app = insert(:oauth_app, scopes: ["read", "write"]) @@ -1125,7 +1125,7 @@ test "issues a new access token with keep fresh token" do end test "issues a new access token with new fresh token" do - Pleroma.Config.put([:oauth2, :issue_new_refresh_token], false) + clear_config([:oauth2, :issue_new_refresh_token], false) user = insert(:user) app = insert(:oauth_app, scopes: ["read", "write"]) diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs index 5c2473955..cd9fc391d 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs @@ -31,7 +31,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do end test "GET /api/pleroma/emoji/packs when :public: false", %{conn: conn} do - Config.put([:instance, :public], false) + clear_config([:instance, :public], false) conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200) end diff --git a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs index 665c1962e..79561afb7 100644 --- a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs +++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs @@ -35,7 +35,7 @@ test "does nothing if a user is assigned", %{conn: conn} do end test "with `admin_token` query parameter", %{conn: conn} do - Pleroma.Config.put(:admin_token, "password123") + clear_config(:admin_token, "password123") conn = %{conn | params: %{"admin_token" => "wrong_password"}} @@ -54,7 +54,7 @@ test "with `admin_token` query parameter", %{conn: conn} do end test "with `x-admin-token` HTTP header", %{conn: conn} do - Pleroma.Config.put(:admin_token, "☕️") + clear_config(:admin_token, "☕️") conn = conn diff --git a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs index 33d0f64e9..75c3b5784 100644 --- a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs +++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs @@ -5,14 +5,13 @@ defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do use Pleroma.Web.ConnCase - alias Pleroma.Config alias Pleroma.User alias Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug setup do: clear_config([:instance, :public]) test "it halts if not public and no user is assigned", %{conn: conn} do - Config.put([:instance, :public], false) + clear_config([:instance, :public], false) conn = conn @@ -23,7 +22,7 @@ test "it halts if not public and no user is assigned", %{conn: conn} do end test "it continues if public", %{conn: conn} do - Config.put([:instance, :public], true) + clear_config([:instance, :public], true) ret_conn = conn @@ -33,7 +32,7 @@ test "it continues if public", %{conn: conn} do end test "it continues if a user is assigned, even if not public", %{conn: conn} do - Config.put([:instance, :public], false) + clear_config([:instance, :public], false) conn = conn diff --git a/test/pleroma/web/plugs/federating_plug_test.exs b/test/pleroma/web/plugs/federating_plug_test.exs index 9c3426862..01ecd2a1e 100644 --- a/test/pleroma/web/plugs/federating_plug_test.exs +++ b/test/pleroma/web/plugs/federating_plug_test.exs @@ -8,7 +8,7 @@ defmodule Pleroma.Web.Plugs.FederatingPlugTest do setup do: clear_config([:instance, :federating]) test "returns and halt the conn when federating is disabled" do - Pleroma.Config.put([:instance, :federating], false) + clear_config([:instance, :federating], false) conn = build_conn() @@ -19,7 +19,7 @@ test "returns and halt the conn when federating is disabled" do end test "does nothing when federating is enabled" do - Pleroma.Config.put([:instance, :federating], true) + clear_config([:instance, :federating], true) conn = build_conn() diff --git a/test/pleroma/web/plugs/http_signature_plug_test.exs b/test/pleroma/web/plugs/http_signature_plug_test.exs index bb3257dc9..56ef6b06f 100644 --- a/test/pleroma/web/plugs/http_signature_plug_test.exs +++ b/test/pleroma/web/plugs/http_signature_plug_test.exs @@ -32,11 +32,7 @@ test "it call HTTPSignatures to check validity if the actor sighed it" do describe "requires a signature when `authorized_fetch_mode` is enabled" do setup do - Pleroma.Config.put([:activitypub, :authorized_fetch_mode], true) - - on_exit(fn -> - Pleroma.Config.put([:activitypub, :authorized_fetch_mode], false) - end) + clear_config([:activitypub, :authorized_fetch_mode], true) params = %{"actor" => "http://mastodon.example.org/users/admin"} conn = build_conn(:get, "/doesntmattter", params) |> put_format("activity+json") diff --git a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index 1703830ce..7241b0afd 100644 --- a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -181,7 +181,7 @@ test "with :admin option, prefixes all requested scopes with `admin:` " <> "and [optionally] keeps only prefixed scopes, " <> "depending on `[:auth, :enforce_oauth_admin_scope_usage]` setting", %{f: f} do - Pleroma.Config.put([:auth, :enforce_oauth_admin_scope_usage], false) + clear_config([:auth, :enforce_oauth_admin_scope_usage], false) assert f.(["read"], %{admin: true}) == ["admin:read", "read"] @@ -192,7 +192,7 @@ test "with :admin option, prefixes all requested scopes with `admin:` " <> "write" ] - Pleroma.Config.put([:auth, :enforce_oauth_admin_scope_usage], true) + clear_config([:auth, :enforce_oauth_admin_scope_usage], true) assert f.(["read:accounts"], %{admin: true}) == ["admin:read:accounts"] diff --git a/test/pleroma/web/plugs/rate_limiter_test.exs b/test/pleroma/web/plugs/rate_limiter_test.exs index 3cac10b0e..d007e3f26 100644 --- a/test/pleroma/web/plugs/rate_limiter_test.exs +++ b/test/pleroma/web/plugs/rate_limiter_test.exs @@ -6,7 +6,6 @@ defmodule Pleroma.Web.Plugs.RateLimiterTest do use Pleroma.Web.ConnCase alias Phoenix.ConnTest - alias Pleroma.Config alias Pleroma.Web.Plugs.RateLimiter alias Plug.Conn @@ -22,8 +21,8 @@ defmodule Pleroma.Web.Plugs.RateLimiterTest do setup do: clear_config([Pleroma.Web.Plugs.RemoteIp, :enabled]) test "config is required for plug to work" do - Config.put([:rate_limit, @limiter_name], {1, 1}) - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, @limiter_name], {1, 1}) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) assert %{limits: {1, 1}, name: :test_init, opts: [name: :test_init]} == [name: @limiter_name] @@ -54,8 +53,8 @@ test "it restricts based on config values" do scale = 80 limit = 5 - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) - Config.put([:rate_limit, limiter_name], {scale, limit}) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], {scale, limit}) plug_opts = RateLimiter.init(name: limiter_name) conn = build_conn(:get, "/") @@ -86,8 +85,8 @@ test "it restricts based on config values" do test "`bucket_name` option overrides default bucket name" do limiter_name = :test_bucket_name - Config.put([:rate_limit, limiter_name], {1000, 5}) - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], {1000, 5}) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) base_bucket_name = "#{limiter_name}:group1" plug_opts = RateLimiter.init(name: limiter_name, bucket_name: base_bucket_name) @@ -101,8 +100,8 @@ test "`bucket_name` option overrides default bucket name" do test "`params` option allows different queries to be tracked independently" do limiter_name = :test_params - Config.put([:rate_limit, limiter_name], {1000, 5}) - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], {1000, 5}) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) plug_opts = RateLimiter.init(name: limiter_name, params: ["id"]) @@ -117,8 +116,8 @@ test "`params` option allows different queries to be tracked independently" do test "it supports combination of options modifying bucket name" do limiter_name = :test_options_combo - Config.put([:rate_limit, limiter_name], {1000, 5}) - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], {1000, 5}) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) base_bucket_name = "#{limiter_name}:group1" @@ -140,8 +139,8 @@ test "it supports combination of options modifying bucket name" do describe "unauthenticated users" do test "are restricted based on remote IP" do limiter_name = :test_unauthenticated - Config.put([:rate_limit, limiter_name], [{1000, 5}, {1, 10}]) - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], [{1000, 5}, {1, 10}]) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) plug_opts = RateLimiter.init(name: limiter_name) @@ -180,8 +179,8 @@ test "can have limits separate from unauthenticated connections" do scale = 50 limit = 5 - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) - Config.put([:rate_limit, limiter_name], [{1000, 1}, {scale, limit}]) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], [{1000, 1}, {scale, limit}]) plug_opts = RateLimiter.init(name: limiter_name) @@ -202,8 +201,8 @@ test "can have limits separate from unauthenticated connections" do test "different users are counted independently" do limiter_name = :test_authenticated2 - Config.put([:rate_limit, limiter_name], [{1, 10}, {1000, 5}]) - Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], [{1, 10}, {1000, 5}]) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) plug_opts = RateLimiter.init(name: limiter_name) @@ -232,8 +231,8 @@ test "different users are counted independently" do test "doesn't crash due to a race condition when multiple requests are made at the same time and the bucket is not yet initialized" do limiter_name = :test_race_condition - Pleroma.Config.put([:rate_limit, limiter_name], {1000, 5}) - Pleroma.Config.put([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) + clear_config([:rate_limit, limiter_name], {1000, 5}) + clear_config([Pleroma.Web.Endpoint, :http, :ip], {8, 8, 8, 8}) opts = RateLimiter.init(name: limiter_name) diff --git a/test/pleroma/web/plugs/remote_ip_test.exs b/test/pleroma/web/plugs/remote_ip_test.exs index b7fc24db0..4d98de2bd 100644 --- a/test/pleroma/web/plugs/remote_ip_test.exs +++ b/test/pleroma/web/plugs/remote_ip_test.exs @@ -26,7 +26,7 @@ defmodule Pleroma.Web.Plugs.RemoteIpTest do ) test "disabled" do - Pleroma.Config.put(RemoteIp, enabled: false) + clear_config(RemoteIp, enabled: false) %{remote_ip: remote_ip} = conn(:get, "/") @@ -48,7 +48,7 @@ test "enabled" do end test "custom headers" do - Pleroma.Config.put(RemoteIp, enabled: true, headers: ["cf-connecting-ip"]) + clear_config(RemoteIp, enabled: true, headers: ["cf-connecting-ip"]) conn = conn(:get, "/") @@ -73,7 +73,7 @@ test "custom proxies" do refute conn.remote_ip == {1, 1, 1, 1} - Pleroma.Config.put([RemoteIp, :proxies], ["173.245.48.0/20"]) + clear_config([RemoteIp, :proxies], ["173.245.48.0/20"]) conn = conn(:get, "/") @@ -84,7 +84,7 @@ test "custom proxies" do end test "proxies set without CIDR format" do - Pleroma.Config.put([RemoteIp, :proxies], ["173.245.48.1"]) + clear_config([RemoteIp, :proxies], ["173.245.48.1"]) conn = conn(:get, "/") @@ -95,8 +95,8 @@ test "proxies set without CIDR format" do end test "proxies set `nonsensical` CIDR" do - Pleroma.Config.put([RemoteIp, :reserved], ["127.0.0.0/8"]) - Pleroma.Config.put([RemoteIp, :proxies], ["10.0.0.3/24"]) + clear_config([RemoteIp, :reserved], ["127.0.0.0/8"]) + clear_config([RemoteIp, :proxies], ["10.0.0.3/24"]) conn = conn(:get, "/") diff --git a/test/pleroma/web/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs index 71822305b..999c6c49c 100644 --- a/test/pleroma/web/plugs/user_enabled_plug_test.exs +++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs @@ -20,7 +20,7 @@ test "doesn't do anything if the user isn't set", %{conn: conn} do test "with a user that's not confirmed and a config requiring confirmation, it removes that user", %{conn: conn} do - Pleroma.Config.put([:instance, :account_activation_required], true) + clear_config([:instance, :account_activation_required], true) user = insert(:user, is_confirmed: false) diff --git a/test/pleroma/web/rich_media/helpers_test.exs b/test/pleroma/web/rich_media/helpers_test.exs index efa4c91e4..689854fb6 100644 --- a/test/pleroma/web/rich_media/helpers_test.exs +++ b/test/pleroma/web/rich_media/helpers_test.exs @@ -5,7 +5,6 @@ defmodule Pleroma.Web.RichMedia.HelpersTest do use Pleroma.DataCase - alias Pleroma.Config alias Pleroma.Web.CommonAPI alias Pleroma.Web.RichMedia.Helpers @@ -29,7 +28,7 @@ test "refuses to crawl incomplete URLs" do content_type: "text/markdown" }) - Config.put([:rich_media, :enabled], true) + clear_config([:rich_media, :enabled], true) assert %{} == Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) end @@ -43,7 +42,7 @@ test "refuses to crawl malformed URLs" do content_type: "text/markdown" }) - Config.put([:rich_media, :enabled], true) + clear_config([:rich_media, :enabled], true) assert %{} == Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) end @@ -57,7 +56,7 @@ test "crawls valid, complete URLs" do content_type: "text/markdown" }) - Config.put([:rich_media, :enabled], true) + clear_config([:rich_media, :enabled], true) assert %{page_url: "https://example.com/ogp", rich_media: _} = Pleroma.Web.RichMedia.Helpers.fetch_data_for_activity(activity) @@ -74,7 +73,7 @@ test "refuses to crawl URLs of private network from posts" do {:ok, activity4} = CommonAPI.post(user, %{status: "https://192.168.10.40/notice/9kCP7V"}) {:ok, activity5} = CommonAPI.post(user, %{status: "https://pleroma.local/notice/9kCP7V"}) - Config.put([:rich_media, :enabled], true) + clear_config([:rich_media, :enabled], true) assert %{} = Helpers.fetch_data_for_activity(activity) assert %{} = Helpers.fetch_data_for_activity(activity2) diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index 0402e59ea..cef2b7629 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -510,7 +510,7 @@ test "handles deletions" do describe "thread_containment/2" do test "it filters to user if recipients invalid and thread containment is enabled" do - Pleroma.Config.put([:instance, :skip_thread_containment], false) + clear_config([:instance, :skip_thread_containment], false) author = insert(:user) %{user: user, token: oauth_token} = oauth_access(["read"]) User.follow(user, author, :follow_accept) @@ -531,7 +531,7 @@ test "it filters to user if recipients invalid and thread containment is enabled end test "it sends message if recipients invalid and thread containment is disabled" do - Pleroma.Config.put([:instance, :skip_thread_containment], true) + clear_config([:instance, :skip_thread_containment], true) author = insert(:user) %{user: user, token: oauth_token} = oauth_access(["read"]) User.follow(user, author, :follow_accept) @@ -553,7 +553,7 @@ test "it sends message if recipients invalid and thread containment is disabled" end test "it sends message if recipients invalid and thread containment is enabled but user's thread containment is disabled" do - Pleroma.Config.put([:instance, :skip_thread_containment], false) + clear_config([:instance, :skip_thread_containment], false) author = insert(:user) user = insert(:user, skip_thread_containment: true) %{token: oauth_token} = oauth_access(["read"], user: user) diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs index f9d9e0525..f389c272b 100644 --- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs +++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs @@ -154,7 +154,7 @@ test "returns error when user is deactivated", %{conn: conn} do end test "returns error when user is blocked", %{conn: conn} do - Pleroma.Config.put([:user, :deny_follow_blocked], true) + clear_config([:user, :deny_follow_blocked], true) user = insert(:user) user2 = insert(:user) @@ -365,7 +365,7 @@ test "returns error when password invalid", %{conn: conn} do end test "returns error when user is blocked", %{conn: conn} do - Pleroma.Config.put([:user, :deny_follow_blocked], true) + clear_config([:user, :deny_follow_blocked], true) user = insert(:user) user2 = insert(:user) {:ok, _user_block} = Pleroma.User.block(user2, user) diff --git a/test/pleroma/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs index 129ffdf4d..85629be04 100644 --- a/test/pleroma/web/twitter_api/twitter_api_test.exs +++ b/test/pleroma/web/twitter_api/twitter_api_test.exs @@ -46,12 +46,7 @@ test "it registers a new user with empty string in bio and returns the user" do end test "it sends confirmation email if :account_activation_required is specified in instance config" do - setting = Pleroma.Config.get([:instance, :account_activation_required]) - - unless setting do - Pleroma.Config.put([:instance, :account_activation_required], true) - on_exit(fn -> Pleroma.Config.put([:instance, :account_activation_required], setting) end) - end + clear_config([:instance, :account_activation_required], true) data = %{ :username => "lain", diff --git a/test/pleroma/web/twitter_api/util_controller_test.exs b/test/pleroma/web/twitter_api/util_controller_test.exs index 283c61678..bdbc478c3 100644 --- a/test/pleroma/web/twitter_api/util_controller_test.exs +++ b/test/pleroma/web/twitter_api/util_controller_test.exs @@ -6,7 +6,6 @@ defmodule Pleroma.Web.TwitterAPI.UtilControllerTest do use Pleroma.Web.ConnCase use Oban.Testing, repo: Pleroma.Repo - alias Pleroma.Config alias Pleroma.Tests.ObanHelpers alias Pleroma.User @@ -66,7 +65,7 @@ test "returns everything in :pleroma, :frontend_configurations", %{conn: conn} d } ] - Config.put(:frontend_configurations, config) + clear_config(:frontend_configurations, config) response = conn @@ -99,7 +98,7 @@ test "returns json with custom emoji with tags", %{conn: conn} do setup do: clear_config([:instance, :healthcheck]) test "returns 503 when healthcheck disabled", %{conn: conn} do - Config.put([:instance, :healthcheck], false) + clear_config([:instance, :healthcheck], false) response = conn @@ -110,7 +109,7 @@ test "returns 503 when healthcheck disabled", %{conn: conn} do end test "returns 200 when healthcheck enabled and all ok", %{conn: conn} do - Config.put([:instance, :healthcheck], true) + clear_config([:instance, :healthcheck], true) with_mock Pleroma.Healthcheck, system_info: fn -> %Pleroma.Healthcheck{healthy: true} end do @@ -130,7 +129,7 @@ test "returns 200 when healthcheck enabled and all ok", %{conn: conn} do end test "returns 503 when healthcheck enabled and health is false", %{conn: conn} do - Config.put([:instance, :healthcheck], true) + clear_config([:instance, :healthcheck], true) with_mock Pleroma.Healthcheck, system_info: fn -> %Pleroma.Healthcheck{healthy: false} end do diff --git a/test/pleroma/workers/cron/digest_emails_worker_test.exs b/test/pleroma/workers/cron/digest_emails_worker_test.exs index 79614212a..b3ca6235b 100644 --- a/test/pleroma/workers/cron/digest_emails_worker_test.exs +++ b/test/pleroma/workers/cron/digest_emails_worker_test.exs @@ -14,7 +14,7 @@ defmodule Pleroma.Workers.Cron.DigestEmailsWorkerTest do setup do: clear_config([:email_notifications, :digest]) setup do - Pleroma.Config.put([:email_notifications, :digest], %{ + clear_config([:email_notifications, :digest], %{ active: true, inactivity_threshold: 7, interval: 7 diff --git a/test/pleroma/workers/scheduled_activity_worker_test.exs b/test/pleroma/workers/scheduled_activity_worker_test.exs index 6786e639d..6e11642d5 100644 --- a/test/pleroma/workers/scheduled_activity_worker_test.exs +++ b/test/pleroma/workers/scheduled_activity_worker_test.exs @@ -14,7 +14,7 @@ defmodule Pleroma.Workers.ScheduledActivityWorkerTest do setup do: clear_config([ScheduledActivity, :enabled]) test "creates a status from the scheduled activity" do - Pleroma.Config.put([ScheduledActivity, :enabled], true) + clear_config([ScheduledActivity, :enabled], true) user = insert(:user) naive_datetime = @@ -40,7 +40,7 @@ test "creates a status from the scheduled activity" do end test "adds log message if ScheduledActivity isn't find" do - Pleroma.Config.put([ScheduledActivity, :enabled], true) + clear_config([ScheduledActivity, :enabled], true) assert capture_log([level: :error], fn -> ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => 42}}) -- cgit v1.2.3 From 6806c03e8543c57ef85393eafdc6117d9776049f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 21 Jan 2021 18:51:21 +0300 Subject: added total to the user statuses adminAPI endpoint --- CHANGELOG.md | 15 ++++-- docs/development/API/admin_api.md | 13 ++++- lib/pleroma/web/activity_pub/activity_pub.ex | 17 +++++- .../admin_api/controllers/admin_api_controller.ex | 7 +-- lib/pleroma/web/admin_api/views/status_view.ex | 4 ++ .../controllers/admin_api_controller_test.exs | 63 ++++++++++++---------- 6 files changed, 80 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..a6b1f31db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,18 +10,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` - **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate/deactivate` -- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed` -- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved` -- **Breaking**: AdminAPI changed User field `deactivated` to `is_active` - Polls now always return a `voters_count`, even if they are single-choice. - Admin Emails: The ap id is used as the user link in emails now. - Improved registration workflow for email confirmation and account approval modes. - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries. - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators. -- Admin API: Reports now ordered by newest - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script +
+ API Changes + +- **Breaking:** AdminAPI changed User field `confirmation_pending` to `is_confirmed` +- **Breaking:** AdminAPI changed User field `approval_pending` to `is_approved` +- **Breaking**: AdminAPI changed User field `deactivated` to `is_active` +- **Breaking:** AdminAPI `GET /api/pleroma/admin/users/:nickname_or_id/statuses` changed response format and added the number of total users posts. +- Admin API: Reports now ordered by newest + +
+ ### Added - Reports now generate notifications for admins and mods. diff --git a/docs/development/API/admin_api.md b/docs/development/API/admin_api.md index 5253dc668..5b75a7b01 100644 --- a/docs/development/API/admin_api.md +++ b/docs/development/API/admin_api.md @@ -287,7 +287,18 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) - Response: - On failure: `Not found` - - On success: JSON array of user's latest statuses + - On success: JSON, where: + - `total`: total count of the statuses for the user + - `activities`: list of the statuses for the user + +```json +{ + "total" : 1, + "activities": [ + // activities list + ] +} +``` ## `GET /api/pleroma/admin/instances/:instance/statuses` diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index d0bb07aab..9ec106749 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -591,7 +591,21 @@ def fetch_user_abstract_activities(user, reading_user, params \\ %{}) do |> Enum.reverse() end - def fetch_user_activities(user, reading_user, params \\ %{}) do + def fetch_user_activities(user, reading_user, params \\ %{}) + + def fetch_user_activities(user, reading_user, %{total: true} = params) do + result = fetch_activities_for_user(user, reading_user, params) + + Keyword.put(result, :items, Enum.reverse(result[:items])) + end + + def fetch_user_activities(user, reading_user, params) do + user + |> fetch_activities_for_user(reading_user, params) + |> Enum.reverse() + end + + defp fetch_activities_for_user(user, reading_user, params) do params = params |> Map.put(:type, ["Create", "Announce"]) @@ -616,7 +630,6 @@ def fetch_user_activities(user, reading_user, params \\ %{}) do } |> user_activities_recipients() |> fetch_activities(params, pagination_type) - |> Enum.reverse() end def fetch_statuses(reading_user, params) do 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 709c863ec..500556710 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -105,18 +105,19 @@ def list_user_statuses(%{assigns: %{user: admin}} = conn, %{"nickname" => nickna with %User{} = user <- User.get_cached_by_nickname_or_id(nickname, for: admin) do {page, page_size} = page_params(params) - activities = + result = ActivityPub.fetch_user_activities(user, nil, %{ limit: page_size, offset: (page - 1) * page_size, godmode: godmode, exclude_reblogs: not with_reblogs, - pagination_type: :offset + pagination_type: :offset, + total: true }) conn |> put_view(AdminAPI.StatusView) - |> render("index.json", %{activities: activities, as: :activity}) + |> render("index.json", %{total: result[:total], activities: result[:items], as: :activity}) else _ -> {:error, :not_found} end diff --git a/lib/pleroma/web/admin_api/views/status_view.ex b/lib/pleroma/web/admin_api/views/status_view.ex index 361fa5b0d..48d639b41 100644 --- a/lib/pleroma/web/admin_api/views/status_view.ex +++ b/lib/pleroma/web/admin_api/views/status_view.ex @@ -13,6 +13,10 @@ defmodule Pleroma.Web.AdminAPI.StatusView do defdelegate merge_account_views(user), to: AdminAPI.AccountView + def render("index.json", %{total: total} = opts) do + %{total: total, activities: safe_render_many(opts.activities, __MODULE__, "show.json", opts)} + end + def render("index.json", opts) do safe_render_many(opts.activities, __MODULE__, "show.json", opts) end 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 23e4bc3af..fe35a26bd 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 @@ -405,13 +405,9 @@ test "need_reboot flag", %{conn: conn} do setup do user = insert(:user) - date1 = (DateTime.to_unix(DateTime.utc_now()) + 2000) |> DateTime.from_unix!() - date2 = (DateTime.to_unix(DateTime.utc_now()) + 1000) |> DateTime.from_unix!() - date3 = (DateTime.to_unix(DateTime.utc_now()) + 3000) |> DateTime.from_unix!() - - insert(:note_activity, user: user, published: date1) - insert(:note_activity, user: user, published: date2) - insert(:note_activity, user: user, published: date3) + insert(:note_activity, user: user) + insert(:note_activity, user: user) + insert(:note_activity, user: user) %{user: user} end @@ -419,23 +415,22 @@ test "need_reboot flag", %{conn: conn} do test "renders user's statuses", %{conn: conn, user: user} do conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses") - assert json_response(conn, 200) |> length() == 3 + assert %{"total" => 3, "activities" => activities} = json_response(conn, 200) + assert length(activities) == 3 end test "renders user's statuses with pagination", %{conn: conn, user: user} do - conn1 = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=1") - - response1 = json_response(conn1, 200) - - assert response1 |> length() == 1 - - conn2 = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=2") - - response2 = json_response(conn2, 200) + %{"total" => 3, "activities" => [activity1]} = + conn + |> get("/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=1") + |> json_response(200) - assert response2 |> length() == 1 + %{"total" => 3, "activities" => [activity2]} = + conn + |> get("/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=2") + |> json_response(200) - refute response1 == response2 + refute activity1 == activity2 end test "doesn't return private statuses by default", %{conn: conn, user: user} do @@ -443,9 +438,12 @@ test "doesn't return private statuses by default", %{conn: conn, user: user} do {:ok, _public_status} = CommonAPI.post(user, %{status: "public", visibility: "public"}) - conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses") + %{"total" => 4, "activities" => activities} = + conn + |> get("/api/pleroma/admin/users/#{user.nickname}/statuses") + |> json_response(200) - assert json_response(conn, 200) |> length() == 4 + assert length(activities) == 4 end test "returns private statuses with godmode on", %{conn: conn, user: user} do @@ -453,9 +451,12 @@ test "returns private statuses with godmode on", %{conn: conn, user: user} do {:ok, _public_status} = CommonAPI.post(user, %{status: "public", visibility: "public"}) - conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?godmode=true") + %{"total" => 5, "activities" => activities} = + conn + |> get("/api/pleroma/admin/users/#{user.nickname}/statuses?godmode=true") + |> json_response(200) - assert json_response(conn, 200) |> length() == 5 + assert length(activities) == 5 end test "excludes reblogs by default", %{conn: conn, user: user} do @@ -463,13 +464,17 @@ test "excludes reblogs by default", %{conn: conn, user: user} do {:ok, activity} = CommonAPI.post(user, %{status: "."}) {:ok, %Activity{}} = CommonAPI.repeat(activity.id, other_user) - conn_res = get(conn, "/api/pleroma/admin/users/#{other_user.nickname}/statuses") - assert json_response(conn_res, 200) |> length() == 0 - - conn_res = - get(conn, "/api/pleroma/admin/users/#{other_user.nickname}/statuses?with_reblogs=true") + assert %{"total" => 0, "activities" => []} == + conn + |> get("/api/pleroma/admin/users/#{other_user.nickname}/statuses") + |> json_response(200) - assert json_response(conn_res, 200) |> length() == 1 + assert %{"total" => 1, "activities" => [_]} = + conn + |> get( + "/api/pleroma/admin/users/#{other_user.nickname}/statuses?with_reblogs=true" + ) + |> json_response(200) end end -- cgit v1.2.3 From d4158e8bf01af3f998a0295668bada9821c4fdc7 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 21 Jan 2021 19:17:37 +0300 Subject: added total to the instance adminAPI endpoint --- CHANGELOG.md | 1 + docs/development/API/admin_api.md | 13 +++++++- lib/pleroma/web/activity_pub/activity_pub.ex | 12 +++++++- .../admin_api/controllers/admin_api_controller.ex | 7 +++-- .../controllers/admin_api_controller_test.exs | 35 ++++++++++------------ 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6b1f31db..b4fa23177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking:** AdminAPI changed User field `approval_pending` to `is_approved` - **Breaking**: AdminAPI changed User field `deactivated` to `is_active` - **Breaking:** AdminAPI `GET /api/pleroma/admin/users/:nickname_or_id/statuses` changed response format and added the number of total users posts. +- **Breaking:** AdminAPI `GET /api/pleroma/admin/instances/:instance/statuses` changed response format and added the number of total users posts. - Admin API: Reports now ordered by newest
diff --git a/docs/development/API/admin_api.md b/docs/development/API/admin_api.md index 5b75a7b01..04a181401 100644 --- a/docs/development/API/admin_api.md +++ b/docs/development/API/admin_api.md @@ -311,7 +311,18 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - *optional* `with_reblogs`: `true`/`false` – allows to see reblogs (default is false) - Response: - On failure: `Not found` - - On success: JSON array of instance's latest statuses + - On success: JSON, where: + - `total`: total count of the statuses for the instance + - `activities`: list of the statuses for the instance + +```json +{ + "total" : 1, + "activities": [ + // activities list + ] +} +``` ## `GET /api/pleroma/admin/statuses` diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 9ec106749..59e1e884b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -632,7 +632,18 @@ defp fetch_activities_for_user(user, reading_user, params) do |> fetch_activities(params, pagination_type) end + def fetch_statuses(reading_user, %{total: true} = params) do + result = fetch_activities_for_reading_user(reading_user, params) + Keyword.put(result, :items, Enum.reverse(result[:items])) + end + def fetch_statuses(reading_user, params) do + reading_user + |> fetch_activities_for_reading_user(params) + |> Enum.reverse() + end + + defp fetch_activities_for_reading_user(reading_user, params) do params = Map.put(params, :type, ["Create", "Announce"]) %{ @@ -641,7 +652,6 @@ def fetch_statuses(reading_user, params) do } |> user_activities_recipients() |> fetch_activities(params, :offset) - |> Enum.reverse() end defp user_activities_recipients(%{godmode: true}), do: [] 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 500556710..8f89f066a 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -85,17 +85,18 @@ def list_instance_statuses(conn, %{"instance" => instance} = params) do with_reblogs = params["with_reblogs"] == "true" || params["with_reblogs"] == true {page, page_size} = page_params(params) - activities = + result = ActivityPub.fetch_statuses(nil, %{ instance: instance, limit: page_size, offset: (page - 1) * page_size, - exclude_reblogs: not with_reblogs + exclude_reblogs: not with_reblogs, + total: true }) conn |> put_view(AdminAPI.StatusView) - |> render("index.json", %{activities: activities, as: :activity}) + |> render("index.json", %{total: result[:total], activities: result[:items], as: :activity}) end def list_user_statuses(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname} = params) do 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 fe35a26bd..e7688c728 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 @@ -864,33 +864,30 @@ test "GET /instances/:instance/statuses", %{conn: conn} do insert_pair(:note_activity, user: user) activity = insert(:note_activity, user: user2) - ret_conn = get(conn, "/api/pleroma/admin/instances/archae.me/statuses") + %{"total" => 2, "activities" => activities} = + conn |> get("/api/pleroma/admin/instances/archae.me/statuses") |> json_response(200) - response = json_response(ret_conn, 200) + assert length(activities) == 2 - assert length(response) == 2 + %{"total" => 1, "activities" => [_]} = + conn |> get("/api/pleroma/admin/instances/test.com/statuses") |> json_response(200) - ret_conn = get(conn, "/api/pleroma/admin/instances/test.com/statuses") + %{"total" => 0, "activities" => []} = + conn |> get("/api/pleroma/admin/instances/nonexistent.com/statuses") |> json_response(200) - response = json_response(ret_conn, 200) - - assert length(response) == 1 - - ret_conn = get(conn, "/api/pleroma/admin/instances/nonexistent.com/statuses") - - response = json_response(ret_conn, 200) + CommonAPI.repeat(activity.id, user) - assert Enum.empty?(response) + %{"total" => 2, "activities" => activities} = + conn |> get("/api/pleroma/admin/instances/archae.me/statuses") |> json_response(200) - CommonAPI.repeat(activity.id, user) + assert length(activities) == 2 - ret_conn = get(conn, "/api/pleroma/admin/instances/archae.me/statuses") - response = json_response(ret_conn, 200) - assert length(response) == 2 + %{"total" => 3, "activities" => activities} = + conn + |> get("/api/pleroma/admin/instances/archae.me/statuses?with_reblogs=true") + |> json_response(200) - ret_conn = get(conn, "/api/pleroma/admin/instances/archae.me/statuses?with_reblogs=true") - response = json_response(ret_conn, 200) - assert length(response) == 3 + assert length(activities) == 3 end end -- cgit v1.2.3 From 793fc77b160ae2bcaded23d22d7606c2ab499f0a Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Sat, 23 Jan 2021 00:37:49 +0400 Subject: Add active user count --- lib/pleroma/user.ex | 15 +++++++++++ .../web/mastodon_api/views/instance_view.ex | 1 + lib/pleroma/web/plugs/user_tracking_plug.ex | 30 ++++++++++++++++++++++ lib/pleroma/web/router.ex | 1 + .../20210122151424_add_last_active_at_to_users.exs | 11 ++++++++ .../controllers/status_controller_test.exs | 1 + .../controllers/conversation_controller_test.exs | 2 +- 7 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 lib/pleroma/web/plugs/user_tracking_plug.ex create mode 100644 priv/repo/migrations/20210122151424_add_last_active_at_to_users.exs diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index e422b59f1..1dde65335 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -146,6 +146,7 @@ defmodule Pleroma.User do field(:inbox, :string) field(:shared_inbox, :string) field(:accepts_chat_messages, :boolean, default: nil) + field(:last_active_at, :naive_datetime) embeds_one( :notification_settings, @@ -2444,4 +2445,18 @@ def sanitize_html(%User{} = user, filter) do def get_host(%User{ap_id: ap_id} = _user) do URI.parse(ap_id).host end + + def update_last_active_at(user) do + user + |> cast(%{last_active_at: NaiveDateTime.utc_now()}, [:last_active_at]) + |> update_and_set_cache() + end + + def active_user_count(weeks \\ 4) do + active_after = Timex.shift(NaiveDateTime.utc_now(), weeks: -weeks) + + __MODULE__ + |> where([u], u.last_active_at >= ^active_after) + |> Repo.aggregate(:count) + end end diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index 1edbdbe11..73205fb6d 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -45,6 +45,7 @@ def render("show.json", _) do fields_limits: fields_limits(), post_formats: Config.get([:instance, :allowed_post_formats]) }, + stats: %{mau: Pleroma.User.active_user_count()}, vapid_public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key) } } diff --git a/lib/pleroma/web/plugs/user_tracking_plug.ex b/lib/pleroma/web/plugs/user_tracking_plug.ex new file mode 100644 index 000000000..c9a988f00 --- /dev/null +++ b/lib/pleroma/web/plugs/user_tracking_plug.ex @@ -0,0 +1,30 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Plugs.UserTrackingPlug do + alias Pleroma.User + + import Plug.Conn, only: [assign: 3] + + @update_interval :timer.hours(24) + + def init(opts), do: opts + + def call(%{assigns: %{user: %User{id: id} = user}} = conn, _) when not is_nil(id) do + with true <- needs_update?(user), + {:ok, user} <- User.update_last_active_at(user) do + assign(conn, :user, user) + else + _ -> conn + end + end + + def call(conn, _), do: conn + + defp needs_update?(%User{last_active_at: nil}), do: true + + defp needs_update?(%User{last_active_at: last_active_at}) do + NaiveDateTime.diff(NaiveDateTime.utc_now(), last_active_at, :millisecond) >= @update_interval + end +end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index a9e332fa1..7521f5dc3 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -56,6 +56,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.UserEnabledPlug) plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug) + plug(Pleroma.Web.Plugs.UserTrackingPlug) end pipeline :base_api do diff --git a/priv/repo/migrations/20210122151424_add_last_active_at_to_users.exs b/priv/repo/migrations/20210122151424_add_last_active_at_to_users.exs new file mode 100644 index 000000000..9671e495b --- /dev/null +++ b/priv/repo/migrations/20210122151424_add_last_active_at_to_users.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.AddLastActiveAtToUsers do + use Ecto.Migration + + def change do + alter table(:users) do + add(:last_active_at, :naive_datetime) + end + + create_if_not_exists(index(:users, [:last_active_at])) + end +end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index a647cd57f..3c73eb514 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -263,6 +263,7 @@ test "posting a fake status", %{conn: conn} do fake_conn = conn + |> assign(:user, refresh_record(conn.assigns.user)) |> put_req_header("content-type", "application/json") |> post("/api/v1/statuses", %{ "status" => diff --git a/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs index 98a23aaaa..54f2c5a58 100644 --- a/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs @@ -104,7 +104,7 @@ test "PATCH /api/v1/pleroma/conversations/:id" do [participation] = Participation.for_user(user) participation = Repo.preload(participation, :recipients) - assert user in participation.recipients + assert refresh_record(user) in participation.recipients assert other_user in participation.recipients end -- cgit v1.2.3 From bddb01bdedf93b3aabed6a90a3e4f9eac7ef33f0 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Wed, 27 Jan 2021 18:18:46 +0400 Subject: Add tests --- test/pleroma/user_test.exs | 38 ++++++++++++++ .../controllers/instance_controller_test.exs | 1 + test/pleroma/web/plugs/user_tracking_plug_test.exs | 58 ++++++++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100644 test/pleroma/web/plugs/user_tracking_plug_test.exs diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index b4df22c2c..1fab519f0 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -2248,4 +2248,42 @@ test "get_host/1" do user = insert(:user, ap_id: "https://lain.com/users/lain", nickname: "lain") assert User.get_host(user) == "lain.com" end + + test "update_last_active_at/1" do + user = insert(:user) + assert is_nil(user.last_active_at) + + test_started_at = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) + + assert {:ok, user} = User.update_last_active_at(user) + + assert user.last_active_at >= test_started_at + assert user.last_active_at <= NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) + + last_active_at = + NaiveDateTime.utc_now() + |> NaiveDateTime.add(-:timer.hours(24), :millisecond) + |> NaiveDateTime.truncate(:second) + + assert {:ok, user} = + user + |> cast(%{last_active_at: last_active_at}, [:last_active_at]) + |> User.update_and_set_cache() + + assert user.last_active_at == last_active_at + assert {:ok, user} = User.update_last_active_at(user) + assert user.last_active_at >= test_started_at + assert user.last_active_at <= NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) + end + + test "active_user_count/1" do + insert(:user) + insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -5)}) + insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -3)}) + insert(:user, %{last_active_at: NaiveDateTime.utc_now()}) + + assert User.active_user_count() == 2 + assert User.active_user_count(6) == 3 + assert User.active_user_count(1) == 1 + end end diff --git a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs index 0d4eebb73..b99856659 100644 --- a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs @@ -47,6 +47,7 @@ test "get instance information", %{conn: conn} do assert result["pleroma"]["metadata"]["federation"] assert result["pleroma"]["metadata"]["fields_limits"] assert result["pleroma"]["vapid_public_key"] + assert result["pleroma"]["stats"]["mau"] == 0 assert email == from_config_email assert thumbnail == from_config_thumbnail diff --git a/test/pleroma/web/plugs/user_tracking_plug_test.exs b/test/pleroma/web/plugs/user_tracking_plug_test.exs new file mode 100644 index 000000000..8e9d59b99 --- /dev/null +++ b/test/pleroma/web/plugs/user_tracking_plug_test.exs @@ -0,0 +1,58 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Plugs.UserTrackingPlugTest do + use Pleroma.Web.ConnCase, async: true + + import Pleroma.Factory + + alias Pleroma.Web.Plugs.UserTrackingPlug + + test "updates last_active_at for a new user", %{conn: conn} do + user = insert(:user) + + assert is_nil(user.last_active_at) + + test_started_at = NaiveDateTime.utc_now() |> NaiveDateTime.truncate(:second) + + %{assigns: %{user: user}} = + conn + |> assign(:user, user) + |> UserTrackingPlug.call(%{}) + + assert user.last_active_at >= test_started_at + assert user.last_active_at <= NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) + end + + test "doesn't update last_active_at if it was updated recently", %{conn: conn} do + last_active_at = + NaiveDateTime.utc_now() + |> NaiveDateTime.add(-:timer.hours(1), :millisecond) + |> NaiveDateTime.truncate(:second) + + user = insert(:user, %{last_active_at: last_active_at}) + + %{assigns: %{user: user}} = + conn + |> assign(:user, user) + |> UserTrackingPlug.call(%{}) + + assert user.last_active_at == last_active_at + end + + test "skips updating last_active_at if user ID is nil", %{conn: conn} do + %{assigns: %{user: user}} = + conn + |> assign(:user, %Pleroma.User{}) + |> UserTrackingPlug.call(%{}) + + assert is_nil(user.last_active_at) + end + + test "does nothing if user is not present", %{conn: conn} do + %{assigns: assigns} = UserTrackingPlug.call(conn, %{}) + + refute Map.has_key?(assigns, :user) + end +end -- cgit v1.2.3 From 13a2ae8ce0f6eb642ef9d6b8fb2cc08e712385c5 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Wed, 27 Jan 2021 18:23:46 +0400 Subject: Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..905e35f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Admin API: An endpoint to manage frontends. - Streaming API: Add follow relationships updates. - WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types +- Mastodon API: Add monthly active users to `/api/v1/instance` (`pleroma.stats.mau`)
### Fixed -- cgit v1.2.3 From 35cad9793d97a732b88b713971e5ce6679d49d93 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 27 Jan 2021 18:49:08 +0300 Subject: cache headers for emoji and images --- lib/pleroma/web/endpoint.ex | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 94703cd05..7e197ebc5 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -59,6 +59,18 @@ defmodule Pleroma.Web.Endpoint do # # You should set gzip to true if you are running phoenix.digest # when deploying your static files in production. + plug( + Plug.Static, + at: "/", + from: :pleroma, + only: ["emoji", "images"], + gzip: true, + cache_control_for_etags: "public, max-age=1209600", + headers: %{ + "cache-control" => "public, max-age=1209600" + } + ) + plug( Plug.Static, at: "/", -- cgit v1.2.3 From 1547a2fda441c6409a992d838849ba60285b50b4 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 28 Jan 2021 09:39:53 +0000 Subject: mix: instance: ensure all needed folders are created before generating config --- lib/mix/tasks/pleroma/instance.ex | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index f272fdb7f..ffe580fa7 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -242,6 +242,13 @@ def run(["gen" | rest]) do rum_enabled: rum_enabled ) + config_dir = Path.dirname(config_path) + psql_dir = Path.dirname(psql_path) + + [config_dir, psql_dir, static_dir, uploads_dir] + |> Enum.reject(&File.exists?/1) + |> Enum.map(&File.mkdir_p!/1) + shell_info("Writing config to #{config_path}.") File.write(config_path, result_config) @@ -275,10 +282,6 @@ defp write_robots_txt(static_dir, indexable, template_dir) do indexable: indexable ) - unless File.exists?(static_dir) do - File.mkdir_p!(static_dir) - end - robots_txt_path = Path.join(static_dir, "robots.txt") if File.exists?(robots_txt_path) do -- cgit v1.2.3 From aaceb042c562161f289a0504dea8e688843a215e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 28 Jan 2021 10:20:25 +0000 Subject: fix format --- lib/mix/tasks/pleroma/instance.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/tasks/pleroma/instance.ex b/lib/mix/tasks/pleroma/instance.ex index ffe580fa7..da27a99d0 100644 --- a/lib/mix/tasks/pleroma/instance.ex +++ b/lib/mix/tasks/pleroma/instance.ex @@ -244,7 +244,7 @@ def run(["gen" | rest]) do config_dir = Path.dirname(config_path) psql_dir = Path.dirname(psql_path) - + [config_dir, psql_dir, static_dir, uploads_dir] |> Enum.reject(&File.exists?/1) |> Enum.map(&File.mkdir_p!/1) -- cgit v1.2.3 From 39335d42513e47289fc825d04680531b84862686 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 28 Jan 2021 16:57:03 +0300 Subject: fix for unique oban worker option --- lib/pleroma/workers/purge_expired_filter.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/workers/purge_expired_filter.ex b/lib/pleroma/workers/purge_expired_filter.ex index 9c3db8af2..4740d52e9 100644 --- a/lib/pleroma/workers/purge_expired_filter.ex +++ b/lib/pleroma/workers/purge_expired_filter.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Workers.PurgeExpiredFilter do Worker which purges expired filters """ - use Oban.Worker, queue: :filter_expiration, max_attempts: 1, unique: [fields: [:args]] + use Oban.Worker, queue: :filter_expiration, max_attempts: 1, unique: [period: :infinity] import Ecto.Query -- cgit v1.2.3 From 6c987c76708a4f334f9c2ad9b249c0f462fd9511 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 28 Jan 2021 16:50:21 +0300 Subject: fix and delete purge activities duplicates --- lib/pleroma/workers/purge_expired_activity.ex | 2 +- ...e_duplicates_from_activity_expiration_queue.exs | 29 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 priv/repo/migrations/20210128092834_remove_duplicates_from_activity_expiration_queue.exs diff --git a/lib/pleroma/workers/purge_expired_activity.ex b/lib/pleroma/workers/purge_expired_activity.ex index 01256831b..027171c1e 100644 --- a/lib/pleroma/workers/purge_expired_activity.ex +++ b/lib/pleroma/workers/purge_expired_activity.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Workers.PurgeExpiredActivity do Worker which purges expired activity. """ - use Oban.Worker, queue: :activity_expiration, max_attempts: 1 + use Oban.Worker, queue: :activity_expiration, max_attempts: 1, unique: [period: :infinity] import Ecto.Query diff --git a/priv/repo/migrations/20210128092834_remove_duplicates_from_activity_expiration_queue.exs b/priv/repo/migrations/20210128092834_remove_duplicates_from_activity_expiration_queue.exs new file mode 100644 index 000000000..309009205 --- /dev/null +++ b/priv/repo/migrations/20210128092834_remove_duplicates_from_activity_expiration_queue.exs @@ -0,0 +1,29 @@ +defmodule Pleroma.Repo.Migrations.RemoveDuplicatesFromActivityExpirationQueue do + use Ecto.Migration + + import Ecto.Query, only: [from: 2] + + def up do + duplicate_ids = + from(j in Oban.Job, + where: j.queue == "activity_expiration", + where: j.worker == "Pleroma.Workers.PurgeExpiredActivity", + where: j.state == "scheduled", + select: + {fragment("(?)->>'activity_id'", j.args), fragment("array_agg(?)", j.id), count(j.id)}, + group_by: fragment("(?)->>'activity_id'", j.args), + having: count(j.id) > 1 + ) + |> Pleroma.Repo.all() + |> Enum.map(fn {_, ids, _} -> + max_id = Enum.max(ids) + List.delete(ids, max_id) + end) + |> List.flatten() + + from(j in Oban.Job, where: j.id in ^duplicate_ids) + |> Pleroma.Repo.delete_all() + end + + def down, do: :noop +end -- cgit v1.2.3 From dd1be13f752e62214c5345ca76f49ea2c82f3809 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 28 Jan 2021 17:01:31 +0300 Subject: changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..24873f591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers. - Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private. - Tag URLs in statuses are now absolute +- Creation of duplicate purge expired activities jobs
API Changes -- cgit v1.2.3 From 60b46540380e1467dcc0a93f7bfded84c5e98c64 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 28 Jan 2021 19:49:43 +0300 Subject: Email-like field in /api/v1/accounts/verify_credentials response (for OAuth plugins like Peertube). Addresses https://git.pleroma.social/pleroma/pleroma-support/-/issues/56. --- lib/pleroma/user.ex | 9 +++++++ lib/pleroma/web/mastodon_api/views/account_view.ex | 4 ++- lib/pleroma/web/router.ex | 2 ++ lib/pleroma/web/templates/embed/show.html.eex | 2 +- lib/pleroma/web/views/embed_view.ex | 7 ++--- test/pleroma/user_test.exs | 30 ++++++++++++++++++++++ .../web/mastodon_api/views/account_view_test.exs | 2 ++ 7 files changed, 49 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index e422b59f1..7cb36454a 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2030,6 +2030,15 @@ def local_nickname(nickname_or_mention) do |> hd() end + def full_nickname(%User{} = user) do + if String.contains?(user.nickname, "@") do + user.nickname + else + %{host: host} = URI.parse(user.ap_id) + user.nickname <> "@" <> host + end + end + def full_nickname(nickname_or_mention), do: String.trim_leading(nickname_or_mention, "@") diff --git a/lib/pleroma/web/mastodon_api/views/account_view.ex b/lib/pleroma/web/mastodon_api/views/account_view.ex index 63417142f..ac25aefdd 100644 --- a/lib/pleroma/web/mastodon_api/views/account_view.ex +++ b/lib/pleroma/web/mastodon_api/views/account_view.ex @@ -262,7 +262,9 @@ defp do_render("show.json", %{user: user} = opts) do } }, - # Pleroma extension + # Pleroma extensions + # Note: it's insecure to output :email but fully-qualified nickname may serve as safe stub + fqn: User.full_nickname(user), pleroma: %{ ap_id: user.ap_id, also_known_as: user.also_known_as, diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index a9e332fa1..f70d327d2 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -319,6 +319,8 @@ defmodule Pleroma.Web.Router do end scope "/oauth", Pleroma.Web.OAuth do + # Note: use /api/v1/accounts/verify_credentials for userinfo of signed-in user + get("/registration_details", OAuthController, :registration_details) post("/mfa/verify", MFAController, :verify, as: :mfa_verify) diff --git a/lib/pleroma/web/templates/embed/show.html.eex b/lib/pleroma/web/templates/embed/show.html.eex index 05a3f0ee3..092b52b70 100644 --- a/lib/pleroma/web/templates/embed/show.html.eex +++ b/lib/pleroma/web/templates/embed/show.html.eex @@ -6,7 +6,7 @@ <%= raw (@author.name |> Formatter.emojify(@author.emoji)) %> - <%= full_nickname(@author) %> + @<%= full_nickname(@author) %> diff --git a/lib/pleroma/web/views/embed_view.ex b/lib/pleroma/web/views/embed_view.ex index cb7600adb..81e196730 100644 --- a/lib/pleroma/web/views/embed_view.ex +++ b/lib/pleroma/web/views/embed_view.ex @@ -17,6 +17,8 @@ defmodule Pleroma.Web.EmbedView do use Phoenix.HTML + defdelegate full_nickname(user), to: User + @media_types ["image", "audio", "video"] defp fetch_media_type(%{"mediaType" => mediaType}) do @@ -30,11 +32,6 @@ defp open_content? do ) end - defp full_nickname(user) do - %{host: host} = URI.parse(user.ap_id) - "@" <> user.nickname <> "@" <> host - end - defp status_title(%Activity{object: %Object{data: %{"name" => name}}}) when is_binary(name), do: name diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index b4df22c2c..baa71ca66 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -2232,6 +2232,36 @@ test "Notifications are updated", %{user: user} do end end + describe "local_nickname/1" do + test "returns nickname without host" do + assert User.local_nickname("@mentioned") == "mentioned" + assert User.local_nickname("a_local_nickname") == "a_local_nickname" + assert User.local_nickname("nickname@host.com") == "nickname" + end + end + + describe "full_nickname/1" do + test "returns fully qualified nickname for local and remote users" do + local_user = + insert(:user, nickname: "local_user", ap_id: "https://somehost.com/users/local_user") + + remote_user = insert(:user, nickname: "remote@host.com", local: false) + + assert User.full_nickname(local_user) == "local_user@somehost.com" + assert User.full_nickname(remote_user) == "remote@host.com" + end + + test "strips leading @ from mentions" do + assert User.full_nickname("@mentioned") == "mentioned" + assert User.full_nickname("@nickname@host.com") == "nickname@host.com" + end + + test "does not modify nicknames" do + assert User.full_nickname("nickname") == "nickname" + assert User.full_nickname("nickname@host.com") == "nickname@host.com" + end + end + test "avatar fallback" do user = insert(:user) assert User.avatar_url(user) =~ "/images/avi.png" diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs index 999bde474..5373a17c3 100644 --- a/test/pleroma/web/mastodon_api/views/account_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs @@ -73,6 +73,7 @@ test "Represent a user account" do }, fields: [] }, + fqn: "shp@shitposter.club", pleroma: %{ ap_id: user.ap_id, also_known_as: ["https://shitposter.zone/users/shp"], @@ -172,6 +173,7 @@ test "Represent a Service(bot) account" do }, fields: [] }, + fqn: "shp@shitposter.club", pleroma: %{ ap_id: user.ap_id, also_known_as: [], -- cgit v1.2.3 From a51d903e0c8c87247df6b3cdecc476269edf58ce Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Thu, 28 Jan 2021 22:23:10 +0400 Subject: Make sure active_user_count/1 counts only local users --- lib/pleroma/user.ex | 3 ++- test/pleroma/user_test.exs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 1dde65335..06cdb42af 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2446,7 +2446,7 @@ def get_host(%User{ap_id: ap_id} = _user) do URI.parse(ap_id).host end - def update_last_active_at(user) do + def update_last_active_at(%__MODULE__{local: true} = user) do user |> cast(%{last_active_at: NaiveDateTime.utc_now()}, [:last_active_at]) |> update_and_set_cache() @@ -2457,6 +2457,7 @@ def active_user_count(weeks \\ 4) do __MODULE__ |> where([u], u.last_active_at >= ^active_after) + |> where([u], u.local == true) |> Repo.aggregate(:count) end end diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 1fab519f0..ae6fc4c0d 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -2278,6 +2278,7 @@ test "update_last_active_at/1" do test "active_user_count/1" do insert(:user) + insert(:user, %{local: false}) insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -5)}) insert(:user, %{last_active_at: Timex.shift(NaiveDateTime.utc_now(), weeks: -3)}) insert(:user, %{last_active_at: NaiveDateTime.utc_now()}) -- cgit v1.2.3 From 9272cef500308862d0d86be329bad7f41c66d4ad Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 28 Jan 2021 14:03:29 -0600 Subject: Switch to a build of Majic that does not try to fix extensions by default --- mix.exs | 2 +- mix.lock | 2 +- test/pleroma/web/activity_pub/activity_pub_controller_test.exs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mix.exs b/mix.exs index 489bb5729..50d4b4080 100644 --- a/mix.exs +++ b/mix.exs @@ -194,7 +194,7 @@ defp deps do {:restarter, path: "./restarter"}, {:majic, git: "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", - ref: "4c692e544b28d1f5e543fb8a44be090f8cd96f80"}, + ref: "289cda1b6d0d70ccb2ba508a2b0bd24638db2880"}, {:open_api_spex, git: "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"}, diff --git a/mix.lock b/mix.lock index 840a82555..3e5631c72 100644 --- a/mix.lock +++ b/mix.lock @@ -66,7 +66,7 @@ "jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"}, "libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"}, "linkify": {:hex, :linkify, "0.4.1", "f881eb3429ae88010cf736e6fb3eed406c187bcdd544902ec937496636b7c7b3", [:mix], [], "hexpm", "ce98693f54ae9ace59f2f7a8aed3de2ef311381a8ce7794804bd75484c371dda"}, - "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "4c692e544b28d1f5e543fb8a44be090f8cd96f80", [ref: "4c692e544b28d1f5e543fb8a44be090f8cd96f80"]}, + "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "289cda1b6d0d70ccb2ba508a2b0bd24638db2880", [ref: "289cda1b6d0d70ccb2ba508a2b0bd24638db2880"]}, "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, "meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"}, diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index f7417de31..91a3109bb 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1607,9 +1607,9 @@ test "POST /api/ap/upload_media", %{conn: conn} do desc = "Description of the image" image = %Plug.Upload{ - content_type: "bad/content-type", + content_type: "image/jpeg", path: Path.absname("test/fixtures/image.jpg"), - filename: "an_image.png" + filename: "an_image.jpg" } object = -- cgit v1.2.3 From 13d79c281fd09d3f9dad802e6c11722bc75ed746 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 28 Jan 2021 14:42:20 -0600 Subject: Make attachment cleanup jobs a noop if the setting is disabled. --- lib/pleroma/workers/attachments_cleanup_worker.ex | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/workers/attachments_cleanup_worker.ex b/lib/pleroma/workers/attachments_cleanup_worker.ex index a2373ebb9..f5090dae7 100644 --- a/lib/pleroma/workers/attachments_cleanup_worker.ex +++ b/lib/pleroma/workers/attachments_cleanup_worker.ex @@ -17,12 +17,14 @@ def perform(%Job{ "object" => %{"data" => %{"attachment" => [_ | _] = attachments, "actor" => actor}} } }) do - attachments - |> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end) - |> fetch_objects - |> prepare_objects(actor, Enum.map(attachments, & &1["name"])) - |> filter_objects - |> do_clean + if Pleroma.Config.get([:instance, :cleanup_attachments], false) do + attachments + |> Enum.flat_map(fn item -> Enum.map(item["url"], & &1["href"]) end) + |> fetch_objects + |> prepare_objects(actor, Enum.map(attachments, & &1["name"])) + |> filter_objects + |> do_clean + end {:ok, :success} end -- cgit v1.2.3 From 5fcab23aa3a6187d2e8746ff92330ab2aed807f6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 28 Jan 2021 14:57:24 -0600 Subject: Improve error message for ConfigDB --- lib/pleroma/web/admin_api/controllers/admin_api_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/config_controller.ex | 2 +- test/pleroma/web/admin_api/controllers/config_controller_test.exs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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 709c863ec..06883cf2d 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -404,7 +404,7 @@ defp configurable_from_database do if Config.get(:configurable_from_database) do :ok else - {:error, "To use this endpoint you need to enable configuration from database."} + {:error, "You must enable configurable_from_database in your config file."} end end diff --git a/lib/pleroma/web/admin_api/controllers/config_controller.ex b/lib/pleroma/web/admin_api/controllers/config_controller.ex index 7872fe2d8..4ebf2a305 100644 --- a/lib/pleroma/web/admin_api/controllers/config_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/config_controller.ex @@ -122,7 +122,7 @@ defp configurable_from_database do if Config.get(:configurable_from_database) do :ok else - {:error, "To use this endpoint you need to enable configuration from database."} + {:error, "You must enable configurable_from_database in your config file."} end end diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 77688c7a3..578a4c914 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -31,7 +31,7 @@ test "when configuration from database is off", %{conn: conn} do assert json_response_and_validate_schema(conn, 400) == %{ - "error" => "To use this endpoint you need to enable configuration from database." + "error" => "You must enable configurable_from_database in your config file." } end @@ -170,7 +170,7 @@ test "POST /api/pleroma/admin/config with configdb disabled", %{conn: conn} do |> post("/api/pleroma/admin/config", %{"configs" => []}) assert json_response_and_validate_schema(conn, 400) == - %{"error" => "To use this endpoint you need to enable configuration from database."} + %{"error" => "You must enable configurable_from_database in your config file."} end describe "POST /api/pleroma/admin/config" do -- cgit v1.2.3 From 380d0cce6b802baf4d13031a4a39f169dd65bffd Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Fri, 29 Jan 2021 00:17:33 +0300 Subject: [#3213] Reinstated DISTINCT clause for hashtag "any" filtering with 2+ terms. Added test. --- lib/pleroma/web/activity_pub/activity_pub.ex | 17 ++++++++++++----- .../web/mastodon_api/controllers/timeline_controller.ex | 2 +- test/pleroma/web/activity_pub/activity_pub_test.exs | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index be81e0833..0a21ac2f2 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -846,11 +846,18 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_hashtag_any(query, %{tag: tags}) when is_list(tags) do - from( - [_activity, object] in query, - join: hashtag in assoc(object, :hashtags), - where: hashtag.name in ^tags - ) + query = + from( + [_activity, object] in query, + join: hashtag in assoc(object, :hashtags), + where: hashtag.name in ^tags + ) + + if length(tags) > 1 do + distinct(query, [activity], true) + else + query + end end defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 08e6f23b9..1fb954a9b 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -134,9 +134,9 @@ defp hashtag_fetching(params, user, local_only) do tags = [params[:tag], params[:any]] |> List.flatten() - |> Enum.uniq() |> Enum.reject(&is_nil/1) |> Enum.map(&String.downcase/1) + |> Enum.uniq() tag_all = params diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 1fcaf74d3..0b18269cd 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -217,6 +217,9 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_two} = CommonAPI.post(user, %{status: ". #essais"}) {:ok, status_three} = CommonAPI.post(user, %{status: ". #test #reject"}) + {:ok, status_four} = CommonAPI.post(user, %{status: ". #any1 #any2"}) + {:ok, status_five} = CommonAPI.post(user, %{status: ". #any2 #any1"}) + for hashtag_timeline_strategy <- [true, :prefer_aggregation, false] do clear_config([:instance, :improved_hashtag_timeline], hashtag_timeline_strategy) @@ -238,8 +241,17 @@ test "it fetches the appropriate tag-restricted posts" do tag_all: ["test", "reject"] }) - [fetch_one, fetch_two, fetch_three, fetch_four] = - Enum.map([fetch_one, fetch_two, fetch_three, fetch_four], fn statuses -> + # This test would fail if JOIN with 2+ terms in "any" clause is done without DISTINCT. + # The :limit is important (w/o DISTINCT 2 records are deduped by Ecto to 1 b/c of preload). + fetch_five = + ActivityPub.fetch_activities([], %{ + type: "Create", + tag: ["any1", "any2"], + limit: 2 + }) + + [fetch_one, fetch_two, fetch_three, fetch_four, fetch_five] = + Enum.map([fetch_one, fetch_two, fetch_three, fetch_four, fetch_five], fn statuses -> Enum.map(statuses, fn s -> Repo.preload(s, object: :hashtags) end) end) @@ -247,6 +259,7 @@ test "it fetches the appropriate tag-restricted posts" do assert fetch_two == [status_one, status_two, status_three] assert fetch_three == [status_one, status_two] assert fetch_four == [status_three] + assert fetch_five == [status_four, status_five] end end -- cgit v1.2.3 From c369d2b93028e4dc11f1f2c4cd7380ee0392ccac Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 29 Jan 2021 08:41:21 +0300 Subject: support for with_relationships parameter in /api/v1/mutes and /api/v1/accounts/:id endpoints --- CHANGELOG.md | 3 +- .../API/differences_in_mastoapi_responses.md | 7 ++ .../web/api_spec/operations/account_operation.ex | 7 +- .../mastodon_api/controllers/account_controller.ex | 15 ++- .../controllers/account_controller_test.exs | 134 ++++++++++++++++++++- 5 files changed, 155 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..b2b7e5671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute. - Admin API: An endpoint to manage frontends. - Streaming API: Add follow relationships updates. -- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types +- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types. +- Mastodon API: `/api/v1/accounts/:id` & `/api/v1/mutes` endpoints accept `with_relationships` parameter and return filled `pleroma.relationship` field.
### Fixed diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index 84430408b..b532d14ed 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -54,6 +54,13 @@ The `id` parameter can also be the `nickname` of the user. This only works in th - `/api/v1/accounts/:id` - `/api/v1/accounts/:id/statuses` +Endpoints which accept `with_relationships` parameter: + +- `/api/v1/accounts/:id` +- `/api/v1/accounts/:id/followers` +- `/api/v1/accounts/:id/following` +- `/api/v1/mutes` + Has these additional fields under the `pleroma` object: - `ap_id`: nullable URL string, ActivityPub id of the user diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 80acee2f7..d7e01f55b 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -99,7 +99,10 @@ def show_operation do summary: "Account", operationId: "AccountController.show", description: "View information about a profile.", - parameters: [%Reference{"$ref": "#/components/parameters/accountIdOrNickname"}], + parameters: [ + %Reference{"$ref": "#/components/parameters/accountIdOrNickname"}, + with_relationships_param() + ], responses: %{ 200 => Operation.response("Account", "application/json", Account), 401 => Operation.response("Error", "application/json", ApiError), @@ -347,7 +350,7 @@ def mutes_operation do operationId: "AccountController.mutes", description: "Accounts the user has muted.", security: [%{"oAuth" => ["follow", "read:mutes"]}], - parameters: pagination_params(), + parameters: [with_relationships_param() | pagination_params()], responses: %{ 200 => Operation.response("Accounts", "application/json", array_of_accounts()) } diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex index d277aeca5..7a1e99044 100644 --- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex @@ -269,10 +269,14 @@ def relationships(%{assigns: %{user: user}} = conn, %{id: id}) do def relationships(%{assigns: %{user: _user}} = conn, _), do: json(conn, []) @doc "GET /api/v1/accounts/:id" - def show(%{assigns: %{user: for_user}} = conn, %{id: nickname_or_id}) do + def show(%{assigns: %{user: for_user}} = conn, %{id: nickname_or_id} = params) do with %User{} = user <- User.get_cached_by_nickname_or_id(nickname_or_id, for: for_user), :visible <- User.visible_for(user, for_user) do - render(conn, "show.json", user: user, for: for_user) + render(conn, "show.json", + user: user, + for: for_user, + embed_relationships: embed_relationships?(params) + ) else error -> user_visibility_error(conn, error) end @@ -454,7 +458,12 @@ def mutes(%{assigns: %{user: user}} = conn, params) do conn |> add_link_headers(users) - |> render("index.json", users: users, for: user, as: :user) + |> render("index.json", + users: users, + for: user, + as: :user, + embed_relationships: embed_relationships?(params) + ) end @doc "GET /api/v1/blocks" diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs index 1276597a4..e5020feca 100644 --- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs @@ -29,6 +29,45 @@ test "works by id" do |> json_response_and_validate_schema(404) end + test "relationship field" do + %{conn: conn, user: user} = oauth_access(["read"]) + + other_user = insert(:user) + + response = + conn + |> get("/api/v1/accounts/#{other_user.id}") + |> json_response_and_validate_schema(200) + + assert response["id"] == other_user.id + assert response["pleroma"]["relationship"] == %{} + + assert %{"pleroma" => %{"relationship" => %{"following" => false, "followed_by" => false}}} = + conn + |> get("/api/v1/accounts/#{other_user.id}?with_relationships=true") + |> json_response_and_validate_schema(200) + + {:ok, _, %{id: other_id}} = User.follow(user, other_user) + + assert %{ + "id" => ^other_id, + "pleroma" => %{"relationship" => %{"following" => true, "followed_by" => false}} + } = + conn + |> get("/api/v1/accounts/#{other_id}?with_relationships=true") + |> json_response_and_validate_schema(200) + + {:ok, _, _} = User.follow(other_user, user) + + assert %{ + "id" => ^other_id, + "pleroma" => %{"relationship" => %{"following" => true, "followed_by" => true}} + } = + conn + |> get("/api/v1/accounts/#{other_id}?with_relationships=true") + |> json_response_and_validate_schema(200) + end + test "works by nickname" do user = insert(:user) @@ -590,6 +629,45 @@ test "getting followers", %{user: user, conn: conn} do assert [%{"id" => ^user_id}] = json_response_and_validate_schema(conn, 200) end + test "following with relationship", %{conn: conn, user: user} do + other_user = insert(:user) + {:ok, %{id: id}, _} = User.follow(other_user, user) + + assert [ + %{ + "id" => ^id, + "pleroma" => %{ + "relationship" => %{ + "id" => ^id, + "following" => false, + "followed_by" => true + } + } + } + ] = + conn + |> get("/api/v1/accounts/#{user.id}/followers?with_relationships=true") + |> json_response_and_validate_schema(200) + + {:ok, _, _} = User.follow(user, other_user) + + assert [ + %{ + "id" => ^id, + "pleroma" => %{ + "relationship" => %{ + "id" => ^id, + "following" => true, + "followed_by" => true + } + } + } + ] = + conn + |> get("/api/v1/accounts/#{user.id}/followers?with_relationships=true") + |> json_response_and_validate_schema(200) + end + test "getting followers, hide_followers", %{user: user, conn: conn} do other_user = insert(:user, hide_followers: true) {:ok, _user, _other_user} = User.follow(user, other_user) @@ -660,6 +738,24 @@ test "getting following", %{user: user, conn: conn} do assert id == to_string(other_user.id) end + test "following with relationship", %{conn: conn, user: user} do + other_user = insert(:user) + {:ok, user, other_user} = User.follow(user, other_user) + + conn = get(conn, "/api/v1/accounts/#{user.id}/following?with_relationships=true") + + id = other_user.id + + assert [ + %{ + "id" => ^id, + "pleroma" => %{ + "relationship" => %{"id" => ^id, "following" => true, "followed_by" => false} + } + } + ] = json_response_and_validate_schema(conn, 200) + end + test "getting following, hide_follows, other user requesting" do user = insert(:user, hide_follows: true) other_user = insert(:user) @@ -1565,7 +1661,6 @@ test "getting a list of mutes" do result = conn - |> assign(:user, user) |> get("/api/v1/mutes") |> json_response_and_validate_schema(200) @@ -1573,7 +1668,6 @@ test "getting a list of mutes" do result = conn - |> assign(:user, user) |> get("/api/v1/mutes?limit=1") |> json_response_and_validate_schema(200) @@ -1581,7 +1675,6 @@ test "getting a list of mutes" do result = conn - |> assign(:user, user) |> get("/api/v1/mutes?since_id=#{id1}") |> json_response_and_validate_schema(200) @@ -1589,7 +1682,6 @@ test "getting a list of mutes" do result = conn - |> assign(:user, user) |> get("/api/v1/mutes?since_id=#{id1}&max_id=#{id3}") |> json_response_and_validate_schema(200) @@ -1597,13 +1689,45 @@ test "getting a list of mutes" do result = conn - |> assign(:user, user) |> get("/api/v1/mutes?since_id=#{id1}&limit=1") |> json_response_and_validate_schema(200) assert [%{"id" => ^id2}] = result end + test "list of mutes with with_relationships parameter" do + %{user: user, conn: conn} = oauth_access(["read:mutes"]) + %{id: id1} = other_user1 = insert(:user) + %{id: id2} = other_user2 = insert(:user) + %{id: id3} = other_user3 = insert(:user) + + {:ok, _, _} = User.follow(other_user1, user) + {:ok, _, _} = User.follow(other_user2, user) + {:ok, _, _} = User.follow(other_user3, user) + + {:ok, _} = User.mute(user, other_user1) + {:ok, _} = User.mute(user, other_user2) + {:ok, _} = User.mute(user, other_user3) + + assert [ + %{ + "id" => ^id1, + "pleroma" => %{"relationship" => %{"muting" => true, "followed_by" => true}} + }, + %{ + "id" => ^id2, + "pleroma" => %{"relationship" => %{"muting" => true, "followed_by" => true}} + }, + %{ + "id" => ^id3, + "pleroma" => %{"relationship" => %{"muting" => true, "followed_by" => true}} + } + ] = + conn + |> get("/api/v1/mutes?with_relationships=true") + |> json_response_and_validate_schema(200) + end + test "getting a list of blocks" do %{user: user, conn: conn} = oauth_access(["read:blocks"]) %{id: id1} = other_user1 = insert(:user) -- cgit v1.2.3 From b794dae98a09cd1e18af60c1239f5c03b7193e57 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 29 Jan 2021 15:24:22 +0300 Subject: like this --- lib/pleroma/web/endpoint.ex | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex index 7e197ebc5..8e274de88 100644 --- a/lib/pleroma/web/endpoint.ex +++ b/lib/pleroma/web/endpoint.ex @@ -23,6 +23,18 @@ defmodule Pleroma.Web.Endpoint do # InstanceStatic needs to be before Plug.Static to be able to override shipped-static files # If you're adding new paths to `only:` you'll need to configure them in InstanceStatic as well # Cache-control headers are duplicated in case we turn off etags in the future + plug( + Pleroma.Web.Plugs.InstanceStatic, + at: "/", + from: :pleroma, + only: ["emoji", "images"], + gzip: true, + cache_control_for_etags: "public, max-age=1209600", + headers: %{ + "cache-control" => "public, max-age=1209600" + } + ) + plug(Pleroma.Web.Plugs.InstanceStatic, at: "/", gzip: true, @@ -59,18 +71,6 @@ defmodule Pleroma.Web.Endpoint do # # You should set gzip to true if you are running phoenix.digest # when deploying your static files in production. - plug( - Plug.Static, - at: "/", - from: :pleroma, - only: ["emoji", "images"], - gzip: true, - cache_control_for_etags: "public, max-age=1209600", - headers: %{ - "cache-control" => "public, max-age=1209600" - } - ) - plug( Plug.Static, at: "/", -- cgit v1.2.3 From 239057155ff52441227684accd23f81fade005c0 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Fri, 29 Jan 2021 16:36:25 +0300 Subject: [#3286] Documentation on configuring Pleroma as OAuth 2.0 provider. --- docs/configuration/auth.md | 1 + docs/configuration/cheatsheet.md | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 docs/configuration/auth.md diff --git a/docs/configuration/auth.md b/docs/configuration/auth.md new file mode 100644 index 000000000..c80f094e7 --- /dev/null +++ b/docs/configuration/auth.md @@ -0,0 +1 @@ +See `Authentication` section of [the configuration cheatsheet](../configuration/cheatsheet.md#authentication). diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 9d4b07bf4..ad5768465 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -893,6 +893,22 @@ Pleroma account will be created with the same name as the LDAP user name. Note, if your LDAP server is an Active Directory server the correct value is commonly `uid: "cn"`, but if you use an OpenLDAP server the value may be `uid: "uid"`. +### :oauth2 (Pleroma as OAuth 2.0 provider settings) + +OAuth 2.0 provider settings: + +* `token_expires_in` - The lifetime in seconds of the access token. +* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token. +* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`. + +OAuth 2.0 provider and related endpoints: + +* `POST /api/v1/apps` creates client app basing on provided params. +* `GET/POST /oauth/authorize` renders/submits authorization form. +* `POST /oauth/token` creates/renews OAuth token. +* `POST /oauth/revoke` revokes provided OAuth token. +* `GET /api/v1/accounts/verify_credentials` (with proper `Authorization` header or `access_token` URI param) returns user info on requester (with `acct` field containing local nickname and `fqn` field containing fully-qualified nickname which could generally be used as email stub for OAuth software that demands email field in identity endpoint response, like Peertube). + ### OAuth consumer mode OAuth consumer mode allows sign in / sign up via external OAuth providers (e.g. Twitter, Facebook, Google, Microsoft, etc.). @@ -965,14 +981,6 @@ config :ueberauth, Ueberauth, ] ``` -### OAuth 2.0 provider - :oauth2 - -Configure OAuth 2 provider capabilities: - -* `token_expires_in` - The lifetime in seconds of the access token. -* `issue_new_refresh_token` - Keeps old refresh token or generate new refresh token when to obtain an access token. -* `clean_expired_tokens` - Enable a background job to clean expired oauth tokens. Defaults to `false`. - ## Link parsing ### :uri_schemes -- cgit v1.2.3 From 2048b93929360a2917f160c18176c201e51330a1 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 29 Jan 2021 11:31:15 -0600 Subject: Add missing :ex_aws, :s3, :region setting --- config/description.exs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/config/description.exs b/config/description.exs index fac5a006e..f84b52a4f 100644 --- a/config/description.exs +++ b/config/description.exs @@ -3224,6 +3224,12 @@ type: :string, description: "S3 host", suggestions: ["s3.eu-central-1.amazonaws.com"] + }, + %{ + key: :region, + type: :string, + description: "S3 region (for AWS)", + suggestions: ["us-east-1"] } ] }, -- cgit v1.2.3 From 9948ff3356f9e9e214584207a53eba614c73383c Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 31 Jan 2021 18:24:19 +0300 Subject: [#3213] Added HashtagsCleanupWorker periodic job. --- config/config.exs | 2 + config/description.exs | 1 + lib/pleroma/migrators/hashtags_table_migrator.ex | 1 + lib/pleroma/object.ex | 1 + .../workers/cron/hashtags_cleanup_worker.ex | 57 ++++++++++++++++++++++ 5 files changed, 62 insertions(+) create mode 100644 lib/pleroma/workers/cron/hashtags_cleanup_worker.ex diff --git a/config/config.exs b/config/config.exs index c4a690799..dfd2fc434 100644 --- a/config/config.exs +++ b/config/config.exs @@ -553,10 +553,12 @@ remote_fetcher: 2, attachments_cleanup: 1, new_users_digest: 1, + hashtags_cleanup: 1, mute_expire: 5 ], plugins: [Oban.Plugins.Pruner], crontab: [ + {"0 1 * * *", Pleroma.Workers.Cron.HashtagsCleanupWorker}, {"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker}, {"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker} ] diff --git a/config/description.exs b/config/description.exs index 46f085c70..147c1930c 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1943,6 +1943,7 @@ type: {:list, :tuple}, description: "Settings for cron background jobs", suggestions: [ + {"0 1 * * *", Pleroma.Workers.Cron.HashtagsCleanupWorker}, {"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker}, {"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker} ] diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 6a1c9592c..07b42a7f4 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -152,6 +152,7 @@ def handle_info(:migrate_hashtags, state) do defp query do # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) + # Note: not checking activity type; HashtagsCleanupWorker should clean up unused records later from( object in Object, where: diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 9edf43e04..52b77e41c 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -65,6 +65,7 @@ def change(struct, params \\ %{}) do |> maybe_handle_hashtags_change(struct) end + # Note: not checking activity type; HashtagsCleanupWorker should clean up unused records later defp maybe_handle_hashtags_change(changeset, struct) do with data_hashtags_change = get_change(changeset, :data), true <- hashtags_changed?(struct, data_hashtags_change), diff --git a/lib/pleroma/workers/cron/hashtags_cleanup_worker.ex b/lib/pleroma/workers/cron/hashtags_cleanup_worker.ex new file mode 100644 index 000000000..b319067ca --- /dev/null +++ b/lib/pleroma/workers/cron/hashtags_cleanup_worker.ex @@ -0,0 +1,57 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Workers.Cron.HashtagsCleanupWorker do + @moduledoc """ + The worker to clean up unused hashtags_objects and hashtags. + """ + + use Oban.Worker, queue: "hashtags_cleanup" + + alias Pleroma.Repo + + require Logger + + @hashtags_objects_query """ + DELETE FROM hashtags_objects WHERE object_id IN + (SELECT DISTINCT objects.id FROM objects + JOIN hashtags_objects ON hashtags_objects.object_id = objects.id LEFT JOIN activities + ON COALESCE(activities.data->'object'->>'id', activities.data->>'object') = + (objects.data->>'id') + AND activities.data->>'type' = 'Create' + WHERE activities.id IS NULL); + """ + + @hashtags_query """ + DELETE FROM hashtags WHERE id IN + (SELECT hashtags.id FROM hashtags + LEFT OUTER JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id + WHERE hashtags_objects.hashtag_id IS NULL AND hashtags.inserted_at < $1); + """ + + @impl Oban.Worker + def perform(_job) do + Logger.info("Cleaning up unused `hashtags_objects` records...") + + {:ok, %{num_rows: hashtags_objects_count}} = + Repo.query(@hashtags_objects_query, [], timeout: :infinity) + + Logger.info("Deleted #{hashtags_objects_count} unused `hashtags_objects` records.") + + Logger.info("Cleaning up unused `hashtags` records...") + + # Note: ignoring recently created hashtags since references are added after hashtag is created + {:ok, %{num_rows: hashtags_count}} = + Repo.query(@hashtags_query, [NaiveDateTime.add(NaiveDateTime.utc_now(), -3600 * 24)], + timeout: :infinity + ) + + Logger.info("Deleted #{hashtags_count} unused `hashtags` records.") + + Logger.info("HashtagsCleanupWorker complete.") + + :ok + end +end -- cgit v1.2.3 From 6fd4163ab60be07b1a20ac8911e105ddca8e2095 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 31 Jan 2021 20:37:33 +0300 Subject: [#3213] ActivityPub: implemented subqueries-based hashtags filtering, removed aggregation-based hashtags filtering. --- config/description.exs | 2 +- lib/pleroma/web/activity_pub/activity_pub.ex | 228 +++++++-------------- .../pleroma/web/activity_pub/activity_pub_test.exs | 5 +- 3 files changed, 81 insertions(+), 154 deletions(-) diff --git a/config/description.exs b/config/description.exs index 147c1930c..ead541724 100644 --- a/config/description.exs +++ b/config/description.exs @@ -940,7 +940,7 @@ key: :improved_hashtag_timeline, type: :keyword, description: - "If `true` / `:prefer_aggregation`, hashtags table and selected strategy will be used for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." + "If `true`, hashtags will be fetched from `hashtags` table for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." } ] }, diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 0a21ac2f2..cda8d3f54 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -669,24 +669,6 @@ defp restrict_since(query, %{since_id: since_id}) do defp restrict_since(query, _), do: query - defp restrict_embedded_tag_reject(_query, %{tag_reject: _tag_reject, skip_preload: true}) do - raise_on_missing_preload() - end - - defp restrict_embedded_tag_reject(query, %{tag_reject: tag_reject}) when is_list(tag_reject) do - from( - [_activity, object] in query, - where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) - ) - end - - defp restrict_embedded_tag_reject(query, %{tag_reject: tag_reject}) - when is_binary(tag_reject) do - restrict_embedded_tag_reject(query, %{tag_reject: [tag_reject]}) - end - - defp restrict_embedded_tag_reject(query, _), do: query - defp restrict_embedded_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) do raise_on_missing_preload() end @@ -699,139 +681,65 @@ defp restrict_embedded_tag_all(query, %{tag_all: tag_all}) when is_list(tag_all) end defp restrict_embedded_tag_all(query, %{tag_all: tag}) when is_binary(tag) do - restrict_embedded_tag(query, %{tag: tag}) + restrict_embedded_tag_any(query, %{tag: tag}) end defp restrict_embedded_tag_all(query, _), do: query - defp restrict_embedded_tag(_query, %{tag: _tag, skip_preload: true}) do + defp restrict_embedded_tag_any(_query, %{tag: _tag, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_embedded_tag(query, %{tag: tag}) when is_list(tag) do + defp restrict_embedded_tag_any(query, %{tag: tag}) when is_list(tag) do from( [_activity, object] in query, where: fragment("(?)->'tag' \\?| (?)", object.data, ^tag) ) end - defp restrict_embedded_tag(query, %{tag: tag}) when is_binary(tag) do - restrict_embedded_tag(query, %{tag: [tag]}) - end - - defp restrict_embedded_tag(query, _), do: query - - defp hashtag_conditions(opts) do - [:tag, :tag_all, :tag_reject] - |> Enum.map(&opts[&1]) - |> Enum.map(&List.wrap(&1)) - end - - # Note: times out on larger instances (with default timeout), intended for complex queries - defp restrict_hashtag_agg(query, opts) do - [tag_any, tag_all, tag_reject] = hashtag_conditions(opts) - has_conditions = Enum.any?([tag_any, tag_all, tag_reject], &Enum.any?(&1)) - - cond do - !has_conditions -> - query - - opts[:skip_preload] -> - raise_on_missing_preload() - - true -> - query - |> group_by_all_bindings() - |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) - |> maybe_restrict_hashtag_any(tag_any) - |> maybe_restrict_hashtag_all(tag_all) - |> maybe_restrict_hashtag_reject_any(tag_reject) - end - end - - # Groups by all bindings to allow aggregation on hashtags - defp group_by_all_bindings(query) do - # Expecting named bindings: :object, :bookmark, :thread_mute, :report_note - cond do - Enum.count(query.aliases) == 4 -> - from([a, o, b3, b4, b5] in query, group_by: [a.id, o.id, b3.id, b4.id, b5.id]) - - Enum.count(query.aliases) == 3 -> - from([a, o, b3, b4] in query, group_by: [a.id, o.id, b3.id, b4.id]) - - Enum.count(query.aliases) == 2 -> - from([a, o, b3] in query, group_by: [a.id, o.id, b3.id]) - - true -> - from([a, o] in query, group_by: [a.id, o.id]) - end - end - - defp maybe_restrict_hashtag_any(query, []) do - query - end - - defp maybe_restrict_hashtag_any(query, tags) do - having( - query, - [hashtag: hashtag], - fragment("array_agg(?) && (?)", hashtag.name, ^tags) - ) - end - - defp maybe_restrict_hashtag_all(query, []) do - query + defp restrict_embedded_tag_any(query, %{tag: tag}) when is_binary(tag) do + restrict_embedded_tag_any(query, %{tag: [tag]}) end - defp maybe_restrict_hashtag_all(query, tags) do - having( - query, - [hashtag: hashtag], - fragment("array_agg(?) @> (?)", hashtag.name, ^tags) - ) - end + defp restrict_embedded_tag_any(query, _), do: query - defp maybe_restrict_hashtag_reject_any(query, []) do - query - end - - defp maybe_restrict_hashtag_reject_any(query, tags) do - having( - query, - [hashtag: hashtag], - fragment("not(array_agg(?) && (?))", hashtag.name, ^tags) - ) - end - - defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do + defp restrict_embedded_tag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do - query - |> group_by_all_bindings() - |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) - |> having( - [hashtag: hashtag], - fragment("not(array_agg(?) && (?))", hashtag.name, ^tags_reject) + defp restrict_embedded_tag_reject_any(query, %{tag_reject: tag_reject}) + when is_list(tag_reject) do + from( + [_activity, object] in query, + where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) ) end - defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do - restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) + defp restrict_embedded_tag_reject_any(query, %{tag_reject: tag_reject}) + when is_binary(tag_reject) do + restrict_embedded_tag_reject_any(query, %{tag_reject: [tag_reject]}) end - defp restrict_hashtag_reject_any(query, _), do: query + defp restrict_embedded_tag_reject_any(query, _), do: query defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do raise_on_missing_preload() end defp restrict_hashtag_all(query, %{tag_all: tags}) when is_list(tags) do - Enum.reduce( - tags, - query, - fn tag, acc -> restrict_hashtag_any(acc, %{tag: tag}) end + from( + [_activity, object] in query, + where: + fragment( + """ + (SELECT array_agg(hashtags.name) FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ?) @> ? + """, + ^tags, + object.id, + ^tags + ) ) end @@ -846,18 +754,19 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_hashtag_any(query, %{tag: tags}) when is_list(tags) do - query = - from( - [_activity, object] in query, - join: hashtag in assoc(object, :hashtags), - where: hashtag.name in ^tags - ) - - if length(tags) > 1 do - distinct(query, [activity], true) - else - query - end + from( + [_activity, object] in query, + where: + fragment( + """ + EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ? LIMIT 1) + """, + ^tags, + object.id + ) + ) end defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do @@ -866,6 +775,32 @@ defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do defp restrict_hashtag_any(query, _), do: query + defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do + raise_on_missing_preload() + end + + defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do + from( + [_activity, object] in query, + where: + fragment( + """ + NOT EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ? LIMIT 1) + """, + ^tags_reject, + object.id + ) + ) + end + + defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do + restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) + end + + defp restrict_hashtag_reject_any(query, _), do: query + defp raise_on_missing_preload do raise "Can't use the child object without preloading!" end @@ -1286,23 +1221,16 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> exclude_invisible_actors(opts) |> exclude_visibility(opts) - hashtag_timeline_strategy = Config.improved_hashtag_timeline() - - cond do - !hashtag_timeline_strategy -> - query - |> restrict_embedded_tag(opts) - |> restrict_embedded_tag_reject(opts) - |> restrict_embedded_tag_all(opts) - - hashtag_timeline_strategy == :prefer_aggregation -> - restrict_hashtag_agg(query, opts) - - true -> - query - |> restrict_hashtag_any(opts) - |> restrict_hashtag_all(opts) - |> restrict_hashtag_reject_any(opts) + if Config.improved_hashtag_timeline() do + query + |> restrict_hashtag_any(opts) + |> restrict_hashtag_all(opts) + |> restrict_hashtag_reject_any(opts) + else + query + |> restrict_embedded_tag_any(opts) + |> restrict_embedded_tag_all(opts) + |> restrict_embedded_tag_reject_any(opts) end end diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 0b18269cd..c2cc5a9af 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -220,7 +220,7 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_four} = CommonAPI.post(user, %{status: ". #any1 #any2"}) {:ok, status_five} = CommonAPI.post(user, %{status: ". #any2 #any1"}) - for hashtag_timeline_strategy <- [true, :prefer_aggregation, false] do + for hashtag_timeline_strategy <- [true, false] do clear_config([:instance, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) @@ -241,8 +241,7 @@ test "it fetches the appropriate tag-restricted posts" do tag_all: ["test", "reject"] }) - # This test would fail if JOIN with 2+ terms in "any" clause is done without DISTINCT. - # The :limit is important (w/o DISTINCT 2 records are deduped by Ecto to 1 b/c of preload). + # Testing that deduplication (if needed) is done on DB (not Ecto) level; :limit is important fetch_five = ActivityPub.fetch_activities([], %{ type: "Create", -- cgit v1.2.3 From 108e90b18edcfb57b9839e7c5d6d444a63ae2069 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 31 Jan 2021 22:03:59 +0300 Subject: [#3213] Explicitly defined PKs in hashtags_objects and data_migration_failed_ids. Added "pleroma.database rollback" task to revert a single migration. --- lib/mix/tasks/pleroma/database.ex | 24 ++++++++++++++++++++++ .../20201221203824_create_hashtags_objects.exs | 4 ++-- ...ta_migration_create_populate_hashtags_table.exs | 4 +++- ...0111172254_create_data_migration_failed_ids.exs | 4 ++-- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 4ddace9c9..30c0d2bf1 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -20,6 +20,30 @@ defmodule Mix.Tasks.Pleroma.Database do @shortdoc "A collection of database related tasks" @moduledoc File.read!("docs/administration/CLI_tasks/database.md") + # Rolls back a specific migration (leaving subsequent migrations applied) + # Based on https://stackoverflow.com/a/53825840 + def run(["rollback", version]) do + start_pleroma() + + version = String.to_integer(version) + re = ~r/^#{version}_.*\.exs/ + path = Application.app_dir(:pleroma, Path.join(["priv", "repo", "migrations"])) + + result = + with {:find, "" <> file} <- {:find, Enum.find(File.ls!(path), &String.match?(&1, re))}, + {:compile, [{mod, _} | _]} <- {:compile, Code.compile_file(Path.join(path, file))}, + {:rollback, :ok} <- {:rollback, Ecto.Migrator.down(Repo, version, mod)} do + {:ok, "Reversed migration: #{file}"} + else + {:find, _} -> {:error, "No migration found with version prefix: #{version}"} + {:compile, e} -> {:error, "Problem compiling migration module: #{inspect(e)}"} + {:rollback, e} -> {:error, "Problem reversing migration: #{inspect(e)}"} + e -> {:error, "Something unexpected happened: #{inspect(e)}"} + end + + IO.inspect(result) + end + def run(["remove_embedded_objects" | args]) do {options, [], []} = OptionParser.parse( diff --git a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs index 214ea81c3..efd60369d 100644 --- a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs +++ b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs @@ -3,8 +3,8 @@ defmodule Pleroma.Repo.Migrations.CreateHashtagsObjects do def change do create_if_not_exists table(:hashtags_objects, primary_key: false) do - add(:hashtag_id, references(:hashtags), null: false) - add(:object_id, references(:objects), null: false) + add(:hashtag_id, references(:hashtags), null: false, primary_key: true) + add(:object_id, references(:objects), null: false, primary_key: true) end create_if_not_exists(unique_index(:hashtags_objects, [:hashtag_id, :object_id])) diff --git a/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs b/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs index 2a965f075..cf3cf26a0 100644 --- a/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs +++ b/priv/repo/migrations/20210106183301_data_migration_create_populate_hashtags_table.exs @@ -10,5 +10,7 @@ def up do ) end - def down, do: :ok + def down do + execute("DELETE FROM data_migrations WHERE name = 'populate_hashtags_table';") + end end diff --git a/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs b/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs index ba0be98af..18afa74ac 100644 --- a/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs +++ b/priv/repo/migrations/20210111172254_create_data_migration_failed_ids.exs @@ -3,8 +3,8 @@ defmodule Pleroma.Repo.Migrations.CreateDataMigrationFailedIds do def change do create_if_not_exists table(:data_migration_failed_ids, primary_key: false) do - add(:data_migration_id, references(:data_migrations), null: false) - add(:record_id, :bigint, null: false) + add(:data_migration_id, references(:data_migrations), null: false, primary_key: true) + add(:record_id, :bigint, null: false, primary_key: true) end create_if_not_exists( -- cgit v1.2.3 From 10207f840ce3515dddfde36288575f203c52840f Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 31 Jan 2021 22:36:46 +0300 Subject: [#3213] ActivityPub: temporarily reverted to previous hashtags filtering implementation due to blank results issue. --- lib/pleroma/web/activity_pub/activity_pub.ex | 106 ++++++++++++++------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index cda8d3f54..fd0144aad 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -722,24 +722,53 @@ defp restrict_embedded_tag_reject_any(query, %{tag_reject: tag_reject}) defp restrict_embedded_tag_reject_any(query, _), do: query + # Groups by all bindings to allow aggregation on hashtags + defp group_by_all_bindings(query) do + # Expecting named bindings: :object, :bookmark, :thread_mute, :report_note + cond do + Enum.count(query.aliases) == 4 -> + from([a, o, b3, b4, b5] in query, group_by: [a.id, o.id, b3.id, b4.id, b5.id]) + + Enum.count(query.aliases) == 3 -> + from([a, o, b3, b4] in query, group_by: [a.id, o.id, b3.id, b4.id]) + + Enum.count(query.aliases) == 2 -> + from([a, o, b3] in query, group_by: [a.id, o.id, b3.id]) + + true -> + from([a, o] in query, group_by: [a.id, o.id]) + end + end + + defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do + raise_on_missing_preload() + end + + defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do + query + |> group_by_all_bindings() + |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) + |> having( + [hashtag: hashtag], + fragment("not(array_agg(?) && (?))", hashtag.name, ^tags_reject) + ) + end + + defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do + restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) + end + + defp restrict_hashtag_reject_any(query, _), do: query + defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do raise_on_missing_preload() end defp restrict_hashtag_all(query, %{tag_all: tags}) when is_list(tags) do - from( - [_activity, object] in query, - where: - fragment( - """ - (SELECT array_agg(hashtags.name) FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) - AND hashtags_objects.object_id = ?) @> ? - """, - ^tags, - object.id, - ^tags - ) + Enum.reduce( + tags, + query, + fn tag, acc -> restrict_hashtag_any(acc, %{tag: tag}) end ) end @@ -754,19 +783,18 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_hashtag_any(query, %{tag: tags}) when is_list(tags) do - from( - [_activity, object] in query, - where: - fragment( - """ - EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) - AND hashtags_objects.object_id = ? LIMIT 1) - """, - ^tags, - object.id - ) - ) + query = + from( + [_activity, object] in query, + join: hashtag in assoc(object, :hashtags), + where: hashtag.name in ^tags + ) + + if length(tags) > 1 do + distinct(query, [activity], true) + else + query + end end defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do @@ -775,32 +803,6 @@ defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do defp restrict_hashtag_any(query, _), do: query - defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do - raise_on_missing_preload() - end - - defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do - from( - [_activity, object] in query, - where: - fragment( - """ - NOT EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) - AND hashtags_objects.object_id = ? LIMIT 1) - """, - ^tags_reject, - object.id - ) - ) - end - - defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do - restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) - end - - defp restrict_hashtag_reject_any(query, _), do: query - defp raise_on_missing_preload do raise "Can't use the child object without preloading!" end -- cgit v1.2.3 From cf4765af4098098fa4d6996193432bd19c439a75 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 31 Jan 2021 23:06:38 +0300 Subject: [#3213] ActivityPub: fixed subquery-based hashtags filtering implementation (addressed empty list options issue). Added regression test. --- lib/pleroma/web/activity_pub/activity_pub.ex | 115 ++++++++++----------- .../pleroma/web/activity_pub/activity_pub_test.exs | 11 ++ 2 files changed, 67 insertions(+), 59 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index fd0144aad..6cf4093fb 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -673,7 +673,7 @@ defp restrict_embedded_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) raise_on_missing_preload() end - defp restrict_embedded_tag_all(query, %{tag_all: tag_all}) when is_list(tag_all) do + defp restrict_embedded_tag_all(query, %{tag_all: [_ | _] = tag_all}) do from( [_activity, object] in query, where: fragment("(?)->'tag' \\?& (?)", object.data, ^tag_all) @@ -690,7 +690,7 @@ defp restrict_embedded_tag_any(_query, %{tag: _tag, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_embedded_tag_any(query, %{tag: tag}) when is_list(tag) do + defp restrict_embedded_tag_any(query, %{tag: [_ | _] = tag}) do from( [_activity, object] in query, where: fragment("(?)->'tag' \\?| (?)", object.data, ^tag) @@ -707,8 +707,7 @@ defp restrict_embedded_tag_reject_any(_query, %{tag_reject: _tag_reject, skip_pr raise_on_missing_preload() end - defp restrict_embedded_tag_reject_any(query, %{tag_reject: tag_reject}) - when is_list(tag_reject) do + defp restrict_embedded_tag_reject_any(query, %{tag_reject: [_ | _] = tag_reject}) do from( [_activity, object] in query, where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) @@ -722,86 +721,84 @@ defp restrict_embedded_tag_reject_any(query, %{tag_reject: tag_reject}) defp restrict_embedded_tag_reject_any(query, _), do: query - # Groups by all bindings to allow aggregation on hashtags - defp group_by_all_bindings(query) do - # Expecting named bindings: :object, :bookmark, :thread_mute, :report_note - cond do - Enum.count(query.aliases) == 4 -> - from([a, o, b3, b4, b5] in query, group_by: [a.id, o.id, b3.id, b4.id, b5.id]) - - Enum.count(query.aliases) == 3 -> - from([a, o, b3, b4] in query, group_by: [a.id, o.id, b3.id, b4.id]) - - Enum.count(query.aliases) == 2 -> - from([a, o, b3] in query, group_by: [a.id, o.id, b3.id]) - - true -> - from([a, o] in query, group_by: [a.id, o.id]) - end - end - - defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do + defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_hashtag_reject_any(query, %{tag_reject: tags_reject}) when is_list(tags_reject) do - query - |> group_by_all_bindings() - |> join(:left, [_activity, object], hashtag in assoc(object, :hashtags), as: :hashtag) - |> having( - [hashtag: hashtag], - fragment("not(array_agg(?) && (?))", hashtag.name, ^tags_reject) + defp restrict_hashtag_all(query, %{tag_all: [_ | _] = tags}) do + from( + [_activity, object] in query, + where: + fragment( + """ + (SELECT array_agg(hashtags.name) FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ?) @> ? + """, + ^tags, + object.id, + ^tags + ) ) end - defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do - restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) + defp restrict_hashtag_all(query, %{tag_all: tag}) when is_binary(tag) do + restrict_hashtag_any(query, %{tag: tag}) end - defp restrict_hashtag_reject_any(query, _), do: query + defp restrict_hashtag_all(query, _), do: query - defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do + defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_hashtag_all(query, %{tag_all: tags}) when is_list(tags) do - Enum.reduce( - tags, - query, - fn tag, acc -> restrict_hashtag_any(acc, %{tag: tag}) end + defp restrict_hashtag_any(query, %{tag: [_ | _] = tags}) do + from( + [_activity, object] in query, + where: + fragment( + """ + EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ? LIMIT 1) + """, + ^tags, + object.id + ) ) end - defp restrict_hashtag_all(query, %{tag_all: tag}) when is_binary(tag) do - restrict_hashtag_any(query, %{tag: tag}) + defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do + restrict_hashtag_any(query, %{tag: [tag]}) end - defp restrict_hashtag_all(query, _), do: query + defp restrict_hashtag_any(query, _), do: query - defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do + defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_hashtag_any(query, %{tag: tags}) when is_list(tags) do - query = - from( - [_activity, object] in query, - join: hashtag in assoc(object, :hashtags), - where: hashtag.name in ^tags - ) - - if length(tags) > 1 do - distinct(query, [activity], true) - else - query - end + defp restrict_hashtag_reject_any(query, %{tag_reject: [_ | _] = tags_reject}) do + from( + [_activity, object] in query, + where: + fragment( + """ + NOT EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ? LIMIT 1) + """, + ^tags_reject, + object.id + ) + ) end - defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do - restrict_hashtag_any(query, %{tag: [tag]}) + defp restrict_hashtag_reject_any(query, %{tag_reject: tag_reject}) when is_binary(tag_reject) do + restrict_hashtag_reject_any(query, %{tag_reject: [tag_reject]}) end - defp restrict_hashtag_any(query, _), do: query + defp restrict_hashtag_reject_any(query, _), do: query defp raise_on_missing_preload do raise "Can't use the child object without preloading!" diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 5b9fc061e..04fd1def3 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -249,6 +249,17 @@ test "it fetches the appropriate tag-restricted posts" do limit: 2 }) + fetch_six = + ActivityPub.fetch_activities([], %{ + type: "Create", + tag: ["any1", "any2"], + tag_all: [], + tag_reject: [] + }) + + # Regression test: passing empty lists as filter options shouldn't affect the results + assert fetch_five == fetch_six + [fetch_one, fetch_two, fetch_three, fetch_four, fetch_five] = Enum.map([fetch_one, fetch_two, fetch_three, fetch_four, fetch_five], fn statuses -> Enum.map(statuses, fn s -> Repo.preload(s, object: :hashtags) end) -- cgit v1.2.3 From 93e3b8935003ae92bc32311a890e8e4051b41210 Mon Sep 17 00:00:00 2001 From: Lain Soykaf Date: Mon, 1 Feb 2021 10:12:05 +0100 Subject: Update frontend --- priv/static/index.html | 2 +- priv/static/static/js/10.8702741bef65422a8655.js | Bin 0 -> 31550 bytes .../static/js/10.8702741bef65422a8655.js.map | Bin 0 -> 113 bytes priv/static/static/js/10.a11a612e4c1ef51ded17.js | Bin 31550 -> 0 bytes .../static/js/10.a11a612e4c1ef51ded17.js.map | Bin 113 -> 0 bytes priv/static/static/js/11.22872a1f83121e70a148.js | Bin 16124 -> 0 bytes .../static/js/11.22872a1f83121e70a148.js.map | Bin 113 -> 0 bytes priv/static/static/js/11.a3e462fd9190986433f8.js | Bin 0 -> 16124 bytes .../static/js/11.a3e462fd9190986433f8.js.map | Bin 0 -> 113 bytes priv/static/static/js/12.7d5889019e7177d19bc2.js | Bin 0 -> 23834 bytes .../static/js/12.7d5889019e7177d19bc2.js.map | Bin 0 -> 113 bytes priv/static/static/js/12.c6df5166dc6cdcf749e5.js | Bin 23834 -> 0 bytes .../static/js/12.c6df5166dc6cdcf749e5.js.map | Bin 113 -> 0 bytes priv/static/static/js/13.77214c18c6d2a9865281.js | Bin 27059 -> 0 bytes .../static/js/13.77214c18c6d2a9865281.js.map | Bin 113 -> 0 bytes priv/static/static/js/13.bb129366e7d54b5678d4.js | Bin 0 -> 27059 bytes .../static/js/13.bb129366e7d54b5678d4.js.map | Bin 0 -> 113 bytes priv/static/static/js/14.3546063198fc4cb3852c.js | Bin 0 -> 29348 bytes .../static/js/14.3546063198fc4cb3852c.js.map | Bin 0 -> 113 bytes priv/static/static/js/14.e560f5e2f902b9ad2d0d.js | Bin 29348 -> 0 bytes .../static/js/14.e560f5e2f902b9ad2d0d.js.map | Bin 113 -> 0 bytes priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js | Bin 7789 -> 0 bytes .../static/js/15.2893c12f1ca2bcdc3cbf.js.map | Bin 113 -> 0 bytes priv/static/static/js/15.e0cc6ce336f523c26f4d.js | Bin 0 -> 7789 bytes .../static/js/15.e0cc6ce336f523c26f4d.js.map | Bin 0 -> 113 bytes priv/static/static/js/16.67b2bcf7dd3271e31643.js | Bin 0 -> 15802 bytes .../static/js/16.67b2bcf7dd3271e31643.js.map | Bin 0 -> 113 bytes priv/static/static/js/16.be7f4b788716bec25023.js | Bin 15802 -> 0 bytes .../static/js/16.be7f4b788716bec25023.js.map | Bin 113 -> 0 bytes priv/static/static/js/17.4ddba89b4f8c284f6392.js | Bin 2086 -> 0 bytes .../static/js/17.4ddba89b4f8c284f6392.js.map | Bin 113 -> 0 bytes priv/static/static/js/17.a8395e49508cd81ecdf4.js | Bin 0 -> 2086 bytes .../static/js/17.a8395e49508cd81ecdf4.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.1b9a9aedd06803dbb3e4.js | Bin 0 -> 29046 bytes .../static/js/18.1b9a9aedd06803dbb3e4.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.990b88b57bf3a6809098.js | Bin 29064 -> 0 bytes .../static/js/18.990b88b57bf3a6809098.js.map | Bin 113 -> 0 bytes priv/static/static/js/19.783715f17e3f98e8898e.js | Bin 31472 -> 0 bytes .../static/js/19.783715f17e3f98e8898e.js.map | Bin 113 -> 0 bytes priv/static/static/js/19.af8826ed7cd146d80620.js | Bin 0 -> 31472 bytes .../static/js/19.af8826ed7cd146d80620.js.map | Bin 0 -> 113 bytes priv/static/static/js/2.88fa7ac80b2020ac2b46.js | Bin 182214 -> 0 bytes .../static/static/js/2.88fa7ac80b2020ac2b46.js.map | Bin 473015 -> 0 bytes priv/static/static/js/2.cac6da00a889ad330fef.js | Bin 0 -> 182187 bytes .../static/static/js/2.cac6da00a889ad330fef.js.map | Bin 0 -> 472791 bytes priv/static/static/js/20.96c40f6c9db8c08633bd.js | Bin 26280 -> 0 bytes .../static/js/20.96c40f6c9db8c08633bd.js.map | Bin 113 -> 0 bytes priv/static/static/js/20.c45b976fb08603acced8.js | Bin 0 -> 26280 bytes .../static/js/20.c45b976fb08603acced8.js.map | Bin 0 -> 113 bytes priv/static/static/js/21.11c34dd4260444732ab0.js | Bin 0 -> 13162 bytes .../static/js/21.11c34dd4260444732ab0.js.map | Bin 0 -> 113 bytes priv/static/static/js/21.5a9f8e39a7833c1aa117.js | Bin 13162 -> 0 bytes .../static/js/21.5a9f8e39a7833c1aa117.js.map | Bin 113 -> 0 bytes priv/static/static/js/22.6155d82624c0297d5694.js | Bin 0 -> 19706 bytes .../static/js/22.6155d82624c0297d5694.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.d65671b9e5e00a0eb625.js | Bin 19706 -> 0 bytes .../static/js/22.d65671b9e5e00a0eb625.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.bf697d60801d277815e0.js | Bin 27669 -> 0 bytes .../static/js/23.bf697d60801d277815e0.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.d89535c0e277447a45a7.js | Bin 0 -> 27669 bytes .../static/js/23.d89535c0e277447a45a7.js.map | Bin 0 -> 113 bytes priv/static/static/js/24.4693bde7d2a49831dbe2.js | Bin 0 -> 18493 bytes .../static/js/24.4693bde7d2a49831dbe2.js.map | Bin 0 -> 113 bytes priv/static/static/js/24.914e51bfcfc620a93c0e.js | Bin 18493 -> 0 bytes .../static/js/24.914e51bfcfc620a93c0e.js.map | Bin 113 -> 0 bytes priv/static/static/js/25.8f7cea2eb70da626b21d.js | Bin 0 -> 29996 bytes .../static/js/25.8f7cea2eb70da626b21d.js.map | Bin 0 -> 113 bytes priv/static/static/js/25.fa8acda1a0ba7de2ab58.js | Bin 29996 -> 0 bytes .../static/js/25.fa8acda1a0ba7de2ab58.js.map | Bin 113 -> 0 bytes priv/static/static/js/26.3f806866a23f516b7e87.js | Bin 0 -> 31123 bytes .../static/js/26.3f806866a23f516b7e87.js.map | Bin 0 -> 113 bytes priv/static/static/js/26.5233739c17e00ab514f7.js | Bin 14249 -> 0 bytes .../static/js/26.5233739c17e00ab514f7.js.map | Bin 113 -> 0 bytes priv/static/static/js/27.2d655ddddf874f532191.js | Bin 0 -> 2022 bytes .../static/js/27.2d655ddddf874f532191.js.map | Bin 0 -> 113 bytes priv/static/static/js/27.79a2337abb067d8a36ce.js | Bin 2022 -> 0 bytes .../static/js/27.79a2337abb067d8a36ce.js.map | Bin 113 -> 0 bytes priv/static/static/js/28.ed355decbad274c26485.js | Bin 35421 -> 0 bytes .../static/js/28.ed355decbad274c26485.js.map | Bin 113 -> 0 bytes priv/static/static/js/28.f738a8b568b00299a569.js | Bin 0 -> 38107 bytes .../static/js/28.f738a8b568b00299a569.js.map | Bin 0 -> 113 bytes priv/static/static/js/29.64d5389501dc6e6c77f2.js | Bin 0 -> 23857 bytes .../static/js/29.64d5389501dc6e6c77f2.js.map | Bin 0 -> 113 bytes priv/static/static/js/29.d3d8f3c066d579644c9a.js | Bin 23857 -> 0 bytes .../static/js/29.d3d8f3c066d579644c9a.js.map | Bin 113 -> 0 bytes priv/static/static/js/3.0b1cb0c49b906b834801.js | Bin 78760 -> 0 bytes .../static/static/js/3.0b1cb0c49b906b834801.js.map | Bin 332972 -> 0 bytes priv/static/static/js/3.91e3846705ce522e8366.js | Bin 0 -> 78760 bytes .../static/static/js/3.91e3846705ce522e8366.js.map | Bin 0 -> 332972 bytes priv/static/static/js/30.04694ca04ca2fb3b9695.js | Bin 44101 -> 0 bytes .../static/js/30.04694ca04ca2fb3b9695.js.map | Bin 113 -> 0 bytes priv/static/static/js/30.d0724c72975d6ce2243c.js | Bin 0 -> 44258 bytes .../static/js/30.d0724c72975d6ce2243c.js.map | Bin 0 -> 113 bytes priv/static/static/js/31.31627923fc0b0d75672f.js | Bin 0 -> 26981 bytes .../static/js/31.31627923fc0b0d75672f.js.map | Bin 0 -> 113 bytes priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js | Bin 26981 -> 0 bytes .../static/js/31.ef44f6a2b08f7f78dd8e.js.map | Bin 113 -> 0 bytes priv/static/static/js/32.044555dd7095261d9faf.js | Bin 25909 -> 0 bytes .../static/js/32.044555dd7095261d9faf.js.map | Bin 113 -> 0 bytes priv/static/static/js/32.f628f72f0c04549e3d56.js | Bin 0 -> 25945 bytes .../static/js/32.f628f72f0c04549e3d56.js.map | Bin 0 -> 113 bytes priv/static/static/js/4.14dd3a6fcb972eb61829.js | Bin 0 -> 2177 bytes .../static/static/js/4.14dd3a6fcb972eb61829.js.map | Bin 0 -> 7940 bytes priv/static/static/js/4.15e71ac865c2606c30a6.js | Bin 2177 -> 0 bytes .../static/static/js/4.15e71ac865c2606c30a6.js.map | Bin 7940 -> 0 bytes priv/static/static/js/5.41ab92595cefc4c72fe0.js | Bin 0 -> 6994 bytes .../static/static/js/5.41ab92595cefc4c72fe0.js.map | Bin 0 -> 112 bytes priv/static/static/js/5.e116ac5b71f5e62029a1.js | Bin 6994 -> 0 bytes .../static/static/js/5.e116ac5b71f5e62029a1.js.map | Bin 112 -> 0 bytes priv/static/static/js/6.22a79587289c1f1e1e99.js | Bin 0 -> 13285 bytes .../static/static/js/6.22a79587289c1f1e1e99.js.map | Bin 0 -> 112 bytes priv/static/static/js/6.4e804674e0bff336a51b.js | Bin 13285 -> 0 bytes .../static/static/js/6.4e804674e0bff336a51b.js.map | Bin 112 -> 0 bytes priv/static/static/js/7.cf211d851ab1c77ec4c3.js | Bin 0 -> 15617 bytes .../static/static/js/7.cf211d851ab1c77ec4c3.js.map | Bin 0 -> 112 bytes priv/static/static/js/7.e8595e0b6e063c6d9478.js | Bin 15617 -> 0 bytes .../static/static/js/7.e8595e0b6e063c6d9478.js.map | Bin 112 -> 0 bytes priv/static/static/js/8.08dd17e532ddcdd39742.js | Bin 0 -> 21604 bytes .../static/static/js/8.08dd17e532ddcdd39742.js.map | Bin 0 -> 112 bytes priv/static/static/js/8.2d08c6fbb6b6ef23752f.js | Bin 21604 -> 0 bytes .../static/static/js/8.2d08c6fbb6b6ef23752f.js.map | Bin 112 -> 0 bytes priv/static/static/js/9.1ea2330cb884e98f8257.js | Bin 0 -> 28695 bytes .../static/static/js/9.1ea2330cb884e98f8257.js.map | Bin 0 -> 112 bytes priv/static/static/js/9.7d9dd95c4a1c9aa47453.js | Bin 28695 -> 0 bytes .../static/static/js/9.7d9dd95c4a1c9aa47453.js.map | Bin 112 -> 0 bytes priv/static/static/js/app.c6b8a1c86149ed63e6ff.js | Bin 0 -> 605657 bytes .../static/js/app.c6b8a1c86149ed63e6ff.js.map | Bin 0 -> 1561726 bytes priv/static/static/js/app.eb8f7164fc75862a251d.js | Bin 605400 -> 0 bytes .../static/js/app.eb8f7164fc75862a251d.js.map | Bin 1560791 -> 0 bytes .../static/js/vendors~app.3b02e2e5bd8cdca42216.js | Bin 0 -> 375540 bytes .../js/vendors~app.3b02e2e5bd8cdca42216.js.map | Bin 0 -> 2277783 bytes .../static/js/vendors~app.54838a79dee084ec3dad.js | Bin 375539 -> 0 bytes .../js/vendors~app.54838a79dee084ec3dad.js.map | Bin 2277783 -> 0 bytes priv/static/sw-pleroma.js | Bin 184690 -> 184816 bytes priv/static/sw-pleroma.js.map | Bin 714735 -> 714735 bytes 135 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 priv/static/static/js/10.8702741bef65422a8655.js create mode 100644 priv/static/static/js/10.8702741bef65422a8655.js.map delete mode 100644 priv/static/static/js/10.a11a612e4c1ef51ded17.js delete mode 100644 priv/static/static/js/10.a11a612e4c1ef51ded17.js.map delete mode 100644 priv/static/static/js/11.22872a1f83121e70a148.js delete mode 100644 priv/static/static/js/11.22872a1f83121e70a148.js.map create mode 100644 priv/static/static/js/11.a3e462fd9190986433f8.js create mode 100644 priv/static/static/js/11.a3e462fd9190986433f8.js.map create mode 100644 priv/static/static/js/12.7d5889019e7177d19bc2.js create mode 100644 priv/static/static/js/12.7d5889019e7177d19bc2.js.map delete mode 100644 priv/static/static/js/12.c6df5166dc6cdcf749e5.js delete mode 100644 priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map delete mode 100644 priv/static/static/js/13.77214c18c6d2a9865281.js delete mode 100644 priv/static/static/js/13.77214c18c6d2a9865281.js.map create mode 100644 priv/static/static/js/13.bb129366e7d54b5678d4.js create mode 100644 priv/static/static/js/13.bb129366e7d54b5678d4.js.map create mode 100644 priv/static/static/js/14.3546063198fc4cb3852c.js create mode 100644 priv/static/static/js/14.3546063198fc4cb3852c.js.map delete mode 100644 priv/static/static/js/14.e560f5e2f902b9ad2d0d.js delete mode 100644 priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map delete mode 100644 priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js delete mode 100644 priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map create mode 100644 priv/static/static/js/15.e0cc6ce336f523c26f4d.js create mode 100644 priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map create mode 100644 priv/static/static/js/16.67b2bcf7dd3271e31643.js create mode 100644 priv/static/static/js/16.67b2bcf7dd3271e31643.js.map delete mode 100644 priv/static/static/js/16.be7f4b788716bec25023.js delete mode 100644 priv/static/static/js/16.be7f4b788716bec25023.js.map delete mode 100644 priv/static/static/js/17.4ddba89b4f8c284f6392.js delete mode 100644 priv/static/static/js/17.4ddba89b4f8c284f6392.js.map create mode 100644 priv/static/static/js/17.a8395e49508cd81ecdf4.js create mode 100644 priv/static/static/js/17.a8395e49508cd81ecdf4.js.map create mode 100644 priv/static/static/js/18.1b9a9aedd06803dbb3e4.js create mode 100644 priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map delete mode 100644 priv/static/static/js/18.990b88b57bf3a6809098.js delete mode 100644 priv/static/static/js/18.990b88b57bf3a6809098.js.map delete mode 100644 priv/static/static/js/19.783715f17e3f98e8898e.js delete mode 100644 priv/static/static/js/19.783715f17e3f98e8898e.js.map create mode 100644 priv/static/static/js/19.af8826ed7cd146d80620.js create mode 100644 priv/static/static/js/19.af8826ed7cd146d80620.js.map delete mode 100644 priv/static/static/js/2.88fa7ac80b2020ac2b46.js delete mode 100644 priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map create mode 100644 priv/static/static/js/2.cac6da00a889ad330fef.js create mode 100644 priv/static/static/js/2.cac6da00a889ad330fef.js.map delete mode 100644 priv/static/static/js/20.96c40f6c9db8c08633bd.js delete mode 100644 priv/static/static/js/20.96c40f6c9db8c08633bd.js.map create mode 100644 priv/static/static/js/20.c45b976fb08603acced8.js create mode 100644 priv/static/static/js/20.c45b976fb08603acced8.js.map create mode 100644 priv/static/static/js/21.11c34dd4260444732ab0.js create mode 100644 priv/static/static/js/21.11c34dd4260444732ab0.js.map delete mode 100644 priv/static/static/js/21.5a9f8e39a7833c1aa117.js delete mode 100644 priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map create mode 100644 priv/static/static/js/22.6155d82624c0297d5694.js create mode 100644 priv/static/static/js/22.6155d82624c0297d5694.js.map delete mode 100644 priv/static/static/js/22.d65671b9e5e00a0eb625.js delete mode 100644 priv/static/static/js/22.d65671b9e5e00a0eb625.js.map delete mode 100644 priv/static/static/js/23.bf697d60801d277815e0.js delete mode 100644 priv/static/static/js/23.bf697d60801d277815e0.js.map create mode 100644 priv/static/static/js/23.d89535c0e277447a45a7.js create mode 100644 priv/static/static/js/23.d89535c0e277447a45a7.js.map create mode 100644 priv/static/static/js/24.4693bde7d2a49831dbe2.js create mode 100644 priv/static/static/js/24.4693bde7d2a49831dbe2.js.map delete mode 100644 priv/static/static/js/24.914e51bfcfc620a93c0e.js delete mode 100644 priv/static/static/js/24.914e51bfcfc620a93c0e.js.map create mode 100644 priv/static/static/js/25.8f7cea2eb70da626b21d.js create mode 100644 priv/static/static/js/25.8f7cea2eb70da626b21d.js.map delete mode 100644 priv/static/static/js/25.fa8acda1a0ba7de2ab58.js delete mode 100644 priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map create mode 100644 priv/static/static/js/26.3f806866a23f516b7e87.js create mode 100644 priv/static/static/js/26.3f806866a23f516b7e87.js.map delete mode 100644 priv/static/static/js/26.5233739c17e00ab514f7.js delete mode 100644 priv/static/static/js/26.5233739c17e00ab514f7.js.map create mode 100644 priv/static/static/js/27.2d655ddddf874f532191.js create mode 100644 priv/static/static/js/27.2d655ddddf874f532191.js.map delete mode 100644 priv/static/static/js/27.79a2337abb067d8a36ce.js delete mode 100644 priv/static/static/js/27.79a2337abb067d8a36ce.js.map delete mode 100644 priv/static/static/js/28.ed355decbad274c26485.js delete mode 100644 priv/static/static/js/28.ed355decbad274c26485.js.map create mode 100644 priv/static/static/js/28.f738a8b568b00299a569.js create mode 100644 priv/static/static/js/28.f738a8b568b00299a569.js.map create mode 100644 priv/static/static/js/29.64d5389501dc6e6c77f2.js create mode 100644 priv/static/static/js/29.64d5389501dc6e6c77f2.js.map delete mode 100644 priv/static/static/js/29.d3d8f3c066d579644c9a.js delete mode 100644 priv/static/static/js/29.d3d8f3c066d579644c9a.js.map delete mode 100644 priv/static/static/js/3.0b1cb0c49b906b834801.js delete mode 100644 priv/static/static/js/3.0b1cb0c49b906b834801.js.map create mode 100644 priv/static/static/js/3.91e3846705ce522e8366.js create mode 100644 priv/static/static/js/3.91e3846705ce522e8366.js.map delete mode 100644 priv/static/static/js/30.04694ca04ca2fb3b9695.js delete mode 100644 priv/static/static/js/30.04694ca04ca2fb3b9695.js.map create mode 100644 priv/static/static/js/30.d0724c72975d6ce2243c.js create mode 100644 priv/static/static/js/30.d0724c72975d6ce2243c.js.map create mode 100644 priv/static/static/js/31.31627923fc0b0d75672f.js create mode 100644 priv/static/static/js/31.31627923fc0b0d75672f.js.map delete mode 100644 priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js delete mode 100644 priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map delete mode 100644 priv/static/static/js/32.044555dd7095261d9faf.js delete mode 100644 priv/static/static/js/32.044555dd7095261d9faf.js.map create mode 100644 priv/static/static/js/32.f628f72f0c04549e3d56.js create mode 100644 priv/static/static/js/32.f628f72f0c04549e3d56.js.map create mode 100644 priv/static/static/js/4.14dd3a6fcb972eb61829.js create mode 100644 priv/static/static/js/4.14dd3a6fcb972eb61829.js.map delete mode 100644 priv/static/static/js/4.15e71ac865c2606c30a6.js delete mode 100644 priv/static/static/js/4.15e71ac865c2606c30a6.js.map create mode 100644 priv/static/static/js/5.41ab92595cefc4c72fe0.js create mode 100644 priv/static/static/js/5.41ab92595cefc4c72fe0.js.map delete mode 100644 priv/static/static/js/5.e116ac5b71f5e62029a1.js delete mode 100644 priv/static/static/js/5.e116ac5b71f5e62029a1.js.map create mode 100644 priv/static/static/js/6.22a79587289c1f1e1e99.js create mode 100644 priv/static/static/js/6.22a79587289c1f1e1e99.js.map delete mode 100644 priv/static/static/js/6.4e804674e0bff336a51b.js delete mode 100644 priv/static/static/js/6.4e804674e0bff336a51b.js.map create mode 100644 priv/static/static/js/7.cf211d851ab1c77ec4c3.js create mode 100644 priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map delete mode 100644 priv/static/static/js/7.e8595e0b6e063c6d9478.js delete mode 100644 priv/static/static/js/7.e8595e0b6e063c6d9478.js.map create mode 100644 priv/static/static/js/8.08dd17e532ddcdd39742.js create mode 100644 priv/static/static/js/8.08dd17e532ddcdd39742.js.map delete mode 100644 priv/static/static/js/8.2d08c6fbb6b6ef23752f.js delete mode 100644 priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map create mode 100644 priv/static/static/js/9.1ea2330cb884e98f8257.js create mode 100644 priv/static/static/js/9.1ea2330cb884e98f8257.js.map delete mode 100644 priv/static/static/js/9.7d9dd95c4a1c9aa47453.js delete mode 100644 priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map create mode 100644 priv/static/static/js/app.c6b8a1c86149ed63e6ff.js create mode 100644 priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map delete mode 100644 priv/static/static/js/app.eb8f7164fc75862a251d.js delete mode 100644 priv/static/static/js/app.eb8f7164fc75862a251d.js.map create mode 100644 priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js create mode 100644 priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map delete mode 100644 priv/static/static/js/vendors~app.54838a79dee084ec3dad.js delete mode 100644 priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map diff --git a/priv/static/index.html b/priv/static/index.html index c4dcf5d37..79d67c4c2 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/priv/static/static/js/10.8702741bef65422a8655.js b/priv/static/static/js/10.8702741bef65422a8655.js new file mode 100644 index 000000000..0a0795bcd Binary files /dev/null and b/priv/static/static/js/10.8702741bef65422a8655.js differ diff --git a/priv/static/static/js/10.8702741bef65422a8655.js.map b/priv/static/static/js/10.8702741bef65422a8655.js.map new file mode 100644 index 000000000..cb936cec1 Binary files /dev/null and b/priv/static/static/js/10.8702741bef65422a8655.js.map differ diff --git a/priv/static/static/js/10.a11a612e4c1ef51ded17.js b/priv/static/static/js/10.a11a612e4c1ef51ded17.js deleted file mode 100644 index 2a1ffcc2b..000000000 Binary files a/priv/static/static/js/10.a11a612e4c1ef51ded17.js and /dev/null differ diff --git a/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map b/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map deleted file mode 100644 index fd81b28be..000000000 Binary files a/priv/static/static/js/10.a11a612e4c1ef51ded17.js.map and /dev/null differ diff --git a/priv/static/static/js/11.22872a1f83121e70a148.js b/priv/static/static/js/11.22872a1f83121e70a148.js deleted file mode 100644 index a2e9cee51..000000000 Binary files a/priv/static/static/js/11.22872a1f83121e70a148.js and /dev/null differ diff --git a/priv/static/static/js/11.22872a1f83121e70a148.js.map b/priv/static/static/js/11.22872a1f83121e70a148.js.map deleted file mode 100644 index 6467c58a5..000000000 Binary files a/priv/static/static/js/11.22872a1f83121e70a148.js.map and /dev/null differ diff --git a/priv/static/static/js/11.a3e462fd9190986433f8.js b/priv/static/static/js/11.a3e462fd9190986433f8.js new file mode 100644 index 000000000..6b49bb02d Binary files /dev/null and b/priv/static/static/js/11.a3e462fd9190986433f8.js differ diff --git a/priv/static/static/js/11.a3e462fd9190986433f8.js.map b/priv/static/static/js/11.a3e462fd9190986433f8.js.map new file mode 100644 index 000000000..496d6a6f1 Binary files /dev/null and b/priv/static/static/js/11.a3e462fd9190986433f8.js.map differ diff --git a/priv/static/static/js/12.7d5889019e7177d19bc2.js b/priv/static/static/js/12.7d5889019e7177d19bc2.js new file mode 100644 index 000000000..6dc87809f Binary files /dev/null and b/priv/static/static/js/12.7d5889019e7177d19bc2.js differ diff --git a/priv/static/static/js/12.7d5889019e7177d19bc2.js.map b/priv/static/static/js/12.7d5889019e7177d19bc2.js.map new file mode 100644 index 000000000..cf9631696 Binary files /dev/null and b/priv/static/static/js/12.7d5889019e7177d19bc2.js.map differ diff --git a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js deleted file mode 100644 index 441071f37..000000000 Binary files a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js and /dev/null differ diff --git a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map b/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map deleted file mode 100644 index c0bac6f0f..000000000 Binary files a/priv/static/static/js/12.c6df5166dc6cdcf749e5.js.map and /dev/null differ diff --git a/priv/static/static/js/13.77214c18c6d2a9865281.js b/priv/static/static/js/13.77214c18c6d2a9865281.js deleted file mode 100644 index 08e356de2..000000000 Binary files a/priv/static/static/js/13.77214c18c6d2a9865281.js and /dev/null differ diff --git a/priv/static/static/js/13.77214c18c6d2a9865281.js.map b/priv/static/static/js/13.77214c18c6d2a9865281.js.map deleted file mode 100644 index 3d7abf273..000000000 Binary files a/priv/static/static/js/13.77214c18c6d2a9865281.js.map and /dev/null differ diff --git a/priv/static/static/js/13.bb129366e7d54b5678d4.js b/priv/static/static/js/13.bb129366e7d54b5678d4.js new file mode 100644 index 000000000..8c73a0022 Binary files /dev/null and b/priv/static/static/js/13.bb129366e7d54b5678d4.js differ diff --git a/priv/static/static/js/13.bb129366e7d54b5678d4.js.map b/priv/static/static/js/13.bb129366e7d54b5678d4.js.map new file mode 100644 index 000000000..b5a0af8a3 Binary files /dev/null and b/priv/static/static/js/13.bb129366e7d54b5678d4.js.map differ diff --git a/priv/static/static/js/14.3546063198fc4cb3852c.js b/priv/static/static/js/14.3546063198fc4cb3852c.js new file mode 100644 index 000000000..8897a50ce Binary files /dev/null and b/priv/static/static/js/14.3546063198fc4cb3852c.js differ diff --git a/priv/static/static/js/14.3546063198fc4cb3852c.js.map b/priv/static/static/js/14.3546063198fc4cb3852c.js.map new file mode 100644 index 000000000..e7596b961 Binary files /dev/null and b/priv/static/static/js/14.3546063198fc4cb3852c.js.map differ diff --git a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js deleted file mode 100644 index d2d291725..000000000 Binary files a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js and /dev/null differ diff --git a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map b/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map deleted file mode 100644 index f9797f1b6..000000000 Binary files a/priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map and /dev/null differ diff --git a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js deleted file mode 100644 index 82318f797..000000000 Binary files a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js and /dev/null differ diff --git a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map b/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map deleted file mode 100644 index 00cab138d..000000000 Binary files a/priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map and /dev/null differ diff --git a/priv/static/static/js/15.e0cc6ce336f523c26f4d.js b/priv/static/static/js/15.e0cc6ce336f523c26f4d.js new file mode 100644 index 000000000..ec162d862 Binary files /dev/null and b/priv/static/static/js/15.e0cc6ce336f523c26f4d.js differ diff --git a/priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map b/priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map new file mode 100644 index 000000000..d6ec98aaf Binary files /dev/null and b/priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map differ diff --git a/priv/static/static/js/16.67b2bcf7dd3271e31643.js b/priv/static/static/js/16.67b2bcf7dd3271e31643.js new file mode 100644 index 000000000..b4f1fcb57 Binary files /dev/null and b/priv/static/static/js/16.67b2bcf7dd3271e31643.js differ diff --git a/priv/static/static/js/16.67b2bcf7dd3271e31643.js.map b/priv/static/static/js/16.67b2bcf7dd3271e31643.js.map new file mode 100644 index 000000000..31f00875c Binary files /dev/null and b/priv/static/static/js/16.67b2bcf7dd3271e31643.js.map differ diff --git a/priv/static/static/js/16.be7f4b788716bec25023.js b/priv/static/static/js/16.be7f4b788716bec25023.js deleted file mode 100644 index ea5b554f1..000000000 Binary files a/priv/static/static/js/16.be7f4b788716bec25023.js and /dev/null differ diff --git a/priv/static/static/js/16.be7f4b788716bec25023.js.map b/priv/static/static/js/16.be7f4b788716bec25023.js.map deleted file mode 100644 index 121a49be1..000000000 Binary files a/priv/static/static/js/16.be7f4b788716bec25023.js.map and /dev/null differ diff --git a/priv/static/static/js/17.4ddba89b4f8c284f6392.js b/priv/static/static/js/17.4ddba89b4f8c284f6392.js deleted file mode 100644 index 39283f245..000000000 Binary files a/priv/static/static/js/17.4ddba89b4f8c284f6392.js and /dev/null differ diff --git a/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map b/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map deleted file mode 100644 index 322db8c6b..000000000 Binary files a/priv/static/static/js/17.4ddba89b4f8c284f6392.js.map and /dev/null differ diff --git a/priv/static/static/js/17.a8395e49508cd81ecdf4.js b/priv/static/static/js/17.a8395e49508cd81ecdf4.js new file mode 100644 index 000000000..0b90485ff Binary files /dev/null and b/priv/static/static/js/17.a8395e49508cd81ecdf4.js differ diff --git a/priv/static/static/js/17.a8395e49508cd81ecdf4.js.map b/priv/static/static/js/17.a8395e49508cd81ecdf4.js.map new file mode 100644 index 000000000..33b1c8e34 Binary files /dev/null and b/priv/static/static/js/17.a8395e49508cd81ecdf4.js.map differ diff --git a/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js b/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js new file mode 100644 index 000000000..621616a3f Binary files /dev/null and b/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js differ diff --git a/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map b/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map new file mode 100644 index 000000000..46f4d2a0c Binary files /dev/null and b/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map differ diff --git a/priv/static/static/js/18.990b88b57bf3a6809098.js b/priv/static/static/js/18.990b88b57bf3a6809098.js deleted file mode 100644 index 96de50c61..000000000 Binary files a/priv/static/static/js/18.990b88b57bf3a6809098.js and /dev/null differ diff --git a/priv/static/static/js/18.990b88b57bf3a6809098.js.map b/priv/static/static/js/18.990b88b57bf3a6809098.js.map deleted file mode 100644 index b0fb3b629..000000000 Binary files a/priv/static/static/js/18.990b88b57bf3a6809098.js.map and /dev/null differ diff --git a/priv/static/static/js/19.783715f17e3f98e8898e.js b/priv/static/static/js/19.783715f17e3f98e8898e.js deleted file mode 100644 index bf4fd22fd..000000000 Binary files a/priv/static/static/js/19.783715f17e3f98e8898e.js and /dev/null differ diff --git a/priv/static/static/js/19.783715f17e3f98e8898e.js.map b/priv/static/static/js/19.783715f17e3f98e8898e.js.map deleted file mode 100644 index d3bd148d5..000000000 Binary files a/priv/static/static/js/19.783715f17e3f98e8898e.js.map and /dev/null differ diff --git a/priv/static/static/js/19.af8826ed7cd146d80620.js b/priv/static/static/js/19.af8826ed7cd146d80620.js new file mode 100644 index 000000000..d941e222e Binary files /dev/null and b/priv/static/static/js/19.af8826ed7cd146d80620.js differ diff --git a/priv/static/static/js/19.af8826ed7cd146d80620.js.map b/priv/static/static/js/19.af8826ed7cd146d80620.js.map new file mode 100644 index 000000000..886699ead Binary files /dev/null and b/priv/static/static/js/19.af8826ed7cd146d80620.js.map differ diff --git a/priv/static/static/js/2.88fa7ac80b2020ac2b46.js b/priv/static/static/js/2.88fa7ac80b2020ac2b46.js deleted file mode 100644 index b2c2eeb25..000000000 Binary files a/priv/static/static/js/2.88fa7ac80b2020ac2b46.js and /dev/null differ diff --git a/priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map b/priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map deleted file mode 100644 index f6aafd426..000000000 Binary files a/priv/static/static/js/2.88fa7ac80b2020ac2b46.js.map and /dev/null differ diff --git a/priv/static/static/js/2.cac6da00a889ad330fef.js b/priv/static/static/js/2.cac6da00a889ad330fef.js new file mode 100644 index 000000000..0e34c12d2 Binary files /dev/null and b/priv/static/static/js/2.cac6da00a889ad330fef.js differ diff --git a/priv/static/static/js/2.cac6da00a889ad330fef.js.map b/priv/static/static/js/2.cac6da00a889ad330fef.js.map new file mode 100644 index 000000000..05f611b86 Binary files /dev/null and b/priv/static/static/js/2.cac6da00a889ad330fef.js.map differ diff --git a/priv/static/static/js/20.96c40f6c9db8c08633bd.js b/priv/static/static/js/20.96c40f6c9db8c08633bd.js deleted file mode 100644 index a3b3d7894..000000000 Binary files a/priv/static/static/js/20.96c40f6c9db8c08633bd.js and /dev/null differ diff --git a/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map b/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map deleted file mode 100644 index d7d40ed07..000000000 Binary files a/priv/static/static/js/20.96c40f6c9db8c08633bd.js.map and /dev/null differ diff --git a/priv/static/static/js/20.c45b976fb08603acced8.js b/priv/static/static/js/20.c45b976fb08603acced8.js new file mode 100644 index 000000000..6012aebb1 Binary files /dev/null and b/priv/static/static/js/20.c45b976fb08603acced8.js differ diff --git a/priv/static/static/js/20.c45b976fb08603acced8.js.map b/priv/static/static/js/20.c45b976fb08603acced8.js.map new file mode 100644 index 000000000..c0cc39285 Binary files /dev/null and b/priv/static/static/js/20.c45b976fb08603acced8.js.map differ diff --git a/priv/static/static/js/21.11c34dd4260444732ab0.js b/priv/static/static/js/21.11c34dd4260444732ab0.js new file mode 100644 index 000000000..b5b0d7403 Binary files /dev/null and b/priv/static/static/js/21.11c34dd4260444732ab0.js differ diff --git a/priv/static/static/js/21.11c34dd4260444732ab0.js.map b/priv/static/static/js/21.11c34dd4260444732ab0.js.map new file mode 100644 index 000000000..11b0f1cdb Binary files /dev/null and b/priv/static/static/js/21.11c34dd4260444732ab0.js.map differ diff --git a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js deleted file mode 100644 index 4114db7db..000000000 Binary files a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js and /dev/null differ diff --git a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map b/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map deleted file mode 100644 index 898948286..000000000 Binary files a/priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map and /dev/null differ diff --git a/priv/static/static/js/22.6155d82624c0297d5694.js b/priv/static/static/js/22.6155d82624c0297d5694.js new file mode 100644 index 000000000..7054f1a7c Binary files /dev/null and b/priv/static/static/js/22.6155d82624c0297d5694.js differ diff --git a/priv/static/static/js/22.6155d82624c0297d5694.js.map b/priv/static/static/js/22.6155d82624c0297d5694.js.map new file mode 100644 index 000000000..721b74faf Binary files /dev/null and b/priv/static/static/js/22.6155d82624c0297d5694.js.map differ diff --git a/priv/static/static/js/22.d65671b9e5e00a0eb625.js b/priv/static/static/js/22.d65671b9e5e00a0eb625.js deleted file mode 100644 index 3748a53b2..000000000 Binary files a/priv/static/static/js/22.d65671b9e5e00a0eb625.js and /dev/null differ diff --git a/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map b/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map deleted file mode 100644 index 110cadd41..000000000 Binary files a/priv/static/static/js/22.d65671b9e5e00a0eb625.js.map and /dev/null differ diff --git a/priv/static/static/js/23.bf697d60801d277815e0.js b/priv/static/static/js/23.bf697d60801d277815e0.js deleted file mode 100644 index e61cf01d7..000000000 Binary files a/priv/static/static/js/23.bf697d60801d277815e0.js and /dev/null differ diff --git a/priv/static/static/js/23.bf697d60801d277815e0.js.map b/priv/static/static/js/23.bf697d60801d277815e0.js.map deleted file mode 100644 index 20c74e93b..000000000 Binary files a/priv/static/static/js/23.bf697d60801d277815e0.js.map and /dev/null differ diff --git a/priv/static/static/js/23.d89535c0e277447a45a7.js b/priv/static/static/js/23.d89535c0e277447a45a7.js new file mode 100644 index 000000000..8979bc0fe Binary files /dev/null and b/priv/static/static/js/23.d89535c0e277447a45a7.js differ diff --git a/priv/static/static/js/23.d89535c0e277447a45a7.js.map b/priv/static/static/js/23.d89535c0e277447a45a7.js.map new file mode 100644 index 000000000..336c6ecd4 Binary files /dev/null and b/priv/static/static/js/23.d89535c0e277447a45a7.js.map differ diff --git a/priv/static/static/js/24.4693bde7d2a49831dbe2.js b/priv/static/static/js/24.4693bde7d2a49831dbe2.js new file mode 100644 index 000000000..7faf73baa Binary files /dev/null and b/priv/static/static/js/24.4693bde7d2a49831dbe2.js differ diff --git a/priv/static/static/js/24.4693bde7d2a49831dbe2.js.map b/priv/static/static/js/24.4693bde7d2a49831dbe2.js.map new file mode 100644 index 000000000..1b2573a33 Binary files /dev/null and b/priv/static/static/js/24.4693bde7d2a49831dbe2.js.map differ diff --git a/priv/static/static/js/24.914e51bfcfc620a93c0e.js b/priv/static/static/js/24.914e51bfcfc620a93c0e.js deleted file mode 100644 index abdad101e..000000000 Binary files a/priv/static/static/js/24.914e51bfcfc620a93c0e.js and /dev/null differ diff --git a/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map b/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map deleted file mode 100644 index 1ddfced9a..000000000 Binary files a/priv/static/static/js/24.914e51bfcfc620a93c0e.js.map and /dev/null differ diff --git a/priv/static/static/js/25.8f7cea2eb70da626b21d.js b/priv/static/static/js/25.8f7cea2eb70da626b21d.js new file mode 100644 index 000000000..726304c49 Binary files /dev/null and b/priv/static/static/js/25.8f7cea2eb70da626b21d.js differ diff --git a/priv/static/static/js/25.8f7cea2eb70da626b21d.js.map b/priv/static/static/js/25.8f7cea2eb70da626b21d.js.map new file mode 100644 index 000000000..c8e52eac5 Binary files /dev/null and b/priv/static/static/js/25.8f7cea2eb70da626b21d.js.map differ diff --git a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js deleted file mode 100644 index 719148fcd..000000000 Binary files a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js and /dev/null differ diff --git a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map b/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map deleted file mode 100644 index ec5910108..000000000 Binary files a/priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map and /dev/null differ diff --git a/priv/static/static/js/26.3f806866a23f516b7e87.js b/priv/static/static/js/26.3f806866a23f516b7e87.js new file mode 100644 index 000000000..48273248b Binary files /dev/null and b/priv/static/static/js/26.3f806866a23f516b7e87.js differ diff --git a/priv/static/static/js/26.3f806866a23f516b7e87.js.map b/priv/static/static/js/26.3f806866a23f516b7e87.js.map new file mode 100644 index 000000000..68cc924a8 Binary files /dev/null and b/priv/static/static/js/26.3f806866a23f516b7e87.js.map differ diff --git a/priv/static/static/js/26.5233739c17e00ab514f7.js b/priv/static/static/js/26.5233739c17e00ab514f7.js deleted file mode 100644 index 9adba8a0c..000000000 Binary files a/priv/static/static/js/26.5233739c17e00ab514f7.js and /dev/null differ diff --git a/priv/static/static/js/26.5233739c17e00ab514f7.js.map b/priv/static/static/js/26.5233739c17e00ab514f7.js.map deleted file mode 100644 index 9aad55492..000000000 Binary files a/priv/static/static/js/26.5233739c17e00ab514f7.js.map and /dev/null differ diff --git a/priv/static/static/js/27.2d655ddddf874f532191.js b/priv/static/static/js/27.2d655ddddf874f532191.js new file mode 100644 index 000000000..b52d610aa Binary files /dev/null and b/priv/static/static/js/27.2d655ddddf874f532191.js differ diff --git a/priv/static/static/js/27.2d655ddddf874f532191.js.map b/priv/static/static/js/27.2d655ddddf874f532191.js.map new file mode 100644 index 000000000..0042ffa62 Binary files /dev/null and b/priv/static/static/js/27.2d655ddddf874f532191.js.map differ diff --git a/priv/static/static/js/27.79a2337abb067d8a36ce.js b/priv/static/static/js/27.79a2337abb067d8a36ce.js deleted file mode 100644 index 07b8fbea4..000000000 Binary files a/priv/static/static/js/27.79a2337abb067d8a36ce.js and /dev/null differ diff --git a/priv/static/static/js/27.79a2337abb067d8a36ce.js.map b/priv/static/static/js/27.79a2337abb067d8a36ce.js.map deleted file mode 100644 index a55aeae77..000000000 Binary files a/priv/static/static/js/27.79a2337abb067d8a36ce.js.map and /dev/null differ diff --git a/priv/static/static/js/28.ed355decbad274c26485.js b/priv/static/static/js/28.ed355decbad274c26485.js deleted file mode 100644 index e4cfd3d70..000000000 Binary files a/priv/static/static/js/28.ed355decbad274c26485.js and /dev/null differ diff --git a/priv/static/static/js/28.ed355decbad274c26485.js.map b/priv/static/static/js/28.ed355decbad274c26485.js.map deleted file mode 100644 index 0349f2c68..000000000 Binary files a/priv/static/static/js/28.ed355decbad274c26485.js.map and /dev/null differ diff --git a/priv/static/static/js/28.f738a8b568b00299a569.js b/priv/static/static/js/28.f738a8b568b00299a569.js new file mode 100644 index 000000000..64de7926b Binary files /dev/null and b/priv/static/static/js/28.f738a8b568b00299a569.js differ diff --git a/priv/static/static/js/28.f738a8b568b00299a569.js.map b/priv/static/static/js/28.f738a8b568b00299a569.js.map new file mode 100644 index 000000000..1e1aa98e3 Binary files /dev/null and b/priv/static/static/js/28.f738a8b568b00299a569.js.map differ diff --git a/priv/static/static/js/29.64d5389501dc6e6c77f2.js b/priv/static/static/js/29.64d5389501dc6e6c77f2.js new file mode 100644 index 000000000..6d1246a86 Binary files /dev/null and b/priv/static/static/js/29.64d5389501dc6e6c77f2.js differ diff --git a/priv/static/static/js/29.64d5389501dc6e6c77f2.js.map b/priv/static/static/js/29.64d5389501dc6e6c77f2.js.map new file mode 100644 index 000000000..075022565 Binary files /dev/null and b/priv/static/static/js/29.64d5389501dc6e6c77f2.js.map differ diff --git a/priv/static/static/js/29.d3d8f3c066d579644c9a.js b/priv/static/static/js/29.d3d8f3c066d579644c9a.js deleted file mode 100644 index 8a8a3b51f..000000000 Binary files a/priv/static/static/js/29.d3d8f3c066d579644c9a.js and /dev/null differ diff --git a/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map b/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map deleted file mode 100644 index 0ef69d368..000000000 Binary files a/priv/static/static/js/29.d3d8f3c066d579644c9a.js.map and /dev/null differ diff --git a/priv/static/static/js/3.0b1cb0c49b906b834801.js b/priv/static/static/js/3.0b1cb0c49b906b834801.js deleted file mode 100644 index 5b79d06b1..000000000 Binary files a/priv/static/static/js/3.0b1cb0c49b906b834801.js and /dev/null differ diff --git a/priv/static/static/js/3.0b1cb0c49b906b834801.js.map b/priv/static/static/js/3.0b1cb0c49b906b834801.js.map deleted file mode 100644 index 08e6ffdfe..000000000 Binary files a/priv/static/static/js/3.0b1cb0c49b906b834801.js.map and /dev/null differ diff --git a/priv/static/static/js/3.91e3846705ce522e8366.js b/priv/static/static/js/3.91e3846705ce522e8366.js new file mode 100644 index 000000000..a01c4760a Binary files /dev/null and b/priv/static/static/js/3.91e3846705ce522e8366.js differ diff --git a/priv/static/static/js/3.91e3846705ce522e8366.js.map b/priv/static/static/js/3.91e3846705ce522e8366.js.map new file mode 100644 index 000000000..dba83509c Binary files /dev/null and b/priv/static/static/js/3.91e3846705ce522e8366.js.map differ diff --git a/priv/static/static/js/30.04694ca04ca2fb3b9695.js b/priv/static/static/js/30.04694ca04ca2fb3b9695.js deleted file mode 100644 index cc60c675d..000000000 Binary files a/priv/static/static/js/30.04694ca04ca2fb3b9695.js and /dev/null differ diff --git a/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map b/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map deleted file mode 100644 index b347f4f84..000000000 Binary files a/priv/static/static/js/30.04694ca04ca2fb3b9695.js.map and /dev/null differ diff --git a/priv/static/static/js/30.d0724c72975d6ce2243c.js b/priv/static/static/js/30.d0724c72975d6ce2243c.js new file mode 100644 index 000000000..04132ef83 Binary files /dev/null and b/priv/static/static/js/30.d0724c72975d6ce2243c.js differ diff --git a/priv/static/static/js/30.d0724c72975d6ce2243c.js.map b/priv/static/static/js/30.d0724c72975d6ce2243c.js.map new file mode 100644 index 000000000..330ad3596 Binary files /dev/null and b/priv/static/static/js/30.d0724c72975d6ce2243c.js.map differ diff --git a/priv/static/static/js/31.31627923fc0b0d75672f.js b/priv/static/static/js/31.31627923fc0b0d75672f.js new file mode 100644 index 000000000..1dfae7798 Binary files /dev/null and b/priv/static/static/js/31.31627923fc0b0d75672f.js differ diff --git a/priv/static/static/js/31.31627923fc0b0d75672f.js.map b/priv/static/static/js/31.31627923fc0b0d75672f.js.map new file mode 100644 index 000000000..52ae7f8af Binary files /dev/null and b/priv/static/static/js/31.31627923fc0b0d75672f.js.map differ diff --git a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js deleted file mode 100644 index 886c184d1..000000000 Binary files a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js and /dev/null differ diff --git a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map b/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map deleted file mode 100644 index 1a4bd1a0a..000000000 Binary files a/priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map and /dev/null differ diff --git a/priv/static/static/js/32.044555dd7095261d9faf.js b/priv/static/static/js/32.044555dd7095261d9faf.js deleted file mode 100644 index 6ca50349e..000000000 Binary files a/priv/static/static/js/32.044555dd7095261d9faf.js and /dev/null differ diff --git a/priv/static/static/js/32.044555dd7095261d9faf.js.map b/priv/static/static/js/32.044555dd7095261d9faf.js.map deleted file mode 100644 index f7f4094ee..000000000 Binary files a/priv/static/static/js/32.044555dd7095261d9faf.js.map and /dev/null differ diff --git a/priv/static/static/js/32.f628f72f0c04549e3d56.js b/priv/static/static/js/32.f628f72f0c04549e3d56.js new file mode 100644 index 000000000..1fd7b588f Binary files /dev/null and b/priv/static/static/js/32.f628f72f0c04549e3d56.js differ diff --git a/priv/static/static/js/32.f628f72f0c04549e3d56.js.map b/priv/static/static/js/32.f628f72f0c04549e3d56.js.map new file mode 100644 index 000000000..8a5717322 Binary files /dev/null and b/priv/static/static/js/32.f628f72f0c04549e3d56.js.map differ diff --git a/priv/static/static/js/4.14dd3a6fcb972eb61829.js b/priv/static/static/js/4.14dd3a6fcb972eb61829.js new file mode 100644 index 000000000..a92d5cc42 Binary files /dev/null and b/priv/static/static/js/4.14dd3a6fcb972eb61829.js differ diff --git a/priv/static/static/js/4.14dd3a6fcb972eb61829.js.map b/priv/static/static/js/4.14dd3a6fcb972eb61829.js.map new file mode 100644 index 000000000..3a5561a41 Binary files /dev/null and b/priv/static/static/js/4.14dd3a6fcb972eb61829.js.map differ diff --git a/priv/static/static/js/4.15e71ac865c2606c30a6.js b/priv/static/static/js/4.15e71ac865c2606c30a6.js deleted file mode 100644 index 3406cc065..000000000 Binary files a/priv/static/static/js/4.15e71ac865c2606c30a6.js and /dev/null differ diff --git a/priv/static/static/js/4.15e71ac865c2606c30a6.js.map b/priv/static/static/js/4.15e71ac865c2606c30a6.js.map deleted file mode 100644 index 023d90430..000000000 Binary files a/priv/static/static/js/4.15e71ac865c2606c30a6.js.map and /dev/null differ diff --git a/priv/static/static/js/5.41ab92595cefc4c72fe0.js b/priv/static/static/js/5.41ab92595cefc4c72fe0.js new file mode 100644 index 000000000..4a7b85b13 Binary files /dev/null and b/priv/static/static/js/5.41ab92595cefc4c72fe0.js differ diff --git a/priv/static/static/js/5.41ab92595cefc4c72fe0.js.map b/priv/static/static/js/5.41ab92595cefc4c72fe0.js.map new file mode 100644 index 000000000..74e16ebfa Binary files /dev/null and b/priv/static/static/js/5.41ab92595cefc4c72fe0.js.map differ diff --git a/priv/static/static/js/5.e116ac5b71f5e62029a1.js b/priv/static/static/js/5.e116ac5b71f5e62029a1.js deleted file mode 100644 index acd64094e..000000000 Binary files a/priv/static/static/js/5.e116ac5b71f5e62029a1.js and /dev/null differ diff --git a/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map b/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map deleted file mode 100644 index 0017a3bfd..000000000 Binary files a/priv/static/static/js/5.e116ac5b71f5e62029a1.js.map and /dev/null differ diff --git a/priv/static/static/js/6.22a79587289c1f1e1e99.js b/priv/static/static/js/6.22a79587289c1f1e1e99.js new file mode 100644 index 000000000..e1b663f59 Binary files /dev/null and b/priv/static/static/js/6.22a79587289c1f1e1e99.js differ diff --git a/priv/static/static/js/6.22a79587289c1f1e1e99.js.map b/priv/static/static/js/6.22a79587289c1f1e1e99.js.map new file mode 100644 index 000000000..aa2f9be2c Binary files /dev/null and b/priv/static/static/js/6.22a79587289c1f1e1e99.js.map differ diff --git a/priv/static/static/js/6.4e804674e0bff336a51b.js b/priv/static/static/js/6.4e804674e0bff336a51b.js deleted file mode 100644 index b33bbd652..000000000 Binary files a/priv/static/static/js/6.4e804674e0bff336a51b.js and /dev/null differ diff --git a/priv/static/static/js/6.4e804674e0bff336a51b.js.map b/priv/static/static/js/6.4e804674e0bff336a51b.js.map deleted file mode 100644 index bbb049a88..000000000 Binary files a/priv/static/static/js/6.4e804674e0bff336a51b.js.map and /dev/null differ diff --git a/priv/static/static/js/7.cf211d851ab1c77ec4c3.js b/priv/static/static/js/7.cf211d851ab1c77ec4c3.js new file mode 100644 index 000000000..c013d64c7 Binary files /dev/null and b/priv/static/static/js/7.cf211d851ab1c77ec4c3.js differ diff --git a/priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map b/priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map new file mode 100644 index 000000000..16461348e Binary files /dev/null and b/priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map differ diff --git a/priv/static/static/js/7.e8595e0b6e063c6d9478.js b/priv/static/static/js/7.e8595e0b6e063c6d9478.js deleted file mode 100644 index 7622e0d7a..000000000 Binary files a/priv/static/static/js/7.e8595e0b6e063c6d9478.js and /dev/null differ diff --git a/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map b/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map deleted file mode 100644 index 40327d1fd..000000000 Binary files a/priv/static/static/js/7.e8595e0b6e063c6d9478.js.map and /dev/null differ diff --git a/priv/static/static/js/8.08dd17e532ddcdd39742.js b/priv/static/static/js/8.08dd17e532ddcdd39742.js new file mode 100644 index 000000000..bf83ae385 Binary files /dev/null and b/priv/static/static/js/8.08dd17e532ddcdd39742.js differ diff --git a/priv/static/static/js/8.08dd17e532ddcdd39742.js.map b/priv/static/static/js/8.08dd17e532ddcdd39742.js.map new file mode 100644 index 000000000..c4c701b5f Binary files /dev/null and b/priv/static/static/js/8.08dd17e532ddcdd39742.js.map differ diff --git a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js deleted file mode 100644 index 085a9e004..000000000 Binary files a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js and /dev/null differ diff --git a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map b/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map deleted file mode 100644 index 50222e2be..000000000 Binary files a/priv/static/static/js/8.2d08c6fbb6b6ef23752f.js.map and /dev/null differ diff --git a/priv/static/static/js/9.1ea2330cb884e98f8257.js b/priv/static/static/js/9.1ea2330cb884e98f8257.js new file mode 100644 index 000000000..35cc53089 Binary files /dev/null and b/priv/static/static/js/9.1ea2330cb884e98f8257.js differ diff --git a/priv/static/static/js/9.1ea2330cb884e98f8257.js.map b/priv/static/static/js/9.1ea2330cb884e98f8257.js.map new file mode 100644 index 000000000..f72847ec6 Binary files /dev/null and b/priv/static/static/js/9.1ea2330cb884e98f8257.js.map differ diff --git a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js deleted file mode 100644 index 41ab62b92..000000000 Binary files a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js and /dev/null differ diff --git a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map b/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map deleted file mode 100644 index c215e9a03..000000000 Binary files a/priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map and /dev/null differ diff --git a/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js b/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js new file mode 100644 index 000000000..83b640a87 Binary files /dev/null and b/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js differ diff --git a/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map b/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map new file mode 100644 index 000000000..742d5229b Binary files /dev/null and b/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map differ diff --git a/priv/static/static/js/app.eb8f7164fc75862a251d.js b/priv/static/static/js/app.eb8f7164fc75862a251d.js deleted file mode 100644 index 55414d124..000000000 Binary files a/priv/static/static/js/app.eb8f7164fc75862a251d.js and /dev/null differ diff --git a/priv/static/static/js/app.eb8f7164fc75862a251d.js.map b/priv/static/static/js/app.eb8f7164fc75862a251d.js.map deleted file mode 100644 index f1dbb68bb..000000000 Binary files a/priv/static/static/js/app.eb8f7164fc75862a251d.js.map and /dev/null differ diff --git a/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js b/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js new file mode 100644 index 000000000..066573a52 Binary files /dev/null and b/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js differ diff --git a/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map b/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map new file mode 100644 index 000000000..72d5e4e8a Binary files /dev/null and b/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map differ diff --git a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js deleted file mode 100644 index 38dd65643..000000000 Binary files a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js and /dev/null differ diff --git a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map b/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map deleted file mode 100644 index 35b5fd52f..000000000 Binary files a/priv/static/static/js/vendors~app.54838a79dee084ec3dad.js.map and /dev/null differ diff --git a/priv/static/sw-pleroma.js b/priv/static/sw-pleroma.js index 25879eb45..6731447d4 100644 Binary files a/priv/static/sw-pleroma.js and b/priv/static/sw-pleroma.js differ diff --git a/priv/static/sw-pleroma.js.map b/priv/static/sw-pleroma.js.map index 62cea8c08..ed747c6d6 100644 Binary files a/priv/static/sw-pleroma.js.map and b/priv/static/sw-pleroma.js.map differ -- cgit v1.2.3 From c3110c46f36c1cdfb1fb30855dfba709373548eb Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 26 Jan 2021 11:58:54 +0300 Subject: expanding filtration for home timeline added local & remote statuses filtration for home timeline --- lib/pleroma/web/activity_pub/activity_pub.ex | 7 ++ .../web/api_spec/operations/timeline_operation.ex | 10 +++ .../controllers/timeline_controller.ex | 2 + .../controllers/timeline_controller_test.exs | 76 ++++++++++++++++++++++ 4 files changed, 95 insertions(+) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index d0bb07aab..58e868119 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -735,6 +735,12 @@ defp restrict_local(query, %{local_only: true}) do defp restrict_local(query, _), do: query + defp restrict_remote(query, %{only_remote: true}) do + from(activity in query, where: activity.local == false) + end + + defp restrict_remote(query, _), do: query + defp restrict_actor(query, %{actor_id: actor_id}) do from(activity in query, where: activity.actor == ^actor_id) end @@ -1111,6 +1117,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> restrict_tag_all(opts) |> restrict_since(opts) |> restrict_local(opts) + |> restrict_remote(opts) |> restrict_actor(opts) |> restrict_type(opts) |> restrict_state(opts) diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index e1ebdab38..2f44cb70d 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -25,6 +25,7 @@ def home_operation do security: [%{"oAuth" => ["read:statuses"]}], parameters: [ local_param(), + remote_param(), with_muted_param(), exclude_visibilities_param(), reply_visibility_param() | pagination_params() @@ -198,4 +199,13 @@ defp only_media_param do "Show only statuses with media attached?" ) end + + defp remote_param do + Operation.parameter( + :only_remote, + :query, + %Schema{allOf: [BooleanLike], default: false}, + "Show only remote statuses?" + ) + end end diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 08e6f23b9..b63945912 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -51,6 +51,8 @@ def home(%{assigns: %{user: user}} = conn, params) do |> Map.put(:reply_filtering_user, user) |> Map.put(:announce_filtering_user, user) |> Map.put(:user, user) + |> Map.put(:local_only, params[:local]) + |> Map.delete(:local) activities = [user.ap_id | User.following(user)] diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 664375fef..30118f74e 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -90,6 +90,82 @@ test "muted emotions", %{user: user, conn: conn} do } ] = result end + + test "local/remote filtering", %{conn: conn, user: user} do + local = insert(:user) + remote = insert(:user, local: false) + + {:ok, user, local} = User.follow(user, local) + {:ok, _user, remote} = User.follow(user, remote) + + object1 = + insert(:note, %{ + data: %{ + "to" => ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(local)] + }, + user: local + }) + + activity1 = + insert(:note_activity, %{ + note: object1, + recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(local)], + user: local + }) + + object2 = + insert(:note, %{ + data: %{ + "to" => ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(remote)] + }, + user: remote + }) + + activity2 = + insert(:note_activity, %{ + note: object2, + recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(remote)], + user: remote, + local: false + }) + + resp1 = + conn + |> get("/api/v1/timelines/home") + |> json_response_and_validate_schema(200) + + without_filter_ids = Enum.map(resp1, & &1["id"]) + + assert activity1.id in without_filter_ids + assert activity2.id in without_filter_ids + + resp2 = + conn + |> get("/api/v1/timelines/home?local=true") + |> json_response_and_validate_schema(200) + + only_local_ids = Enum.map(resp2, & &1["id"]) + + assert activity1.id in only_local_ids + refute activity2.id in only_local_ids + + resp3 = + conn + |> get("/api/v1/timelines/home?only_remote=true") + |> json_response_and_validate_schema(200) + + only_remote_ids = Enum.map(resp3, & &1["id"]) + + refute activity1.id in only_remote_ids + assert activity2.id in only_remote_ids + + resp4 = + conn + |> get("/api/v1/timelines/home?only_remote=true&local=true") + |> json_response_and_validate_schema(200) + + assert resp4 == [] + end end describe "public" do -- cgit v1.2.3 From b6a72680e2a20e30fa4e9dbc3f4f60e4c51dd63f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 26 Jan 2021 14:35:31 +0300 Subject: added only_media flag to home timeline --- .../web/api_spec/operations/timeline_operation.ex | 1 + .../controllers/timeline_controller_test.exs | 60 ++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index 2f44cb70d..7b2fe48a5 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -26,6 +26,7 @@ def home_operation do parameters: [ local_param(), remote_param(), + only_media_param(), with_muted_param(), exclude_visibilities_param(), reply_visibility_param() | pagination_params() diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 30118f74e..d8cc3c9b9 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -166,6 +166,66 @@ test "local/remote filtering", %{conn: conn, user: user} do assert resp4 == [] end + + test "only_media flag", %{conn: conn, user: user} do + other = insert(:user) + {:ok, _, other} = User.follow(user, other) + + without_media = + insert(:note_activity, + user: other, + recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(other)] + ) + + obj = + insert(:note, %{ + data: %{ + "attachment" => [ + %{ + "mediaType" => "image/jpeg", + "name" => "an_image.jpg", + "type" => "Document", + "url" => [ + %{ + "href" => + "http://localhost:4001/media/8270697e-104f-4a54-a7c1-514bb6713f2c/some_image.jpg", + "mediaType" => "image/jpeg", + "type" => "Link" + } + ] + } + ] + }, + user: other + }) + + with_media = + insert(:note_activity, %{ + note: obj, + recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(other)], + user: other + }) + + resp1 = + conn + |> get("/api/v1/timelines/home") + |> json_response_and_validate_schema(200) + + without_filter_ids = Enum.map(resp1, & &1["id"]) + + assert without_media.id in without_filter_ids + assert with_media.id in without_filter_ids + + resp2 = + conn + |> get("/api/v1/timelines/home?only_media=true") + |> json_response_and_validate_schema(200) + + only_media_ids = Enum.map(resp2, & &1["id"]) + + refute without_media.id in only_media_ids + assert with_media.id in only_media_ids + end end describe "public" do -- cgit v1.2.3 From e21af1cfe48779427b6abf815022ebb88b6815d7 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 26 Jan 2021 14:42:03 +0300 Subject: only_media & only_remote docs and changelog --- CHANGELOG.md | 3 ++- docs/development/API/differences_in_mastoapi_responses.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..0d1039be8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,7 +48,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute. - Admin API: An endpoint to manage frontends. - Streaming API: Add follow relationships updates. -- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types +- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types. +- Mastodon API: Added `only_media` & `only_remote` parameters to the home timeline.
### Fixed diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index 84430408b..cb34324ab 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -16,6 +16,10 @@ Adding the parameter `reply_visibility` to the public and home timelines queries Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance). +Adding the parameter `only_media=true` to the home timeline will show only statuses with media attachments. + +Adding the parameter `only_remote=true` to the home timeline will show only remote statuses. + ## Statuses - `visibility`: has additional possible values `list` and `local` (for local-only statuses) -- cgit v1.2.3 From 2cb6dc5a3a3bd7e2326fe632a34b74cb150c5821 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 26 Jan 2021 16:55:44 +0300 Subject: list timeline filtration by params --- .../web/api_spec/operations/timeline_operation.ex | 7 +- .../controllers/timeline_controller.ex | 1 + .../controllers/timeline_controller_test.exs | 182 ++++++++++++--------- test/support/factory.ex | 31 ++++ 4 files changed, 145 insertions(+), 76 deletions(-) diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index 7b2fe48a5..e5bf18d4d 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -25,7 +25,7 @@ def home_operation do security: [%{"oAuth" => ["read:statuses"]}], parameters: [ local_param(), - remote_param(), + only_remote_param(), only_media_param(), with_muted_param(), exclude_visibilities_param(), @@ -134,6 +134,9 @@ def list_operation do required: true ), with_muted_param(), + local_param(), + only_remote_param(), + only_media_param(), exclude_visibilities_param() | pagination_params() ], operationId: "TimelineController.list", @@ -201,7 +204,7 @@ defp only_media_param do ) end - defp remote_param do + defp only_remote_param do Operation.parameter( :only_remote, :query, diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index b63945912..cef299aa4 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -192,6 +192,7 @@ def list(%{assigns: %{user: user}} = conn, %{list_id: id} = params) do |> Map.put(:blocking_user, user) |> Map.put(:user, user) |> Map.put(:muting_user, user) + |> Map.put(:local_only, params[:local]) # we must filter the following list for the user to avoid leaking statuses the user # does not actually have permission to see (for more info, peruse security issue #270). diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index d8cc3c9b9..75a008f4c 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -92,42 +92,13 @@ test "muted emotions", %{user: user, conn: conn} do end test "local/remote filtering", %{conn: conn, user: user} do - local = insert(:user) - remote = insert(:user, local: false) - - {:ok, user, local} = User.follow(user, local) - {:ok, _user, remote} = User.follow(user, remote) - - object1 = - insert(:note, %{ - data: %{ - "to" => ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(local)] - }, - user: local - }) - - activity1 = - insert(:note_activity, %{ - note: object1, - recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(local)], - user: local - }) + local_user = insert(:user) + {:ok, user, local_user} = User.follow(user, local_user) + {:ok, local_activity} = CommonAPI.post(local_user, %{status: "Status"}) - object2 = - insert(:note, %{ - data: %{ - "to" => ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(remote)] - }, - user: remote - }) - - activity2 = - insert(:note_activity, %{ - note: object2, - recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(remote)], - user: remote, - local: false - }) + remote_user = insert(:user, local: false) + {:ok, _user, remote_user} = User.follow(user, remote_user) + remote_activity = create_remote_activity(remote_user) resp1 = conn @@ -136,8 +107,8 @@ test "local/remote filtering", %{conn: conn, user: user} do without_filter_ids = Enum.map(resp1, & &1["id"]) - assert activity1.id in without_filter_ids - assert activity2.id in without_filter_ids + assert local_activity.id in without_filter_ids + assert remote_activity.id in without_filter_ids resp2 = conn @@ -146,8 +117,8 @@ test "local/remote filtering", %{conn: conn, user: user} do only_local_ids = Enum.map(resp2, & &1["id"]) - assert activity1.id in only_local_ids - refute activity2.id in only_local_ids + assert local_activity.id in only_local_ids + refute remote_activity.id in only_local_ids resp3 = conn @@ -156,8 +127,8 @@ test "local/remote filtering", %{conn: conn, user: user} do only_remote_ids = Enum.map(resp3, & &1["id"]) - refute activity1.id in only_remote_ids - assert activity2.id in only_remote_ids + refute local_activity.id in only_remote_ids + assert remote_activity.id in only_remote_ids resp4 = conn @@ -171,40 +142,9 @@ test "only_media flag", %{conn: conn, user: user} do other = insert(:user) {:ok, _, other} = User.follow(user, other) - without_media = - insert(:note_activity, - user: other, - recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(other)] - ) - - obj = - insert(:note, %{ - data: %{ - "attachment" => [ - %{ - "mediaType" => "image/jpeg", - "name" => "an_image.jpg", - "type" => "Document", - "url" => [ - %{ - "href" => - "http://localhost:4001/media/8270697e-104f-4a54-a7c1-514bb6713f2c/some_image.jpg", - "mediaType" => "image/jpeg", - "type" => "Link" - } - ] - } - ] - }, - user: other - }) + {:ok, without_media} = CommonAPI.post(other, %{status: "some status"}) - with_media = - insert(:note_activity, %{ - note: obj, - recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(other)], - user: other - }) + with_media = create_with_media_activity(other) resp1 = conn @@ -680,6 +620,67 @@ test "muted emotions", %{user: user, conn: conn} do } ] = result end + + test "filering with params", %{user: user, conn: conn} do + {:ok, list} = Pleroma.List.create("name", user) + + local_user = insert(:user) + {:ok, local_activity} = CommonAPI.post(local_user, %{status: "Marisa is stupid."}) + with_media = create_with_media_activity(local_user) + {:ok, list} = Pleroma.List.follow(list, local_user) + + remote_user = insert(:user, local: false) + remote_activity = create_remote_activity(remote_user) + {:ok, list} = Pleroma.List.follow(list, remote_user) + + resp1 = + conn |> get("/api/v1/timelines/list/#{list.id}") |> json_response_and_validate_schema(200) + + all_ids = Enum.map(resp1, & &1["id"]) + + assert local_activity.id in all_ids + assert with_media.id in all_ids + assert remote_activity.id in all_ids + + resp2 = + conn + |> get("/api/v1/timelines/list/#{list.id}?local=true") + |> json_response_and_validate_schema(200) + + only_local_ids = Enum.map(resp2, & &1["id"]) + + assert local_activity.id in only_local_ids + assert with_media.id in only_local_ids + refute remote_activity.id in only_local_ids + + resp3 = + conn + |> get("/api/v1/timelines/list/#{list.id}?only_remote=true") + |> json_response_and_validate_schema(200) + + only_remote_ids = Enum.map(resp3, & &1["id"]) + + refute local_activity.id in only_remote_ids + refute with_media.id in only_remote_ids + assert remote_activity.id in only_remote_ids + + resp4 = + conn + |> get("/api/v1/timelines/list/#{list.id}?only_media=true") + |> json_response_and_validate_schema(200) + + only_media_ids = Enum.map(resp4, & &1["id"]) + + refute local_activity.id in only_media_ids + assert with_media.id in only_media_ids + refute remote_activity.id in only_media_ids + + assert conn + |> get( + "/api/v1/timelines/list/#{list.id}?only_media=true&local=true&only_remote=true" + ) + |> json_response_and_validate_schema(200) == [] + end end describe "hashtag" do @@ -862,4 +863,37 @@ test "with `%{local: true, federated: false}`, forbids unauthenticated access to ensure_authenticated_access(base_uri) end end + + defp create_remote_activity(user) do + obj = + insert(:note, %{ + data: %{ + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + User.ap_followers(user) + ] + }, + user: user + }) + + insert(:note_activity, %{ + note: obj, + recipients: [ + "https://www.w3.org/ns/activitystreams#Public", + User.ap_followers(user) + ], + user: user, + local: false + }) + end + + defp create_with_media_activity(user) do + obj = insert(:attachment_note, user: user) + + insert(:note_activity, %{ + note: obj, + recipients: ["https://www.w3.org/ns/activitystreams#Public", User.ap_followers(user)], + user: user + }) + end end diff --git a/test/support/factory.ex b/test/support/factory.ex index bf9592064..436e19409 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -104,6 +104,37 @@ def note_factory(attrs \\ %{}) do } end + def attachment_note_factory(attrs \\ %{}) do + user = attrs[:user] || insert(:user) + {length, attrs} = Map.pop(attrs, :length, 1) + + data = %{ + "attachment" => + Stream.repeatedly(fn -> attachment_data(user.ap_id, attrs[:href]) end) + |> Enum.take(length) + } + + build(:note, Map.put(attrs, :data, data)) + end + + defp attachment_data(ap_id, href) do + href = href || sequence(:href, &"#{Pleroma.Web.Endpoint.url()}/media/#{&1}.jpg") + + %{ + "url" => [ + %{ + "href" => href, + "type" => "Link", + "mediaType" => "image/jpeg" + } + ], + "name" => "some name", + "type" => "Document", + "actor" => ap_id, + "mediaType" => "image/jpeg" + } + end + def audio_factory(attrs \\ %{}) do text = sequence(:text, &"lain radio episode #{&1}") -- cgit v1.2.3 From 77f0a0af7df3ad4cf566a8c68560a09ba6a50cd5 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 26 Jan 2021 17:43:49 +0300 Subject: more tests and update for docs and changelog --- CHANGELOG.md | 2 +- .../API/differences_in_mastoapi_responses.md | 6 +- .../web/api_spec/operations/timeline_operation.ex | 2 + .../controllers/timeline_controller_test.exs | 256 +++++++++++++++------ 4 files changed, 192 insertions(+), 74 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d1039be8..70d2ac0a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Admin API: An endpoint to manage frontends. - Streaming API: Add follow relationships updates. - WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types. -- Mastodon API: Added `only_media` & `only_remote` parameters to the home timeline. +- Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `only_remote` & `local` parameters for filtration.
### Fixed diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index cb34324ab..e9ab896b7 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -16,9 +16,11 @@ Adding the parameter `reply_visibility` to the public and home timelines queries Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance). -Adding the parameter `only_media=true` to the home timeline will show only statuses with media attachments. +Home, public, hashtag & list timelines can filter statuses by accepting these parameters: -Adding the parameter `only_remote=true` to the home timeline will show only remote statuses. +- `only_media`: show only statuses with media attached +- `local`: show only local statuses +- `only_remote`: show only remote statuses ## Statuses diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index e5bf18d4d..52008e27c 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -63,6 +63,7 @@ def public_operation do local_param(), instance_param(), only_media_param(), + only_remote_param(), with_muted_param(), exclude_visibilities_param(), reply_visibility_param() | pagination_params() @@ -109,6 +110,7 @@ def hashtag_operation do ), local_param(), only_media_param(), + only_remote_param(), with_muted_param(), exclude_visibilities_param() | pagination_params() ], diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 75a008f4c..066762748 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -91,110 +91,146 @@ test "muted emotions", %{user: user, conn: conn} do ] = result end - test "local/remote filtering", %{conn: conn, user: user} do + test "filtering", %{conn: conn, user: user} do local_user = insert(:user) {:ok, user, local_user} = User.follow(user, local_user) {:ok, local_activity} = CommonAPI.post(local_user, %{status: "Status"}) + with_media = create_with_media_activity(local_user) remote_user = insert(:user, local: false) {:ok, _user, remote_user} = User.follow(user, remote_user) remote_activity = create_remote_activity(remote_user) - resp1 = + without_filter_ids = conn |> get("/api/v1/timelines/home") |> json_response_and_validate_schema(200) - - without_filter_ids = Enum.map(resp1, & &1["id"]) + |> Enum.map(& &1["id"]) assert local_activity.id in without_filter_ids assert remote_activity.id in without_filter_ids + assert with_media.id in without_filter_ids - resp2 = + only_local_ids = conn |> get("/api/v1/timelines/home?local=true") |> json_response_and_validate_schema(200) - - only_local_ids = Enum.map(resp2, & &1["id"]) + |> Enum.map(& &1["id"]) assert local_activity.id in only_local_ids refute remote_activity.id in only_local_ids + assert with_media.id in only_local_ids - resp3 = + only_local_media_ids = conn - |> get("/api/v1/timelines/home?only_remote=true") + |> get("/api/v1/timelines/home?local=true&only_media=true") |> json_response_and_validate_schema(200) + |> Enum.map(& &1["id"]) - only_remote_ids = Enum.map(resp3, & &1["id"]) + refute local_activity.id in only_local_media_ids + refute remote_activity.id in only_local_media_ids + assert with_media.id in only_local_media_ids + + only_remote_ids = + conn + |> get("/api/v1/timelines/home?only_remote=true") + |> json_response_and_validate_schema(200) + |> Enum.map(& &1["id"]) refute local_activity.id in only_remote_ids assert remote_activity.id in only_remote_ids + refute with_media.id in only_remote_ids - resp4 = - conn - |> get("/api/v1/timelines/home?only_remote=true&local=true") - |> json_response_and_validate_schema(200) + assert conn + |> get("/api/v1/timelines/home?only_remote=true&only_media=true") + |> json_response_and_validate_schema(200) == [] - assert resp4 == [] + assert conn + |> get("/api/v1/timelines/home?only_remote=true&local=true") + |> json_response_and_validate_schema(200) == [] end + end + + describe "public" do + @tag capture_log: true + test "the public timeline", %{conn: conn} do + user = insert(:user) - test "only_media flag", %{conn: conn, user: user} do - other = insert(:user) - {:ok, _, other} = User.follow(user, other) + {:ok, activity} = CommonAPI.post(user, %{status: "test"}) + with_media = create_with_media_activity(user) - {:ok, without_media} = CommonAPI.post(other, %{status: "some status"}) + remote = insert(:note_activity, local: false) - with_media = create_with_media_activity(other) + assert conn + |> get("/api/v1/timelines/public?local=False") + |> json_response_and_validate_schema(:ok) + |> length == 3 - resp1 = + local_ids = conn - |> get("/api/v1/timelines/home") - |> json_response_and_validate_schema(200) - - without_filter_ids = Enum.map(resp1, & &1["id"]) + |> get("/api/v1/timelines/public?local=True") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) - assert without_media.id in without_filter_ids - assert with_media.id in without_filter_ids + assert activity.id in local_ids + assert with_media.id in local_ids + refute remote.id in local_ids - resp2 = + local_ids = conn - |> get("/api/v1/timelines/home?only_media=true") - |> json_response_and_validate_schema(200) + |> get("/api/v1/timelines/public?local=True") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) - only_media_ids = Enum.map(resp2, & &1["id"]) + assert activity.id in local_ids + assert with_media.id in local_ids + refute remote.id in local_ids - refute without_media.id in only_media_ids - assert with_media.id in only_media_ids - end - end - - describe "public" do - @tag capture_log: true - test "the public timeline", %{conn: conn} do - user = insert(:user) + local_ids = + conn + |> get("/api/v1/timelines/public?local=True&only_media=true") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) - {:ok, activity} = CommonAPI.post(user, %{status: "test"}) + refute activity.id in local_ids + assert with_media.id in local_ids + refute remote.id in local_ids - _activity = insert(:note_activity, local: false) + local_ids = + conn + |> get("/api/v1/timelines/public?local=1") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) - conn = get(conn, "/api/v1/timelines/public?local=False") + assert activity.id in local_ids + assert with_media.id in local_ids + refute remote.id in local_ids - assert length(json_response_and_validate_schema(conn, :ok)) == 2 + remote_id = remote.id - conn = get(build_conn(), "/api/v1/timelines/public?local=True") + assert [%{"id" => ^remote_id}] = + conn + |> get("/api/v1/timelines/public?only_remote=true") + |> json_response_and_validate_schema(:ok) - assert [%{"content" => "test"}] = json_response_and_validate_schema(conn, :ok) + with_media_id = with_media.id - conn = get(build_conn(), "/api/v1/timelines/public?local=1") + assert [%{"id" => ^with_media_id}] = + conn + |> get("/api/v1/timelines/public?only_media=true") + |> json_response_and_validate_schema(:ok) - assert [%{"content" => "test"}] = json_response_and_validate_schema(conn, :ok) + assert conn + |> get("/api/v1/timelines/public?only_remote=true&only_media=true") + |> json_response_and_validate_schema(:ok) == [] # does not contain repeats {:ok, _} = CommonAPI.repeat(activity.id, user) - conn = get(build_conn(), "/api/v1/timelines/public?local=true") - - assert [_] = json_response_and_validate_schema(conn, :ok) + assert [_, _] = + conn + |> get("/api/v1/timelines/public?local=true") + |> json_response_and_validate_schema(:ok) end test "the public timeline includes only public statuses for an authenticated user" do @@ -621,7 +657,7 @@ test "muted emotions", %{user: user, conn: conn} do ] = result end - test "filering with params", %{user: user, conn: conn} do + test "filering", %{user: user, conn: conn} do {:ok, list} = Pleroma.List.create("name", user) local_user = insert(:user) @@ -633,43 +669,55 @@ test "filering with params", %{user: user, conn: conn} do remote_activity = create_remote_activity(remote_user) {:ok, list} = Pleroma.List.follow(list, remote_user) - resp1 = - conn |> get("/api/v1/timelines/list/#{list.id}") |> json_response_and_validate_schema(200) - - all_ids = Enum.map(resp1, & &1["id"]) + all_ids = + conn + |> get("/api/v1/timelines/list/#{list.id}") + |> json_response_and_validate_schema(200) + |> Enum.map(& &1["id"]) assert local_activity.id in all_ids assert with_media.id in all_ids assert remote_activity.id in all_ids - resp2 = + only_local_ids = conn |> get("/api/v1/timelines/list/#{list.id}?local=true") |> json_response_and_validate_schema(200) - - only_local_ids = Enum.map(resp2, & &1["id"]) + |> Enum.map(& &1["id"]) assert local_activity.id in only_local_ids assert with_media.id in only_local_ids refute remote_activity.id in only_local_ids - resp3 = + only_local_media_ids = conn - |> get("/api/v1/timelines/list/#{list.id}?only_remote=true") + |> get("/api/v1/timelines/list/#{list.id}?local=true&only_media=true") |> json_response_and_validate_schema(200) + |> Enum.map(& &1["id"]) + + refute local_activity.id in only_local_media_ids + assert with_media.id in only_local_media_ids + refute remote_activity.id in only_local_media_ids - only_remote_ids = Enum.map(resp3, & &1["id"]) + only_remote_ids = + conn + |> get("/api/v1/timelines/list/#{list.id}?only_remote=true") + |> json_response_and_validate_schema(200) + |> Enum.map(& &1["id"]) refute local_activity.id in only_remote_ids refute with_media.id in only_remote_ids assert remote_activity.id in only_remote_ids - resp4 = + assert conn + |> get("/api/v1/timelines/list/#{list.id}?only_remote=true&only_media=true") + |> json_response_and_validate_schema(200) == [] + + only_media_ids = conn |> get("/api/v1/timelines/list/#{list.id}?only_media=true") |> json_response_and_validate_schema(200) - - only_media_ids = Enum.map(resp4, & &1["id"]) + |> Enum.map(& &1["id"]) refute local_activity.id in only_media_ids assert with_media.id in only_media_ids @@ -691,19 +739,85 @@ test "hashtag timeline", %{conn: conn} do following = insert(:user) {:ok, activity} = CommonAPI.post(following, %{status: "test #2hu"}) + with_media = create_with_media_activity(following) - nconn = get(conn, "/api/v1/timelines/tag/2hu") + remote = insert(:user, local: false) + remote_activity = create_remote_activity(remote) - assert [%{"id" => id}] = json_response_and_validate_schema(nconn, :ok) + all_ids = + conn + |> get("/api/v1/timelines/tag/2hu") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) - assert id == to_string(activity.id) + assert activity.id in all_ids + assert with_media.id in all_ids + assert remote_activity.id in all_ids # works for different capitalization too - nconn = get(conn, "/api/v1/timelines/tag/2HU") + all_ids = + conn + |> get("/api/v1/timelines/tag/2HU") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) - assert [%{"id" => id}] = json_response_and_validate_schema(nconn, :ok) + assert activity.id in all_ids + assert with_media.id in all_ids + assert remote_activity.id in all_ids + + local_ids = + conn + |> get("/api/v1/timelines/tag/2hu?local=true") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) + + assert activity.id in local_ids + assert with_media.id in local_ids + refute remote_activity.id in local_ids + + remote_ids = + conn + |> get("/api/v1/timelines/tag/2hu?only_remote=true") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) + + refute activity.id in remote_ids + refute with_media.id in remote_ids + assert remote_activity.id in remote_ids + + media_ids = + conn + |> get("/api/v1/timelines/tag/2hu?only_media=true") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) + + refute activity.id in media_ids + assert with_media.id in media_ids + refute remote_activity.id in media_ids + + media_local_ids = + conn + |> get("/api/v1/timelines/tag/2hu?only_media=true&local=true") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) + + refute activity.id in media_local_ids + assert with_media.id in media_local_ids + refute remote_activity.id in media_local_ids - assert id == to_string(activity.id) + ids = + conn + |> get("/api/v1/timelines/tag/2hu?only_media=true&local=true&only_remote=true") + |> json_response_and_validate_schema(:ok) + |> Enum.map(& &1["id"]) + + refute activity.id in ids + refute with_media.id in ids + refute remote_activity.id in ids + + assert conn + |> get("/api/v1/timelines/tag/2hu?only_media=true&only_remote=true") + |> json_response_and_validate_schema(:ok) == [] end test "multi-hashtag timeline", %{conn: conn} do -- cgit v1.2.3 From ba512cbea42fc0a628d74d5680f0b34c3b1f1b5f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 26 Jan 2021 17:55:43 +0300 Subject: `/api/v1/accounts/:id/statuses` docs update --- docs/development/API/differences_in_mastoapi_responses.md | 12 +++++++++++- lib/pleroma/web/api_spec/operations/account_operation.ex | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index e9ab896b7..7a4979154 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -16,7 +16,7 @@ Adding the parameter `reply_visibility` to the public and home timelines queries Adding the parameter `instance=lain.com` to the public timeline will show only statuses originating from `lain.com` (or any remote instance). -Home, public, hashtag & list timelines can filter statuses by accepting these parameters: +Home, public, hashtag & list timelines accept these parameters: - `only_media`: show only statuses with media attached - `local`: show only local statuses @@ -60,6 +60,16 @@ The `id` parameter can also be the `nickname` of the user. This only works in th - `/api/v1/accounts/:id` - `/api/v1/accounts/:id/statuses` +`/api/v1/accounts/:id/statuses` endpoint accepts these parameters: + +- `pinned`: include only pinned statuses +- `tagged`: with tag +- `only_media`: include only statuses with media attached +- `with_muted`: include statuses/reactions from muted accounts +- `exclude_reblogs`: exclude reblogs +- `exclude_replies`: exclude replies +- `exclude_visibilities`: exclude visibilities + Has these additional fields under the `pleroma` object: - `ap_id`: nullable URL string, ActivityPub id of the user diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 80acee2f7..a301ce090 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -130,7 +130,7 @@ def statuses_operation do :with_muted, :query, BooleanLike, - "Include statuses from muted acccounts." + "Include statuses from muted accounts." ), Operation.parameter(:exclude_reblogs, :query, BooleanLike, "Exclude reblogs"), Operation.parameter(:exclude_replies, :query, BooleanLike, "Exclude replies"), @@ -144,7 +144,7 @@ def statuses_operation do :with_muted, :query, BooleanLike, - "Include reactions from muted acccounts." + "Include reactions from muted accounts." ) ] ++ pagination_params(), responses: %{ -- cgit v1.2.3 From fdf1dfed560e27cd4e367cc2952fcb1b4e2580db Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Mon, 1 Feb 2021 14:09:23 +0300 Subject: only_remote -> remote renaming --- CHANGELOG.md | 2 +- .../API/differences_in_mastoapi_responses.md | 2 +- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- .../web/api_spec/operations/timeline_operation.ex | 12 +++---- .../controllers/timeline_controller_test.exs | 42 +++++++++++----------- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70d2ac0a8..628f6f17d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Admin API: An endpoint to manage frontends. - Streaming API: Add follow relationships updates. - WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types. -- Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `only_remote` & `local` parameters for filtration. +- Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `remote` & `local` parameters for filtration.
### Fixed diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index 7a4979154..c83be2faa 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -20,7 +20,7 @@ Home, public, hashtag & list timelines accept these parameters: - `only_media`: show only statuses with media attached - `local`: show only local statuses -- `only_remote`: show only remote statuses +- `remote`: show only remote statuses ## Statuses diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 58e868119..98051032a 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -735,7 +735,7 @@ defp restrict_local(query, %{local_only: true}) do defp restrict_local(query, _), do: query - defp restrict_remote(query, %{only_remote: true}) do + defp restrict_remote(query, %{remote: true}) do from(activity in query, where: activity.local == false) end diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index 52008e27c..01396642c 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -25,7 +25,7 @@ def home_operation do security: [%{"oAuth" => ["read:statuses"]}], parameters: [ local_param(), - only_remote_param(), + remote_param(), only_media_param(), with_muted_param(), exclude_visibilities_param(), @@ -63,7 +63,7 @@ def public_operation do local_param(), instance_param(), only_media_param(), - only_remote_param(), + remote_param(), with_muted_param(), exclude_visibilities_param(), reply_visibility_param() | pagination_params() @@ -110,7 +110,7 @@ def hashtag_operation do ), local_param(), only_media_param(), - only_remote_param(), + remote_param(), with_muted_param(), exclude_visibilities_param() | pagination_params() ], @@ -137,7 +137,7 @@ def list_operation do ), with_muted_param(), local_param(), - only_remote_param(), + remote_param(), only_media_param(), exclude_visibilities_param() | pagination_params() ], @@ -206,9 +206,9 @@ defp only_media_param do ) end - defp only_remote_param do + defp remote_param do Operation.parameter( - :only_remote, + :remote, :query, %Schema{allOf: [BooleanLike], default: false}, "Show only remote statuses?" diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs index 066762748..cc409451c 100644 --- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs @@ -131,22 +131,22 @@ test "filtering", %{conn: conn, user: user} do refute remote_activity.id in only_local_media_ids assert with_media.id in only_local_media_ids - only_remote_ids = + remote_ids = conn - |> get("/api/v1/timelines/home?only_remote=true") + |> get("/api/v1/timelines/home?remote=true") |> json_response_and_validate_schema(200) |> Enum.map(& &1["id"]) - refute local_activity.id in only_remote_ids - assert remote_activity.id in only_remote_ids - refute with_media.id in only_remote_ids + refute local_activity.id in remote_ids + assert remote_activity.id in remote_ids + refute with_media.id in remote_ids assert conn - |> get("/api/v1/timelines/home?only_remote=true&only_media=true") + |> get("/api/v1/timelines/home?remote=true&only_media=true") |> json_response_and_validate_schema(200) == [] assert conn - |> get("/api/v1/timelines/home?only_remote=true&local=true") + |> get("/api/v1/timelines/home?remote=true&local=true") |> json_response_and_validate_schema(200) == [] end end @@ -210,7 +210,7 @@ test "the public timeline", %{conn: conn} do assert [%{"id" => ^remote_id}] = conn - |> get("/api/v1/timelines/public?only_remote=true") + |> get("/api/v1/timelines/public?remote=true") |> json_response_and_validate_schema(:ok) with_media_id = with_media.id @@ -221,7 +221,7 @@ test "the public timeline", %{conn: conn} do |> json_response_and_validate_schema(:ok) assert conn - |> get("/api/v1/timelines/public?only_remote=true&only_media=true") + |> get("/api/v1/timelines/public?remote=true&only_media=true") |> json_response_and_validate_schema(:ok) == [] # does not contain repeats @@ -657,7 +657,7 @@ test "muted emotions", %{user: user, conn: conn} do ] = result end - test "filering", %{user: user, conn: conn} do + test "filtering", %{user: user, conn: conn} do {:ok, list} = Pleroma.List.create("name", user) local_user = insert(:user) @@ -699,18 +699,18 @@ test "filering", %{user: user, conn: conn} do assert with_media.id in only_local_media_ids refute remote_activity.id in only_local_media_ids - only_remote_ids = + remote_ids = conn - |> get("/api/v1/timelines/list/#{list.id}?only_remote=true") + |> get("/api/v1/timelines/list/#{list.id}?remote=true") |> json_response_and_validate_schema(200) |> Enum.map(& &1["id"]) - refute local_activity.id in only_remote_ids - refute with_media.id in only_remote_ids - assert remote_activity.id in only_remote_ids + refute local_activity.id in remote_ids + refute with_media.id in remote_ids + assert remote_activity.id in remote_ids assert conn - |> get("/api/v1/timelines/list/#{list.id}?only_remote=true&only_media=true") + |> get("/api/v1/timelines/list/#{list.id}?remote=true&only_media=true") |> json_response_and_validate_schema(200) == [] only_media_ids = @@ -724,9 +724,7 @@ test "filering", %{user: user, conn: conn} do refute remote_activity.id in only_media_ids assert conn - |> get( - "/api/v1/timelines/list/#{list.id}?only_media=true&local=true&only_remote=true" - ) + |> get("/api/v1/timelines/list/#{list.id}?only_media=true&local=true&remote=true") |> json_response_and_validate_schema(200) == [] end end @@ -777,7 +775,7 @@ test "hashtag timeline", %{conn: conn} do remote_ids = conn - |> get("/api/v1/timelines/tag/2hu?only_remote=true") + |> get("/api/v1/timelines/tag/2hu?remote=true") |> json_response_and_validate_schema(:ok) |> Enum.map(& &1["id"]) @@ -807,7 +805,7 @@ test "hashtag timeline", %{conn: conn} do ids = conn - |> get("/api/v1/timelines/tag/2hu?only_media=true&local=true&only_remote=true") + |> get("/api/v1/timelines/tag/2hu?only_media=true&local=true&remote=true") |> json_response_and_validate_schema(:ok) |> Enum.map(& &1["id"]) @@ -816,7 +814,7 @@ test "hashtag timeline", %{conn: conn} do refute remote_activity.id in ids assert conn - |> get("/api/v1/timelines/tag/2hu?only_media=true&only_remote=true") + |> get("/api/v1/timelines/tag/2hu?only_media=true&remote=true") |> json_response_and_validate_schema(:ok) == [] end -- cgit v1.2.3 From 0dc68c157f9e1cb1ef53223faeb9aa8d924e3094 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Mon, 1 Feb 2021 18:22:26 +0300 Subject: fix for scheduled post with poll --- CHANGELOG.md | 1 + .../web/api_spec/operations/status_operation.ex | 60 ++++++++++++---------- .../web/api_spec/schemas/scheduled_status.ex | 4 +- lib/pleroma/workers/scheduled_activity_worker.ex | 54 +++++++++++-------- .../controllers/status_controller_test.exs | 40 ++++++++++++++- .../workers/scheduled_activity_worker_test.exs | 21 ++++---- 6 files changed, 119 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..f599602d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: Fixed last_status.account being not filled with account data. - Mastodon API: Fix not being able to add or remove multiple users at once in lists. - Mastodon API: Fixed own_votes being not returned with poll data. + - Mastodon API: Fixed creation of scheduled posts with polls. ## Unreleased (Patch) diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index fd29f5139..f4c7f00af 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -413,34 +413,7 @@ defp create_request do items: %Schema{type: :string}, description: "Array of Attachment ids to be attached as media." }, - poll: %Schema{ - nullable: true, - type: :object, - required: [:options], - properties: %{ - options: %Schema{ - type: :array, - items: %Schema{type: :string}, - description: "Array of possible answers. Must be provided with `poll[expires_in]`." - }, - expires_in: %Schema{ - type: :integer, - nullable: true, - description: - "Duration the poll should be open, in seconds. Must be provided with `poll[options]`" - }, - multiple: %Schema{ - allOf: [BooleanLike], - nullable: true, - description: "Allow multiple choices?" - }, - hide_totals: %Schema{ - allOf: [BooleanLike], - nullable: true, - description: "Hide vote counts until the poll ends?" - } - } - }, + poll: poll_params(), in_reply_to_id: %Schema{ nullable: true, allOf: [FlakeID], @@ -522,6 +495,37 @@ defp create_request do } end + def poll_params do + %Schema{ + nullable: true, + type: :object, + required: [:options, :expires_in], + properties: %{ + options: %Schema{ + type: :array, + items: %Schema{type: :string}, + description: "Array of possible answers. Must be provided with `poll[expires_in]`." + }, + expires_in: %Schema{ + type: :integer, + nullable: true, + description: + "Duration the poll should be open, in seconds. Must be provided with `poll[options]`" + }, + multiple: %Schema{ + allOf: [BooleanLike], + nullable: true, + description: "Allow multiple choices?" + }, + hide_totals: %Schema{ + allOf: [BooleanLike], + nullable: true, + description: "Hide vote counts until the poll ends?" + } + } + } + end + def id_param do Operation.parameter(:id, :path, FlakeID, "Status ID", example: "9umDrYheeY451cQnEe", diff --git a/lib/pleroma/web/api_spec/schemas/scheduled_status.ex b/lib/pleroma/web/api_spec/schemas/scheduled_status.ex index dd0d9aa8f..cc051046a 100644 --- a/lib/pleroma/web/api_spec/schemas/scheduled_status.ex +++ b/lib/pleroma/web/api_spec/schemas/scheduled_status.ex @@ -5,8 +5,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do alias OpenApiSpex.Schema alias Pleroma.Web.ApiSpec.Schemas.Attachment - alias Pleroma.Web.ApiSpec.Schemas.Poll alias Pleroma.Web.ApiSpec.Schemas.VisibilityScope + alias Pleroma.Web.ApiSpec.StatusOperation require OpenApiSpex @@ -29,7 +29,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do spoiler_text: %Schema{type: :string, nullable: true}, visibility: %Schema{allOf: [VisibilityScope], nullable: true}, scheduled_at: %Schema{type: :string, format: :"date-time", nullable: true}, - poll: %Schema{allOf: [Poll], nullable: true}, + poll: StatusOperation.poll_params(), in_reply_to_id: %Schema{type: :string, nullable: true} } } diff --git a/lib/pleroma/workers/scheduled_activity_worker.ex b/lib/pleroma/workers/scheduled_activity_worker.ex index cf965999c..a4ab9928d 100644 --- a/lib/pleroma/workers/scheduled_activity_worker.ex +++ b/lib/pleroma/workers/scheduled_activity_worker.ex @@ -9,38 +9,50 @@ defmodule Pleroma.Workers.ScheduledActivityWorker do use Pleroma.Workers.WorkerHelper, queue: "scheduled_activities" - alias Pleroma.Config + alias Pleroma.Repo alias Pleroma.ScheduledActivity alias Pleroma.User - alias Pleroma.Web.CommonAPI require Logger @impl Oban.Worker def perform(%Job{args: %{"activity_id" => activity_id}}) do - if Config.get([ScheduledActivity, :enabled]) do - case Pleroma.Repo.get(ScheduledActivity, activity_id) do - %ScheduledActivity{} = scheduled_activity -> - post_activity(scheduled_activity) - - _ -> - Logger.error("#{__MODULE__} Couldn't find scheduled activity: #{activity_id}") - end + with %ScheduledActivity{} = scheduled_activity <- find_scheduled_activity(activity_id), + %User{} = user <- find_user(scheduled_activity.user_id) do + params = atomize_keys(scheduled_activity.params) + + Repo.transaction(fn -> + {:ok, activity} = Pleroma.Web.CommonAPI.post(user, params) + {:ok, _} = ScheduledActivity.delete(scheduled_activity) + activity + end) + else + {:error, :scheduled_activity_not_found} = error -> + Logger.error("#{__MODULE__} Couldn't find scheduled activity: #{activity_id}") + error + + {:error, :user_not_found} = error -> + Logger.error("#{__MODULE__} Couldn't find user for scheduled activity: #{activity_id}") + error end end - defp post_activity(%ScheduledActivity{user_id: user_id, params: params} = scheduled_activity) do - params = Map.new(params, fn {key, value} -> {String.to_existing_atom(key), value} end) + defp find_scheduled_activity(id) do + with nil <- Repo.get(ScheduledActivity, id) do + {:error, :scheduled_activity_not_found} + end + end - with {:delete, {:ok, _}} <- {:delete, ScheduledActivity.delete(scheduled_activity)}, - {:user, %User{} = user} <- {:user, User.get_cached_by_id(user_id)}, - {:post, {:ok, _}} <- {:post, CommonAPI.post(user, params)} do - :ok - else - error -> - Logger.error( - "#{__MODULE__} Couldn't create a status from the scheduled activity: #{inspect(error)}" - ) + defp find_user(id) do + with nil <- User.get_cached_by_id(id) do + {:error, :user_not_found} end end + + defp atomize_keys(map) do + Map.new(map, fn + {key, value} when is_map(value) -> {String.to_existing_atom(key), atomize_keys(value)} + {key, value} -> {String.to_existing_atom(key), value} + end) + end end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index a647cd57f..7819bc4f0 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -515,7 +515,7 @@ test "posting a poll", %{conn: conn} do end) assert NaiveDateTime.diff(NaiveDateTime.from_iso8601!(response["poll"]["expires_at"]), time) in 420..430 - refute response["poll"]["expred"] + assert response["poll"]["expired"] == false question = Object.get_by_id(response["poll"]["id"]) @@ -591,6 +591,44 @@ test "maximum date limit is enforced", %{conn: conn} do %{"error" => error} = json_response_and_validate_schema(conn, 422) assert error == "Expiration date is too far in the future" end + + test "scheduled poll", %{conn: conn} do + clear_config([ScheduledActivity, :enabled], true) + + scheduled_at = + NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(6), :millisecond) + |> NaiveDateTime.to_iso8601() + |> Kernel.<>("Z") + + %{"id" => scheduled_id} = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses", %{ + "status" => "very cool poll", + "poll" => %{ + "options" => ~w(a b c), + "expires_in" => 420 + }, + "scheduled_at" => scheduled_at + }) + |> json_response_and_validate_schema(200) + + assert {:ok, %{id: activity_id}} = + perform_job(Pleroma.Workers.ScheduledActivityWorker, %{ + activity_id: scheduled_id + }) + + assert Repo.all(Oban.Job) == [] + + object = + Activity + |> Repo.get(activity_id) + |> Object.normalize() + + assert object.data["content"] == "very cool poll" + assert object.data["type"] == "Question" + assert length(object.data["oneOf"]) == 3 + end end test "get a status" do diff --git a/test/pleroma/workers/scheduled_activity_worker_test.exs b/test/pleroma/workers/scheduled_activity_worker_test.exs index 6e11642d5..5558d5b5f 100644 --- a/test/pleroma/workers/scheduled_activity_worker_test.exs +++ b/test/pleroma/workers/scheduled_activity_worker_test.exs @@ -11,10 +11,9 @@ defmodule Pleroma.Workers.ScheduledActivityWorkerTest do import Pleroma.Factory import ExUnit.CaptureLog - setup do: clear_config([ScheduledActivity, :enabled]) + setup do: clear_config([ScheduledActivity, :enabled], true) test "creates a status from the scheduled activity" do - clear_config([ScheduledActivity, :enabled], true) user = insert(:user) naive_datetime = @@ -32,18 +31,22 @@ test "creates a status from the scheduled activity" do params: %{status: "hi"} ) - ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => scheduled_activity.id}}) + {:ok, %{id: activity_id}} = + ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => scheduled_activity.id}}) refute Repo.get(ScheduledActivity, scheduled_activity.id) - activity = Repo.all(Pleroma.Activity) |> Enum.find(&(&1.actor == user.ap_id)) - assert Pleroma.Object.normalize(activity, fetch: false).data["content"] == "hi" - end - test "adds log message if ScheduledActivity isn't find" do - clear_config([ScheduledActivity, :enabled], true) + object = + Pleroma.Activity + |> Repo.get(activity_id) + |> Pleroma.Object.normalize() + + assert object.data["content"] == "hi" + end + test "error message for non-existent scheduled activity" do assert capture_log([level: :error], fn -> ScheduledActivityWorker.perform(%Oban.Job{args: %{"activity_id" => 42}}) - end) =~ "Couldn't find scheduled activity" + end) =~ "Couldn't find scheduled activity: 42" end end -- cgit v1.2.3 From aacd1c90b7422780ae1eb9030f9fd26d541d4a9c Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Mon, 1 Feb 2021 19:33:40 +0300 Subject: fix for test warnings --- test/pleroma/config/deprecation_warnings_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs index 37e02fae2..15f4982ea 100644 --- a/test/pleroma/config/deprecation_warnings_test.exs +++ b/test/pleroma/config/deprecation_warnings_test.exs @@ -87,7 +87,7 @@ test "check_hellthread_threshold/0" do end test "check_activity_expiration_config/0" do - clear_config(Pleroma.ActivityExpiration, enabled: true) + clear_config([Pleroma.ActivityExpiration], enabled: true) assert capture_log(fn -> DeprecationWarnings.check_activity_expiration_config() @@ -95,7 +95,7 @@ test "check_activity_expiration_config/0" do end test "check_uploders_s3_public_endpoint/0" do - clear_config(Pleroma.Uploaders.S3, public_endpoint: "https://fake.amazonaws.com/bucket/") + clear_config([Pleroma.Uploaders.S3], public_endpoint: "https://fake.amazonaws.com/bucket/") assert capture_log(fn -> DeprecationWarnings.check_uploders_s3_public_endpoint() -- cgit v1.2.3 From 22486fb4af49214fb2b0eff09f00006fbfdd9745 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Feb 2021 11:15:47 -0600 Subject: Improve changelog description --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24873f591..5225217bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,7 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers. - Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private. - Tag URLs in statuses are now absolute -- Creation of duplicate purge expired activities jobs +- Removed duplicate jobs to purge expired activities
API Changes -- cgit v1.2.3 From f852e8d2d21657dae36871a8c0ef65e33192f8da Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Feb 2021 12:03:20 -0600 Subject: Document we are disabling the extension fixup in Majic --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4f3bddb7..90bf3d999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private. - Tag URLs in statuses are now absolute - Removed duplicate jobs to purge expired activities +- File extensions of some attachments were incorrectly changed. This feature has been disabled for now.
API Changes -- cgit v1.2.3 From 92efdf9adc5d061e0bb008d75dae67b1ae80b834 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Feb 2021 12:12:37 -0600 Subject: Document OAuth 2.0 provider fqn field addition --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..0598bdb6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Admin API: Reports now ordered by newest - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script +- Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address. ### Added -- cgit v1.2.3 From d0c2159b773de4fe4eb13dd4925a912c1b89c69c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Feb 2021 12:16:01 -0600 Subject: Mix pleroma.instance creates parent directories now --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4f3867a2..3431d2afa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers. - Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private. - Tag URLs in statuses are now absolute +- Mix task pleroma.instance creates missing parent directories if the configuration or SQL output paths are changed.
API Changes -- cgit v1.2.3 From fb25231fbe57ed3ca27e277a35b7e376f1af26fa Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 21 Jan 2021 17:09:18 +0100 Subject: Add test for Answer presence into an authenticated /outbox --- .../activity_pub/activity_pub_controller_test.exs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index e0cd28303..019781ddf 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -1023,6 +1023,31 @@ test "it returns an announce activity in a collection", %{conn: conn} do assert response(conn, 200) =~ announce_activity.data["object"] end + + test "It returns poll Answers when authenticated", %{conn: conn} do + poller = insert(:user) + voter = insert(:user) + + {:ok, activity} = + CommonAPI.post(poller, %{ + status: "suya...", + poll: %{options: ["suya", "suya.", "suya.."], expires_in: 10} + }) + + assert question = Object.normalize(activity, fetch: false) + + {:ok, [activity], _object} = CommonAPI.vote(voter, question, [1]) + + assert outbox_get = + conn + |> assign(:user, voter) + |> put_req_header("accept", "application/activity+json") + |> get(voter.ap_id <> "/outbox?page=true") + |> json_response(200) + + assert [answer_outbox] = outbox_get["orderedItems"] + assert answer_outbox["id"] == activity.data["id"] + end end describe "POST /users/:nickname/outbox (C2S)" do -- cgit v1.2.3 From 9fcff7851f9b54d6baa14d87af3087ac3ce373dc Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 3 Feb 2021 15:38:59 +0300 Subject: Improve OpenAPI spec and deploy it to api.pleroma.social Too many changes in OpenAPI spec to describe each one, but basically it is tag fixes, bringing consitency to operation summaries and fixing some incorrect information. --- .gitlab-ci.yml | 19 +++++ lib/mix/tasks/pleroma/openapi_spec.ex | 6 ++ lib/pleroma/web/api_spec.ex | 92 +++++++++++++++++++--- .../web/api_spec/operations/account_operation.ex | 46 +++++------ .../api_spec/operations/admin/chat_operation.ex | 8 +- .../api_spec/operations/admin/config_operation.ex | 12 +-- .../operations/admin/frontend_operation.ex | 6 +- .../admin/instance_document_operation.ex | 12 +-- .../api_spec/operations/admin/invite_operation.ex | 8 +- .../admin/media_proxy_cache_operation.ex | 14 ++-- .../operations/admin/o_auth_app_operation.ex | 16 ++-- .../api_spec/operations/admin/relay_operation.ex | 12 +-- .../api_spec/operations/admin/report_operation.ex | 20 ++--- .../api_spec/operations/admin/status_operation.ex | 15 ++-- .../web/api_spec/operations/app_operation.ex | 6 +- .../web/api_spec/operations/chat_operation.ex | 26 +++--- .../api_spec/operations/conversation_operation.ex | 4 +- .../api_spec/operations/custom_emoji_operation.ex | 4 +- .../api_spec/operations/domain_block_operation.ex | 9 +-- .../operations/emoji_reaction_operation.ex | 8 +- .../web/api_spec/operations/filter_operation.ex | 14 ++-- .../operations/follow_request_operation.ex | 12 +-- .../web/api_spec/operations/instance_operation.ex | 4 +- .../web/api_spec/operations/list_operation.ex | 8 +- .../web/api_spec/operations/media_operation.ex | 14 ++-- .../api_spec/operations/notification_operation.ex | 6 +- .../operations/pleroma_account_operation.ex | 21 +++-- .../operations/pleroma_conversation_operation.ex | 9 ++- .../operations/pleroma_emoji_file_operation.ex | 6 +- .../operations/pleroma_emoji_pack_operation.ex | 18 ++--- .../operations/pleroma_instances_operation.ex | 4 +- .../operations/pleroma_mascot_operation.ex | 4 +- .../operations/pleroma_notification_operation.ex | 5 +- .../web/api_spec/operations/report_operation.ex | 2 +- .../operations/scheduled_activity_operation.ex | 8 +- .../web/api_spec/operations/status_operation.ex | 56 ++++++------- .../api_spec/operations/subscription_operation.ex | 14 ++-- .../web/api_spec/operations/timeline_operation.ex | 3 +- .../api_spec/operations/user_import_operation.ex | 12 +-- 39 files changed, 334 insertions(+), 229 deletions(-) create mode 100644 lib/mix/tasks/pleroma/openapi_spec.ex diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ef3ddd0d..634c4b893 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -34,6 +34,14 @@ build: - mix deps.get - mix compile --force +spec-build: + stage: test + artifacts: + paths: + - spec.json + script: + - mix pleroma.openapi_spec spec.json + benchmark: stage: benchmark when: manual @@ -155,6 +163,17 @@ review_app: - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true - git push -f dokku@pleroma.online:$CI_ENVIRONMENT_SLUG $CI_COMMIT_SHA:refs/heads/master +spec-deploy: + stage: deploy + only: + - develop@pleroma/pleroma + image: alpine:latest + before_script: + - apk add curl + script: + - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline + + stop_review_app: image: alpine:3.9 stage: deploy diff --git a/lib/mix/tasks/pleroma/openapi_spec.ex b/lib/mix/tasks/pleroma/openapi_spec.ex new file mode 100644 index 000000000..524bf5144 --- /dev/null +++ b/lib/mix/tasks/pleroma/openapi_spec.ex @@ -0,0 +1,6 @@ +defmodule Mix.Tasks.Pleroma.OpenapiSpec do + def run([path]) do + spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!() + File.write(path, spec) + end +end diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index 064558597..81b7bc9e8 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -11,10 +11,10 @@ defmodule Pleroma.Web.ApiSpec do @behaviour OpenApi @impl OpenApi - def spec do + def spec(opts \\ []) do %OpenApi{ servers: - if Phoenix.Endpoint.server?(:pleroma, Endpoint) do + if opts[:server_specific] do [ # Populate the Server info from a phoenix endpoint OpenApiSpex.Server.from_endpoint(Endpoint) @@ -23,9 +23,25 @@ def spec do [] end, info: %OpenApiSpex.Info{ - title: "Pleroma", - description: Application.spec(:pleroma, :description) |> to_string(), - version: Application.spec(:pleroma, :vsn) |> to_string() + title: "Pleroma API", + description: """ + This is documentation for client Pleroma API. Most of the endpoints and entities come + from Mastodon API and have custom extensions on top. + + While this document aims to be a complete guide to the client API Pleroma exposes, + the details are still being worked out. Some endpoints may have incomplete or poorly worded documentation. + You might want to check the following resources if something is not clear: + - [Legacy Pleroma-specific endpoint documentation](https://docs-develop.pleroma.social/backend/development/API/pleroma_api/) + - [Mastodon API documentation](https://docs.joinmastodon.org/client/intro/) + - [Differences in Mastodon API responses from vanilla Mastodon](https://docs-develop.pleroma.social/backend/development/API/differences_in_mastoapi_responses/) + + Please report such occurences on our [issue tracker](https://git.pleroma.social/pleroma/pleroma/-/issues). Feel free to submit API questions or proposals there too! + """, + version: Application.spec(:pleroma, :vsn) |> to_string(), + extensions: %{ + # Logo path should be picked so that the path exists both on Pleroma instances and on api.pleroma.social + "x-logo": %{"url" => "/static/logo.svg", "altText" => "Pleroma logo"} + } }, # populate the paths from a phoenix router paths: OpenApiSpex.Paths.from_router(Router), @@ -45,15 +61,73 @@ def spec do authorizationUrl: "/oauth/authorize", tokenUrl: "/oauth/token", scopes: %{ - "read" => "read", - "write" => "write", - "follow" => "follow", - "push" => "push" + # TODO: Document granular scopes + "read" => "Read everything", + "write" => "Write everything", + "follow" => "Manage relationships", + "push" => "Web Push API subscriptions" } } } } } + }, + extensions: %{ + # Redoc-specific extension, every time a new tag is added it should be reflected here, + # otherwise it won't be shown. + "x-tagGroups": [ + %{ + "name" => "Accounts", + "tags" => ["Account actions", "Retrieve account information", "Scrobbles"] + }, + %{ + "name" => "Administration", + "tags" => [ + "Chat administration", + "Emoji packs", + "Frontend managment", + "Instance configuration", + "Instance documents", + "Invites", + "MediaProxy cache", + "OAuth application managment", + "Report managment", + "Relays", + "Status administration" + ] + }, + %{"name" => "Applications", "tags" => ["Applications", "Push subscriptions"]}, + %{ + "name" => "Current account", + "tags" => [ + "Account credentials", + "Backups", + "Blocks and mutes", + "Data import", + "Domain blocks", + "Follow requests", + "Mascot", + "Markers", + "Notifications" + ] + }, + %{"name" => "Instance", "tags" => ["Custom emojis"]}, + %{"name" => "Messaging", "tags" => ["Chats", "Conversations"]}, + %{ + "name" => "Statuses", + "tags" => [ + "Emoji reactions", + "Lists", + "Polls", + "Timelines", + "Retrieve status information", + "Scheduled statuses", + "Search", + "Status actions" + ] + }, + %{"name" => "Miscellaneous", "tags" => ["Reports", "Suggestions"]} + ] } } # discover request/response schemas from path specs diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 80acee2f7..f11ae53ab 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -26,7 +26,7 @@ def open_api_operation(action) do @spec create_operation() :: Operation.t() def create_operation do %Operation{ - tags: ["accounts"], + tags: ["Account credentials"], summary: "Register an account", description: "Creates a user and account records. Returns an account access token for the app that initiated the request. The app should save this token for later, and should wait for the user to confirm their account by clicking a link in their email inbox.", @@ -43,7 +43,7 @@ def create_operation do def verify_credentials_operation do %Operation{ - tags: ["accounts"], + tags: ["Account credentials"], description: "Test to make sure that the user token works.", summary: "Verify account credentials", operationId: "AccountController.verify_credentials", @@ -56,7 +56,7 @@ def verify_credentials_operation do def update_credentials_operation do %Operation{ - tags: ["accounts"], + tags: ["Account credentials"], summary: "Update account credentials", description: "Update the user's display and preferences.", operationId: "AccountController.update_credentials", @@ -71,8 +71,8 @@ def update_credentials_operation do def relationships_operation do %Operation{ - tags: ["accounts"], - summary: "Check relationships to other accounts", + tags: ["Retrieve account information"], + summary: "Relationship with current account", operationId: "AccountController.relationships", description: "Find out whether a given account is followed, blocked, muted, etc.", security: [%{"oAuth" => ["read:follows"]}], @@ -95,7 +95,7 @@ def relationships_operation do def show_operation do %Operation{ - tags: ["accounts"], + tags: ["Retrieve account information"], summary: "Account", operationId: "AccountController.show", description: "View information about a profile.", @@ -110,8 +110,8 @@ def show_operation do def statuses_operation do %Operation{ - tags: ["accounts"], summary: "Statuses", + tags: ["Retrieve account information"], operationId: "AccountController.statuses", description: "Statuses posted to the given account. Public (for public statuses only), or user token + `read:statuses` (for private statuses the user is authorized to see)", @@ -157,7 +157,7 @@ def statuses_operation do def followers_operation do %Operation{ - tags: ["accounts"], + tags: ["Retrieve account information"], summary: "Followers", operationId: "AccountController.followers", security: [%{"oAuth" => ["read:accounts"]}], @@ -176,7 +176,7 @@ def followers_operation do def following_operation do %Operation{ - tags: ["accounts"], + tags: ["Retrieve account information"], summary: "Following", operationId: "AccountController.following", security: [%{"oAuth" => ["read:accounts"]}], @@ -193,7 +193,7 @@ def following_operation do def lists_operation do %Operation{ - tags: ["accounts"], + tags: ["Retrieve account information"], summary: "Lists containing this account", operationId: "AccountController.lists", security: [%{"oAuth" => ["read:lists"]}], @@ -205,7 +205,7 @@ def lists_operation do def follow_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Follow", operationId: "AccountController.follow", security: [%{"oAuth" => ["follow", "write:follows"]}], @@ -238,7 +238,7 @@ def follow_operation do def unfollow_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Unfollow", operationId: "AccountController.unfollow", security: [%{"oAuth" => ["follow", "write:follows"]}], @@ -254,7 +254,7 @@ def unfollow_operation do def mute_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Mute", operationId: "AccountController.mute", security: [%{"oAuth" => ["follow", "write:mutes"]}], @@ -284,7 +284,7 @@ def mute_operation do def unmute_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Unmute", operationId: "AccountController.unmute", security: [%{"oAuth" => ["follow", "write:mutes"]}], @@ -298,7 +298,7 @@ def unmute_operation do def block_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Block", operationId: "AccountController.block", security: [%{"oAuth" => ["follow", "write:blocks"]}], @@ -313,7 +313,7 @@ def block_operation do def unblock_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Unblock", operationId: "AccountController.unblock", security: [%{"oAuth" => ["follow", "write:blocks"]}], @@ -327,7 +327,7 @@ def unblock_operation do def follow_by_uri_operation do %Operation{ - tags: ["accounts"], + tags: ["Account actions"], summary: "Follow by URI", operationId: "AccountController.follows", security: [%{"oAuth" => ["follow", "write:follows"]}], @@ -342,8 +342,8 @@ def follow_by_uri_operation do def mutes_operation do %Operation{ - tags: ["accounts"], - summary: "Muted accounts", + tags: ["Blocks and mutes"], + summary: "Retrieve list of mutes", operationId: "AccountController.mutes", description: "Accounts the user has muted.", security: [%{"oAuth" => ["follow", "read:mutes"]}], @@ -356,8 +356,8 @@ def mutes_operation do def blocks_operation do %Operation{ - tags: ["accounts"], - summary: "Blocked users", + tags: ["Blocks and mutes"], + summary: "Retrieve list of blocks", operationId: "AccountController.blocks", description: "View your blocks. See also accounts/:id/{block,unblock}", security: [%{"oAuth" => ["read:blocks"]}], @@ -370,7 +370,7 @@ def blocks_operation do def endorsements_operation do %Operation{ - tags: ["accounts"], + tags: ["Retrieve account information"], summary: "Endorsements", operationId: "AccountController.endorsements", description: "Not implemented", @@ -383,7 +383,7 @@ def endorsements_operation do def identity_proofs_operation do %Operation{ - tags: ["accounts"], + tags: ["Retrieve account information"], summary: "Identity proofs", operationId: "AccountController.identity_proofs", # Validators complains about unused path params otherwise diff --git a/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex b/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex index 8062da987..cbe4b8972 100644 --- a/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do def delete_message_operation do %Operation{ - tags: ["admin", "chat"], + tags: ["Chat administration"], summary: "Delete an individual chat message", operationId: "AdminAPI.ChatController.delete_message", parameters: [ @@ -41,8 +41,8 @@ def delete_message_operation do def messages_operation do %Operation{ - tags: ["admin", "chat"], - summary: "Get the most recent messages of the chat", + tags: ["Chat administration"], + summary: "Get chat's messages", operationId: "AdminAPI.ChatController.messages", parameters: [Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++ @@ -65,7 +65,7 @@ def messages_operation do def show_operation do %Operation{ - tags: ["chat"], + tags: ["Chat administration"], summary: "Create a chat", operationId: "AdminAPI.ChatController.show", parameters: [ diff --git a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex index 323539ca5..b8ccc1d00 100644 --- a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex @@ -16,8 +16,8 @@ def open_api_operation(action) do def show_operation do %Operation{ - tags: ["Admin", "Config"], - summary: "Get list of merged default settings with saved in database", + tags: ["Instance configuration"], + summary: "Retrieve instance configuration", operationId: "AdminAPI.ConfigController.show", parameters: [ Operation.parameter( @@ -38,8 +38,8 @@ def show_operation do def update_operation do %Operation{ - tags: ["Admin", "Config"], - summary: "Update config settings", + tags: ["Instance configuration"], + summary: "Update instance configuration", operationId: "AdminAPI.ConfigController.update", security: [%{"oAuth" => ["write"]}], parameters: admin_api_params(), @@ -71,8 +71,8 @@ def update_operation do def descriptions_operation do %Operation{ - tags: ["Admin", "Config"], - summary: "Get JSON with config descriptions.", + tags: ["Instance configuration"], + summary: "Retrieve config description", operationId: "AdminAPI.ConfigController.descriptions", security: [%{"oAuth" => ["read"]}], parameters: admin_api_params(), diff --git a/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex b/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex index 05e2fe2be..b149becf9 100644 --- a/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex @@ -16,8 +16,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Admin", "Reports"], - summary: "Get a list of available frontends", + tags: ["Frontend managment"], + summary: "Retrieve a list of available frontends", operationId: "AdminAPI.FrontendController.index", security: [%{"oAuth" => ["read"]}], responses: %{ @@ -29,7 +29,7 @@ def index_operation do def install_operation do %Operation{ - tags: ["Admin", "Reports"], + tags: ["Frontend managment"], summary: "Install a frontend", operationId: "AdminAPI.FrontendController.install", security: [%{"oAuth" => ["read"]}], diff --git a/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex b/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex index 0e1fdec08..3e89abfb5 100644 --- a/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex @@ -15,8 +15,8 @@ def open_api_operation(action) do def show_operation do %Operation{ - tags: ["Admin", "InstanceDocument"], - summary: "Get the instance document", + tags: ["Instance documents"], + summary: "Retrieve an instance document", operationId: "AdminAPI.InstanceDocumentController.show", security: [%{"oAuth" => ["read"]}], parameters: [ @@ -36,8 +36,8 @@ def show_operation do def update_operation do %Operation{ - tags: ["Admin", "InstanceDocument"], - summary: "Update the instance document", + tags: ["Instance documents"], + summary: "Update an instance document", operationId: "AdminAPI.InstanceDocumentController.update", security: [%{"oAuth" => ["write"]}], requestBody: Helpers.request_body("Parameters", update_request()), @@ -74,8 +74,8 @@ defp update_request do def delete_operation do %Operation{ - tags: ["Admin", "InstanceDocument"], - summary: "Get the instance document", + tags: ["Instance documents"], + summary: "Delete an instance document", operationId: "AdminAPI.InstanceDocumentController.delete", security: [%{"oAuth" => ["write"]}], parameters: [ diff --git a/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex b/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex index 0ce7bcc45..60d69c767 100644 --- a/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Admin", "Invites"], + tags: ["Invites"], summary: "Get a list of generated invites", operationId: "AdminAPI.InviteController.index", security: [%{"oAuth" => ["read:invites"]}], @@ -48,7 +48,7 @@ def index_operation do def create_operation do %Operation{ - tags: ["Admin", "Invites"], + tags: ["Invites"], summary: "Create an account registration invite token", operationId: "AdminAPI.InviteController.create", security: [%{"oAuth" => ["write:invites"]}], @@ -69,7 +69,7 @@ def create_operation do def revoke_operation do %Operation{ - tags: ["Admin", "Invites"], + tags: ["Invites"], summary: "Revoke invite by token", operationId: "AdminAPI.InviteController.revoke", security: [%{"oAuth" => ["write:invites"]}], @@ -96,7 +96,7 @@ def revoke_operation do def email_operation do %Operation{ - tags: ["Admin", "Invites"], + tags: ["Invites"], summary: "Sends registration invite via email", operationId: "AdminAPI.InviteController.email", security: [%{"oAuth" => ["write:invites"]}], diff --git a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex index e16356a47..675504ee0 100644 --- a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex @@ -16,8 +16,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Admin", "MediaProxyCache"], - summary: "Fetch a paginated list of all banned MediaProxy URLs in Cachex", + tags: ["MediaProxy cache"], + summary: "Retrieve a list of banned MediaProxy URLs", operationId: "AdminAPI.MediaProxyCacheController.index", security: [%{"oAuth" => ["read:media_proxy_caches"]}], parameters: [ @@ -44,7 +44,7 @@ def index_operation do responses: %{ 200 => Operation.response( - "Array of banned MediaProxy URLs in Cachex", + "Array of MediaProxy URLs", "application/json", %Schema{ type: :object, @@ -68,8 +68,8 @@ def index_operation do def delete_operation do %Operation{ - tags: ["Admin", "MediaProxyCache"], - summary: "Remove a banned MediaProxy URL from Cachex", + tags: ["MediaProxy cache"], + summary: "Remove a banned MediaProxy URL", operationId: "AdminAPI.MediaProxyCacheController.delete", security: [%{"oAuth" => ["write:media_proxy_caches"]}], parameters: admin_api_params(), @@ -94,8 +94,8 @@ def delete_operation do def purge_operation do %Operation{ - tags: ["Admin", "MediaProxyCache"], - summary: "Purge and optionally ban a MediaProxy URL", + tags: ["MediaProxy cache"], + summary: "Purge a URL from MediaProxy cache and optionally ban it", operationId: "AdminAPI.MediaProxyCacheController.purge", security: [%{"oAuth" => ["write:media_proxy_caches"]}], parameters: admin_api_params(), diff --git a/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex index f1b32343d..2f3bee4f0 100644 --- a/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex @@ -16,8 +16,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - summary: "List OAuth apps", - tags: ["Admin", "oAuth Apps"], + summary: "Retrieve a list of OAuth applications", + tags: ["OAuth application managment"], operationId: "AdminAPI.OAuthAppController.index", security: [%{"oAuth" => ["write"]}], parameters: [ @@ -69,8 +69,8 @@ def index_operation do def create_operation do %Operation{ - tags: ["Admin", "oAuth Apps"], - summary: "Create OAuth App", + tags: ["OAuth application managment"], + summary: "Create an OAuth application", operationId: "AdminAPI.OAuthAppController.create", requestBody: request_body("Parameters", create_request()), parameters: admin_api_params(), @@ -84,8 +84,8 @@ def create_operation do def update_operation do %Operation{ - tags: ["Admin", "oAuth Apps"], - summary: "Update OAuth App", + tags: ["OAuth application managment"], + summary: "Update OAuth application", operationId: "AdminAPI.OAuthAppController.update", parameters: [id_param() | admin_api_params()], security: [%{"oAuth" => ["write"]}], @@ -102,8 +102,8 @@ def update_operation do def delete_operation do %Operation{ - tags: ["Admin", "oAuth Apps"], - summary: "Delete OAuth App", + tags: ["OAuth application managment"], + summary: "Delete OAuth application", operationId: "AdminAPI.OAuthAppController.delete", parameters: [id_param() | admin_api_params()], security: [%{"oAuth" => ["write"]}], diff --git a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex index 7a17072e1..c47f18f0c 100644 --- a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex @@ -15,8 +15,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Admin", "Relays"], - summary: "List Relays", + tags: ["Relays"], + summary: "Retrieve a list of relays", operationId: "AdminAPI.RelayController.index", security: [%{"oAuth" => ["read"]}], parameters: admin_api_params(), @@ -37,8 +37,8 @@ def index_operation do def follow_operation do %Operation{ - tags: ["Admin", "Relays"], - summary: "Follow a Relay", + tags: ["Relays"], + summary: "Follow a relay", operationId: "AdminAPI.RelayController.follow", security: [%{"oAuth" => ["write:follows"]}], parameters: admin_api_params(), @@ -51,8 +51,8 @@ def follow_operation do def unfollow_operation do %Operation{ - tags: ["Admin", "Relays"], - summary: "Unfollow a Relay", + tags: ["Relays"], + summary: "Unfollow a relay", operationId: "AdminAPI.RelayController.unfollow", security: [%{"oAuth" => ["write:follows"]}], parameters: admin_api_params(), diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index d60e84a66..2e115f241 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -19,8 +19,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Admin", "Reports"], - summary: "Get a list of reports", + tags: ["Report managment"], + summary: "Retrieve a list of reports", operationId: "AdminAPI.ReportController.index", security: [%{"oAuth" => ["read:reports"]}], parameters: [ @@ -69,8 +69,8 @@ def index_operation do def show_operation do %Operation{ - tags: ["Admin", "Reports"], - summary: "Get an individual report", + tags: ["Report managment"], + summary: "Retrieve a report", operationId: "AdminAPI.ReportController.show", parameters: [id_param() | admin_api_params()], security: [%{"oAuth" => ["read:reports"]}], @@ -83,8 +83,8 @@ def show_operation do def update_operation do %Operation{ - tags: ["Admin", "Reports"], - summary: "Change the state of one or multiple reports", + tags: ["Report managment"], + summary: "Change state of specified reports", operationId: "AdminAPI.ReportController.update", security: [%{"oAuth" => ["write:reports"]}], parameters: admin_api_params(), @@ -99,8 +99,8 @@ def update_operation do def notes_create_operation do %Operation{ - tags: ["Admin", "Reports"], - summary: "Create report note", + tags: ["Report managment"], + summary: "Add a note to the report", operationId: "AdminAPI.ReportController.notes_create", parameters: [id_param() | admin_api_params()], requestBody: @@ -120,8 +120,8 @@ def notes_create_operation do def notes_delete_operation do %Operation{ - tags: ["Admin", "Reports"], - summary: "Delete report note", + tags: ["Report managment"], + summary: "Delete note attached to the report", operationId: "AdminAPI.ReportController.notes_delete", parameters: [ Operation.parameter(:report_id, :path, :string, "Report ID"), diff --git a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex index fed3da27a..04c97fad9 100644 --- a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex @@ -21,8 +21,9 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Admin", "Statuses"], + tags: ["Status administration"], operationId: "AdminAPI.StatusController.index", + summary: "Get all statuses", security: [%{"oAuth" => ["read:statuses"]}], parameters: [ Operation.parameter( @@ -69,8 +70,8 @@ def index_operation do def show_operation do %Operation{ - tags: ["Admin", "Statuses"], - summary: "Show Status", + tags: ["Status adminitration)"], + summary: "Get status", operationId: "AdminAPI.StatusController.show", parameters: [id_param() | admin_api_params()], security: [%{"oAuth" => ["read:statuses"]}], @@ -83,8 +84,8 @@ def show_operation do def update_operation do %Operation{ - tags: ["Admin", "Statuses"], - summary: "Change the scope of an individual reported status", + tags: ["Status adminitration)"], + summary: "Change the scope of a status", operationId: "AdminAPI.StatusController.update", parameters: [id_param() | admin_api_params()], security: [%{"oAuth" => ["write:statuses"]}], @@ -98,8 +99,8 @@ def update_operation do def delete_operation do %Operation{ - tags: ["Admin", "Statuses"], - summary: "Delete an individual reported status", + tags: ["Status adminitration)"], + summary: "Delete status", operationId: "AdminAPI.StatusController.delete", parameters: [id_param() | admin_api_params()], security: [%{"oAuth" => ["write:statuses"]}], diff --git a/lib/pleroma/web/api_spec/operations/app_operation.ex b/lib/pleroma/web/api_spec/operations/app_operation.ex index 7587e488e..dfb1c7170 100644 --- a/lib/pleroma/web/api_spec/operations/app_operation.ex +++ b/lib/pleroma/web/api_spec/operations/app_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do @spec create_operation() :: Operation.t() def create_operation do %Operation{ - tags: ["apps"], + tags: ["Applications"], summary: "Create an application", description: "Create a new application to obtain OAuth2 credentials", operationId: "AppController.create", @@ -45,8 +45,8 @@ def create_operation do def verify_credentials_operation do %Operation{ - tags: ["apps"], - summary: "Verify your app works", + tags: ["Applications"], + summary: "Verify the application works", description: "Confirm that the app's OAuth2 credentials work.", operationId: "AppController.verify_credentials", security: [%{"oAuth" => ["read"]}], diff --git a/lib/pleroma/web/api_spec/operations/chat_operation.ex b/lib/pleroma/web/api_spec/operations/chat_operation.ex index e5ee6e695..b49700172 100644 --- a/lib/pleroma/web/api_spec/operations/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/chat_operation.ex @@ -20,7 +20,7 @@ def open_api_operation(action) do def mark_as_read_operation do %Operation{ - tags: ["chat"], + tags: ["Chats"], summary: "Mark all messages in the chat as read", operationId: "ChatController.mark_as_read", parameters: [Operation.parameter(:id, :path, :string, "The ID of the Chat")], @@ -43,8 +43,8 @@ def mark_as_read_operation do def mark_message_as_read_operation do %Operation{ - tags: ["chat"], - summary: "Mark one message in the chat as read", + tags: ["Chats"], + summary: "Mark a message as read", operationId: "ChatController.mark_message_as_read", parameters: [ Operation.parameter(:id, :path, :string, "The ID of the Chat"), @@ -68,8 +68,8 @@ def mark_message_as_read_operation do def show_operation do %Operation{ - tags: ["chat"], - summary: "Create a chat", + tags: ["Chats"], + summary: "Retrieve a chat", operationId: "ChatController.show", parameters: [ Operation.parameter( @@ -99,7 +99,7 @@ def show_operation do def create_operation do %Operation{ - tags: ["chat"], + tags: ["Chats"], summary: "Create a chat", operationId: "ChatController.create", parameters: [ @@ -130,8 +130,8 @@ def create_operation do def index_operation do %Operation{ - tags: ["chat"], - summary: "Get a list of chats that you participated in", + tags: ["Chats"], + summary: "Retrieve list of chats", operationId: "ChatController.index", parameters: [ Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users") @@ -150,8 +150,8 @@ def index_operation do def messages_operation do %Operation{ - tags: ["chat"], - summary: "Get the most recent messages of the chat", + tags: ["Chats"], + summary: "Retrieve chat's messages", operationId: "ChatController.messages", parameters: [Operation.parameter(:id, :path, :string, "The ID of the Chat")] ++ @@ -175,7 +175,7 @@ def messages_operation do def post_chat_message_operation do %Operation{ - tags: ["chat"], + tags: ["Chats"], summary: "Post a message to the chat", operationId: "ChatController.post_chat_message", parameters: [ @@ -202,8 +202,8 @@ def post_chat_message_operation do def delete_message_operation do %Operation{ - tags: ["chat"], - summary: "delete_message", + tags: ["Chats"], + summary: "Delete message", operationId: "ChatController.delete_message", parameters: [ Operation.parameter(:id, :path, :string, "The ID of the Chat"), diff --git a/lib/pleroma/web/api_spec/operations/conversation_operation.ex b/lib/pleroma/web/api_spec/operations/conversation_operation.ex index 15fc3d66d..367f4125a 100644 --- a/lib/pleroma/web/api_spec/operations/conversation_operation.ex +++ b/lib/pleroma/web/api_spec/operations/conversation_operation.ex @@ -18,7 +18,7 @@ def open_api_operation(action) do def index_operation do %Operation{ tags: ["Conversations"], - summary: "Show conversation", + summary: "List of conversations", security: [%{"oAuth" => ["read:statuses"]}], operationId: "ConversationController.index", parameters: [ @@ -44,7 +44,7 @@ def index_operation do def mark_as_read_operation do %Operation{ tags: ["Conversations"], - summary: "Mark as read", + summary: "Mark conversation as read", operationId: "ConversationController.mark_as_read", parameters: [ Operation.parameter(:id, :path, :string, "Conversation ID", diff --git a/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex b/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex index 541c1ff1b..98da1a6de 100644 --- a/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex +++ b/lib/pleroma/web/api_spec/operations/custom_emoji_operation.ex @@ -14,8 +14,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["custom_emojis"], - summary: "List custom custom emojis", + tags: ["Custom emojis"], + summary: "Retrieve a list of custom emojis", description: "Returns custom emojis that are available on the server.", operationId: "CustomEmojiController.index", responses: %{ diff --git a/lib/pleroma/web/api_spec/operations/domain_block_operation.ex b/lib/pleroma/web/api_spec/operations/domain_block_operation.ex index 2be54e359..f124e7fe5 100644 --- a/lib/pleroma/web/api_spec/operations/domain_block_operation.ex +++ b/lib/pleroma/web/api_spec/operations/domain_block_operation.ex @@ -14,9 +14,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["domain_blocks"], - summary: "Fetch domain blocks", - description: "View domains the user has blocked.", + tags: ["Domain blocks"], + summary: "Retrieve a list of blocked domains", security: [%{"oAuth" => ["follow", "read:blocks"]}], operationId: "DomainBlockController.index", responses: %{ @@ -34,7 +33,7 @@ def index_operation do # Supporting domain query parameter is deprecated in Mastodon API def create_operation do %Operation{ - tags: ["domain_blocks"], + tags: ["Domain blocks"], summary: "Block a domain", description: """ Block a domain to: @@ -55,7 +54,7 @@ def create_operation do # Supporting domain query parameter is deprecated in Mastodon API def delete_operation do %Operation{ - tags: ["domain_blocks"], + tags: ["Domain blocks"], summary: "Unblock a domain", description: "Remove a domain block, if it exists in the user's array of blocked domains.", operationId: "DomainBlockController.delete", diff --git a/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex b/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex index e1aa7d4ca..a7b306a30 100644 --- a/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex +++ b/lib/pleroma/web/api_spec/operations/emoji_reaction_operation.ex @@ -17,7 +17,7 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Emoji Reactions"], + tags: ["Emoji reactions"], summary: "Get an object of emoji to account mappings with accounts that reacted to the post", parameters: [ @@ -42,7 +42,7 @@ def index_operation do def create_operation do %Operation{ - tags: ["Emoji Reactions"], + tags: ["Emoji reactions"], summary: "React to a post with a unicode emoji", parameters: [ Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), @@ -61,7 +61,7 @@ def create_operation do def delete_operation do %Operation{ - tags: ["Emoji Reactions"], + tags: ["Emoji reactions"], summary: "Remove a reaction to a post with a unicode emoji", parameters: [ Operation.parameter(:id, :path, FlakeID, "Status ID", required: true), @@ -78,7 +78,7 @@ def delete_operation do end defp array_of_reactions_response do - Operation.response("Array of Emoji Reactions", "application/json", %Schema{ + Operation.response("Array of Emoji reactions", "application/json", %Schema{ type: :array, items: emoji_reaction(), example: [emoji_reaction().example] diff --git a/lib/pleroma/web/api_spec/operations/filter_operation.ex b/lib/pleroma/web/api_spec/operations/filter_operation.ex index c5b0c035b..42b8fc931 100644 --- a/lib/pleroma/web/api_spec/operations/filter_operation.ex +++ b/lib/pleroma/web/api_spec/operations/filter_operation.ex @@ -15,8 +15,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["apps"], - summary: "View all filters", + tags: ["Filters"], + summary: "All filters", operationId: "FilterController.index", security: [%{"oAuth" => ["read:filters"]}], responses: %{ @@ -27,7 +27,7 @@ def index_operation do def create_operation do %Operation{ - tags: ["apps"], + tags: ["Filters"], summary: "Create a filter", operationId: "FilterController.create", requestBody: Helpers.request_body("Parameters", create_request(), required: true), @@ -38,8 +38,8 @@ def create_operation do def show_operation do %Operation{ - tags: ["apps"], - summary: "View all filters", + tags: ["Filters"], + summary: "Filter", parameters: [id_param()], operationId: "FilterController.show", security: [%{"oAuth" => ["read:filters"]}], @@ -51,7 +51,7 @@ def show_operation do def update_operation do %Operation{ - tags: ["apps"], + tags: ["Filters"], summary: "Update a filter", parameters: [id_param()], operationId: "FilterController.update", @@ -65,7 +65,7 @@ def update_operation do def delete_operation do %Operation{ - tags: ["apps"], + tags: ["Filters"], summary: "Remove a filter", parameters: [id_param()], operationId: "FilterController.delete", diff --git a/lib/pleroma/web/api_spec/operations/follow_request_operation.ex b/lib/pleroma/web/api_spec/operations/follow_request_operation.ex index fc849bcb2..784019699 100644 --- a/lib/pleroma/web/api_spec/operations/follow_request_operation.ex +++ b/lib/pleroma/web/api_spec/operations/follow_request_operation.ex @@ -15,8 +15,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Follow Requests"], - summary: "Pending Follows", + tags: ["Follow requests"], + summary: "Retrieve follow requests", security: [%{"oAuth" => ["read:follows", "follow"]}], operationId: "FollowRequestController.index", responses: %{ @@ -32,8 +32,8 @@ def index_operation do def authorize_operation do %Operation{ - tags: ["Follow Requests"], - summary: "Accept Follow", + tags: ["Follow requests"], + summary: "Accept follow request", operationId: "FollowRequestController.authorize", parameters: [id_param()], security: [%{"oAuth" => ["follow", "write:follows"]}], @@ -45,8 +45,8 @@ def authorize_operation do def reject_operation do %Operation{ - tags: ["Follow Requests"], - summary: "Reject Follow", + tags: ["Follow requests"], + summary: "Reject follow request", operationId: "FollowRequestController.reject", parameters: [id_param()], security: [%{"oAuth" => ["follow", "write:follows"]}], diff --git a/lib/pleroma/web/api_spec/operations/instance_operation.ex b/lib/pleroma/web/api_spec/operations/instance_operation.ex index 8ca82b95c..9384acc32 100644 --- a/lib/pleroma/web/api_spec/operations/instance_operation.ex +++ b/lib/pleroma/web/api_spec/operations/instance_operation.ex @@ -14,7 +14,7 @@ def open_api_operation(action) do def show_operation do %Operation{ tags: ["Instance"], - summary: "Fetch instance", + summary: "Retrieve instance information", description: "Information about the server", operationId: "InstanceController.show", responses: %{ @@ -26,7 +26,7 @@ def show_operation do def peers_operation do %Operation{ tags: ["Instance"], - summary: "List of known hosts", + summary: "Retrieve list of known instances", operationId: "InstanceController.peers", responses: %{ 200 => Operation.response("Array of domains", "application/json", array_of_domains()) diff --git a/lib/pleroma/web/api_spec/operations/list_operation.ex b/lib/pleroma/web/api_spec/operations/list_operation.ex index 62a67cc20..8a6e92b99 100644 --- a/lib/pleroma/web/api_spec/operations/list_operation.ex +++ b/lib/pleroma/web/api_spec/operations/list_operation.ex @@ -20,7 +20,7 @@ def open_api_operation(action) do def index_operation do %Operation{ tags: ["Lists"], - summary: "Show user's lists", + summary: "Retrieve a list of lists", description: "Fetch all lists that the user owns", security: [%{"oAuth" => ["read:lists"]}], operationId: "ListController.index", @@ -33,7 +33,7 @@ def index_operation do def create_operation do %Operation{ tags: ["Lists"], - summary: "Create a list", + summary: "Create a list", description: "Fetch the list with the given ID. Used for verifying the title of a list.", operationId: "ListController.create", requestBody: create_update_request(), @@ -49,7 +49,7 @@ def create_operation do def show_operation do %Operation{ tags: ["Lists"], - summary: "Show a single list", + summary: "Retrieve a list", description: "Fetch the list with the given ID. Used for verifying the title of a list.", operationId: "ListController.show", parameters: [id_param()], @@ -93,7 +93,7 @@ def delete_operation do def list_accounts_operation do %Operation{ tags: ["Lists"], - summary: "View accounts in list", + summary: "Retrieve accounts in list", operationId: "ListController.list_accounts", parameters: [id_param()], security: [%{"oAuth" => ["read:lists"]}], diff --git a/lib/pleroma/web/api_spec/operations/media_operation.ex b/lib/pleroma/web/api_spec/operations/media_operation.ex index 7de0d7da5..85aa14869 100644 --- a/lib/pleroma/web/api_spec/operations/media_operation.ex +++ b/lib/pleroma/web/api_spec/operations/media_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do def create_operation do %Operation{ - tags: ["media"], + tags: ["Media attachments"], summary: "Upload media as attachment", description: "Creates an attachment to be used with a new status.", operationId: "MediaController.create", @@ -56,8 +56,8 @@ defp create_request do def update_operation do %Operation{ - tags: ["media"], - summary: "Upload media as attachment", + tags: ["Media attachments"], + summary: "Update attachment", description: "Creates an attachment to be used with a new status.", operationId: "MediaController.update", security: [%{"oAuth" => ["write:media"]}], @@ -97,8 +97,8 @@ defp update_request do def show_operation do %Operation{ - tags: ["media"], - summary: "Show Uploaded media attachment", + tags: ["Media attachments"], + summary: "Attachment", operationId: "MediaController.show", parameters: [id_param()], security: [%{"oAuth" => ["read:media"]}], @@ -112,8 +112,8 @@ def show_operation do def create2_operation do %Operation{ - tags: ["media"], - summary: "Upload media as attachment", + tags: ["Media attachments"], + summary: "Upload media as attachment (v2)", description: "Creates an attachment to be used with a new status.", operationId: "MediaController.create2", security: [%{"oAuth" => ["write:media"]}], diff --git a/lib/pleroma/web/api_spec/operations/notification_operation.ex b/lib/pleroma/web/api_spec/operations/notification_operation.ex index b7e391264..ec88eabe1 100644 --- a/lib/pleroma/web/api_spec/operations/notification_operation.ex +++ b/lib/pleroma/web/api_spec/operations/notification_operation.ex @@ -22,7 +22,7 @@ def open_api_operation(action) do def index_operation do %Operation{ tags: ["Notifications"], - summary: "Get all notifications", + summary: "Retrieve a list of notifications", description: "Notifications concerning the user. This API returns Link headers containing links to the next/previous page. However, the links can also be constructed dynamically using query params and `id` values.", operationId: "NotificationController.index", @@ -74,7 +74,7 @@ def index_operation do def show_operation do %Operation{ tags: ["Notifications"], - summary: "Get a single notification", + summary: "Retrieve a notification", description: "View information about a notification with a given ID.", operationId: "NotificationController.show", security: [%{"oAuth" => ["read:notifications"]}], @@ -99,7 +99,7 @@ def clear_operation do def dismiss_operation do %Operation{ tags: ["Notifications"], - summary: "Dismiss a single notification", + summary: "Dismiss a notification", description: "Clear a single notification from the server.", operationId: "NotificationController.dismiss", parameters: [id_param()], diff --git a/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex index caa13afee..ad49f6426 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_account_operation.ex @@ -18,8 +18,9 @@ def open_api_operation(action) do def confirmation_resend_operation do %Operation{ - tags: ["Accounts"], - summary: "Resend confirmation email. Expects `email` or `nickname`", + tags: ["Account credentials"], + summary: "Resend confirmation email", + description: "Expects `email` or `nickname`.", operationId: "PleromaAPI.AccountController.confirmation_resend", parameters: [ Operation.parameter(:email, :query, :string, "Email of that needs to be verified", @@ -41,8 +42,10 @@ def confirmation_resend_operation do def favourites_operation do %Operation{ - tags: ["Accounts"], - summary: "Returns favorites timeline of any user", + tags: ["Retrieve account information"], + summary: "Favorites", + description: + "Only returns data if the user has opted into sharing it. See `hide_favorites` in [Update account credentials](#operation/AccountController.update_credentials).", operationId: "PleromaAPI.AccountController.favourites", parameters: [id_param() | pagination_params()], security: [%{"oAuth" => ["read:favourites"]}], @@ -61,8 +64,9 @@ def favourites_operation do def subscribe_operation do %Operation{ - tags: ["Accounts"], - summary: "Subscribe to receive notifications for all statuses posted by a user", + tags: ["Account actions"], + summary: "Subscribe", + description: "Receive notifications for all statuses posted by the account.", operationId: "PleromaAPI.AccountController.subscribe", parameters: [id_param()], security: [%{"oAuth" => ["follow", "write:follows"]}], @@ -75,8 +79,9 @@ def subscribe_operation do def unsubscribe_operation do %Operation{ - tags: ["Accounts"], - summary: "Unsubscribe to stop receiving notifications from user statuses", + tags: ["Account actions"], + summary: "Unsubscribe", + description: "Stop receiving notifications for all statuses posted by the account.", operationId: "PleromaAPI.AccountController.unsubscribe", parameters: [id_param()], security: [%{"oAuth" => ["follow", "write:follows"]}], diff --git a/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex index 7752f4676..12fb8ed36 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_conversation_operation.ex @@ -19,7 +19,7 @@ def open_api_operation(action) do def show_operation do %Operation{ tags: ["Conversations"], - summary: "The conversation with the given ID", + summary: "Conversation", parameters: [ Operation.parameter(:id, :path, :string, "Conversation ID", example: "123", @@ -37,7 +37,7 @@ def show_operation do def statuses_operation do %Operation{ tags: ["Conversations"], - summary: "Timeline for a given conversation", + summary: "Timeline for conversation", parameters: [ Operation.parameter(:id, :path, :string, "Conversation ID", example: "123", @@ -61,7 +61,8 @@ def statuses_operation do def update_operation do %Operation{ tags: ["Conversations"], - summary: "Update a conversation. Used to change the set of recipients.", + summary: "Update conversation", + description: "Change set of recipients for the conversation.", parameters: [ Operation.parameter(:id, :path, :string, "Conversation ID", example: "123", @@ -86,7 +87,7 @@ def update_operation do def mark_as_read_operation do %Operation{ tags: ["Conversations"], - summary: "Marks all user's conversations as read", + summary: "Marks all conversations as read", security: [%{"oAuth" => ["write:conversations"]}], operationId: "PleromaAPI.ConversationController.mark_as_read", responses: %{ diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex index 83981f4e7..bed9511ef 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do def create_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Add new file to the pack", operationId: "PleromaAPI.EmojiPackController.add_file", security: [%{"oAuth" => ["write"]}], @@ -62,7 +62,7 @@ defp create_request do def update_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Add new file to the pack", operationId: "PleromaAPI.EmojiPackController.update_file", security: [%{"oAuth" => ["write"]}], @@ -106,7 +106,7 @@ defp update_request do def delete_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Delete emoji file from pack", operationId: "PleromaAPI.EmojiPackController.delete_file", security: [%{"oAuth" => ["write"]}], diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex index ceff3f67a..48dafa5f2 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do def remote_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Make request to another instance for emoji packs list", security: [%{"oAuth" => ["write"]}], parameters: [ @@ -44,7 +44,7 @@ def remote_operation do def index_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Lists local custom emoji packs", operationId: "PleromaAPI.EmojiPackController.index", parameters: [ @@ -69,7 +69,7 @@ def index_operation do def show_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Show emoji pack", operationId: "PleromaAPI.EmojiPackController.show", parameters: [ @@ -97,7 +97,7 @@ def show_operation do def archive_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Requests a local pack archive from the instance", operationId: "PleromaAPI.EmojiPackController.archive", parameters: [name_param()], @@ -115,7 +115,7 @@ def archive_operation do def download_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Download pack from another instance", operationId: "PleromaAPI.EmojiPackController.download", security: [%{"oAuth" => ["write"]}], @@ -145,7 +145,7 @@ defp download_request do def create_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Create an empty pack", operationId: "PleromaAPI.EmojiPackController.create", security: [%{"oAuth" => ["write"]}], @@ -161,7 +161,7 @@ def create_operation do def delete_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Delete a custom emoji pack", operationId: "PleromaAPI.EmojiPackController.delete", security: [%{"oAuth" => ["write"]}], @@ -177,7 +177,7 @@ def delete_operation do def update_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Updates (replaces) pack metadata", operationId: "PleromaAPI.EmojiPackController.update", security: [%{"oAuth" => ["write"]}], @@ -193,7 +193,7 @@ def update_operation do def import_from_filesystem_operation do %Operation{ - tags: ["Emoji Packs"], + tags: ["Emoji packs"], summary: "Imports packs from filesystem", operationId: "PleromaAPI.EmojiPackController.import", security: [%{"oAuth" => ["write"]}], diff --git a/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex index c9519f769..612113147 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_instances_operation.ex @@ -13,8 +13,8 @@ def open_api_operation(action) do def show_operation do %Operation{ - tags: ["PleromaInstances"], - summary: "Instances federation status", + tags: ["Instance"], + summary: "Retrieve federation status", description: "Information about instances deemed unreachable by the server", operationId: "PleromaInstances.show", responses: %{ diff --git a/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex index 226d95054..6191cb97d 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_mascot_operation.ex @@ -17,7 +17,7 @@ def open_api_operation(action) do def show_operation do %Operation{ tags: ["Mascot"], - summary: "Gets user mascot image", + summary: "Retrieve mascot", security: [%{"oAuth" => ["read:accounts"]}], operationId: "PleromaAPI.MascotController.show", responses: %{ @@ -29,7 +29,7 @@ def show_operation do def update_operation do %Operation{ tags: ["Mascot"], - summary: "Set/clear user avatar image", + summary: "Set or clear mascot", description: "Behaves exactly the same as `POST /api/v1/upload`. Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`.", operationId: "PleromaAPI.MascotController.update", diff --git a/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex index c26fb2736..1dda39240 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_notification_operation.ex @@ -18,7 +18,8 @@ def open_api_operation(action) do def mark_as_read_operation do %Operation{ tags: ["Notifications"], - summary: "Mark notifications as read. Query parameters are mutually exclusive.", + summary: "Mark notifications as read", + description: "Query parameters are mutually exclusive.", requestBody: request_body("Parameters", %Schema{ type: :object, @@ -32,7 +33,7 @@ def mark_as_read_operation do responses: %{ 200 => Operation.response( - "A Notification or array of Motifications", + "A Notification or array of Notifications", "application/json", %Schema{ anyOf: [ diff --git a/lib/pleroma/web/api_spec/operations/report_operation.ex b/lib/pleroma/web/api_spec/operations/report_operation.ex index 792d5cb51..b744efa60 100644 --- a/lib/pleroma/web/api_spec/operations/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/report_operation.ex @@ -16,7 +16,7 @@ def open_api_operation(action) do def create_operation do %Operation{ - tags: ["reports"], + tags: ["Reports"], summary: "File a report", description: "Report problematic users to your moderators", operationId: "ReportController.create", diff --git a/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex b/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex index 873ed3a80..b9c5b35c1 100644 --- a/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex +++ b/lib/pleroma/web/api_spec/operations/scheduled_activity_operation.ex @@ -18,7 +18,7 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Scheduled Statuses"], + tags: ["Scheduled statuses"], summary: "View scheduled statuses", security: [%{"oAuth" => ["read:statuses"]}], parameters: pagination_params(), @@ -35,7 +35,7 @@ def index_operation do def show_operation do %Operation{ - tags: ["Scheduled Statuses"], + tags: ["Scheduled statuses"], summary: "View a single scheduled status", security: [%{"oAuth" => ["read:statuses"]}], parameters: [id_param()], @@ -49,7 +49,7 @@ def show_operation do def update_operation do %Operation{ - tags: ["Scheduled Statuses"], + tags: ["Scheduled statuses"], summary: "Schedule a status", operationId: "ScheduledActivity.update", security: [%{"oAuth" => ["write:statuses"]}], @@ -75,7 +75,7 @@ def update_operation do def delete_operation do %Operation{ - tags: ["Scheduled Statuses"], + tags: ["Scheduled statuses"], summary: "Cancel a scheduled status", security: [%{"oAuth" => ["write:statuses"]}], parameters: [id_param()], diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index fd29f5139..5a5b106f8 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -22,8 +22,8 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Statuses"], - summary: "Get multiple statuses by IDs", + tags: ["Retrieve status information"], + summary: "Multiple statuses", security: [%{"oAuth" => ["read:statuses"]}], parameters: [ Operation.parameter( @@ -48,7 +48,7 @@ def index_operation do def create_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Publish new status", security: [%{"oAuth" => ["write:statuses"]}], description: "Post a new status", @@ -68,8 +68,8 @@ def create_operation do def show_operation do %Operation{ - tags: ["Statuses"], - summary: "View specific status", + tags: ["Retrieve status information"], + summary: "Status", description: "View information about a status", operationId: "StatusController.show", security: [%{"oAuth" => ["read:statuses"]}], @@ -91,8 +91,8 @@ def show_operation do def delete_operation do %Operation{ - tags: ["Statuses"], - summary: "Delete status", + tags: ["Status actions"], + summary: "Delete", security: [%{"oAuth" => ["write:statuses"]}], description: "Delete one of your own statuses", operationId: "StatusController.delete", @@ -107,8 +107,8 @@ def delete_operation do def reblog_operation do %Operation{ - tags: ["Statuses"], - summary: "Boost", + tags: ["Status actions"], + summary: "Reblog", security: [%{"oAuth" => ["write:statuses"]}], description: "Share a status", operationId: "StatusController.reblog", @@ -129,8 +129,8 @@ def reblog_operation do def unreblog_operation do %Operation{ - tags: ["Statuses"], - summary: "Undo boost", + tags: ["Status actions"], + summary: "Undo reblog", security: [%{"oAuth" => ["write:statuses"]}], description: "Undo a reshare of a status", operationId: "StatusController.unreblog", @@ -144,7 +144,7 @@ def unreblog_operation do def favourite_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Favourite", security: [%{"oAuth" => ["write:favourites"]}], description: "Add a status to your favourites list", @@ -159,7 +159,7 @@ def favourite_operation do def unfavourite_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Undo favourite", security: [%{"oAuth" => ["write:favourites"]}], description: "Remove a status from your favourites list", @@ -174,7 +174,7 @@ def unfavourite_operation do def pin_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Pin to profile", security: [%{"oAuth" => ["write:accounts"]}], description: "Feature one of your own public statuses at the top of your profile", @@ -189,8 +189,8 @@ def pin_operation do def unpin_operation do %Operation{ - tags: ["Statuses"], - summary: "Unpin to profile", + tags: ["Status actions"], + summary: "Unpin from profile", security: [%{"oAuth" => ["write:accounts"]}], description: "Unfeature a status from the top of your profile", operationId: "StatusController.unpin", @@ -204,7 +204,7 @@ def unpin_operation do def bookmark_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Bookmark", security: [%{"oAuth" => ["write:bookmarks"]}], description: "Privately bookmark a status", @@ -218,7 +218,7 @@ def bookmark_operation do def unbookmark_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Undo bookmark", security: [%{"oAuth" => ["write:bookmarks"]}], description: "Remove a status from your private bookmarks", @@ -232,7 +232,7 @@ def unbookmark_operation do def mute_conversation_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Mute conversation", security: [%{"oAuth" => ["write:mutes"]}], description: "Do not receive notifications for the thread that this status is part of.", @@ -267,7 +267,7 @@ def mute_conversation_operation do def unmute_conversation_operation do %Operation{ - tags: ["Statuses"], + tags: ["Status actions"], summary: "Unmute conversation", security: [%{"oAuth" => ["write:mutes"]}], description: @@ -283,7 +283,7 @@ def unmute_conversation_operation do def card_operation do %Operation{ - tags: ["Statuses"], + tags: ["Retrieve status information"], deprecated: true, summary: "Preview card", description: "Deprecated in favor of card property inlined on Status entity", @@ -311,7 +311,7 @@ def card_operation do def favourited_by_operation do %Operation{ - tags: ["Statuses"], + tags: ["Retrieve status information"], summary: "Favourited by", description: "View who favourited a given status", operationId: "StatusController.favourited_by", @@ -331,9 +331,9 @@ def favourited_by_operation do def reblogged_by_operation do %Operation{ - tags: ["Statuses"], - summary: "Boosted by", - description: "View who boosted a given status", + tags: ["Retrieve status information"], + summary: "Reblogged by", + description: "View who reblogged a given status", operationId: "StatusController.reblogged_by", security: [%{"oAuth" => ["read:accounts"]}], parameters: [id_param()], @@ -351,7 +351,7 @@ def reblogged_by_operation do def context_operation do %Operation{ - tags: ["Statuses"], + tags: ["Retrieve status information"], summary: "Parent and child statuses", description: "View statuses above and below this status in the thread", operationId: "StatusController.context", @@ -365,7 +365,7 @@ def context_operation do def favourites_operation do %Operation{ - tags: ["Statuses"], + tags: ["Timelines"], summary: "Favourited statuses", description: "Statuses the user has favourited. Please note that you have to use the link headers to paginate this. You can not build the query parameters yourself.", @@ -380,7 +380,7 @@ def favourites_operation do def bookmarks_operation do %Operation{ - tags: ["Statuses"], + tags: ["Timelines"], summary: "Bookmarked statuses", description: "Statuses the user has bookmarked", operationId: "StatusController.bookmarks", diff --git a/lib/pleroma/web/api_spec/operations/subscription_operation.ex b/lib/pleroma/web/api_spec/operations/subscription_operation.ex index 1374a6ff4..60a7fb3b0 100644 --- a/lib/pleroma/web/api_spec/operations/subscription_operation.ex +++ b/lib/pleroma/web/api_spec/operations/subscription_operation.ex @@ -17,7 +17,7 @@ def open_api_operation(action) do def create_operation do %Operation{ - tags: ["Push Subscriptions"], + tags: ["Push subscriptions"], summary: "Subscribe to push notifications", description: "Add a Web Push API subscription to receive notifications. Each access token can have one push subscription. If you create a new subscription, the old subscription is deleted.", @@ -25,7 +25,7 @@ def create_operation do security: [%{"oAuth" => ["push"]}], requestBody: Helpers.request_body("Parameters", create_request(), required: true), responses: %{ - 200 => Operation.response("Push Subscription", "application/json", PushSubscription), + 200 => Operation.response("Push subscription", "application/json", PushSubscription), 400 => Operation.response("Error", "application/json", ApiError), 403 => Operation.response("Error", "application/json", ApiError) } @@ -34,13 +34,13 @@ def create_operation do def show_operation do %Operation{ - tags: ["Push Subscriptions"], + tags: ["Push subscriptions"], summary: "Get current subscription", description: "View the PushSubscription currently associated with this access token.", operationId: "SubscriptionController.show", security: [%{"oAuth" => ["push"]}], responses: %{ - 200 => Operation.response("Push Subscription", "application/json", PushSubscription), + 200 => Operation.response("Push subscription", "application/json", PushSubscription), 403 => Operation.response("Error", "application/json", ApiError), 404 => Operation.response("Error", "application/json", ApiError) } @@ -49,7 +49,7 @@ def show_operation do def update_operation do %Operation{ - tags: ["Push Subscriptions"], + tags: ["Push subscriptions"], summary: "Change types of notifications", description: "Updates the current push subscription. Only the data part can be updated. To change fundamentals, a new subscription must be created instead.", @@ -57,7 +57,7 @@ def update_operation do security: [%{"oAuth" => ["push"]}], requestBody: Helpers.request_body("Parameters", update_request(), required: true), responses: %{ - 200 => Operation.response("Push Subscription", "application/json", PushSubscription), + 200 => Operation.response("Push subscription", "application/json", PushSubscription), 403 => Operation.response("Error", "application/json", ApiError) } } @@ -65,7 +65,7 @@ def update_operation do def delete_operation do %Operation{ - tags: ["Push Subscriptions"], + tags: ["Push subscriptions"], summary: "Remove current subscription", description: "Removes the current Web Push API subscription.", operationId: "SubscriptionController.delete", diff --git a/lib/pleroma/web/api_spec/operations/timeline_operation.ex b/lib/pleroma/web/api_spec/operations/timeline_operation.ex index e1ebdab38..44f5fb0bd 100644 --- a/lib/pleroma/web/api_spec/operations/timeline_operation.ex +++ b/lib/pleroma/web/api_spec/operations/timeline_operation.ex @@ -41,8 +41,7 @@ def direct_operation do tags: ["Timelines"], summary: "Direct timeline", description: - "View statuses with a “direct” privacy, from your account or in your notifications", - deprecated: true, + "View statuses with a “direct” scope addressed to the account. Using this endpoint is discouraged, please use [conversations](#tag/Conversations) or [chats](#tag/Chats).", parameters: [with_muted_param() | pagination_params()], security: [%{"oAuth" => ["read:statuses"]}], operationId: "TimelineController.direct", diff --git a/lib/pleroma/web/api_spec/operations/user_import_operation.ex b/lib/pleroma/web/api_spec/operations/user_import_operation.ex index 859404ded..6292e2004 100644 --- a/lib/pleroma/web/api_spec/operations/user_import_operation.ex +++ b/lib/pleroma/web/api_spec/operations/user_import_operation.ex @@ -17,8 +17,8 @@ def open_api_operation(action) do def follow_operation do %Operation{ - tags: ["follow_import"], - summary: "Imports your follows.", + tags: ["Data import"], + summary: "Import follows", operationId: "UserImportController.follow", requestBody: request_body("Parameters", import_request(), required: true), responses: %{ @@ -31,8 +31,8 @@ def follow_operation do def blocks_operation do %Operation{ - tags: ["blocks_import"], - summary: "Imports your blocks.", + tags: ["Data import"], + summary: "Import blocks", operationId: "UserImportController.blocks", requestBody: request_body("Parameters", import_request(), required: true), responses: %{ @@ -45,8 +45,8 @@ def blocks_operation do def mutes_operation do %Operation{ - tags: ["mutes_import"], - summary: "Imports your mutes.", + tags: ["Data import"], + summary: "Import mutes", operationId: "UserImportController.mutes", requestBody: request_body("Parameters", import_request(), required: true), responses: %{ -- cgit v1.2.3 From 00268b4476dc7bcd85da9b96c44314ddb5a70a07 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 3 Feb 2021 17:02:01 +0300 Subject: CI: Add job ref when calling api docs builder Just grabbing the latest artifact for the branch does not work because gitlab will only change the latest artifact when the whole pipeline finishes --- .gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 634c4b893..ed145df52 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -165,13 +165,16 @@ review_app: spec-deploy: stage: deploy + artifacts: + paths: + - spec.json only: - develop@pleroma/pleroma image: alpine:latest before_script: - apk add curl script: - - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline + - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline stop_review_app: -- cgit v1.2.3 From c47ca9959292fdd9058ab98b922139be07198946 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 3 Feb 2021 18:00:04 +0300 Subject: CI: Forgot $ in spec-deploy --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ed145df52..0fec89368 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -174,7 +174,7 @@ spec-deploy: before_script: - apk add curl script: - - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline + - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline stop_review_app: -- cgit v1.2.3 From 74ef1a044d965cb20154c051d42fc183dc8ee0c2 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 3 Feb 2021 18:10:43 +0300 Subject: Account schema: specify that pleroma.relationship is nullable --- lib/pleroma/web/api_spec/helpers.ex | 2 +- lib/pleroma/web/api_spec/schemas/account.ex | 2 +- lib/pleroma/web/api_spec/schemas/account_relationship.ex | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/api_spec/helpers.ex b/lib/pleroma/web/api_spec/helpers.ex index 6babe0b28..6f67339e6 100644 --- a/lib/pleroma/web/api_spec/helpers.ex +++ b/lib/pleroma/web/api_spec/helpers.ex @@ -63,7 +63,7 @@ def with_relationships_param do :with_relationships, :query, BooleanLike, - "Embed relationships into accounts." + "Embed relationships into accounts. **If this parameter is not set account's `pleroma.relationship` is going to be `null`.**" ) end diff --git a/lib/pleroma/web/api_spec/schemas/account.ex b/lib/pleroma/web/api_spec/schemas/account.ex index 4f9b564d1..bd7143ab9 100644 --- a/lib/pleroma/web/api_spec/schemas/account.ex +++ b/lib/pleroma/web/api_spec/schemas/account.ex @@ -96,7 +96,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Account do hide_notification_contents: %Schema{type: :boolean} } }, - relationship: AccountRelationship, + relationship: %Schema{allOf: [AccountRelationship], nullable: true}, settings_store: %Schema{ type: :object, description: diff --git a/lib/pleroma/web/api_spec/schemas/account_relationship.ex b/lib/pleroma/web/api_spec/schemas/account_relationship.ex index 2cda19631..16b73ebb4 100644 --- a/lib/pleroma/web/api_spec/schemas/account_relationship.ex +++ b/lib/pleroma/web/api_spec/schemas/account_relationship.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.AccountRelationship do OpenApiSpex.schema(%{ title: "AccountRelationship", - description: "Response schema for relationship", + description: "Relationship between current account and requested account", type: :object, properties: %{ blocked_by: %Schema{type: :boolean}, -- cgit v1.2.3 From 76f732766ba36c3a94cf6b8b39fb745c1cf3f49a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 3 Feb 2021 12:32:44 -0600 Subject: Exclude reporter from receiving notifications from their own reports. Currently only works if the reporting actor is an admin, but if we include moderators with those who receive notification reports it will work for them. --- lib/pleroma/notification.ex | 4 ++-- lib/pleroma/web/activity_pub/activity_pub.ex | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 55b513212..1970fbf65 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -507,8 +507,8 @@ def get_potential_receiver_ap_ids(%{data: %{"type" => "Follow", "object" => obje [object_id] end - def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag"}}) do - User.all_superusers() |> Enum.map(fn user -> user.ap_id end) + def get_potential_receiver_ap_ids(%{data: %{"type" => "Flag", "actor" => actor}}) do + (User.all_superusers() |> Enum.map(fn user -> user.ap_id end)) -- [actor] end def get_potential_receiver_ap_ids(activity) do diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 1a84375fb..5b45e2ca1 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -377,6 +377,7 @@ defp do_flag( :ok <- maybe_federate(stripped_activity) do User.all_superusers() + |> Enum.filter(fn user -> user.ap_id != actor end) |> Enum.filter(fn user -> not is_nil(user.email) end) |> Enum.each(fn superuser -> superuser -- cgit v1.2.3 From 5bb5949048b6eeb236cca450c8399ac412fbd2a8 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 3 Feb 2021 12:54:53 -0600 Subject: Validate admin making report doesn't get their own report notification, but other admins do --- test/pleroma/notification_test.exs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs index 0c6ebfb76..948587292 100644 --- a/test/pleroma/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -45,6 +45,20 @@ test "creates a notification for a report" do assert notification.type == "pleroma:report" end + test "suppresses notification to reporter if reporter is an admin" do + reporting_admin = insert(:user, is_admin: true) + reported_user = insert(:user) + other_admin = insert(:user, is_admin: true) + + {:ok, activity} = CommonAPI.report(reporting_admin, %{account_id: reported_user.id}) + + {:ok, [notification]} = Notification.create_notifications(activity) + + refute notification.user_id == reporting_admin.id + assert notification.user_id == other_admin.id + assert notification.type == "pleroma:report" + end + test "creates a notification for an emoji reaction" do user = insert(:user) other_user = insert(:user) -- cgit v1.2.3 From 000d3365c391fb3613c5365f73f5bd51d2555840 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 3 Feb 2021 14:52:49 -0600 Subject: Document admin actors not getting report notifications --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47009abc9..777847fa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script - Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address. +- Admins no longer receive notifications for reports if they are the actor making the report.
API Changes -- cgit v1.2.3 From 887db076b55764f1cc7757df06f5ff8587de9798 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 3 Feb 2021 16:36:45 -0600 Subject: Load an emoji.txt specific to the test env --- config/emoji.txt | 1 - lib/pleroma/emoji/loader.ex | 11 ++++++++++- test/config/emoji.txt | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 test/config/emoji.txt diff --git a/config/emoji.txt b/config/emoji.txt index a2c5add2e..52b714ee5 100644 --- a/config/emoji.txt +++ b/config/emoji.txt @@ -1,4 +1,3 @@ firefox, /emoji/Firefox.gif, Gif,Fun blank, /emoji/blank.png, Fun dinosaur, /emoji/dino walking.gif, Gif -external_emoji, https://example.com/emoji.png diff --git a/lib/pleroma/emoji/loader.ex b/lib/pleroma/emoji/loader.ex index 028cf5ea8..cc25dabf9 100644 --- a/lib/pleroma/emoji/loader.ex +++ b/lib/pleroma/emoji/loader.ex @@ -77,10 +77,19 @@ def load do # it should run even if there are no emoji packs shortcode_globs = Config.get([:emoji, :shortcode_globs], []) + # for testing emoji.txt entries we do not want exposed in normal operation + test_emoji = + if Mix.env() == :test do + load_from_file("test/config/emoji.txt", emoji_groups) + else + [] + end + emojis_txt = (load_from_file("config/emoji.txt", emoji_groups) ++ load_from_file("config/custom_emoji.txt", emoji_groups) ++ - load_from_globs(shortcode_globs, emoji_groups)) + load_from_globs(shortcode_globs, emoji_groups) ++ + test_emoji) |> Enum.reject(fn value -> value == nil end) Enum.map(emojis ++ emojis_txt, &prepare_emoji/1) diff --git a/test/config/emoji.txt b/test/config/emoji.txt new file mode 100644 index 000000000..14dd0c332 --- /dev/null +++ b/test/config/emoji.txt @@ -0,0 +1 @@ +external_emoji, https://example.com/emoji.png -- cgit v1.2.3 From ecff02741817e5622da58365855dce09c789ca83 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 3 Feb 2021 17:53:09 +0100 Subject: Redirect non-local activities when /notice/:id is used Related-to: https://git.pleroma.social/pleroma/pleroma/-/issues/2496 --- CHANGELOG.md | 1 + lib/pleroma/web/o_status/o_status_controller.ex | 8 ++------ test/pleroma/web/o_status/o_status_controller_test.exs | 16 +++++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f439d3a4..e9dfac97e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script - Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address. +- Provide redirect of external posts from `/notice/:id` to their original URL ### Added diff --git a/lib/pleroma/web/o_status/o_status_controller.ex b/lib/pleroma/web/o_status/o_status_controller.ex index 450aae042..da3264149 100644 --- a/lib/pleroma/web/o_status/o_status_controller.ex +++ b/lib/pleroma/web/o_status/o_status_controller.ex @@ -73,12 +73,8 @@ def notice(%{assigns: %{format: format}} = conn, %{"id" => id}) do %User{} = user <- User.get_cached_by_ap_id(activity.data["actor"]) do cond do format in ["json", "activity+json"] -> - if activity.local do - %{data: %{"id" => redirect_url}} = Object.normalize(activity, fetch: false) - redirect(conn, external: redirect_url) - else - {:error, :not_found} - end + %{data: %{"id" => redirect_url}} = Object.normalize(activity, fetch: false) + redirect(conn, external: redirect_url) activity.data["type"] == "Create" -> %Object{} = object = Object.normalize(activity, fetch: false) diff --git a/test/pleroma/web/o_status/o_status_controller_test.exs b/test/pleroma/web/o_status/o_status_controller_test.exs index 5cdca019a..2038f4ddd 100644 --- a/test/pleroma/web/o_status/o_status_controller_test.exs +++ b/test/pleroma/web/o_status/o_status_controller_test.exs @@ -144,13 +144,19 @@ test "redirects to a proper object URL when json requested and the object is loc assert redirect_url == expected_redirect_url end - test "returns a 404 on remote notice when json requested", %{conn: conn} do + test "redirects to a proper object URL when json requested and the object is remote", %{ + conn: conn + } do note_activity = insert(:note_activity, local: false) + expected_redirect_url = Object.normalize(note_activity, fetch: false).data["id"] - conn - |> put_req_header("accept", "application/activity+json") - |> get("/notice/#{note_activity.id}") - |> response(404) + redirect_url = + conn + |> put_req_header("accept", "application/activity+json") + |> get("/notice/#{note_activity.id}") + |> redirected_to() + + assert redirect_url == expected_redirect_url end test "500s when actor not found", %{conn: conn} do -- cgit v1.2.3 From bf9cd4a0e24e2279a7560f6fb5e58d2d69362125 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 10:11:48 -0600 Subject: Standardize the way we capture and use Mix.env() --- lib/pleroma/application.ex | 10 +++++----- lib/pleroma/emoji/loader.ex | 4 +++- lib/pleroma/uploaders/uploader.ex | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 9e262235e..375507de1 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -14,7 +14,7 @@ defmodule Pleroma.Application do @name Mix.Project.config()[:name] @version Mix.Project.config()[:version] @repository Mix.Project.config()[:source_url] - @env Mix.env() + @mix_env Mix.env() def name, do: @name def version, do: @version @@ -92,15 +92,15 @@ def start(_type, _args) do Pleroma.Web.Plugs.RateLimiter.Supervisor ] ++ cachex_children() ++ - http_children(adapter, @env) ++ + http_children(adapter, @mix_env) ++ [ Pleroma.Stats, Pleroma.JobQueueMonitor, {Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]}, {Oban, Config.get(Oban)} ] ++ - task_children(@env) ++ - dont_run_in_test(@env) ++ + task_children(@mix_env) ++ + dont_run_in_test(@mix_env) ++ chat_child(chat_enabled?()) ++ [ Pleroma.Web.Endpoint, @@ -145,7 +145,7 @@ def load_custom_modules do raise "Invalid custom modules" {:ok, modules, _warnings} -> - if @env != :test do + if @mix_env != :test do Enum.each(modules, fn mod -> Logger.info("Custom module loaded: #{inspect(mod)}") end) diff --git a/lib/pleroma/emoji/loader.ex b/lib/pleroma/emoji/loader.ex index cc25dabf9..67acd7069 100644 --- a/lib/pleroma/emoji/loader.ex +++ b/lib/pleroma/emoji/loader.ex @@ -15,6 +15,8 @@ defmodule Pleroma.Emoji.Loader do require Logger + @mix_env Mix.env() + @type pattern :: Regex.t() | module() | String.t() @type patterns :: pattern() | [pattern()] @type group_patterns :: keyword(patterns()) @@ -79,7 +81,7 @@ def load do # for testing emoji.txt entries we do not want exposed in normal operation test_emoji = - if Mix.env() == :test do + if @mix_env == :test do load_from_file("test/config/emoji.txt", emoji_groups) else [] diff --git a/lib/pleroma/uploaders/uploader.ex b/lib/pleroma/uploaders/uploader.ex index af99d001c..0be878ca2 100644 --- a/lib/pleroma/uploaders/uploader.ex +++ b/lib/pleroma/uploaders/uploader.ex @@ -5,6 +5,8 @@ defmodule Pleroma.Uploaders.Uploader do import Pleroma.Web.Gettext + @mix_env Mix.env() + @moduledoc """ Defines the contract to put and get an uploaded file to any backend. """ @@ -74,7 +76,7 @@ defp handle_callback(uploader, upload) do end defp callback_timeout do - case Mix.env() do + case @mix_env do :test -> 1_000 _ -> 30_000 end -- cgit v1.2.3 From b22b12f73813b9c46701cac84cfe3a21a5ceacca Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 14:01:15 -0600 Subject: These welcome emails are not guaranteed and can be private functions --- lib/pleroma/user.ex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index b69709db4..6aab247d1 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -814,9 +814,9 @@ def post_register_action(%User{is_approved: true, is_confirmed: true} = user) do with {:ok, user} <- autofollow_users(user), {:ok, _} <- autofollowing_users(user), {:ok, user} <- set_cache(user), - {:ok, _} <- send_welcome_email(user), - {:ok, _} <- send_welcome_message(user), - {:ok, _} <- send_welcome_chat_message(user) do + {:ok, _} <- maybe_send_welcome_email(user), + {:ok, _} <- maybe_send_welcome_message(user), + {:ok, _} <- maybe_send_welcome_chat_message(user) do {:ok, user} end end @@ -841,7 +841,7 @@ defp send_admin_approval_emails(user) do {:ok, :enqueued} end - def send_welcome_message(user) do + defp maybe_send_welcome_message(user) do if User.WelcomeMessage.enabled?() do User.WelcomeMessage.post_message(user) {:ok, :enqueued} @@ -850,7 +850,7 @@ def send_welcome_message(user) do end end - def send_welcome_chat_message(user) do + defp maybe_send_welcome_chat_message(user) do if User.WelcomeChatMessage.enabled?() do User.WelcomeChatMessage.post_message(user) {:ok, :enqueued} @@ -859,7 +859,7 @@ def send_welcome_chat_message(user) do end end - def send_welcome_email(%User{email: email} = user) when is_binary(email) do + defp maybe_send_welcome_email(%User{email: email} = user) when is_binary(email) do if User.WelcomeEmail.enabled?() do User.WelcomeEmail.send_email(user) {:ok, :enqueued} @@ -868,7 +868,7 @@ def send_welcome_email(%User{email: email} = user) when is_binary(email) do end end - def send_welcome_email(_), do: {:ok, :noop} + defp maybe_send_welcome_email(_), do: {:ok, :noop} @spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop} def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user) -- cgit v1.2.3 From af37a5c51a3984d8e5ddbe5978b8c3edb7f9bbc2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 14:33:49 -0600 Subject: Also make this maybe_ for consistency --- lib/mix/tasks/pleroma/email.ex | 2 +- lib/pleroma/user.ex | 8 ++++---- lib/pleroma/web/pleroma_api/controllers/account_controller.ex | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/mix/tasks/pleroma/email.ex b/lib/mix/tasks/pleroma/email.ex index e05c207e5..4ce8c9b05 100644 --- a/lib/mix/tasks/pleroma/email.ex +++ b/lib/mix/tasks/pleroma/email.ex @@ -38,7 +38,7 @@ def run(["resend_confirmation_emails"]) do invisible: false }) |> Pleroma.Repo.chunk_stream(500) - |> Stream.each(&Pleroma.User.try_send_confirmation_email(&1)) + |> Stream.each(&Pleroma.User.maybe_send_confirmation_email(&1)) |> Stream.run() end end diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 6aab247d1..7a7956c8f 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -798,7 +798,7 @@ def register(%Ecto.Changeset{} = changeset) do end def post_register_action(%User{is_confirmed: false} = user) do - with {:ok, _} <- try_send_confirmation_email(user) do + with {:ok, _} <- maybe_send_confirmation_email(user) do {:ok, user} end end @@ -870,8 +870,8 @@ defp maybe_send_welcome_email(%User{email: email} = user) when is_binary(email) defp maybe_send_welcome_email(_), do: {:ok, :noop} - @spec try_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop} - def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user) + @spec maybe_send_confirmation_email(User.t()) :: {:ok, :enqueued | :noop} + def maybe_send_confirmation_email(%User{is_confirmed: false, email: email} = user) when is_binary(email) do if Config.get([:instance, :account_activation_required]) do send_confirmation_email(user) @@ -881,7 +881,7 @@ def try_send_confirmation_email(%User{is_confirmed: false, email: email} = user) end end - def try_send_confirmation_email(_), do: {:ok, :noop} + def maybe_send_confirmation_email(_), do: {:ok, :noop} @spec send_confirmation_email(Uset.t()) :: User.t() def send_confirmation_email(%User{} = user) do diff --git a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex index bca8e679c..165afd3b4 100644 --- a/lib/pleroma/web/pleroma_api/controllers/account_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/account_controller.ex @@ -56,7 +56,7 @@ def confirmation_resend(conn, params) do nickname_or_email = params[:email] || params[:nickname] with %User{} = user <- User.get_by_nickname_or_email(nickname_or_email), - {:ok, _} <- User.try_send_confirmation_email(user) do + {:ok, _} <- User.maybe_send_confirmation_email(user) do json_response(conn, :no_content, "") end end -- cgit v1.2.3 From 2956c21a55518f5f6f6648cc2d25f2b2114dc20f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 15:10:43 -0600 Subject: Improve confirmation email language --- lib/pleroma/emails/user_email.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index dbd89f1c7..0c00069e2 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -81,9 +81,9 @@ def account_confirmation_email(user) do ) html_body = """ -

Welcome to #{instance_name()}!

+

Thank you for registering on #{instance_name()}

Email confirmation is required to activate the account.

-

Click the following link to proceed: activate your account.

+

Please click the following link to activate your account.

""" new() -- cgit v1.2.3 From e945ccc91bbc7c3479e842feb276c5efff30eed2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 15:16:50 -0600 Subject: Add a registration email that only sends if no other emails (welcome, approval, confirmation) are enabled --- lib/pleroma/emails/user_email.ex | 14 ++++++++++++++ lib/pleroma/user.ex | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index 0c00069e2..a5233f373 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -106,6 +106,20 @@ def approval_pending_email(user) do |> html_body(html_body) end + def successful_registration_email(user) do + html_body = """ +

Hello @#{user.nickname}

+

Your account at #{instance_name()} has been registered successfully.

+

No further action is required to activate your account.

+ """ + + new() + |> to(recipient(user)) + |> from(sender()) + |> subject("Account registered on #{instance_name()}") + |> html_body(html_body) + end + @doc """ Email used in digest email notifications Includes Mentions and New Followers data diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 7a7956c8f..1d7cb22b2 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -814,6 +814,7 @@ def post_register_action(%User{is_approved: true, is_confirmed: true} = user) do with {:ok, user} <- autofollow_users(user), {:ok, _} <- autofollowing_users(user), {:ok, user} <- set_cache(user), + {:ok, _} <- maybe_send_registration_email(user), {:ok, _} <- maybe_send_welcome_email(user), {:ok, _} <- maybe_send_welcome_message(user), {:ok, _} <- maybe_send_welcome_chat_message(user) do @@ -892,6 +893,23 @@ def send_confirmation_email(%User{} = user) do user end + @spec maybe_send_registration_email(User.t()) :: {:ok, :enqueued | :noop} + defp maybe_send_registration_email(%User{email: email} = user) when is_binary(email) do + with false <- User.WelcomeEmail.enabled?(), + false <- Config.get([:instance, :account_activation_required], false), + false <- Config.get([:instance, :account_approval_required], false) do + user + |> Pleroma.Emails.UserEmail.successful_registration_email() + + {:ok, :enqueued} + else + _ -> + {:ok, :noop} + end + end + + defp maybe_send_registration_email(_), do: {:ok, :noop} + def needs_update?(%User{local: true}), do: false def needs_update?(%User{local: false, last_refreshed_at: nil}), do: true -- cgit v1.2.3 From 2a863987bc41c5fed26f430f47548a1cf49030ed Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 16:14:37 -0600 Subject: Added: New user registration mail --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbdb3f4e..c1e490c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to set ActivityPub aliases for follower migration. - Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy - Ability to define custom HTTP headers per each frontend +- New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required)
API Changes -- cgit v1.2.3 From 95930a7aa5b06ded61a2694989531846a527d0ed Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 17:42:09 -0600 Subject: Actually send the mail --- lib/pleroma/user.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 1d7cb22b2..51f5bc8ea 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -900,6 +900,7 @@ defp maybe_send_registration_email(%User{email: email} = user) when is_binary(em false <- Config.get([:instance, :account_approval_required], false) do user |> Pleroma.Emails.UserEmail.successful_registration_email() + |> Pleroma.Emails.Mailer.deliver_async() {:ok, :enqueued} else -- cgit v1.2.3 From c3614403966ddddeddecd45d97fdda8f2879cd32 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 4 Feb 2021 17:56:46 -0600 Subject: Add basic test to validate the registration email is dispatched when the others are disabled Also only check for subject as the body is a mess of html and we don't really need to prove its contents if the subject matches. --- test/pleroma/user_test.exs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index be39339f3..86f050fd1 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -551,6 +551,26 @@ test "sends a pending approval email" do ) end + test "it sends a registration confirmed email if no others will be sent" do + clear_config([:welcome, :email, :enabled], false) + clear_config([:instance, :account_activation_required], false) + clear_config([:instance, :account_approval_required], false) + + {:ok, user} = + User.register_changeset(%User{}, @full_user_data) + |> User.register() + ObanHelpers.perform_all() + + instance_name = Pleroma.Config.get([:instance, :name]) + sender = Pleroma.Config.get([:instance, :notify_email]) + + assert_email_sent( + from: {instance_name, sender}, + to: {user.name, user.email}, + subject: "Account registered on #{instance_name}" + ) + end + test "it requires an email, name, nickname and password, bio is optional when account_activation_required is enabled" do clear_config([:instance, :account_activation_required], true) -- cgit v1.2.3 From 6a3e75c8e65c11794bef8688464ce03ad978d7f1 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 5 Feb 2021 09:00:17 -0600 Subject: Lint --- test/pleroma/user_test.exs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 86f050fd1..6f5bcab57 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -559,6 +559,7 @@ test "it sends a registration confirmed email if no others will be sent" do {:ok, user} = User.register_changeset(%User{}, @full_user_data) |> User.register() + ObanHelpers.perform_all() instance_name = Pleroma.Config.get([:instance, :name]) -- cgit v1.2.3 From 5df9f68392f65a5688867b9bad4bda766e492923 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 5 Feb 2021 09:13:17 -0600 Subject: Add plaintext support for all emails except the digest --- lib/pleroma/emails/user_email.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index a5233f373..74e3e6f41 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -8,6 +8,7 @@ defmodule Pleroma.Emails.UserEmail do use Phoenix.Swoosh, view: Pleroma.Web.EmailView, layout: {Pleroma.Web.LayoutView, :email} alias Pleroma.Config + alias Pleroma.HTML alias Pleroma.User alias Pleroma.Web.Endpoint alias Pleroma.Web.Router @@ -43,6 +44,7 @@ def password_reset_email(user, token) when is_binary(token) do |> from(sender()) |> subject("Password reset") |> html_body(html_body) + |> text_body(HTML.strip_tags(html_body)) end def user_invitation_email( @@ -69,6 +71,7 @@ def user_invitation_email( |> from(sender()) |> subject("Invitation to #{instance_name()}") |> html_body(html_body) + |> text_body(HTML.strip_tags(html_body)) end def account_confirmation_email(user) do @@ -91,6 +94,7 @@ def account_confirmation_email(user) do |> from(sender()) |> subject("#{instance_name()} account confirmation") |> html_body(html_body) + |> text_body(HTML.strip_tags(html_body)) end def approval_pending_email(user) do @@ -104,6 +108,7 @@ def approval_pending_email(user) do |> from(sender()) |> subject("Your account is awaiting approval") |> html_body(html_body) + |> text_body(HTML.strip_tags(html_body)) end def successful_registration_email(user) do @@ -118,6 +123,7 @@ def successful_registration_email(user) do |> from(sender()) |> subject("Account registered on #{instance_name()}") |> html_body(html_body) + |> text_body(HTML.strip_tags(html_body)) end @doc """ @@ -241,5 +247,6 @@ def backup_is_ready_email(backup, admin_user_id \\ nil) do |> from(sender()) |> subject("Your account archive is ready") |> html_body(html_body) + |> text_body(HTML.strip_tags(html_body)) end end -- cgit v1.2.3 From 0368419fce04f636d2c5adcf44e7d35c43279dc1 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 5 Feb 2021 09:13:53 -0600 Subject: Slightly better formatting --- lib/pleroma/emails/user_email.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index 74e3e6f41..e5a6feed9 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -113,7 +113,7 @@ def approval_pending_email(user) do def successful_registration_email(user) do html_body = """ -

Hello @#{user.nickname}

+

Hello @#{user.nickname},

Your account at #{instance_name()} has been registered successfully.

No further action is required to activate your account.

""" -- cgit v1.2.3 From 1d8f1fe0772736dd71219d244783c9d671dd7223 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 5 Feb 2021 13:32:21 -0600 Subject: Add a default rule to not attempt to cache any files larger than 50MB This fixes connection failures when trying to retrieve large files. It is less common in typical Pleroma usage, but it's possible to encounter this on a cloud instance with lower memory. --- installation/pleroma.vcl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/installation/pleroma.vcl b/installation/pleroma.vcl index 13dad784c..4752510ea 100644 --- a/installation/pleroma.vcl +++ b/installation/pleroma.vcl @@ -59,6 +59,13 @@ sub vcl_backend_response { set beresp.http.CR = beresp.http.content-range; } + # Bypass cache for large files + # 50000000 ~ 50MB + if (std.integer(beresp.http.content-length, 0) > 50000000) { + set beresp.uncacheable = true; + return(deliver); + } + # Don't cache objects that require authentication if (beresp.http.Authorization && !beresp.http.Cache-Control ~ "public") { set beresp.uncacheable = true; -- cgit v1.2.3 From 8d4e0342e1b5ebbe486dc538e3c8fe81d53220e6 Mon Sep 17 00:00:00 2001 From: hyperion <8027-hyperion@users.noreply.git.pleroma.social> Date: Sat, 6 Feb 2021 09:42:17 +0000 Subject: Update priv/repo/migrations/20190501125843_add_fts_index_to_objects.exs, priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs files --- docs/administration/CLI_tasks/database.md | 18 +++++++++ docs/configuration/howto_search_cjk.md | 42 +++++++++++++++++++ lib/mix/tasks/pleroma/database.ex | 47 ++++++++++++++++++++++ lib/pleroma/activity/search.ex | 8 ++-- ...210121080964_add_default_text_search_config.exs | 11 +++++ ...20190510135645_add_fts_index_to_objects_two.exs | 2 +- 6 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 docs/configuration/howto_search_cjk.md create mode 100644 priv/repo/migrations/20210121080964_add_default_text_search_config.exs diff --git a/docs/administration/CLI_tasks/database.md b/docs/administration/CLI_tasks/database.md index 6dca83167..c53c49921 100644 --- a/docs/administration/CLI_tasks/database.md +++ b/docs/administration/CLI_tasks/database.md @@ -141,3 +141,21 @@ but should only be run if necessary. **It is safe to cancel this.** ```sh mix pleroma.database ensure_expiration ``` + +## Change Text Search Configuration + +Change `default_text_search_config` for database and (if necessary) text_search_config used in index, then rebuild index (it may take time). + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database set_text_search_config english + ``` + +=== "From Source" + + ```sh + mix pleroma.database set_text_search_config english + ``` + +See [PostgreSQL documentation](https://www.postgresql.org/docs/current/textsearch-configuration.html) and `docs/configuration/howto_search_cjk.md` for more detail. diff --git a/docs/configuration/howto_search_cjk.md b/docs/configuration/howto_search_cjk.md new file mode 100644 index 000000000..d3ce28077 --- /dev/null +++ b/docs/configuration/howto_search_cjk.md @@ -0,0 +1,42 @@ +# How to enable text search for Chinese, Japanese and Korean + +Pleroma's full text search feature is powered by PostgreSQL's native [text search](https://www.postgresql.org/docs/current/textsearch.html), it works well out of box for most of languages, but needs extra configurations for some asian languages like Chinese, Japanese and Korean (CJK). + + +## Setup and test the new search config + +In most cases, you would need an extension installed to support parsing CJK text. Here are a few extension you may choose from, or you are more than welcome to share additional ones you found working for you with the rest of Pleroma community. + + * [a generic n-gram parser](https://github.com/huangjimmy/pg_cjk_parser) supports Simplifed/Traditional Chinese, Japanese, and Korean + * [a Korean parser](https://github.com/i0seph/textsearch_ko) based on mecab + * [a Japanese parser](https://www.amris.co.jp/tsja/index.html) based on mecab + * [zhparser](https://github.com/amutu/zhparser/) is a PostgreSQL extension base on the Simple Chinese Word Segmentation(SCWS) + * [another Chinese parser](https://github.com/jaiminpan/pg_jieba) based on Jieba Chinese Word Segmentation + +Once you have the new search config , make sure you test it with the `pleroma` user in PostgreSQL (change `YOUR.CONFIG` to your real configuration name) +``` +SELECT ts_debug('YOUR.CONFIG', '安装和配置Nginx, ElixirとErlangをインストールします'); +``` +Check output of the query, and see if it matches your expectation. + + +## Update text search config and index in database + +=== "OTP" + + ```sh + ./bin/pleroma_ctl database set_text_search_config YOUR.CONFIG + ``` + +=== "From Source" + + ```sh + mix pleroma.database set_text_search_config YOUR.CONFIG + ``` + +Note: index update may take a while. + +## Restart database connection +Since some changes above will only apply with a new database connection, you will have to restart either Pleroma or PostgreSQL process, or use `pg_terminate_backend` SQL command without restarting either. + +Now the search results of statuses should be much more friendly for your language of choice, the results for searching users and tags were not changed, as the default parsing/matching should work for most cases. diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 6261910f0..2403ed581 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -167,4 +167,51 @@ def run(["ensure_expiration"]) do end) |> Stream.run() end + + def run(["set_text_search_config", tsconfig]) do + start_pleroma() + %{rows: [[tsc]]} = Ecto.Adapters.SQL.query!(Pleroma.Repo, "SHOW default_text_search_config;") + shell_info("Current default_text_search_config: #{tsc}") + + %{rows: [[db]]} = Ecto.Adapters.SQL.query!(Pleroma.Repo, "SELECT current_database();") + shell_info("Update default_text_search_config: #{tsconfig}") + + %{messages: msg} = + Ecto.Adapters.SQL.query!( + Pleroma.Repo, + "ALTER DATABASE #{db} SET default_text_search_config = '#{tsconfig}';" + ) + + # non-exist config will not raise excpetion but only give >0 messages + if length(msg) > 0 do + shell_info("Error: #{inspect(msg, pretty: true)}") + else + rum_enabled = Pleroma.Config.get([:database, :rum_enabled]) + shell_info("Recreate index, RUM: #{rum_enabled}") + + # Note SQL below needs to be kept up-to-date with latest GIN or RUM index definition in future + if rum_enabled do + Ecto.Adapters.SQL.query!( + Pleroma.Repo, + "CREATE OR REPLACE FUNCTION objects_fts_update() RETURNS trigger AS $$ BEGIN + new.fts_content := to_tsvector(new.data->>'content'); + RETURN new; + END + $$ LANGUAGE plpgsql" + ) + + shell_info("Refresh RUM index") + Ecto.Adapters.SQL.query!(Pleroma.Repo, "UPDATE objects SET updated_at = NOW();") + else + Ecto.Adapters.SQL.query!(Pleroma.Repo, "DROP INDEX IF EXISTS objects_fts;") + + Ecto.Adapters.SQL.query!( + Pleroma.Repo, + "CREATE INDEX objects_fts ON objects USING gin(to_tsvector('#{tsconfig}', data->>'content')); " + ) + end + + shell_info('Done.') + end + end end diff --git a/lib/pleroma/activity/search.ex b/lib/pleroma/activity/search.ex index 52e7c048d..ed898ba4f 100644 --- a/lib/pleroma/activity/search.ex +++ b/lib/pleroma/activity/search.ex @@ -64,7 +64,7 @@ defp query_with(q, :gin, search_query, :plain) do from([a, o] in q, where: fragment( - "to_tsvector('english', ?->>'content') @@ plainto_tsquery('english', ?)", + "to_tsvector(?->>'content') @@ plainto_tsquery(?)", o.data, ^search_query ) @@ -75,7 +75,7 @@ defp query_with(q, :gin, search_query, :websearch) do from([a, o] in q, where: fragment( - "to_tsvector('english', ?->>'content') @@ websearch_to_tsquery('english', ?)", + "to_tsvector(?->>'content') @@ websearch_to_tsquery(?)", o.data, ^search_query ) @@ -86,7 +86,7 @@ defp query_with(q, :rum, search_query, :plain) do from([a, o] in q, where: fragment( - "? @@ plainto_tsquery('english', ?)", + "? @@ plainto_tsquery(?)", o.fts_content, ^search_query ), @@ -98,7 +98,7 @@ defp query_with(q, :rum, search_query, :websearch) do from([a, o] in q, where: fragment( - "? @@ websearch_to_tsquery('english', ?)", + "? @@ websearch_to_tsquery(?)", o.fts_content, ^search_query ), diff --git a/priv/repo/migrations/20210121080964_add_default_text_search_config.exs b/priv/repo/migrations/20210121080964_add_default_text_search_config.exs new file mode 100644 index 000000000..09b6cccc9 --- /dev/null +++ b/priv/repo/migrations/20210121080964_add_default_text_search_config.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.AddDefaultTextSearchConfig do + use Ecto.Migration + + def change do + execute("DO $$ + BEGIN + execute 'ALTER DATABASE '||current_database()||' SET default_text_search_config = ''english'' '; + END + $$;") + end +end diff --git a/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs b/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs index 82e02281d..88476fb57 100644 --- a/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs +++ b/priv/repo/optional_migrations/rum_indexing/20190510135645_add_fts_index_to_objects_two.exs @@ -17,7 +17,7 @@ def up do execute("CREATE FUNCTION objects_fts_update() RETURNS trigger AS $$ begin - new.fts_content := to_tsvector('english', new.data->>'content'); + new.fts_content := to_tsvector(new.data->>'content'); return new; end $$ LANGUAGE plpgsql") -- cgit v1.2.3 From 9f98885388c9fad95aebddec42ad4a08f82d117a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 11:28:55 -0600 Subject: No reason to suggest users try the useless "Local" mail adapter --- config/description.exs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/config/description.exs b/config/description.exs index f84b52a4f..600fa87d7 100644 --- a/config/description.exs +++ b/config/description.exs @@ -218,8 +218,7 @@ key: :adapter, type: :module, description: - "One of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters)," <> - " or Swoosh.Adapters.Local for in-memory mailbox", + "One of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters)", suggestions: [ Swoosh.Adapters.SMTP, Swoosh.Adapters.Sendgrid, @@ -232,8 +231,7 @@ Swoosh.Adapters.AmazonSES, Swoosh.Adapters.Dyn, Swoosh.Adapters.SocketLabs, - Swoosh.Adapters.Gmail, - Swoosh.Adapters.Local + Swoosh.Adapters.Gmail ] }, %{ -- cgit v1.2.3 From 85710b026feea51057b05d02390d4d36e5f32bb1 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 11:55:01 -0600 Subject: Improve SMTP adapter setting descriptions --- config/description.exs | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/config/description.exs b/config/description.exs index 600fa87d7..85f90ca3e 100644 --- a/config/description.exs +++ b/config/description.exs @@ -243,21 +243,27 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :relay, type: :string, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: ["smtp.gmail.com"] + description: "Hostname or IP address", + suggestions: ["smtp.example.com"] + }, + %{ + group: {:subgroup, Swoosh.Adapters.SMTP}, + key: :port, + type: :integer, + description: "SMTP port" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :username, type: :string, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: ["pleroma"] + description: "SMTP auth username", + suggestions: ["user@example.com"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :password, type: :string, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", + description: "SMTP auth password", suggestions: ["password"] }, %{ @@ -265,29 +271,22 @@ key: :ssl, label: "SSL", type: :boolean, - description: "`Swoosh.Adapters.SMTP` adapter specific setting" + description: "Use implicit SSL/TLS: e.g., port 465", }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :tls, - label: "TLS", - type: :atom, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [:always, :never, :if_available] + label: "STARTTLS", + type: {:dropdown, :atom}, + description: "Explicit TLS (STARTTLS) mode", + suggestions: [:if_available, :always, :never] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :auth, - type: :atom, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [:always, :never, :if_available] - }, - %{ - group: {:subgroup, Swoosh.Adapters.SMTP}, - key: :port, - type: :integer, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [1025] + type: {:dropdown, :atom}, + description: "SMTP authentication mode", + suggestions: [:if_available, :always, :never] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, -- cgit v1.2.3 From 6ffe15cc9feadecf5e6756cb3db3240fa9eb63c2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 11:55:25 -0600 Subject: Remove No MX lookups setting This setting defaults to false so the relay host will be used in an MX query so multiple SMTP servers can be used. gen_smtp code states that all records returned from the MX query are attempted in order and only a permanent SMTP error will stop the client from attempting other servers in the list. Connection failures, TLS issues, etc will cause it to try the next host. If there is no MX record associated with the relay host, it automatically tries connecting to it directly. There is really no reason to expose this to end users. The default value is fine for everyone. --- config/description.exs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/config/description.exs b/config/description.exs index 85f90ca3e..8922a3626 100644 --- a/config/description.exs +++ b/config/description.exs @@ -295,13 +295,6 @@ description: "`Swoosh.Adapters.SMTP` adapter specific setting", suggestions: [5] }, - %{ - group: {:subgroup, Swoosh.Adapters.SMTP}, - key: :no_mx_lookups, - label: "No MX lookups", - type: :boolean, - description: "`Swoosh.Adapters.SMTP` adapter specific setting" - }, %{ group: {:subgroup, Swoosh.Adapters.Sendgrid}, key: :api_key, -- cgit v1.2.3 From cfc474c5f7e29238132948d1858e4ed0d88bb062 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:01:11 -0600 Subject: There is no reason to expose these Local adapter settings either. --- config/description.exs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/config/description.exs b/config/description.exs index 8922a3626..8a4410723 100644 --- a/config/description.exs +++ b/config/description.exs @@ -434,26 +434,6 @@ } ] }, - %{ - group: :swoosh, - type: :group, - description: "`Swoosh.Adapters.Local` adapter specific settings", - children: [ - %{ - group: {:subgroup, Swoosh.Adapters.Local}, - key: :serve_mailbox, - type: :boolean, - description: "Run the preview server together as part of your app" - }, - %{ - group: {:subgroup, Swoosh.Adapters.Local}, - key: :preview_port, - type: :integer, - description: "The preview server port", - suggestions: [4001] - } - ] - }, %{ group: :pleroma, key: :uri_schemes, -- cgit v1.2.3 From 9e3e8e2e30d48c2989bc645f2b7929eb339de09b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:04:28 -0600 Subject: Update Swoosh docs URL, lint --- config/description.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/description.exs b/config/description.exs index 8a4410723..6f6462900 100644 --- a/config/description.exs +++ b/config/description.exs @@ -218,7 +218,7 @@ key: :adapter, type: :module, description: - "One of the mail adapters listed in [Swoosh readme](https://github.com/swoosh/swoosh#adapters)", + "One of the mail adapters listed in [Swoosh documentation](https://hexdocs.pm/swoosh/Swoosh.html#module-adapters)", suggestions: [ Swoosh.Adapters.SMTP, Swoosh.Adapters.Sendgrid, @@ -271,7 +271,7 @@ key: :ssl, label: "SSL", type: :boolean, - description: "Use implicit SSL/TLS: e.g., port 465", + description: "Use implicit SSL/TLS: e.g., port 465" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, -- cgit v1.2.3 From 227dd84f1175ed61c768c0ada39b748371c0c441 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:06:47 -0600 Subject: Update SMTP error description and default value --- config/description.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/description.exs b/config/description.exs index 6f6462900..6e1a8e7ea 100644 --- a/config/description.exs +++ b/config/description.exs @@ -292,8 +292,8 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :retries, type: :integer, - description: "`Swoosh.Adapters.SMTP` adapter specific setting", - suggestions: [5] + description: "SMTP temporary (4xx) error retries", + suggestions: [1] }, %{ group: {:subgroup, Swoosh.Adapters.Sendgrid}, -- cgit v1.2.3 From bd828e5c9c2c1a373b13cf80b185d11b1fcd1bc3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:28:49 -0600 Subject: More description improvements --- config/description.exs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/config/description.exs b/config/description.exs index 6e1a8e7ea..54b5fd5d6 100644 --- a/config/description.exs +++ b/config/description.exs @@ -237,7 +237,7 @@ %{ key: :enabled, type: :boolean, - description: "Allow/disallow send emails" + description: "Pleroma Email sending capability" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, @@ -256,36 +256,37 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :username, type: :string, - description: "SMTP auth username", + description: "SMTP AUTH username", suggestions: ["user@example.com"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :password, type: :string, - description: "SMTP auth password", + description: "SMTP AUTH password", suggestions: ["password"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :ssl, - label: "SSL", + label: "Use SSL", type: :boolean, - description: "Use implicit SSL/TLS: e.g., port 465" + description: "Use implicit SSL/TLS. e.g. port 465" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :tls, - label: "STARTTLS", + label: "STARTTLS Mode", type: {:dropdown, :atom}, - description: "Explicit TLS (STARTTLS) mode", + description: "Explicit TLS (STARTTLS) enforcement mode", suggestions: [:if_available, :always, :never] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :auth, + label: "AUTH Mode", type: {:dropdown, :atom}, - description: "SMTP authentication mode", + description: "SMTP AUTH enforcement mode", suggestions: [:if_available, :always, :never] }, %{ -- cgit v1.2.3 From 0fcf16dcb858cdd464fbd614aaba54fb81264199 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 12:34:32 -0600 Subject: Move Enabled to top as it's the master control of all email. Description not really needed. --- config/description.exs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/config/description.exs b/config/description.exs index 54b5fd5d6..8d3312caa 100644 --- a/config/description.exs +++ b/config/description.exs @@ -214,6 +214,10 @@ type: :group, description: "Mailer-related settings", children: [ + %{ + key: :enabled, + type: :boolean, + }, %{ key: :adapter, type: :module, @@ -234,11 +238,6 @@ Swoosh.Adapters.Gmail ] }, - %{ - key: :enabled, - type: :boolean, - description: "Pleroma Email sending capability" - }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :relay, -- cgit v1.2.3 From f736501e977f976324cda244b51f0a76ffb4691f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 13:18:48 -0600 Subject: Alpha-sort adapters Add various labels, descriptions and suggestions for all adapter settings and try to use the same terminology by the service provider. --- config/description.exs | 101 +++++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 54 deletions(-) diff --git a/config/description.exs b/config/description.exs index 8d3312caa..650b504c1 100644 --- a/config/description.exs +++ b/config/description.exs @@ -216,6 +216,7 @@ children: [ %{ key: :enabled, + label: "Mailer Enabled", type: :boolean, }, %{ @@ -224,18 +225,18 @@ description: "One of the mail adapters listed in [Swoosh documentation](https://hexdocs.pm/swoosh/Swoosh.html#module-adapters)", suggestions: [ - Swoosh.Adapters.SMTP, - Swoosh.Adapters.Sendgrid, - Swoosh.Adapters.Sendmail, - Swoosh.Adapters.Mandrill, + Swoosh.Adapters.AmazonSES, + Swoosh.Adapters.Dyn, + Swoosh.Adapters.Gmail, Swoosh.Adapters.Mailgun, Swoosh.Adapters.Mailjet, + Swoosh.Adapters.Mandrill, Swoosh.Adapters.Postmark, - Swoosh.Adapters.SparkPost, - Swoosh.Adapters.AmazonSES, - Swoosh.Adapters.Dyn, + Swoosh.Adapters.SMTP, + Swoosh.Adapters.Sendgrid, + Swoosh.Adapters.Sendmail, Swoosh.Adapters.SocketLabs, - Swoosh.Adapters.Gmail + Swoosh.Adapters.SparkPost ] }, %{ @@ -249,7 +250,8 @@ group: {:subgroup, Swoosh.Adapters.SMTP}, key: :port, type: :integer, - description: "SMTP port" + description: "SMTP port", + suggestions: ["1025"] }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, @@ -270,7 +272,7 @@ key: :ssl, label: "Use SSL", type: :boolean, - description: "Use implicit SSL/TLS. e.g. port 465" + description: "Use Implicit SSL/TLS. e.g. port 465" }, %{ group: {:subgroup, Swoosh.Adapters.SMTP}, @@ -298,139 +300,130 @@ %{ group: {:subgroup, Swoosh.Adapters.Sendgrid}, key: :api_key, - label: "API key", + label: "SendGrid API Key", type: :string, - description: "`Swoosh.Adapters.Sendgrid` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :cmd_path, type: :string, - description: "`Swoosh.Adapters.Sendmail` adapter specific setting", suggestions: ["/usr/bin/sendmail"] }, %{ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :cmd_args, type: :string, - description: "`Swoosh.Adapters.Sendmail` adapter specific setting", suggestions: ["-N delay,failure,success"] }, %{ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :qmail, + label: "Qmail compat mode", type: :boolean, - description: "`Swoosh.Adapters.Sendmail` adapter specific setting" }, %{ group: {:subgroup, Swoosh.Adapters.Mandrill}, key: :api_key, - label: "API key", + label: "Mandrill API Key", type: :string, - description: "`Swoosh.Adapters.Mandrill` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailgun}, key: :api_key, - label: "API key", + label: "Mailgun API Key", type: :string, - description: "`Swoosh.Adapters.Mailgun` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailgun}, key: :domain, type: :string, - description: "`Swoosh.Adapters.Mailgun` adapter specific setting", - suggestions: ["pleroma.com"] + suggestions: ["YOUR_DOMAIN_NAME"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailjet}, key: :api_key, - label: "API key", + label: "MailJet Public API Key", type: :string, - description: "`Swoosh.Adapters.Mailjet` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["MJ_APIKEY_PUBLIC"] }, %{ group: {:subgroup, Swoosh.Adapters.Mailjet}, key: :secret, + label: "MailJet Private API Key", type: :string, - description: "`Swoosh.Adapters.Mailjet` adapter specific setting", - suggestions: ["my-secret-key"] + suggestions: ["MJ_APIKEY_PRIVATE"] }, %{ group: {:subgroup, Swoosh.Adapters.Postmark}, key: :api_key, - label: "API key", + label: "Postmark API Key", type: :string, - description: "`Swoosh.Adapters.Postmark` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["X-Postmark-Server-Token"] }, %{ group: {:subgroup, Swoosh.Adapters.SparkPost}, key: :api_key, - label: "API key", + label: "SparkPost API key", type: :string, - description: "`Swoosh.Adapters.SparkPost` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["YOUR_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.SparkPost}, key: :endpoint, type: :string, - description: "`Swoosh.Adapters.SparkPost` adapter specific setting", suggestions: ["https://api.sparkpost.com/api/v1"] }, %{ group: {:subgroup, Swoosh.Adapters.AmazonSES}, - key: :region, + key: :access_key, + label: "AWS Access Key", type: :string, - description: "`Swoosh.Adapters.AmazonSES` adapter specific setting", - suggestions: ["us-east-1", "us-east-2"] + suggestions: ["AWS_ACCESS_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.AmazonSES}, - key: :access_key, + key: :secret, + label: "AWS Secret Key", type: :string, - description: "`Swoosh.Adapters.AmazonSES` adapter specific setting", - suggestions: ["aws-access-key"] + suggestions: ["AWS_SECRET_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.AmazonSES}, - key: :secret, + key: :region, + label: "AWS Region", type: :string, - description: "`Swoosh.Adapters.AmazonSES` adapter specific setting", - suggestions: ["aws-secret-key"] + suggestions: ["us-east-1", "us-east-2"] }, %{ group: {:subgroup, Swoosh.Adapters.Dyn}, key: :api_key, - label: "API key", + label: "Dyn API Key", type: :string, - description: "`Swoosh.Adapters.Dyn` adapter specific setting", - suggestions: ["my-api-key"] + suggestions: ["apikey"] }, %{ group: {:subgroup, Swoosh.Adapters.SocketLabs}, - key: :server_id, + key: :api_key, + label: "SocketLabs API Key", type: :string, - description: "`Swoosh.Adapters.SocketLabs` adapter specific setting" + suggestions: ["INJECTION_API_KEY"] }, %{ group: {:subgroup, Swoosh.Adapters.SocketLabs}, - key: :api_key, - label: "API key", + key: :server_id, + label: "Server ID", type: :string, - description: "`Swoosh.Adapters.SocketLabs` adapter specific setting" + suggestions: ["SERVER_ID"] }, %{ group: {:subgroup, Swoosh.Adapters.Gmail}, key: :access_token, + label: "GMail API Access Token", type: :string, - description: "`Swoosh.Adapters.Gmail` adapter specific setting" + suggestions: ["GMAIL_API_ACCESS_TOKEN"] } ] }, -- cgit v1.2.3 From d1c6dd97aa503ca7c897d67d98fe8c924e113a61 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 7 Feb 2021 22:24:12 +0300 Subject: [#3213] Partially addressed code review points. migration rollback task changes, hashtags-related config handling tweaks, `hashtags.data` deletion (unused). --- config/description.exs | 20 +++++--- lib/mix/tasks/pleroma/database.ex | 53 ++++++++++++---------- lib/pleroma/config.ex | 3 -- lib/pleroma/hashtag.ex | 5 +- lib/pleroma/migrators/hashtags_table_migrator.ex | 4 +- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- .../migrations/20201221202251_create_hashtags.exs | 1 - .../20201221202252_remove_data_from_hashtags.exs | 15 ++++++ .../pleroma/web/activity_pub/activity_pub_test.exs | 2 +- 9 files changed, 63 insertions(+), 42 deletions(-) create mode 100644 priv/repo/migrations/20201221202252_remove_data_from_hashtags.exs diff --git a/config/description.exs b/config/description.exs index ed3a534a0..02cdf2ff3 100644 --- a/config/description.exs +++ b/config/description.exs @@ -495,6 +495,20 @@ } ] }, + %{ + group: :pleroma, + key: :database, + type: :group, + description: "Database-related settings", + children: [ + %{ + key: :improved_hashtag_timeline, + type: :keyword, + description: + "If `true`, hashtags will be fetched from `hashtags` table for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." + } + ] + }, %{ group: :pleroma, key: :instance, @@ -941,12 +955,6 @@ key: :show_reactions, type: :boolean, description: "Let favourites and emoji reactions be viewed through the API." - }, - %{ - key: :improved_hashtag_timeline, - type: :keyword, - description: - "If `true`, hashtags will be fetched from `hashtags` table for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." } ] }, diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 30c0d2bf1..7c4f54141 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -20,30 +20,6 @@ defmodule Mix.Tasks.Pleroma.Database do @shortdoc "A collection of database related tasks" @moduledoc File.read!("docs/administration/CLI_tasks/database.md") - # Rolls back a specific migration (leaving subsequent migrations applied) - # Based on https://stackoverflow.com/a/53825840 - def run(["rollback", version]) do - start_pleroma() - - version = String.to_integer(version) - re = ~r/^#{version}_.*\.exs/ - path = Application.app_dir(:pleroma, Path.join(["priv", "repo", "migrations"])) - - result = - with {:find, "" <> file} <- {:find, Enum.find(File.ls!(path), &String.match?(&1, re))}, - {:compile, [{mod, _} | _]} <- {:compile, Code.compile_file(Path.join(path, file))}, - {:rollback, :ok} <- {:rollback, Ecto.Migrator.down(Repo, version, mod)} do - {:ok, "Reversed migration: #{file}"} - else - {:find, _} -> {:error, "No migration found with version prefix: #{version}"} - {:compile, e} -> {:error, "Problem compiling migration module: #{inspect(e)}"} - {:rollback, e} -> {:error, "Problem reversing migration: #{inspect(e)}"} - e -> {:error, "Something unexpected happened: #{inspect(e)}"} - end - - IO.inspect(result) - end - def run(["remove_embedded_objects" | args]) do {options, [], []} = OptionParser.parse( @@ -194,4 +170,33 @@ def run(["ensure_expiration"]) do end) |> Stream.run() end + + # Rolls back a specific migration (leaving subsequent migrations applied). + # WARNING: imposes a risk of unrecoverable data loss — proceed at your own responsibility. + # Based on https://stackoverflow.com/a/53825840 + def run(["rollback", version]) do + prompt = "SEVERE WARNING: this operation may result in unrecoverable data loss. Continue?" + + if shell_prompt(prompt, "n") in ~w(Yn Y y) do + {_, result, _} = + Ecto.Migrator.with_repo(Pleroma.Repo, fn repo -> + version = String.to_integer(version) + re = ~r/^#{version}_.*\.exs/ + path = Ecto.Migrator.migrations_path(repo) + + with {:find, "" <> file} <- {:find, Enum.find(File.ls!(path), &String.match?(&1, re))}, + {:compile, [{mod, _} | _]} <- {:compile, Code.compile_file(Path.join(path, file))}, + {:rollback, :ok} <- {:rollback, Ecto.Migrator.down(repo, version, mod)} do + {:ok, "Reversed migration: #{file}"} + else + {:find, _} -> {:error, "No migration found with version prefix: #{version}"} + {:compile, e} -> {:error, "Problem compiling migration module: #{inspect(e)}"} + {:rollback, e} -> {:error, "Problem reversing migration: #{inspect(e)}"} + e -> {:error, "Something unexpected happened: #{inspect(e)}"} + end + end) + + IO.inspect(result) + end + end end diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index 0a6ac0ad0..f17e14128 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -96,9 +96,6 @@ def restrict_unauthenticated_access?(resource, kind) do end end - def improved_hashtag_timeline_path, do: [:instance, :improved_hashtag_timeline] - def improved_hashtag_timeline, do: get(improved_hashtag_timeline_path()) - def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], []) def oauth_consumer_enabled?, do: oauth_consumer_strategies() != [] diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex index b05927563..9e4c6c894 100644 --- a/lib/pleroma/hashtag.ex +++ b/lib/pleroma/hashtag.ex @@ -10,11 +10,8 @@ defmodule Pleroma.Hashtag do alias Pleroma.Hashtag alias Pleroma.Repo - @derive {Jason.Encoder, only: [:data]} - schema "hashtags" do field(:name, :string) - field(:data, :map, default: %{}) many_to_many(:objects, Pleroma.Object, join_through: "hashtags_objects", on_replace: :delete) @@ -50,7 +47,7 @@ def get_or_create_by_names(names) when is_list(names) do def changeset(%Hashtag{} = struct, params) do struct - |> cast(params, [:name, :data]) + |> cast(params, [:name]) |> update_change(:name, &String.downcase/1) |> validate_required([:name]) |> unique_constraint(:name) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 07b42a7f4..9a036e0b2 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -239,11 +239,11 @@ defp handle_success(data_migration) do data_migration.feature_lock -> :noop - not is_nil(Config.improved_hashtag_timeline()) -> + not is_nil(Config.get([:database, :improved_hashtag_timeline])) -> :noop true -> - Config.put(Config.improved_hashtag_timeline_path(), true) + Config.put([:database, :improved_hashtag_timeline], true) :ok end end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 573b4243c..7ac18e5c5 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1227,7 +1227,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> exclude_invisible_actors(opts) |> exclude_visibility(opts) - if Config.improved_hashtag_timeline() do + if Config.get([:database, :improved_hashtag_timeline]) do query |> restrict_hashtag_any(opts) |> restrict_hashtag_all(opts) diff --git a/priv/repo/migrations/20201221202251_create_hashtags.exs b/priv/repo/migrations/20201221202251_create_hashtags.exs index afc522002..8d2e9ae66 100644 --- a/priv/repo/migrations/20201221202251_create_hashtags.exs +++ b/priv/repo/migrations/20201221202251_create_hashtags.exs @@ -4,7 +4,6 @@ defmodule Pleroma.Repo.Migrations.CreateHashtags do def change do create_if_not_exists table(:hashtags) do add(:name, :citext, null: false) - add(:data, :map, default: %{}) timestamps() end diff --git a/priv/repo/migrations/20201221202252_remove_data_from_hashtags.exs b/priv/repo/migrations/20201221202252_remove_data_from_hashtags.exs new file mode 100644 index 000000000..0442c3b87 --- /dev/null +++ b/priv/repo/migrations/20201221202252_remove_data_from_hashtags.exs @@ -0,0 +1,15 @@ +defmodule Pleroma.Repo.Migrations.RemoveDataFromHashtags do + use Ecto.Migration + + def up do + alter table(:hashtags) do + remove_if_exists(:data, :map) + end + end + + def down do + alter table(:hashtags) do + add_if_not_exists(:data, :map, default: %{}) + end + end +end diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 04fd1def3..bab5a199c 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -221,7 +221,7 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_five} = CommonAPI.post(user, %{status: ". #any2 #any1"}) for hashtag_timeline_strategy <- [true, false] do - clear_config([:instance, :improved_hashtag_timeline], hashtag_timeline_strategy) + clear_config([:database, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) -- cgit v1.2.3 From 4dbb08a19f57e720e299608ebeb4387d37c55e99 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Feb 2021 13:20:58 -0600 Subject: Improved Mailer descriptions --- CHANGELOG.md | 3 ++- config/description.exs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbdb3f4e..15c75353f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders. - Improved Apache webserver support: updated sample configuration, MediaProxy cache invalidation verified with the included sample script - Improve OAuth 2.0 provider support. A missing `fqn` field was added to the response, but does not expose the user's email address. -- Provide redirect of external posts from `/notice/:id` to their original URL +- Provide redirect of external posts from `/notice/:id` to their original URL. +- Improved Mailer configuration setting descriptions for AdminFE.
API Changes diff --git a/config/description.exs b/config/description.exs index 650b504c1..8eefa2ba1 100644 --- a/config/description.exs +++ b/config/description.exs @@ -217,7 +217,7 @@ %{ key: :enabled, label: "Mailer Enabled", - type: :boolean, + type: :boolean }, %{ key: :adapter, @@ -320,7 +320,7 @@ group: {:subgroup, Swoosh.Adapters.Sendmail}, key: :qmail, label: "Qmail compat mode", - type: :boolean, + type: :boolean }, %{ group: {:subgroup, Swoosh.Adapters.Mandrill}, -- cgit v1.2.3 From 2bffa8e0202e4db61eb24dae0f7063ac8305cae4 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 8 Feb 2021 11:25:32 -0600 Subject: Make the suggestion match the default value --- config/description.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/description.exs b/config/description.exs index f84b52a4f..df5108582 100644 --- a/config/description.exs +++ b/config/description.exs @@ -2888,7 +2888,7 @@ type: :integer, description: "Activity pub routes (except question activities). Default: `nil` (no expiration).", - suggestions: [30_000, nil] + suggestions: [nil] }, %{ key: :activity_pub_question, -- cgit v1.2.3 From ce7c275fb35fee87d85ef5165900d2991bdfc660 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 8 Feb 2021 11:45:50 -0600 Subject: Improve various descriptions and labels --- config/description.exs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/config/description.exs b/config/description.exs index df5108582..0c0963678 100644 --- a/config/description.exs +++ b/config/description.exs @@ -99,7 +99,8 @@ key: :base_url, label: "Base URL", type: :string, - description: "Base URL for the uploads, needed if you use CDN", + description: + "Base URL for the uploads. Required if you use a CDN or host attachments under a different domain.", suggestions: [ "https://cdn-host.com" ] @@ -1545,7 +1546,8 @@ %{ key: :max_body_length, type: :integer, - description: "Maximum file size allowed through the Pleroma MediaProxy cache." + description: + "Maximum file size (in bytes) allowed through the Pleroma MediaProxy cache." }, %{ key: :max_read_duration, @@ -1595,7 +1597,7 @@ key: :min_content_length, type: :integer, description: - "Min content length to perform preview, in bytes. If greater than 0, media smaller in size will be served as is, without thumbnailing." + "Min content length (in bytes) to perform preview. Media smaller in size will be served without thumbnailing." } ] }, @@ -1643,6 +1645,7 @@ }, %{ key: :url_format, + label: "URL Format", type: :string, description: "Optional URL format preprocessing. Only required for Apache's htcacheclean.", @@ -3326,9 +3329,9 @@ }, %{ key: :ip_whitelist, + label: "IP Whitelist", type: [{:list, :string}, {:list, :charlist}, {:list, :tuple}], - description: - "[Pleroma extension] If non-empty, restricts access to app metrics endpoint to specified IP addresses." + description: "Restrict access of app metrics endpoint to the specified IP addresses." }, %{ key: :auth, -- cgit v1.2.3 From 8c7b3b20d8c94e07eb36c6ac871cd4ead874bef5 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 21 Jan 2021 17:45:42 +0100 Subject: activity_pub_controller: Add authentication to object & activity endpoints --- .../web/activity_pub/activity_pub_controller.ex | 24 +++---- lib/pleroma/web/activity_pub/visibility.ex | 19 +++--- .../activity_pub/activity_pub_controller_test.exs | 79 ++++++++++++++++++++++ test/pleroma/web/activity_pub/visibility_test.exs | 69 ++++++++++++++++++- 4 files changed, 168 insertions(+), 23 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index eb9e119f7..9d3dcc7f9 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -79,11 +79,11 @@ def user(conn, %{"nickname" => nickname}) do end end - def object(conn, _) do + def object(%{assigns: assigns} = conn, _) do with ap_id <- Endpoint.url() <> conn.request_path, %Object{} = object <- Object.get_cached_by_ap_id(ap_id), - {_, true} <- {:public?, Visibility.is_public?(object)}, - {_, false} <- {:local?, Visibility.is_local_public?(object)} do + user <- Map.get(assigns, :user, nil), + {_, true} <- {:visible?, Visibility.visible_for_user?(object, user)} do conn |> assign(:tracking_fun_data, object.id) |> set_cache_ttl_for(object) @@ -91,11 +91,8 @@ def object(conn, _) do |> put_view(ObjectView) |> render("object.json", object: object) else - {:public?, false} -> - {:error, :not_found} - - {:local?, true} -> - {:error, :not_found} + {:visible?, false} -> {:error, :not_found} + nil -> {:error, :not_found} end end @@ -109,11 +106,12 @@ def track_object_fetch(conn, object_id) do conn end - def activity(conn, _params) do + def activity(%{assigns: assigns} = conn, _) do with ap_id <- Endpoint.url() <> conn.request_path, %Activity{} = activity <- Activity.normalize(ap_id), - {_, true} <- {:public?, Visibility.is_public?(activity)}, - {_, false} <- {:local?, Visibility.is_local_public?(activity)} do + {_, true} <- {:local?, activity.local}, + user <- Map.get(assigns, :user, nil), + {_, true} <- {:visible?, Visibility.visible_for_user?(activity, user)} do conn |> maybe_set_tracking_data(activity) |> set_cache_ttl_for(activity) @@ -121,8 +119,8 @@ def activity(conn, _params) do |> put_view(ObjectView) |> render("object.json", object: activity) else - {:public?, false} -> {:error, :not_found} - {:local?, true} -> {:error, :not_found} + {:visible?, false} -> {:error, :not_found} + {:local?, false} -> {:error, :not_found} nil -> {:error, :not_found} end end diff --git a/lib/pleroma/web/activity_pub/visibility.ex b/lib/pleroma/web/activity_pub/visibility.ex index 6ef59e93f..00234c0b0 100644 --- a/lib/pleroma/web/activity_pub/visibility.ex +++ b/lib/pleroma/web/activity_pub/visibility.ex @@ -56,11 +56,10 @@ def is_direct?(activity) do def is_list?(%{data: %{"listMessage" => _}}), do: true def is_list?(_), do: false - @spec visible_for_user?(Activity.t() | nil, User.t() | nil) :: boolean() + @spec visible_for_user?(Object.t() | Activity.t() | nil, User.t() | nil) :: boolean() def visible_for_user?(%Activity{actor: ap_id}, %User{ap_id: ap_id}), do: true - + def visible_for_user?(%Object{data: %{"actor" => ap_id}}, %User{ap_id: ap_id}), do: true def visible_for_user?(nil, _), do: false - def visible_for_user?(%Activity{data: %{"listMessage" => _}}, nil), do: false def visible_for_user?( @@ -73,16 +72,18 @@ def visible_for_user?( |> Pleroma.List.member?(user) end - def visible_for_user?(%Activity{} = activity, nil) do - if restrict_unauthenticated_access?(activity), + def visible_for_user?(%{__struct__: module} = message, nil) + when module in [Activity, Object] do + if restrict_unauthenticated_access?(message), do: false, - else: is_public?(activity) + else: is_public?(message) and not is_local_public?(message) end - def visible_for_user?(%Activity{} = activity, user) do + def visible_for_user?(%{__struct__: module} = message, user) + when module in [Activity, Object] do x = [user.ap_id | User.following(user)] - y = [activity.actor] ++ activity.data["to"] ++ (activity.data["cc"] || []) - is_public?(activity) || Enum.any?(x, &(&1 in y)) + y = [message.data["actor"]] ++ message.data["to"] ++ (message.data["cc"] || []) + is_public?(message) || Enum.any?(x, &(&1 in y)) end def entire_thread_visible_for_user?(%Activity{} = activity, %User{} = user) do diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 91a3109bb..5e53b8afc 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -229,6 +229,24 @@ test "it doesn't return a local-only object", %{conn: conn} do assert json_response(conn, 404) end + test "returns local-only objects when authenticated", %{conn: conn} do + user = insert(:user) + {:ok, post} = CommonAPI.post(user, %{status: "test", visibility: "local"}) + + assert Pleroma.Web.ActivityPub.Visibility.is_local_public?(post) + + object = Object.normalize(post, fetch: false) + uuid = String.split(object.data["id"], "/") |> List.last() + + assert response = + conn + |> assign(:user, user) + |> put_req_header("accept", "application/activity+json") + |> get("/objects/#{uuid}") + + assert json_response(response, 200) == ObjectView.render("object.json", %{object: object}) + end + test "it returns a json representation of the object with accept application/json", %{ conn: conn } do @@ -285,6 +303,28 @@ test "it returns 404 for non-public messages", %{conn: conn} do assert json_response(conn, 404) end + test "returns visible non-public messages when authenticated", %{conn: conn} do + note = insert(:direct_note) + uuid = String.split(note.data["id"], "/") |> List.last() + user = User.get_by_ap_id(note.data["actor"]) + marisa = insert(:user) + + assert conn + |> assign(:user, marisa) + |> put_req_header("accept", "application/activity+json") + |> get("/objects/#{uuid}") + |> json_response(404) + + assert response = + conn + |> assign(:user, user) + |> put_req_header("accept", "application/activity+json") + |> get("/objects/#{uuid}") + |> json_response(200) + + assert response == ObjectView.render("object.json", %{object: note}) + end + test "it returns 404 for tombstone objects", %{conn: conn} do tombstone = insert(:tombstone) uuid = String.split(tombstone.data["id"], "/") |> List.last() @@ -358,6 +398,23 @@ test "it doesn't return a local-only activity", %{conn: conn} do assert json_response(conn, 404) end + test "returns local-only activities when authenticated", %{conn: conn} do + user = insert(:user) + {:ok, post} = CommonAPI.post(user, %{status: "test", visibility: "local"}) + + assert Pleroma.Web.ActivityPub.Visibility.is_local_public?(post) + + uuid = String.split(post.data["id"], "/") |> List.last() + + assert response = + conn + |> assign(:user, user) + |> put_req_header("accept", "application/activity+json") + |> get("/activities/#{uuid}") + + assert json_response(response, 200) == ObjectView.render("object.json", %{object: post}) + end + test "it returns a json representation of the activity", %{conn: conn} do activity = insert(:note_activity) uuid = String.split(activity.data["id"], "/") |> List.last() @@ -382,6 +439,28 @@ test "it returns 404 for non-public activities", %{conn: conn} do assert json_response(conn, 404) end + test "returns visible non-public messages when authenticated", %{conn: conn} do + note = insert(:direct_note_activity) + uuid = String.split(note.data["id"], "/") |> List.last() + user = User.get_by_ap_id(note.data["actor"]) + marisa = insert(:user) + + assert conn + |> assign(:user, marisa) + |> put_req_header("accept", "application/activity+json") + |> get("/activities/#{uuid}") + |> json_response(404) + + assert response = + conn + |> assign(:user, user) + |> put_req_header("accept", "application/activity+json") + |> get("/activities/#{uuid}") + |> json_response(200) + + assert response == ObjectView.render("object.json", %{object: note}) + end + test "it caches a response", %{conn: conn} do activity = insert(:note_activity) uuid = String.split(activity.data["id"], "/") |> List.last() diff --git a/test/pleroma/web/activity_pub/visibility_test.exs b/test/pleroma/web/activity_pub/visibility_test.exs index d8544279a..23485225d 100644 --- a/test/pleroma/web/activity_pub/visibility_test.exs +++ b/test/pleroma/web/activity_pub/visibility_test.exs @@ -6,6 +6,7 @@ defmodule Pleroma.Web.ActivityPub.VisibilityTest do use Pleroma.DataCase, async: true alias Pleroma.Activity + alias Pleroma.Object alias Pleroma.Web.ActivityPub.Visibility alias Pleroma.Web.CommonAPI import Pleroma.Factory @@ -107,7 +108,7 @@ test "is_list?", %{ assert Visibility.is_list?(list) end - test "visible_for_user?", %{ + test "visible_for_user? Activity", %{ public: public, private: private, direct: direct, @@ -149,10 +150,76 @@ test "visible_for_user?", %{ refute Visibility.visible_for_user?(private, unrelated) refute Visibility.visible_for_user?(direct, unrelated) + # Public and unlisted visible for unauthenticated + + assert Visibility.visible_for_user?(public, nil) + assert Visibility.visible_for_user?(unlisted, nil) + refute Visibility.visible_for_user?(private, nil) + refute Visibility.visible_for_user?(direct, nil) + # Visible for a list member assert Visibility.visible_for_user?(list, unrelated) end + test "visible_for_user? Object", %{ + public: public, + private: private, + direct: direct, + unlisted: unlisted, + user: user, + mentioned: mentioned, + following: following, + unrelated: unrelated, + list: list + } do + public = Object.normalize(public) + private = Object.normalize(private) + unlisted = Object.normalize(unlisted) + direct = Object.normalize(direct) + list = Object.normalize(list) + + # All visible to author + + assert Visibility.visible_for_user?(public, user) + assert Visibility.visible_for_user?(private, user) + assert Visibility.visible_for_user?(unlisted, user) + assert Visibility.visible_for_user?(direct, user) + assert Visibility.visible_for_user?(list, user) + + # All visible to a mentioned user + + assert Visibility.visible_for_user?(public, mentioned) + assert Visibility.visible_for_user?(private, mentioned) + assert Visibility.visible_for_user?(unlisted, mentioned) + assert Visibility.visible_for_user?(direct, mentioned) + assert Visibility.visible_for_user?(list, mentioned) + + # DM not visible for just follower + + assert Visibility.visible_for_user?(public, following) + assert Visibility.visible_for_user?(private, following) + assert Visibility.visible_for_user?(unlisted, following) + refute Visibility.visible_for_user?(direct, following) + refute Visibility.visible_for_user?(list, following) + + # Public and unlisted visible for unrelated user + + assert Visibility.visible_for_user?(public, unrelated) + assert Visibility.visible_for_user?(unlisted, unrelated) + refute Visibility.visible_for_user?(private, unrelated) + refute Visibility.visible_for_user?(direct, unrelated) + + # Public and unlisted visible for unauthenticated + + assert Visibility.visible_for_user?(public, nil) + assert Visibility.visible_for_user?(unlisted, nil) + refute Visibility.visible_for_user?(private, nil) + refute Visibility.visible_for_user?(direct, nil) + + # Visible for a list member + # assert Visibility.visible_for_user?(list, unrelated) + end + test "doesn't die when the user doesn't exist", %{ direct: direct, -- cgit v1.2.3 From ed8ef80b5eb4936087389dd9a6545e9a3b666311 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 8 Feb 2021 22:41:35 +0300 Subject: RSS: Make sure post URL is the first `` element Otherwise some RSS readers (tested in Miniflux) might pick the context URL as the external link. Related to #2425. --- lib/pleroma/web/templates/feed/feed/_activity.rss.eex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/templates/feed/feed/_activity.rss.eex b/lib/pleroma/web/templates/feed/feed/_activity.rss.eex index 42960de7d..947bbb099 100644 --- a/lib/pleroma/web/templates/feed/feed/_activity.rss.eex +++ b/lib/pleroma/web/templates/feed/feed/_activity.rss.eex @@ -9,7 +9,6 @@ <%= activity_context(@activity) %> - <%= activity_context(@activity) %> <%= if @data["summary"] do %> <%= escape(@data["summary"]) %> @@ -21,6 +20,8 @@ <%= @data["external_url"] %> <% end %> + <%= activity_context(@activity) %> + <%= for tag <- @data["tag"] || [] do %> <% end %> -- cgit v1.2.3 From 55a13fc3607c9d753e6fca596010c0a96ba3fba8 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 8 Feb 2021 15:32:47 -0600 Subject: MRF NoEmptyPolicy: Deny posts from local users if there is no content or only mentions. Helps prevent accidental button mashes from submitting incomplete posts --- CHANGELOG.md | 1 + .../web/activity_pub/mrf/no_empty_policy.ex | 61 ++++++++ .../web/activity_pub/mrf/no_empty_policy_test.exs | 154 +++++++++++++++++++++ 3 files changed, 216 insertions(+) create mode 100644 lib/pleroma/web/activity_pub/mrf/no_empty_policy.ex create mode 100644 test/pleroma/web/activity_pub/mrf/no_empty_policy_test.exs diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbdb3f4e..d4acbc9a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to set ActivityPub aliases for follower migration. - Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy - Ability to define custom HTTP headers per each frontend +- MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users
API Changes diff --git a/lib/pleroma/web/activity_pub/mrf/no_empty_policy.ex b/lib/pleroma/web/activity_pub/mrf/no_empty_policy.ex new file mode 100644 index 000000000..32bb1b645 --- /dev/null +++ b/lib/pleroma/web/activity_pub/mrf/no_empty_policy.ex @@ -0,0 +1,61 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.NoEmptyPolicy do + @moduledoc "Filter local activities which have no content" + @behaviour Pleroma.Web.ActivityPub.MRF + + alias Pleroma.Web + + @impl true + def filter(%{"actor" => actor} = object) do + with true <- is_local?(actor), + true <- is_note?(object), + false <- has_attachment?(object), + true <- only_mentions?(object) do + {:reject, "[NoEmptyPolicy]"} + else + _ -> + {:ok, object} + end + end + + def filter(object), do: {:ok, object} + + defp is_local?(actor) do + if actor |> String.starts_with?("#{Web.base_url()}") do + true + else + false + end + end + + defp has_attachment?(%{ + "type" => "Create", + "object" => %{"type" => "Note", "attachment" => attachments} + }) + when length(attachments) > 0, + do: true + + defp has_attachment?(_), do: false + + defp only_mentions?(%{"type" => "Create", "object" => %{"type" => "Note", "source" => source}}) do + non_mentions = + source |> String.split() |> Enum.filter(&(not String.starts_with?(&1, "@"))) |> length + + if non_mentions > 0 do + false + else + true + end + end + + defp only_mentions?(_), do: false + + defp is_note?(%{"type" => "Create", "object" => %{"type" => "Note"}}), do: true + defp is_note?(_), do: false + + @impl true + def describe, do: {:ok, %{}} +end diff --git a/test/pleroma/web/activity_pub/mrf/no_empty_policy_test.exs b/test/pleroma/web/activity_pub/mrf/no_empty_policy_test.exs new file mode 100644 index 000000000..fbcf68414 --- /dev/null +++ b/test/pleroma/web/activity_pub/mrf/no_empty_policy_test.exs @@ -0,0 +1,154 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.NoEmptyPolicyTest do + use Pleroma.DataCase + alias Pleroma.Web.ActivityPub.MRF.NoEmptyPolicy + + setup_all do: clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.NoEmptyPolicy]) + + test "Notes with content are exempt" do + message = %{ + "actor" => "http://localhost:4001/users/testuser", + "cc" => ["http://localhost:4001/users/testuser/followers"], + "object" => %{ + "actor" => "http://localhost:4001/users/testuser", + "attachment" => [], + "cc" => ["http://localhost:4001/users/testuser/followers"], + "source" => "this is a test post", + "to" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Note" + }, + "to" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create" + } + + assert NoEmptyPolicy.filter(message) == {:ok, message} + end + + test "Polls are exempt" do + message = %{ + "actor" => "http://localhost:4001/users/testuser", + "cc" => ["http://localhost:4001/users/testuser/followers"], + "object" => %{ + "actor" => "http://localhost:4001/users/testuser", + "attachment" => [], + "cc" => ["http://localhost:4001/users/testuser/followers"], + "oneOf" => [ + %{ + "name" => "chocolate", + "replies" => %{"totalItems" => 0, "type" => "Collection"}, + "type" => "Note" + }, + %{ + "name" => "vanilla", + "replies" => %{"totalItems" => 0, "type" => "Collection"}, + "type" => "Note" + } + ], + "source" => "@user2", + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + "http://localhost:4001/users/user2" + ], + "type" => "Question" + }, + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + "http://localhost:4001/users/user2" + ], + "type" => "Create" + } + + assert NoEmptyPolicy.filter(message) == {:ok, message} + end + + test "Notes with attachments are exempt" do + message = %{ + "actor" => "http://localhost:4001/users/testuser", + "cc" => ["http://localhost:4001/users/testuser/followers"], + "object" => %{ + "actor" => "http://localhost:4001/users/testuser", + "attachment" => [ + %{ + "actor" => "http://localhost:4001/users/testuser", + "mediaType" => "image/png", + "name" => "", + "type" => "Document", + "url" => [ + %{ + "href" => + "http://localhost:4001/media/68ba231cf12e1382ce458f1979969f8ed5cc07ba198a02e653464abaf39bdb90.png", + "mediaType" => "image/png", + "type" => "Link" + } + ] + } + ], + "cc" => ["http://localhost:4001/users/testuser/followers"], + "source" => "@user2", + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + "http://localhost:4001/users/user2" + ], + "type" => "Note" + }, + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + "http://localhost:4001/users/user2" + ], + "type" => "Create" + } + + assert NoEmptyPolicy.filter(message) == {:ok, message} + end + + test "Notes with only mentions are denied" do + message = %{ + "actor" => "http://localhost:4001/users/testuser", + "cc" => ["http://localhost:4001/users/testuser/followers"], + "object" => %{ + "actor" => "http://localhost:4001/users/testuser", + "attachment" => [], + "cc" => ["http://localhost:4001/users/testuser/followers"], + "source" => "@user2", + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + "http://localhost:4001/users/user2" + ], + "type" => "Note" + }, + "to" => [ + "https://www.w3.org/ns/activitystreams#Public", + "http://localhost:4001/users/user2" + ], + "type" => "Create" + } + + assert NoEmptyPolicy.filter(message) == {:reject, "[NoEmptyPolicy]"} + end + + test "Notes with no content are denied" do + message = %{ + "actor" => "http://localhost:4001/users/testuser", + "cc" => ["http://localhost:4001/users/testuser/followers"], + "object" => %{ + "actor" => "http://localhost:4001/users/testuser", + "attachment" => [], + "cc" => ["http://localhost:4001/users/testuser/followers"], + "source" => "", + "to" => [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type" => "Note" + }, + "to" => [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type" => "Create" + } + + assert NoEmptyPolicy.filter(message) == {:reject, "[NoEmptyPolicy]"} + end +end -- cgit v1.2.3 From 4cacce4b42e25d608390a7fd06ab21dc64529e37 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 8 Feb 2021 16:39:55 -0600 Subject: Revert "Add plaintext support for all emails except the digest" This reverts commit 5df9f68392f65a5688867b9bad4bda766e492923. --- lib/pleroma/emails/user_email.ex | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/pleroma/emails/user_email.ex b/lib/pleroma/emails/user_email.ex index e5a6feed9..52f3d419d 100644 --- a/lib/pleroma/emails/user_email.ex +++ b/lib/pleroma/emails/user_email.ex @@ -8,7 +8,6 @@ defmodule Pleroma.Emails.UserEmail do use Phoenix.Swoosh, view: Pleroma.Web.EmailView, layout: {Pleroma.Web.LayoutView, :email} alias Pleroma.Config - alias Pleroma.HTML alias Pleroma.User alias Pleroma.Web.Endpoint alias Pleroma.Web.Router @@ -44,7 +43,6 @@ def password_reset_email(user, token) when is_binary(token) do |> from(sender()) |> subject("Password reset") |> html_body(html_body) - |> text_body(HTML.strip_tags(html_body)) end def user_invitation_email( @@ -71,7 +69,6 @@ def user_invitation_email( |> from(sender()) |> subject("Invitation to #{instance_name()}") |> html_body(html_body) - |> text_body(HTML.strip_tags(html_body)) end def account_confirmation_email(user) do @@ -94,7 +91,6 @@ def account_confirmation_email(user) do |> from(sender()) |> subject("#{instance_name()} account confirmation") |> html_body(html_body) - |> text_body(HTML.strip_tags(html_body)) end def approval_pending_email(user) do @@ -108,7 +104,6 @@ def approval_pending_email(user) do |> from(sender()) |> subject("Your account is awaiting approval") |> html_body(html_body) - |> text_body(HTML.strip_tags(html_body)) end def successful_registration_email(user) do @@ -123,7 +118,6 @@ def successful_registration_email(user) do |> from(sender()) |> subject("Account registered on #{instance_name()}") |> html_body(html_body) - |> text_body(HTML.strip_tags(html_body)) end @doc """ @@ -247,6 +241,5 @@ def backup_is_ready_email(backup, admin_user_id \\ nil) do |> from(sender()) |> subject("Your account archive is ready") |> html_body(html_body) - |> text_body(HTML.strip_tags(html_body)) end end -- cgit v1.2.3 From 6e90b79d63729a8ee51a25fb010a1be29613a4d0 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 8 Feb 2021 16:40:27 -0600 Subject: Lint --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8635ed4e7..bbd898bdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Configurable background job limits for RichMedia (link previews) and MediaProxyWarmingPolicy - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required)
-- cgit v1.2.3 From f13f5d9303d45093953a7c609a7b1f282a31e8da Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 9 Feb 2021 22:10:09 +0300 Subject: OpenAPI spec task: Load pleroma application to get version info For whatever reason it seems to pick up the version without loading the app on my machine, but not on the CI. --- lib/mix/tasks/pleroma/openapi_spec.ex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mix/tasks/pleroma/openapi_spec.ex b/lib/mix/tasks/pleroma/openapi_spec.ex index 524bf5144..8f719c58b 100644 --- a/lib/mix/tasks/pleroma/openapi_spec.ex +++ b/lib/mix/tasks/pleroma/openapi_spec.ex @@ -1,5 +1,7 @@ defmodule Mix.Tasks.Pleroma.OpenapiSpec do def run([path]) do + # Load Pleroma application to get version info + Application.load(:pleroma) spec = Pleroma.Web.ApiSpec.spec(server_specific: false) |> Jason.encode!() File.write(path, spec) end -- cgit v1.2.3 From 0d9230aed9f492599ecb505375474578714a2ee8 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 9 Feb 2021 22:23:11 +0300 Subject: OpenAPI spec: Do not show build enviroment in the spec version --- lib/pleroma/web/api_spec.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index 81b7bc9e8..b16068f7b 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -37,7 +37,8 @@ def spec(opts \\ []) do Please report such occurences on our [issue tracker](https://git.pleroma.social/pleroma/pleroma/-/issues). Feel free to submit API questions or proposals there too! """, - version: Application.spec(:pleroma, :vsn) |> to_string(), + # Strip environment from the version + version: Application.spec(:pleroma, :vsn) |> to_string() |> String.replace(~r/\+.*$/, ""), extensions: %{ # Logo path should be picked so that the path exists both on Pleroma instances and on api.pleroma.social "x-logo": %{"url" => "/static/logo.svg", "altText" => "Pleroma logo"} -- cgit v1.2.3 From de8b8e9cf15e5d0d084fbcdf73f5d637617c7744 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 9 Feb 2021 14:41:58 -0600 Subject: Add a function to lookup client app details by the app_id --- lib/pleroma/web/o_auth/app.ex | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/pleroma/web/o_auth/app.ex b/lib/pleroma/web/o_auth/app.ex index 382750010..083b5ce09 100644 --- a/lib/pleroma/web/o_auth/app.ex +++ b/lib/pleroma/web/o_auth/app.ex @@ -146,4 +146,14 @@ def errors(changeset) do Map.put(acc, key, error) end) end + + @spec get_app_by_id(pos_integer()) :: {:ok, map()} + def get_app_by_id(app_id) do + query = + __MODULE__ + |> where([a], a.id == ^app_id) + |> select([a], %{name: a.client_name, website: a.website}) + + Repo.one!(query) + end end -- cgit v1.2.3 From 3dc7e89c54ea3d2bf7e81d99ac4efac37cd00e6c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 9 Feb 2021 18:07:15 -0600 Subject: Ensure we capture the application details into the object --- lib/pleroma/web/common_api/activity_draft.ex | 1 + .../mastodon_api/controllers/status_controller.ex | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/common_api/activity_draft.ex b/lib/pleroma/web/common_api/activity_draft.ex index fb059c27c..d7dcdad90 100644 --- a/lib/pleroma/web/common_api/activity_draft.ex +++ b/lib/pleroma/web/common_api/activity_draft.ex @@ -190,6 +190,7 @@ defp object(draft) do Utils.make_note_data(draft) |> Map.put("emoji", emoji) |> Map.put("source", draft.status) + |> Map.put("application", draft.params[:application]) %__MODULE__{draft | object: object} end diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 4cf2ee35c..47a5bbd60 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -132,13 +132,15 @@ def index(%{assigns: %{user: user}} = conn, %{ids: ids} = params) do # Creates a scheduled status when `scheduled_at` param is present and it's far enough def create( %{ - assigns: %{user: user}, + assigns: %{user: user, token: %{app_id: app_id}}, body_params: %{status: _, scheduled_at: scheduled_at} = params } = conn, _ ) when not is_nil(scheduled_at) do - params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) + params = + Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) + |> add_application(app_id) attrs = %{ params: Map.new(params, fn {key, value} -> {to_string(key), value} end), @@ -161,8 +163,14 @@ def create( end # Creates a regular status - def create(%{assigns: %{user: user}, body_params: %{status: _} = params} = conn, _) do - params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) + def create( + %{assigns: %{user: user, token: %{app_id: app_id}}, body_params: %{status: _} = params} = + conn, + _ + ) do + params = + Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) + |> add_application(app_id) with {:ok, activity} <- CommonAPI.post(user, params) do try_render(conn, "show.json", @@ -414,4 +422,8 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do as: :activity ) end + + defp add_application(params, app_id) do + params |> Map.put(:application, Pleroma.Web.OAuth.App.get_app_by_id(app_id)) + end end -- cgit v1.2.3 From 981349f21d401da55168fdb00b245e3dccea1afd Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 9 Feb 2021 18:19:20 -0600 Subject: Enable rendering of the client application data details --- lib/pleroma/web/mastodon_api/views/status_view.ex | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 2cd6732fe..e4f623b97 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -180,10 +180,7 @@ def render( media_attachments: reblogged[:media_attachments] || [], mentions: mentions, tags: reblogged[:tags] || [], - application: %{ - name: "Web", - website: nil - }, + application: activity_object.data["application"], language: nil, emojis: [], pleroma: %{ @@ -348,10 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} poll: render(PollView, "show.json", object: object, for: opts[:for]), mentions: mentions, tags: build_tags(tags), - application: %{ - name: "Web", - website: nil - }, + application: object.data["application"], language: nil, emojis: build_emojis(object.data["emoji"]), pleroma: %{ -- cgit v1.2.3 From 4540e08a6a19cea753e1271ebc9f79bf2e4c47ce Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 9 Feb 2021 18:51:59 -0600 Subject: Rendering fallback for when we don't have valid data available --- lib/pleroma/web/mastodon_api/views/status_view.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index e4f623b97..38960c256 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -180,7 +180,7 @@ def render( media_attachments: reblogged[:media_attachments] || [], mentions: mentions, tags: reblogged[:tags] || [], - application: activity_object.data["application"], + application: activity_object.data["application"] || %{name: "Web", website: nil}, language: nil, emojis: [], pleroma: %{ @@ -345,7 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} poll: render(PollView, "show.json", object: object, for: opts[:for]), mentions: mentions, tags: build_tags(tags), - application: object.data["application"], + application: object.data["application"] || %{name: "Web", website: nil}, language: nil, emojis: build_emojis(object.data["emoji"]), pleroma: %{ -- cgit v1.2.3 From b5d001fc8c898e32f8c155cd5081a2fe545531a5 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 10 Feb 2021 18:44:49 +0300 Subject: not used mock --- test/fixtures/users_mock/localhost.json | 41 ---------------------- test/pleroma/notification_test.exs | 13 ------- .../controllers/notification_controller_test.exs | 13 ------- .../mastodon_api/views/notification_view_test.exs | 13 ------- test/pleroma/web/streamer_test.exs | 22 ------------ 5 files changed, 102 deletions(-) delete mode 100644 test/fixtures/users_mock/localhost.json diff --git a/test/fixtures/users_mock/localhost.json b/test/fixtures/users_mock/localhost.json deleted file mode 100644 index a49935db1..000000000 --- a/test/fixtures/users_mock/localhost.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "@context": [ - "https://www.w3.org/ns/activitystreams", - "http://localhost:4001/schemas/litepub-0.1.jsonld", - { - "@language": "und" - } - ], - "attachment": [], - "endpoints": { - "oauthAuthorizationEndpoint": "http://localhost:4001/oauth/authorize", - "oauthRegistrationEndpoint": "http://localhost:4001/api/v1/apps", - "oauthTokenEndpoint": "http://localhost:4001/oauth/token", - "sharedInbox": "http://localhost:4001/inbox" - }, - "followers": "http://localhost:4001/users/{{nickname}}/followers", - "following": "http://localhost:4001/users/{{nickname}}/following", - "icon": { - "type": "Image", - "url": "http://localhost:4001/media/4e914f5b84e4a259a3f6c2d2edc9ab642f2ab05f3e3d9c52c81fc2d984b3d51e.jpg" - }, - "id": "http://localhost:4001/users/{{nickname}}", - "image": { - "type": "Image", - "url": "http://localhost:4001/media/f739efddefeee49c6e67e947c4811fdc911785c16ae43da4c3684051fbf8da6a.jpg?name=f739efddefeee49c6e67e947c4811fdc911785c16ae43da4c3684051fbf8da6a.jpg" - }, - "inbox": "http://localhost:4001/users/{{nickname}}/inbox", - "manuallyApprovesFollowers": false, - "name": "{{nickname}}", - "outbox": "http://localhost:4001/users/{{nickname}}/outbox", - "preferredUsername": "{{nickname}}", - "publicKey": { - "id": "http://localhost:4001/users/{{nickname}}#main-key", - "owner": "http://localhost:4001/users/{{nickname}}", - "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5DLtwGXNZElJyxFGfcVc\nXANhaMadj/iYYQwZjOJTV9QsbtiNBeIK54PJrYuU0/0YIdrvS1iqheX5IwXRhcwa\nhm3ZyLz7XeN9st7FBni4BmZMBtMpxAuYuu5p/jbWy13qAiYOhPreCx0wrWgm/lBD\n9mkgaxIxPooBE0S4ZWEJIDIV1Vft3AWcRUyWW1vIBK0uZzs6GYshbQZB952S0yo4\nFzI1hABGHncH8UvuFauh4EZ8tY7/X5I0pGRnDOcRN1dAht5w5yTA+6r5kebiFQjP\nIzN/eCO/a9Flrj9YGW7HDNtjSOH0A31PLRGlJtJO3yK57dnf5ppyCZGfL4emShQo\ncQIDAQAB\n-----END PUBLIC KEY-----\n\n" - }, - "summary": "your friendly neighborhood pleroma developer
I like cute things and distributed systems, and really hate delete and redrafts", - "tag": [], - "type": "Person", - "url": "http://localhost:4001/users/{{nickname}}" -} \ No newline at end of file diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs index 948587292..abf1b0410 100644 --- a/test/pleroma/notification_test.exs +++ b/test/pleroma/notification_test.exs @@ -990,7 +990,6 @@ test "notifications are deleted if a remote user is deleted" do assert Enum.empty?(Notification.for_user(local_user)) end - @tag capture_log: true test "move activity generates a notification" do %{ap_id: old_ap_id} = old_user = insert(:user) %{ap_id: new_ap_id} = new_user = insert(:user, also_known_as: [old_ap_id]) @@ -1000,18 +999,6 @@ test "move activity generates a notification" do User.follow(follower, old_user) User.follow(other_follower, old_user) - old_user_url = old_user.ap_id - - body = - File.read!("test/fixtures/users_mock/localhost.json") - |> String.replace("{{nickname}}", old_user.nickname) - |> Jason.encode!() - - Tesla.Mock.mock(fn - %{method: :get, url: ^old_user_url} -> - %Tesla.Env{status: 200, body: body} - end) - Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user) ObanHelpers.perform_all() diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs index 631e5c4fc..2615912a8 100644 --- a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs @@ -555,24 +555,11 @@ test "see notifications after muting user with notifications and with_muted para assert length(json_response_and_validate_schema(conn, 200)) == 1 end - @tag capture_log: true test "see move notifications" do old_user = insert(:user) new_user = insert(:user, also_known_as: [old_user.ap_id]) %{user: follower, conn: conn} = oauth_access(["read:notifications"]) - old_user_url = old_user.ap_id - - body = - File.read!("test/fixtures/users_mock/localhost.json") - |> String.replace("{{nickname}}", old_user.nickname) - |> Jason.encode!() - - Tesla.Mock.mock(fn - %{method: :get, url: ^old_user_url} -> - %Tesla.Env{status: 200, body: body} - end) - User.follow(follower, old_user) Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user) Pleroma.Tests.ObanHelpers.perform_all() diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs index 965044fd3..496a688d1 100644 --- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs @@ -144,24 +144,11 @@ test "Follow notification" do refute Repo.one(Notification) end - @tag capture_log: true test "Move notification" do old_user = insert(:user) new_user = insert(:user, also_known_as: [old_user.ap_id]) follower = insert(:user) - old_user_url = old_user.ap_id - - body = - File.read!("test/fixtures/users_mock/localhost.json") - |> String.replace("{{nickname}}", old_user.nickname) - |> Jason.encode!() - - Tesla.Mock.mock(fn - %{method: :get, url: ^old_user_url} -> - %Tesla.Env{status: 200, body: body} - end) - User.follow(follower, old_user) Pleroma.Web.ActivityPub.ActivityPub.move(old_user, new_user) Pleroma.Tests.ObanHelpers.perform_all() diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs index cef2b7629..b788a9138 100644 --- a/test/pleroma/web/streamer_test.exs +++ b/test/pleroma/web/streamer_test.exs @@ -383,19 +383,8 @@ test "it sends follow activities to the 'user:notification' stream", %{ user: user, token: oauth_token } do - user_url = user.ap_id user2 = insert(:user) - body = - File.read!("test/fixtures/users_mock/localhost.json") - |> String.replace("{{nickname}}", user.nickname) - |> Jason.encode!() - - Tesla.Mock.mock_global(fn - %{method: :get, url: ^user_url} -> - %Tesla.Env{status: 200, body: body} - end) - Streamer.get_topic_and_add_socket("user:notification", user, oauth_token) {:ok, _follower, _followed, follow_activity} = CommonAPI.follow(user2, user) @@ -409,20 +398,9 @@ test "it sends follow relationships updates to the 'user' stream", %{ token: oauth_token } do user_id = user.id - user_url = user.ap_id other_user = insert(:user) other_user_id = other_user.id - body = - File.read!("test/fixtures/users_mock/localhost.json") - |> String.replace("{{nickname}}", user.nickname) - |> Jason.encode!() - - Tesla.Mock.mock_global(fn - %{method: :get, url: ^user_url} -> - %Tesla.Env{status: 200, body: body} - end) - Streamer.get_topic_and_add_socket("user", user, oauth_token) {:ok, _follower, _followed, _follow_activity} = CommonAPI.follow(user, other_user) -- cgit v1.2.3 From df89b5019b2c284d02361de509a2306db5115153 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 11 Feb 2021 15:02:50 +0300 Subject: [#2510] Improved support for app-bound OAuth tokens. Auth-related refactoring. --- .../web/mastodon_api/controllers/app_controller.ex | 20 ++++++++---- lib/pleroma/web/mastodon_api/views/app_view.ex | 4 +-- lib/pleroma/web/plugs/ensure_authenticated_plug.ex | 4 +++ .../plugs/ensure_public_or_authenticated_plug.ex | 5 +++ .../web/plugs/ensure_user_token_assigns_plug.ex | 5 +++ lib/pleroma/web/router.ex | 38 ++++++++++++++-------- .../controllers/app_controller_test.exs | 28 +++++++++------- 7 files changed, 70 insertions(+), 34 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex index a7e4d93f5..dd3b39c77 100644 --- a/lib/pleroma/web/mastodon_api/controllers/app_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/app_controller.ex @@ -3,6 +3,11 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.MastodonAPI.AppController do + @moduledoc """ + Controller for supporting app-related actions. + If authentication is an option, app tokens (user-unbound) must be supported. + """ + use Pleroma.Web, :controller alias Pleroma.Repo @@ -17,11 +22,9 @@ defmodule Pleroma.Web.MastodonAPI.AppController do plug( :skip_plug, [OAuthScopesPlug, EnsurePublicOrAuthenticatedPlug] - when action == :create + when action in [:create, :verify_credentials] ) - plug(OAuthScopesPlug, %{scopes: ["read"]} when action == :verify_credentials) - plug(Pleroma.Web.ApiSpec.CastAndValidate) @local_mastodon_name "Mastodon-Local" @@ -44,10 +47,13 @@ def create(%{body_params: params} = conn, _params) do end end - @doc "GET /api/v1/apps/verify_credentials" - def verify_credentials(%{assigns: %{user: _user, token: token}} = conn, _) do - with %Token{app: %App{} = app} <- Repo.preload(token, :app) do - render(conn, "short.json", app: app) + @doc """ + GET /api/v1/apps/verify_credentials + Gets compact non-secret representation of the app. Supports app tokens and user tokens. + """ + def verify_credentials(%{assigns: %{token: %Token{} = token}} = conn, _) do + with %{app: %App{} = app} <- Repo.preload(token, :app) do + render(conn, "compact_non_secret.json", app: app) end end end diff --git a/lib/pleroma/web/mastodon_api/views/app_view.ex b/lib/pleroma/web/mastodon_api/views/app_view.ex index 3d7131e09..c406b5a27 100644 --- a/lib/pleroma/web/mastodon_api/views/app_view.ex +++ b/lib/pleroma/web/mastodon_api/views/app_view.ex @@ -34,10 +34,10 @@ def render("show.json", %{app: %App{} = app}) do |> with_vapid_key() end - def render("short.json", %{app: %App{website: webiste, client_name: name}}) do + def render("compact_non_secret.json", %{app: %App{website: website, client_name: name}}) do %{ name: name, - website: webiste + website: website } |> with_vapid_key() end diff --git a/lib/pleroma/web/plugs/ensure_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex index a4b5dc257..31e7410d6 100644 --- a/lib/pleroma/web/plugs/ensure_authenticated_plug.ex +++ b/lib/pleroma/web/plugs/ensure_authenticated_plug.ex @@ -3,6 +3,10 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsureAuthenticatedPlug do + @moduledoc """ + Ensures _user_ authentication (app-bound user-unbound tokens are not accepted). + """ + import Plug.Conn import Pleroma.Web.TranslationHelpers diff --git a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex index b6dfc4f3c..8a8532f41 100644 --- a/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex +++ b/lib/pleroma/web/plugs/ensure_public_or_authenticated_plug.ex @@ -3,6 +3,11 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlug do + @moduledoc """ + Ensures instance publicity or _user_ authentication + (app-bound user-unbound tokens are accepted only if the instance is public). + """ + import Pleroma.Web.TranslationHelpers import Plug.Conn diff --git a/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex b/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex index 3a2b5dda8..534b0cff1 100644 --- a/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex +++ b/lib/pleroma/web/plugs/ensure_user_token_assigns_plug.ex @@ -28,6 +28,11 @@ def call(%{assigns: %{user: %User{id: user_id}} = assigns} = conn, _) do end end + # App-bound token case (obtained with client_id and client_secret) + def call(%{assigns: %{token: %Token{user_id: nil}}} = conn, _) do + assign(conn, :user, nil) + end + def call(conn, _) do conn |> assign(:user, nil) diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 2105d7e9e..297f03fbd 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -37,11 +37,13 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug) end - pipeline :expect_authentication do + # Note: expects _user_ authentication (user-unbound app-bound tokens don't qualify) + pipeline :expect_user_authentication do plug(Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug) end - pipeline :expect_public_instance_or_authentication do + # Note: expects public instance or _user_ authentication (user-unbound tokens don't qualify) + pipeline :expect_public_instance_or_user_authentication do plug(Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug) end @@ -66,23 +68,30 @@ defmodule Pleroma.Web.Router do plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec) end - pipeline :api do - plug(:expect_public_instance_or_authentication) + pipeline :no_auth_or_privacy_expectations_api do plug(:base_api) plug(:after_auth) plug(Pleroma.Web.Plugs.IdempotencyPlug) end + # Pipeline for app-related endpoints (no user auth checks — app-bound tokens must be supported) + pipeline :app_api do + plug(:no_auth_or_privacy_expectations_api) + end + + pipeline :api do + plug(:expect_public_instance_or_user_authentication) + plug(:no_auth_or_privacy_expectations_api) + end + pipeline :authenticated_api do - plug(:expect_authentication) - plug(:base_api) - plug(:after_auth) + plug(:expect_user_authentication) + plug(:no_auth_or_privacy_expectations_api) plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug) - plug(Pleroma.Web.Plugs.IdempotencyPlug) end pipeline :admin_api do - plug(:expect_authentication) + plug(:expect_user_authentication) plug(:base_api) plug(Pleroma.Web.Plugs.AdminSecretAuthenticationPlug) plug(:after_auth) @@ -432,8 +441,6 @@ defmodule Pleroma.Web.Router do post("/accounts/:id/mute", AccountController, :mute) post("/accounts/:id/unmute", AccountController, :unmute) - get("/apps/verify_credentials", AppController, :verify_credentials) - get("/conversations", ConversationController, :index) post("/conversations/:id/read", ConversationController, :mark_as_read) @@ -524,6 +531,13 @@ defmodule Pleroma.Web.Router do put("/settings", MastoFEController, :put_settings) end + scope "/api/v1", Pleroma.Web.MastodonAPI do + pipe_through(:app_api) + + post("/apps", AppController, :create) + get("/apps/verify_credentials", AppController, :verify_credentials) + end + scope "/api/v1", Pleroma.Web.MastodonAPI do pipe_through(:api) @@ -540,8 +554,6 @@ defmodule Pleroma.Web.Router do get("/instance", InstanceController, :show) get("/instance/peers", InstanceController, :peers) - post("/apps", AppController, :create) - get("/statuses", StatusController, :index) get("/statuses/:id", StatusController, :show) get("/statuses/:id/context", StatusController, :context) diff --git a/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs index 238fd265b..76d81b942 100644 --- a/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/app_controller_test.exs @@ -12,22 +12,26 @@ defmodule Pleroma.Web.MastodonAPI.AppControllerTest do import Pleroma.Factory test "apps/verify_credentials", %{conn: conn} do - token = insert(:oauth_token) + user_bound_token = insert(:oauth_token) + app_bound_token = insert(:oauth_token, user: nil) + refute app_bound_token.user - conn = - conn - |> put_req_header("authorization", "Bearer #{token.token}") - |> get("/api/v1/apps/verify_credentials") + for token <- [app_bound_token, user_bound_token] do + conn = + conn + |> put_req_header("authorization", "Bearer #{token.token}") + |> get("/api/v1/apps/verify_credentials") - app = Repo.preload(token, :app).app + app = Repo.preload(token, :app).app - expected = %{ - "name" => app.client_name, - "website" => app.website, - "vapid_key" => Push.vapid_config() |> Keyword.get(:public_key) - } + expected = %{ + "name" => app.client_name, + "website" => app.website, + "vapid_key" => Push.vapid_config() |> Keyword.get(:public_key) + } - assert expected == json_response_and_validate_schema(conn, 200) + assert expected == json_response_and_validate_schema(conn, 200) + end end test "creates an oauth app", %{conn: conn} do -- cgit v1.2.3 From a996ab46a54acbfa7a19da3eae12c78ed6466a1a Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 11 Feb 2021 19:30:21 +0300 Subject: [#3213] Reorganized hashtags cleanup. Transaction-wrapped Hashtag.get_or_create_by_names/1. Misc. improvements. --- config/config.exs | 1 - config/description.exs | 1 - lib/pleroma/hashtag.ex | 60 +++++++++++++++---- lib/pleroma/migrators/hashtags_table_migrator.ex | 70 +++++++++++++++------- lib/pleroma/object.ex | 27 +++++---- .../workers/cron/hashtags_cleanup_worker.ex | 57 ------------------ 6 files changed, 114 insertions(+), 102 deletions(-) delete mode 100644 lib/pleroma/workers/cron/hashtags_cleanup_worker.ex diff --git a/config/config.exs b/config/config.exs index 36c609936..91888c512 100644 --- a/config/config.exs +++ b/config/config.exs @@ -560,7 +560,6 @@ ], plugins: [Oban.Plugins.Pruner], crontab: [ - {"0 1 * * *", Pleroma.Workers.Cron.HashtagsCleanupWorker}, {"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker}, {"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker} ] diff --git a/config/description.exs b/config/description.exs index 02cdf2ff3..b2f301e2d 100644 --- a/config/description.exs +++ b/config/description.exs @@ -1964,7 +1964,6 @@ type: {:list, :tuple}, description: "Settings for cron background jobs", suggestions: [ - {"0 1 * * *", Pleroma.Workers.Cron.HashtagsCleanupWorker}, {"0 0 * * 0", Pleroma.Workers.Cron.DigestEmailsWorker}, {"0 0 * * *", Pleroma.Workers.Cron.NewUsersDigestWorker} ] diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex index 9e4c6c894..de52c4dae 100644 --- a/lib/pleroma/hashtag.ex +++ b/lib/pleroma/hashtag.ex @@ -6,14 +6,17 @@ defmodule Pleroma.Hashtag do use Ecto.Schema import Ecto.Changeset + import Ecto.Query + alias Ecto.Multi alias Pleroma.Hashtag + alias Pleroma.Object alias Pleroma.Repo schema "hashtags" do field(:name, :string) - many_to_many(:objects, Pleroma.Object, join_through: "hashtags_objects", on_replace: :delete) + many_to_many(:objects, Object, join_through: "hashtags_objects", on_replace: :delete) timestamps() end @@ -34,15 +37,27 @@ def get_or_create_by_name(name) when is_bitstring(name) do end def get_or_create_by_names(names) when is_list(names) do - Enum.reduce_while(names, {:ok, []}, fn name, {:ok, list} -> - case get_or_create_by_name(name) do - {:ok, %Hashtag{} = hashtag} -> - {:cont, {:ok, list ++ [hashtag]}} - - error -> - {:halt, error} - end - end) + timestamp = NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) + + structs = + Enum.map(names, fn name -> + %Hashtag{} + |> changeset(%{name: name}) + |> Map.get(:changes) + |> Map.merge(%{inserted_at: timestamp, updated_at: timestamp}) + end) + + with {:ok, %{query_op: hashtags}} <- + Multi.new() + |> Multi.insert_all(:insert_all_op, Hashtag, structs, on_conflict: :nothing) + |> Multi.run(:query_op, fn _repo, _changes -> + {:ok, Repo.all(from(ht in Hashtag, where: ht.name in ^names))} + end) + |> Repo.transaction() do + {:ok, hashtags} + else + {:error, _name, value, _changes_so_far} -> {:error, value} + end end def changeset(%Hashtag{} = struct, params) do @@ -52,4 +67,29 @@ def changeset(%Hashtag{} = struct, params) do |> validate_required([:name]) |> unique_constraint(:name) end + + def unlink(%Object{id: object_id}) do + with {_, hashtag_ids} <- + from(hto in "hashtags_objects", + where: hto.object_id == ^object_id, + select: hto.hashtag_id + ) + |> Repo.delete_all() do + delete_unreferenced(hashtag_ids) + end + end + + @delete_unreferenced_query """ + DELETE FROM hashtags WHERE id IN + (SELECT hashtags.id FROM hashtags + LEFT OUTER JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id + WHERE hashtags_objects.hashtag_id IS NULL AND hashtags.id = ANY($1)); + """ + + def delete_unreferenced(ids) do + with {:ok, %{num_rows: deleted_count}} <- Repo.query(@delete_unreferenced_query, [ids]) do + {:ok, deleted_count} + end + end end diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 9a036e0b2..c53f6be12 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -74,16 +74,15 @@ def handle_continue(:init_state, _state) do def handle_info(:migrate_hashtags, state) do State.clear() - data_migration = data_migration() + update_status(:running) + put_stat(:started_at, NaiveDateTime.utc_now()) + data_migration = data_migration() persistent_data = Map.take(data_migration.data, ["max_processed_id"]) {:ok, data_migration} = DataMigration.update(data_migration, %{state: :running, data: persistent_data}) - update_status(:running) - put_stat(:started_at, NaiveDateTime.utc_now()) - Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") max_processed_id = data_migration.data["max_processed_id"] || 0 @@ -137,6 +136,8 @@ def handle_info(:migrate_hashtags, state) do |> Stream.run() with 0 <- failures_count(data_migration.id) do + _ = delete_non_create_activities_hashtags() + {:ok, data_migration} = DataMigration.update_state(data_migration, :complete) handle_success(data_migration) @@ -150,9 +151,37 @@ def handle_info(:migrate_hashtags, state) do {:noreply, state} end + @hashtags_objects_cleanup_query """ + DELETE FROM hashtags_objects WHERE object_id IN + (SELECT DISTINCT objects.id FROM objects + JOIN hashtags_objects ON hashtags_objects.object_id = objects.id LEFT JOIN activities + ON COALESCE(activities.data->'object'->>'id', activities.data->>'object') = + (objects.data->>'id') + AND activities.data->>'type' = 'Create' + WHERE activities.id IS NULL); + """ + + @hashtags_cleanup_query """ + DELETE FROM hashtags WHERE id IN + (SELECT hashtags.id FROM hashtags + LEFT OUTER JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id + WHERE hashtags_objects.hashtag_id IS NULL); + """ + + def delete_non_create_activities_hashtags do + {:ok, %{num_rows: hashtags_objects_count}} = + Repo.query(@hashtags_objects_cleanup_query, [], timeout: :infinity) + + {:ok, %{num_rows: hashtags_count}} = + Repo.query(@hashtags_cleanup_query, [], timeout: :infinity) + + {:ok, hashtags_objects_count, hashtags_count} + end + defp query do # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) - # Note: not checking activity type; HashtagsCleanupWorker should clean up unused records later + # Note: not checking activity type, expecting remove_non_create_objects_hashtags/_ to clean up from( object in Object, where: @@ -182,25 +211,20 @@ defp transfer_object_hashtags(object) do defp transfer_object_hashtags(object, hashtags) do Repo.transaction(fn -> with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do - for hashtag_record <- hashtag_records do - with {:ok, _} <- - Repo.query( - "insert into hashtags_objects(hashtag_id, object_id) values ($1, $2);", - [hashtag_record.id, object.id] - ) do - nil - else - {:error, e} -> - error = - "ERROR: could not link object #{object.id} and hashtag " <> - "#{hashtag_record.id}: #{inspect(e)}" - - Logger.error(error) - Repo.rollback(object.id) - end + maps = Enum.map(hashtag_records, &%{hashtag_id: &1.id, object_id: object.id}) + expected_rows = length(hashtag_records) + + with {^expected_rows, _} <- Repo.insert_all("hashtags_objects", maps) do + object.id + else + e -> + error = + "ERROR when inserting #{expected_rows} hashtags_objects " <> + "for object #{object.id}: #{inspect(e)}" + + Logger.error(error) + Repo.rollback(object.id) end - - object.id else e -> error = "ERROR: could not create hashtags for object #{object.id}: #{inspect(e)}" diff --git a/lib/pleroma/object.ex b/lib/pleroma/object.ex index 52b77e41c..3ba749d1a 100644 --- a/lib/pleroma/object.ex +++ b/lib/pleroma/object.ex @@ -62,27 +62,30 @@ def change(struct, params \\ %{}) do |> cast(params, [:data]) |> validate_required([:data]) |> unique_constraint(:ap_id, name: :objects_unique_apid_index) + # Expecting `maybe_handle_hashtags_change/1` to run last: |> maybe_handle_hashtags_change(struct) end - # Note: not checking activity type; HashtagsCleanupWorker should clean up unused records later + # Note: not checking activity type (assuming non-legacy objects are associated with Create act.) defp maybe_handle_hashtags_change(changeset, struct) do - with data_hashtags_change = get_change(changeset, :data), - true <- hashtags_changed?(struct, data_hashtags_change), + with %Ecto.Changeset{valid?: true} <- changeset, + data_hashtags_change = get_change(changeset, :data), + {_, true} <- {:changed, hashtags_changed?(struct, data_hashtags_change)}, {:ok, hashtag_records} <- data_hashtags_change |> object_data_hashtags() |> Hashtag.get_or_create_by_names() do put_assoc(changeset, :hashtags, hashtag_records) else - false -> + %{valid?: false} -> changeset - {:error, hashtag_changeset} -> - failed_hashtag = get_field(hashtag_changeset, :name) + {:changed, false} -> + changeset + {:error, _} -> validate_change(changeset, :data, fn _, _ -> - [data: "error referencing hashtag: #{failed_hashtag}"] + [data: "error referencing hashtags"] end) end end @@ -221,9 +224,13 @@ def make_tombstone(%Object{data: %{"id" => id, "type" => type}}, deleted \\ Date def swap_object_with_tombstone(object) do tombstone = make_tombstone(object) - object - |> Object.change(%{data: tombstone}) - |> Repo.update() + with {:ok, object} <- + object + |> Object.change(%{data: tombstone}) + |> Repo.update() do + Hashtag.unlink(object) + {:ok, object} + end end def delete(%Object{data: %{"id" => id}} = object) do diff --git a/lib/pleroma/workers/cron/hashtags_cleanup_worker.ex b/lib/pleroma/workers/cron/hashtags_cleanup_worker.ex deleted file mode 100644 index b319067ca..000000000 --- a/lib/pleroma/workers/cron/hashtags_cleanup_worker.ex +++ /dev/null @@ -1,57 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Workers.Cron.HashtagsCleanupWorker do - @moduledoc """ - The worker to clean up unused hashtags_objects and hashtags. - """ - - use Oban.Worker, queue: "hashtags_cleanup" - - alias Pleroma.Repo - - require Logger - - @hashtags_objects_query """ - DELETE FROM hashtags_objects WHERE object_id IN - (SELECT DISTINCT objects.id FROM objects - JOIN hashtags_objects ON hashtags_objects.object_id = objects.id LEFT JOIN activities - ON COALESCE(activities.data->'object'->>'id', activities.data->>'object') = - (objects.data->>'id') - AND activities.data->>'type' = 'Create' - WHERE activities.id IS NULL); - """ - - @hashtags_query """ - DELETE FROM hashtags WHERE id IN - (SELECT hashtags.id FROM hashtags - LEFT OUTER JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id - WHERE hashtags_objects.hashtag_id IS NULL AND hashtags.inserted_at < $1); - """ - - @impl Oban.Worker - def perform(_job) do - Logger.info("Cleaning up unused `hashtags_objects` records...") - - {:ok, %{num_rows: hashtags_objects_count}} = - Repo.query(@hashtags_objects_query, [], timeout: :infinity) - - Logger.info("Deleted #{hashtags_objects_count} unused `hashtags_objects` records.") - - Logger.info("Cleaning up unused `hashtags` records...") - - # Note: ignoring recently created hashtags since references are added after hashtag is created - {:ok, %{num_rows: hashtags_count}} = - Repo.query(@hashtags_query, [NaiveDateTime.add(NaiveDateTime.utc_now(), -3600 * 24)], - timeout: :infinity - ) - - Logger.info("Deleted #{hashtags_count} unused `hashtags` records.") - - Logger.info("HashtagsCleanupWorker complete.") - - :ok - end -end -- cgit v1.2.3 From 09b8378646122053e418e08d2cb35d154c01e52c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 14:15:25 -0600 Subject: %Token{} may not be in the conn, so avoid breaking the ability to post statuses in that scenario. --- .../web/mastodon_api/controllers/status_controller.ex | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 47a5bbd60..6eb518684 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -132,7 +132,7 @@ def index(%{assigns: %{user: user}} = conn, %{ids: ids} = params) do # Creates a scheduled status when `scheduled_at` param is present and it's far enough def create( %{ - assigns: %{user: user, token: %{app_id: app_id}}, + assigns: %{user: user}, body_params: %{status: _, scheduled_at: scheduled_at} = params } = conn, _ @@ -140,7 +140,7 @@ def create( when not is_nil(scheduled_at) do params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) - |> add_application(app_id) + |> add_application(conn) attrs = %{ params: Map.new(params, fn {key, value} -> {to_string(key), value} end), @@ -164,13 +164,12 @@ def create( # Creates a regular status def create( - %{assigns: %{user: user, token: %{app_id: app_id}}, body_params: %{status: _} = params} = - conn, + %{assigns: %{user: user}, body_params: %{status: _} = params} = conn, _ ) do params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) - |> add_application(app_id) + |> add_application(conn) with {:ok, activity} <- CommonAPI.post(user, params) do try_render(conn, "show.json", @@ -423,7 +422,9 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do ) end - defp add_application(params, app_id) do + defp add_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do params |> Map.put(:application, Pleroma.Web.OAuth.App.get_app_by_id(app_id)) end + + defp add_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil}) end -- cgit v1.2.3 From 7c508319a57f3ba50ddae03dc72aa83d1cd044cf Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 14:19:53 -0600 Subject: Prefer naming this put_application because we're putting it into the params map --- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 6eb518684..a54357f93 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -140,7 +140,7 @@ def create( when not is_nil(scheduled_at) do params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) - |> add_application(conn) + |> put_application(conn) attrs = %{ params: Map.new(params, fn {key, value} -> {to_string(key), value} end), @@ -169,7 +169,7 @@ def create( ) do params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) - |> add_application(conn) + |> put_application(conn) with {:ok, activity} <- CommonAPI.post(user, params) do try_render(conn, "show.json", @@ -422,9 +422,9 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do ) end - defp add_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do + defp put_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do params |> Map.put(:application, Pleroma.Web.OAuth.App.get_app_by_id(app_id)) end - defp add_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil}) + defp put_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil}) end -- cgit v1.2.3 From 6dc0b13cf850c4aee7c9f84df0f97467434e6d2b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 14:22:58 -0600 Subject: Revert to original formatting for these function defs --- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index a54357f93..c8f6a2994 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -163,10 +163,7 @@ def create( end # Creates a regular status - def create( - %{assigns: %{user: user}, body_params: %{status: _} = params} = conn, - _ - ) do + def create(%{assigns: %{user: user}, body_params: %{status: _} = params} = conn, _) do params = Map.put(params, :in_reply_to_status_id, params[:in_reply_to_id]) |> put_application(conn) -- cgit v1.2.3 From c1d78328ee38fb2bc6c6f56c26588557f27365a9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 14:27:52 -0600 Subject: Consistency --- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index c8f6a2994..ec3e79ea7 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -420,7 +420,7 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do end defp put_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do - params |> Map.put(:application, Pleroma.Web.OAuth.App.get_app_by_id(app_id)) + Map.put(params, :application, Pleroma.Web.OAuth.App.get_app_by_id(app_id)) end defp put_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil}) -- cgit v1.2.3 From 333ff527fd44bce06b7c7e7450494ea929017b56 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 15:07:21 -0600 Subject: Validate client application metadata is retained in the object --- .../mastodon_api/controllers/status_controller_test.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index dcd1e6d5b..fada7c25c 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -357,6 +357,23 @@ test "posting a direct status", %{conn: conn} do assert activity.data["to"] == [user2.ap_id] assert activity.data["cc"] == [] end + + test "preserves client application metadata", %{conn: conn} do + result = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses", %{ + "status" => "cofe is my copilot" + }) + + assert %{ + "content" => "cofe is my copilot", + "application" => %{ + "name" => "Some client 0", + "website" => "https://example.com" + } + } = json_response_and_validate_schema(result, 200) + end end describe "posting scheduled statuses" do -- cgit v1.2.3 From 4b979538bcc0861ed81b6af72bbe48af07425c18 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 15:10:53 -0600 Subject: Document the application metadata is now retained as part of the post. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd898bdf..69b9e2c52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) +- The `application` metadata returned with statuses is no longer hardcoded. Apps that want to display these details will now have valid data for new posts after this change.
API Changes -- cgit v1.2.3 From bd3d0e8b57f6a27b8c833d11f4b98d4dbfd846ad Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Feb 2021 15:53:10 -0600 Subject: Use a custom oauth token so we can predict and validate the client_name and website --- .../mastodon_api/controllers/status_controller_test.exs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index fada7c25c..1ca829544 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -358,7 +358,16 @@ test "posting a direct status", %{conn: conn} do assert activity.data["cc"] == [] end - test "preserves client application metadata", %{conn: conn} do + test "preserves client application metadata" do + %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"]) + + %Pleroma.Web.OAuth.Token{ + app: %Pleroma.Web.OAuth.App{ + client_name: _app_name, + website: _app_website + } + } = token + result = conn |> put_req_header("content-type", "application/json") @@ -369,8 +378,8 @@ test "preserves client application metadata", %{conn: conn} do assert %{ "content" => "cofe is my copilot", "application" => %{ - "name" => "Some client 0", - "website" => "https://example.com" + "name" => app_name, + "website" => app_website } } = json_response_and_validate_schema(result, 200) end -- cgit v1.2.3 From 9b61df1fb64c49a4ad6277862d1405a27ad1c0da Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 12 Feb 2021 12:44:45 -0600 Subject: App is already preloaded into the token, so avoid an extra query --- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 6 ++++-- lib/pleroma/web/o_auth/app.ex | 10 ---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index ec3e79ea7..db3f248e5 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -21,6 +21,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.ScheduledActivityView + alias Pleroma.Web.OAuth.Token alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter @@ -419,8 +420,9 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do ) end - defp put_application(params, %{assigns: %{token: %{app_id: app_id}}} = _conn) do - Map.put(params, :application, Pleroma.Web.OAuth.App.get_app_by_id(app_id)) + defp put_application(params, %{assigns: %{token: %Token{} = token}} = _conn) do + %{client_name: client_name, website: website} = Repo.preload(token, :app).app + Map.put(params, :application, %{name: client_name, website: website}) end defp put_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil}) diff --git a/lib/pleroma/web/o_auth/app.ex b/lib/pleroma/web/o_auth/app.ex index 083b5ce09..382750010 100644 --- a/lib/pleroma/web/o_auth/app.ex +++ b/lib/pleroma/web/o_auth/app.ex @@ -146,14 +146,4 @@ def errors(changeset) do Map.put(acc, key, error) end) end - - @spec get_app_by_id(pos_integer()) :: {:ok, map()} - def get_app_by_id(app_id) do - query = - __MODULE__ - |> where([a], a.id == ^app_id) - |> select([a], %{name: a.client_name, website: a.website}) - - Repo.one!(query) - end end -- cgit v1.2.3 From 3554a65f45d0e513e5e23e987f6f8fb1da5e8525 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 12 Feb 2021 13:05:12 -0600 Subject: Inject fake application metadata and validate it is stripped by transmogrifier --- lib/pleroma/constants.ex | 3 ++- test/pleroma/web/activity_pub/transmogrifier_test.exs | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/constants.ex b/lib/pleroma/constants.ex index a40741ba6..9ee836d5d 100644 --- a/lib/pleroma/constants.ex +++ b/lib/pleroma/constants.ex @@ -18,7 +18,8 @@ defmodule Pleroma.Constants do "emoji", "context_id", "deleted_activity_id", - "pleroma_internal" + "pleroma_internal", + "application" ] ) diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 7c97fa8f8..2c99875ff 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -202,7 +202,11 @@ test "it strips internal hashtag data" do test "it strips internal fields" do user = insert(:user) - {:ok, activity} = CommonAPI.post(user, %{status: "#2hu :firefox:"}) + {:ok, activity} = + CommonAPI.post(user, %{ + status: "#2hu :firefox:", + application: %{name: "TestClient", website: "https://pleroma.social"} + }) {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) @@ -213,6 +217,7 @@ test "it strips internal fields" do assert is_nil(modified["object"]["announcements"]) assert is_nil(modified["object"]["announcement_count"]) assert is_nil(modified["object"]["context_id"]) + assert is_nil(modified["object"]["application"]) end test "it strips internal fields of article" do -- cgit v1.2.3 From fb2a8e7ccd6cfbfb9bc226998a083405fcebcbe0 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 12 Feb 2021 13:15:33 -0600 Subject: Additional validation so we don't get caught off guard with a nil response if CommonAPI ever prevents us from injecting this data --- test/pleroma/web/activity_pub/transmogrifier_test.exs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 2c99875ff..33ccbe2a7 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -208,6 +208,12 @@ test "it strips internal fields" do application: %{name: "TestClient", website: "https://pleroma.social"} }) + # Ensure injected application data made it into the activity + # as we don't have a Token to derive it from, otherwise it will + # be nil and the test will pass + assert %{"application" => %{name: "TestClient", website: "https://pleroma.social"}} = + activity.object.data + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) assert length(modified["object"]["tag"]) == 2 -- cgit v1.2.3 From 349b8b0f4fb1c2b86f913e1840f15c052ff43c24 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sat, 13 Feb 2021 22:01:11 +0300 Subject: [#3213] `rescue` around potentially-raising `Repo.insert_all/_` calls. Misc. improvements (docs etc.). --- CHANGELOG.md | 2 +- config/config.exs | 1 - config/description.exs | 14 ++++++++++++ docs/configuration/cheatsheet.md | 6 +++++ lib/pleroma/hashtag.ex | 29 ++++++++++++++---------- lib/pleroma/migrators/hashtags_table_migrator.ex | 21 ++++++++++------- 6 files changed, 51 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23567a97c..a7b5f6ac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Admin API: Reports now ordered by newest
-- Extracted object hashtags into separate table in order to improve hashtag timeline performance (via background migration in `Pleroma.Migrators.HashtagsTableMigrator`). +- Improved hashtag timeline performance (requires a background migration). ### Added diff --git a/config/config.exs b/config/config.exs index 8a7c466d3..0fbca06f3 100644 --- a/config/config.exs +++ b/config/config.exs @@ -556,7 +556,6 @@ remote_fetcher: 2, attachments_cleanup: 1, new_users_digest: 1, - hashtags_cleanup: 1, mute_expire: 5 ], plugins: [Oban.Plugins.Pruner], diff --git a/config/description.exs b/config/description.exs index 2e96024f5..29fc5fbd4 100644 --- a/config/description.exs +++ b/config/description.exs @@ -473,6 +473,20 @@ } ] }, + %{ + group: :pleroma, + key: :populate_hashtags_table, + type: :group, + description: "`populate_hashtags_table` background migration settings", + children: [ + %{ + key: :sleep_interval_ms, + type: :integer, + description: + "Sleep interval between each chunk of processed records in order to decrease the load on the system (defaults to 0 and should be keep default on most instances)." + } + ] + }, %{ group: :pleroma, key: :instance, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index ad5768465..68a5a3c7f 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -65,6 +65,12 @@ To add configuration to your config file, you can copy it from the base config. * `show_reactions`: Let favourites and emoji reactions be viewed through the API (default: `true`). * `password_reset_token_validity`: The time after which reset tokens aren't accepted anymore, in seconds (default: one day). +## :database +* `improved_hashtag_timeline`: If `true`, hashtags will be fetched from `hashtags` table for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when `HashtagsTableMigrator` completes. + +## Background migrations +* `populate_hashtags_table/sleep_interval_ms`: Sleep interval between each chunk of processed records in order to decrease the load on the system (defaults to 0 and should be keep default on most instances). + ## Welcome * `direct_message`: - welcome message sent as a direct message. * `enabled`: Enables the send a direct message to a newly registered user. Defaults to `false`. diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex index de52c4dae..0d6a4d09e 100644 --- a/lib/pleroma/hashtag.ex +++ b/lib/pleroma/hashtag.ex @@ -47,16 +47,20 @@ def get_or_create_by_names(names) when is_list(names) do |> Map.merge(%{inserted_at: timestamp, updated_at: timestamp}) end) - with {:ok, %{query_op: hashtags}} <- - Multi.new() - |> Multi.insert_all(:insert_all_op, Hashtag, structs, on_conflict: :nothing) - |> Multi.run(:query_op, fn _repo, _changes -> - {:ok, Repo.all(from(ht in Hashtag, where: ht.name in ^names))} - end) - |> Repo.transaction() do - {:ok, hashtags} - else - {:error, _name, value, _changes_so_far} -> {:error, value} + try do + with {:ok, %{query_op: hashtags}} <- + Multi.new() + |> Multi.insert_all(:insert_all_op, Hashtag, structs, on_conflict: :nothing) + |> Multi.run(:query_op, fn _repo, _changes -> + {:ok, Repo.all(from(ht in Hashtag, where: ht.name in ^names))} + end) + |> Repo.transaction() do + {:ok, hashtags} + else + {:error, _name, value, _changes_so_far} -> {:error, value} + end + rescue + e -> {:error, e} end end @@ -74,8 +78,9 @@ def unlink(%Object{id: object_id}) do where: hto.object_id == ^object_id, select: hto.hashtag_id ) - |> Repo.delete_all() do - delete_unreferenced(hashtag_ids) + |> Repo.delete_all(), + {:ok, unreferenced_count} <- delete_unreferenced(hashtag_ids) do + {:ok, length(hashtag_ids), unreferenced_count} end end diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index c53f6be12..432c3401a 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -214,15 +214,20 @@ defp transfer_object_hashtags(object, hashtags) do maps = Enum.map(hashtag_records, &%{hashtag_id: &1.id, object_id: object.id}) expected_rows = length(hashtag_records) - with {^expected_rows, _} <- Repo.insert_all("hashtags_objects", maps) do - object.id - else + base_error = + "ERROR when inserting #{expected_rows} hashtags_objects for obj. #{object.id}" + + try do + with {^expected_rows, _} <- Repo.insert_all("hashtags_objects", maps) do + object.id + else + e -> + Logger.error("#{base_error}: #{inspect(e)}") + Repo.rollback(object.id) + end + rescue e -> - error = - "ERROR when inserting #{expected_rows} hashtags_objects " <> - "for object #{object.id}: #{inspect(e)}" - - Logger.error(error) + Logger.error("#{base_error}: #{inspect(e)}") Repo.rollback(object.id) end else -- cgit v1.2.3 From 284504f689b03e23f7db0033a53dbf953663e395 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 15 Feb 2021 09:08:04 +0300 Subject: [#2053] Changed `Notification/for_user_query/2` to use join to filter out inactive actors instead of subselect of _all_ inactive AP ids from `users`. --- lib/pleroma/notification.ex | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/pleroma/notification.ex b/lib/pleroma/notification.ex index 1970fbf65..7efbdc49a 100644 --- a/lib/pleroma/notification.ex +++ b/lib/pleroma/notification.ex @@ -112,13 +112,6 @@ def for_user_query(user, opts \\ %{}) do Notification |> where(user_id: ^user.id) - |> where( - [n, a], - fragment( - "? not in (SELECT ap_id FROM users WHERE is_active = 'false')", - a.actor - ) - ) |> join(:inner, [n], activity in assoc(n, :activity)) |> join(:left, [n, a], object in Object, on: @@ -129,7 +122,9 @@ def for_user_query(user, opts \\ %{}) do a.data ) ) + |> join(:inner, [_n, a], u in User, on: u.ap_id == a.actor, as: :user_actor) |> preload([n, a, o], activity: {a, object: o}) + |> where([user_actor: user_actor], user_actor.is_active) |> exclude_notification_muted(user, exclude_notification_muted_opts) |> exclude_blocked(user, exclude_blocked_opts) |> exclude_filtered(user) @@ -156,9 +151,10 @@ defp exclude_notification_muted(query, user, opts) do query |> where([n, a], a.actor not in ^notification_muted_ap_ids) |> join(:left, [n, a], tm in ThreadMute, - on: tm.user_id == ^user.id and tm.context == fragment("?->>'context'", a.data) + on: tm.user_id == ^user.id and tm.context == fragment("?->>'context'", a.data), + as: :thread_mute ) - |> where([n, a, o, tm], is_nil(tm.user_id)) + |> where([thread_mute: thread_mute], is_nil(thread_mute.user_id)) end defp exclude_filtered(query, user) do -- cgit v1.2.3 From e2927d714eff9f9196a775b881dfe305e13dc62b Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 15 Feb 2021 13:19:44 +0300 Subject: Add myself to .mailmap I changed my email to rin@patch.cx --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index e4ca5f9b5..84fffaee7 100644 --- a/.mailmap +++ b/.mailmap @@ -1,2 +1,3 @@ Ariadne Conill Ariadne Conill +rinpatch -- cgit v1.2.3 From 956bbc1ec79d87447695936fd7ca1255dc56d479 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 15 Feb 2021 15:44:27 +0200 Subject: replace avi.png --- priv/static/images/avi.png | Bin 726 -> 1036 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/priv/static/images/avi.png b/priv/static/images/avi.png index c6595adad..df4e2d233 100644 Binary files a/priv/static/images/avi.png and b/priv/static/images/avi.png differ -- cgit v1.2.3 From 0c73935de1651d305216dde0ece95ce03f95e853 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 15 Feb 2021 15:52:36 +0200 Subject: update changelog to mention change of avatar --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd898bdf..93e5fab5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Provide redirect of external posts from `/notice/:id` to their original URL - Admins no longer receive notifications for reports if they are the actor making the report. - Improved Mailer configuration setting descriptions for AdminFE. +- Updated default avatar to look nicer.
API Changes -- cgit v1.2.3 From cf6d3db58f20de5224fa77dbf902e78a653ced96 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Mon, 15 Feb 2021 21:48:13 +0400 Subject: Add API endpoint to remove a conversation --- CHANGELOG.md | 1 + lib/pleroma/conversation.ex | 5 ++-- lib/pleroma/conversation/participation.ex | 4 ++++ .../api_spec/operations/conversation_operation.ex | 27 +++++++++++++++++----- .../controllers/conversation_controller.ex | 9 ++++++++ lib/pleroma/web/router.ex | 1 + test/pleroma/conversation/participation_test.exs | 12 ++++++++++ .../controllers/conversation_controller_test.exs | 26 +++++++++++++++++++++ 8 files changed, 76 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd898bdf..036550430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: Add monthly active users to `/api/v1/instance` (`pleroma.stats.mau`). - Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `remote` & `local` parameters for filtration. - Mastodon API: `/api/v1/accounts/:id` & `/api/v1/mutes` endpoints accept `with_relationships` parameter and return filled `pleroma.relationship` field. +- Mastodon API: Endpoint to remove a conversation (`DELETE /api/v1/conversations/:id`).
### Fixed diff --git a/lib/pleroma/conversation.ex b/lib/pleroma/conversation.ex index 8812b456d..828e27450 100644 --- a/lib/pleroma/conversation.ex +++ b/lib/pleroma/conversation.ex @@ -61,9 +61,8 @@ def create_or_bump_for(activity, opts \\ []) do "Create" <- activity.data["type"], %Object{} = object <- Object.normalize(activity, fetch: false), true <- object.data["type"] in ["Note", "Question"], - ap_id when is_binary(ap_id) and byte_size(ap_id) > 0 <- object.data["context"] do - {:ok, conversation} = create_for_ap_id(ap_id) - + ap_id when is_binary(ap_id) and byte_size(ap_id) > 0 <- object.data["context"], + {:ok, conversation} <- create_for_ap_id(ap_id) do users = User.get_users_from_set(activity.recipients, local_only: false) participations = diff --git a/lib/pleroma/conversation/participation.ex b/lib/pleroma/conversation/participation.ex index da5e57714..e0a3af28b 100644 --- a/lib/pleroma/conversation/participation.ex +++ b/lib/pleroma/conversation/participation.ex @@ -220,4 +220,8 @@ def unread_conversation_count_for_user(user) do select: %{count: count(p.id)} ) end + + def delete(%__MODULE__{} = participation) do + Repo.delete(participation) + end end diff --git a/lib/pleroma/web/api_spec/operations/conversation_operation.ex b/lib/pleroma/web/api_spec/operations/conversation_operation.ex index 367f4125a..17ed1af5e 100644 --- a/lib/pleroma/web/api_spec/operations/conversation_operation.ex +++ b/lib/pleroma/web/api_spec/operations/conversation_operation.ex @@ -46,16 +46,31 @@ def mark_as_read_operation do tags: ["Conversations"], summary: "Mark conversation as read", operationId: "ConversationController.mark_as_read", - parameters: [ - Operation.parameter(:id, :path, :string, "Conversation ID", - example: "123", - required: true - ) - ], + parameters: [id_param()], security: [%{"oAuth" => ["write:conversations"]}], responses: %{ 200 => Operation.response("Conversation", "application/json", Conversation) } } end + + def delete_operation do + %Operation{ + tags: ["Conversations"], + summary: "Remove conversation", + operationId: "ConversationController.delete", + parameters: [id_param()], + security: [%{"oAuth" => ["write:conversations"]}], + responses: %{ + 200 => empty_object_response() + } + } + end + + def id_param do + Operation.parameter(:id, :path, :string, "Conversation ID", + example: "123", + required: true + ) + end end diff --git a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex index 4526d3c7a..f2a0949e8 100644 --- a/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex @@ -36,4 +36,13 @@ def mark_as_read(%{assigns: %{user: user}} = conn, %{id: participation_id}) do render(conn, "participation.json", participation: participation, for: user) end end + + @doc "DELETE /api/v1/conversations/:id" + def delete(%{assigns: %{user: user}} = conn, %{id: participation_id}) do + with %Participation{} = participation <- + Repo.get_by(Participation, id: participation_id, user_id: user.id), + {:ok, _} <- Participation.delete(participation) do + json(conn, %{}) + end + end end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 2105d7e9e..b8aa8c67c 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -436,6 +436,7 @@ defmodule Pleroma.Web.Router do get("/conversations", ConversationController, :index) post("/conversations/:id/read", ConversationController, :mark_as_read) + delete("/conversations/:id", ConversationController, :delete) get("/domain_blocks", DomainBlockController, :index) post("/domain_blocks", DomainBlockController, :create) diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs index 8b039cd78..a25e17c95 100644 --- a/test/pleroma/conversation/participation_test.exs +++ b/test/pleroma/conversation/participation_test.exs @@ -359,4 +359,16 @@ test "the conversation with the blocked user is not marked as unread on a reply" assert Participation.unread_count(blocked) == 1 end end + + test "deletes a conversation" do + user = insert(:user) + other_user = insert(:user) + + {:ok, _activity} = + CommonAPI.post(user, %{status: "Hey @#{other_user.nickname}.", visibility: "direct"}) + + assert [participation] = Participation.for_user(other_user) + assert {:ok, _} = Participation.delete(participation) + assert [] == Participation.for_user(other_user) + end end diff --git a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs index 29bc4fd17..3176f1296 100644 --- a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs @@ -217,6 +217,32 @@ test "(vanilla) Mastodon frontend behaviour", %{user: user_one, conn: conn} do assert %{"ancestors" => [], "descendants" => []} == json_response(res_conn, 200) end + test "Removes a conversation", %{user: user_one, conn: conn} do + user_two = insert(:user) + token = insert(:oauth_token, user: user_one, scopes: ["read:statuses", "write:conversations"]) + + {:ok, _direct} = create_direct_message(user_one, [user_two]) + {:ok, _direct} = create_direct_message(user_one, [user_two]) + + assert [%{"id" => conv1_id}, %{"id" => conv2_id}] = + conn + |> assign(:token, token) + |> get("/api/v1/conversations") + |> json_response_and_validate_schema(200) + + assert %{} = + conn + |> assign(:token, token) + |> delete("/api/v1/conversations/#{conv1_id}") + |> json_response_and_validate_schema(200) + + assert [%{"id" => ^conv2_id}] = + conn + |> assign(:token, token) + |> get("/api/v1/conversations") + |> json_response_and_validate_schema(200) + end + defp create_direct_message(sender, recips) do hellos = recips -- cgit v1.2.3 From 1dac7d14623f36744953a523650211540d90d1fc Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 15 Feb 2021 21:13:14 +0300 Subject: [#3213] Fixed `hashtags.name` lookup (must use `citext` type to do index scan). Fixed embedded hashtags lookup (lowercasing), adjusted tests. --- lib/pleroma/hashtag.ex | 8 ++++++-- lib/pleroma/web/activity_pub/activity_pub.ex | 22 ++++++++++++++++------ .../pleroma/web/activity_pub/activity_pub_test.exs | 18 +++++++++--------- 3 files changed, 31 insertions(+), 17 deletions(-) diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex index 0d6a4d09e..a6d033816 100644 --- a/lib/pleroma/hashtag.ex +++ b/lib/pleroma/hashtag.ex @@ -22,7 +22,9 @@ defmodule Pleroma.Hashtag do end def get_by_name(name) do - Repo.get_by(Hashtag, name: name) + from(h in Hashtag) + |> where([h], fragment("name = ?::citext", ^String.downcase(name))) + |> Repo.one() end def get_or_create_by_name(name) when is_bitstring(name) do @@ -37,6 +39,7 @@ def get_or_create_by_name(name) when is_bitstring(name) do end def get_or_create_by_names(names) when is_list(names) do + names = Enum.map(names, &String.downcase/1) timestamp = NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) structs = @@ -52,7 +55,8 @@ def get_or_create_by_names(names) when is_list(names) do Multi.new() |> Multi.insert_all(:insert_all_op, Hashtag, structs, on_conflict: :nothing) |> Multi.run(:query_op, fn _repo, _changes -> - {:ok, Repo.all(from(ht in Hashtag, where: ht.name in ^names))} + {:ok, + Repo.all(from(ht in Hashtag, where: ht.name in fragment("?::citext[]", ^names)))} end) |> Repo.transaction() do {:ok, hashtags} diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 9623e635a..e012f2779 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -698,6 +698,8 @@ defp restrict_embedded_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) end defp restrict_embedded_tag_all(query, %{tag_all: [_ | _] = tag_all}) do + tag_all = Enum.map(tag_all, &String.downcase/1) + from( [_activity, object] in query, where: fragment("(?)->'tag' \\?& (?)", object.data, ^tag_all) @@ -714,10 +716,12 @@ defp restrict_embedded_tag_any(_query, %{tag: _tag, skip_preload: true}) do raise_on_missing_preload() end - defp restrict_embedded_tag_any(query, %{tag: [_ | _] = tag}) do + defp restrict_embedded_tag_any(query, %{tag: [_ | _] = tag_any}) do + tag_any = Enum.map(tag_any, &String.downcase/1) + from( [_activity, object] in query, - where: fragment("(?)->'tag' \\?| (?)", object.data, ^tag) + where: fragment("(?)->'tag' \\?| (?)", object.data, ^tag_any) ) end @@ -732,6 +736,8 @@ defp restrict_embedded_tag_reject_any(_query, %{tag_reject: _tag_reject, skip_pr end defp restrict_embedded_tag_reject_any(query, %{tag_reject: [_ | _] = tag_reject}) do + tag_reject = Enum.map(tag_reject, &String.downcase/1) + from( [_activity, object] in query, where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) @@ -749,6 +755,10 @@ defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do raise_on_missing_preload() end + defp restrict_hashtag_all(query, %{tag_all: [single_tag]}) do + restrict_hashtag_any(query, %{tag: single_tag}) + end + defp restrict_hashtag_all(query, %{tag_all: [_ | _] = tags}) do from( [_activity, object] in query, @@ -756,7 +766,7 @@ defp restrict_hashtag_all(query, %{tag_all: [_ | _] = tags}) do fragment( """ (SELECT array_agg(hashtags.name) FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) AND hashtags_objects.object_id = ?) @> ? """, ^tags, @@ -767,7 +777,7 @@ defp restrict_hashtag_all(query, %{tag_all: [_ | _] = tags}) do end defp restrict_hashtag_all(query, %{tag_all: tag}) when is_binary(tag) do - restrict_hashtag_any(query, %{tag: tag}) + restrict_hashtag_all(query, %{tag_all: [tag]}) end defp restrict_hashtag_all(query, _), do: query @@ -783,7 +793,7 @@ defp restrict_hashtag_any(query, %{tag: [_ | _] = tags}) do fragment( """ EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) AND hashtags_objects.object_id = ? LIMIT 1) """, ^tags, @@ -809,7 +819,7 @@ defp restrict_hashtag_reject_any(query, %{tag_reject: [_ | _] = tags_reject}) do fragment( """ NOT EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) AND hashtags_objects.object_id = ? LIMIT 1) """, ^tags_reject, diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index bab5a199c..c41c8a5dd 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -213,24 +213,24 @@ test "works for guppe actors" do test "it fetches the appropriate tag-restricted posts" do user = insert(:user) - {:ok, status_one} = CommonAPI.post(user, %{status: ". #test"}) + {:ok, status_one} = CommonAPI.post(user, %{status: ". #TEST"}) {:ok, status_two} = CommonAPI.post(user, %{status: ". #essais"}) - {:ok, status_three} = CommonAPI.post(user, %{status: ". #test #reject"}) + {:ok, status_three} = CommonAPI.post(user, %{status: ". #test #Reject"}) - {:ok, status_four} = CommonAPI.post(user, %{status: ". #any1 #any2"}) - {:ok, status_five} = CommonAPI.post(user, %{status: ". #any2 #any1"}) + {:ok, status_four} = CommonAPI.post(user, %{status: ". #Any1 #any2"}) + {:ok, status_five} = CommonAPI.post(user, %{status: ". #Any2 #any1"}) for hashtag_timeline_strategy <- [true, false] do clear_config([:database, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) - fetch_two = ActivityPub.fetch_activities([], %{type: "Create", tag: ["test", "essais"]}) + fetch_two = ActivityPub.fetch_activities([], %{type: "Create", tag: ["TEST", "essais"]}) fetch_three = ActivityPub.fetch_activities([], %{ type: "Create", - tag: ["test", "essais"], + tag: ["test", "Essais"], tag_reject: ["reject"] }) @@ -238,21 +238,21 @@ test "it fetches the appropriate tag-restricted posts" do ActivityPub.fetch_activities([], %{ type: "Create", tag: ["test"], - tag_all: ["test", "reject"] + tag_all: ["test", "REJECT"] }) # Testing that deduplication (if needed) is done on DB (not Ecto) level; :limit is important fetch_five = ActivityPub.fetch_activities([], %{ type: "Create", - tag: ["any1", "any2"], + tag: ["ANY1", "any2"], limit: 2 }) fetch_six = ActivityPub.fetch_activities([], %{ type: "Create", - tag: ["any1", "any2"], + tag: ["any1", "Any2"], tag_all: [], tag_reject: [] }) -- cgit v1.2.3 From f1f215cb389c09fdf148923494a4dc6d5c029ce8 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 16 Feb 2021 13:08:08 +0300 Subject: Relicense documentation under CC-BY-4.0 All contributors whose contributions were still being used at the moment of relicensing have agreed to it. See https://git.pleroma.social/pleroma/pleroma/-/issues/2146 . --- COPYING | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/COPYING b/COPYING index eb60dbd56..dd25f1d81 100644 --- a/COPYING +++ b/COPYING @@ -5,6 +5,13 @@ copy of the license file as AGPL-3. --- +Files inside docs directory are copyright © 2021 Pleroma Authors +, and are distributed under the Creative Commons +Attribution 4.0 International license, you should have received +a copy of the license file as CC-BY-4.0. + +--- + The following files are copyright © 2019 shitposter.club, and are distributed under the Creative Commons Attribution-ShareAlike 4.0 International license, you should have received a copy of the license file as CC-BY-SA-4.0. -- cgit v1.2.3 From 98ab2b82a649ceb2f50c3058a1a52349507959c4 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Tue, 16 Feb 2021 22:41:06 +0300 Subject: ChatMessage schema: Add `unread` property It is present in the code, but was not documented. --- lib/pleroma/web/api_spec/schemas/chat_message.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/api_spec/schemas/chat_message.ex b/lib/pleroma/web/api_spec/schemas/chat_message.ex index 6986b9c17..348fe95f8 100644 --- a/lib/pleroma/web/api_spec/schemas/chat_message.ex +++ b/lib/pleroma/web/api_spec/schemas/chat_message.ex @@ -52,7 +52,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ChatMessage do title: %Schema{type: :string, description: "Title of linked resource"}, description: %Schema{type: :string, description: "Description of preview"} } - } + }, + unread: %Schema{type: :boolean, description: "Whether a message has been marked as read."} }, example: %{ "account_id" => "someflakeid", @@ -69,7 +70,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ChatMessage do } ], "id" => "14", - "attachment" => nil + "attachment" => nil, + "unread" => false } }) end -- cgit v1.2.3 From 938823c73040f6b55896581daf5baf732f859f02 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 16 Feb 2021 23:14:15 +0300 Subject: [#3213] HashtagsTableMigrator state management refactoring & improvements (proper stats serialization etc.). --- lib/pleroma/data_migration.ex | 15 ++-- lib/pleroma/migrators/hashtags_table_migrator.ex | 87 ++++++++++------------ .../migrators/hashtags_table_migrator/state.ex | 87 +++++++++++++++++++--- 3 files changed, 122 insertions(+), 67 deletions(-) diff --git a/lib/pleroma/data_migration.ex b/lib/pleroma/data_migration.ex index 64fa155ff..1377af16e 100644 --- a/lib/pleroma/data_migration.ex +++ b/lib/pleroma/data_migration.ex @@ -10,6 +10,7 @@ defmodule Pleroma.DataMigration do alias Pleroma.Repo import Ecto.Changeset + import Ecto.Query schema "data_migrations" do field(:name, :string) @@ -28,14 +29,12 @@ def changeset(data_migration, params \\ %{}) do |> unique_constraint(:name) end - def update(data_migration, params \\ %{}) do - data_migration - |> changeset(params) - |> Repo.update() - end - - def update_state(data_migration, new_state) do - update(data_migration, %{state: new_state}) + def update_one_by_id(id, params \\ %{}) do + with {1, _} <- + from(dm in DataMigration, where: dm.id == ^id) + |> Repo.update_all(set: params) do + :ok + end end def get_by_name(name) do diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 432c3401a..a226d9d29 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -11,16 +11,16 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator do alias __MODULE__.State alias Pleroma.Config - alias Pleroma.DataMigration alias Pleroma.Hashtag alias Pleroma.Object alias Pleroma.Repo - defdelegate state(), to: State, as: :get - defdelegate put_stat(key, value), to: State, as: :put - defdelegate increment_stat(key, increment), to: State, as: :increment + defdelegate data_migration(), to: State - defdelegate data_migration(), to: DataMigration, as: :populate_hashtags_table + defdelegate state(), to: State + defdelegate get_stat(key, value), to: State, as: :get_data_key + defdelegate put_stat(key, value), to: State, as: :put_data_key + defdelegate increment_stat(key, increment), to: State, as: :increment_data_key @reg_name {:global, __MODULE__} @@ -45,7 +45,7 @@ def init(_) do def handle_continue(:init_state, _state) do {:ok, _} = State.start_link(nil) - update_status(:init) + update_status(:pending) data_migration = data_migration() manual_migrations = Config.get([:instance, :manual_data_migrations], []) @@ -55,13 +55,13 @@ def handle_continue(:init_state, _state) do update_status(:noop) is_nil(data_migration) -> - update_status(:halt, "Data migration does not exist.") + update_status(:failed, "Data migration does not exist.") data_migration.state == :manual or data_migration.name in manual_migrations -> - update_status(:noop, "Data migration is in manual execution state.") + update_status(:manual, "Data migration is in manual execution state.") data_migration.state == :complete -> - handle_success(data_migration) + on_complete(data_migration) true -> send(self(), :migrate_hashtags) @@ -72,20 +72,15 @@ def handle_continue(:init_state, _state) do @impl true def handle_info(:migrate_hashtags, state) do - State.clear() + State.reinit() update_status(:running) put_stat(:started_at, NaiveDateTime.utc_now()) - data_migration = data_migration() - persistent_data = Map.take(data_migration.data, ["max_processed_id"]) - - {:ok, data_migration} = - DataMigration.update(data_migration, %{state: :running, data: persistent_data}) - - Logger.info("Starting transferring object embedded hashtags to `hashtags` table...") + %{id: data_migration_id} = data_migration() + max_processed_id = get_stat(:max_processed_id, 0) - max_processed_id = data_migration.data["max_processed_id"] || 0 + Logger.info("Transferring embedded hashtags to `hashtags` (from oid: #{max_processed_id})...") query() |> where([object], object.id > ^max_processed_id) @@ -104,7 +99,7 @@ def handle_info(:migrate_hashtags, state) do Repo.query( "INSERT INTO data_migration_failed_ids(data_migration_id, record_id) " <> "VALUES ($1, $2) ON CONFLICT DO NOTHING;", - [data_migration.id, failed_id] + [data_migration_id, failed_id] ) end @@ -112,7 +107,7 @@ def handle_info(:migrate_hashtags, state) do Repo.query( "DELETE FROM data_migration_failed_ids " <> "WHERE data_migration_id = $1 AND record_id = ANY($2)", - [data_migration.id, object_ids -- failed_ids] + [data_migration_id, object_ids -- failed_ids] ) max_object_id = Enum.at(object_ids, -1) @@ -120,14 +115,8 @@ def handle_info(:migrate_hashtags, state) do put_stat(:max_processed_id, max_object_id) increment_stat(:processed_count, length(object_ids)) increment_stat(:failed_count, length(failed_ids)) - - put_stat( - :records_per_second, - state()[:processed_count] / - Enum.max([NaiveDateTime.diff(NaiveDateTime.utc_now(), state()[:started_at]), 1]) - ) - - persist_stats(data_migration) + put_stat(:records_per_second, records_per_second()) + _ = State.persist_to_db() # A quick and dirty approach to controlling the load this background migration imposes sleep_interval = Config.get([:populate_hashtags_table, :sleep_interval_ms], 0) @@ -135,22 +124,25 @@ def handle_info(:migrate_hashtags, state) do end) |> Stream.run() - with 0 <- failures_count(data_migration.id) do + with 0 <- failures_count(data_migration_id) do _ = delete_non_create_activities_hashtags() - - {:ok, data_migration} = DataMigration.update_state(data_migration, :complete) - - handle_success(data_migration) + set_complete() else _ -> - _ = DataMigration.update_state(data_migration, :failed) - update_status(:failed, "Please check data_migration_failed_ids records.") end {:noreply, state} end + defp records_per_second do + get_stat(:processed_count, 0) / Enum.max([running_time(), 1]) + end + + defp running_time do + NaiveDateTime.diff(NaiveDateTime.utc_now(), get_stat(:started_at, NaiveDateTime.utc_now())) + end + @hashtags_objects_cleanup_query """ DELETE FROM hashtags_objects WHERE object_id IN (SELECT DISTINCT objects.id FROM objects @@ -169,6 +161,10 @@ def handle_info(:migrate_hashtags, state) do WHERE hashtags_objects.hashtag_id IS NULL); """ + @doc """ + Deletes `hashtags_objects` for legacy objects not asoociated with Create activity. + Also deletes unreferenced `hashtags` records (might occur after deletion of `hashtags_objects`). + """ def delete_non_create_activities_hashtags do {:ok, %{num_rows: hashtags_objects_count}} = Repo.query(@hashtags_objects_cleanup_query, [], timeout: :infinity) @@ -256,14 +252,7 @@ def count(force \\ false, timeout \\ :infinity) do end end - defp persist_stats(data_migration) do - runner_state = Map.drop(state(), [:status]) - _ = DataMigration.update(data_migration, %{data: runner_state}) - end - - defp handle_success(data_migration) do - update_status(:complete) - + defp on_complete(data_migration) do cond do data_migration.feature_lock -> :noop @@ -321,18 +310,18 @@ def force_continue do end def force_restart do - {:ok, _} = DataMigration.update(data_migration(), %{state: :pending, data: %{}}) + :ok = State.reset() force_continue() end - def force_complete do - {:ok, data_migration} = DataMigration.update_state(data_migration(), :complete) - - handle_success(data_migration) + def set_complete do + update_status(:complete) + _ = State.persist_to_db() + on_complete(data_migration()) end defp update_status(status, message \\ nil) do - put_stat(:status, status) + put_stat(:state, status) put_stat(:message, message) end end diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex index 901563426..ed9848824 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator/state.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator/state.ex @@ -5,31 +5,98 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator.State do use Agent - @init_state %{} + alias Pleroma.DataMigration + + defdelegate data_migration(), to: DataMigration, as: :populate_hashtags_table + @reg_name {:global, __MODULE__} def start_link(_) do - Agent.start_link(fn -> @init_state end, name: @reg_name) + Agent.start_link(fn -> load_state_from_db() end, name: @reg_name) + end + + defp load_state_from_db do + data_migration = data_migration() + + data = + if data_migration do + Map.new(data_migration.data, fn {k, v} -> {String.to_atom(k), v} end) + else + %{} + end + + %{ + data_migration_id: data_migration && data_migration.id, + data: data + } end - def clear do - Agent.update(@reg_name, fn _state -> @init_state end) + def persist_to_db do + %{data_migration_id: data_migration_id, data: data} = state() + + if data_migration_id do + DataMigration.update_one_by_id(data_migration_id, data: data) + else + {:error, :nil_data_migration_id} + end + end + + def reset do + %{data_migration_id: data_migration_id} = state() + + with false <- is_nil(data_migration_id), + :ok <- + DataMigration.update_one_by_id(data_migration_id, + state: :pending, + data: %{} + ) do + reinit() + else + true -> {:error, :nil_data_migration_id} + e -> e + end end - def get do + def reinit do + Agent.update(@reg_name, fn _state -> load_state_from_db() end) + end + + def state do Agent.get(@reg_name, & &1) end - def put(key, value) do + def get_data_key(key, default \\ nil) do + get_in(state(), [:data, key]) || default + end + + def put_data_key(key, value) do + _ = persist_non_data_change(key, value) + Agent.update(@reg_name, fn state -> - Map.put(state, key, value) + put_in(state, [:data, key], value) end) end - def increment(key, increment \\ 1) do + def increment_data_key(key, increment \\ 1) do Agent.update(@reg_name, fn state -> - updated_value = (state[key] || 0) + increment - Map.put(state, key, updated_value) + initial_value = get_in(state, [:data, key]) || 0 + updated_value = initial_value + increment + put_in(state, [:data, key], updated_value) end) end + + defp persist_non_data_change(:state, value) do + with true <- get_data_key(:state) != value, + true <- value in Pleroma.DataMigration.State.__valid_values__(), + %{data_migration_id: data_migration_id} when not is_nil(data_migration_id) <- state() do + DataMigration.update_one_by_id(data_migration_id, state: value) + else + false -> :ok + _ -> {:error, :nil_data_migration_id} + end + end + + defp persist_non_data_change(_, _) do + nil + end end -- cgit v1.2.3 From 854ea1aefb5ff4e03e9e9af6e8dd50f66c61c913 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 17 Feb 2021 09:23:35 +0300 Subject: [#3213] Fixed `HashtagsTableMigrator.count/1`. --- lib/pleroma/migrators/hashtags_table_migrator.ex | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index a226d9d29..ac17f91cc 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -18,7 +18,8 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator do defdelegate data_migration(), to: State defdelegate state(), to: State - defdelegate get_stat(key, value), to: State, as: :get_data_key + defdelegate persist_state(), to: State, as: :persist_to_db + defdelegate get_stat(key, value \\ nil), to: State, as: :get_data_key defdelegate put_stat(key, value), to: State, as: :put_data_key defdelegate increment_stat(key, increment), to: State, as: :increment_data_key @@ -116,7 +117,7 @@ def handle_info(:migrate_hashtags, state) do increment_stat(:processed_count, length(object_ids)) increment_stat(:failed_count, length(failed_ids)) put_stat(:records_per_second, records_per_second()) - _ = State.persist_to_db() + persist_state() # A quick and dirty approach to controlling the load this background migration imposes sleep_interval = Config.get([:populate_hashtags_table, :sleep_interval_ms], 0) @@ -237,17 +238,19 @@ defp transfer_object_hashtags(object, hashtags) do @doc "Approximate count for current iteration (including processed records count)" def count(force \\ false, timeout \\ :infinity) do - stored_count = state()[:count] + stored_count = get_stat(:count) if stored_count && !force do stored_count else - processed_count = state()[:processed_count] || 0 - max_processed_id = data_migration().data["max_processed_id"] || 0 + processed_count = get_stat(:processed_count, 0) + max_processed_id = get_stat(:max_processed_id, 0) query = where(query(), [object], object.id > ^max_processed_id) count = Repo.aggregate(query, :count, :id, timeout: timeout) + processed_count put_stat(:count, count) + persist_state() + count end end @@ -316,7 +319,7 @@ def force_restart do def set_complete do update_status(:complete) - _ = State.persist_to_db() + persist_state() on_complete(data_migration()) end -- cgit v1.2.3 From d7ad288c849965c027ea496c8665f178cc559f20 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 17 Feb 2021 15:58:33 +0300 Subject: Chats: Introduce /api/v2/pleroma/chats which implements pagination Also removes incorrect claim that /api/v1/pleroma/chats supports pagination and deprecates it. Closes #2140 --- CHANGELOG.md | 2 + .../web/api_spec/operations/chat_operation.ex | 24 +- .../web/pleroma_api/controllers/chat_controller.ex | 30 ++- lib/pleroma/web/router.ex | 7 + .../controllers/chat_controller_test.exs | 260 +++++++++++---------- 5 files changed, 196 insertions(+), 127 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e5fab5c..c2ac495a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking:** AdminAPI `GET /api/pleroma/admin/users/:nickname_or_id/statuses` changed response format and added the number of total users posts. - **Breaking:** AdminAPI `GET /api/pleroma/admin/instances/:instance/statuses` changed response format and added the number of total users posts. - Admin API: Reports now ordered by newest +- Pleroma API: `GET /api/v1/pleroma/chats` is deprecated in favor of `GET /api/v2/pleroma/chats`.
@@ -58,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
API Changes - Admin API: (`GET /api/pleroma/admin/users`) filter users by `unconfirmed` status and `actor_type`. +- Pleroma API: `GET /api/v2/pleroma/chats` added. It is exactly like `GET /api/v1/pleroma/chats` except supports pagination. - Pleroma API: Add `idempotency_key` to the chat message entity that can be used for optimistic message sending. - Pleroma API: (`GET /api/v1/pleroma/federation_status`) Add a way to get a list of unreachable instances. - Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute. diff --git a/lib/pleroma/web/api_spec/operations/chat_operation.ex b/lib/pleroma/web/api_spec/operations/chat_operation.ex index b49700172..23cb66392 100644 --- a/lib/pleroma/web/api_spec/operations/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/chat_operation.ex @@ -131,8 +131,30 @@ def create_operation do def index_operation do %Operation{ tags: ["Chats"], - summary: "Retrieve list of chats", + summary: "Retrieve list of chats (unpaginated)", + deprecated: true, + description: + "Deprecated due to no support for pagination. Using [/api/v2/pleroma/chats](#operation/ChatController.index2) instead is recommended.", operationId: "ChatController.index", + parameters: [ + Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users") + ], + responses: %{ + 200 => Operation.response("The chats of the user", "application/json", chats_response()) + }, + security: [ + %{ + "oAuth" => ["read:chats"] + } + ] + } + end + + def index2_operation do + %Operation{ + tags: ["Chats"], + summary: "Retrieve list of chats", + operationId: "ChatController.index2", parameters: [ Operation.parameter(:with_muted, :query, BooleanLike, "Include chats from muted users") | pagination_params() diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex index f3cd1fbf6..4adc685fe 100644 --- a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -35,7 +35,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do plug( OAuthScopesPlug, - %{scopes: ["read:chats"]} when action in [:messages, :index, :show] + %{scopes: ["read:chats"]} when action in [:messages, :index, :index2, :show] ) plug(OpenApiSpex.Plug.CastAndValidate, render_error: Pleroma.Web.ApiSpec.RenderError) @@ -138,20 +138,32 @@ def messages(%{assigns: %{user: user}} = conn, %{id: id} = params) do end end - def index(%{assigns: %{user: %{id: user_id} = user}} = conn, params) do - exclude_users = - User.cached_blocked_users_ap_ids(user) ++ - if params[:with_muted], do: [], else: User.cached_muted_users_ap_ids(user) - + def index(%{assigns: %{user: user}} = conn, params) do chats = - user_id - |> Chat.for_user_query() - |> where([c], c.recipient not in ^exclude_users) + index_query(user, params) |> Repo.all() render(conn, "index.json", chats: chats) end + def index2(%{assigns: %{user: user}} = conn, params) do + chats = + index_query(user, params) + |> Pagination.fetch_paginated(params) + + render(conn, "index.json", chats: chats) + end + + defp index_query(%{id: user_id} = user, params) do + exclude_users = + User.cached_blocked_users_ap_ids(user) ++ + if params[:with_muted], do: [], else: User.cached_muted_users_ap_ids(user) + + user_id + |> Chat.for_user_query() + |> where([c], c.recipient not in ^exclude_users) + end + def create(%{assigns: %{user: user}} = conn, %{id: id}) do with %User{ap_id: recipient} <- User.get_cached_by_id(id), {:ok, %Chat{} = chat} <- Chat.get_or_create(user.id, recipient) do diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 2105d7e9e..1a27bc63d 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -411,6 +411,13 @@ defmodule Pleroma.Web.Router do get("/federation_status", InstancesController, :show) end + scope "/api/v2/pleroma", Pleroma.Web.PleromaAPI do + scope [] do + pipe_through(:authenticated_api) + get("/chats", ChatController, :index2) + end + end + scope "/api/v1", Pleroma.Web.MastodonAPI do pipe_through(:authenticated_api) diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs index 372613b8b..99b0d43a7 100644 --- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs @@ -304,139 +304,165 @@ test "it returns a chat", %{conn: conn, user: user} do end end - describe "GET /api/v1/pleroma/chats" do - setup do: oauth_access(["read:chats"]) - - test "it does not return chats with deleted users", %{conn: conn, user: user} do - recipient = insert(:user) - {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) - - Pleroma.Repo.delete(recipient) - User.invalidate_cache(recipient) - - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) - - assert length(result) == 0 - end - - test "it does not return chats with users you blocked", %{conn: conn, user: user} do - recipient = insert(:user) - - {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) - - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) - - assert length(result) == 1 - - User.block(user, recipient) - - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) - - assert length(result) == 0 - end - - test "it does not return chats with users you muted", %{conn: conn, user: user} do - recipient = insert(:user) - - {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) - - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) - - assert length(result) == 1 + for tested_endpoint <- ["/api/v1/pleroma/chats", "/api/v2/pleroma/chats"] do + describe "GET #{tested_endpoint}" do + setup do: oauth_access(["read:chats"]) - User.mute(user, recipient) - - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) - - assert length(result) == 0 - - result = - conn - |> get("/api/v1/pleroma/chats?with_muted=true") - |> json_response_and_validate_schema(200) - - assert length(result) == 1 - end - - test "it returns all chats", %{conn: conn, user: user} do - Enum.each(1..30, fn _ -> + test "it does not return chats with deleted users", %{conn: conn, user: user} do recipient = insert(:user) {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) - end) - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) + Pleroma.Repo.delete(recipient) + User.invalidate_cache(recipient) - assert length(result) == 30 - end + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) - test "it return a list of chats the current user is participating in, in descending order of updates", - %{conn: conn, user: user} do - har = insert(:user) - jafnhar = insert(:user) - tridi = insert(:user) + assert length(result) == 0 + end - {:ok, chat_1} = Chat.get_or_create(user.id, har.ap_id) - {:ok, chat_1} = time_travel(chat_1, -3) - {:ok, chat_2} = Chat.get_or_create(user.id, jafnhar.ap_id) - {:ok, _chat_2} = time_travel(chat_2, -2) - {:ok, chat_3} = Chat.get_or_create(user.id, tridi.ap_id) - {:ok, chat_3} = time_travel(chat_3, -1) + test "it does not return chats with users you blocked", %{conn: conn, user: user} do + recipient = insert(:user) - # bump the second one - {:ok, chat_2} = Chat.bump_or_create(user.id, jafnhar.ap_id) + {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) - ids = Enum.map(result, & &1["id"]) + assert length(result) == 1 - assert ids == [ - chat_2.id |> to_string(), - chat_3.id |> to_string(), - chat_1.id |> to_string() - ] - end + User.block(user, recipient) - test "it is not affected by :restrict_unauthenticated setting (issue #1973)", %{ - conn: conn, - user: user - } do - clear_config([:restrict_unauthenticated, :profiles, :local], true) - clear_config([:restrict_unauthenticated, :profiles, :remote], true) + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) - user2 = insert(:user) - user3 = insert(:user, local: false) + assert length(result) == 0 + end - {:ok, _chat_12} = Chat.get_or_create(user.id, user2.ap_id) - {:ok, _chat_13} = Chat.get_or_create(user.id, user3.ap_id) + test "it does not return chats with users you muted", %{conn: conn, user: user} do + recipient = insert(:user) - result = - conn - |> get("/api/v1/pleroma/chats") - |> json_response_and_validate_schema(200) + {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) - account_ids = Enum.map(result, &get_in(&1, ["account", "id"])) - assert Enum.sort(account_ids) == Enum.sort([user2.id, user3.id]) + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) + + assert length(result) == 1 + + User.mute(user, recipient) + + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) + + assert length(result) == 0 + + result = + conn + |> get("#{unquote(tested_endpoint)}?with_muted=true") + |> json_response_and_validate_schema(200) + + assert length(result) == 1 + end + + if tested_endpoint == "/api/v1/pleroma/chats" do + test "it returns all chats", %{conn: conn, user: user} do + Enum.each(1..30, fn _ -> + recipient = insert(:user) + {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) + end) + + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) + + assert length(result) == 30 + end + else + test "it paginates chats", %{conn: conn, user: user} do + Enum.each(1..30, fn _ -> + recipient = insert(:user) + {:ok, _} = Chat.get_or_create(user.id, recipient.ap_id) + end) + + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) + + assert length(result) == 20 + last_id = List.last(result)["id"] + + result = + conn + |> get(unquote(tested_endpoint) <> "?max_id=#{last_id}") + |> json_response_and_validate_schema(200) + + assert length(result) == 10 + end + end + + test "it return a list of chats the current user is participating in, in descending order of updates", + %{conn: conn, user: user} do + har = insert(:user) + jafnhar = insert(:user) + tridi = insert(:user) + + {:ok, chat_1} = Chat.get_or_create(user.id, har.ap_id) + {:ok, chat_1} = time_travel(chat_1, -3) + {:ok, chat_2} = Chat.get_or_create(user.id, jafnhar.ap_id) + {:ok, _chat_2} = time_travel(chat_2, -2) + {:ok, chat_3} = Chat.get_or_create(user.id, tridi.ap_id) + {:ok, chat_3} = time_travel(chat_3, -1) + + # bump the second one + {:ok, chat_2} = Chat.bump_or_create(user.id, jafnhar.ap_id) + + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) + + ids = Enum.map(result, & &1["id"]) + + assert ids == [ + chat_2.id |> to_string(), + chat_3.id |> to_string(), + chat_1.id |> to_string() + ] + end + + test "it is not affected by :restrict_unauthenticated setting (issue #1973)", %{ + conn: conn, + user: user + } do + clear_config([:restrict_unauthenticated, :profiles, :local], true) + clear_config([:restrict_unauthenticated, :profiles, :remote], true) + + user2 = insert(:user) + user3 = insert(:user, local: false) + + {:ok, _chat_12} = Chat.get_or_create(user.id, user2.ap_id) + {:ok, _chat_13} = Chat.get_or_create(user.id, user3.ap_id) + + result = + conn + |> get(unquote(tested_endpoint)) + |> json_response_and_validate_schema(200) + + account_ids = Enum.map(result, &get_in(&1, ["account", "id"])) + assert Enum.sort(account_ids) == Enum.sort([user2.id, user3.id]) + end end end end -- cgit v1.2.3 From 068740aa1649869fbb73ef037767a28eacb945d2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 17 Feb 2021 10:08:12 -0600 Subject: Make it possible to generate custom docker images by prefixing the branch name with "build-docker" --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0fec89368..291a5cff9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -326,6 +326,7 @@ docker: - dind only: - develop@pleroma/pleroma + - /^build-docker/.*$/@pleroma/pleroma docker-stable: stage: docker -- cgit v1.2.3 From dc4baee6dd03be3c498140eafbb521ac1cd73f4f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 17 Feb 2021 10:24:37 -0600 Subject: Do not want these interfering with develop builds --- .gitlab-ci.yml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 291a5cff9..c7e8291d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -326,7 +326,6 @@ docker: - dind only: - develop@pleroma/pleroma - - /^build-docker/.*$/@pleroma/pleroma docker-stable: stage: docker @@ -372,3 +371,26 @@ docker-release: - dind only: - /^release/.*$/@pleroma/pleroma + +docker-adhoc: + stage: docker + image: docker:latest + cache: {} + dependencies: [] + variables: *docker-variables + before_script: *before-docker + allow_failure: true + script: + script: + - mkdir -p /root/.docker/cli-plugins + - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx + - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c + - chmod +x ~/.docker/cli-plugins/docker-buildx + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - docker buildx create --name mbuilder --driver docker-container --use + - docker buildx inspect --bootstrap + - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG . + tags: + - dind + only: + - /^build-docker/.*$/@pleroma/pleroma \ No newline at end of file -- cgit v1.2.3 From ff72ce31cabad55e1be3ea376873b7d98701a3d9 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 25 Jan 2021 20:15:33 +0100 Subject: Enhance reports in Pleroma API: index, show --- .../api_spec/operations/admin/report_operation.ex | 4 +- .../operations/pleroma_report_operation.ex | 97 ++++++++++++++++++++++ .../pleroma_api/controllers/report_controller.ex | 46 ++++++++++ lib/pleroma/web/pleroma_api/views/report_view.ex | 55 ++++++++++++ lib/pleroma/web/router.ex | 6 ++ .../controllers/report_controller_test.exs | 80 ++++++++++++++++++ 6 files changed, 286 insertions(+), 2 deletions(-) create mode 100644 lib/pleroma/web/api_spec/operations/pleroma_report_operation.ex create mode 100644 lib/pleroma/web/pleroma_api/controllers/report_controller.ex create mode 100644 lib/pleroma/web/pleroma_api/views/report_view.ex create mode 100644 test/pleroma/web/pleroma_api/controllers/report_controller_test.exs diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index cfa892d29..30e56366e 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -136,11 +136,11 @@ def notes_delete_operation do } end - defp report_state do + def report_state do %Schema{type: :string, enum: ["open", "closed", "resolved"]} end - defp id_param do + def id_param do Operation.parameter(:id, :path, FlakeID, "Report ID", example: "9umDrYheeY451cQnEe", required: true diff --git a/lib/pleroma/web/api_spec/operations/pleroma_report_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_report_operation.ex new file mode 100644 index 000000000..ee8870dc2 --- /dev/null +++ b/lib/pleroma/web/api_spec/operations/pleroma_report_operation.ex @@ -0,0 +1,97 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ApiSpec.PleromaReportOperation do + alias OpenApiSpex.Operation + alias OpenApiSpex.Schema + alias Pleroma.Web.ApiSpec.Admin.ReportOperation + alias Pleroma.Web.ApiSpec.Schemas.Account + alias Pleroma.Web.ApiSpec.Schemas.ApiError + alias Pleroma.Web.ApiSpec.Schemas.FlakeID + alias Pleroma.Web.ApiSpec.Schemas.Status + + def open_api_operation(action) do + operation = String.to_existing_atom("#{action}_operation") + apply(__MODULE__, operation, []) + end + + def index_operation do + %Operation{ + tags: ["Reports"], + summary: "Get a list of your own reports", + operationId: "PleromaAPI.ReportController.index", + security: [%{"oAuth" => ["read:reports"]}], + parameters: [ + Operation.parameter( + :state, + :query, + ReportOperation.report_state(), + "Filter by report state" + ), + Operation.parameter( + :limit, + :query, + %Schema{type: :integer}, + "The number of records to retrieve" + ), + Operation.parameter( + :page, + :query, + %Schema{type: :integer, default: 1}, + "Page number" + ), + Operation.parameter( + :page_size, + :query, + %Schema{type: :integer, default: 50}, + "Number number of log entries per page" + ) + ], + responses: %{ + 200 => + Operation.response("Response", "application/json", %Schema{ + type: :object, + properties: %{ + total: %Schema{type: :integer}, + reports: %Schema{ + type: :array, + items: report() + } + } + }), + 404 => Operation.response("Not Found", "application/json", ApiError) + } + } + end + + def show_operation do + %Operation{ + tags: ["Reports"], + summary: "Get an individual report", + operationId: "PleromaAPI.ReportController.show", + parameters: [ReportOperation.id_param()], + security: [%{"oAuth" => ["read:reports"]}], + responses: %{ + 200 => Operation.response("Report", "application/json", report()), + 404 => Operation.response("Not Found", "application/json", ApiError) + } + } + end + + # Copied from ReportOperation.report with removing notes + defp report do + %Schema{ + type: :object, + properties: %{ + id: FlakeID, + state: ReportOperation.report_state(), + account: Account, + actor: Account, + content: %Schema{type: :string}, + created_at: %Schema{type: :string, format: :"date-time"}, + statuses: %Schema{type: :array, items: Status} + } + } + end +end diff --git a/lib/pleroma/web/pleroma_api/controllers/report_controller.ex b/lib/pleroma/web/pleroma_api/controllers/report_controller.ex new file mode 100644 index 000000000..d93d7570a --- /dev/null +++ b/lib/pleroma/web/pleroma_api/controllers/report_controller.ex @@ -0,0 +1,46 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.PleromaAPI.ReportController do + use Pleroma.Web, :controller + + alias Pleroma.Activity + alias Pleroma.Web.ActivityPub.Utils + alias Pleroma.Web.AdminAPI.Report + + action_fallback(Pleroma.Web.MastodonAPI.FallbackController) + plug(Pleroma.Web.ApiSpec.CastAndValidate) + plug(Pleroma.Web.Plugs.OAuthScopesPlug, %{scopes: ["read:reports"]}) + + defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaReportOperation + + @doc "GET /api/v0/pleroma/reports" + def index(%{assigns: %{user: user}, body_params: params} = conn, _) do + params = + params + |> Map.put(:actor_id, user.ap_id) + + reports = Utils.get_reports(params, Map.get(params, :page, 1), Map.get(params, :size, 20)) + + render(conn, "index.json", %{reports: reports, for: user}) + end + + @doc "GET /api/v0/pleroma/reports/:id" + def show(%{assigns: %{user: user}} = conn, %{id: id}) do + with %Activity{} = report <- Activity.get_report(id), + true <- report.actor == user.ap_id, + %{} = report_info <- Report.extract_report_info(report) do + render(conn, "show.json", Map.put(report_info, :for, user)) + else + false -> + {:error, :not_found} + + nil -> + {:error, :not_found} + + e -> + {:error, inspect(e)} + end + end +end diff --git a/lib/pleroma/web/pleroma_api/views/report_view.ex b/lib/pleroma/web/pleroma_api/views/report_view.ex new file mode 100644 index 000000000..a0b3f085c --- /dev/null +++ b/lib/pleroma/web/pleroma_api/views/report_view.ex @@ -0,0 +1,55 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.PleromaAPI.ReportView do + use Pleroma.Web, :view + + alias Pleroma.HTML + alias Pleroma.Web.AdminAPI.Report + alias Pleroma.Web.CommonAPI.Utils + alias Pleroma.Web.MastodonAPI.AccountView + alias Pleroma.Web.MastodonAPI.StatusView + + def render("index.json", %{reports: reports, for: for_user}) do + %{ + reports: + reports[:items] + |> Enum.map(&Report.extract_report_info/1) + |> Enum.map(&render(__MODULE__, "show.json", Map.put(&1, :for, for_user))), + total: reports[:total] + } + end + + def render("show.json", %{ + report: report, + user: actor, + account: account, + statuses: statuses, + for: for_user + }) do + created_at = Utils.to_masto_date(report.data["published"]) + + content = + unless is_nil(report.data["content"]) do + HTML.filter_tags(report.data["content"]) + else + nil + end + + %{ + id: report.id, + account: AccountView.render("show.json", %{user: account, for: for_user}), + actor: AccountView.render("show.json", %{user: actor, for: for_user}), + content: content, + created_at: created_at, + statuses: + StatusView.render("index.json", %{ + activities: statuses, + as: :activity, + for: for_user + }), + state: report.data["state"] + } + end +end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index d71011033..0064dacc8 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -368,6 +368,12 @@ defmodule Pleroma.Web.Router do get("/statuses/:id/reactions", EmojiReactionController, :index) end + scope "/api/v0/pleroma", Pleroma.Web.PleromaAPI do + pipe_through(:authenticated_api) + get("/reports", ReportController, :index) + get("/reports/:id", ReportController, :show) + end + scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do scope [] do pipe_through(:authenticated_api) diff --git a/test/pleroma/web/pleroma_api/controllers/report_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/report_controller_test.exs new file mode 100644 index 000000000..c507aeca0 --- /dev/null +++ b/test/pleroma/web/pleroma_api/controllers/report_controller_test.exs @@ -0,0 +1,80 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.PleromaAPI.ReportControllerTest do + use Pleroma.Web.ConnCase, async: true + + import Pleroma.Factory + + alias Pleroma.Web.CommonAPI + + describe "GET /api/v0/pleroma/reports" do + test "returns list of own reports" do + %{conn: reporter_conn, user: reporter} = oauth_access(["read:reports"]) + %{conn: reported_conn, user: reported} = oauth_access(["read:reports"]) + activity = insert(:note_activity, user: reported) + + {:ok, %{id: report_id}} = + CommonAPI.report(reporter, %{ + account_id: reported.id, + comment: "You stole my sandwich!", + status_ids: [activity.id] + }) + + assert reported_response = + reported_conn + |> get("/api/v0/pleroma/reports") + |> json_response_and_validate_schema(:ok) + + assert reported_response == %{"reports" => [], "total" => 0} + + assert reporter_response = + reporter_conn + |> get("/api/v0/pleroma/reports") + |> json_response_and_validate_schema(:ok) + + assert %{"reports" => [report], "total" => 1} = reporter_response + assert report["id"] == report_id + refute report["notes"] + end + end + + describe "GET /api/v0/pleroma/reports/:id" do + test "returns report by its id" do + %{conn: reporter_conn, user: reporter} = oauth_access(["read:reports"]) + %{conn: reported_conn, user: reported} = oauth_access(["read:reports"]) + activity = insert(:note_activity, user: reported) + + {:ok, %{id: report_id}} = + CommonAPI.report(reporter, %{ + account_id: reported.id, + comment: "You stole my sandwich!", + status_ids: [activity.id] + }) + + assert reported_conn + |> get("/api/v0/pleroma/reports/#{report_id}") + |> json_response_and_validate_schema(:not_found) + + assert response = + reporter_conn + |> get("/api/v0/pleroma/reports/#{report_id}") + |> json_response_and_validate_schema(:ok) + + assert response["id"] == report_id + refute response["notes"] + end + + test "returns 404 when report id is invalid" do + %{conn: conn, user: _user} = oauth_access(["read:reports"]) + + assert response = + conn + |> get("/api/v0/pleroma/reports/0") + |> json_response_and_validate_schema(:not_found) + + assert response == %{"error" => "Record not found"} + end + end +end -- cgit v1.2.3 From 6d66fadea7f798f64f4f8b5d41c9ef29469eaf78 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 17 Feb 2021 20:47:38 +0300 Subject: Remove `:auth, :enforce_oauth_admin_scope_usage` `admin` scope has been required by default for more than a year now and all apps that use the API seems to request a proper scope by now. --- CHANGELOG.md | 4 + config/config.exs | 5 +- docs/development/API/admin_api.md | 7 -- lib/pleroma/config.ex | 10 +- .../controllers/admin_api_controller_test.exs | 131 ++++++--------------- .../admin_api/controllers/user_controller_test.exs | 121 +++++-------------- .../controllers/emoji_file_controller_test.exs | 2 - .../controllers/emoji_pack_controller_test.exs | 1 - test/pleroma/web/plugs/o_auth_scopes_plug_test.exs | 38 ------ 9 files changed, 75 insertions(+), 244 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e26c8d261..74473b3d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Removed + +- `:auth, :enforce_oauth_admin_scope_usage` configuration option. + ### Changed - **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` diff --git a/config/config.exs b/config/config.exs index 0fbca06f3..66aee3264 100644 --- a/config/config.exs +++ b/config/config.exs @@ -611,10 +611,7 @@ base_path: "/oauth", providers: ueberauth_providers -config :pleroma, - :auth, - enforce_oauth_admin_scope_usage: true, - oauth_consumer_strategies: oauth_consumer_strategies +config :pleroma, :auth, oauth_consumer_strategies: oauth_consumer_strategies config :pleroma, Pleroma.Emails.Mailer, adapter: Swoosh.Adapters.Sendmail, enabled: false diff --git a/docs/development/API/admin_api.md b/docs/development/API/admin_api.md index 04a181401..f6519830b 100644 --- a/docs/development/API/admin_api.md +++ b/docs/development/API/admin_api.md @@ -2,13 +2,6 @@ Authentication is required and the user must be an admin. -Configuration options: - -* `[:auth, :enforce_oauth_admin_scope_usage]` — OAuth admin scope requirement toggle. - If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token (client app must support admin scopes). - If `false` and token doesn't have admin scope(s), `is_admin` user flag grants access to admin-specific actions. - Note that client app needs to explicitly support admin scopes and request them when obtaining auth token. - ## `GET /api/pleroma/admin/users` ### List users diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index f17e14128..b35491fdc 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -100,15 +100,7 @@ def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], []) def oauth_consumer_enabled?, do: oauth_consumer_strategies() != [] - def enforce_oauth_admin_scope_usage?, do: !!get([:auth, :enforce_oauth_admin_scope_usage]) - def oauth_admin_scopes(scopes) when is_list(scopes) do - Enum.flat_map( - scopes, - fn scope -> - ["admin:#{scope}"] ++ - if enforce_oauth_admin_scope_usage?(), do: [], else: [scope] - end - ) + Enum.map(scopes, fn scope -> "admin:#{scope}" end) end end 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 e7688c728..8cd9f939b 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 @@ -46,104 +46,47 @@ test "with valid `admin_token` query parameter, skips OAuth scopes check" do assert json_response(conn, 200) end - describe "with [:auth, :enforce_oauth_admin_scope_usage]," do - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], true) + test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope", + %{admin: admin} do + user = insert(:user) + url = "/api/pleroma/admin/users/#{user.nickname}" - test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope", - %{admin: admin} do - user = insert(:user) - url = "/api/pleroma/admin/users/#{user.nickname}" - - good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"]) - good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"]) - good_token3 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts"]) - - bad_token1 = insert(:oauth_token, user: admin, scopes: ["read:accounts"]) - bad_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts:partial"]) - bad_token3 = nil - - for good_token <- [good_token1, good_token2, good_token3] do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, good_token) - |> get(url) - - assert json_response(conn, 200) - end - - for good_token <- [good_token1, good_token2, good_token3] do - conn = - build_conn() - |> assign(:user, nil) - |> assign(:token, good_token) - |> get(url) - - assert json_response(conn, :forbidden) - end - - for bad_token <- [bad_token1, bad_token2, bad_token3] do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, bad_token) - |> get(url) - - assert json_response(conn, :forbidden) - end + good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"]) + good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"]) + good_token3 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts"]) + + bad_token1 = insert(:oauth_token, user: admin, scopes: ["read:accounts"]) + bad_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts:partial"]) + bad_token3 = nil + + for good_token <- [good_token1, good_token2, good_token3] do + conn = + build_conn() + |> assign(:user, admin) + |> assign(:token, good_token) + |> get(url) + + assert json_response(conn, 200) end - end - describe "unless [:auth, :enforce_oauth_admin_scope_usage]," do - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], false) + for good_token <- [good_token1, good_token2, good_token3] do + conn = + build_conn() + |> assign(:user, nil) + |> assign(:token, good_token) + |> get(url) + + assert json_response(conn, :forbidden) + end - test "GET /api/pleroma/admin/users/:nickname requires " <> - "read:accounts or admin:read:accounts or broader scope", - %{admin: admin} do - user = insert(:user) - url = "/api/pleroma/admin/users/#{user.nickname}" - - good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"]) - good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"]) - good_token3 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts"]) - good_token4 = insert(:oauth_token, user: admin, scopes: ["read:accounts"]) - good_token5 = insert(:oauth_token, user: admin, scopes: ["read"]) - - good_tokens = [good_token1, good_token2, good_token3, good_token4, good_token5] - - bad_token1 = insert(:oauth_token, user: admin, scopes: ["read:accounts:partial"]) - bad_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts:partial"]) - bad_token3 = nil - - for good_token <- good_tokens do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, good_token) - |> get(url) - - assert json_response(conn, 200) - end - - for good_token <- good_tokens do - conn = - build_conn() - |> assign(:user, nil) - |> assign(:token, good_token) - |> get(url) - - assert json_response(conn, :forbidden) - end - - for bad_token <- [bad_token1, bad_token2, bad_token3] do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, bad_token) - |> get(url) - - assert json_response(conn, :forbidden) - end + for bad_token <- [bad_token1, bad_token2, bad_token3] do + conn = + build_conn() + |> assign(:user, admin) + |> assign(:token, bad_token) + |> get(url) + + assert json_response(conn, :forbidden) end end diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index ef16dede3..beb8a5d58 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -47,104 +47,47 @@ test "with valid `admin_token` query parameter, skips OAuth scopes check" do assert json_response(conn, 200) end - describe "with [:auth, :enforce_oauth_admin_scope_usage]," do - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], true) - - test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope", - %{admin: admin} do - user = insert(:user) - url = "/api/pleroma/admin/users/#{user.nickname}" - - good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"]) - good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"]) - good_token3 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts"]) - - bad_token1 = insert(:oauth_token, user: admin, scopes: ["read:accounts"]) - bad_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts:partial"]) - bad_token3 = nil - - for good_token <- [good_token1, good_token2, good_token3] do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, good_token) - |> get(url) + test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope", + %{admin: admin} do + user = insert(:user) + url = "/api/pleroma/admin/users/#{user.nickname}" - assert json_response(conn, 200) - end + good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"]) + good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"]) + good_token3 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts"]) - for good_token <- [good_token1, good_token2, good_token3] do - conn = - build_conn() - |> assign(:user, nil) - |> assign(:token, good_token) - |> get(url) + bad_token1 = insert(:oauth_token, user: admin, scopes: ["read:accounts"]) + bad_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts:partial"]) + bad_token3 = nil - assert json_response(conn, :forbidden) - end - - for bad_token <- [bad_token1, bad_token2, bad_token3] do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, bad_token) - |> get(url) + for good_token <- [good_token1, good_token2, good_token3] do + conn = + build_conn() + |> assign(:user, admin) + |> assign(:token, good_token) + |> get(url) - assert json_response(conn, :forbidden) - end + assert json_response(conn, 200) end - end - describe "unless [:auth, :enforce_oauth_admin_scope_usage]," do - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], false) - - test "GET /api/pleroma/admin/users/:nickname requires " <> - "read:accounts or admin:read:accounts or broader scope", - %{admin: admin} do - user = insert(:user) - url = "/api/pleroma/admin/users/#{user.nickname}" - - good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"]) - good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"]) - good_token3 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts"]) - good_token4 = insert(:oauth_token, user: admin, scopes: ["read:accounts"]) - good_token5 = insert(:oauth_token, user: admin, scopes: ["read"]) - - good_tokens = [good_token1, good_token2, good_token3, good_token4, good_token5] - - bad_token1 = insert(:oauth_token, user: admin, scopes: ["read:accounts:partial"]) - bad_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read:accounts:partial"]) - bad_token3 = nil - - for good_token <- good_tokens do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, good_token) - |> get(url) - - assert json_response(conn, 200) - end - - for good_token <- good_tokens do - conn = - build_conn() - |> assign(:user, nil) - |> assign(:token, good_token) - |> get(url) + for good_token <- [good_token1, good_token2, good_token3] do + conn = + build_conn() + |> assign(:user, nil) + |> assign(:token, good_token) + |> get(url) - assert json_response(conn, :forbidden) - end + assert json_response(conn, :forbidden) + end - for bad_token <- [bad_token1, bad_token2, bad_token3] do - conn = - build_conn() - |> assign(:user, admin) - |> assign(:token, bad_token) - |> get(url) + for bad_token <- [bad_token1, bad_token2, bad_token3] do + conn = + build_conn() + |> assign(:user, admin) + |> assign(:token, bad_token) + |> get(url) - assert json_response(conn, :forbidden) - end + assert json_response(conn, :forbidden) end end diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs index 8f0da00c0..547391249 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs @@ -13,8 +13,6 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do Pleroma.Config.get!([:instance, :static_dir]), "emoji" ) - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], false) - setup do: clear_config([:instance, :public], true) setup do diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs index cd9fc391d..d1ba067b8 100644 --- a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs +++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs @@ -13,7 +13,6 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do Pleroma.Config.get!([:instance, :static_dir]), "emoji" ) - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage], false) setup do: clear_config([:instance, :public], true) diff --git a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs index 7241b0afd..9f6d3dc71 100644 --- a/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs +++ b/test/pleroma/web/plugs/o_auth_scopes_plug_test.exs @@ -169,42 +169,4 @@ test "filters scopes which directly match or are ancestors of supported scopes" assert f.(["admin:read"], ["write", "admin"]) == ["admin:read"] end end - - describe "transform_scopes/2" do - setup do: clear_config([:auth, :enforce_oauth_admin_scope_usage]) - - setup do - {:ok, %{f: &OAuthScopesPlug.transform_scopes/2}} - end - - test "with :admin option, prefixes all requested scopes with `admin:` " <> - "and [optionally] keeps only prefixed scopes, " <> - "depending on `[:auth, :enforce_oauth_admin_scope_usage]` setting", - %{f: f} do - clear_config([:auth, :enforce_oauth_admin_scope_usage], false) - - assert f.(["read"], %{admin: true}) == ["admin:read", "read"] - - assert f.(["read", "write"], %{admin: true}) == [ - "admin:read", - "read", - "admin:write", - "write" - ] - - clear_config([:auth, :enforce_oauth_admin_scope_usage], true) - - assert f.(["read:accounts"], %{admin: true}) == ["admin:read:accounts"] - - assert f.(["read", "write:reports"], %{admin: true}) == [ - "admin:read", - "admin:write:reports" - ] - end - - test "with no supported options, returns unmodified scopes", %{f: f} do - assert f.(["read"], %{}) == ["read"] - assert f.(["read", "write"], %{}) == ["read", "write"] - end - end end -- cgit v1.2.3 From 95a22c1cc27428434e566da47f3a2c04c9bf8fd5 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 17 Feb 2021 20:56:13 +0300 Subject: OpenAPI: Add `admin:` scope prefix to admin operations Also splits "Emoji packs" to two categories: "Emoji pack administration" and "Emoji packs" --- lib/pleroma/web/api_spec.ex | 4 ++-- .../api_spec/operations/admin/chat_operation.ex | 6 +++--- .../api_spec/operations/admin/config_operation.ex | 6 +++--- .../operations/admin/frontend_operation.ex | 4 ++-- .../admin/instance_document_operation.ex | 6 +++--- .../api_spec/operations/admin/invite_operation.ex | 8 ++++---- .../admin/media_proxy_cache_operation.ex | 6 +++--- .../operations/admin/o_auth_app_operation.ex | 8 ++++---- .../api_spec/operations/admin/relay_operation.ex | 6 +++--- .../api_spec/operations/admin/report_operation.ex | 10 ++++----- .../api_spec/operations/admin/status_operation.ex | 8 ++++---- .../operations/pleroma_emoji_file_operation.ex | 12 +++++------ .../operations/pleroma_emoji_pack_operation.ex | 24 +++++++++++----------- 13 files changed, 54 insertions(+), 54 deletions(-) diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index b16068f7b..adc8762dc 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -85,7 +85,7 @@ def spec(opts \\ []) do "name" => "Administration", "tags" => [ "Chat administration", - "Emoji packs", + "Emoji pack administration", "Frontend managment", "Instance configuration", "Instance documents", @@ -127,7 +127,7 @@ def spec(opts \\ []) do "Status actions" ] }, - %{"name" => "Miscellaneous", "tags" => ["Reports", "Suggestions"]} + %{"name" => "Miscellaneous", "tags" => ["Emoji packs", "Reports", "Suggestions"]} ] } } diff --git a/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex b/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex index cbe4b8972..57906445e 100644 --- a/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/chat_operation.ex @@ -33,7 +33,7 @@ def delete_message_operation do }, security: [ %{ - "oAuth" => ["write:chats"] + "oAuth" => ["admin:write:chats"] } ] } @@ -57,7 +57,7 @@ def messages_operation do }, security: [ %{ - "oAuth" => ["read:chats"] + "oAuth" => ["admin:read:chats"] } ] } @@ -88,7 +88,7 @@ def show_operation do }, security: [ %{ - "oAuth" => ["read"] + "oAuth" => ["admin:read"] } ] } diff --git a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex index b8ccc1d00..30c3433b7 100644 --- a/lib/pleroma/web/api_spec/operations/admin/config_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/config_operation.ex @@ -28,7 +28,7 @@ def show_operation do ) | admin_api_params() ], - security: [%{"oAuth" => ["read"]}], + security: [%{"oAuth" => ["admin:read"]}], responses: %{ 200 => Operation.response("Config", "application/json", config_response()), 400 => Operation.response("Bad Request", "application/json", ApiError) @@ -41,7 +41,7 @@ def update_operation do tags: ["Instance configuration"], summary: "Update instance configuration", operationId: "AdminAPI.ConfigController.update", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: admin_api_params(), requestBody: request_body("Parameters", %Schema{ @@ -74,7 +74,7 @@ def descriptions_operation do tags: ["Instance configuration"], summary: "Retrieve config description", operationId: "AdminAPI.ConfigController.descriptions", - security: [%{"oAuth" => ["read"]}], + security: [%{"oAuth" => ["admin:read"]}], parameters: admin_api_params(), responses: %{ 200 => diff --git a/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex b/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex index b149becf9..566f1eeb1 100644 --- a/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/frontend_operation.ex @@ -19,7 +19,7 @@ def index_operation do tags: ["Frontend managment"], summary: "Retrieve a list of available frontends", operationId: "AdminAPI.FrontendController.index", - security: [%{"oAuth" => ["read"]}], + security: [%{"oAuth" => ["admin:read"]}], responses: %{ 200 => Operation.response("Response", "application/json", list_of_frontends()), 403 => Operation.response("Forbidden", "application/json", ApiError) @@ -32,7 +32,7 @@ def install_operation do tags: ["Frontend managment"], summary: "Install a frontend", operationId: "AdminAPI.FrontendController.install", - security: [%{"oAuth" => ["read"]}], + security: [%{"oAuth" => ["admin:read"]}], requestBody: request_body("Parameters", install_request(), required: true), responses: %{ 200 => Operation.response("Response", "application/json", list_of_frontends()), diff --git a/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex b/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex index 3e89abfb5..79ceae970 100644 --- a/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/instance_document_operation.ex @@ -18,7 +18,7 @@ def show_operation do tags: ["Instance documents"], summary: "Retrieve an instance document", operationId: "AdminAPI.InstanceDocumentController.show", - security: [%{"oAuth" => ["read"]}], + security: [%{"oAuth" => ["admin:read"]}], parameters: [ Operation.parameter(:name, :path, %Schema{type: :string}, "The document name", required: true @@ -39,7 +39,7 @@ def update_operation do tags: ["Instance documents"], summary: "Update an instance document", operationId: "AdminAPI.InstanceDocumentController.update", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], requestBody: Helpers.request_body("Parameters", update_request()), parameters: [ Operation.parameter(:name, :path, %Schema{type: :string}, "The document name", @@ -77,7 +77,7 @@ def delete_operation do tags: ["Instance documents"], summary: "Delete an instance document", operationId: "AdminAPI.InstanceDocumentController.delete", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: [ Operation.parameter(:name, :path, %Schema{type: :string}, "The document name", required: true diff --git a/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex b/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex index 60d69c767..704f082ba 100644 --- a/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/invite_operation.ex @@ -19,7 +19,7 @@ def index_operation do tags: ["Invites"], summary: "Get a list of generated invites", operationId: "AdminAPI.InviteController.index", - security: [%{"oAuth" => ["read:invites"]}], + security: [%{"oAuth" => ["admin:read:invites"]}], parameters: admin_api_params(), responses: %{ 200 => @@ -51,7 +51,7 @@ def create_operation do tags: ["Invites"], summary: "Create an account registration invite token", operationId: "AdminAPI.InviteController.create", - security: [%{"oAuth" => ["write:invites"]}], + security: [%{"oAuth" => ["admin:write:invites"]}], parameters: admin_api_params(), requestBody: request_body("Parameters", %Schema{ @@ -72,7 +72,7 @@ def revoke_operation do tags: ["Invites"], summary: "Revoke invite by token", operationId: "AdminAPI.InviteController.revoke", - security: [%{"oAuth" => ["write:invites"]}], + security: [%{"oAuth" => ["admin:write:invites"]}], parameters: admin_api_params(), requestBody: request_body( @@ -99,7 +99,7 @@ def email_operation do tags: ["Invites"], summary: "Sends registration invite via email", operationId: "AdminAPI.InviteController.email", - security: [%{"oAuth" => ["write:invites"]}], + security: [%{"oAuth" => ["admin:write:invites"]}], parameters: admin_api_params(), requestBody: request_body( diff --git a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex index 675504ee0..8f85ebf2d 100644 --- a/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/media_proxy_cache_operation.ex @@ -19,7 +19,7 @@ def index_operation do tags: ["MediaProxy cache"], summary: "Retrieve a list of banned MediaProxy URLs", operationId: "AdminAPI.MediaProxyCacheController.index", - security: [%{"oAuth" => ["read:media_proxy_caches"]}], + security: [%{"oAuth" => ["admin:read:media_proxy_caches"]}], parameters: [ Operation.parameter( :query, @@ -71,7 +71,7 @@ def delete_operation do tags: ["MediaProxy cache"], summary: "Remove a banned MediaProxy URL", operationId: "AdminAPI.MediaProxyCacheController.delete", - security: [%{"oAuth" => ["write:media_proxy_caches"]}], + security: [%{"oAuth" => ["admin:write:media_proxy_caches"]}], parameters: admin_api_params(), requestBody: request_body( @@ -97,7 +97,7 @@ def purge_operation do tags: ["MediaProxy cache"], summary: "Purge a URL from MediaProxy cache and optionally ban it", operationId: "AdminAPI.MediaProxyCacheController.purge", - security: [%{"oAuth" => ["write:media_proxy_caches"]}], + security: [%{"oAuth" => ["admin:write:media_proxy_caches"]}], parameters: admin_api_params(), requestBody: request_body( diff --git a/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex index 2f3bee4f0..35b029b19 100644 --- a/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/o_auth_app_operation.ex @@ -19,7 +19,7 @@ def index_operation do summary: "Retrieve a list of OAuth applications", tags: ["OAuth application managment"], operationId: "AdminAPI.OAuthAppController.index", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: [ Operation.parameter(:name, :query, %Schema{type: :string}, "App name"), Operation.parameter(:client_id, :query, %Schema{type: :string}, "Client ID"), @@ -74,7 +74,7 @@ def create_operation do operationId: "AdminAPI.OAuthAppController.create", requestBody: request_body("Parameters", create_request()), parameters: admin_api_params(), - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], responses: %{ 200 => Operation.response("App", "application/json", oauth_app()), 400 => Operation.response("Bad Request", "application/json", ApiError) @@ -88,7 +88,7 @@ def update_operation do summary: "Update OAuth application", operationId: "AdminAPI.OAuthAppController.update", parameters: [id_param() | admin_api_params()], - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], requestBody: request_body("Parameters", update_request()), responses: %{ 200 => Operation.response("App", "application/json", oauth_app()), @@ -106,7 +106,7 @@ def delete_operation do summary: "Delete OAuth application", operationId: "AdminAPI.OAuthAppController.delete", parameters: [id_param() | admin_api_params()], - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], responses: %{ 204 => no_content_response(), 400 => no_content_response() diff --git a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex index c47f18f0c..c55c84fee 100644 --- a/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/relay_operation.ex @@ -18,7 +18,7 @@ def index_operation do tags: ["Relays"], summary: "Retrieve a list of relays", operationId: "AdminAPI.RelayController.index", - security: [%{"oAuth" => ["read"]}], + security: [%{"oAuth" => ["admin:read"]}], parameters: admin_api_params(), responses: %{ 200 => @@ -40,7 +40,7 @@ def follow_operation do tags: ["Relays"], summary: "Follow a relay", operationId: "AdminAPI.RelayController.follow", - security: [%{"oAuth" => ["write:follows"]}], + security: [%{"oAuth" => ["admin:write:follows"]}], parameters: admin_api_params(), requestBody: request_body("Parameters", relay_url()), responses: %{ @@ -54,7 +54,7 @@ def unfollow_operation do tags: ["Relays"], summary: "Unfollow a relay", operationId: "AdminAPI.RelayController.unfollow", - security: [%{"oAuth" => ["write:follows"]}], + security: [%{"oAuth" => ["admin:write:follows"]}], parameters: admin_api_params(), requestBody: request_body("Parameters", relay_unfollow()), responses: %{ diff --git a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex index cfa892d29..3ea4af1e4 100644 --- a/lib/pleroma/web/api_spec/operations/admin/report_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/report_operation.ex @@ -22,7 +22,7 @@ def index_operation do tags: ["Report managment"], summary: "Retrieve a list of reports", operationId: "AdminAPI.ReportController.index", - security: [%{"oAuth" => ["read:reports"]}], + security: [%{"oAuth" => ["admin:read:reports"]}], parameters: [ Operation.parameter( :state, @@ -73,7 +73,7 @@ def show_operation do summary: "Retrieve a report", operationId: "AdminAPI.ReportController.show", parameters: [id_param() | admin_api_params()], - security: [%{"oAuth" => ["read:reports"]}], + security: [%{"oAuth" => ["admin:read:reports"]}], responses: %{ 200 => Operation.response("Report", "application/json", report()), 404 => Operation.response("Not Found", "application/json", ApiError) @@ -86,7 +86,7 @@ def update_operation do tags: ["Report managment"], summary: "Change state of specified reports", operationId: "AdminAPI.ReportController.update", - security: [%{"oAuth" => ["write:reports"]}], + security: [%{"oAuth" => ["admin:write:reports"]}], parameters: admin_api_params(), requestBody: request_body("Parameters", update_request(), required: true), responses: %{ @@ -110,7 +110,7 @@ def notes_create_operation do content: %Schema{type: :string, description: "The message"} } }), - security: [%{"oAuth" => ["write:reports"]}], + security: [%{"oAuth" => ["admin:write:reports"]}], responses: %{ 204 => no_content_response(), 404 => Operation.response("Not Found", "application/json", ApiError) @@ -128,7 +128,7 @@ def notes_delete_operation do Operation.parameter(:id, :path, :string, "Note ID") | admin_api_params() ], - security: [%{"oAuth" => ["write:reports"]}], + security: [%{"oAuth" => ["admin:write:reports"]}], responses: %{ 204 => no_content_response(), 404 => Operation.response("Not Found", "application/json", ApiError) diff --git a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex index bbfbd8f93..d25ab5247 100644 --- a/lib/pleroma/web/api_spec/operations/admin/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/status_operation.ex @@ -24,7 +24,7 @@ def index_operation do tags: ["Status administration"], operationId: "AdminAPI.StatusController.index", summary: "Get all statuses", - security: [%{"oAuth" => ["read:statuses"]}], + security: [%{"oAuth" => ["admin:read:statuses"]}], parameters: [ Operation.parameter( :godmode, @@ -74,7 +74,7 @@ def show_operation do summary: "Get status", operationId: "AdminAPI.StatusController.show", parameters: [id_param() | admin_api_params()], - security: [%{"oAuth" => ["read:statuses"]}], + security: [%{"oAuth" => ["admin:read:statuses"]}], responses: %{ 200 => Operation.response("Status", "application/json", status()), 404 => Operation.response("Not Found", "application/json", ApiError) @@ -88,7 +88,7 @@ def update_operation do summary: "Change the scope of a status", operationId: "AdminAPI.StatusController.update", parameters: [id_param() | admin_api_params()], - security: [%{"oAuth" => ["write:statuses"]}], + security: [%{"oAuth" => ["admin:write:statuses"]}], requestBody: request_body("Parameters", update_request(), required: true), responses: %{ 200 => Operation.response("Status", "application/json", Status), @@ -103,7 +103,7 @@ def delete_operation do summary: "Delete status", operationId: "AdminAPI.StatusController.delete", parameters: [id_param() | admin_api_params()], - security: [%{"oAuth" => ["write:statuses"]}], + security: [%{"oAuth" => ["admin:write:statuses"]}], responses: %{ 200 => empty_object_response(), 404 => Operation.response("Not Found", "application/json", ApiError) diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex index bed9511ef..8c76096b5 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_file_operation.ex @@ -16,10 +16,10 @@ def open_api_operation(action) do def create_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Add new file to the pack", operationId: "PleromaAPI.EmojiPackController.add_file", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], requestBody: request_body("Parameters", create_request(), required: true), parameters: [name_param()], responses: %{ @@ -62,10 +62,10 @@ defp create_request do def update_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Add new file to the pack", operationId: "PleromaAPI.EmojiPackController.update_file", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], requestBody: request_body("Parameters", update_request(), required: true), parameters: [name_param()], responses: %{ @@ -106,10 +106,10 @@ defp update_request do def delete_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Delete emoji file from pack", operationId: "PleromaAPI.EmojiPackController.delete_file", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: [ name_param(), Operation.parameter(:shortcode, :query, :string, "File shortcode", diff --git a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex index 48dafa5f2..49247d9b6 100644 --- a/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex +++ b/lib/pleroma/web/api_spec/operations/pleroma_emoji_pack_operation.ex @@ -16,9 +16,9 @@ def open_api_operation(action) do def remote_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Make request to another instance for emoji packs list", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: [ url_param(), Operation.parameter( @@ -115,10 +115,10 @@ def archive_operation do def download_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Download pack from another instance", operationId: "PleromaAPI.EmojiPackController.download", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], requestBody: request_body("Parameters", download_request(), required: true), responses: %{ 200 => ok_response(), @@ -145,10 +145,10 @@ defp download_request do def create_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Create an empty pack", operationId: "PleromaAPI.EmojiPackController.create", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: [name_param()], responses: %{ 200 => ok_response(), @@ -161,10 +161,10 @@ def create_operation do def delete_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Delete a custom emoji pack", operationId: "PleromaAPI.EmojiPackController.delete", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], parameters: [name_param()], responses: %{ 200 => ok_response(), @@ -177,10 +177,10 @@ def delete_operation do def update_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Updates (replaces) pack metadata", operationId: "PleromaAPI.EmojiPackController.update", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], requestBody: request_body("Parameters", update_request(), required: true), parameters: [name_param()], responses: %{ @@ -193,10 +193,10 @@ def update_operation do def import_from_filesystem_operation do %Operation{ - tags: ["Emoji packs"], + tags: ["Emoji pack administration"], summary: "Imports packs from filesystem", operationId: "PleromaAPI.EmojiPackController.import", - security: [%{"oAuth" => ["write"]}], + security: [%{"oAuth" => ["admin:write"]}], responses: %{ 200 => Operation.response("Array of imported pack names", "application/json", %Schema{ -- cgit v1.2.3 From 2ab9499258ee4abe92dd89dfe8ebaf0a7dad7564 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Wed, 17 Feb 2021 21:37:23 +0300 Subject: OAuthScopesPlug: remove transform_scopes in favor of explicit admin scope definitions Transforming scopes is no longer necessary since we are dropping support for accessing admin api without `admin:` prefix in scopes. --- lib/pleroma/config.ex | 4 ---- .../web/admin_api/controllers/admin_api_controller.ex | 12 ++++++------ lib/pleroma/web/admin_api/controllers/chat_controller.ex | 4 ++-- lib/pleroma/web/admin_api/controllers/config_controller.ex | 4 ++-- lib/pleroma/web/admin_api/controllers/frontend_controller.ex | 4 ++-- .../admin_api/controllers/instance_document_controller.ex | 4 ++-- lib/pleroma/web/admin_api/controllers/invite_controller.ex | 4 ++-- .../admin_api/controllers/media_proxy_cache_controller.ex | 4 ++-- .../web/admin_api/controllers/o_auth_app_controller.ex | 2 +- lib/pleroma/web/admin_api/controllers/relay_controller.ex | 4 ++-- lib/pleroma/web/admin_api/controllers/report_controller.ex | 4 ++-- lib/pleroma/web/admin_api/controllers/status_controller.ex | 4 ++-- lib/pleroma/web/admin_api/controllers/user_controller.ex | 6 +++--- .../web/pleroma_api/controllers/emoji_file_controller.ex | 2 +- .../web/pleroma_api/controllers/emoji_pack_controller.ex | 2 +- lib/pleroma/web/plugs/o_auth_scopes_plug.ex | 11 ----------- 16 files changed, 30 insertions(+), 45 deletions(-) diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index b35491fdc..2e15a3719 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -99,8 +99,4 @@ def restrict_unauthenticated_access?(resource, kind) do def oauth_consumer_strategies, do: get([:auth, :oauth_consumer_strategies], []) def oauth_consumer_enabled?, do: oauth_consumer_strategies() != [] - - def oauth_admin_scopes(scopes) when is_list(scopes) do - Enum.map(scopes, fn scope -> "admin:#{scope}" end) - end end 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 d581df4a2..839ac1a8d 100644 --- a/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/admin_api_controller.ex @@ -25,13 +25,13 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do plug( OAuthScopesPlug, - %{scopes: ["read:accounts"], admin: true} + %{scopes: ["admin:read:accounts"]} when action in [:right_get, :show_user_credentials, :create_backup] ) plug( OAuthScopesPlug, - %{scopes: ["write:accounts"], admin: true} + %{scopes: ["admin:write:accounts"]} when action in [ :get_password_reset, :force_password_reset, @@ -48,19 +48,19 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do plug( OAuthScopesPlug, - %{scopes: ["read:statuses"], admin: true} + %{scopes: ["admin:read:statuses"]} when action in [:list_user_statuses, :list_instance_statuses] ) plug( OAuthScopesPlug, - %{scopes: ["read:chats"], admin: true} + %{scopes: ["admin:read:chats"]} when action in [:list_user_chats] ) plug( OAuthScopesPlug, - %{scopes: ["read"], admin: true} + %{scopes: ["admin:read"]} when action in [ :list_log, :stats, @@ -70,7 +70,7 @@ defmodule Pleroma.Web.AdminAPI.AdminAPIController do plug( OAuthScopesPlug, - %{scopes: ["write"], admin: true} + %{scopes: ["admin:write"]} when action in [ :restart, :resend_confirmation_email, diff --git a/lib/pleroma/web/admin_api/controllers/chat_controller.ex b/lib/pleroma/web/admin_api/controllers/chat_controller.ex index 3761a588a..ff20c8604 100644 --- a/lib/pleroma/web/admin_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/chat_controller.ex @@ -21,12 +21,12 @@ defmodule Pleroma.Web.AdminAPI.ChatController do plug( OAuthScopesPlug, - %{scopes: ["read:chats"], admin: true} when action in [:show, :messages] + %{scopes: ["admin:read:chats"]} when action in [:show, :messages] ) plug( OAuthScopesPlug, - %{scopes: ["write:chats"], admin: true} when action in [:delete_message] + %{scopes: ["admin:write:chats"]} when action in [:delete_message] ) action_fallback(Pleroma.Web.AdminAPI.FallbackController) diff --git a/lib/pleroma/web/admin_api/controllers/config_controller.ex b/lib/pleroma/web/admin_api/controllers/config_controller.ex index 4ebf2a305..a718d7b8d 100644 --- a/lib/pleroma/web/admin_api/controllers/config_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/config_controller.ex @@ -10,11 +10,11 @@ defmodule Pleroma.Web.AdminAPI.ConfigController do alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["write"], admin: true} when action == :update) + plug(OAuthScopesPlug, %{scopes: ["admin:write"]} when action == :update) plug( OAuthScopesPlug, - %{scopes: ["read"], admin: true} + %{scopes: ["admin:read"]} when action in [:show, :descriptions] ) diff --git a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex index 20472a55e..722f51bd2 100644 --- a/lib/pleroma/web/admin_api/controllers/frontend_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/frontend_controller.ex @@ -9,8 +9,8 @@ defmodule Pleroma.Web.AdminAPI.FrontendController do alias Pleroma.Web.Plugs.OAuthScopesPlug plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["write"], admin: true} when action == :install) - plug(OAuthScopesPlug, %{scopes: ["read"], admin: true} when action == :index) + plug(OAuthScopesPlug, %{scopes: ["admin:write"]} when action == :install) + plug(OAuthScopesPlug, %{scopes: ["admin:read"]} when action == :index) action_fallback(Pleroma.Web.AdminAPI.FallbackController) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.Admin.FrontendOperation diff --git a/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex b/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex index ef00d3417..a55857a0e 100644 --- a/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/instance_document_controller.ex @@ -15,8 +15,8 @@ defmodule Pleroma.Web.AdminAPI.InstanceDocumentController do defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.Admin.InstanceDocumentOperation - plug(OAuthScopesPlug, %{scopes: ["read"], admin: true} when action == :show) - plug(OAuthScopesPlug, %{scopes: ["write"], admin: true} when action in [:update, :delete]) + plug(OAuthScopesPlug, %{scopes: ["admin:read"]} when action == :show) + plug(OAuthScopesPlug, %{scopes: ["admin:write"]} when action in [:update, :delete]) def show(conn, %{name: document_name}) do with {:ok, url} <- InstanceDocument.get(document_name), diff --git a/lib/pleroma/web/admin_api/controllers/invite_controller.ex b/lib/pleroma/web/admin_api/controllers/invite_controller.ex index 3f233a0c4..727ebd846 100644 --- a/lib/pleroma/web/admin_api/controllers/invite_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/invite_controller.ex @@ -14,11 +14,11 @@ defmodule Pleroma.Web.AdminAPI.InviteController do require Logger plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["read:invites"], admin: true} when action == :index) + plug(OAuthScopesPlug, %{scopes: ["admin:read:invites"]} when action == :index) plug( OAuthScopesPlug, - %{scopes: ["write:invites"], admin: true} when action in [:create, :revoke, :email] + %{scopes: ["admin:write:invites"]} when action in [:create, :revoke, :email] ) action_fallback(Pleroma.Web.AdminAPI.FallbackController) diff --git a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex index 3564738af..a6d7aaf54 100644 --- a/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex @@ -15,12 +15,12 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheController do plug( OAuthScopesPlug, - %{scopes: ["read:media_proxy_caches"], admin: true} when action in [:index] + %{scopes: ["admin:read:media_proxy_caches"]} when action in [:index] ) plug( OAuthScopesPlug, - %{scopes: ["write:media_proxy_caches"], admin: true} when action in [:purge, :delete] + %{scopes: ["admin:write:media_proxy_caches"]} when action in [:purge, :delete] ) action_fallback(Pleroma.Web.AdminAPI.FallbackController) diff --git a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex index 2bd2b3644..005fe67e2 100644 --- a/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/o_auth_app_controller.ex @@ -17,7 +17,7 @@ defmodule Pleroma.Web.AdminAPI.OAuthAppController do plug( OAuthScopesPlug, - %{scopes: ["write"], admin: true} + %{scopes: ["admin:write"]} when action in [:create, :index, :update, :delete] ) diff --git a/lib/pleroma/web/admin_api/controllers/relay_controller.ex b/lib/pleroma/web/admin_api/controllers/relay_controller.ex index 18443e74e..c6bd43fea 100644 --- a/lib/pleroma/web/admin_api/controllers/relay_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/relay_controller.ex @@ -15,11 +15,11 @@ defmodule Pleroma.Web.AdminAPI.RelayController do plug( OAuthScopesPlug, - %{scopes: ["write:follows"], admin: true} + %{scopes: ["admin:write:follows"]} when action in [:follow, :unfollow] ) - plug(OAuthScopesPlug, %{scopes: ["read"], admin: true} when action == :index) + plug(OAuthScopesPlug, %{scopes: ["admin:read"]} when action == :index) action_fallback(Pleroma.Web.AdminAPI.FallbackController) diff --git a/lib/pleroma/web/admin_api/controllers/report_controller.ex b/lib/pleroma/web/admin_api/controllers/report_controller.ex index abc068a3f..d4a4935ee 100644 --- a/lib/pleroma/web/admin_api/controllers/report_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/report_controller.ex @@ -19,11 +19,11 @@ defmodule Pleroma.Web.AdminAPI.ReportController do require Logger plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["read:reports"], admin: true} when action in [:index, :show]) + plug(OAuthScopesPlug, %{scopes: ["admin:read:reports"]} when action in [:index, :show]) plug( OAuthScopesPlug, - %{scopes: ["write:reports"], admin: true} + %{scopes: ["admin:write:reports"]} when action in [:update, :notes_create, :notes_delete] ) diff --git a/lib/pleroma/web/admin_api/controllers/status_controller.ex b/lib/pleroma/web/admin_api/controllers/status_controller.ex index 903badec0..7058def82 100644 --- a/lib/pleroma/web/admin_api/controllers/status_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/status_controller.ex @@ -15,11 +15,11 @@ defmodule Pleroma.Web.AdminAPI.StatusController do require Logger plug(Pleroma.Web.ApiSpec.CastAndValidate) - plug(OAuthScopesPlug, %{scopes: ["read:statuses"], admin: true} when action in [:index, :show]) + plug(OAuthScopesPlug, %{scopes: ["admin:read:statuses"]} when action in [:index, :show]) plug( OAuthScopesPlug, - %{scopes: ["write:statuses"], admin: true} when action in [:update, :delete] + %{scopes: ["admin:write:statuses"]} when action in [:update, :delete] ) action_fallback(Pleroma.Web.AdminAPI.FallbackController) diff --git a/lib/pleroma/web/admin_api/controllers/user_controller.ex b/lib/pleroma/web/admin_api/controllers/user_controller.ex index a18b9f8d5..65bc63cb9 100644 --- a/lib/pleroma/web/admin_api/controllers/user_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/user_controller.ex @@ -21,13 +21,13 @@ defmodule Pleroma.Web.AdminAPI.UserController do plug( OAuthScopesPlug, - %{scopes: ["read:accounts"], admin: true} + %{scopes: ["admin:read:accounts"]} when action in [:list, :show] ) plug( OAuthScopesPlug, - %{scopes: ["write:accounts"], admin: true} + %{scopes: ["admin:write:accounts"]} when action in [ :delete, :create, @@ -40,7 +40,7 @@ defmodule Pleroma.Web.AdminAPI.UserController do plug( OAuthScopesPlug, - %{scopes: ["write:follows"], admin: true} + %{scopes: ["admin:write:follows"]} when action in [:follow, :unfollow] ) diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex index 6a41bbab4..204e81311 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_file_controller.ex @@ -12,7 +12,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileController do plug( Pleroma.Web.Plugs.OAuthScopesPlug, - %{scopes: ["write"], admin: true} + %{scopes: ["admin:write"]} when action in [ :create, :update, diff --git a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex index c696241f0..d0f677d3c 100644 --- a/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex @@ -11,7 +11,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackController do plug( Pleroma.Web.Plugs.OAuthScopesPlug, - %{scopes: ["write"], admin: true} + %{scopes: ["admin:write"]} when action in [ :import_from_filesystem, :remote, diff --git a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex index 0f32f70a6..f017c8bc7 100644 --- a/lib/pleroma/web/plugs/o_auth_scopes_plug.ex +++ b/lib/pleroma/web/plugs/o_auth_scopes_plug.ex @@ -6,7 +6,6 @@ defmodule Pleroma.Web.Plugs.OAuthScopesPlug do import Plug.Conn import Pleroma.Web.Gettext - alias Pleroma.Config alias Pleroma.Helpers.AuthHelper use Pleroma.Web, :plug @@ -18,7 +17,6 @@ def perform(%Plug.Conn{assigns: assigns} = conn, %{scopes: scopes} = options) do op = options[:op] || :| token = assigns[:token] - scopes = transform_scopes(scopes, options) matched_scopes = (token && filter_descendants(scopes, token.scopes)) || [] cond do @@ -57,13 +55,4 @@ def filter_descendants(scopes, supported_scopes) do end ) end - - @doc "Transforms scopes by applying supported options (e.g. :admin)" - def transform_scopes(scopes, options) do - if options[:admin] do - Config.oauth_admin_scopes(scopes) - else - scopes - end - end end -- cgit v1.2.3 From 1e6c27181e0bbfad3fbd964d770cd4d547c10236 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 11 Feb 2021 13:01:48 +0300 Subject: expires_in in scheduled status params --- CHANGELOG.md | 1 + .../API/differences_in_mastoapi_responses.md | 6 ++++++ .../web/api_spec/schemas/scheduled_status.ex | 6 ++++-- .../mastodon_api/views/scheduled_activity_view.ex | 3 ++- .../controllers/status_controller_test.exs | 25 ++++++++++++++++++++++ .../views/scheduled_activity_view_test.exs | 3 ++- 6 files changed, 40 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74473b3d0..508a6ea15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: Home, public, hashtag & list timelines accept `only_media`, `remote` & `local` parameters for filtration. - Mastodon API: `/api/v1/accounts/:id` & `/api/v1/mutes` endpoints accept `with_relationships` parameter and return filled `pleroma.relationship` field. - Mastodon API: Endpoint to remove a conversation (`DELETE /api/v1/conversations/:id`). +- Mastodon API: `expires_in` in the scheduled post `params` field on `/api/v1/statuses` and `/api/v1/scheduled_statuses/:id` endpoints.
### Fixed diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index 38d70fa78..6288ad33d 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -39,6 +39,12 @@ Has these additional fields under the `pleroma` object: - `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint. - `parent_visible`: If the parent of this post is visible to the user or not. +## Scheduled statuses + +Has these additional fields in `params`: + +- `expires_in`: the number of seconds the posted activity should expire in. + ## Media Attachments Has these additional fields under the `pleroma` object: diff --git a/lib/pleroma/web/api_spec/schemas/scheduled_status.ex b/lib/pleroma/web/api_spec/schemas/scheduled_status.ex index cc051046a..607586e32 100644 --- a/lib/pleroma/web/api_spec/schemas/scheduled_status.ex +++ b/lib/pleroma/web/api_spec/schemas/scheduled_status.ex @@ -30,7 +30,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do visibility: %Schema{allOf: [VisibilityScope], nullable: true}, scheduled_at: %Schema{type: :string, format: :"date-time", nullable: true}, poll: StatusOperation.poll_params(), - in_reply_to_id: %Schema{type: :string, nullable: true} + in_reply_to_id: %Schema{type: :string, nullable: true}, + expires_in: %Schema{type: :integer, nullable: true} } } }, @@ -46,7 +47,8 @@ defmodule Pleroma.Web.ApiSpec.Schemas.ScheduledStatus do scheduled_at: nil, poll: nil, idempotency: nil, - in_reply_to_id: nil + in_reply_to_id: nil, + expires_in: nil }, media_attachments: [Attachment.schema().example] } diff --git a/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex b/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex index 13774d237..453221f41 100644 --- a/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex +++ b/lib/pleroma/web/mastodon_api/views/scheduled_activity_view.ex @@ -37,7 +37,8 @@ defp status_params(params) do visibility: params["visibility"], scheduled_at: params["scheduled_at"], poll: params["poll"], - in_reply_to_id: params["in_reply_to_id"] + in_reply_to_id: params["in_reply_to_id"], + expires_in: params["expires_in"] } |> Pleroma.Maps.put_if_present(:media_ids, params["media_ids"]) end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index dcd1e6d5b..c59b156bf 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -383,6 +383,31 @@ test "creates a scheduled activity", %{conn: conn} do assert [] == Repo.all(Activity) end + test "with expiration" do + %{conn: conn} = oauth_access(["write:statuses", "read:statuses"]) + + scheduled_at = + NaiveDateTime.add(NaiveDateTime.utc_now(), :timer.minutes(6), :millisecond) + |> NaiveDateTime.to_iso8601() + |> Kernel.<>("Z") + + assert %{"id" => status_id, "params" => %{"expires_in" => 300}} = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses", %{ + "status" => "scheduled", + "scheduled_at" => scheduled_at, + "expires_in" => 300 + }) + |> json_response_and_validate_schema(200) + + assert %{"id" => ^status_id, "params" => %{"expires_in" => 300}} = + conn + |> put_req_header("content-type", "application/json") + |> get("/api/v1/scheduled_statuses/#{status_id}") + |> json_response_and_validate_schema(200) + end + test "ignores nil values", %{conn: conn} do conn = conn diff --git a/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs index c3b7f0f41..e323f3a1f 100644 --- a/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs @@ -58,7 +58,8 @@ test "A scheduled activity with a media attachment" do sensitive: true, spoiler_text: "spoiler", text: "hi", - visibility: "unlisted" + visibility: "unlisted", + expires_in: nil }, scheduled_at: Utils.to_masto_date(scheduled_activity.scheduled_at) } -- cgit v1.2.3 From b981edad8a7d8f27b231bc6164fc0546efbdb646 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 18 Feb 2021 20:40:10 +0300 Subject: [#3213] HashtagsTableMigrator: fault rate allowance to enable the feature (defaults to 1%), counting of affected objects, misc. tweaks. --- config/config.exs | 2 + config/description.exs | 7 ++ docs/configuration/cheatsheet.md | 1 + lib/pleroma/migrators/hashtags_table_migrator.ex | 101 +++++++++++++++------ .../migrators/hashtags_table_migrator/state.ex | 4 +- 5 files changed, 84 insertions(+), 31 deletions(-) diff --git a/config/config.exs b/config/config.exs index 0fbca06f3..c371c397c 100644 --- a/config/config.exs +++ b/config/config.exs @@ -657,6 +657,8 @@ config :pleroma, :database, rum_enabled: false +config :pleroma, :populate_hashtags_table, fault_rate_allowance: 0.01 + config :pleroma, :env, Mix.env() config :http_signatures, diff --git a/config/description.exs b/config/description.exs index 29fc5fbd4..6ffc71278 100644 --- a/config/description.exs +++ b/config/description.exs @@ -479,6 +479,13 @@ type: :group, description: "`populate_hashtags_table` background migration settings", children: [ + %{ + key: :fault_rate_allowance, + type: :float, + description: + "Max rate of failed objects to actually processed objects in order to enable the feature (any value from 0.0 which tolerates no errors to 1.0 which will enable the feature even if hashtags transfer failed for all records).", + suggestions: [0.01] + }, %{ key: :sleep_interval_ms, type: :integer, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 68a5a3c7f..6a1031f15 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -70,6 +70,7 @@ To add configuration to your config file, you can copy it from the base config. ## Background migrations * `populate_hashtags_table/sleep_interval_ms`: Sleep interval between each chunk of processed records in order to decrease the load on the system (defaults to 0 and should be keep default on most instances). +* `populate_hashtags_table/fault_rate_allowance`: Max rate of failed objects to actually processed objects in order to enable the feature (any value from 0.0 which tolerates no errors to 1.0 which will enable the feature even if hashtags transfer failed for all records). ## Welcome * `direct_message`: - welcome message sent as a direct message. diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index ac17f91cc..45dab8470 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -15,7 +15,8 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator do alias Pleroma.Object alias Pleroma.Repo - defdelegate data_migration(), to: State + defdelegate data_migration(), to: Pleroma.DataMigration, as: :populate_hashtags_table + defdelegate data_migration_id(), to: State defdelegate state(), to: State defdelegate persist_state(), to: State, as: :persist_to_db @@ -23,10 +24,13 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator do defdelegate put_stat(key, value), to: State, as: :put_data_key defdelegate increment_stat(key, increment), to: State, as: :increment_data_key + @feature_config_path [:database, :improved_hashtag_timeline] @reg_name {:global, __MODULE__} def whereis, do: GenServer.whereis(@reg_name) + def feature_state, do: Config.get(@feature_config_path) + def start_link(_) do case whereis() do nil -> @@ -46,8 +50,6 @@ def init(_) do def handle_continue(:init_state, _state) do {:ok, _} = State.start_link(nil) - update_status(:pending) - data_migration = data_migration() manual_migrations = Config.get([:instance, :manual_data_migrations], []) @@ -56,10 +58,14 @@ def handle_continue(:init_state, _state) do update_status(:noop) is_nil(data_migration) -> - update_status(:failed, "Data migration does not exist.") + message = "Data migration does not exist." + update_status(:failed, message) + Logger.error("#{__MODULE__}: #{message}") data_migration.state == :manual or data_migration.name in manual_migrations -> - update_status(:manual, "Data migration is in manual execution state.") + message = "Data migration is in manual execution or manual fix mode." + update_status(:manual, message) + Logger.warn("#{__MODULE__}: #{message}") data_migration.state == :complete -> on_complete(data_migration) @@ -78,7 +84,7 @@ def handle_info(:migrate_hashtags, state) do update_status(:running) put_stat(:started_at, NaiveDateTime.utc_now()) - %{id: data_migration_id} = data_migration() + data_migration_id = data_migration_id() max_processed_id = get_stat(:max_processed_id, 0) Logger.info("Transferring embedded hashtags to `hashtags` (from oid: #{max_processed_id})...") @@ -89,12 +95,19 @@ def handle_info(:migrate_hashtags, state) do |> Stream.each(fn objects -> object_ids = Enum.map(objects, & &1.id) + results = Enum.map(objects, &transfer_object_hashtags(&1)) + failed_ids = - objects - |> Enum.map(&transfer_object_hashtags(&1)) + results |> Enum.filter(&(elem(&1, 0) == :error)) |> Enum.map(&elem(&1, 1)) + # Count of objects with hashtags (`{:noop, id}` is returned for objects having other AS2 tags) + chunk_affected_count = + results + |> Enum.filter(&(elem(&1, 0) == :ok)) + |> length() + for failed_id <- failed_ids do _ = Repo.query( @@ -116,6 +129,7 @@ def handle_info(:migrate_hashtags, state) do put_stat(:max_processed_id, max_object_id) increment_stat(:processed_count, length(object_ids)) increment_stat(:failed_count, length(failed_ids)) + increment_stat(:affected_count, chunk_affected_count) put_stat(:records_per_second, records_per_second()) persist_state() @@ -125,17 +139,42 @@ def handle_info(:migrate_hashtags, state) do end) |> Stream.run() - with 0 <- failures_count(data_migration_id) do - _ = delete_non_create_activities_hashtags() - set_complete() - else - _ -> - update_status(:failed, "Please check data_migration_failed_ids records.") + fault_rate = fault_rate() + put_stat(:fault_rate, fault_rate) + fault_rate_allowance = Config.get([:populate_hashtags_table, :fault_rate_allowance], 0) + + cond do + fault_rate == 0 -> + set_complete() + + is_float(fault_rate) and fault_rate <= fault_rate_allowance -> + message = """ + Done with fault rate of #{fault_rate} which doesn't exceed #{fault_rate_allowance}. + Putting data migration to manual fix mode. Check `retry_failed/0`. + """ + + Logger.warn("#{__MODULE__}: #{message}") + update_status(:manual, message) + on_complete(data_migration()) + + true -> + message = "Too many failures. Check data_migration_failed_ids records / `retry_failed/0`." + Logger.error("#{__MODULE__}: #{message}") + update_status(:failed, message) end + persist_state() {:noreply, state} end + def fault_rate do + with failures_count when is_integer(failures_count) <- failures_count() do + failures_count / Enum.max([get_stat(:affected_count, 0), 1]) + else + _ -> :error + end + end + defp records_per_second do get_stat(:processed_count, 0) / Enum.max([running_time(), 1]) end @@ -194,6 +233,7 @@ defp query do |> where([_o, hashtags_objects], is_nil(hashtags_objects.object_id)) end + @spec transfer_object_hashtags(Map.t()) :: {:noop | :ok | :error, integer()} defp transfer_object_hashtags(object) do embedded_tags = if Map.has_key?(object, :tag), do: object.tag, else: object.data["tag"] hashtags = Object.object_data_hashtags(%{"tag" => embedded_tags}) @@ -201,7 +241,7 @@ defp transfer_object_hashtags(object) do if Enum.any?(hashtags) do transfer_object_hashtags(object, hashtags) else - {:ok, object.id} + {:noop, object.id} end end @@ -209,13 +249,11 @@ defp transfer_object_hashtags(object, hashtags) do Repo.transaction(fn -> with {:ok, hashtag_records} <- Hashtag.get_or_create_by_names(hashtags) do maps = Enum.map(hashtag_records, &%{hashtag_id: &1.id, object_id: object.id}) - expected_rows = length(hashtag_records) - - base_error = - "ERROR when inserting #{expected_rows} hashtags_objects for obj. #{object.id}" + base_error = "ERROR when inserting hashtags_objects for object with id #{object.id}" try do - with {^expected_rows, _} <- Repo.insert_all("hashtags_objects", maps) do + with {rows_count, _} when is_integer(rows_count) <- + Repo.insert_all("hashtags_objects", maps, on_conflict: :nothing) do object.id else e -> @@ -260,11 +298,11 @@ defp on_complete(data_migration) do data_migration.feature_lock -> :noop - not is_nil(Config.get([:database, :improved_hashtag_timeline])) -> + not is_nil(feature_state()) -> :noop true -> - Config.put([:database, :improved_hashtag_timeline], true) + Config.put(@feature_config_path, true) :ok end end @@ -274,38 +312,41 @@ def failed_objects_query do |> join(:inner, [o], dmf in fragment("SELECT * FROM data_migration_failed_ids"), on: dmf.record_id == o.id ) - |> where([_o, dmf], dmf.data_migration_id == ^data_migration().id) + |> where([_o, dmf], dmf.data_migration_id == ^data_migration_id()) |> order_by([o], asc: o.id) end - def failures_count(data_migration_id \\ nil) do - data_migration_id = data_migration_id || data_migration().id - + def failures_count do with {:ok, %{rows: [[count]]}} <- Repo.query( "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", - [data_migration_id] + [data_migration_id()] ) do count end end def retry_failed do - data_migration = data_migration() + data_migration_id = data_migration_id() failed_objects_query() |> Repo.chunk_stream(100, :one) |> Stream.each(fn object -> - with {:ok, _} <- transfer_object_hashtags(object) do + with {res, _} when res != :error <- transfer_object_hashtags(object) do _ = Repo.query( "DELETE FROM data_migration_failed_ids " <> "WHERE data_migration_id = $1 AND record_id = $2", - [data_migration.id, object.id] + [data_migration_id, object.id] ) end end) |> Stream.run() + + put_stat(:failed_count, failures_count()) + persist_state() + + force_continue() end def force_continue do diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex index ed9848824..ee0009b2e 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator/state.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator/state.ex @@ -7,7 +7,7 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator.State do alias Pleroma.DataMigration - defdelegate data_migration(), to: DataMigration, as: :populate_hashtags_table + defdelegate data_migration(), to: Pleroma.Migrators.HashtagsTableMigrator @reg_name {:global, __MODULE__} @@ -99,4 +99,6 @@ defp persist_non_data_change(:state, value) do defp persist_non_data_change(_, _) do nil end + + def data_migration_id, do: Map.get(state(), :data_migration_id) end -- cgit v1.2.3 From 998437d4a4111055e019f28dd84a8af1f9a27047 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 18 Feb 2021 21:03:06 +0300 Subject: [#3213] Experimental / debug feature: `database: [improved_hashtag_timeline: :preselect_hashtag_ids]`. --- lib/pleroma/web/activity_pub/activity_pub.ex | 47 +++++++++++++++++++++------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index e012f2779..5392ce7c9 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -787,19 +787,42 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_hashtag_any(query, %{tag: [_ | _] = tags}) do - from( - [_activity, object] in query, - where: - fragment( - """ - EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) - AND hashtags_objects.object_id = ? LIMIT 1) - """, - ^tags, - object.id + # TODO: refactor: debug / experimental feature + if Config.get([:database, :improved_hashtag_timeline]) == :preselect_hashtag_ids do + hashtag_ids = + from(ht in Pleroma.Hashtag, + where: fragment("name = ANY(?::citext[])", ^tags), + select: ht.id ) - ) + |> Repo.all() + + from( + [_activity, object] in query, + where: + fragment( + """ + EXISTS ( + SELECT 1 FROM hashtags_objects WHERE hashtag_id = ANY(?) AND object_id = ? LIMIT 1) + """, + ^hashtag_ids, + object.id + ) + ) + else + from( + [_activity, object] in query, + where: + fragment( + """ + EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) + AND hashtags_objects.object_id = ? LIMIT 1) + """, + ^tags, + object.id + ) + ) + end end defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do -- cgit v1.2.3 From d5ef02c7a7905dc2053298045873b365d2411cde Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 18 Feb 2021 16:35:03 -0600 Subject: Mastodon makes this field null when posting with MastoFE or if you choose to not disclose it, so it's safe to be null by default --- lib/pleroma/web/api_spec/schemas/status.ex | 5 +++-- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 2 +- lib/pleroma/web/mastodon_api/views/status_view.ex | 4 ++-- test/pleroma/web/mastodon_api/views/status_view_test.exs | 5 +---- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index 61ebd8089..42fa98718 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -23,9 +23,10 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do application: %Schema{ description: "The application used to post this status", type: :object, + nullable: true, properties: %{ name: %Schema{type: :string}, - website: %Schema{type: :string, nullable: true, format: :uri} + website: %Schema{type: :string, format: :uri} } }, bookmarked: %Schema{type: :boolean, description: "Have you bookmarked this status?"}, @@ -291,7 +292,7 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do "url" => "http://localhost:4001/users/nick6", "username" => "nick6" }, - "application" => %{"name" => "Web", "website" => nil}, + "application" => nil, "bookmarked" => false, "card" => nil, "content" => "foobar", diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index db3f248e5..2e63c8869 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -425,5 +425,5 @@ defp put_application(params, %{assigns: %{token: %Token{} = token}} = _conn) do Map.put(params, :application, %{name: client_name, website: website}) end - defp put_application(params, _), do: Map.put(params, :application, %{name: "Web", website: nil}) + defp put_application(params, _), do: Map.put(params, :application, nil) end diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 38960c256..a45650988 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -180,7 +180,7 @@ def render( media_attachments: reblogged[:media_attachments] || [], mentions: mentions, tags: reblogged[:tags] || [], - application: activity_object.data["application"] || %{name: "Web", website: nil}, + application: activity_object.data["application"] || nil, language: nil, emojis: [], pleroma: %{ @@ -345,7 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} poll: render(PollView, "show.json", object: object, for: opts[:for]), mentions: mentions, tags: build_tags(tags), - application: object.data["application"] || %{name: "Web", website: nil}, + application: object.data["application"] || nil, language: nil, emojis: build_emojis(object.data["emoji"]), pleroma: %{ 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 ed59cf285..2de3afc4f 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -266,10 +266,7 @@ test "a note activity" do url: "http://localhost:4001/tag/#{object_data["tag"]}" } ], - application: %{ - name: "Web", - website: nil - }, + application: nil, language: nil, emojis: [ %{ -- cgit v1.2.3 From 83301fe61aa3d453b7c12ee1f5465d9802d07370 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 18 Feb 2021 16:43:41 -0600 Subject: Add field to user schema for controlling disclosure of client details --- lib/pleroma/user.ex | 1 + .../20210218223811_add_disclose_client_to_users.exs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 51f5bc8ea..a52089d7b 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -147,6 +147,7 @@ defmodule Pleroma.User do field(:shared_inbox, :string) field(:accepts_chat_messages, :boolean, default: nil) field(:last_active_at, :naive_datetime) + field(:disclose_client, :boolean, default: true) embeds_one( :notification_settings, diff --git a/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs b/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs new file mode 100644 index 000000000..c6b6fe7b2 --- /dev/null +++ b/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs @@ -0,0 +1,15 @@ +defmodule Pleroma.Repo.Migrations.AddDiscloseClientToUsers do + use Ecto.Migration + + def up do + alter table(:users) do + add(:disclose_client, :boolean, default: true) + end + end + + def down do + alter table(:users) do + remove(:disclose_client) + end + end +end -- cgit v1.2.3 From 63739c5a58ccb65dd4a63019b270429d5a462e71 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 18 Feb 2021 17:23:17 -0600 Subject: Tests to validate client disclosure obeys user setting --- .../mastodon_api/controllers/status_controller.ex | 10 +++++++--- .../controllers/status_controller_test.exs | 22 ++++++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 2e63c8869..2655d6b6e 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -420,9 +420,13 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do ) end - defp put_application(params, %{assigns: %{token: %Token{} = token}} = _conn) do - %{client_name: client_name, website: website} = Repo.preload(token, :app).app - Map.put(params, :application, %{name: client_name, website: website}) + defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do + if user.disclose_client do + %{client_name: client_name, website: website} = Repo.preload(token, :app).app + Map.put(params, :application, %{name: client_name, website: website}) + else + Map.put(params, :application, nil) + end end defp put_application(params, _), do: Map.put(params, :application, nil) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 1ca829544..bae2ad4bf 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -358,8 +358,9 @@ test "posting a direct status", %{conn: conn} do assert activity.data["cc"] == [] end - test "preserves client application metadata" do - %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"]) + test "discloses application metadata when enabled" do + user = insert(:user, disclose_client: true) + %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"], user: user) %Pleroma.Web.OAuth.Token{ app: %Pleroma.Web.OAuth.App{ @@ -383,6 +384,23 @@ test "preserves client application metadata" do } } = json_response_and_validate_schema(result, 200) end + + test "hides application metadata when disabled" do + user = insert(:user, disclose_client: false) + %{user: _user, token: _token, conn: conn} = oauth_access(["write:statuses"], user: user) + + result = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses", %{ + "status" => "club mate is my wingman" + }) + + assert %{ + "content" => "club mate is my wingman", + "application" => nil + } = json_response_and_validate_schema(result, 200) + end end describe "posting scheduled statuses" do -- cgit v1.2.3 From 26b620d67652b3b7733354c4492465978f53fafb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 18 Feb 2021 17:50:46 -0600 Subject: Permit :disclose_client in changesets --- lib/pleroma/user.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index a52089d7b..9942617d8 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -514,7 +514,8 @@ def update_changeset(struct, params \\ %{}) do :pleroma_settings_store, :is_discoverable, :actor_type, - :accepts_chat_messages + :accepts_chat_messages, + :disclose_client ] ) |> unique_constraint(:nickname) -- cgit v1.2.3 From db7d6f337f971707424c103bbb919822d7218527 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 18:37:37 -0600 Subject: Avoid unnecessary 500ms sleeps from CommonAPI.follow when the target user is remote --- config/test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/test.exs b/config/test.exs index 690c98e40..87396a88d 100644 --- a/config/test.exs +++ b/config/test.exs @@ -38,7 +38,7 @@ external_user_synchronization: false, static_dir: "test/instance_static/" -config :pleroma, :activitypub, sign_object_fetches: false +config :pleroma, :activitypub, sign_object_fetches: false, follow_handshake_timeout: 0 # Configure your database config :pleroma, Pleroma.Repo, -- cgit v1.2.3 From 369581db6db5d2ce5396391d814d903002c7eff6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 20 Feb 2021 14:26:59 -0600 Subject: Show a proper error. A failure doesn't always mean the command isn't available, and we check for it on startup --- lib/pleroma/upload/filter/exiftool.ex | 4 ++-- lib/pleroma/upload/filter/mogrifun.ex | 4 ++-- lib/pleroma/upload/filter/mogrify.ex | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/upload/filter/exiftool.ex b/lib/pleroma/upload/filter/exiftool.ex index 2dbde540d..a03b32ae4 100644 --- a/lib/pleroma/upload/filter/exiftool.ex +++ b/lib/pleroma/upload/filter/exiftool.ex @@ -21,8 +21,8 @@ def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do {error, 1} -> {:error, error} end rescue - _e in ErlangError -> - {:error, "exiftool command not found"} + e in ErlangError -> + {:error, "#{__MODULE__}: #{inspect(e)}"} end end diff --git a/lib/pleroma/upload/filter/mogrifun.ex b/lib/pleroma/upload/filter/mogrifun.ex index 9abdd2d51..01126aaeb 100644 --- a/lib/pleroma/upload/filter/mogrifun.ex +++ b/lib/pleroma/upload/filter/mogrifun.ex @@ -44,8 +44,8 @@ def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do Filter.Mogrify.do_filter(file, [Enum.random(@filters)]) {:ok, :filtered} rescue - _e in ErlangError -> - {:error, "mogrify command not found"} + e in ErlangError -> + {:error, "#{__MODULE__}: #{inspect(e)}"} end end diff --git a/lib/pleroma/upload/filter/mogrify.ex b/lib/pleroma/upload/filter/mogrify.ex index 4bca4f5ca..f27aefc22 100644 --- a/lib/pleroma/upload/filter/mogrify.ex +++ b/lib/pleroma/upload/filter/mogrify.ex @@ -14,8 +14,8 @@ def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do do_filter(file, Pleroma.Config.get!([__MODULE__, :args])) {:ok, :filtered} rescue - _e in ErlangError -> - {:error, "mogrify command not found"} + e in ErlangError -> + {:error, "#{__MODULE__}: #{inspect(e)}"} end end -- cgit v1.2.3 From 73aef0503c80ddad7fcaf8b33b49d692a4737b1d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 20 Feb 2021 14:28:21 -0600 Subject: Exiftool also cannot strip from heic files. --- lib/pleroma/upload/filter/exiftool.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/upload/filter/exiftool.ex b/lib/pleroma/upload/filter/exiftool.ex index a03b32ae4..a2bfbbf61 100644 --- a/lib/pleroma/upload/filter/exiftool.ex +++ b/lib/pleroma/upload/filter/exiftool.ex @@ -11,7 +11,8 @@ defmodule Pleroma.Upload.Filter.Exiftool do @spec filter(Pleroma.Upload.t()) :: {:ok, any()} | {:error, String.t()} - # webp is not compatible with exiftool at this time + # Formats not compatible with exiftool at this time + def filter(%Pleroma.Upload{content_type: "image/heic"}), do: {:ok, :noop} def filter(%Pleroma.Upload{content_type: "image/webp"}), do: {:ok, :noop} def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do -- cgit v1.2.3 From 1cb417bce62087025db72296bff41a1dbb269009 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 20 Feb 2021 14:32:14 -0600 Subject: Document HeifToJpeg and its requirement of libheif's heic-convert tool --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74473b3d0..6199942c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) +- Added Pleroma.Upload.Filter.HeifToJpeg to automate converting .heic files from Apple devices to JPEGs which can be viewed in browsers. Requires heic-convert tool from libheif.
API Changes -- cgit v1.2.3 From e31274f51dd677a0e8cd381083c4d7d87059d5d5 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 20 Feb 2021 17:07:12 -0600 Subject: Revert changelog entry that leaked from another branch. --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6199942c1..74473b3d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,7 +59,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) -- Added Pleroma.Upload.Filter.HeifToJpeg to automate converting .heic files from Apple devices to JPEGs which can be viewed in browsers. Requires heic-convert tool from libheif.
API Changes -- cgit v1.2.3 From c1d63bbd9a4f39dbd92811b1720705342e5c914e Mon Sep 17 00:00:00 2001 From: eugenijm Date: Fri, 19 Feb 2021 00:59:06 +0300 Subject: Reroute /api/pleroma to /api/v1/pleroma --- CHANGELOG.md | 1 + .../fallback/legacy_pleroma_api_rerouter_plug.ex | 26 ++++++++++++++++++++++ lib/pleroma/web/router.ex | 9 ++++---- 3 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 lib/pleroma/web/fallback/legacy_pleroma_api_rerouter_plug.ex diff --git a/CHANGELOG.md b/CHANGELOG.md index 74473b3d0..9a972770f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking:** AdminAPI `GET /api/pleroma/admin/instances/:instance/statuses` changed response format and added the number of total users posts. - Admin API: Reports now ordered by newest - Pleroma API: `GET /api/v1/pleroma/chats` is deprecated in favor of `GET /api/v2/pleroma/chats`. +- Pleroma API: Reroute `/api/pleroma/*` to `/api/v1/pleroma/*`
diff --git a/lib/pleroma/web/fallback/legacy_pleroma_api_rerouter_plug.ex b/lib/pleroma/web/fallback/legacy_pleroma_api_rerouter_plug.ex new file mode 100644 index 000000000..f86d6b52b --- /dev/null +++ b/lib/pleroma/web/fallback/legacy_pleroma_api_rerouter_plug.ex @@ -0,0 +1,26 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.Fallback.LegacyPleromaApiRerouterPlug do + alias Pleroma.Web.Endpoint + alias Pleroma.Web.Fallback.RedirectController + + def init(opts), do: opts + + def call(%{path_info: ["api", "pleroma" | path_info_rest]} = conn, _opts) do + new_path_info = ["api", "v1", "pleroma" | path_info_rest] + new_request_path = Enum.join(new_path_info, "/") + + conn + |> Map.merge(%{ + path_info: new_path_info, + request_path: new_request_path + }) + |> Endpoint.call(conn.params) + end + + def call(conn, _opts) do + RedirectController.api_not_implemented(conn, %{}) + end +end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index d71011033..de24d31f4 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -140,7 +140,7 @@ defmodule Pleroma.Web.Router do plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug) end - scope "/api/pleroma", Pleroma.Web.TwitterAPI do + scope "/api/v1/pleroma", Pleroma.Web.TwitterAPI do pipe_through(:pleroma_api) get("/password_reset/:token", PasswordController, :reset, as: :reset_password) @@ -150,12 +150,12 @@ defmodule Pleroma.Web.Router do get("/healthcheck", UtilController, :healthcheck) end - scope "/api/pleroma", Pleroma.Web do + scope "/api/v1/pleroma", Pleroma.Web do pipe_through(:pleroma_api) post("/uploader_callback/:upload_path", UploaderController, :callback) end - scope "/api/pleroma/admin", Pleroma.Web.AdminAPI do + scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do pipe_through(:admin_api) put("/users/disable_mfa", AdminAPIController, :disable_mfa) @@ -259,7 +259,7 @@ defmodule Pleroma.Web.Router do post("/backups", AdminAPIController, :create_backup) end - scope "/api/pleroma/emoji", Pleroma.Web.PleromaAPI do + scope "/api/v1/pleroma/emoji", Pleroma.Web.PleromaAPI do scope "/pack" do pipe_through(:admin_api) @@ -809,6 +809,7 @@ defmodule Pleroma.Web.Router do scope "/", Pleroma.Web.Fallback do get("/registration/:token", RedirectController, :registration_page) get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta) + match(:*, "/api/pleroma*path", LegacyPleromaApiRerouterPlug, []) get("/api*path", RedirectController, :api_not_implemented) get("/*path", RedirectController, :redirector_with_preload) -- cgit v1.2.3 From 7fc9cd09740e31fe75ff3402f29614bb328240f7 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 21 Feb 2021 23:41:13 +0100 Subject: Video: Handle peertube videos only stashing attachments in x-mpegURL Closes: https://git.pleroma.social/pleroma/pleroma/-/issues/2535 --- .../object_validators/audio_video_validator.ex | 34 +- test/fixtures/peertube/actor-person.json | 121 ++++++ .../peertube/video-object-mpegURL-only.json | 413 +++++++++++++++++++++ .../transmogrifier/video_handling_test.exs | 30 ++ test/support/http_request_mock.ex | 9 + 5 files changed, 597 insertions(+), 10 deletions(-) create mode 100644 test/fixtures/peertube/actor-person.json create mode 100644 test/fixtures/peertube/video-object-mpegURL-only.json diff --git a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex index b3e738d8d..4a96fef52 100644 --- a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex @@ -70,19 +70,33 @@ def cast_data(data) do |> changeset(data) end - defp fix_url(%{"url" => url} = data) when is_list(url) do - attachment = - Enum.find(url, fn x -> - mime_type = x["mimeType"] || x["mediaType"] || "" - - is_map(x) and String.starts_with?(mime_type, ["video/", "audio/"]) + defp find_attachment(url) do + mpeg_url = + Enum.find(url, fn + %{"mediaType" => mime_type, "tag" => tags} when is_list(tags) -> + mime_type == "application/x-mpegURL" + + _ -> + false end) - link_element = - Enum.find(url, fn x -> - mime_type = x["mimeType"] || x["mediaType"] || "" + url + |> Enum.concat(mpeg_url["tag"] || []) + |> Enum.find(fn + %{"mediaType" => mime_type} -> String.starts_with?(mime_type, ["video/", "audio/"]) + %{"mimeType" => mime_type} -> String.starts_with?(mime_type, ["video/", "audio/"]) + _ -> false + end) + end - is_map(x) and mime_type == "text/html" + defp fix_url(%{"url" => url} = data) when is_list(url) do + attachment = find_attachment(url) + + link_element = + Enum.find(url, fn + %{"mediaType" => "text/html"} -> true + %{"mimeType" => "text/html"} -> true + _ -> false end) data diff --git a/test/fixtures/peertube/actor-person.json b/test/fixtures/peertube/actor-person.json new file mode 100644 index 000000000..8c387d455 --- /dev/null +++ b/test/fixtures/peertube/actor-person.json @@ -0,0 +1,121 @@ +{ + "type": "Person", + "id": "https://peertube.stream/accounts/createurs", + "following": "https://peertube.stream/accounts/createurs/following", + "followers": "https://peertube.stream/accounts/createurs/followers", + "playlists": "https://peertube.stream/accounts/createurs/playlists", + "inbox": "https://peertube.stream/accounts/createurs/inbox", + "outbox": "https://peertube.stream/accounts/createurs/outbox", + "preferredUsername": "createurs", + "url": "https://peertube.stream/accounts/createurs", + "name": "Créateurs", + "endpoints": { + "sharedInbox": "https://peertube.stream/inbox" + }, + "publicKey": { + "id": "https://peertube.stream/accounts/createurs#main-key", + "owner": "https://peertube.stream/accounts/createurs", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxqkQhbRYbA81+WTYjorR\n2lEMad3kYCnzDjGTLr4I92eanzFHxyELGnjzP6TpEvjOiB9NrCRrqU/iFPLdgrq2\nwIFcXPWdCq6Gcg7QLlaeMM0JoJmr0KTEhzg0XKCo96UsyTzaF4DISxqi8RyoyWeU\nEkgiOzlkdYTlouq3MlQH+p1PBAsNUQfIEUsU+l6k1vzbm8JRwlT+D1bNde4I/Lqs\n4uB5ru3zzInwZ2hz9+heiriNoGEBv74rZHYn966tZVX8iMGx2+m6okozEdEQbqCl\n0ekqDcd8P6CoFqqeeu8coh82OUtuFI/XsbetdWA55YQmSHyMiTsIwVbeoogIETbI\n4QIDAQAB\n-----END PUBLIC KEY-----" + }, + "icon": { + "type": "Image", + "mediaType": "image/png", + "url": "https://peertube.stream/lazy-static/avatars/c27b672d-ad8f-498a-adbe-553af8da56f9.png" + }, + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + { + "RsaSignature2017": "https://w3id.org/security#RsaSignature2017" + }, + { + "pt": "https://joinpeertube.org/ns#", + "sc": "http://schema.org#", + "Hashtag": "as:Hashtag", + "uuid": "sc:identifier", + "category": "sc:category", + "licence": "sc:license", + "subtitleLanguage": "sc:subtitleLanguage", + "sensitive": "as:sensitive", + "language": "sc:inLanguage", + "isLiveBroadcast": "sc:isLiveBroadcast", + "liveSaveReplay": { + "@type": "sc:Boolean", + "@id": "pt:liveSaveReplay" + }, + "permanentLive": { + "@type": "sc:Boolean", + "@id": "pt:permanentLive" + }, + "Infohash": "pt:Infohash", + "Playlist": "pt:Playlist", + "PlaylistElement": "pt:PlaylistElement", + "originallyPublishedAt": "sc:datePublished", + "views": { + "@type": "sc:Number", + "@id": "pt:views" + }, + "state": { + "@type": "sc:Number", + "@id": "pt:state" + }, + "size": { + "@type": "sc:Number", + "@id": "pt:size" + }, + "fps": { + "@type": "sc:Number", + "@id": "pt:fps" + }, + "startTimestamp": { + "@type": "sc:Number", + "@id": "pt:startTimestamp" + }, + "stopTimestamp": { + "@type": "sc:Number", + "@id": "pt:stopTimestamp" + }, + "position": { + "@type": "sc:Number", + "@id": "pt:position" + }, + "commentsEnabled": { + "@type": "sc:Boolean", + "@id": "pt:commentsEnabled" + }, + "downloadEnabled": { + "@type": "sc:Boolean", + "@id": "pt:downloadEnabled" + }, + "waitTranscoding": { + "@type": "sc:Boolean", + "@id": "pt:waitTranscoding" + }, + "support": { + "@type": "sc:Text", + "@id": "pt:support" + }, + "likes": { + "@id": "as:likes", + "@type": "@id" + }, + "dislikes": { + "@id": "as:dislikes", + "@type": "@id" + }, + "playlists": { + "@id": "pt:playlists", + "@type": "@id" + }, + "shares": { + "@id": "as:shares", + "@type": "@id" + }, + "comments": { + "@id": "as:comments", + "@type": "@id" + } + } + ], + "summary": null +} diff --git a/test/fixtures/peertube/video-object-mpegURL-only.json b/test/fixtures/peertube/video-object-mpegURL-only.json new file mode 100644 index 000000000..7f26e89bf --- /dev/null +++ b/test/fixtures/peertube/video-object-mpegURL-only.json @@ -0,0 +1,413 @@ +{ + "type": "Create", + "id": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6/activity", + "actor": "https://peertube.stream/accounts/createurs", + "object": { + "type": "Video", + "id": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6", + "name": "Vu du 20/02/21 : \"Planète Mars 2050\"", + "duration": "PT385S", + "uuid": "abece3c3-b9c6-47f4-8040-f3eed8c602e6", + "tag": [ + { + "type": "Hashtag", + "name": "France3" + }, + { + "type": "Hashtag", + "name": "lezapping" + } + ], + "category": { + "identifier": "11", + "name": "News & Politics" + }, + "language": { + "identifier": "fr", + "name": "French" + }, + "views": 5, + "sensitive": false, + "waitTranscoding": false, + "isLiveBroadcast": false, + "liveSaveReplay": null, + "permanentLive": null, + "state": 1, + "commentsEnabled": true, + "downloadEnabled": false, + "published": "2021-02-20T17:04:54.278Z", + "originallyPublishedAt": "2021-02-19T23:00:00.000Z", + "updated": "2021-02-21T20:01:11.189Z", + "mediaType": "text/markdown", + "content": "Un regard impertinent et libre, orchestré par Patrick Menais et son équipe, sur le monde de l’image.\r\n\r\nEn avant-première du lundi au samedi à 17h00 sur Facebook, Twitter et YouTube.\r\n\r\nDu lundi au samedi à 20h00 sur France 3.\r\n\r\nhttps://www.facebook.com/vufrancetv\r\nhttps://twitter.com/VuFrancetv", + "support": "Suivre VU :\r\n- Twitter : https://twitter.com/vufrancetv\r\n- Facebook :https://www.facebook.com/vufrancetv/\r\n- Site : https://www.france.tv/france-3/vu/", + "subtitleLanguage": [], + "icon": [ + { + "type": "Image", + "url": "https://peertube.stream/static/thumbnails/abece3c3-b9c6-47f4-8040-f3eed8c602e6.jpg", + "mediaType": "image/jpeg", + "width": 223, + "height": 122 + }, + { + "type": "Image", + "url": "https://peertube.stream/lazy-static/previews/abece3c3-b9c6-47f4-8040-f3eed8c602e6.jpg", + "mediaType": "image/jpeg", + "width": 850, + "height": 480 + } + ], + "url": [ + { + "type": "Link", + "mediaType": "text/html", + "href": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6" + }, + { + "type": "Link", + "mediaType": "application/x-mpegURL", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/master.m3u8", + "tag": [ + { + "type": "Infohash", + "name": "00bfce9595e1655d8696b60e19ca25c34be5fa63" + }, + { + "type": "Infohash", + "name": "256c21b65d5e0f944b4b79d8e0cbc55c9d906807" + }, + { + "type": "Infohash", + "name": "fcd981098c484d0e328927c8fb21ecf986880b7e" + }, + { + "type": "Infohash", + "name": "f7e01ac566e9fef91cd22514e6c3c256af7a9f5f" + }, + { + "type": "Infohash", + "name": "42b421fc44d0dceb45ac3f6f6419b07fd570a232" + }, + { + "type": "Infohash", + "name": "f876c6d6d49ce618a880ca223df54cb29f4b4bfd" + }, + { + "type": "Link", + "name": "sha256", + "mediaType": "application/json", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/segments-sha256.json" + }, + { + "type": "Link", + "mediaType": "video/mp4", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-1080-fragmented.mp4", + "height": 1080, + "size": 57888169, + "fps": 25 + }, + { + "type": "Link", + "rel": [ + "metadata", + "video/mp4" + ], + "mediaType": "application/json", + "href": "https://peertube.stream/api/v1/videos/abece3c3-b9c6-47f4-8040-f3eed8c602e6/metadata/570040", + "height": 1080, + "fps": 25 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent", + "href": "https://peertube.stream/static/torrents/abece3c3-b9c6-47f4-8040-f3eed8c602e6-1080-hls.torrent", + "height": 1080 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", + "href": "magnet:?xs=https%3A%2F%2Fpeertube.stream%2Fstatic%2Ftorrents%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-1080-hls.torrent&xt=urn:btih:68af82ebcd9df8335e407b755f38f5fd39c8a6a4&dn=Vu+du+20%2F02%2F21+%3A+%22Plan%C3%A8te+Mars+2050%22&tr=wss%3A%2F%2Fpeertube.stream%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube.stream%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube.stream%2Fstatic%2Fstreaming-playlists%2Fhls%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-1080-fragmented.mp4", + "height": 1080 + }, + { + "type": "Link", + "mediaType": "video/mp4", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-720-fragmented.mp4", + "height": 720, + "size": 45165123, + "fps": 25 + }, + { + "type": "Link", + "rel": [ + "metadata", + "video/mp4" + ], + "mediaType": "application/json", + "href": "https://peertube.stream/api/v1/videos/abece3c3-b9c6-47f4-8040-f3eed8c602e6/metadata/570056", + "height": 720, + "fps": 25 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent", + "href": "https://peertube.stream/static/torrents/abece3c3-b9c6-47f4-8040-f3eed8c602e6-720-hls.torrent", + "height": 720 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", + "href": "magnet:?xs=https%3A%2F%2Fpeertube.stream%2Fstatic%2Ftorrents%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-720-hls.torrent&xt=urn:btih:8450928a4ffb2a4c5f927a163487c48c05f6e700&dn=Vu+du+20%2F02%2F21+%3A+%22Plan%C3%A8te+Mars+2050%22&tr=wss%3A%2F%2Fpeertube.stream%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube.stream%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube.stream%2Fstatic%2Fstreaming-playlists%2Fhls%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-720-fragmented.mp4", + "height": 720 + }, + { + "type": "Link", + "mediaType": "video/mp4", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-480-fragmented.mp4", + "height": 480, + "size": 29618534, + "fps": 25 + }, + { + "type": "Link", + "rel": [ + "metadata", + "video/mp4" + ], + "mediaType": "application/json", + "href": "https://peertube.stream/api/v1/videos/abece3c3-b9c6-47f4-8040-f3eed8c602e6/metadata/570042", + "height": 480, + "fps": 25 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent", + "href": "https://peertube.stream/static/torrents/abece3c3-b9c6-47f4-8040-f3eed8c602e6-480-hls.torrent", + "height": 480 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", + "href": "magnet:?xs=https%3A%2F%2Fpeertube.stream%2Fstatic%2Ftorrents%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-480-hls.torrent&xt=urn:btih:39e11181db5f376aa78c94bffcb9ccf2f4bca715&dn=Vu+du+20%2F02%2F21+%3A+%22Plan%C3%A8te+Mars+2050%22&tr=wss%3A%2F%2Fpeertube.stream%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube.stream%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube.stream%2Fstatic%2Fstreaming-playlists%2Fhls%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-480-fragmented.mp4", + "height": 480 + }, + { + "type": "Link", + "mediaType": "video/mp4", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-360-fragmented.mp4", + "height": 360, + "size": 21771466, + "fps": 25 + }, + { + "type": "Link", + "rel": [ + "metadata", + "video/mp4" + ], + "mediaType": "application/json", + "href": "https://peertube.stream/api/v1/videos/abece3c3-b9c6-47f4-8040-f3eed8c602e6/metadata/570043", + "height": 360, + "fps": 25 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent", + "href": "https://peertube.stream/static/torrents/abece3c3-b9c6-47f4-8040-f3eed8c602e6-360-hls.torrent", + "height": 360 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", + "href": "magnet:?xs=https%3A%2F%2Fpeertube.stream%2Fstatic%2Ftorrents%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-360-hls.torrent&xt=urn:btih:c33aa52822528e29ffd1a615ebe40450e4c61452&dn=Vu+du+20%2F02%2F21+%3A+%22Plan%C3%A8te+Mars+2050%22&tr=wss%3A%2F%2Fpeertube.stream%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube.stream%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube.stream%2Fstatic%2Fstreaming-playlists%2Fhls%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-360-fragmented.mp4", + "height": 360 + }, + { + "type": "Link", + "mediaType": "video/mp4", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-240-fragmented.mp4", + "height": 240, + "size": 14856165, + "fps": 25 + }, + { + "type": "Link", + "rel": [ + "metadata", + "video/mp4" + ], + "mediaType": "application/json", + "href": "https://peertube.stream/api/v1/videos/abece3c3-b9c6-47f4-8040-f3eed8c602e6/metadata/570057", + "height": 240, + "fps": 25 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent", + "href": "https://peertube.stream/static/torrents/abece3c3-b9c6-47f4-8040-f3eed8c602e6-240-hls.torrent", + "height": 240 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", + "href": "magnet:?xs=https%3A%2F%2Fpeertube.stream%2Fstatic%2Ftorrents%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-240-hls.torrent&xt=urn:btih:157e4cc3e9f15c06e995d6c3388539fdda312771&dn=Vu+du+20%2F02%2F21+%3A+%22Plan%C3%A8te+Mars+2050%22&tr=wss%3A%2F%2Fpeertube.stream%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube.stream%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube.stream%2Fstatic%2Fstreaming-playlists%2Fhls%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-240-fragmented.mp4", + "height": 240 + }, + { + "type": "Link", + "mediaType": "video/mp4", + "href": "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-0-fragmented.mp4", + "height": 0, + "size": 6248765, + "fps": 0 + }, + { + "type": "Link", + "rel": [ + "metadata", + "video/mp4" + ], + "mediaType": "application/json", + "href": "https://peertube.stream/api/v1/videos/abece3c3-b9c6-47f4-8040-f3eed8c602e6/metadata/570041", + "height": 0, + "fps": 0 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent", + "href": "https://peertube.stream/static/torrents/abece3c3-b9c6-47f4-8040-f3eed8c602e6-0-hls.torrent", + "height": 0 + }, + { + "type": "Link", + "mediaType": "application/x-bittorrent;x-scheme-handler/magnet", + "href": "magnet:?xs=https%3A%2F%2Fpeertube.stream%2Fstatic%2Ftorrents%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-0-hls.torrent&xt=urn:btih:abc8dc58903d18cf7ec0c0cef92cc5ffe5cb0b5c&dn=Vu+du+20%2F02%2F21+%3A+%22Plan%C3%A8te+Mars+2050%22&tr=wss%3A%2F%2Fpeertube.stream%3A443%2Ftracker%2Fsocket&tr=https%3A%2F%2Fpeertube.stream%2Ftracker%2Fannounce&ws=https%3A%2F%2Fpeertube.stream%2Fstatic%2Fstreaming-playlists%2Fhls%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6%2Fabece3c3-b9c6-47f4-8040-f3eed8c602e6-0-fragmented.mp4", + "height": 0 + } + ] + } + ], + "likes": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6/likes", + "dislikes": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6/dislikes", + "shares": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6/announces", + "comments": "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6/comments", + "attributedTo": [ + { + "type": "Person", + "id": "https://peertube.stream/accounts/createurs" + }, + { + "type": "Group", + "id": "https://peertube.stream/video-channels/vu" + } + ], + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "cc": [ + "https://peertube.stream/accounts/createurs/followers" + ] + }, + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "cc": [ + "https://peertube.stream/accounts/createurs/followers" + ], + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + { + "RsaSignature2017": "https://w3id.org/security#RsaSignature2017" + }, + { + "pt": "https://joinpeertube.org/ns#", + "sc": "http://schema.org#", + "Hashtag": "as:Hashtag", + "uuid": "sc:identifier", + "category": "sc:category", + "licence": "sc:license", + "subtitleLanguage": "sc:subtitleLanguage", + "sensitive": "as:sensitive", + "language": "sc:inLanguage", + "isLiveBroadcast": "sc:isLiveBroadcast", + "liveSaveReplay": { + "@type": "sc:Boolean", + "@id": "pt:liveSaveReplay" + }, + "permanentLive": { + "@type": "sc:Boolean", + "@id": "pt:permanentLive" + }, + "Infohash": "pt:Infohash", + "Playlist": "pt:Playlist", + "PlaylistElement": "pt:PlaylistElement", + "originallyPublishedAt": "sc:datePublished", + "views": { + "@type": "sc:Number", + "@id": "pt:views" + }, + "state": { + "@type": "sc:Number", + "@id": "pt:state" + }, + "size": { + "@type": "sc:Number", + "@id": "pt:size" + }, + "fps": { + "@type": "sc:Number", + "@id": "pt:fps" + }, + "startTimestamp": { + "@type": "sc:Number", + "@id": "pt:startTimestamp" + }, + "stopTimestamp": { + "@type": "sc:Number", + "@id": "pt:stopTimestamp" + }, + "position": { + "@type": "sc:Number", + "@id": "pt:position" + }, + "commentsEnabled": { + "@type": "sc:Boolean", + "@id": "pt:commentsEnabled" + }, + "downloadEnabled": { + "@type": "sc:Boolean", + "@id": "pt:downloadEnabled" + }, + "waitTranscoding": { + "@type": "sc:Boolean", + "@id": "pt:waitTranscoding" + }, + "support": { + "@type": "sc:Text", + "@id": "pt:support" + }, + "likes": { + "@id": "as:likes", + "@type": "@id" + }, + "dislikes": { + "@id": "as:dislikes", + "@type": "@id" + }, + "playlists": { + "@id": "pt:playlists", + "@type": "@id" + }, + "shares": { + "@id": "as:shares", + "@type": "@id" + }, + "comments": { + "@id": "as:comments", + "@type": "@id" + } + } + ] +} diff --git a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs index c00df6a04..6ddf7c172 100644 --- a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs @@ -92,4 +92,34 @@ test "it remaps video URLs as attachments if necessary" do assert object.data["url"] == "https://framatube.org/videos/watch/6050732a-8a7a-43d4-a6cd-809525a1d206" end + + test "it works for peertube videos with only their mpegURL map" do + data = + File.read!("test/fixtures/peertube/video-object-mpegURL-only.json") + |> Jason.decode!() + + {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data) + + assert object = Object.normalize(activity, fetch: false) + + assert object.data["attachment"] == [ + %{ + "type" => "Link", + "mediaType" => "video/mp4", + "name" => nil, + "blurhash" => nil, + "url" => [ + %{ + "href" => + "https://peertube.stream/static/streaming-playlists/hls/abece3c3-b9c6-47f4-8040-f3eed8c602e6/abece3c3-b9c6-47f4-8040-f3eed8c602e6-1080-fragmented.mp4", + "mediaType" => "video/mp4", + "type" => "Link" + } + ] + } + ] + + assert object.data["url"] == + "https://peertube.stream/videos/watch/abece3c3-b9c6-47f4-8040-f3eed8c602e6" + end end diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 7da0a8380..1328d6225 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -275,6 +275,15 @@ def get("https://peertube.moe/accounts/7even", _, _, _) do }} end + def get("https://peertube.stream/accounts/createurs", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/peertube/actor-person.json"), + headers: activitypub_object_headers() + }} + end + def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3", _, _, _) do {:ok, %Tesla.Env{ -- cgit v1.2.3 From c140cc7bf30fe35fe5c250fb01ada56f287bbaf1 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Mon, 22 Feb 2021 04:26:56 +0300 Subject: Update the documentation to use make it use /api/v1/pleroma instead of /api/pleroma --- docs/configuration/cheatsheet.md | 8 +- docs/development/API/admin_api.md | 154 +++++++++++---------- .../API/differences_in_mastoapi_responses.md | 2 +- docs/development/API/pleroma_api.md | 58 ++++---- 4 files changed, 113 insertions(+), 109 deletions(-) diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index ad5768465..028c5e91d 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -49,7 +49,7 @@ To add configuration to your config file, you can copy it from the base config. * `attachment_links`: Set to true to enable automatically adding attachment link text to statuses. * `max_report_comment_size`: The maximum size of the report comment (Default: `1000`). * `safe_dm_mentions`: If set to true, only mentions at the beginning of a post will be used to address people in direct messages. This is to prevent accidental mentioning of people when talking about them (e.g. "@friend hey i really don't like @enemy"). Default: `false`. -* `healthcheck`: If set to true, system data will be shown on ``/api/pleroma/healthcheck``. +* `healthcheck`: If set to true, system data will be shown on ``/api/v1/pleroma/healthcheck``. * `remote_post_retention_days`: The default amount of days to retain remote posts when pruning the database. * `user_bio_length`: A user bio maximum length (default: `5000`). * `user_name_length`: A user name maximum length (default: `100`). @@ -225,7 +225,7 @@ config :pleroma, :mrf_user_allowlist, %{ This can be used to configure a keyword list that keeps the configuration data for any kind of frontend. By default, settings for `pleroma_fe` and `masto_fe` are configured. You can find the documentation for `pleroma_fe` configuration into [Pleroma-FE configuration and customization for instance administrators](/frontend/CONFIGURATION/#options). -Frontends can access these settings at `/api/pleroma/frontend_configurations` +Frontends can access these settings at `/api/v1/pleroma/frontend_configurations` To add your own configuration for PleromaFE, use it like this: @@ -848,13 +848,13 @@ config :pleroma, :admin_token, "somerandomtoken" You can then do ```shell -curl "http://localhost:4000/api/pleroma/admin/users/invites?admin_token=somerandomtoken" +curl "http://localhost:4000/api/v1/pleroma/admin/users/invites?admin_token=somerandomtoken" ``` or ```shell -curl -H "X-Admin-Token: somerandomtoken" "http://localhost:4000/api/pleroma/admin/users/invites" +curl -H "X-Admin-Token: somerandomtoken" "http://localhost:4000/api/v1/pleroma/admin/users/invites" ``` Warning: it's discouraged to use this feature because of the associated security risk: static / rarely changed instance-wide token is much weaker compared to email-password pair of a real admin user; consider using HTTP Basic Auth or OAuth-based authentication instead. diff --git a/docs/development/API/admin_api.md b/docs/development/API/admin_api.md index f6519830b..8f855d251 100644 --- a/docs/development/API/admin_api.md +++ b/docs/development/API/admin_api.md @@ -2,7 +2,9 @@ Authentication is required and the user must be an admin. -## `GET /api/pleroma/admin/users` +The `/api/v1/pleroma/admin/*` path is backwards compatible with `/api/pleroma/admin/*` (`/api/pleroma/admin/*` will be deprecated in the future). + +## `GET /api/v1/pleroma/admin/users` ### List users @@ -23,7 +25,7 @@ Authentication is required and the user must be an admin. - *optional* `actor_types`: **[string]** actor type list (`Person`, `Service`, `Application`) - *optional* `name`: **string** user display name - *optional* `email`: **string** user email -- Example: `https://mypleroma.org/api/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com` +- Example: `https://mypleroma.org/api/v1/pleroma/admin/users?query=john&filters=local,active&page=1&page_size=10&tags[]=some_tag&tags[]=another_tag&name=display_name&email=email@example.com` - Response: ```json @@ -52,7 +54,7 @@ Authentication is required and the user must be an admin. } ``` -## DEPRECATED `DELETE /api/pleroma/admin/users` +## DEPRECATED `DELETE /api/v1/pleroma/admin/users` ### Remove a user @@ -60,7 +62,7 @@ Authentication is required and the user must be an admin. - `nickname` - Response: User’s nickname -## `DELETE /api/pleroma/admin/users` +## `DELETE /api/v1/pleroma/admin/users` ### Remove a user @@ -81,7 +83,7 @@ Authentication is required and the user must be an admin. ] - Response: User’s nickname -## `POST /api/pleroma/admin/users/follow` +## `POST /api/v1/pleroma/admin/users/follow` ### Make a user follow another user @@ -91,7 +93,7 @@ Authentication is required and the user must be an admin. - Response: - "ok" -## `POST /api/pleroma/admin/users/unfollow` +## `POST /api/v1/pleroma/admin/users/unfollow` ### Make a user unfollow another user @@ -101,7 +103,7 @@ Authentication is required and the user must be an admin. - Response: - "ok" -## `PATCH /api/pleroma/admin/users/:nickname/toggle_activation` +## `PATCH /api/v1/pleroma/admin/users/:nickname/toggle_activation` ### Toggle user activation @@ -117,7 +119,7 @@ Authentication is required and the user must be an admin. } ``` -## `PUT /api/pleroma/admin/users/tag` +## `PUT /api/v1/pleroma/admin/users/tag` ### Tag a list of users @@ -125,7 +127,7 @@ Authentication is required and the user must be an admin. - `nicknames` (array) - `tags` (array) -## `DELETE /api/pleroma/admin/users/tag` +## `DELETE /api/v1/pleroma/admin/users/tag` ### Untag a list of users @@ -133,7 +135,7 @@ Authentication is required and the user must be an admin. - `nicknames` (array) - `tags` (array) -## `GET /api/pleroma/admin/users/:nickname/permission_group` +## `GET /api/v1/pleroma/admin/users/:nickname/permission_group` ### Get user user permission groups membership @@ -147,7 +149,7 @@ Authentication is required and the user must be an admin. } ``` -## `GET /api/pleroma/admin/users/:nickname/permission_group/:permission_group` +## `GET /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group` Note: Available `:permission_group` is currently moderator and admin. 404 is returned when the permission group doesn’t exist. @@ -163,7 +165,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret } ``` -## DEPRECATED `POST /api/pleroma/admin/users/:nickname/permission_group/:permission_group` +## DEPRECATED `POST /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group` ### Add user to permission group @@ -172,7 +174,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - On failure: `{"error": "…"}` - On success: JSON of the user -## `POST /api/pleroma/admin/users/permission_group/:permission_group` +## `POST /api/v1/pleroma/admin/users/permission_group/:permission_group` ### Add users to permission group @@ -182,9 +184,9 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - On failure: `{"error": "…"}` - On success: JSON of the user -## DEPRECATED `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group` +## DEPRECATED `DELETE /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group` -## `DELETE /api/pleroma/admin/users/:nickname/permission_group/:permission_group` +## `DELETE /api/v1/pleroma/admin/users/:nickname/permission_group/:permission_group` ### Remove user from permission group @@ -194,7 +196,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - On success: JSON of the user - Note: An admin cannot revoke their own admin status. -## `DELETE /api/pleroma/admin/users/permission_group/:permission_group` +## `DELETE /api/v1/pleroma/admin/users/permission_group/:permission_group` ### Remove users from permission group @@ -205,7 +207,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - On success: JSON of the user - Note: An admin cannot revoke their own admin status. -## `PATCH /api/pleroma/admin/users/activate` +## `PATCH /api/v1/pleroma/admin/users/activate` ### Activate user @@ -223,7 +225,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret } ``` -## `PATCH /api/pleroma/admin/users/deactivate` +## `PATCH /api/v1/pleroma/admin/users/deactivate` ### Deactivate user @@ -241,7 +243,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret } ``` -## `PATCH /api/pleroma/admin/users/approve` +## `PATCH /api/v1/pleroma/admin/users/approve` ### Approve user @@ -259,7 +261,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret } ``` -## `GET /api/pleroma/admin/users/:nickname_or_id` +## `GET /api/v1/pleroma/admin/users/:nickname_or_id` ### Retrive the details of a user @@ -269,7 +271,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - On failure: `Not found` - On success: JSON of the user -## `GET /api/pleroma/admin/users/:nickname_or_id/statuses` +## `GET /api/v1/pleroma/admin/users/:nickname_or_id/statuses` ### Retrive user's latest statuses @@ -293,7 +295,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret } ``` -## `GET /api/pleroma/admin/instances/:instance/statuses` +## `GET /api/v1/pleroma/admin/instances/:instance/statuses` ### Retrive instance's latest statuses @@ -317,7 +319,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret } ``` -## `GET /api/pleroma/admin/statuses` +## `GET /api/v1/pleroma/admin/statuses` ### Retrives all latest statuses @@ -330,7 +332,7 @@ Note: Available `:permission_group` is currently moderator and admin. 404 is ret - On failure: `Not found` - On success: JSON array of user's latest statuses -## `GET /api/pleroma/admin/relay` +## `GET /api/v1/pleroma/admin/relay` ### List Relays @@ -346,7 +348,7 @@ Response: ] ``` -## `POST /api/pleroma/admin/relay` +## `POST /api/v1/pleroma/admin/relay` ### Follow a Relay @@ -362,7 +364,7 @@ Response: {"actor": "https://example.com/relay", "followed_back": true} ``` -## `DELETE /api/pleroma/admin/relay` +## `DELETE /api/v1/pleroma/admin/relay` ### Unfollow a Relay @@ -378,7 +380,7 @@ Response: {"https://example.com/relay"} ``` -## `POST /api/pleroma/admin/users/invite_token` +## `POST /api/v1/pleroma/admin/users/invite_token` ### Create an account registration invite token @@ -399,7 +401,7 @@ Response: } ``` -## `GET /api/pleroma/admin/users/invites` +## `GET /api/v1/pleroma/admin/users/invites` ### Get a list of generated invites @@ -424,7 +426,7 @@ Response: } ``` -## `POST /api/pleroma/admin/users/revoke_invite` +## `POST /api/v1/pleroma/admin/users/revoke_invite` ### Revoke invite by token @@ -445,7 +447,7 @@ Response: } ``` -## `POST /api/pleroma/admin/users/email_invite` +## `POST /api/v1/pleroma/admin/users/email_invite` ### Sends registration invite via email @@ -466,7 +468,7 @@ Response: ] ``` -## `GET /api/pleroma/admin/users/:nickname/password_reset` +## `GET /api/v1/pleroma/admin/users/:nickname/password_reset` ### Get a password reset token for a given nickname @@ -477,11 +479,11 @@ Response: ```json { "token": "base64 reset token", - "link": "https://pleroma.social/api/pleroma/password_reset/url-encoded-base64-token" + "link": "https://pleroma.social/api/v1/pleroma/password_reset/url-encoded-base64-token" } ``` -## `PATCH /api/pleroma/admin/users/force_password_reset` +## `PATCH /api/v1/pleroma/admin/users/force_password_reset` ### Force passord reset for a user with a given nickname @@ -489,7 +491,7 @@ Response: - `nicknames` - Response: none (code `204`) -## PUT `/api/pleroma/admin/users/disable_mfa` +## PUT `/api/v1/pleroma/admin/users/disable_mfa` ### Disable mfa for user's account. @@ -497,7 +499,7 @@ Response: - `nickname` - Response: User’s nickname -## `GET /api/pleroma/admin/users/:nickname/credentials` +## `GET /api/v1/pleroma/admin/users/:nickname/credentials` ### Get the user's email, password, display and settings-related fields @@ -545,7 +547,7 @@ Response: } ``` -## `PATCH /api/pleroma/admin/users/:nickname/credentials` +## `PATCH /api/v1/pleroma/admin/users/:nickname/credentials` ### Change the user's email, password, display and settings-related fields @@ -596,7 +598,7 @@ Status: 404 {"error": "Not found"} ``` -## `GET /api/pleroma/admin/reports` +## `GET /api/v1/pleroma/admin/reports` ### Get a list of reports @@ -756,17 +758,17 @@ Status: 404 } ``` -## `GET /api/pleroma/admin/grouped_reports` +## `GET /api/v1/pleroma/admin/grouped_reports` ### Get a list of reports, grouped by status - Params: none - On success: JSON, returns a list of reports, where: - `date`: date of the latest report - - `account`: the user who has been reported (see `/api/pleroma/admin/reports` for reference) - - `status`: reported status (see `/api/pleroma/admin/reports` for reference) - - `actors`: users who had reported this status (see `/api/pleroma/admin/reports` for reference) - - `reports`: reports (see `/api/pleroma/admin/reports` for reference) + - `account`: the user who has been reported (see `/api/v1/pleroma/admin/reports` for reference) + - `status`: reported status (see `/api/v1/pleroma/admin/reports` for reference) + - `actors`: users who had reported this status (see `/api/v1/pleroma/admin/reports` for reference) + - `reports`: reports (see `/api/v1/pleroma/admin/reports` for reference) ```json "reports": [ @@ -780,7 +782,7 @@ Status: 404 ] ``` -## `GET /api/pleroma/admin/reports/:id` +## `GET /api/v1/pleroma/admin/reports/:id` ### Get an individual report @@ -792,7 +794,7 @@ Status: 404 - 404 Not Found `"Not found"` - On success: JSON, Report object (see above) -## `PATCH /api/pleroma/admin/reports` +## `PATCH /api/v1/pleroma/admin/reports` ### Change the state of one or multiple reports @@ -823,7 +825,7 @@ Status: 404 - On success: `204`, empty response -## `POST /api/pleroma/admin/reports/:id/notes` +## `POST /api/v1/pleroma/admin/reports/:id/notes` ### Create report note @@ -835,7 +837,7 @@ Status: 404 - 400 Bad Request `"Invalid parameters"` when `status` is missing - On success: `204`, empty response -## `DELETE /api/pleroma/admin/reports/:report_id/notes/:id` +## `DELETE /api/v1/pleroma/admin/reports/:report_id/notes/:id` ### Delete report note @@ -847,7 +849,7 @@ Status: 404 - 400 Bad Request `"Invalid parameters"` when `status` is missing - On success: `204`, empty response -## `GET /api/pleroma/admin/statuses/:id` +## `GET /api/v1/pleroma/admin/statuses/:id` ### Show status by id @@ -858,7 +860,7 @@ Status: 404 - 404 Not Found `"Not Found"` - On success: JSON, Mastodon Status entity -## `PUT /api/pleroma/admin/statuses/:id` +## `PUT /api/v1/pleroma/admin/statuses/:id` ### Change the scope of an individual reported status @@ -873,7 +875,7 @@ Status: 404 - 404 Not Found `"Not found"` - On success: JSON, Mastodon Status entity -## `DELETE /api/pleroma/admin/statuses/:id` +## `DELETE /api/v1/pleroma/admin/statuses/:id` ### Delete an individual reported status @@ -885,7 +887,7 @@ Status: 404 - 404 Not Found `"Not found"` - On success: 200 OK `{}` -## `GET /api/pleroma/admin/restart` +## `GET /api/v1/pleroma/admin/restart` ### Restarts pleroma application @@ -900,7 +902,7 @@ Status: 404 {} ``` -## `GET /api/pleroma/admin/need_reboot` +## `GET /api/v1/pleroma/admin/need_reboot` ### Returns the flag whether the pleroma should be restarted @@ -913,7 +915,7 @@ Status: 404 } ``` -## `GET /api/pleroma/admin/config` +## `GET /api/v1/pleroma/admin/config` ### Get list of merged default settings with saved in database. @@ -940,7 +942,7 @@ Status: 404 } ``` -## `POST /api/pleroma/admin/config` +## `POST /api/v1/pleroma/admin/config` ### Update config settings @@ -1089,7 +1091,7 @@ config :quack, } ``` -## ` GET /api/pleroma/admin/config/descriptions` +## ` GET /api/v1/pleroma/admin/config/descriptions` ### Get JSON with config descriptions. Loads json generated from `config/descriptions.exs`. @@ -1122,7 +1124,7 @@ Loads json generated from `config/descriptions.exs`. }] ``` -## `GET /api/pleroma/admin/moderation_log` +## `GET /api/v1/pleroma/admin/moderation_log` ### Get moderation log @@ -1152,7 +1154,7 @@ Loads json generated from `config/descriptions.exs`. ] ``` -## `POST /api/pleroma/admin/reload_emoji` +## `POST /api/v1/pleroma/admin/reload_emoji` ### Reload the instance's custom emoji @@ -1160,7 +1162,7 @@ Loads json generated from `config/descriptions.exs`. - Params: None - Response: JSON, "ok" and 200 status -## `PATCH /api/pleroma/admin/users/confirm_email` +## `PATCH /api/v1/pleroma/admin/users/confirm_email` ### Confirm users' emails @@ -1168,7 +1170,7 @@ Loads json generated from `config/descriptions.exs`. - `nicknames` - Response: Array of user nicknames -## `PATCH /api/pleroma/admin/users/resend_confirmation_email` +## `PATCH /api/v1/pleroma/admin/users/resend_confirmation_email` ### Resend confirmation email @@ -1176,13 +1178,13 @@ Loads json generated from `config/descriptions.exs`. - `nicknames` - Response: Array of user nicknames -## `GET /api/pleroma/admin/stats` +## `GET /api/v1/pleroma/admin/stats` ### Stats - Query Params: - *optional* `instance`: **string** instance hostname (without protocol) to get stats for -- Example: `https://mypleroma.org/api/pleroma/admin/stats?instance=lain.com` +- Example: `https://mypleroma.org/api/v1/pleroma/admin/stats?instance=lain.com` - Response: @@ -1197,7 +1199,7 @@ Loads json generated from `config/descriptions.exs`. } ``` -## `GET /api/pleroma/admin/oauth_app` +## `GET /api/v1/pleroma/admin/oauth_app` ### List OAuth app @@ -1229,7 +1231,7 @@ Loads json generated from `config/descriptions.exs`. ``` -## `POST /api/pleroma/admin/oauth_app` +## `POST /api/v1/pleroma/admin/oauth_app` ### Create OAuth App @@ -1262,7 +1264,7 @@ Loads json generated from `config/descriptions.exs`. } ``` -## `PATCH /api/pleroma/admin/oauth_app/:id` +## `PATCH /api/v1/pleroma/admin/oauth_app/:id` ### Update OAuth App @@ -1287,7 +1289,7 @@ Loads json generated from `config/descriptions.exs`. } ``` -## `DELETE /api/pleroma/admin/oauth_app/:id` +## `DELETE /api/v1/pleroma/admin/oauth_app/:id` ### Delete OAuth App @@ -1298,7 +1300,7 @@ Loads json generated from `config/descriptions.exs`. - On failure: - 400 Bad Request `"Invalid parameters"` when `status` is missing -## `GET /api/pleroma/admin/media_proxy_caches` +## `GET /api/v1/pleroma/admin/media_proxy_caches` ### Get a list of all banned MediaProxy URLs in Cachex @@ -1322,7 +1324,7 @@ Loads json generated from `config/descriptions.exs`. ``` -## `POST /api/pleroma/admin/media_proxy_caches/delete` +## `POST /api/v1/pleroma/admin/media_proxy_caches/delete` ### Remove a banned MediaProxy URL from Cachex @@ -1337,7 +1339,7 @@ Loads json generated from `config/descriptions.exs`. ``` -## `POST /api/pleroma/admin/media_proxy_caches/purge` +## `POST /api/v1/pleroma/admin/media_proxy_caches/purge` ### Purge a MediaProxy URL @@ -1353,7 +1355,7 @@ Loads json generated from `config/descriptions.exs`. ``` -## GET /api/pleroma/admin/users/:nickname/chats +## GET /api/v1/pleroma/admin/users/:nickname/chats ### List a user's chats @@ -1382,7 +1384,7 @@ Loads json generated from `config/descriptions.exs`. ] ``` -## GET /api/pleroma/admin/chats/:chat_id +## GET /api/v1/pleroma/admin/chats/:chat_id ### View a single chat @@ -1409,7 +1411,7 @@ Loads json generated from `config/descriptions.exs`. } ``` -## GET /api/pleroma/admin/chats/:chat_id/messages +## GET /api/v1/pleroma/admin/chats/:chat_id/messages ### List the messages in a chat @@ -1447,7 +1449,7 @@ Loads json generated from `config/descriptions.exs`. ] ``` -## DELETE /api/pleroma/admin/chats/:chat_id/messages/:message_id +## DELETE /api/v1/pleroma/admin/chats/:chat_id/messages/:message_id ### Delete a single message @@ -1474,7 +1476,7 @@ Loads json generated from `config/descriptions.exs`. } ``` -## `GET /api/pleroma/admin/instance_document/:document_name` +## `GET /api/v1/pleroma/admin/instance_document/:document_name` ### Get an instance document @@ -1488,7 +1490,7 @@ Returns the content of the document

Instance panel

``` -## `PATCH /api/pleroma/admin/instance_document/:document_name` +## `PATCH /api/v1/pleroma/admin/instance_document/:document_name` - Params: - `file` (the file to be uploaded, using multipart form data.) @@ -1504,7 +1506,7 @@ Returns the content of the document } ``` -## `DELETE /api/pleroma/admin/instance_document/:document_name` +## `DELETE /api/v1/pleroma/admin/instance_document/:document_name` ### Delete an instance document @@ -1516,7 +1518,7 @@ Returns the content of the document } ``` -## `GET /api/pleroma/admin/frontends +## `GET /api/v1/pleroma/admin/frontends ### List available frontends @@ -1541,7 +1543,7 @@ Returns the content of the document ] ``` -## `POST /api/pleroma/admin/frontends/install` +## `POST /api/v1/pleroma/admin/frontends/install` ### Install a frontend diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index 38d70fa78..493cb4c16 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -97,7 +97,7 @@ Has these additional fields under the `pleroma` object: - `allow_following_move`: boolean, true when the user allows automatically follow moved following accounts - `unread_conversation_count`: The count of unread conversations. Only returned to the account owner. - `unread_notifications_count`: The count of unread notifications. Only returned to the account owner. -- `notification_settings`: object, can be absent. See `/api/pleroma/notification_settings` for the parameters/keys returned. +- `notification_settings`: object, can be absent. See `/api/v1/pleroma/notification_settings` for the parameters/keys returned. - `accepts_chat_messages`: boolean, but can be null if we don't have that information about a user - `favicon`: nullable URL string, Favicon image of the user's instance diff --git a/docs/development/API/pleroma_api.md b/docs/development/API/pleroma_api.md index d8790ca32..d896f0ce7 100644 --- a/docs/development/API/pleroma_api.md +++ b/docs/development/API/pleroma_api.md @@ -4,7 +4,9 @@ Requests that require it can be authenticated with [an OAuth token](https://tool Request parameters can be passed via [query strings](https://en.wikipedia.org/wiki/Query_string) or as [form data](https://www.w3.org/TR/html401/interact/forms.html). Files must be uploaded as `multipart/form-data`. -## `/api/pleroma/emoji` +The `/api/v1/pleroma/*` path is backwards compatible with `/api/pleroma/*` (`/api/pleroma/*` will be deprecated in the future). + +## `/api/v1/pleroma/emoji` ### Lists the custom emoji on that server. * Method: `GET` * Authentication: not required @@ -35,7 +37,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi ``` * Note: Same data as Mastodon API’s `/api/v1/custom_emojis` but in a different format -## `/api/pleroma/follow_import` +## `/api/v1/pleroma/follow_import` ### Imports your follows, for example from a Mastodon CSV file. * Method: `POST` * Authentication: required @@ -44,7 +46,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * Response: HTTP 200 on success, 500 on error * Note: Users that can't be followed are silently skipped. -## `/api/pleroma/blocks_import` +## `/api/v1/pleroma/blocks_import` ### Imports your blocks. * Method: `POST` * Authentication: required @@ -52,7 +54,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * `list`: STRING or FILE containing a whitespace-separated list of accounts to block * Response: HTTP 200 on success, 500 on error -## `/api/pleroma/mutes_import` +## `/api/v1/pleroma/mutes_import` ### Imports your mutes. * Method: `POST` * Authentication: required @@ -60,7 +62,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * `list`: STRING or FILE containing a whitespace-separated list of accounts to mute * Response: HTTP 200 on success, 500 on error -## `/api/pleroma/captcha` +## `/api/v1/pleroma/captcha` ### Get a new captcha * Method: `GET` * Authentication: not required @@ -68,7 +70,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * Response: Provider specific JSON, the only guaranteed parameter is `type` * Example response: `{"type": "kocaptcha", "token": "whatever", "url": "https://captcha.kotobank.ch/endpoint", "seconds_valid": 300}` -## `/api/pleroma/delete_account` +## `/api/v1/pleroma/delete_account` ### Delete an account * Method `POST` * Authentication: required @@ -77,7 +79,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * Response: JSON. Returns `{"status": "success"}` if the deletion was successful, `{"error": "[error message]"}` otherwise * Example response: `{"error": "Invalid password."}` -## `/api/pleroma/disable_account` +## `/api/v1/pleroma/disable_account` ### Disable an account * Method `POST` * Authentication: required @@ -86,21 +88,21 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * Response: JSON. Returns `{"status": "success"}` if the account was successfully disabled, `{"error": "[error message]"}` otherwise * Example response: `{"error": "Invalid password."}` -## `/api/pleroma/accounts/mfa` +## `/api/v1/pleroma/accounts/mfa` #### Gets current MFA settings * method: `GET` * Authentication: required * OAuth scope: `read:security` * Response: JSON. Returns `{"enabled": "false", "totp": false }` -## `/api/pleroma/accounts/mfa/setup/totp` +## `/api/v1/pleroma/accounts/mfa/setup/totp` #### Pre-setup the MFA/TOTP method * method: `GET` * Authentication: required * OAuth scope: `write:security` * Response: JSON. Returns `{"key": [secret_key], "provisioning_uri": "[qr code uri]" }` when successful, otherwise returns HTTP 422 `{"error": "error_msg"}` -## `/api/pleroma/accounts/mfa/confirm/totp` +## `/api/v1/pleroma/accounts/mfa/confirm/totp` #### Confirms & enables MFA/TOTP support for user account. * method: `POST` * Authentication: required @@ -111,7 +113,7 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * Response: JSON. Returns `{}` if the enable was successful, HTTP 422 `{"error": "[error message]"}` otherwise -## `/api/pleroma/accounts/mfa/totp` +## `/api/v1/pleroma/accounts/mfa/totp` #### Disables MFA/TOTP method for user account. * method: `DELETE` * Authentication: required @@ -121,14 +123,14 @@ Request parameters can be passed via [query strings](https://en.wikipedia.org/wi * Response: JSON. Returns `{}` if the disable was successful, HTTP 422 `{"error": "[error message]"}` otherwise * Example response: `{"error": "Invalid password."}` -## `/api/pleroma/accounts/mfa/backup_codes` +## `/api/v1/pleroma/accounts/mfa/backup_codes` #### Generstes backup codes MFA for user account. * method: `GET` * Authentication: required * OAuth scope: `write:security` * Response: JSON. Returns `{"codes": codes}`when successful, otherwise HTTP 422 `{"error": "[error message]"}` -## `/api/pleroma/admin/` +## `/api/v1/pleroma/admin/` See [Admin-API](admin_api.md) ## `/api/v1/pleroma/notifications/read` @@ -298,7 +300,7 @@ See [Admin-API](admin_api.md) * Note: Behaves exactly the same as `POST /api/v1/upload`. Can only accept images - any attempt to upload non-image files will be met with `HTTP 415 Unsupported Media Type`. -## `/api/pleroma/notification_settings` +## `/api/v1/pleroma/notification_settings` ### Updates user notification settings * Method `PUT` * Authentication: required @@ -307,7 +309,7 @@ See [Admin-API](admin_api.md) * `hide_notification_contents`: BOOLEAN field. When set to true, it removes the contents of a message from the push notification. * Response: JSON. Returns `{"status": "success"}` if the update was successful, otherwise returns `{"error": "error_msg"}` -## `/api/pleroma/healthcheck` +## `/api/v1/pleroma/healthcheck` ### Healthcheck endpoint with additional system data. * Method `GET` * Authentication: not required @@ -325,7 +327,7 @@ See [Admin-API](admin_api.md) } ``` -## `/api/pleroma/change_email` +## `/api/v1/pleroma/change_email` ### Change account email * Method `POST` * Authentication: required @@ -378,7 +380,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * Params: None * Response: JSON, returns a list of Mastodon Conversation entities that were marked as read (200 - healthy, 503 unhealthy). -## `GET /api/pleroma/emoji/pack?name=:name` +## `GET /api/v1/pleroma/emoji/pack?name=:name` ### Get pack.json for the pack @@ -397,7 +399,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa } ``` -## `POST /api/pleroma/emoji/pack?name=:name` +## `POST /api/v1/pleroma/emoji/pack?name=:name` ### Creates an empty pack @@ -407,7 +409,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * `name`: pack name * Response: JSON, "ok" and 200 status or 409 if the pack with that name already exists -## `PATCH /api/pleroma/emoji/pack?name=:name` +## `PATCH /api/v1/pleroma/emoji/pack?name=:name` ### Updates (replaces) pack metadata @@ -425,7 +427,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * Response: JSON, updated "metadata" section of the pack and 200 status or 400 if there was a problem with the new metadata (the error is specified in the "error" part of the response JSON) -## `DELETE /api/pleroma/emoji/pack?name=:name` +## `DELETE /api/v1/pleroma/emoji/pack?name=:name` ### Delete a custom emoji pack @@ -435,7 +437,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * `name`: pack name * Response: JSON, "ok" and 200 status or 500 if there was an error deleting the pack -## `GET /api/pleroma/emoji/packs/import` +## `GET /api/v1/pleroma/emoji/packs/import` ### Imports packs from filesystem @@ -444,7 +446,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * Params: None * Response: JSON, returns a list of imported packs. -## `GET /api/pleroma/emoji/packs/remote` +## `GET /api/v1/pleroma/emoji/packs/remote` ### Make request to another instance for packs list @@ -456,7 +458,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * `page_size`: page size for packs (default 50) * Response: JSON with the pack list, hashmap with pack name and pack contents -## `POST /api/pleroma/emoji/packs/download` +## `POST /api/v1/pleroma/emoji/packs/download` ### Download pack from another instance @@ -469,7 +471,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * Response: JSON, "ok" with 200 status if the pack was downloaded, or 500 if there were errors downloading the pack -## `POST /api/pleroma/emoji/packs/files?name=:name` +## `POST /api/v1/pleroma/emoji/packs/files?name=:name` ### Add new file to the pack @@ -482,7 +484,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * `filename`: (*optional*) new emoji file name. If not specified will be taken from original filename. * Response: JSON, list of files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. -## `PATCH /api/pleroma/emoji/packs/files?name=:name` +## `PATCH /api/v1/pleroma/emoji/packs/files?name=:name` ### Update emoji file from pack @@ -496,7 +498,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * `force`: (*optional*) with true value to overwrite existing emoji with new shortcode * Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. -## `DELETE /api/pleroma/emoji/packs/files?name=:name` +## `DELETE /api/v1/pleroma/emoji/packs/files?name=:name` ### Delete emoji file from pack @@ -507,7 +509,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa * `shortcode`: emoji file shortcode * Response: JSON, list with updated files for updated pack (hashmap -> shortcode => filename) with status 200, either error status with error message. -## `GET /api/pleroma/emoji/packs` +## `GET /api/v1/pleroma/emoji/packs` ### Lists local custom emoji packs @@ -528,7 +530,7 @@ The status posting endpoint takes an additional parameter, `in_reply_to_conversa } ``` -## `GET /api/pleroma/emoji/packs/archive?name=:name` +## `GET /api/v1/pleroma/emoji/packs/archive?name=:name` ### Requests a local pack archive from the instance -- cgit v1.2.3 From 0ef783baa1d82c57a47569e494e1d5010cd3dd91 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 22 Feb 2021 23:09:41 +0300 Subject: [#2534] Earlier init of Pleroma.Web.Endpoint (must be started prior to Pleroma.Web.Streamer). --- lib/pleroma/application.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 375507de1..c853a2bb4 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -97,13 +97,13 @@ def start(_type, _args) do Pleroma.Stats, Pleroma.JobQueueMonitor, {Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]}, - {Oban, Config.get(Oban)} + {Oban, Config.get(Oban)}, + Pleroma.Web.Endpoint ] ++ task_children(@mix_env) ++ dont_run_in_test(@mix_env) ++ chat_child(chat_enabled?()) ++ [ - Pleroma.Web.Endpoint, Pleroma.Gopher.Server ] -- cgit v1.2.3 From 6531eddf361fa52db3906ab011a4e33c7a5f9552 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 22 Feb 2021 23:26:07 +0300 Subject: [#3213] `hashtags`: altered `name` type to `text`. `hashtags_objects`: removed unused index. HashtagsTableMigrator: records_per_second calculation fix. ActivityPub: hashtags-related options normalization. --- lib/pleroma/hashtag.ex | 22 ++++--- lib/pleroma/migrators/hashtags_table_migrator.ex | 4 +- lib/pleroma/web/activity_pub/activity_pub.ex | 75 +++++++++------------- .../20201221203824_create_hashtags_objects.exs | 2 +- ...840_remove_hashtags_objects_duplicate_index.exs | 11 ++++ ...20210222184616_change_hashtags_name_to_text.exs | 15 +++++ 6 files changed, 76 insertions(+), 53 deletions(-) create mode 100644 priv/repo/migrations/20210222183840_remove_hashtags_objects_duplicate_index.exs create mode 100644 priv/repo/migrations/20210222184616_change_hashtags_name_to_text.exs diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex index a6d033816..e9d143fb1 100644 --- a/lib/pleroma/hashtag.ex +++ b/lib/pleroma/hashtag.ex @@ -21,10 +21,14 @@ defmodule Pleroma.Hashtag do timestamps() end + def normalize_name(name) do + name + |> String.downcase() + |> String.trim() + end + def get_by_name(name) do - from(h in Hashtag) - |> where([h], fragment("name = ?::citext", ^String.downcase(name))) - |> Repo.one() + Repo.get_by(Hashtag, name: normalize_name(name)) end def get_or_create_by_name(name) when is_bitstring(name) do @@ -39,7 +43,7 @@ def get_or_create_by_name(name) when is_bitstring(name) do end def get_or_create_by_names(names) when is_list(names) do - names = Enum.map(names, &String.downcase/1) + names = Enum.map(names, &normalize_name/1) timestamp = NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second) structs = @@ -53,10 +57,12 @@ def get_or_create_by_names(names) when is_list(names) do try do with {:ok, %{query_op: hashtags}} <- Multi.new() - |> Multi.insert_all(:insert_all_op, Hashtag, structs, on_conflict: :nothing) + |> Multi.insert_all(:insert_all_op, Hashtag, structs, + on_conflict: :nothing, + conflict_target: :name + ) |> Multi.run(:query_op, fn _repo, _changes -> - {:ok, - Repo.all(from(ht in Hashtag, where: ht.name in fragment("?::citext[]", ^names)))} + {:ok, Repo.all(from(ht in Hashtag, where: ht.name in ^names))} end) |> Repo.transaction() do {:ok, hashtags} @@ -71,7 +77,7 @@ def get_or_create_by_names(names) when is_list(names) do def changeset(%Hashtag{} = struct, params) do struct |> cast(params, [:name]) - |> update_change(:name, &String.downcase/1) + |> update_change(:name, &normalize_name/1) |> validate_required([:name]) |> unique_constraint(:name) end diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 45dab8470..07bb9aeb2 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -82,6 +82,7 @@ def handle_info(:migrate_hashtags, state) do State.reinit() update_status(:running) + put_stat(:iteration_processed_count, 0) put_stat(:started_at, NaiveDateTime.utc_now()) data_migration_id = data_migration_id() @@ -127,6 +128,7 @@ def handle_info(:migrate_hashtags, state) do max_object_id = Enum.at(object_ids, -1) put_stat(:max_processed_id, max_object_id) + increment_stat(:iteration_processed_count, length(object_ids)) increment_stat(:processed_count, length(object_ids)) increment_stat(:failed_count, length(failed_ids)) increment_stat(:affected_count, chunk_affected_count) @@ -176,7 +178,7 @@ def fault_rate do end defp records_per_second do - get_stat(:processed_count, 0) / Enum.max([running_time(), 1]) + get_stat(:iteration_processed_count, 0) / Enum.max([running_time(), 1]) end defp running_time do diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 5392ce7c9..8182bc205 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do alias Pleroma.Conversation alias Pleroma.Conversation.Participation alias Pleroma.Filter + alias Pleroma.Hashtag alias Pleroma.Maps alias Pleroma.Notification alias Pleroma.Object @@ -698,8 +699,6 @@ defp restrict_embedded_tag_all(_query, %{tag_all: _tag_all, skip_preload: true}) end defp restrict_embedded_tag_all(query, %{tag_all: [_ | _] = tag_all}) do - tag_all = Enum.map(tag_all, &String.downcase/1) - from( [_activity, object] in query, where: fragment("(?)->'tag' \\?& (?)", object.data, ^tag_all) @@ -717,8 +716,6 @@ defp restrict_embedded_tag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_embedded_tag_any(query, %{tag: [_ | _] = tag_any}) do - tag_any = Enum.map(tag_any, &String.downcase/1) - from( [_activity, object] in query, where: fragment("(?)->'tag' \\?| (?)", object.data, ^tag_any) @@ -736,8 +733,6 @@ defp restrict_embedded_tag_reject_any(_query, %{tag_reject: _tag_reject, skip_pr end defp restrict_embedded_tag_reject_any(query, %{tag_reject: [_ | _] = tag_reject}) do - tag_reject = Enum.map(tag_reject, &String.downcase/1) - from( [_activity, object] in query, where: fragment("not (?)->'tag' \\?| (?)", object.data, ^tag_reject) @@ -766,7 +761,7 @@ defp restrict_hashtag_all(query, %{tag_all: [_ | _] = tags}) do fragment( """ (SELECT array_agg(hashtags.name) FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) AND hashtags_objects.object_id = ?) @> ? """, ^tags, @@ -787,42 +782,19 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_hashtag_any(query, %{tag: [_ | _] = tags}) do - # TODO: refactor: debug / experimental feature - if Config.get([:database, :improved_hashtag_timeline]) == :preselect_hashtag_ids do - hashtag_ids = - from(ht in Pleroma.Hashtag, - where: fragment("name = ANY(?::citext[])", ^tags), - select: ht.id + from( + [_activity, object] in query, + where: + fragment( + """ + EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) + AND hashtags_objects.object_id = ? LIMIT 1) + """, + ^tags, + object.id ) - |> Repo.all() - - from( - [_activity, object] in query, - where: - fragment( - """ - EXISTS ( - SELECT 1 FROM hashtags_objects WHERE hashtag_id = ANY(?) AND object_id = ? LIMIT 1) - """, - ^hashtag_ids, - object.id - ) - ) - else - from( - [_activity, object] in query, - where: - fragment( - """ - EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) - AND hashtags_objects.object_id = ? LIMIT 1) - """, - ^tags, - object.id - ) - ) - end + ) end defp restrict_hashtag_any(query, %{tag: tag}) when is_binary(tag) do @@ -842,7 +814,7 @@ defp restrict_hashtag_reject_any(query, %{tag_reject: [_ | _] = tags_reject}) do fragment( """ NOT EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?::citext[]) + ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) AND hashtags_objects.object_id = ? LIMIT 1) """, ^tags_reject, @@ -1220,6 +1192,21 @@ defp maybe_order(query, %{order: :asc}) do defp maybe_order(query, _), do: query + defp normalize_fetch_activities_query_opts(opts) do + Enum.reduce([:tag, :tag_all, :tag_reject], opts, fn key, opts -> + case opts[key] do + value when is_bitstring(value) -> + Map.put(opts, key, Hashtag.normalize_name(value)) + + value when is_list(value) -> + Map.put(opts, key, Enum.map(value, &Hashtag.normalize_name/1)) + + _ -> + opts + end + end) + end + defp fetch_activities_query_ap_ids_ops(opts) do source_user = opts[:muting_user] ap_id_relationships = if source_user, do: [:mute, :reblog_mute], else: [] @@ -1243,6 +1230,8 @@ defp fetch_activities_query_ap_ids_ops(opts) do end def fetch_activities_query(recipients, opts \\ %{}) do + opts = normalize_fetch_activities_query_opts(opts) + {restrict_blocked_opts, restrict_muted_opts, restrict_muted_reblogs_opts} = fetch_activities_query_ap_ids_ops(opts) diff --git a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs index efd60369d..581f32b3c 100644 --- a/priv/repo/migrations/20201221203824_create_hashtags_objects.exs +++ b/priv/repo/migrations/20201221203824_create_hashtags_objects.exs @@ -7,7 +7,7 @@ def change do add(:object_id, references(:objects), null: false, primary_key: true) end - create_if_not_exists(unique_index(:hashtags_objects, [:hashtag_id, :object_id])) + # Note: PK index: "hashtags_objects_pkey" PRIMARY KEY, btree (hashtag_id, object_id) create_if_not_exists(index(:hashtags_objects, [:object_id])) end end diff --git a/priv/repo/migrations/20210222183840_remove_hashtags_objects_duplicate_index.exs b/priv/repo/migrations/20210222183840_remove_hashtags_objects_duplicate_index.exs new file mode 100644 index 000000000..6c4a2dfdc --- /dev/null +++ b/priv/repo/migrations/20210222183840_remove_hashtags_objects_duplicate_index.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.RemoveHashtagsObjectsDuplicateIndex do + use Ecto.Migration + + @moduledoc "Removes `hashtags_objects_hashtag_id_object_id_index` index (duplicate of PK index)." + + def up do + drop_if_exists(unique_index(:hashtags_objects, [:hashtag_id, :object_id])) + end + + def down, do: nil +end diff --git a/priv/repo/migrations/20210222184616_change_hashtags_name_to_text.exs b/priv/repo/migrations/20210222184616_change_hashtags_name_to_text.exs new file mode 100644 index 000000000..8940b6ca3 --- /dev/null +++ b/priv/repo/migrations/20210222184616_change_hashtags_name_to_text.exs @@ -0,0 +1,15 @@ +defmodule Pleroma.Repo.Migrations.ChangeHashtagsNameToText do + use Ecto.Migration + + def up do + alter table(:hashtags) do + modify(:name, :text) + end + end + + def down do + alter table(:hashtags) do + modify(:name, :citext) + end + end +end -- cgit v1.2.3 From a98c4423f374c6be8202ae884989e708e7d8ca3b Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Mon, 22 Feb 2021 20:41:57 +0000 Subject: Apply i1t's suggestion(s) to 1 file(s) --- config/description.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/description.exs b/config/description.exs index 6ffc71278..e280ed8cf 100644 --- a/config/description.exs +++ b/config/description.exs @@ -483,7 +483,7 @@ key: :fault_rate_allowance, type: :float, description: - "Max rate of failed objects to actually processed objects in order to enable the feature (any value from 0.0 which tolerates no errors to 1.0 which will enable the feature even if hashtags transfer failed for all records).", + "Max accepted rate of objects that failed in the migration. Any value from 0.0 which tolerates no errors to 1.0 which will enable the feature even if hashtags transfer failed for all records.", suggestions: [0.01] }, %{ -- cgit v1.2.3 From 77f3da035894e2add911101466bfe41b99ee481e Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 23 Feb 2021 13:52:28 +0300 Subject: [#3213] Misc. tweaks: proper upsert in Hashtag, better feature toggle management. --- config/config.exs | 2 ++ config/description.exs | 9 +++++---- docs/configuration/cheatsheet.md | 2 +- lib/pleroma/config.ex | 4 ++++ lib/pleroma/hashtag.ex | 22 +++++++++------------- lib/pleroma/migrators/hashtags_table_migrator.ex | 18 +++++++----------- lib/pleroma/web/activity_pub/activity_pub.ex | 2 +- .../pleroma/web/activity_pub/activity_pub_test.exs | 4 ++-- 8 files changed, 31 insertions(+), 32 deletions(-) diff --git a/config/config.exs b/config/config.exs index c371c397c..05acbf169 100644 --- a/config/config.exs +++ b/config/config.exs @@ -657,6 +657,8 @@ config :pleroma, :database, rum_enabled: false +config :pleroma, :features, improved_hashtag_timeline: :auto + config :pleroma, :populate_hashtags_table, fault_rate_allowance: 0.01 config :pleroma, :env, Mix.env() diff --git a/config/description.exs b/config/description.exs index e280ed8cf..41e5e4056 100644 --- a/config/description.exs +++ b/config/description.exs @@ -461,15 +461,16 @@ }, %{ group: :pleroma, - key: :database, + key: :features, type: :group, - description: "Database-related settings", + description: "Customizable features", children: [ %{ key: :improved_hashtag_timeline, - type: :keyword, + type: {:dropdown, :atom}, description: - "If `true`, hashtags will be fetched from `hashtags` table for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when HashtagsTableMigrator completes." + "Setting to force toggle / force disable improved hashtags timeline. `:enabled` forces hashtags to be fetched from `hashtags` table for hashtags timeline. `:disabled` forces object-embedded hashtags to be used (slower). Keep it `:auto` for automatic behaviour (it is auto-set to `:enabled` [unless overridden] when HashtagsTableMigrator completes).", + suggestions: [:auto, :enabled, :disabled] } ] }, diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 6a1031f15..db1deb665 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -66,7 +66,7 @@ To add configuration to your config file, you can copy it from the base config. * `password_reset_token_validity`: The time after which reset tokens aren't accepted anymore, in seconds (default: one day). ## :database -* `improved_hashtag_timeline`: If `true`, hashtags will be fetched from `hashtags` table for hashtags timeline. When `false`, object-embedded hashtags will be used (slower). Is auto-set to `true` (unless overridden) when `HashtagsTableMigrator` completes. +* `improved_hashtag_timeline`: Setting to force toggle / force disable improved hashtags timeline. `:enabled` forces hashtags to be fetched from `hashtags` table for hashtags timeline. `:disabled` forces object-embedded hashtags to be used (slower). Keep it `:auto` for automatic behaviour (it is auto-set to `:enabled` [unless overridden] when HashtagsTableMigrator completes). ## Background migrations * `populate_hashtags_table/sleep_interval_ms`: Sleep interval between each chunk of processed records in order to decrease the load on the system (defaults to 0 and should be keep default on most instances). diff --git a/lib/pleroma/config.ex b/lib/pleroma/config.ex index f17e14128..e057d8c02 100644 --- a/lib/pleroma/config.ex +++ b/lib/pleroma/config.ex @@ -111,4 +111,8 @@ def oauth_admin_scopes(scopes) when is_list(scopes) do end ) end + + def feature_enabled?(feature_name) do + get([:features, feature_name]) not in [nil, false, :disabled, :auto] + end end diff --git a/lib/pleroma/hashtag.ex b/lib/pleroma/hashtag.ex index e9d143fb1..53e2e9c89 100644 --- a/lib/pleroma/hashtag.ex +++ b/lib/pleroma/hashtag.ex @@ -27,19 +27,15 @@ def normalize_name(name) do |> String.trim() end - def get_by_name(name) do - Repo.get_by(Hashtag, name: normalize_name(name)) - end - - def get_or_create_by_name(name) when is_bitstring(name) do - with %Hashtag{} = hashtag <- get_by_name(name) do - {:ok, hashtag} - else - _ -> - %Hashtag{} - |> changeset(%{name: name}) - |> Repo.insert() - end + def get_or_create_by_name(name) do + changeset = changeset(%Hashtag{}, %{name: name}) + + Repo.insert( + changeset, + on_conflict: [set: [name: get_field(changeset, :name)]], + conflict_target: :name, + returning: true + ) end def get_or_create_by_names(names) when is_list(names) do diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 07bb9aeb2..6123c88e0 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -24,7 +24,7 @@ defmodule Pleroma.Migrators.HashtagsTableMigrator do defdelegate put_stat(key, value), to: State, as: :put_data_key defdelegate increment_stat(key, increment), to: State, as: :increment_data_key - @feature_config_path [:database, :improved_hashtag_timeline] + @feature_config_path [:features, :improved_hashtag_timeline] @reg_name {:global, __MODULE__} def whereis, do: GenServer.whereis(@reg_name) @@ -296,16 +296,12 @@ def count(force \\ false, timeout \\ :infinity) do end defp on_complete(data_migration) do - cond do - data_migration.feature_lock -> - :noop - - not is_nil(feature_state()) -> - :noop - - true -> - Config.put(@feature_config_path, true) - :ok + if data_migration.feature_lock || feature_state() == :disabled do + Logger.warn("#{__MODULE__}: migration complete but feature is locked; consider enabling.") + :noop + else + Config.put(@feature_config_path, :enabled) + :ok end end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 8182bc205..9d557c2cd 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1273,7 +1273,7 @@ def fetch_activities_query(recipients, opts \\ %{}) do |> exclude_invisible_actors(opts) |> exclude_visibility(opts) - if Config.get([:database, :improved_hashtag_timeline]) do + if Config.feature_enabled?(:improved_hashtag_timeline) do query |> restrict_hashtag_any(opts) |> restrict_hashtag_all(opts) diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index c41c8a5dd..f92323abe 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -220,8 +220,8 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_four} = CommonAPI.post(user, %{status: ". #Any1 #any2"}) {:ok, status_five} = CommonAPI.post(user, %{status: ". #Any2 #any1"}) - for hashtag_timeline_strategy <- [true, false] do - clear_config([:database, :improved_hashtag_timeline], hashtag_timeline_strategy) + for hashtag_timeline_strategy <- [:eanbled, :disabled] do + clear_config([:features, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) -- cgit v1.2.3 From 6ff4ef12fd66720eec13a706547784b55433628b Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Tue, 23 Feb 2021 21:31:06 +0900 Subject: Fix URL of Whalebird in docs --- docs/clients.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/clients.md b/docs/clients.md index 3d81763e1..5650ea236 100644 --- a/docs/clients.md +++ b/docs/clients.md @@ -17,7 +17,7 @@ Feel free to contact us to be added to this list! - Features: MastoAPI ### Whalebird -- Homepage: +- Homepage: - Source Code: - Contact: [@h3poteto@pleroma.io](https://pleroma.io/users/h3poteto) - Platforms: Windows, Mac, Linux -- cgit v1.2.3 From 40d4362261abaf0856a1b4397a4bff6344137120 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Tue, 23 Feb 2021 18:11:25 +0300 Subject: [#3213] `mix pleroma.database rollback` tweaks. --- lib/mix/tasks/pleroma/database.ex | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex index 2136ddb02..e7f4b67a4 100644 --- a/lib/mix/tasks/pleroma/database.ex +++ b/lib/mix/tasks/pleroma/database.ex @@ -231,19 +231,18 @@ def run(["rollback", version]) do re = ~r/^#{version}_.*\.exs/ path = Ecto.Migrator.migrations_path(repo) - with {:find, "" <> file} <- {:find, Enum.find(File.ls!(path), &String.match?(&1, re))}, - {:compile, [{mod, _} | _]} <- {:compile, Code.compile_file(Path.join(path, file))}, - {:rollback, :ok} <- {:rollback, Ecto.Migrator.down(repo, version, mod)} do + with {_, "" <> file} <- {:find, Enum.find(File.ls!(path), &String.match?(&1, re))}, + {_, [{mod, _} | _]} <- {:compile, Code.compile_file(Path.join(path, file))}, + {_, :ok} <- {:rollback, Ecto.Migrator.down(repo, version, mod)} do {:ok, "Reversed migration: #{file}"} else {:find, _} -> {:error, "No migration found with version prefix: #{version}"} {:compile, e} -> {:error, "Problem compiling migration module: #{inspect(e)}"} {:rollback, e} -> {:error, "Problem reversing migration: #{inspect(e)}"} - e -> {:error, "Something unexpected happened: #{inspect(e)}"} end end) - IO.inspect(result) + shell_info(inspect(result)) end end end -- cgit v1.2.3 From f38056d2a129d5c3842b95e7249dea15949b90c4 Mon Sep 17 00:00:00 2001 From: zonk <6957-zonk@users.noreply.git.pleroma.social> Date: Wed, 24 Feb 2021 14:23:56 +0000 Subject: Update terminology in differences_in_mastoapi_responses.md --- docs/development/API/differences_in_mastoapi_responses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index 38d70fa78..c8905ea11 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -92,7 +92,7 @@ Has these additional fields under the `pleroma` object: - `hide_followers_count`: boolean, true when the user has follower stat hiding enabled - `hide_follows_count`: boolean, true when the user has follow stat hiding enabled - `settings_store`: A generic map of settings for frontends. Opaque to the backend. Only returned in `/api/v1/accounts/verify_credentials` and `/api/v1/accounts/update_credentials` -- `chat_token`: The token needed for Pleroma chat. Only returned in `/api/v1/accounts/verify_credentials` +- `chat_token`: The token needed for Pleroma shoutbox. Only returned in `/api/v1/accounts/verify_credentials` - `deactivated`: boolean, true when the user is deactivated - `allow_following_move`: boolean, true when the user allows automatically follow moved following accounts - `unread_conversation_count`: The count of unread conversations. Only returned to the account owner. -- cgit v1.2.3 From 978627c5e1775dfd61efe5986efb104a4e87887f Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 12:11:50 -0600 Subject: Vi and emacs temp files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 4dea75e93..f30f4cf5f 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,7 @@ pleroma.iml # asdf .tool-versions + +# Editor temp files +/*~ +/*# \ No newline at end of file -- cgit v1.2.3 From cea31df6a6e0e38ec6a260de0b6ae00d4d40c538 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 15:23:45 -0600 Subject: Attempt to filter out API calls from FrontendStatic plug --- lib/pleroma/web.ex | 14 +++++++++++++- lib/pleroma/web/plugs/frontend_static.ex | 11 ++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index c3aa39492..fe2652ac9 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -63,7 +63,8 @@ defp skip_plug(conn, plug_modules) do # Executed just before actual controller action, invokes before-action hooks (callbacks) defp action(conn, params) do - with %{halted: false} = conn <- maybe_drop_authentication_if_oauth_check_ignored(conn), + with %{halted: false} = conn <- + maybe_drop_authentication_if_oauth_check_ignored(conn), %{halted: false} = conn <- maybe_perform_public_or_authenticated_check(conn), %{halted: false} = conn <- maybe_perform_authenticated_check(conn), %{halted: false} = conn <- maybe_halt_on_missing_oauth_scopes_check(conn) do @@ -232,4 +233,15 @@ defmacro __using__(which) when is_atom(which) do def base_url do Pleroma.Web.Endpoint.url() end + + def get_api_routes do + Pleroma.Web.Router.__routes__() + |> Stream.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) + |> Enum.map(fn r -> + r.path + |> String.split("/", trim: true) + |> List.first() + end) + |> Enum.uniq() + end end diff --git a/lib/pleroma/web/plugs/frontend_static.ex b/lib/pleroma/web/plugs/frontend_static.ex index eecf16264..03fd51043 100644 --- a/lib/pleroma/web/plugs/frontend_static.ex +++ b/lib/pleroma/web/plugs/frontend_static.ex @@ -10,6 +10,8 @@ defmodule Pleroma.Web.Plugs.FrontendStatic do """ @behaviour Plug + @api_routes Pleroma.Web.get_api_routes() + def file_path(path, frontend_type \\ :primary) do if configuration = Pleroma.Config.get([:frontends, frontend_type]) do instance_static_path = Pleroma.Config.get([:instance, :static_dir], "instance/static") @@ -34,7 +36,8 @@ def init(opts) do end def call(conn, opts) do - with false <- invalid_path?(conn.path_info), + with false <- api_route?(conn.path_info), + false <- invalid_path?(conn.path_info), frontend_type <- Map.get(opts, :frontend_type, :primary), path when not is_nil(path) <- file_path("", frontend_type) do call_static(conn, opts, path) @@ -52,6 +55,12 @@ defp invalid_path?([h | _], _match) when h in [".", "..", ""], do: true defp invalid_path?([h | t], match), do: String.contains?(h, match) or invalid_path?(t) defp invalid_path?([], _match), do: false + defp api_route?(list) when is_list(list) and length(list) > 0 do + List.first(list) in @api_routes + end + + defp api_route?(_), do: false + defp call_static(conn, opts, from) do opts = Map.put(opts, :from, from) Plug.Static.call(conn, opts) -- cgit v1.2.3 From 8ad16137173cc57e6947caf1860c3073c0cfdf04 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 25 Feb 2021 09:06:56 -0600 Subject: Enum instead of Stream --- lib/pleroma/web.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index fe2652ac9..a638bb198 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -236,7 +236,7 @@ def base_url do def get_api_routes do Pleroma.Web.Router.__routes__() - |> Stream.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) + |> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) |> Enum.map(fn r -> r.path |> String.split("/", trim: true) -- cgit v1.2.3 From 6b87dfad5de161cf2bef43d02ff89debcee84dd3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 25 Feb 2021 09:23:10 -0600 Subject: Filter out MIX_ENV from route list and add a test --- lib/pleroma/web.ex | 8 ++++++- .../web/plugs/frontend_static_plug_test.exs | 28 ++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index a638bb198..0a4c98e47 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -28,6 +28,8 @@ defmodule Pleroma.Web do alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper + @mix_env Mix.env() + def controller do quote do use Phoenix.Controller, namespace: Pleroma.Web @@ -236,7 +238,11 @@ def base_url do def get_api_routes do Pleroma.Web.Router.__routes__() - |> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) + |> Enum.reject(fn + r -> + r.plug == Pleroma.Web.Fallback.RedirectController or + String.starts_with?(r.path, "/#{@mix_env}") + end) |> Enum.map(fn r -> r.path |> String.split("/", trim: true) diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs index c8cfc967c..9d59d3f8e 100644 --- a/test/pleroma/web/plugs/frontend_static_plug_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -74,4 +74,32 @@ test "exclude invalid path", %{conn: conn} do assert %Plug.Conn{status: :success} = get(conn, url) end end + + test "api routes are detected correctly" do + expected_routes = [ + "api", + "main", + "ostatus_subscribe", + "oauth", + "objects", + "activities", + "notice", + "users", + "tags", + "mailer", + "inbox", + "relay", + "internal", + ".well-known", + "nodeinfo", + "web", + "auth", + "embed", + "proxy", + "user_exists", + "check_password" + ] + + assert expected_routes == Pleroma.Web.get_api_routes() + end end -- cgit v1.2.3 From 155217979287999c69d9506f6fdb9697833e8fa0 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 25 Feb 2021 10:07:29 -0600 Subject: Improved recursion through the api route list --- lib/pleroma/web/plugs/frontend_static.ex | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/plugs/frontend_static.ex b/lib/pleroma/web/plugs/frontend_static.ex index 03fd51043..eb385e94d 100644 --- a/lib/pleroma/web/plugs/frontend_static.ex +++ b/lib/pleroma/web/plugs/frontend_static.ex @@ -55,11 +55,9 @@ defp invalid_path?([h | _], _match) when h in [".", "..", ""], do: true defp invalid_path?([h | t], match), do: String.contains?(h, match) or invalid_path?(t) defp invalid_path?([], _match), do: false - defp api_route?(list) when is_list(list) and length(list) > 0 do - List.first(list) in @api_routes - end - - defp api_route?(_), do: false + defp api_route?([h | _]) when h in @api_routes, do: true + defp api_route?([_ | t]), do: api_route?(t) + defp api_route?([]), do: false defp call_static(conn, opts, from) do opts = Map.put(opts, :from, from) -- cgit v1.2.3 From 2da71a526f9c628370b783ff371858f7fe831b32 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 25 Feb 2021 13:04:08 -0600 Subject: No need to filter out Mix.env() from the API routes. --- lib/pleroma/web.ex | 8 +------- test/pleroma/web/plugs/frontend_static_plug_test.exs | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index 0a4c98e47..a638bb198 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -28,8 +28,6 @@ defmodule Pleroma.Web do alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.PlugHelper - @mix_env Mix.env() - def controller do quote do use Phoenix.Controller, namespace: Pleroma.Web @@ -238,11 +236,7 @@ def base_url do def get_api_routes do Pleroma.Web.Router.__routes__() - |> Enum.reject(fn - r -> - r.plug == Pleroma.Web.Fallback.RedirectController or - String.starts_with?(r.path, "/#{@mix_env}") - end) + |> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) |> Enum.map(fn r -> r.path |> String.split("/", trim: true) diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs index 9d59d3f8e..b5801320a 100644 --- a/test/pleroma/web/plugs/frontend_static_plug_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -96,6 +96,7 @@ test "api routes are detected correctly" do "auth", "embed", "proxy", + "test", "user_exists", "check_password" ] -- cgit v1.2.3 From 902d4e4a4a942880dc49b7720b51d7c014c182b3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 25 Feb 2021 13:06:43 -0600 Subject: Leave a note for future explorers --- test/pleroma/web/plugs/frontend_static_plug_test.exs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/pleroma/web/plugs/frontend_static_plug_test.exs b/test/pleroma/web/plugs/frontend_static_plug_test.exs index b5801320a..100b83d6a 100644 --- a/test/pleroma/web/plugs/frontend_static_plug_test.exs +++ b/test/pleroma/web/plugs/frontend_static_plug_test.exs @@ -76,6 +76,8 @@ test "exclude invalid path", %{conn: conn} do end test "api routes are detected correctly" do + # If this test fails we have probably added something + # new that should be in /api/ instead expected_routes = [ "api", "main", -- cgit v1.2.3 From 76b166f0401c85df537c13591a7397e2c21732ac Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 25 Feb 2021 13:08:36 -0600 Subject: Note our upgrade path for this functionality --- lib/pleroma/web.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/web.ex b/lib/pleroma/web.ex index a638bb198..8630f244b 100644 --- a/lib/pleroma/web.ex +++ b/lib/pleroma/web.ex @@ -234,6 +234,7 @@ def base_url do Pleroma.Web.Endpoint.url() end + # TODO: Change to Phoenix.Router.routes/1 for Phoenix 1.6.0+ def get_api_routes do Pleroma.Web.Router.__routes__() |> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end) -- cgit v1.2.3 From a30126271f261a9c93798f3c51dee232b5a69a3a Mon Sep 17 00:00:00 2001 From: PestToast Date: Fri, 26 Feb 2021 01:01:29 +0000 Subject: Removed a command that references "pleroma.env". This file does not seem to be generated at any point during the install, and not having it does not stop the instance from working, as far as I can tell. --- docs/installation/otp_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation/otp_en.md b/docs/installation/otp_en.md index f36b33c32..42e264e65 100644 --- a/docs/installation/otp_en.md +++ b/docs/installation/otp_en.md @@ -150,7 +150,7 @@ su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate" # su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate --migrations-path priv/repo/optional_migrations/rum_indexing/" # Start the instance to verify that everything is working as expected -su pleroma -s $SHELL -lc "export $(cat /opt/pleroma/config/pleroma.env); ./bin/pleroma daemon" +su pleroma -s $SHELL -lc "./bin/pleroma daemon" # Wait for about 20 seconds and query the instance endpoint, if it shows your uri, name and email correctly, you are configured correctly sleep 20 && curl http://localhost:4000/api/v1/instance -- cgit v1.2.3 From d35b6254b4540394a134e026289a2c09bfe42ddd Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 26 Feb 2021 18:14:57 -0600 Subject: Store the client application data in ActivityStreams format --- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 2 +- lib/pleroma/web/mastodon_api/views/status_view.ex | 8 ++++++-- test/pleroma/web/activity_pub/transmogrifier_test.exs | 9 ++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 2655d6b6e..b8a7b2a0a 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -423,7 +423,7 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do if user.disclose_client do %{client_name: client_name, website: website} = Repo.preload(token, :app).app - Map.put(params, :application, %{name: client_name, website: website}) + Map.put(params, :application, %{type: "Application", name: client_name, url: website}) else Map.put(params, :application, nil) end diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index a45650988..792197a4a 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -180,7 +180,7 @@ def render( media_attachments: reblogged[:media_attachments] || [], mentions: mentions, tags: reblogged[:tags] || [], - application: activity_object.data["application"] || nil, + application: build_application(activity_object.data["application"]), language: nil, emojis: [], pleroma: %{ @@ -345,7 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} poll: render(PollView, "show.json", object: object, for: opts[:for]), mentions: mentions, tags: build_tags(tags), - application: object.data["application"] || nil, + application: build_application(object.data["application"]), language: nil, emojis: build_emojis(object.data["emoji"]), pleroma: %{ @@ -534,4 +534,8 @@ defp build_emoji_map(emoji, users, current_user) do me: !!(current_user && current_user.ap_id in users) } end + + @spec build_application(map() | nil) :: map() | nil + defp build_application(%{type: _type, name: name, url: url}), do: %{name: name, website: url} + defp build_application(_), do: nil end diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 33ccbe2a7..f6a8cbb6f 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -205,14 +205,17 @@ test "it strips internal fields" do {:ok, activity} = CommonAPI.post(user, %{ status: "#2hu :firefox:", - application: %{name: "TestClient", website: "https://pleroma.social"} + application: %{type: "Application", name: "TestClient", url: "https://pleroma.social"} }) # Ensure injected application data made it into the activity # as we don't have a Token to derive it from, otherwise it will # be nil and the test will pass - assert %{"application" => %{name: "TestClient", website: "https://pleroma.social"}} = - activity.object.data + assert %{ + type: "Application", + name: "TestClient", + url: "https://pleroma.social" + } == activity.object.data["application"] {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) -- cgit v1.2.3 From da5d21a1cf6050e35bbc8637b2fc7c44a8476994 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 27 Feb 2021 09:39:15 +0300 Subject: don't use continue in Stats init for test env --- lib/pleroma/stats.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/stats.ex b/lib/pleroma/stats.ex index b096a9b1e..3e3f24c2c 100644 --- a/lib/pleroma/stats.ex +++ b/lib/pleroma/stats.ex @@ -23,7 +23,11 @@ def start_link(_) do @impl true def init(_args) do - {:ok, nil, {:continue, :calculate_stats}} + if Pleroma.Config.get(:env) != :test do + {:ok, nil, {:continue, :calculate_stats}} + else + {:ok, calculate_stat_data()} + end end @doc "Performs update stats" -- cgit v1.2.3 From 3bc7d122712b5cc35ba509542bde63ca130d6a40 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 28 Dec 2020 23:21:53 +0100 Subject: Remove sensitive-property setting #nsfw, create HashtagPolicy --- CHANGELOG.md | 2 +- config/config.exs | 5 + docs/configuration/cheatsheet.md | 10 ++ lib/pleroma/web/activity_pub/mrf.ex | 4 +- lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex | 116 +++++++++++++++++++++ lib/pleroma/web/activity_pub/mrf/simple_policy.ex | 12 +-- lib/pleroma/web/activity_pub/mrf/tag_policy.ex | 13 +-- lib/pleroma/web/activity_pub/transmogrifier.ex | 11 -- lib/pleroma/web/common_api/activity_draft.ex | 2 +- lib/pleroma/web/common_api/utils.ex | 8 -- .../web/activity_pub/mrf/hashtag_policy_test.exs | 31 ++++++ .../web/activity_pub/mrf/simple_policy_test.exs | 10 +- .../web/activity_pub/mrf/tag_policy_test.exs | 2 +- test/pleroma/web/activity_pub/mrf_test.exs | 14 ++- .../web/activity_pub/transmogrifier_test.exs | 9 -- 15 files changed, 187 insertions(+), 62 deletions(-) create mode 100644 lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex create mode 100644 test/pleroma/web/activity_pub/mrf/hashtag_policy_test.exs diff --git a/CHANGELOG.md b/CHANGELOG.md index a7b5f6ac0..52fdcb932 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **Breaking**: Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm` - **Breaking**: Changed `mix pleroma.user toggle_activated` to `mix pleroma.user activate/deactivate` +- **Breaking:** NSFW hashtag is no longer added on sensitive posts - Polls now always return a `voters_count`, even if they are single-choice. - Admin Emails: The ap id is used as the user link in emails now. - Improved registration workflow for email confirmation and account approval modes. @@ -489,7 +490,6 @@ switched to a new configuration mechanism, however it was not officially removed - Static-FE: Fix remote posts not being sanitized ### Fixed -======= - Rate limiter crashes when there is no explicitly specified ip in the config - 500 errors when no `Accept` header is present if Static-FE is enabled - Instance panel not being updated immediately due to wrong `Cache-Control` headers diff --git a/config/config.exs b/config/config.exs index c371c397c..97e440fee 100644 --- a/config/config.exs +++ b/config/config.exs @@ -391,6 +391,11 @@ federated_timeline_removal: [], replace: [] +config :pleroma, :mrf_hashtag, + sensitive: ["nsfw"], + reject: [], + federated_timeline_removal: [] + config :pleroma, :mrf_subchain, match_actor: %{} config :pleroma, :mrf_activity_expiration, days: 365 diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 6a1031f15..f3eee3e67 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -210,6 +210,16 @@ config :pleroma, :mrf_user_allowlist, %{ * `days`: Default global expiration time for all local Create activities (in days) +#### :mrf_hashtag + +* `sensitive`: List of hashtags to mark activities as sensitive (default: `nsfw`) +* `federated_timeline_removal`: List of hashtags to remove activities from the federated timeline (aka TWNK) +* `reject`: List of hashtags to reject activities from + +Notes: +- The hashtags in the configuration do not have a leading `#`. +- This MRF Policy is always enabled, if you want to disable it you have to set empty lists + ### :activitypub * `unfollow_blocked`: Whether blocks result in people getting unfollowed * `outgoing_blocks`: Whether to federate blocks to other instances diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index ef5a09a93..f2fec3ff6 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -92,7 +92,9 @@ def pipeline_filter(%{} = message, meta) do end def get_policies do - Pleroma.Config.get([:mrf, :policies], []) |> get_policies() + Pleroma.Config.get([:mrf, :policies], []) + |> get_policies() + |> Enum.concat([Pleroma.Web.ActivityPub.MRF.HashtagPolicy]) end defp get_policies(policy) when is_atom(policy), do: [policy] diff --git a/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex b/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex new file mode 100644 index 000000000..def0c437c --- /dev/null +++ b/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex @@ -0,0 +1,116 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.HashtagPolicy do + require Pleroma.Constants + + alias Pleroma.Config + alias Pleroma.Object + + @moduledoc """ + Reject, TWKN-remove or Set-Sensitive messsages with specific hashtags (without the leading #) + + Note: This MRF Policy is always enabled, if you want to disable it you have to set empty lists. + """ + + @behaviour Pleroma.Web.ActivityPub.MRF + + defp check_reject(message, hashtags) do + if Enum.any?(Config.get([:mrf_hashtag, :reject]), fn match -> match in hashtags end) do + {:reject, "[HashtagPolicy] Matches with rejected keyword"} + else + {:ok, message} + end + end + + defp check_ftl_removal(%{"to" => to} = message, hashtags) do + if Pleroma.Constants.as_public() in to and + Enum.any?(Config.get([:mrf_hashtag, :federated_timeline_removal]), fn match -> + match in hashtags + end) do + to = List.delete(to, Pleroma.Constants.as_public()) + cc = [Pleroma.Constants.as_public() | message["cc"] || []] + + message = + message + |> Map.put("to", to) + |> Map.put("cc", cc) + |> Kernel.put_in(["object", "to"], to) + |> Kernel.put_in(["object", "cc"], cc) + + {:ok, message} + else + {:ok, message} + end + end + + defp check_ftl_removal(message, _hashtags), do: {:ok, message} + + defp check_sensitive(message, hashtags) do + if Enum.any?(Config.get([:mrf_hashtag, :sensitive]), fn match -> match in hashtags end) do + {:ok, Kernel.put_in(message, ["object", "sensitive"], true)} + else + {:ok, message} + end + end + + @impl true + def filter(%{"type" => "Create", "object" => object} = message) do + hashtags = Object.hashtags(%Object{data: object}) + + if hashtags != [] do + with {:ok, message} <- check_reject(message, hashtags), + {:ok, message} <- check_ftl_removal(message, hashtags), + {:ok, message} <- check_sensitive(message, hashtags) do + {:ok, message} + end + else + {:ok, message} + end + end + + @impl true + def filter(message), do: {:ok, message} + + @impl true + def describe do + mrf_hashtag = + Config.get(:mrf_hashtag) + |> Enum.into(%{}) + + {:ok, %{mrf_hashtag: mrf_hashtag}} + end + + @impl true + def config_description do + %{ + key: :mrf_hashtag, + related_policy: "Pleroma.Web.ActivityPub.MRF.HashtagPolicy", + label: "MRF Hashtag", + description: @moduledoc, + children: [ + %{ + key: :reject, + type: {:list, :string}, + description: "A list of hashtags which result in message being rejected.", + suggestions: ["foo"] + }, + %{ + key: :federated_timeline_removal, + type: {:list, :string}, + description: + "A list of hashtags which result in message being removed from federated timelines (a.k.a unlisted).", + suggestions: ["foo"] + }, + %{ + key: :sensitive, + type: {:list, :string}, + description: + "A list of hashtags which result in message being set as sensitive (a.k.a NSFW/R-18)", + suggestions: ["nsfw", "r18"] + } + ] + } + end +end diff --git a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex index 0b1be8c51..62024c58c 100644 --- a/lib/pleroma/web/activity_pub/mrf/simple_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/simple_policy.ex @@ -64,22 +64,16 @@ defp check_media_nsfw( %{host: actor_host} = _actor_info, %{ "type" => "Create", - "object" => child_object + "object" => %{} = _child_object } = object - ) - when is_map(child_object) do + ) do media_nsfw = Config.get([:mrf_simple, :media_nsfw]) |> MRF.subdomains_regex() object = if MRF.subdomain_match?(media_nsfw, actor_host) do - child_object = - child_object - |> Map.put("tag", (child_object["tag"] || []) ++ ["nsfw"]) - |> Map.put("sensitive", true) - - Map.put(object, "object", child_object) + Kernel.put_in(object, ["object", "sensitive"], true) else object end diff --git a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex index 5739cee63..528093ac0 100644 --- a/lib/pleroma/web/activity_pub/mrf/tag_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/tag_policy.ex @@ -28,20 +28,11 @@ defp process_tag( "mrf_tag:media-force-nsfw", %{ "type" => "Create", - "object" => %{"attachment" => child_attachment} = object + "object" => %{"attachment" => child_attachment} } = message ) when length(child_attachment) > 0 do - tags = (object["tag"] || []) ++ ["nsfw"] - - object = - object - |> Map.put("tag", tags) - |> Map.put("sensitive", true) - - message = Map.put(message, "object", object) - - {:ok, message} + {:ok, Kernel.put_in(message, ["object", "sensitive"], true)} end defp process_tag( diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 0a701334f..8c7d6a747 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -40,7 +40,6 @@ def fix_object(object, options \\ []) do |> fix_in_reply_to(options) |> fix_emoji() |> fix_tag() - |> set_sensitive() |> fix_content_map() |> fix_addressing() |> fix_summary() @@ -741,7 +740,6 @@ def replies(_), do: [] # Prepares the object of an outgoing create activity. def prepare_object(object) do object - |> set_sensitive |> add_hashtags |> add_mention_tags |> add_emoji_tags @@ -932,15 +930,6 @@ def set_conversation(object) do Map.put(object, "conversation", object["context"]) end - def set_sensitive(%{"sensitive" => _} = object) do - object - end - - def set_sensitive(object) do - tags = object["tag"] || [] - Map.put(object, "sensitive", "nsfw" in tags) - end - def set_type(%{"type" => "Answer"} = object) do Map.put(object, "type", "Note") end diff --git a/lib/pleroma/web/common_api/activity_draft.ex b/lib/pleroma/web/common_api/activity_draft.ex index fb059c27c..da726a690 100644 --- a/lib/pleroma/web/common_api/activity_draft.ex +++ b/lib/pleroma/web/common_api/activity_draft.ex @@ -179,7 +179,7 @@ defp context(draft) do end defp sensitive(draft) do - sensitive = draft.params[:sensitive] || Enum.member?(draft.tags, {"#nsfw", "nsfw"}) + sensitive = draft.params[:sensitive] %__MODULE__{draft | sensitive: sensitive} end diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex index 9587dfa25..4e6a3feb0 100644 --- a/lib/pleroma/web/common_api/utils.ex +++ b/lib/pleroma/web/common_api/utils.ex @@ -217,7 +217,6 @@ def make_content_html(%ActivityDraft{} = draft) do draft.status |> format_input(content_type, options) |> maybe_add_attachments(draft.attachments, attachment_links) - |> maybe_add_nsfw_tag(draft.params) end defp get_content_type(content_type) do @@ -228,13 +227,6 @@ defp get_content_type(content_type) do end end - defp maybe_add_nsfw_tag({text, mentions, tags}, %{"sensitive" => sensitive}) - when sensitive in [true, "True", "true", "1"] do - {text, mentions, [{"#nsfw", "nsfw"} | tags]} - end - - defp maybe_add_nsfw_tag(data, _), do: data - def make_context(_, %Participation{} = participation) do Repo.preload(participation, :conversation).conversation.ap_id end diff --git a/test/pleroma/web/activity_pub/mrf/hashtag_policy_test.exs b/test/pleroma/web/activity_pub/mrf/hashtag_policy_test.exs new file mode 100644 index 000000000..13415bb79 --- /dev/null +++ b/test/pleroma/web/activity_pub/mrf/hashtag_policy_test.exs @@ -0,0 +1,31 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.HashtagPolicyTest do + use Oban.Testing, repo: Pleroma.Repo + use Pleroma.DataCase + + alias Pleroma.Web.ActivityPub.Transmogrifier + alias Pleroma.Web.CommonAPI + + import Pleroma.Factory + + test "it sets the sensitive property with relevant hashtags" do + user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{status: "#nsfw hey"}) + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) + + assert modified["object"]["sensitive"] + end + + test "it doesn't sets the sensitive property with irrelevant hashtags" do + user = insert(:user) + + {:ok, activity} = CommonAPI.post(user, %{status: "#cofe hey"}) + {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) + + refute modified["object"]["sensitive"] + end +end diff --git a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs index f48e5b39b..5c0aff26e 100644 --- a/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/simple_policy_test.exs @@ -75,10 +75,7 @@ test "has a matching host" do local_message = build_local_message() assert SimplePolicy.filter(media_message) == - {:ok, - media_message - |> put_in(["object", "tag"], ["foo", "nsfw"]) - |> put_in(["object", "sensitive"], true)} + {:ok, put_in(media_message, ["object", "sensitive"], true)} assert SimplePolicy.filter(local_message) == {:ok, local_message} end @@ -89,10 +86,7 @@ test "match with wildcard domain" do local_message = build_local_message() assert SimplePolicy.filter(media_message) == - {:ok, - media_message - |> put_in(["object", "tag"], ["foo", "nsfw"]) - |> put_in(["object", "sensitive"], true)} + {:ok, put_in(media_message, ["object", "sensitive"], true)} assert SimplePolicy.filter(local_message) == {:ok, local_message} end diff --git a/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs index 66e98b7ee..faaadff79 100644 --- a/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs @@ -114,7 +114,7 @@ test "Mark as sensitive on presence of attachments" do except_message = %{ "actor" => actor.ap_id, "type" => "Create", - "object" => %{"tag" => ["test", "nsfw"], "attachment" => ["file1"], "sensitive" => true} + "object" => %{"tag" => ["test"], "attachment" => ["file1"], "sensitive" => true} } assert TagPolicy.filter(message) == {:ok, except_message} diff --git a/test/pleroma/web/activity_pub/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs index 7c1eef7e0..61d308b97 100644 --- a/test/pleroma/web/activity_pub/mrf_test.exs +++ b/test/pleroma/web/activity_pub/mrf_test.exs @@ -68,7 +68,12 @@ test "it works as expected with noop policy" do clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.NoOpPolicy]) expected = %{ - mrf_policies: ["NoOpPolicy"], + mrf_policies: ["NoOpPolicy", "HashtagPolicy"], + mrf_hashtag: %{ + federated_timeline_removal: [], + reject: [], + sensitive: ["nsfw"] + }, exclusions: false } @@ -79,8 +84,13 @@ test "it works as expected with mock policy" do clear_config([:mrf, :policies], [MRFModuleMock]) expected = %{ - mrf_policies: ["MRFModuleMock"], + mrf_policies: ["MRFModuleMock", "HashtagPolicy"], mrf_module_mock: "some config data", + mrf_hashtag: %{ + federated_timeline_removal: [], + reject: [], + sensitive: ["nsfw"] + }, exclusions: false } diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 7c97fa8f8..a7894a8d0 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -153,15 +153,6 @@ test "it turns mentions into tags" do end end - test "it adds the sensitive property" do - user = insert(:user) - - {:ok, activity} = CommonAPI.post(user, %{status: "#nsfw hey"}) - {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) - - assert modified["object"]["sensitive"] - end - test "it adds the json-ld context and the conversation property" do user = insert(:user) -- cgit v1.2.3 From 0faf8dbef8f0d77fdd42b36ade4d55c42f0ccc8c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sun, 28 Feb 2021 09:04:29 -0600 Subject: Simplify migration --- .../migrations/20210218223811_add_disclose_client_to_users.exs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs b/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs index c6b6fe7b2..37c5776ff 100644 --- a/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs +++ b/priv/repo/migrations/20210218223811_add_disclose_client_to_users.exs @@ -1,15 +1,9 @@ defmodule Pleroma.Repo.Migrations.AddDiscloseClientToUsers do use Ecto.Migration - def up do + def change do alter table(:users) do add(:disclose_client, :boolean, default: true) end end - - def down do - alter table(:users) do - remove(:disclose_client) - end - end end -- cgit v1.2.3 From f85ed1c521cf36a50f3758db99e23e5f4c1492d7 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sun, 28 Feb 2021 19:41:25 +0300 Subject: warning fix --- .../web/mastodon_api/controllers/status_controller_test.exs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index dd2f306b7..bd385bccd 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -364,8 +364,8 @@ test "discloses application metadata when enabled" do %Pleroma.Web.OAuth.Token{ app: %Pleroma.Web.OAuth.App{ - client_name: _app_name, - website: _app_website + client_name: app_name, + website: app_website } } = token @@ -379,8 +379,8 @@ test "discloses application metadata when enabled" do assert %{ "content" => "cofe is my copilot", "application" => %{ - "name" => app_name, - "website" => app_website + "name" => ^app_name, + "website" => ^app_website } } = json_response_and_validate_schema(result, 200) end -- cgit v1.2.3 From 8a563efdd8975d37143953d173c40f9e2d1aab99 Mon Sep 17 00:00:00 2001 From: feld Date: Sun, 28 Feb 2021 18:46:03 +0000 Subject: Update CHANGELOG.md --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43927fe6e..812816f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Reports now generate notifications for admins and mods. -- Experimental websocket-based federation between Pleroma instances. - Support for local-only statuses. - Support pagination of blocks and mutes. - Account backup. -- cgit v1.2.3 From b1e1db82bc2c076f2a7858ec63017c10dda1966b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 1 Mar 2021 11:29:10 -0600 Subject: Store application details in the object under the generator key, not application key --- lib/pleroma/constants.ex | 2 +- lib/pleroma/web/common_api/activity_draft.ex | 2 +- lib/pleroma/web/mastodon_api/controllers/status_controller.ex | 6 +++--- lib/pleroma/web/mastodon_api/views/status_view.ex | 4 ++-- test/pleroma/web/activity_pub/transmogrifier_test.exs | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/constants.ex b/lib/pleroma/constants.ex index 9ee836d5d..b24338cc6 100644 --- a/lib/pleroma/constants.ex +++ b/lib/pleroma/constants.ex @@ -19,7 +19,7 @@ defmodule Pleroma.Constants do "context_id", "deleted_activity_id", "pleroma_internal", - "application" + "generator" ] ) diff --git a/lib/pleroma/web/common_api/activity_draft.ex b/lib/pleroma/web/common_api/activity_draft.ex index d7dcdad90..73f1b0931 100644 --- a/lib/pleroma/web/common_api/activity_draft.ex +++ b/lib/pleroma/web/common_api/activity_draft.ex @@ -190,7 +190,7 @@ defp object(draft) do Utils.make_note_data(draft) |> Map.put("emoji", emoji) |> Map.put("source", draft.status) - |> Map.put("application", draft.params[:application]) + |> Map.put("generator", draft.params[:generator]) %__MODULE__{draft | object: object} end diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index b8a7b2a0a..b051fca74 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -423,11 +423,11 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do if user.disclose_client do %{client_name: client_name, website: website} = Repo.preload(token, :app).app - Map.put(params, :application, %{type: "Application", name: client_name, url: website}) + Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) else - Map.put(params, :application, nil) + Map.put(params, :generator, nil) end end - defp put_application(params, _), do: Map.put(params, :application, nil) + defp put_application(params, _), do: Map.put(params, :generator, nil) end diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 792197a4a..bac897a57 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -180,7 +180,7 @@ def render( media_attachments: reblogged[:media_attachments] || [], mentions: mentions, tags: reblogged[:tags] || [], - application: build_application(activity_object.data["application"]), + application: build_application(activity_object.data["generator"]), language: nil, emojis: [], pleroma: %{ @@ -345,7 +345,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} poll: render(PollView, "show.json", object: object, for: opts[:for]), mentions: mentions, tags: build_tags(tags), - application: build_application(object.data["application"]), + application: build_application(object.data["generator"]), language: nil, emojis: build_emojis(object.data["emoji"]), pleroma: %{ diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index f6a8cbb6f..211e535a5 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -205,7 +205,7 @@ test "it strips internal fields" do {:ok, activity} = CommonAPI.post(user, %{ status: "#2hu :firefox:", - application: %{type: "Application", name: "TestClient", url: "https://pleroma.social"} + generator: %{type: "Application", name: "TestClient", url: "https://pleroma.social"} }) # Ensure injected application data made it into the activity @@ -215,7 +215,7 @@ test "it strips internal fields" do type: "Application", name: "TestClient", url: "https://pleroma.social" - } == activity.object.data["application"] + } == activity.object.data["generator"] {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data) @@ -226,7 +226,7 @@ test "it strips internal fields" do assert is_nil(modified["object"]["announcements"]) assert is_nil(modified["object"]["announcement_count"]) assert is_nil(modified["object"]["context_id"]) - assert is_nil(modified["object"]["application"]) + assert is_nil(modified["object"]["generator"]) end test "it strips internal fields of article" do -- cgit v1.2.3 From 5058de328e576efc80c6a7d87b76ae1ae4b468f1 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 1 Mar 2021 20:04:53 +0100 Subject: Update frontend --- priv/static/index.html | 2 +- priv/static/static/js/10.8702741bef65422a8655.js | Bin 31550 -> 0 bytes .../static/js/10.8702741bef65422a8655.js.map | Bin 113 -> 0 bytes priv/static/static/js/10.9a138b362edd4833778a.js | Bin 0 -> 31671 bytes .../static/js/10.9a138b362edd4833778a.js.map | Bin 0 -> 113 bytes priv/static/static/js/11.9d88e9e710c4e0d0c897.js | Bin 0 -> 16124 bytes .../static/js/11.9d88e9e710c4e0d0c897.js.map | Bin 0 -> 113 bytes priv/static/static/js/11.a3e462fd9190986433f8.js | Bin 16124 -> 0 bytes .../static/js/11.a3e462fd9190986433f8.js.map | Bin 113 -> 0 bytes priv/static/static/js/12.36ee26c30e2909c8be60.js | Bin 0 -> 23834 bytes .../static/js/12.36ee26c30e2909c8be60.js.map | Bin 0 -> 113 bytes priv/static/static/js/12.7d5889019e7177d19bc2.js | Bin 23834 -> 0 bytes .../static/js/12.7d5889019e7177d19bc2.js.map | Bin 113 -> 0 bytes priv/static/static/js/13.bb129366e7d54b5678d4.js | Bin 27059 -> 0 bytes .../static/js/13.bb129366e7d54b5678d4.js.map | Bin 113 -> 0 bytes priv/static/static/js/13.d02023d426b44a6886af.js | Bin 0 -> 27059 bytes .../static/js/13.d02023d426b44a6886af.js.map | Bin 0 -> 113 bytes priv/static/static/js/14.3546063198fc4cb3852c.js | Bin 29348 -> 0 bytes .../static/js/14.3546063198fc4cb3852c.js.map | Bin 113 -> 0 bytes priv/static/static/js/14.8e7c0873d041b34efd84.js | Bin 0 -> 31505 bytes .../static/js/14.8e7c0873d041b34efd84.js.map | Bin 0 -> 113 bytes priv/static/static/js/15.349c342e2fe7e9e0fe01.js | Bin 0 -> 7789 bytes .../static/js/15.349c342e2fe7e9e0fe01.js.map | Bin 0 -> 113 bytes priv/static/static/js/15.e0cc6ce336f523c26f4d.js | Bin 7789 -> 0 bytes .../static/js/15.e0cc6ce336f523c26f4d.js.map | Bin 113 -> 0 bytes priv/static/static/js/16.67b2bcf7dd3271e31643.js | Bin 15802 -> 0 bytes .../static/js/16.67b2bcf7dd3271e31643.js.map | Bin 113 -> 0 bytes priv/static/static/js/16.cf210505237c2a0040dd.js | Bin 0 -> 15802 bytes .../static/js/16.cf210505237c2a0040dd.js.map | Bin 0 -> 113 bytes priv/static/static/js/17.a8395e49508cd81ecdf4.js | Bin 2086 -> 0 bytes .../static/js/17.a8395e49508cd81ecdf4.js.map | Bin 113 -> 0 bytes priv/static/static/js/17.fe52ece512025177a3b8.js | Bin 0 -> 2086 bytes .../static/js/17.fe52ece512025177a3b8.js.map | Bin 0 -> 113 bytes priv/static/static/js/18.1b9a9aedd06803dbb3e4.js | Bin 29046 -> 0 bytes .../static/js/18.1b9a9aedd06803dbb3e4.js.map | Bin 113 -> 0 bytes priv/static/static/js/18.c0d447ff77030482a94c.js | Bin 0 -> 29332 bytes .../static/js/18.c0d447ff77030482a94c.js.map | Bin 0 -> 113 bytes priv/static/static/js/19.9b0c21b72dedc1b244bd.js | Bin 0 -> 31472 bytes .../static/js/19.9b0c21b72dedc1b244bd.js.map | Bin 0 -> 113 bytes priv/static/static/js/19.af8826ed7cd146d80620.js | Bin 31472 -> 0 bytes .../static/js/19.af8826ed7cd146d80620.js.map | Bin 113 -> 0 bytes priv/static/static/js/2.80ae75b951121aacd208.js | Bin 0 -> 180346 bytes .../static/static/js/2.80ae75b951121aacd208.js.map | Bin 0 -> 475588 bytes priv/static/static/js/2.cac6da00a889ad330fef.js | Bin 182187 -> 0 bytes .../static/static/js/2.cac6da00a889ad330fef.js.map | Bin 472791 -> 0 bytes priv/static/static/js/20.c45b976fb08603acced8.js | Bin 26280 -> 0 bytes .../static/js/20.c45b976fb08603acced8.js.map | Bin 113 -> 0 bytes priv/static/static/js/20.fee3cd69d629f271e653.js | Bin 0 -> 36685 bytes .../static/js/20.fee3cd69d629f271e653.js.map | Bin 0 -> 113 bytes priv/static/static/js/21.11c34dd4260444732ab0.js | Bin 13162 -> 0 bytes .../static/js/21.11c34dd4260444732ab0.js.map | Bin 113 -> 0 bytes priv/static/static/js/21.9b5434a9d2b0b07a3038.js | Bin 0 -> 19061 bytes .../static/js/21.9b5434a9d2b0b07a3038.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.132b7fba6bee9817b39f.js | Bin 0 -> 19789 bytes .../static/js/22.132b7fba6bee9817b39f.js.map | Bin 0 -> 113 bytes priv/static/static/js/22.6155d82624c0297d5694.js | Bin 19706 -> 0 bytes .../static/js/22.6155d82624c0297d5694.js.map | Bin 113 -> 0 bytes priv/static/static/js/23.63b95894e9f0eb300da0.js | Bin 0 -> 27669 bytes .../static/js/23.63b95894e9f0eb300da0.js.map | Bin 0 -> 113 bytes priv/static/static/js/23.d89535c0e277447a45a7.js | Bin 27669 -> 0 bytes .../static/js/23.d89535c0e277447a45a7.js.map | Bin 113 -> 0 bytes priv/static/static/js/24.10dc1eadca8b0bc15e20.js | Bin 0 -> 18493 bytes .../static/js/24.10dc1eadca8b0bc15e20.js.map | Bin 0 -> 113 bytes priv/static/static/js/24.4693bde7d2a49831dbe2.js | Bin 18493 -> 0 bytes .../static/js/24.4693bde7d2a49831dbe2.js.map | Bin 113 -> 0 bytes priv/static/static/js/25.8f7cea2eb70da626b21d.js | Bin 29996 -> 0 bytes .../static/js/25.8f7cea2eb70da626b21d.js.map | Bin 113 -> 0 bytes priv/static/static/js/25.e2e834e1b024960e0087.js | Bin 0 -> 29996 bytes .../static/js/25.e2e834e1b024960e0087.js.map | Bin 0 -> 113 bytes priv/static/static/js/26.3f806866a23f516b7e87.js | Bin 31123 -> 0 bytes .../static/js/26.3f806866a23f516b7e87.js.map | Bin 113 -> 0 bytes priv/static/static/js/26.74667f919f7bad826ea0.js | Bin 0 -> 31122 bytes .../static/js/26.74667f919f7bad826ea0.js.map | Bin 0 -> 113 bytes priv/static/static/js/27.0af03540f78df63eddca.js | Bin 0 -> 2022 bytes .../static/js/27.0af03540f78df63eddca.js.map | Bin 0 -> 113 bytes priv/static/static/js/27.2d655ddddf874f532191.js | Bin 2022 -> 0 bytes .../static/js/27.2d655ddddf874f532191.js.map | Bin 113 -> 0 bytes priv/static/static/js/28.599a889517f15c01b27e.js | Bin 0 -> 38185 bytes .../static/js/28.599a889517f15c01b27e.js.map | Bin 0 -> 113 bytes priv/static/static/js/28.f738a8b568b00299a569.js | Bin 38107 -> 0 bytes .../static/js/28.f738a8b568b00299a569.js.map | Bin 113 -> 0 bytes priv/static/static/js/29.3fc5f707254d05a94c4e.js | Bin 0 -> 23857 bytes .../static/js/29.3fc5f707254d05a94c4e.js.map | Bin 0 -> 113 bytes priv/static/static/js/29.64d5389501dc6e6c77f2.js | Bin 23857 -> 0 bytes .../static/js/29.64d5389501dc6e6c77f2.js.map | Bin 113 -> 0 bytes priv/static/static/js/3.716f85efb43de512faf0.js | Bin 0 -> 78858 bytes .../static/static/js/3.716f85efb43de512faf0.js.map | Bin 0 -> 333571 bytes priv/static/static/js/3.91e3846705ce522e8366.js | Bin 78760 -> 0 bytes .../static/static/js/3.91e3846705ce522e8366.js.map | Bin 332972 -> 0 bytes priv/static/static/js/30.af9dba19236c2e02ceb0.js | Bin 0 -> 44257 bytes .../static/js/30.af9dba19236c2e02ceb0.js.map | Bin 0 -> 113 bytes priv/static/static/js/30.d0724c72975d6ce2243c.js | Bin 44258 -> 0 bytes .../static/js/30.d0724c72975d6ce2243c.js.map | Bin 113 -> 0 bytes priv/static/static/js/31.31627923fc0b0d75672f.js | Bin 26981 -> 0 bytes .../static/js/31.31627923fc0b0d75672f.js.map | Bin 113 -> 0 bytes priv/static/static/js/31.f4fb830b17ba4aa43cb0.js | Bin 0 -> 27322 bytes .../static/js/31.f4fb830b17ba4aa43cb0.js.map | Bin 0 -> 113 bytes priv/static/static/js/32.e0c1e549e0806ed8c97e.js | Bin 0 -> 26208 bytes .../static/js/32.e0c1e549e0806ed8c97e.js.map | Bin 0 -> 113 bytes priv/static/static/js/32.f628f72f0c04549e3d56.js | Bin 25945 -> 0 bytes .../static/js/32.f628f72f0c04549e3d56.js.map | Bin 113 -> 0 bytes priv/static/static/js/4.14dd3a6fcb972eb61829.js | Bin 2177 -> 0 bytes .../static/static/js/4.14dd3a6fcb972eb61829.js.map | Bin 7940 -> 0 bytes priv/static/static/js/4.ae27cb41b81c1d0fb12b.js | Bin 0 -> 2177 bytes .../static/static/js/4.ae27cb41b81c1d0fb12b.js.map | Bin 0 -> 7940 bytes priv/static/static/js/5.41ab92595cefc4c72fe0.js | Bin 6994 -> 0 bytes .../static/static/js/5.41ab92595cefc4c72fe0.js.map | Bin 112 -> 0 bytes priv/static/static/js/5.730f6dd69f3216d24320.js | Bin 0 -> 6994 bytes .../static/static/js/5.730f6dd69f3216d24320.js.map | Bin 0 -> 112 bytes priv/static/static/js/6.17d3d7ef67c646d7d9e2.js | Bin 0 -> 13285 bytes .../static/static/js/6.17d3d7ef67c646d7d9e2.js.map | Bin 0 -> 112 bytes priv/static/static/js/6.22a79587289c1f1e1e99.js | Bin 13285 -> 0 bytes .../static/static/js/6.22a79587289c1f1e1e99.js.map | Bin 112 -> 0 bytes priv/static/static/js/7.c7fec9856bb057372873.js | Bin 0 -> 15617 bytes .../static/static/js/7.c7fec9856bb057372873.js.map | Bin 0 -> 112 bytes priv/static/static/js/7.cf211d851ab1c77ec4c3.js | Bin 15617 -> 0 bytes .../static/static/js/7.cf211d851ab1c77ec4c3.js.map | Bin 112 -> 0 bytes priv/static/static/js/8.08dd17e532ddcdd39742.js | Bin 21604 -> 0 bytes .../static/static/js/8.08dd17e532ddcdd39742.js.map | Bin 112 -> 0 bytes priv/static/static/js/8.c3a32861cd869f7892e5.js | Bin 0 -> 21604 bytes .../static/static/js/8.c3a32861cd869f7892e5.js.map | Bin 0 -> 112 bytes priv/static/static/js/9.1ea2330cb884e98f8257.js | Bin 28695 -> 0 bytes .../static/static/js/9.1ea2330cb884e98f8257.js.map | Bin 112 -> 0 bytes priv/static/static/js/9.2d36a607172a0f72bb59.js | Bin 0 -> 29083 bytes .../static/static/js/9.2d36a607172a0f72bb59.js.map | Bin 0 -> 112 bytes priv/static/static/js/app.2e518bb8cf82de7a72b0.js | Bin 0 -> 610026 bytes .../static/js/app.2e518bb8cf82de7a72b0.js.map | Bin 0 -> 1570072 bytes priv/static/static/js/app.c6b8a1c86149ed63e6ff.js | Bin 605657 -> 0 bytes .../static/js/app.c6b8a1c86149ed63e6ff.js.map | Bin 1561726 -> 0 bytes .../static/js/vendors~app.102a26590d3ba87dd908.js | Bin 0 -> 375682 bytes .../js/vendors~app.102a26590d3ba87dd908.js.map | Bin 0 -> 2279496 bytes .../static/js/vendors~app.3b02e2e5bd8cdca42216.js | Bin 375540 -> 0 bytes .../js/vendors~app.3b02e2e5bd8cdca42216.js.map | Bin 2277783 -> 0 bytes priv/static/sw-pleroma.js | Bin 184816 -> 185267 bytes priv/static/sw-pleroma.js.map | Bin 714735 -> 714843 bytes 135 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 priv/static/static/js/10.8702741bef65422a8655.js delete mode 100644 priv/static/static/js/10.8702741bef65422a8655.js.map create mode 100644 priv/static/static/js/10.9a138b362edd4833778a.js create mode 100644 priv/static/static/js/10.9a138b362edd4833778a.js.map create mode 100644 priv/static/static/js/11.9d88e9e710c4e0d0c897.js create mode 100644 priv/static/static/js/11.9d88e9e710c4e0d0c897.js.map delete mode 100644 priv/static/static/js/11.a3e462fd9190986433f8.js delete mode 100644 priv/static/static/js/11.a3e462fd9190986433f8.js.map create mode 100644 priv/static/static/js/12.36ee26c30e2909c8be60.js create mode 100644 priv/static/static/js/12.36ee26c30e2909c8be60.js.map delete mode 100644 priv/static/static/js/12.7d5889019e7177d19bc2.js delete mode 100644 priv/static/static/js/12.7d5889019e7177d19bc2.js.map delete mode 100644 priv/static/static/js/13.bb129366e7d54b5678d4.js delete mode 100644 priv/static/static/js/13.bb129366e7d54b5678d4.js.map create mode 100644 priv/static/static/js/13.d02023d426b44a6886af.js create mode 100644 priv/static/static/js/13.d02023d426b44a6886af.js.map delete mode 100644 priv/static/static/js/14.3546063198fc4cb3852c.js delete mode 100644 priv/static/static/js/14.3546063198fc4cb3852c.js.map create mode 100644 priv/static/static/js/14.8e7c0873d041b34efd84.js create mode 100644 priv/static/static/js/14.8e7c0873d041b34efd84.js.map create mode 100644 priv/static/static/js/15.349c342e2fe7e9e0fe01.js create mode 100644 priv/static/static/js/15.349c342e2fe7e9e0fe01.js.map delete mode 100644 priv/static/static/js/15.e0cc6ce336f523c26f4d.js delete mode 100644 priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map delete mode 100644 priv/static/static/js/16.67b2bcf7dd3271e31643.js delete mode 100644 priv/static/static/js/16.67b2bcf7dd3271e31643.js.map create mode 100644 priv/static/static/js/16.cf210505237c2a0040dd.js create mode 100644 priv/static/static/js/16.cf210505237c2a0040dd.js.map delete mode 100644 priv/static/static/js/17.a8395e49508cd81ecdf4.js delete mode 100644 priv/static/static/js/17.a8395e49508cd81ecdf4.js.map create mode 100644 priv/static/static/js/17.fe52ece512025177a3b8.js create mode 100644 priv/static/static/js/17.fe52ece512025177a3b8.js.map delete mode 100644 priv/static/static/js/18.1b9a9aedd06803dbb3e4.js delete mode 100644 priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map create mode 100644 priv/static/static/js/18.c0d447ff77030482a94c.js create mode 100644 priv/static/static/js/18.c0d447ff77030482a94c.js.map create mode 100644 priv/static/static/js/19.9b0c21b72dedc1b244bd.js create mode 100644 priv/static/static/js/19.9b0c21b72dedc1b244bd.js.map delete mode 100644 priv/static/static/js/19.af8826ed7cd146d80620.js delete mode 100644 priv/static/static/js/19.af8826ed7cd146d80620.js.map create mode 100644 priv/static/static/js/2.80ae75b951121aacd208.js create mode 100644 priv/static/static/js/2.80ae75b951121aacd208.js.map delete mode 100644 priv/static/static/js/2.cac6da00a889ad330fef.js delete mode 100644 priv/static/static/js/2.cac6da00a889ad330fef.js.map delete mode 100644 priv/static/static/js/20.c45b976fb08603acced8.js delete mode 100644 priv/static/static/js/20.c45b976fb08603acced8.js.map create mode 100644 priv/static/static/js/20.fee3cd69d629f271e653.js create mode 100644 priv/static/static/js/20.fee3cd69d629f271e653.js.map delete mode 100644 priv/static/static/js/21.11c34dd4260444732ab0.js delete mode 100644 priv/static/static/js/21.11c34dd4260444732ab0.js.map create mode 100644 priv/static/static/js/21.9b5434a9d2b0b07a3038.js create mode 100644 priv/static/static/js/21.9b5434a9d2b0b07a3038.js.map create mode 100644 priv/static/static/js/22.132b7fba6bee9817b39f.js create mode 100644 priv/static/static/js/22.132b7fba6bee9817b39f.js.map delete mode 100644 priv/static/static/js/22.6155d82624c0297d5694.js delete mode 100644 priv/static/static/js/22.6155d82624c0297d5694.js.map create mode 100644 priv/static/static/js/23.63b95894e9f0eb300da0.js create mode 100644 priv/static/static/js/23.63b95894e9f0eb300da0.js.map delete mode 100644 priv/static/static/js/23.d89535c0e277447a45a7.js delete mode 100644 priv/static/static/js/23.d89535c0e277447a45a7.js.map create mode 100644 priv/static/static/js/24.10dc1eadca8b0bc15e20.js create mode 100644 priv/static/static/js/24.10dc1eadca8b0bc15e20.js.map delete mode 100644 priv/static/static/js/24.4693bde7d2a49831dbe2.js delete mode 100644 priv/static/static/js/24.4693bde7d2a49831dbe2.js.map delete mode 100644 priv/static/static/js/25.8f7cea2eb70da626b21d.js delete mode 100644 priv/static/static/js/25.8f7cea2eb70da626b21d.js.map create mode 100644 priv/static/static/js/25.e2e834e1b024960e0087.js create mode 100644 priv/static/static/js/25.e2e834e1b024960e0087.js.map delete mode 100644 priv/static/static/js/26.3f806866a23f516b7e87.js delete mode 100644 priv/static/static/js/26.3f806866a23f516b7e87.js.map create mode 100644 priv/static/static/js/26.74667f919f7bad826ea0.js create mode 100644 priv/static/static/js/26.74667f919f7bad826ea0.js.map create mode 100644 priv/static/static/js/27.0af03540f78df63eddca.js create mode 100644 priv/static/static/js/27.0af03540f78df63eddca.js.map delete mode 100644 priv/static/static/js/27.2d655ddddf874f532191.js delete mode 100644 priv/static/static/js/27.2d655ddddf874f532191.js.map create mode 100644 priv/static/static/js/28.599a889517f15c01b27e.js create mode 100644 priv/static/static/js/28.599a889517f15c01b27e.js.map delete mode 100644 priv/static/static/js/28.f738a8b568b00299a569.js delete mode 100644 priv/static/static/js/28.f738a8b568b00299a569.js.map create mode 100644 priv/static/static/js/29.3fc5f707254d05a94c4e.js create mode 100644 priv/static/static/js/29.3fc5f707254d05a94c4e.js.map delete mode 100644 priv/static/static/js/29.64d5389501dc6e6c77f2.js delete mode 100644 priv/static/static/js/29.64d5389501dc6e6c77f2.js.map create mode 100644 priv/static/static/js/3.716f85efb43de512faf0.js create mode 100644 priv/static/static/js/3.716f85efb43de512faf0.js.map delete mode 100644 priv/static/static/js/3.91e3846705ce522e8366.js delete mode 100644 priv/static/static/js/3.91e3846705ce522e8366.js.map create mode 100644 priv/static/static/js/30.af9dba19236c2e02ceb0.js create mode 100644 priv/static/static/js/30.af9dba19236c2e02ceb0.js.map delete mode 100644 priv/static/static/js/30.d0724c72975d6ce2243c.js delete mode 100644 priv/static/static/js/30.d0724c72975d6ce2243c.js.map delete mode 100644 priv/static/static/js/31.31627923fc0b0d75672f.js delete mode 100644 priv/static/static/js/31.31627923fc0b0d75672f.js.map create mode 100644 priv/static/static/js/31.f4fb830b17ba4aa43cb0.js create mode 100644 priv/static/static/js/31.f4fb830b17ba4aa43cb0.js.map create mode 100644 priv/static/static/js/32.e0c1e549e0806ed8c97e.js create mode 100644 priv/static/static/js/32.e0c1e549e0806ed8c97e.js.map delete mode 100644 priv/static/static/js/32.f628f72f0c04549e3d56.js delete mode 100644 priv/static/static/js/32.f628f72f0c04549e3d56.js.map delete mode 100644 priv/static/static/js/4.14dd3a6fcb972eb61829.js delete mode 100644 priv/static/static/js/4.14dd3a6fcb972eb61829.js.map create mode 100644 priv/static/static/js/4.ae27cb41b81c1d0fb12b.js create mode 100644 priv/static/static/js/4.ae27cb41b81c1d0fb12b.js.map delete mode 100644 priv/static/static/js/5.41ab92595cefc4c72fe0.js delete mode 100644 priv/static/static/js/5.41ab92595cefc4c72fe0.js.map create mode 100644 priv/static/static/js/5.730f6dd69f3216d24320.js create mode 100644 priv/static/static/js/5.730f6dd69f3216d24320.js.map create mode 100644 priv/static/static/js/6.17d3d7ef67c646d7d9e2.js create mode 100644 priv/static/static/js/6.17d3d7ef67c646d7d9e2.js.map delete mode 100644 priv/static/static/js/6.22a79587289c1f1e1e99.js delete mode 100644 priv/static/static/js/6.22a79587289c1f1e1e99.js.map create mode 100644 priv/static/static/js/7.c7fec9856bb057372873.js create mode 100644 priv/static/static/js/7.c7fec9856bb057372873.js.map delete mode 100644 priv/static/static/js/7.cf211d851ab1c77ec4c3.js delete mode 100644 priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map delete mode 100644 priv/static/static/js/8.08dd17e532ddcdd39742.js delete mode 100644 priv/static/static/js/8.08dd17e532ddcdd39742.js.map create mode 100644 priv/static/static/js/8.c3a32861cd869f7892e5.js create mode 100644 priv/static/static/js/8.c3a32861cd869f7892e5.js.map delete mode 100644 priv/static/static/js/9.1ea2330cb884e98f8257.js delete mode 100644 priv/static/static/js/9.1ea2330cb884e98f8257.js.map create mode 100644 priv/static/static/js/9.2d36a607172a0f72bb59.js create mode 100644 priv/static/static/js/9.2d36a607172a0f72bb59.js.map create mode 100644 priv/static/static/js/app.2e518bb8cf82de7a72b0.js create mode 100644 priv/static/static/js/app.2e518bb8cf82de7a72b0.js.map delete mode 100644 priv/static/static/js/app.c6b8a1c86149ed63e6ff.js delete mode 100644 priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map create mode 100644 priv/static/static/js/vendors~app.102a26590d3ba87dd908.js create mode 100644 priv/static/static/js/vendors~app.102a26590d3ba87dd908.js.map delete mode 100644 priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js delete mode 100644 priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map diff --git a/priv/static/index.html b/priv/static/index.html index 79d67c4c2..88bf1484d 100644 --- a/priv/static/index.html +++ b/priv/static/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/priv/static/static/js/10.8702741bef65422a8655.js b/priv/static/static/js/10.8702741bef65422a8655.js deleted file mode 100644 index 0a0795bcd..000000000 Binary files a/priv/static/static/js/10.8702741bef65422a8655.js and /dev/null differ diff --git a/priv/static/static/js/10.8702741bef65422a8655.js.map b/priv/static/static/js/10.8702741bef65422a8655.js.map deleted file mode 100644 index cb936cec1..000000000 Binary files a/priv/static/static/js/10.8702741bef65422a8655.js.map and /dev/null differ diff --git a/priv/static/static/js/10.9a138b362edd4833778a.js b/priv/static/static/js/10.9a138b362edd4833778a.js new file mode 100644 index 000000000..0518eec26 Binary files /dev/null and b/priv/static/static/js/10.9a138b362edd4833778a.js differ diff --git a/priv/static/static/js/10.9a138b362edd4833778a.js.map b/priv/static/static/js/10.9a138b362edd4833778a.js.map new file mode 100644 index 000000000..6a0c72332 Binary files /dev/null and b/priv/static/static/js/10.9a138b362edd4833778a.js.map differ diff --git a/priv/static/static/js/11.9d88e9e710c4e0d0c897.js b/priv/static/static/js/11.9d88e9e710c4e0d0c897.js new file mode 100644 index 000000000..cbfd37408 Binary files /dev/null and b/priv/static/static/js/11.9d88e9e710c4e0d0c897.js differ diff --git a/priv/static/static/js/11.9d88e9e710c4e0d0c897.js.map b/priv/static/static/js/11.9d88e9e710c4e0d0c897.js.map new file mode 100644 index 000000000..ae6a2b9c4 Binary files /dev/null and b/priv/static/static/js/11.9d88e9e710c4e0d0c897.js.map differ diff --git a/priv/static/static/js/11.a3e462fd9190986433f8.js b/priv/static/static/js/11.a3e462fd9190986433f8.js deleted file mode 100644 index 6b49bb02d..000000000 Binary files a/priv/static/static/js/11.a3e462fd9190986433f8.js and /dev/null differ diff --git a/priv/static/static/js/11.a3e462fd9190986433f8.js.map b/priv/static/static/js/11.a3e462fd9190986433f8.js.map deleted file mode 100644 index 496d6a6f1..000000000 Binary files a/priv/static/static/js/11.a3e462fd9190986433f8.js.map and /dev/null differ diff --git a/priv/static/static/js/12.36ee26c30e2909c8be60.js b/priv/static/static/js/12.36ee26c30e2909c8be60.js new file mode 100644 index 000000000..418717dfc Binary files /dev/null and b/priv/static/static/js/12.36ee26c30e2909c8be60.js differ diff --git a/priv/static/static/js/12.36ee26c30e2909c8be60.js.map b/priv/static/static/js/12.36ee26c30e2909c8be60.js.map new file mode 100644 index 000000000..1f9de123e Binary files /dev/null and b/priv/static/static/js/12.36ee26c30e2909c8be60.js.map differ diff --git a/priv/static/static/js/12.7d5889019e7177d19bc2.js b/priv/static/static/js/12.7d5889019e7177d19bc2.js deleted file mode 100644 index 6dc87809f..000000000 Binary files a/priv/static/static/js/12.7d5889019e7177d19bc2.js and /dev/null differ diff --git a/priv/static/static/js/12.7d5889019e7177d19bc2.js.map b/priv/static/static/js/12.7d5889019e7177d19bc2.js.map deleted file mode 100644 index cf9631696..000000000 Binary files a/priv/static/static/js/12.7d5889019e7177d19bc2.js.map and /dev/null differ diff --git a/priv/static/static/js/13.bb129366e7d54b5678d4.js b/priv/static/static/js/13.bb129366e7d54b5678d4.js deleted file mode 100644 index 8c73a0022..000000000 Binary files a/priv/static/static/js/13.bb129366e7d54b5678d4.js and /dev/null differ diff --git a/priv/static/static/js/13.bb129366e7d54b5678d4.js.map b/priv/static/static/js/13.bb129366e7d54b5678d4.js.map deleted file mode 100644 index b5a0af8a3..000000000 Binary files a/priv/static/static/js/13.bb129366e7d54b5678d4.js.map and /dev/null differ diff --git a/priv/static/static/js/13.d02023d426b44a6886af.js b/priv/static/static/js/13.d02023d426b44a6886af.js new file mode 100644 index 000000000..13f1abcb0 Binary files /dev/null and b/priv/static/static/js/13.d02023d426b44a6886af.js differ diff --git a/priv/static/static/js/13.d02023d426b44a6886af.js.map b/priv/static/static/js/13.d02023d426b44a6886af.js.map new file mode 100644 index 000000000..a202df0d2 Binary files /dev/null and b/priv/static/static/js/13.d02023d426b44a6886af.js.map differ diff --git a/priv/static/static/js/14.3546063198fc4cb3852c.js b/priv/static/static/js/14.3546063198fc4cb3852c.js deleted file mode 100644 index 8897a50ce..000000000 Binary files a/priv/static/static/js/14.3546063198fc4cb3852c.js and /dev/null differ diff --git a/priv/static/static/js/14.3546063198fc4cb3852c.js.map b/priv/static/static/js/14.3546063198fc4cb3852c.js.map deleted file mode 100644 index e7596b961..000000000 Binary files a/priv/static/static/js/14.3546063198fc4cb3852c.js.map and /dev/null differ diff --git a/priv/static/static/js/14.8e7c0873d041b34efd84.js b/priv/static/static/js/14.8e7c0873d041b34efd84.js new file mode 100644 index 000000000..74432f43d Binary files /dev/null and b/priv/static/static/js/14.8e7c0873d041b34efd84.js differ diff --git a/priv/static/static/js/14.8e7c0873d041b34efd84.js.map b/priv/static/static/js/14.8e7c0873d041b34efd84.js.map new file mode 100644 index 000000000..e73fcfe38 Binary files /dev/null and b/priv/static/static/js/14.8e7c0873d041b34efd84.js.map differ diff --git a/priv/static/static/js/15.349c342e2fe7e9e0fe01.js b/priv/static/static/js/15.349c342e2fe7e9e0fe01.js new file mode 100644 index 000000000..f77855cfc Binary files /dev/null and b/priv/static/static/js/15.349c342e2fe7e9e0fe01.js differ diff --git a/priv/static/static/js/15.349c342e2fe7e9e0fe01.js.map b/priv/static/static/js/15.349c342e2fe7e9e0fe01.js.map new file mode 100644 index 000000000..d9394d405 Binary files /dev/null and b/priv/static/static/js/15.349c342e2fe7e9e0fe01.js.map differ diff --git a/priv/static/static/js/15.e0cc6ce336f523c26f4d.js b/priv/static/static/js/15.e0cc6ce336f523c26f4d.js deleted file mode 100644 index ec162d862..000000000 Binary files a/priv/static/static/js/15.e0cc6ce336f523c26f4d.js and /dev/null differ diff --git a/priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map b/priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map deleted file mode 100644 index d6ec98aaf..000000000 Binary files a/priv/static/static/js/15.e0cc6ce336f523c26f4d.js.map and /dev/null differ diff --git a/priv/static/static/js/16.67b2bcf7dd3271e31643.js b/priv/static/static/js/16.67b2bcf7dd3271e31643.js deleted file mode 100644 index b4f1fcb57..000000000 Binary files a/priv/static/static/js/16.67b2bcf7dd3271e31643.js and /dev/null differ diff --git a/priv/static/static/js/16.67b2bcf7dd3271e31643.js.map b/priv/static/static/js/16.67b2bcf7dd3271e31643.js.map deleted file mode 100644 index 31f00875c..000000000 Binary files a/priv/static/static/js/16.67b2bcf7dd3271e31643.js.map and /dev/null differ diff --git a/priv/static/static/js/16.cf210505237c2a0040dd.js b/priv/static/static/js/16.cf210505237c2a0040dd.js new file mode 100644 index 000000000..4341c4e6e Binary files /dev/null and b/priv/static/static/js/16.cf210505237c2a0040dd.js differ diff --git a/priv/static/static/js/16.cf210505237c2a0040dd.js.map b/priv/static/static/js/16.cf210505237c2a0040dd.js.map new file mode 100644 index 000000000..e6c3a7b56 Binary files /dev/null and b/priv/static/static/js/16.cf210505237c2a0040dd.js.map differ diff --git a/priv/static/static/js/17.a8395e49508cd81ecdf4.js b/priv/static/static/js/17.a8395e49508cd81ecdf4.js deleted file mode 100644 index 0b90485ff..000000000 Binary files a/priv/static/static/js/17.a8395e49508cd81ecdf4.js and /dev/null differ diff --git a/priv/static/static/js/17.a8395e49508cd81ecdf4.js.map b/priv/static/static/js/17.a8395e49508cd81ecdf4.js.map deleted file mode 100644 index 33b1c8e34..000000000 Binary files a/priv/static/static/js/17.a8395e49508cd81ecdf4.js.map and /dev/null differ diff --git a/priv/static/static/js/17.fe52ece512025177a3b8.js b/priv/static/static/js/17.fe52ece512025177a3b8.js new file mode 100644 index 000000000..25d7ed77c Binary files /dev/null and b/priv/static/static/js/17.fe52ece512025177a3b8.js differ diff --git a/priv/static/static/js/17.fe52ece512025177a3b8.js.map b/priv/static/static/js/17.fe52ece512025177a3b8.js.map new file mode 100644 index 000000000..cfdd5717d Binary files /dev/null and b/priv/static/static/js/17.fe52ece512025177a3b8.js.map differ diff --git a/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js b/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js deleted file mode 100644 index 621616a3f..000000000 Binary files a/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js and /dev/null differ diff --git a/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map b/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map deleted file mode 100644 index 46f4d2a0c..000000000 Binary files a/priv/static/static/js/18.1b9a9aedd06803dbb3e4.js.map and /dev/null differ diff --git a/priv/static/static/js/18.c0d447ff77030482a94c.js b/priv/static/static/js/18.c0d447ff77030482a94c.js new file mode 100644 index 000000000..4bb119120 Binary files /dev/null and b/priv/static/static/js/18.c0d447ff77030482a94c.js differ diff --git a/priv/static/static/js/18.c0d447ff77030482a94c.js.map b/priv/static/static/js/18.c0d447ff77030482a94c.js.map new file mode 100644 index 000000000..d2ff3aa95 Binary files /dev/null and b/priv/static/static/js/18.c0d447ff77030482a94c.js.map differ diff --git a/priv/static/static/js/19.9b0c21b72dedc1b244bd.js b/priv/static/static/js/19.9b0c21b72dedc1b244bd.js new file mode 100644 index 000000000..0c8605d10 Binary files /dev/null and b/priv/static/static/js/19.9b0c21b72dedc1b244bd.js differ diff --git a/priv/static/static/js/19.9b0c21b72dedc1b244bd.js.map b/priv/static/static/js/19.9b0c21b72dedc1b244bd.js.map new file mode 100644 index 000000000..8f3305b3a Binary files /dev/null and b/priv/static/static/js/19.9b0c21b72dedc1b244bd.js.map differ diff --git a/priv/static/static/js/19.af8826ed7cd146d80620.js b/priv/static/static/js/19.af8826ed7cd146d80620.js deleted file mode 100644 index d941e222e..000000000 Binary files a/priv/static/static/js/19.af8826ed7cd146d80620.js and /dev/null differ diff --git a/priv/static/static/js/19.af8826ed7cd146d80620.js.map b/priv/static/static/js/19.af8826ed7cd146d80620.js.map deleted file mode 100644 index 886699ead..000000000 Binary files a/priv/static/static/js/19.af8826ed7cd146d80620.js.map and /dev/null differ diff --git a/priv/static/static/js/2.80ae75b951121aacd208.js b/priv/static/static/js/2.80ae75b951121aacd208.js new file mode 100644 index 000000000..e2e37bf88 Binary files /dev/null and b/priv/static/static/js/2.80ae75b951121aacd208.js differ diff --git a/priv/static/static/js/2.80ae75b951121aacd208.js.map b/priv/static/static/js/2.80ae75b951121aacd208.js.map new file mode 100644 index 000000000..5528b7116 Binary files /dev/null and b/priv/static/static/js/2.80ae75b951121aacd208.js.map differ diff --git a/priv/static/static/js/2.cac6da00a889ad330fef.js b/priv/static/static/js/2.cac6da00a889ad330fef.js deleted file mode 100644 index 0e34c12d2..000000000 Binary files a/priv/static/static/js/2.cac6da00a889ad330fef.js and /dev/null differ diff --git a/priv/static/static/js/2.cac6da00a889ad330fef.js.map b/priv/static/static/js/2.cac6da00a889ad330fef.js.map deleted file mode 100644 index 05f611b86..000000000 Binary files a/priv/static/static/js/2.cac6da00a889ad330fef.js.map and /dev/null differ diff --git a/priv/static/static/js/20.c45b976fb08603acced8.js b/priv/static/static/js/20.c45b976fb08603acced8.js deleted file mode 100644 index 6012aebb1..000000000 Binary files a/priv/static/static/js/20.c45b976fb08603acced8.js and /dev/null differ diff --git a/priv/static/static/js/20.c45b976fb08603acced8.js.map b/priv/static/static/js/20.c45b976fb08603acced8.js.map deleted file mode 100644 index c0cc39285..000000000 Binary files a/priv/static/static/js/20.c45b976fb08603acced8.js.map and /dev/null differ diff --git a/priv/static/static/js/20.fee3cd69d629f271e653.js b/priv/static/static/js/20.fee3cd69d629f271e653.js new file mode 100644 index 000000000..8dc617e25 Binary files /dev/null and b/priv/static/static/js/20.fee3cd69d629f271e653.js differ diff --git a/priv/static/static/js/20.fee3cd69d629f271e653.js.map b/priv/static/static/js/20.fee3cd69d629f271e653.js.map new file mode 100644 index 000000000..b80afa931 Binary files /dev/null and b/priv/static/static/js/20.fee3cd69d629f271e653.js.map differ diff --git a/priv/static/static/js/21.11c34dd4260444732ab0.js b/priv/static/static/js/21.11c34dd4260444732ab0.js deleted file mode 100644 index b5b0d7403..000000000 Binary files a/priv/static/static/js/21.11c34dd4260444732ab0.js and /dev/null differ diff --git a/priv/static/static/js/21.11c34dd4260444732ab0.js.map b/priv/static/static/js/21.11c34dd4260444732ab0.js.map deleted file mode 100644 index 11b0f1cdb..000000000 Binary files a/priv/static/static/js/21.11c34dd4260444732ab0.js.map and /dev/null differ diff --git a/priv/static/static/js/21.9b5434a9d2b0b07a3038.js b/priv/static/static/js/21.9b5434a9d2b0b07a3038.js new file mode 100644 index 000000000..e01b51a44 Binary files /dev/null and b/priv/static/static/js/21.9b5434a9d2b0b07a3038.js differ diff --git a/priv/static/static/js/21.9b5434a9d2b0b07a3038.js.map b/priv/static/static/js/21.9b5434a9d2b0b07a3038.js.map new file mode 100644 index 000000000..cb2792ac9 Binary files /dev/null and b/priv/static/static/js/21.9b5434a9d2b0b07a3038.js.map differ diff --git a/priv/static/static/js/22.132b7fba6bee9817b39f.js b/priv/static/static/js/22.132b7fba6bee9817b39f.js new file mode 100644 index 000000000..a0f30bc81 Binary files /dev/null and b/priv/static/static/js/22.132b7fba6bee9817b39f.js differ diff --git a/priv/static/static/js/22.132b7fba6bee9817b39f.js.map b/priv/static/static/js/22.132b7fba6bee9817b39f.js.map new file mode 100644 index 000000000..5b54e2be5 Binary files /dev/null and b/priv/static/static/js/22.132b7fba6bee9817b39f.js.map differ diff --git a/priv/static/static/js/22.6155d82624c0297d5694.js b/priv/static/static/js/22.6155d82624c0297d5694.js deleted file mode 100644 index 7054f1a7c..000000000 Binary files a/priv/static/static/js/22.6155d82624c0297d5694.js and /dev/null differ diff --git a/priv/static/static/js/22.6155d82624c0297d5694.js.map b/priv/static/static/js/22.6155d82624c0297d5694.js.map deleted file mode 100644 index 721b74faf..000000000 Binary files a/priv/static/static/js/22.6155d82624c0297d5694.js.map and /dev/null differ diff --git a/priv/static/static/js/23.63b95894e9f0eb300da0.js b/priv/static/static/js/23.63b95894e9f0eb300da0.js new file mode 100644 index 000000000..aeef30063 Binary files /dev/null and b/priv/static/static/js/23.63b95894e9f0eb300da0.js differ diff --git a/priv/static/static/js/23.63b95894e9f0eb300da0.js.map b/priv/static/static/js/23.63b95894e9f0eb300da0.js.map new file mode 100644 index 000000000..dbd9ba11e Binary files /dev/null and b/priv/static/static/js/23.63b95894e9f0eb300da0.js.map differ diff --git a/priv/static/static/js/23.d89535c0e277447a45a7.js b/priv/static/static/js/23.d89535c0e277447a45a7.js deleted file mode 100644 index 8979bc0fe..000000000 Binary files a/priv/static/static/js/23.d89535c0e277447a45a7.js and /dev/null differ diff --git a/priv/static/static/js/23.d89535c0e277447a45a7.js.map b/priv/static/static/js/23.d89535c0e277447a45a7.js.map deleted file mode 100644 index 336c6ecd4..000000000 Binary files a/priv/static/static/js/23.d89535c0e277447a45a7.js.map and /dev/null differ diff --git a/priv/static/static/js/24.10dc1eadca8b0bc15e20.js b/priv/static/static/js/24.10dc1eadca8b0bc15e20.js new file mode 100644 index 000000000..ed3bab7cc Binary files /dev/null and b/priv/static/static/js/24.10dc1eadca8b0bc15e20.js differ diff --git a/priv/static/static/js/24.10dc1eadca8b0bc15e20.js.map b/priv/static/static/js/24.10dc1eadca8b0bc15e20.js.map new file mode 100644 index 000000000..82709d683 Binary files /dev/null and b/priv/static/static/js/24.10dc1eadca8b0bc15e20.js.map differ diff --git a/priv/static/static/js/24.4693bde7d2a49831dbe2.js b/priv/static/static/js/24.4693bde7d2a49831dbe2.js deleted file mode 100644 index 7faf73baa..000000000 Binary files a/priv/static/static/js/24.4693bde7d2a49831dbe2.js and /dev/null differ diff --git a/priv/static/static/js/24.4693bde7d2a49831dbe2.js.map b/priv/static/static/js/24.4693bde7d2a49831dbe2.js.map deleted file mode 100644 index 1b2573a33..000000000 Binary files a/priv/static/static/js/24.4693bde7d2a49831dbe2.js.map and /dev/null differ diff --git a/priv/static/static/js/25.8f7cea2eb70da626b21d.js b/priv/static/static/js/25.8f7cea2eb70da626b21d.js deleted file mode 100644 index 726304c49..000000000 Binary files a/priv/static/static/js/25.8f7cea2eb70da626b21d.js and /dev/null differ diff --git a/priv/static/static/js/25.8f7cea2eb70da626b21d.js.map b/priv/static/static/js/25.8f7cea2eb70da626b21d.js.map deleted file mode 100644 index c8e52eac5..000000000 Binary files a/priv/static/static/js/25.8f7cea2eb70da626b21d.js.map and /dev/null differ diff --git a/priv/static/static/js/25.e2e834e1b024960e0087.js b/priv/static/static/js/25.e2e834e1b024960e0087.js new file mode 100644 index 000000000..c2caf0d62 Binary files /dev/null and b/priv/static/static/js/25.e2e834e1b024960e0087.js differ diff --git a/priv/static/static/js/25.e2e834e1b024960e0087.js.map b/priv/static/static/js/25.e2e834e1b024960e0087.js.map new file mode 100644 index 000000000..e4967e625 Binary files /dev/null and b/priv/static/static/js/25.e2e834e1b024960e0087.js.map differ diff --git a/priv/static/static/js/26.3f806866a23f516b7e87.js b/priv/static/static/js/26.3f806866a23f516b7e87.js deleted file mode 100644 index 48273248b..000000000 Binary files a/priv/static/static/js/26.3f806866a23f516b7e87.js and /dev/null differ diff --git a/priv/static/static/js/26.3f806866a23f516b7e87.js.map b/priv/static/static/js/26.3f806866a23f516b7e87.js.map deleted file mode 100644 index 68cc924a8..000000000 Binary files a/priv/static/static/js/26.3f806866a23f516b7e87.js.map and /dev/null differ diff --git a/priv/static/static/js/26.74667f919f7bad826ea0.js b/priv/static/static/js/26.74667f919f7bad826ea0.js new file mode 100644 index 000000000..712c57182 Binary files /dev/null and b/priv/static/static/js/26.74667f919f7bad826ea0.js differ diff --git a/priv/static/static/js/26.74667f919f7bad826ea0.js.map b/priv/static/static/js/26.74667f919f7bad826ea0.js.map new file mode 100644 index 000000000..43a64a1fb Binary files /dev/null and b/priv/static/static/js/26.74667f919f7bad826ea0.js.map differ diff --git a/priv/static/static/js/27.0af03540f78df63eddca.js b/priv/static/static/js/27.0af03540f78df63eddca.js new file mode 100644 index 000000000..86d8c0045 Binary files /dev/null and b/priv/static/static/js/27.0af03540f78df63eddca.js differ diff --git a/priv/static/static/js/27.0af03540f78df63eddca.js.map b/priv/static/static/js/27.0af03540f78df63eddca.js.map new file mode 100644 index 000000000..a1e846519 Binary files /dev/null and b/priv/static/static/js/27.0af03540f78df63eddca.js.map differ diff --git a/priv/static/static/js/27.2d655ddddf874f532191.js b/priv/static/static/js/27.2d655ddddf874f532191.js deleted file mode 100644 index b52d610aa..000000000 Binary files a/priv/static/static/js/27.2d655ddddf874f532191.js and /dev/null differ diff --git a/priv/static/static/js/27.2d655ddddf874f532191.js.map b/priv/static/static/js/27.2d655ddddf874f532191.js.map deleted file mode 100644 index 0042ffa62..000000000 Binary files a/priv/static/static/js/27.2d655ddddf874f532191.js.map and /dev/null differ diff --git a/priv/static/static/js/28.599a889517f15c01b27e.js b/priv/static/static/js/28.599a889517f15c01b27e.js new file mode 100644 index 000000000..6f02d5cf6 Binary files /dev/null and b/priv/static/static/js/28.599a889517f15c01b27e.js differ diff --git a/priv/static/static/js/28.599a889517f15c01b27e.js.map b/priv/static/static/js/28.599a889517f15c01b27e.js.map new file mode 100644 index 000000000..d12cd5dae Binary files /dev/null and b/priv/static/static/js/28.599a889517f15c01b27e.js.map differ diff --git a/priv/static/static/js/28.f738a8b568b00299a569.js b/priv/static/static/js/28.f738a8b568b00299a569.js deleted file mode 100644 index 64de7926b..000000000 Binary files a/priv/static/static/js/28.f738a8b568b00299a569.js and /dev/null differ diff --git a/priv/static/static/js/28.f738a8b568b00299a569.js.map b/priv/static/static/js/28.f738a8b568b00299a569.js.map deleted file mode 100644 index 1e1aa98e3..000000000 Binary files a/priv/static/static/js/28.f738a8b568b00299a569.js.map and /dev/null differ diff --git a/priv/static/static/js/29.3fc5f707254d05a94c4e.js b/priv/static/static/js/29.3fc5f707254d05a94c4e.js new file mode 100644 index 000000000..fbb53794e Binary files /dev/null and b/priv/static/static/js/29.3fc5f707254d05a94c4e.js differ diff --git a/priv/static/static/js/29.3fc5f707254d05a94c4e.js.map b/priv/static/static/js/29.3fc5f707254d05a94c4e.js.map new file mode 100644 index 000000000..d9dc3432e Binary files /dev/null and b/priv/static/static/js/29.3fc5f707254d05a94c4e.js.map differ diff --git a/priv/static/static/js/29.64d5389501dc6e6c77f2.js b/priv/static/static/js/29.64d5389501dc6e6c77f2.js deleted file mode 100644 index 6d1246a86..000000000 Binary files a/priv/static/static/js/29.64d5389501dc6e6c77f2.js and /dev/null differ diff --git a/priv/static/static/js/29.64d5389501dc6e6c77f2.js.map b/priv/static/static/js/29.64d5389501dc6e6c77f2.js.map deleted file mode 100644 index 075022565..000000000 Binary files a/priv/static/static/js/29.64d5389501dc6e6c77f2.js.map and /dev/null differ diff --git a/priv/static/static/js/3.716f85efb43de512faf0.js b/priv/static/static/js/3.716f85efb43de512faf0.js new file mode 100644 index 000000000..c62e430f2 Binary files /dev/null and b/priv/static/static/js/3.716f85efb43de512faf0.js differ diff --git a/priv/static/static/js/3.716f85efb43de512faf0.js.map b/priv/static/static/js/3.716f85efb43de512faf0.js.map new file mode 100644 index 000000000..877f25345 Binary files /dev/null and b/priv/static/static/js/3.716f85efb43de512faf0.js.map differ diff --git a/priv/static/static/js/3.91e3846705ce522e8366.js b/priv/static/static/js/3.91e3846705ce522e8366.js deleted file mode 100644 index a01c4760a..000000000 Binary files a/priv/static/static/js/3.91e3846705ce522e8366.js and /dev/null differ diff --git a/priv/static/static/js/3.91e3846705ce522e8366.js.map b/priv/static/static/js/3.91e3846705ce522e8366.js.map deleted file mode 100644 index dba83509c..000000000 Binary files a/priv/static/static/js/3.91e3846705ce522e8366.js.map and /dev/null differ diff --git a/priv/static/static/js/30.af9dba19236c2e02ceb0.js b/priv/static/static/js/30.af9dba19236c2e02ceb0.js new file mode 100644 index 000000000..dda2ec2cb Binary files /dev/null and b/priv/static/static/js/30.af9dba19236c2e02ceb0.js differ diff --git a/priv/static/static/js/30.af9dba19236c2e02ceb0.js.map b/priv/static/static/js/30.af9dba19236c2e02ceb0.js.map new file mode 100644 index 000000000..e3094bf26 Binary files /dev/null and b/priv/static/static/js/30.af9dba19236c2e02ceb0.js.map differ diff --git a/priv/static/static/js/30.d0724c72975d6ce2243c.js b/priv/static/static/js/30.d0724c72975d6ce2243c.js deleted file mode 100644 index 04132ef83..000000000 Binary files a/priv/static/static/js/30.d0724c72975d6ce2243c.js and /dev/null differ diff --git a/priv/static/static/js/30.d0724c72975d6ce2243c.js.map b/priv/static/static/js/30.d0724c72975d6ce2243c.js.map deleted file mode 100644 index 330ad3596..000000000 Binary files a/priv/static/static/js/30.d0724c72975d6ce2243c.js.map and /dev/null differ diff --git a/priv/static/static/js/31.31627923fc0b0d75672f.js b/priv/static/static/js/31.31627923fc0b0d75672f.js deleted file mode 100644 index 1dfae7798..000000000 Binary files a/priv/static/static/js/31.31627923fc0b0d75672f.js and /dev/null differ diff --git a/priv/static/static/js/31.31627923fc0b0d75672f.js.map b/priv/static/static/js/31.31627923fc0b0d75672f.js.map deleted file mode 100644 index 52ae7f8af..000000000 Binary files a/priv/static/static/js/31.31627923fc0b0d75672f.js.map and /dev/null differ diff --git a/priv/static/static/js/31.f4fb830b17ba4aa43cb0.js b/priv/static/static/js/31.f4fb830b17ba4aa43cb0.js new file mode 100644 index 000000000..65edaa3dd Binary files /dev/null and b/priv/static/static/js/31.f4fb830b17ba4aa43cb0.js differ diff --git a/priv/static/static/js/31.f4fb830b17ba4aa43cb0.js.map b/priv/static/static/js/31.f4fb830b17ba4aa43cb0.js.map new file mode 100644 index 000000000..4157d56ad Binary files /dev/null and b/priv/static/static/js/31.f4fb830b17ba4aa43cb0.js.map differ diff --git a/priv/static/static/js/32.e0c1e549e0806ed8c97e.js b/priv/static/static/js/32.e0c1e549e0806ed8c97e.js new file mode 100644 index 000000000..12e61f91a Binary files /dev/null and b/priv/static/static/js/32.e0c1e549e0806ed8c97e.js differ diff --git a/priv/static/static/js/32.e0c1e549e0806ed8c97e.js.map b/priv/static/static/js/32.e0c1e549e0806ed8c97e.js.map new file mode 100644 index 000000000..a30317255 Binary files /dev/null and b/priv/static/static/js/32.e0c1e549e0806ed8c97e.js.map differ diff --git a/priv/static/static/js/32.f628f72f0c04549e3d56.js b/priv/static/static/js/32.f628f72f0c04549e3d56.js deleted file mode 100644 index 1fd7b588f..000000000 Binary files a/priv/static/static/js/32.f628f72f0c04549e3d56.js and /dev/null differ diff --git a/priv/static/static/js/32.f628f72f0c04549e3d56.js.map b/priv/static/static/js/32.f628f72f0c04549e3d56.js.map deleted file mode 100644 index 8a5717322..000000000 Binary files a/priv/static/static/js/32.f628f72f0c04549e3d56.js.map and /dev/null differ diff --git a/priv/static/static/js/4.14dd3a6fcb972eb61829.js b/priv/static/static/js/4.14dd3a6fcb972eb61829.js deleted file mode 100644 index a92d5cc42..000000000 Binary files a/priv/static/static/js/4.14dd3a6fcb972eb61829.js and /dev/null differ diff --git a/priv/static/static/js/4.14dd3a6fcb972eb61829.js.map b/priv/static/static/js/4.14dd3a6fcb972eb61829.js.map deleted file mode 100644 index 3a5561a41..000000000 Binary files a/priv/static/static/js/4.14dd3a6fcb972eb61829.js.map and /dev/null differ diff --git a/priv/static/static/js/4.ae27cb41b81c1d0fb12b.js b/priv/static/static/js/4.ae27cb41b81c1d0fb12b.js new file mode 100644 index 000000000..36db0a49a Binary files /dev/null and b/priv/static/static/js/4.ae27cb41b81c1d0fb12b.js differ diff --git a/priv/static/static/js/4.ae27cb41b81c1d0fb12b.js.map b/priv/static/static/js/4.ae27cb41b81c1d0fb12b.js.map new file mode 100644 index 000000000..2885b8635 Binary files /dev/null and b/priv/static/static/js/4.ae27cb41b81c1d0fb12b.js.map differ diff --git a/priv/static/static/js/5.41ab92595cefc4c72fe0.js b/priv/static/static/js/5.41ab92595cefc4c72fe0.js deleted file mode 100644 index 4a7b85b13..000000000 Binary files a/priv/static/static/js/5.41ab92595cefc4c72fe0.js and /dev/null differ diff --git a/priv/static/static/js/5.41ab92595cefc4c72fe0.js.map b/priv/static/static/js/5.41ab92595cefc4c72fe0.js.map deleted file mode 100644 index 74e16ebfa..000000000 Binary files a/priv/static/static/js/5.41ab92595cefc4c72fe0.js.map and /dev/null differ diff --git a/priv/static/static/js/5.730f6dd69f3216d24320.js b/priv/static/static/js/5.730f6dd69f3216d24320.js new file mode 100644 index 000000000..b9f9e7ce8 Binary files /dev/null and b/priv/static/static/js/5.730f6dd69f3216d24320.js differ diff --git a/priv/static/static/js/5.730f6dd69f3216d24320.js.map b/priv/static/static/js/5.730f6dd69f3216d24320.js.map new file mode 100644 index 000000000..f6e5d1301 Binary files /dev/null and b/priv/static/static/js/5.730f6dd69f3216d24320.js.map differ diff --git a/priv/static/static/js/6.17d3d7ef67c646d7d9e2.js b/priv/static/static/js/6.17d3d7ef67c646d7d9e2.js new file mode 100644 index 000000000..7c37a2617 Binary files /dev/null and b/priv/static/static/js/6.17d3d7ef67c646d7d9e2.js differ diff --git a/priv/static/static/js/6.17d3d7ef67c646d7d9e2.js.map b/priv/static/static/js/6.17d3d7ef67c646d7d9e2.js.map new file mode 100644 index 000000000..a86efcd83 Binary files /dev/null and b/priv/static/static/js/6.17d3d7ef67c646d7d9e2.js.map differ diff --git a/priv/static/static/js/6.22a79587289c1f1e1e99.js b/priv/static/static/js/6.22a79587289c1f1e1e99.js deleted file mode 100644 index e1b663f59..000000000 Binary files a/priv/static/static/js/6.22a79587289c1f1e1e99.js and /dev/null differ diff --git a/priv/static/static/js/6.22a79587289c1f1e1e99.js.map b/priv/static/static/js/6.22a79587289c1f1e1e99.js.map deleted file mode 100644 index aa2f9be2c..000000000 Binary files a/priv/static/static/js/6.22a79587289c1f1e1e99.js.map and /dev/null differ diff --git a/priv/static/static/js/7.c7fec9856bb057372873.js b/priv/static/static/js/7.c7fec9856bb057372873.js new file mode 100644 index 000000000..3f05de438 Binary files /dev/null and b/priv/static/static/js/7.c7fec9856bb057372873.js differ diff --git a/priv/static/static/js/7.c7fec9856bb057372873.js.map b/priv/static/static/js/7.c7fec9856bb057372873.js.map new file mode 100644 index 000000000..953c23427 Binary files /dev/null and b/priv/static/static/js/7.c7fec9856bb057372873.js.map differ diff --git a/priv/static/static/js/7.cf211d851ab1c77ec4c3.js b/priv/static/static/js/7.cf211d851ab1c77ec4c3.js deleted file mode 100644 index c013d64c7..000000000 Binary files a/priv/static/static/js/7.cf211d851ab1c77ec4c3.js and /dev/null differ diff --git a/priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map b/priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map deleted file mode 100644 index 16461348e..000000000 Binary files a/priv/static/static/js/7.cf211d851ab1c77ec4c3.js.map and /dev/null differ diff --git a/priv/static/static/js/8.08dd17e532ddcdd39742.js b/priv/static/static/js/8.08dd17e532ddcdd39742.js deleted file mode 100644 index bf83ae385..000000000 Binary files a/priv/static/static/js/8.08dd17e532ddcdd39742.js and /dev/null differ diff --git a/priv/static/static/js/8.08dd17e532ddcdd39742.js.map b/priv/static/static/js/8.08dd17e532ddcdd39742.js.map deleted file mode 100644 index c4c701b5f..000000000 Binary files a/priv/static/static/js/8.08dd17e532ddcdd39742.js.map and /dev/null differ diff --git a/priv/static/static/js/8.c3a32861cd869f7892e5.js b/priv/static/static/js/8.c3a32861cd869f7892e5.js new file mode 100644 index 000000000..1165de321 Binary files /dev/null and b/priv/static/static/js/8.c3a32861cd869f7892e5.js differ diff --git a/priv/static/static/js/8.c3a32861cd869f7892e5.js.map b/priv/static/static/js/8.c3a32861cd869f7892e5.js.map new file mode 100644 index 000000000..1ae964e3d Binary files /dev/null and b/priv/static/static/js/8.c3a32861cd869f7892e5.js.map differ diff --git a/priv/static/static/js/9.1ea2330cb884e98f8257.js b/priv/static/static/js/9.1ea2330cb884e98f8257.js deleted file mode 100644 index 35cc53089..000000000 Binary files a/priv/static/static/js/9.1ea2330cb884e98f8257.js and /dev/null differ diff --git a/priv/static/static/js/9.1ea2330cb884e98f8257.js.map b/priv/static/static/js/9.1ea2330cb884e98f8257.js.map deleted file mode 100644 index f72847ec6..000000000 Binary files a/priv/static/static/js/9.1ea2330cb884e98f8257.js.map and /dev/null differ diff --git a/priv/static/static/js/9.2d36a607172a0f72bb59.js b/priv/static/static/js/9.2d36a607172a0f72bb59.js new file mode 100644 index 000000000..def839c6e Binary files /dev/null and b/priv/static/static/js/9.2d36a607172a0f72bb59.js differ diff --git a/priv/static/static/js/9.2d36a607172a0f72bb59.js.map b/priv/static/static/js/9.2d36a607172a0f72bb59.js.map new file mode 100644 index 000000000..d7ee040c4 Binary files /dev/null and b/priv/static/static/js/9.2d36a607172a0f72bb59.js.map differ diff --git a/priv/static/static/js/app.2e518bb8cf82de7a72b0.js b/priv/static/static/js/app.2e518bb8cf82de7a72b0.js new file mode 100644 index 000000000..f610404a0 Binary files /dev/null and b/priv/static/static/js/app.2e518bb8cf82de7a72b0.js differ diff --git a/priv/static/static/js/app.2e518bb8cf82de7a72b0.js.map b/priv/static/static/js/app.2e518bb8cf82de7a72b0.js.map new file mode 100644 index 000000000..b84a6e676 Binary files /dev/null and b/priv/static/static/js/app.2e518bb8cf82de7a72b0.js.map differ diff --git a/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js b/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js deleted file mode 100644 index 83b640a87..000000000 Binary files a/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js and /dev/null differ diff --git a/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map b/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map deleted file mode 100644 index 742d5229b..000000000 Binary files a/priv/static/static/js/app.c6b8a1c86149ed63e6ff.js.map and /dev/null differ diff --git a/priv/static/static/js/vendors~app.102a26590d3ba87dd908.js b/priv/static/static/js/vendors~app.102a26590d3ba87dd908.js new file mode 100644 index 000000000..d44c7f76b Binary files /dev/null and b/priv/static/static/js/vendors~app.102a26590d3ba87dd908.js differ diff --git a/priv/static/static/js/vendors~app.102a26590d3ba87dd908.js.map b/priv/static/static/js/vendors~app.102a26590d3ba87dd908.js.map new file mode 100644 index 000000000..82a20126a Binary files /dev/null and b/priv/static/static/js/vendors~app.102a26590d3ba87dd908.js.map differ diff --git a/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js b/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js deleted file mode 100644 index 066573a52..000000000 Binary files a/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js and /dev/null differ diff --git a/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map b/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map deleted file mode 100644 index 72d5e4e8a..000000000 Binary files a/priv/static/static/js/vendors~app.3b02e2e5bd8cdca42216.js.map and /dev/null differ diff --git a/priv/static/sw-pleroma.js b/priv/static/sw-pleroma.js index 6731447d4..e42440eb6 100644 Binary files a/priv/static/sw-pleroma.js and b/priv/static/sw-pleroma.js differ diff --git a/priv/static/sw-pleroma.js.map b/priv/static/sw-pleroma.js.map index ed747c6d6..d4c2345e0 100644 Binary files a/priv/static/sw-pleroma.js.map and b/priv/static/sw-pleroma.js.map differ -- cgit v1.2.3 From 1dc5794e2996d09dee22f0156c4a442c8338aa8d Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 22 Feb 2021 14:46:59 -0600 Subject: Never forward the client's user-agent through the media proxy --- lib/pleroma/reverse_proxy.ex | 26 +++++++++---------------- test/pleroma/reverse_proxy_test.exs | 38 +++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/lib/pleroma/reverse_proxy.ex b/lib/pleroma/reverse_proxy.ex index 466906f03..406f7e2b8 100644 --- a/lib/pleroma/reverse_proxy.ex +++ b/lib/pleroma/reverse_proxy.ex @@ -4,7 +4,7 @@ defmodule Pleroma.ReverseProxy do @range_headers ~w(range if-range) - @keep_req_headers ~w(accept user-agent accept-encoding cache-control if-modified-since) ++ + @keep_req_headers ~w(accept accept-encoding cache-control if-modified-since) ++ ~w(if-unmodified-since if-none-match) ++ @range_headers @resp_cache_headers ~w(etag date last-modified) @keep_resp_headers @resp_cache_headers ++ @@ -57,9 +57,6 @@ def default_cache_control_header, do: @default_cache_control_header * `false` will add `content-disposition: attachment` to any request, * a list of whitelisted content types - * `keep_user_agent` will forward the client's user-agent to the upstream. This may be useful if the upstream is - doing content transformation (encoding, …) depending on the request. - * `req_headers`, `resp_headers` additional headers. * `http`: options for [hackney](https://github.com/benoitc/hackney) or [gun](https://github.com/ninenines/gun). @@ -84,8 +81,7 @@ def default_cache_control_header, do: @default_cache_control_header import Plug.Conn @type option() :: - {:keep_user_agent, boolean} - | {:max_read_duration, :timer.time() | :infinity} + {:max_read_duration, :timer.time() | :infinity} | {:max_body_length, non_neg_integer() | :infinity} | {:failed_request_ttl, :timer.time() | :infinity} | {:http, []} @@ -291,17 +287,13 @@ defp build_req_range_or_encoding_header(headers, _opts) do end end - defp build_req_user_agent_header(headers, opts) do - if Keyword.get(opts, :keep_user_agent, false) do - List.keystore( - headers, - "user-agent", - 0, - {"user-agent", Pleroma.Application.user_agent()} - ) - else - headers - end + defp build_req_user_agent_header(headers, _opts) do + List.keystore( + headers, + "user-agent", + 0, + {"user-agent", Pleroma.Application.user_agent()} + ) end defp build_resp_headers(headers, opts) do diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index 499d29c06..863e0c50d 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -18,24 +18,23 @@ defmodule Pleroma.ReverseProxyTest do setup :verify_on_exit! - defp user_agent_mock(user_agent, invokes) do - json = Jason.encode!(%{"user-agent": user_agent}) - + defp user_agent_mock(invokes) do ClientMock - |> expect(:request, fn :get, url, _, _, _ -> + |> expect(:request, fn :get, url, headers, _body, _opts -> Registry.register(ClientMock, url, 0) + body = headers |> Enum.into(%{}) |> Jason.encode!() {:ok, 200, [ {"content-type", "application/json"}, - {"content-length", byte_size(json) |> to_string()} - ], %{url: url}} + {"content-length", byte_size(body) |> to_string()} + ], %{url: url, body: body}} end) - |> expect(:stream_body, invokes, fn %{url: url} = client -> + |> expect(:stream_body, invokes, fn %{url: url, body: body} = client -> case Registry.lookup(ClientMock, url) do [{_, 0}] -> Registry.update_value(ClientMock, url, &(&1 + 1)) - {:ok, json, client} + {:ok, body, client} [{_, 1}] -> Registry.unregister(ClientMock, url) @@ -46,7 +45,7 @@ defp user_agent_mock(user_agent, invokes) do describe "reverse proxy" do test "do not track successful request", %{conn: conn} do - user_agent_mock("hackney/1.15.1", 2) + user_agent_mock(2) url = "/success" conn = ReverseProxy.call(conn, url) @@ -56,18 +55,15 @@ test "do not track successful request", %{conn: conn} do end end - describe "user-agent" do - test "don't keep", %{conn: conn} do - user_agent_mock("hackney/1.15.1", 2) - conn = ReverseProxy.call(conn, "/user-agent") - assert json_response(conn, 200) == %{"user-agent" => "hackney/1.15.1"} - end + test "use Pleroma's user agent in the request; don't pass the client's", %{conn: conn} do + user_agent_mock(2) - test "keep", %{conn: conn} do - user_agent_mock(Pleroma.Application.user_agent(), 2) - conn = ReverseProxy.call(conn, "/user-agent-keep", keep_user_agent: true) - assert json_response(conn, 200) == %{"user-agent" => Pleroma.Application.user_agent()} - end + conn = + conn + |> Plug.Conn.put_req_header("user-agent", "fake/1.0") + |> ReverseProxy.call("/user-agent") + + assert json_response(conn, 200) == %{"user-agent" => Pleroma.Application.user_agent()} end test "closed connection", %{conn: conn} do @@ -114,7 +110,7 @@ defp stream_mock(invokes, with_close? \\ false) do describe "max_body" do test "length returns error if content-length more than option", %{conn: conn} do - user_agent_mock("hackney/1.15.1", 0) + user_agent_mock(0) assert capture_log(fn -> ReverseProxy.call(conn, "/huge-file", max_body_length: 4) -- cgit v1.2.3 From 7ebbe11e7589bdabd1199954f07df05107fd6c41 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 24 Feb 2021 21:37:30 -0600 Subject: user_agent_mock --> request_mock --- test/pleroma/reverse_proxy_test.exs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs index 863e0c50d..a4dd8e99a 100644 --- a/test/pleroma/reverse_proxy_test.exs +++ b/test/pleroma/reverse_proxy_test.exs @@ -18,7 +18,7 @@ defmodule Pleroma.ReverseProxyTest do setup :verify_on_exit! - defp user_agent_mock(invokes) do + defp request_mock(invokes) do ClientMock |> expect(:request, fn :get, url, headers, _body, _opts -> Registry.register(ClientMock, url, 0) @@ -45,7 +45,7 @@ defp user_agent_mock(invokes) do describe "reverse proxy" do test "do not track successful request", %{conn: conn} do - user_agent_mock(2) + request_mock(2) url = "/success" conn = ReverseProxy.call(conn, url) @@ -56,7 +56,7 @@ test "do not track successful request", %{conn: conn} do end test "use Pleroma's user agent in the request; don't pass the client's", %{conn: conn} do - user_agent_mock(2) + request_mock(2) conn = conn @@ -110,7 +110,7 @@ defp stream_mock(invokes, with_close? \\ false) do describe "max_body" do test "length returns error if content-length more than option", %{conn: conn} do - user_agent_mock(0) + request_mock(0) assert capture_log(fn -> ReverseProxy.call(conn, "/huge-file", max_body_length: 4) -- cgit v1.2.3 From 808e15b26479a2ae4ac98f4ba293b570106c7140 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 22 Feb 2021 16:19:08 -0600 Subject: Document user agent leak fix --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 812816f48..ead45f990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Security + +- Fixed client user agent leaking through MediaProxy + ### Removed - `:auth, :enforce_oauth_admin_scope_usage` configuration option. -- cgit v1.2.3 From 9f71b63c2d2c621352d12d1b854afb5beadede68 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 1 Mar 2021 21:12:26 +0100 Subject: Update changelog --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ead45f990..82189336f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## Unreleased +## [2.3.0] - 2020-03-01 ### Security @@ -103,9 +103,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: Support for expires_in/expires_at in the Filters.
-## Unreleased (Patch) - - ## [2.2.2] - 2020-01-18 ### Fixed -- cgit v1.2.3 From cd6aa9bcae84499b165fb4be25f4caaac94c2548 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 1 Mar 2021 21:13:43 +0100 Subject: Mix: Update version number --- mix.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 50d4b4080..46b7746fc 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do def project do [ app: :pleroma, - version: version("2.2.50"), + version: version("2.3.0"), elixir: "~> 1.9", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), -- cgit v1.2.3 From 024c11c18d289d4acd65d749f939ad3684f31905 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 2 Mar 2021 14:40:47 +0100 Subject: StatusController: Deactivate application support for now. Some more things to discuss about, so we'll remove it from 2.3.0 --- .../web/mastodon_api/controllers/status_controller.ex | 19 ++++++++++--------- .../controllers/status_controller_test.exs | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index b051fca74..834222740 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -21,7 +21,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.ScheduledActivityView - alias Pleroma.Web.OAuth.Token + # alias Pleroma.Web.OAuth.Token alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter @@ -420,14 +420,15 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do ) end - defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do - if user.disclose_client do - %{client_name: client_name, website: website} = Repo.preload(token, :app).app - Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) - else - Map.put(params, :generator, nil) - end - end + # Deactivated for 2.3.0 + # defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do + # if user.disclose_client do + # %{client_name: client_name, website: website} = Repo.preload(token, :app).app + # Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) + # else + # Map.put(params, :generator, nil) + # end + # end defp put_application(params, _), do: Map.put(params, :generator, nil) end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index bd385bccd..e76c2760d 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -358,6 +358,7 @@ test "posting a direct status", %{conn: conn} do assert activity.data["cc"] == [] end + @tag :skip test "discloses application metadata when enabled" do user = insert(:user, disclose_client: true) %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"], user: user) -- cgit v1.2.3 From 7d790bb27b7f50a404aaaf23f4768227c3c46ae6 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 2 Mar 2021 14:42:11 +0100 Subject: Changelog: Remove application support line. --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82189336f..a55ebbf8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,7 +63,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) -- The `application` metadata returned with statuses is no longer hardcoded. Apps that want to display these details will now have valid data for new posts after this change.
API Changes -- cgit v1.2.3 From 7dac83eb6e8b7bf47633e629870bced590639bbf Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 2 Mar 2021 15:03:16 +0100 Subject: Linting. --- .../web/mastodon_api/controllers/status_controller.ex | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index 834222740..d1a58d5e1 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -421,13 +421,14 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do end # Deactivated for 2.3.0 - # defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do - # if user.disclose_client do - # %{client_name: client_name, website: website} = Repo.preload(token, :app).app - # Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) - # else - # Map.put(params, :generator, nil) - # end + # defp put_application(params, + # %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do + # if user.disclose_client do + # %{client_name: client_name, website: website} = Repo.preload(token, :app).app + # Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) + # else + # Map.put(params, :generator, nil) + # end # end defp put_application(params, _), do: Map.put(params, :generator, nil) -- cgit v1.2.3 From 0a589c887bd4215e7d443a34c194fd0a3bde8f72 Mon Sep 17 00:00:00 2001 From: lain Date: Tue, 2 Mar 2021 17:03:14 +0100 Subject: Mix: Update linkify. --- mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 46b7746fc..436381f32 100644 --- a/mix.exs +++ b/mix.exs @@ -157,7 +157,7 @@ defp deps do {:floki, "~> 0.27"}, {:timex, "~> 3.6"}, {:ueberauth, "~> 0.4"}, - {:linkify, "~> 0.4.1"}, + {:linkify, "~> 0.5.0"}, {:http_signatures, "~> 0.1.0"}, {:telemetry, "~> 0.3"}, {:poolboy, "~> 1.5"}, diff --git a/mix.lock b/mix.lock index 3e5631c72..99be81826 100644 --- a/mix.lock +++ b/mix.lock @@ -65,7 +65,7 @@ "jose": {:hex, :jose, "1.10.1", "16d8e460dae7203c6d1efa3f277e25b5af8b659febfc2f2eb4bacf87f128b80a", [:mix, :rebar3], [], "hexpm", "3c7ddc8a9394b92891db7c2771da94bf819834a1a4c92e30857b7d582e2f8257"}, "jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"}, "libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"}, - "linkify": {:hex, :linkify, "0.4.1", "f881eb3429ae88010cf736e6fb3eed406c187bcdd544902ec937496636b7c7b3", [:mix], [], "hexpm", "ce98693f54ae9ace59f2f7a8aed3de2ef311381a8ce7794804bd75484c371dda"}, + "linkify": {:hex, :linkify, "0.5.0", "e0ea8de73ff44742d6a889721221f4c4eccaad5284957ee9832ffeb347602d54", [:mix], [], "hexpm", "4ccd958350aee7c51c89e21f05b15d30596ebbba707e051d21766be1809df2d7"}, "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "289cda1b6d0d70ccb2ba508a2b0bd24638db2880", [ref: "289cda1b6d0d70ccb2ba508a2b0bd24638db2880"]}, "makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"}, "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, -- cgit v1.2.3 From 3aae5231b2c8f669eadba9228cece254349dd2aa Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Tue, 2 Mar 2021 20:49:17 +0400 Subject: Add OpenAPI spec for AdminAPI.UserController --- CHANGELOG.md | 1 + lib/pleroma/user.ex | 7 - .../web/admin_api/controllers/user_controller.ex | 128 +++---- lib/pleroma/web/admin_api/views/account_view.ex | 19 +- .../api_spec/operations/admin/user_operation.ex | 389 +++++++++++++++++++++ lib/pleroma/web/router.ex | 2 +- .../admin_api/controllers/user_controller_test.exs | 118 ++++--- 7 files changed, 539 insertions(+), 125 deletions(-) create mode 100644 lib/pleroma/web/api_spec/operations/admin/user_operation.ex diff --git a/CHANGELOG.md b/CHANGELOG.md index 812816f48..78f21e69f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
API Changes - Admin API: (`GET /api/pleroma/admin/users`) filter users by `unconfirmed` status and `actor_type`. +- Admin API: OpenAPI spec for the user-related operations - Pleroma API: `GET /api/v2/pleroma/chats` added. It is exactly like `GET /api/v1/pleroma/chats` except supports pagination. - Pleroma API: Add `idempotency_key` to the chat message entity that can be used for optimistic message sending. - Pleroma API: (`GET /api/v1/pleroma/federation_status`) Add a way to get a list of unreachable instances. diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 9942617d8..c1aa0f716 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -2255,13 +2255,6 @@ def update_background(user, background) do |> update_and_set_cache() end - def roles(%{is_moderator: is_moderator, is_admin: is_admin}) do - %{ - admin: is_admin, - moderator: is_moderator - } - end - def validate_fields(changeset, remote? \\ false) do limit_name = if remote?, do: :max_remote_account_fields, else: :max_account_fields limit = Config.get([:instance, limit_name], 0) diff --git a/lib/pleroma/web/admin_api/controllers/user_controller.ex b/lib/pleroma/web/admin_api/controllers/user_controller.ex index 65bc63cb9..d3e4c18a3 100644 --- a/lib/pleroma/web/admin_api/controllers/user_controller.ex +++ b/lib/pleroma/web/admin_api/controllers/user_controller.ex @@ -13,16 +13,17 @@ defmodule Pleroma.Web.AdminAPI.UserController do alias Pleroma.Web.ActivityPub.Builder alias Pleroma.Web.ActivityPub.Pipeline alias Pleroma.Web.AdminAPI - alias Pleroma.Web.AdminAPI.AccountView alias Pleroma.Web.AdminAPI.Search alias Pleroma.Web.Plugs.OAuthScopesPlug @users_page_size 50 + plug(Pleroma.Web.ApiSpec.CastAndValidate) + plug( OAuthScopesPlug, %{scopes: ["admin:read:accounts"]} - when action in [:list, :show] + when action in [:index, :show] ) plug( @@ -44,13 +45,19 @@ defmodule Pleroma.Web.AdminAPI.UserController do when action in [:follow, :unfollow] ) + plug(:put_view, Pleroma.Web.AdminAPI.AccountView) + action_fallback(AdminAPI.FallbackController) - def delete(conn, %{"nickname" => nickname}) do - delete(conn, %{"nicknames" => [nickname]}) + defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.Admin.UserOperation + + def delete(conn, %{nickname: nickname}) do + conn + |> Map.put(:body_params, %{nicknames: [nickname]}) + |> delete(%{}) end - def delete(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do + def delete(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do users = Enum.map(nicknames, &User.get_cached_by_nickname/1) Enum.each(users, fn user -> @@ -67,10 +74,16 @@ def delete(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do json(conn, nicknames) end - def follow(%{assigns: %{user: admin}} = conn, %{ - "follower" => follower_nick, - "followed" => followed_nick - }) do + def follow( + %{ + assigns: %{user: admin}, + body_params: %{ + follower: follower_nick, + followed: followed_nick + } + } = conn, + _ + ) do with %User{} = follower <- User.get_cached_by_nickname(follower_nick), %User{} = followed <- User.get_cached_by_nickname(followed_nick) do User.follow(follower, followed) @@ -86,10 +99,16 @@ def follow(%{assigns: %{user: admin}} = conn, %{ json(conn, "ok") end - def unfollow(%{assigns: %{user: admin}} = conn, %{ - "follower" => follower_nick, - "followed" => followed_nick - }) do + def unfollow( + %{ + assigns: %{user: admin}, + body_params: %{ + follower: follower_nick, + followed: followed_nick + } + } = conn, + _ + ) do with %User{} = follower <- User.get_cached_by_nickname(follower_nick), %User{} = followed <- User.get_cached_by_nickname(followed_nick) do User.unfollow(follower, followed) @@ -105,9 +124,10 @@ def unfollow(%{assigns: %{user: admin}} = conn, %{ json(conn, "ok") end - def create(%{assigns: %{user: admin}} = conn, %{"users" => users}) do + def create(%{assigns: %{user: admin}, body_params: %{users: users}} = conn, _) do changesets = - Enum.map(users, fn %{"nickname" => nickname, "email" => email, "password" => password} -> + users + |> Enum.map(fn %{nickname: nickname, email: email, password: password} -> user_data = %{ nickname: nickname, name: nickname, @@ -124,52 +144,49 @@ def create(%{assigns: %{user: admin}} = conn, %{"users" => users}) do end) case Pleroma.Repo.transaction(changesets) do - {:ok, users} -> - res = - users + {:ok, users_map} -> + users = + users_map |> Map.values() |> Enum.map(fn user -> {:ok, user} = User.post_register_action(user) user end) - |> Enum.map(&AccountView.render("created.json", %{user: &1})) ModerationLog.insert_log(%{ actor: admin, - subjects: Map.values(users), + subjects: users, action: "create" }) - json(conn, res) + render(conn, "created_many.json", users: users) {:error, id, changeset, _} -> - res = + changesets = Enum.map(changesets.operations, fn - {current_id, {:changeset, _current_changeset, _}} when current_id == id -> - AccountView.render("create-error.json", %{changeset: changeset}) + {^id, {:changeset, _current_changeset, _}} -> + changeset {_, {:changeset, current_changeset, _}} -> - AccountView.render("create-error.json", %{changeset: current_changeset}) + current_changeset end) conn |> put_status(:conflict) - |> json(res) + |> render("create_errors.json", changesets: changesets) end end - def show(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname}) do + def show(%{assigns: %{user: admin}} = conn, %{nickname: nickname}) do with %User{} = user <- User.get_cached_by_nickname_or_id(nickname, for: admin) do - conn - |> put_view(AccountView) - |> render("show.json", %{user: user}) + render(conn, "show.json", %{user: user}) else _ -> {:error, :not_found} end end - def toggle_activation(%{assigns: %{user: admin}} = conn, %{"nickname" => nickname}) do + def toggle_activation(%{assigns: %{user: admin}} = conn, %{nickname: nickname}) do user = User.get_cached_by_nickname(nickname) {:ok, updated_user} = User.set_activation(user, !user.is_active) @@ -182,12 +199,10 @@ def toggle_activation(%{assigns: %{user: admin}} = conn, %{"nickname" => nicknam action: action }) - conn - |> put_view(AccountView) - |> render("show.json", %{user: updated_user}) + render(conn, "show.json", user: updated_user) end - def activate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do + def activate(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do users = Enum.map(nicknames, &User.get_cached_by_nickname/1) {:ok, updated_users} = User.set_activation(users, true) @@ -197,12 +212,10 @@ def activate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do action: "activate" }) - conn - |> put_view(AccountView) - |> render("index.json", %{users: Keyword.values(updated_users)}) + render(conn, "index.json", users: Keyword.values(updated_users)) end - def deactivate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do + def deactivate(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do users = Enum.map(nicknames, &User.get_cached_by_nickname/1) {:ok, updated_users} = User.set_activation(users, false) @@ -212,12 +225,10 @@ def deactivate(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) d action: "deactivate" }) - conn - |> put_view(AccountView) - |> render("index.json", %{users: Keyword.values(updated_users)}) + render(conn, "index.json", users: Keyword.values(updated_users)) end - def approve(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do + def approve(%{assigns: %{user: admin}, body_params: %{nicknames: nicknames}} = conn, _) do users = Enum.map(nicknames, &User.get_cached_by_nickname/1) {:ok, updated_users} = User.approve(users) @@ -227,36 +238,27 @@ def approve(%{assigns: %{user: admin}} = conn, %{"nicknames" => nicknames}) do action: "approve" }) - conn - |> put_view(AccountView) - |> render("index.json", %{users: updated_users}) + render(conn, "index.json", users: updated_users) end - def list(conn, params) do + def index(conn, params) do {page, page_size} = page_params(params) - filters = maybe_parse_filters(params["filters"]) + filters = maybe_parse_filters(params[:filters]) search_params = %{ - query: params["query"], + query: params[:query], page: page, page_size: page_size, - tags: params["tags"], - name: params["name"], - email: params["email"], - actor_types: params["actor_types"] + tags: params[:tags], + name: params[:name], + email: params[:email], + actor_types: params[:actor_types] } |> Map.merge(filters) with {:ok, users, count} <- Search.user(search_params) do - json( - conn, - AccountView.render("index.json", - users: users, - count: count, - page_size: page_size - ) - ) + render(conn, "index.json", users: users, count: count, page_size: page_size) end end @@ -274,8 +276,8 @@ defp maybe_parse_filters(filters) do defp page_params(params) do { - fetch_integer_param(params, "page", 1), - fetch_integer_param(params, "page_size", @users_page_size) + fetch_integer_param(params, :page, 1), + fetch_integer_param(params, :page_size, @users_page_size) } end end diff --git a/lib/pleroma/web/admin_api/views/account_view.ex b/lib/pleroma/web/admin_api/views/account_view.ex index d7c63d385..e053a9b67 100644 --- a/lib/pleroma/web/admin_api/views/account_view.ex +++ b/lib/pleroma/web/admin_api/views/account_view.ex @@ -75,7 +75,7 @@ def render("show.json", %{user: user}) do "display_name" => display_name, "is_active" => user.is_active, "local" => user.local, - "roles" => User.roles(user), + "roles" => roles(user), "tags" => user.tags || [], "is_confirmed" => user.is_confirmed, "is_approved" => user.is_approved, @@ -85,6 +85,10 @@ def render("show.json", %{user: user}) do } end + def render("created_many.json", %{users: users}) do + render_many(users, AccountView, "created.json", as: :user) + end + def render("created.json", %{user: user}) do %{ type: "success", @@ -96,7 +100,11 @@ def render("created.json", %{user: user}) do } end - def render("create-error.json", %{changeset: %Ecto.Changeset{changes: changes, errors: errors}}) do + def render("create_errors.json", %{changesets: changesets}) do + render_many(changesets, AccountView, "create_error.json", as: :changeset) + end + + def render("create_error.json", %{changeset: %Ecto.Changeset{changes: changes, errors: errors}}) do %{ type: "error", code: 409, @@ -140,4 +148,11 @@ defp parse_error(errors) do defp image_url(%{"url" => [%{"href" => href} | _]}), do: href defp image_url(_), do: nil + + defp roles(%{is_moderator: is_moderator, is_admin: is_admin}) do + %{ + admin: is_admin, + moderator: is_moderator + } + end end diff --git a/lib/pleroma/web/api_spec/operations/admin/user_operation.ex b/lib/pleroma/web/api_spec/operations/admin/user_operation.ex new file mode 100644 index 000000000..183c61236 --- /dev/null +++ b/lib/pleroma/web/api_spec/operations/admin/user_operation.ex @@ -0,0 +1,389 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ApiSpec.Admin.UserOperation do + alias OpenApiSpex.Operation + alias OpenApiSpex.Schema + alias Pleroma.Web.ApiSpec.Schemas.ActorType + alias Pleroma.Web.ApiSpec.Schemas.ApiError + + import Pleroma.Web.ApiSpec.Helpers + + def open_api_operation(action) do + operation = String.to_existing_atom("#{action}_operation") + apply(__MODULE__, operation, []) + end + + def index_operation do + %Operation{ + tags: ["Users"], + summary: "List users", + operationId: "AdminAPI.UserController.index", + security: [%{"oAuth" => ["admin:read:accounts"]}], + parameters: [ + Operation.parameter(:filters, :query, :string, "Comma separated list of filters"), + Operation.parameter(:query, :query, :string, "Search users query"), + Operation.parameter(:name, :query, :string, "Search by display name"), + Operation.parameter(:email, :query, :string, "Search by email"), + Operation.parameter(:page, :query, :integer, "Page Number"), + Operation.parameter(:page_size, :query, :integer, "Number of users to return per page"), + Operation.parameter( + :actor_types, + :query, + %Schema{type: :array, items: ActorType}, + "Filter by actor type" + ), + Operation.parameter( + :tags, + :query, + %Schema{type: :array, items: %Schema{type: :string}}, + "Filter by tags" + ) + | admin_api_params() + ], + responses: %{ + 200 => + Operation.response( + "Response", + "application/json", + %Schema{ + type: :object, + properties: %{ + users: %Schema{type: :array, items: user()}, + count: %Schema{type: :integer}, + page_size: %Schema{type: :integer} + } + } + ), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def create_operation do + %Operation{ + tags: ["Users"], + summary: "Create a single or multiple users", + operationId: "AdminAPI.UserController.create", + security: [%{"oAuth" => ["admin:write:accounts"]}], + parameters: admin_api_params(), + requestBody: + request_body( + "Parameters", + %Schema{ + description: "POST body for creating users", + type: :object, + properties: %{ + users: %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + nickname: %Schema{type: :string}, + email: %Schema{type: :string}, + password: %Schema{type: :string} + } + } + } + } + } + ), + responses: %{ + 200 => + Operation.response("Response", "application/json", %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + code: %Schema{type: :integer}, + type: %Schema{type: :string}, + data: %Schema{ + type: :object, + properties: %{ + email: %Schema{type: :string, format: :email}, + nickname: %Schema{type: :string} + } + } + } + } + }), + 403 => Operation.response("Forbidden", "application/json", ApiError), + 409 => + Operation.response("Conflict", "application/json", %Schema{ + type: :array, + items: %Schema{ + type: :object, + properties: %{ + code: %Schema{type: :integer}, + error: %Schema{type: :string}, + type: %Schema{type: :string}, + data: %Schema{ + type: :object, + properties: %{ + email: %Schema{type: :string, format: :email}, + nickname: %Schema{type: :string} + } + } + } + } + }) + } + } + end + + def show_operation do + %Operation{ + tags: ["Users"], + summary: "Show user", + operationId: "AdminAPI.UserController.show", + security: [%{"oAuth" => ["admin:read:accounts"]}], + parameters: [ + Operation.parameter( + :nickname, + :path, + :string, + "User nickname or ID" + ) + | admin_api_params() + ], + responses: %{ + 200 => Operation.response("Response", "application/json", user()), + 403 => Operation.response("Forbidden", "application/json", ApiError), + 404 => Operation.response("Not Found", "application/json", ApiError) + } + } + end + + def follow_operation do + %Operation{ + tags: ["Users"], + summary: "Follow", + operationId: "AdminAPI.UserController.follow", + security: [%{"oAuth" => ["admin:write:follows"]}], + parameters: admin_api_params(), + requestBody: + request_body( + "Parameters", + %Schema{ + type: :object, + properties: %{ + follower: %Schema{type: :string, description: "Follower nickname"}, + followed: %Schema{type: :string, description: "Followed nickname"} + } + } + ), + responses: %{ + 200 => Operation.response("Response", "application/json", %Schema{type: :string}), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def unfollow_operation do + %Operation{ + tags: ["Users"], + summary: "Unfollow", + operationId: "AdminAPI.UserController.unfollow", + security: [%{"oAuth" => ["admin:write:follows"]}], + parameters: admin_api_params(), + requestBody: + request_body( + "Parameters", + %Schema{ + type: :object, + properties: %{ + follower: %Schema{type: :string, description: "Follower nickname"}, + followed: %Schema{type: :string, description: "Followed nickname"} + } + } + ), + responses: %{ + 200 => Operation.response("Response", "application/json", %Schema{type: :string}), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def approve_operation do + %Operation{ + tags: ["Users"], + summary: "Approve multiple users", + operationId: "AdminAPI.UserController.approve", + security: [%{"oAuth" => ["admin:write:accounts"]}], + parameters: admin_api_params(), + requestBody: + request_body( + "Parameters", + %Schema{ + description: "POST body for deleting multiple users", + type: :object, + properties: %{ + nicknames: %Schema{ + type: :array, + items: %Schema{type: :string} + } + } + } + ), + responses: %{ + 200 => + Operation.response("Response", "application/json", %Schema{ + type: :object, + properties: %{user: %Schema{type: :array, items: user()}} + }), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def toggle_activation_operation do + %Operation{ + tags: ["Users"], + summary: "Toggle user activation", + operationId: "AdminAPI.UserController.toggle_activation", + security: [%{"oAuth" => ["admin:write:accounts"]}], + parameters: [ + Operation.parameter(:nickname, :path, :string, "User nickname") + | admin_api_params() + ], + responses: %{ + 200 => Operation.response("Response", "application/json", user()), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def activate_operation do + %Operation{ + tags: ["Users"], + summary: "Activate multiple users", + operationId: "AdminAPI.UserController.activate", + security: [%{"oAuth" => ["admin:write:accounts"]}], + parameters: admin_api_params(), + requestBody: + request_body( + "Parameters", + %Schema{ + description: "POST body for deleting multiple users", + type: :object, + properties: %{ + nicknames: %Schema{ + type: :array, + items: %Schema{type: :string} + } + } + } + ), + responses: %{ + 200 => + Operation.response("Response", "application/json", %Schema{ + type: :object, + properties: %{user: %Schema{type: :array, items: user()}} + }), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def deactivate_operation do + %Operation{ + tags: ["Users"], + summary: "Deactivates multiple users", + operationId: "AdminAPI.UserController.deactivate", + security: [%{"oAuth" => ["admin:write:accounts"]}], + parameters: admin_api_params(), + requestBody: + request_body( + "Parameters", + %Schema{ + description: "POST body for deleting multiple users", + type: :object, + properties: %{ + nicknames: %Schema{ + type: :array, + items: %Schema{type: :string} + } + } + } + ), + responses: %{ + 200 => + Operation.response("Response", "application/json", %Schema{ + type: :object, + properties: %{user: %Schema{type: :array, items: user()}} + }), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + def delete_operation do + %Operation{ + tags: ["Users"], + summary: "Removes a single or multiple users", + operationId: "AdminAPI.UserController.delete", + security: [%{"oAuth" => ["admin:write:accounts"]}], + parameters: [ + Operation.parameter( + :nickname, + :query, + :string, + "User nickname" + ) + | admin_api_params() + ], + requestBody: + request_body( + "Parameters", + %Schema{ + description: "POST body for deleting multiple users", + type: :object, + properties: %{ + nicknames: %Schema{ + type: :array, + items: %Schema{type: :string} + } + } + } + ), + responses: %{ + 200 => + Operation.response("Response", "application/json", %Schema{ + description: "Array of nicknames", + type: :array, + items: %Schema{type: :string} + }), + 403 => Operation.response("Forbidden", "application/json", ApiError) + } + } + end + + defp user do + %Schema{ + type: :object, + properties: %{ + id: %Schema{type: :string}, + email: %Schema{type: :string, format: :email}, + avatar: %Schema{type: :string, format: :uri}, + nickname: %Schema{type: :string}, + display_name: %Schema{type: :string}, + is_active: %Schema{type: :boolean}, + local: %Schema{type: :boolean}, + roles: %Schema{ + type: :object, + properties: %{ + admin: %Schema{type: :boolean}, + moderator: %Schema{type: :boolean} + } + }, + tags: %Schema{type: :array, items: %Schema{type: :string}}, + is_confirmed: %Schema{type: :boolean}, + is_approved: %Schema{type: :boolean}, + url: %Schema{type: :string, format: :uri}, + registration_reason: %Schema{type: :string, nullable: true}, + actor_type: %Schema{type: :string} + } + } + end +end diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 72ad14f05..de0bd27d7 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -204,7 +204,7 @@ defmodule Pleroma.Web.Router do get("/users/:nickname/credentials", AdminAPIController, :show_user_credentials) patch("/users/:nickname/credentials", AdminAPIController, :update_user_credentials) - get("/users", UserController, :list) + get("/users", UserController, :index) get("/users/:nickname", UserController, :show) get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses) get("/users/:nickname/chats", AdminAPIController, :list_user_chats) diff --git a/test/pleroma/web/admin_api/controllers/user_controller_test.exs b/test/pleroma/web/admin_api/controllers/user_controller_test.exs index beb8a5d58..31319b5e5 100644 --- a/test/pleroma/web/admin_api/controllers/user_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/user_controller_test.exs @@ -44,7 +44,7 @@ test "with valid `admin_token` query parameter, skips OAuth scopes check" do conn = get(build_conn(), "/api/pleroma/admin/users/#{user.nickname}?admin_token=password123") - assert json_response(conn, 200) + assert json_response_and_validate_schema(conn, 200) end test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope", @@ -67,7 +67,7 @@ test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or bro |> assign(:token, good_token) |> get(url) - assert json_response(conn, 200) + assert json_response_and_validate_schema(conn, 200) end for good_token <- [good_token1, good_token2, good_token3] do @@ -87,7 +87,7 @@ test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or bro |> assign(:token, bad_token) |> get(url) - assert json_response(conn, :forbidden) + assert json_response_and_validate_schema(conn, :forbidden) end end @@ -131,7 +131,7 @@ test "single user", %{admin: admin, conn: conn} do assert ModerationLog.get_log_entry_message(log_entry) == "@#{admin.nickname} deleted users: @#{user.nickname}" - assert json_response(conn, 200) == [user.nickname] + assert json_response_and_validate_schema(conn, 200) == [user.nickname] user = Repo.get(User, user.id) refute user.is_active @@ -152,28 +152,30 @@ test "multiple users", %{admin: admin, conn: conn} do user_one = insert(:user) user_two = insert(:user) - conn = + response = conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> delete("/api/pleroma/admin/users", %{ nicknames: [user_one.nickname, user_two.nickname] }) + |> json_response_and_validate_schema(200) log_entry = Repo.one(ModerationLog) assert ModerationLog.get_log_entry_message(log_entry) == "@#{admin.nickname} deleted users: @#{user_one.nickname}, @#{user_two.nickname}" - response = json_response(conn, 200) assert response -- [user_one.nickname, user_two.nickname] == [] end end describe "/api/pleroma/admin/users" do test "Create", %{conn: conn} do - conn = + response = conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> post("/api/pleroma/admin/users", %{ "users" => [ %{ @@ -188,8 +190,9 @@ test "Create", %{conn: conn} do } ] }) + |> json_response_and_validate_schema(200) + |> Enum.map(&Map.get(&1, "type")) - response = json_response(conn, 200) |> Enum.map(&Map.get(&1, "type")) assert response == ["success", "success"] log_entry = Repo.one(ModerationLog) @@ -203,6 +206,7 @@ test "Cannot create user with existing email", %{conn: conn} do conn = conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> post("/api/pleroma/admin/users", %{ "users" => [ %{ @@ -213,7 +217,7 @@ test "Cannot create user with existing email", %{conn: conn} do ] }) - assert json_response(conn, 409) == [ + assert json_response_and_validate_schema(conn, 409) == [ %{ "code" => 409, "data" => %{ @@ -232,6 +236,7 @@ test "Cannot create user with existing nickname", %{conn: conn} do conn = conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> post("/api/pleroma/admin/users", %{ "users" => [ %{ @@ -242,7 +247,7 @@ test "Cannot create user with existing nickname", %{conn: conn} do ] }) - assert json_response(conn, 409) == [ + assert json_response_and_validate_schema(conn, 409) == [ %{ "code" => 409, "data" => %{ @@ -261,6 +266,7 @@ test "Multiple user creation works in transaction", %{conn: conn} do conn = conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> post("/api/pleroma/admin/users", %{ "users" => [ %{ @@ -276,7 +282,7 @@ test "Multiple user creation works in transaction", %{conn: conn} do ] }) - assert json_response(conn, 409) == [ + assert json_response_and_validate_schema(conn, 409) == [ %{ "code" => 409, "data" => %{ @@ -307,7 +313,7 @@ test "Show", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}") - assert user_response(user) == json_response(conn, 200) + assert user_response(user) == json_response_and_validate_schema(conn, 200) end test "when the user doesn't exist", %{conn: conn} do @@ -315,7 +321,7 @@ test "when the user doesn't exist", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}") - assert %{"error" => "Not found"} == json_response(conn, 404) + assert %{"error" => "Not found"} == json_response_and_validate_schema(conn, 404) end end @@ -326,6 +332,7 @@ test "allows to force-follow another user", %{admin: admin, conn: conn} do conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> post("/api/pleroma/admin/users/follow", %{ "follower" => follower.nickname, "followed" => user.nickname @@ -352,6 +359,7 @@ test "allows to force-unfollow another user", %{admin: admin, conn: conn} do conn |> put_req_header("accept", "application/json") + |> put_req_header("content-type", "application/json") |> post("/api/pleroma/admin/users/unfollow", %{ "follower" => follower.nickname, "followed" => user.nickname @@ -395,7 +403,7 @@ test "renders users array for the first page", %{conn: conn, admin: admin} do ] |> Enum.sort_by(& &1["nickname"]) - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 3, "page_size" => 50, "users" => users @@ -410,7 +418,7 @@ test "pagination works correctly with service users", %{conn: conn} do assert %{"count" => 26, "page_size" => 10, "users" => users1} = conn |> get("/api/pleroma/admin/users?page=1&filters=", %{page_size: "10"}) - |> json_response(200) + |> json_response_and_validate_schema(200) assert Enum.count(users1) == 10 assert service1 not in users1 @@ -418,7 +426,7 @@ test "pagination works correctly with service users", %{conn: conn} do assert %{"count" => 26, "page_size" => 10, "users" => users2} = conn |> get("/api/pleroma/admin/users?page=2&filters=", %{page_size: "10"}) - |> json_response(200) + |> json_response_and_validate_schema(200) assert Enum.count(users2) == 10 assert service1 not in users2 @@ -426,7 +434,7 @@ test "pagination works correctly with service users", %{conn: conn} do assert %{"count" => 26, "page_size" => 10, "users" => users3} = conn |> get("/api/pleroma/admin/users?page=3&filters=", %{page_size: "10"}) - |> json_response(200) + |> json_response_and_validate_schema(200) assert Enum.count(users3) == 6 assert service1 not in users3 @@ -437,7 +445,7 @@ test "renders empty array for the second page", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?page=2") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 2, "page_size" => 50, "users" => [] @@ -449,7 +457,7 @@ test "regular search", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?query=bo") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user, %{"local" => true})] @@ -462,7 +470,7 @@ test "search by domain", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?query=domain.com") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user)] @@ -475,7 +483,7 @@ test "search by full nickname", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?query=nickname@domain.com") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user)] @@ -488,7 +496,7 @@ test "search by display name", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?name=display") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user)] @@ -501,7 +509,7 @@ test "search by email", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?email=email@example.com") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user)] @@ -514,7 +522,7 @@ test "regular search with page size", %{conn: conn} do conn1 = get(conn, "/api/pleroma/admin/users?query=a&page_size=1&page=1") - assert json_response(conn1, 200) == %{ + assert json_response_and_validate_schema(conn1, 200) == %{ "count" => 2, "page_size" => 1, "users" => [user_response(user)] @@ -522,7 +530,7 @@ test "regular search with page size", %{conn: conn} do conn2 = get(conn, "/api/pleroma/admin/users?query=a&page_size=1&page=2") - assert json_response(conn2, 200) == %{ + assert json_response_and_validate_schema(conn2, 200) == %{ "count" => 2, "page_size" => 1, "users" => [user_response(user2)] @@ -542,7 +550,7 @@ test "only local users" do |> assign(:token, token) |> get("/api/pleroma/admin/users?query=bo&filters=local") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user)] @@ -570,7 +578,7 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do ] |> Enum.sort_by(& &1["nickname"]) - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 3, "page_size" => 50, "users" => users @@ -587,7 +595,7 @@ test "only unconfirmed users", %{conn: conn} do result = conn |> get("/api/pleroma/admin/users?filters=unconfirmed") - |> json_response(200) + |> json_response_and_validate_schema(200) users = Enum.map([old_user, sad_user], fn user -> @@ -620,7 +628,7 @@ test "only unapproved users", %{conn: conn} do ) ] - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => users @@ -647,7 +655,7 @@ test "load only admins", %{conn: conn, admin: admin} do ] |> Enum.sort_by(& &1["nickname"]) - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 2, "page_size" => 50, "users" => users @@ -661,7 +669,7 @@ test "load only moderators", %{conn: conn} do conn = get(conn, "/api/pleroma/admin/users?filters=is_moderator") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [ @@ -682,8 +690,8 @@ test "load users with actor_type is Person", %{admin: admin, conn: conn} do response = conn - |> get(user_path(conn, :list), %{actor_types: ["Person"]}) - |> json_response(200) + |> get(user_path(conn, :index), %{actor_types: ["Person"]}) + |> json_response_and_validate_schema(200) users = [ @@ -705,8 +713,8 @@ test "load users with actor_type is Person and Service", %{admin: admin, conn: c response = conn - |> get(user_path(conn, :list), %{actor_types: ["Person", "Service"]}) - |> json_response(200) + |> get(user_path(conn, :index), %{actor_types: ["Person", "Service"]}) + |> json_response_and_validate_schema(200) users = [ @@ -728,8 +736,8 @@ test "load users with actor_type is Service", %{conn: conn} do response = conn - |> get(user_path(conn, :list), %{actor_types: ["Service"]}) - |> json_response(200) + |> get(user_path(conn, :index), %{actor_types: ["Service"]}) + |> json_response_and_validate_schema(200) users = [user_response(user_service, %{"actor_type" => "Service"})] @@ -751,7 +759,7 @@ test "load users with tags list", %{conn: conn} do ] |> Enum.sort_by(& &1["nickname"]) - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 2, "page_size" => 50, "users" => users @@ -776,7 +784,7 @@ test "`active` filters out users pending approval", %{token: token} do %{"id" => ^admin_id}, %{"id" => ^user_id} ] - } = json_response(conn, 200) + } = json_response_and_validate_schema(conn, 200) end test "it works with multiple filters" do @@ -793,7 +801,7 @@ test "it works with multiple filters" do |> assign(:token, token) |> get("/api/pleroma/admin/users?filters=deactivated,external") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [user_response(user)] @@ -805,7 +813,7 @@ test "it omits relay user", %{admin: admin, conn: conn} do conn = get(conn, "/api/pleroma/admin/users") - assert json_response(conn, 200) == %{ + assert json_response_and_validate_schema(conn, 200) == %{ "count" => 1, "page_size" => 50, "users" => [ @@ -820,13 +828,14 @@ test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do user_two = insert(:user, is_active: false) conn = - patch( - conn, + conn + |> put_req_header("content-type", "application/json") + |> patch( "/api/pleroma/admin/users/activate", %{nicknames: [user_one.nickname, user_two.nickname]} ) - response = json_response(conn, 200) + response = json_response_and_validate_schema(conn, 200) assert Enum.map(response["users"], & &1["is_active"]) == [true, true] log_entry = Repo.one(ModerationLog) @@ -840,13 +849,14 @@ test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do user_two = insert(:user, is_active: true) conn = - patch( - conn, + conn + |> put_req_header("content-type", "application/json") + |> patch( "/api/pleroma/admin/users/deactivate", %{nicknames: [user_one.nickname, user_two.nickname]} ) - response = json_response(conn, 200) + response = json_response_and_validate_schema(conn, 200) assert Enum.map(response["users"], & &1["is_active"]) == [false, false] log_entry = Repo.one(ModerationLog) @@ -860,13 +870,14 @@ test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do user_two = insert(:user, is_approved: false) conn = - patch( - conn, + conn + |> put_req_header("content-type", "application/json") + |> patch( "/api/pleroma/admin/users/approve", %{nicknames: [user_one.nickname, user_two.nickname]} ) - response = json_response(conn, 200) + response = json_response_and_validate_schema(conn, 200) assert Enum.map(response["users"], & &1["is_approved"]) == [true, true] log_entry = Repo.one(ModerationLog) @@ -878,9 +889,12 @@ test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admin, conn: conn} do user = insert(:user) - conn = patch(conn, "/api/pleroma/admin/users/#{user.nickname}/toggle_activation") + conn = + conn + |> put_req_header("content-type", "application/json") + |> patch("/api/pleroma/admin/users/#{user.nickname}/toggle_activation") - assert json_response(conn, 200) == + assert json_response_and_validate_schema(conn, 200) == user_response( user, %{"is_active" => !user.is_active} -- cgit v1.2.3 From 85b2387f665045a303486d10e6879a46a7ab922e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Mar 2021 11:37:37 -0600 Subject: Fix build_application/1 match --- lib/pleroma/web/mastodon_api/views/status_view.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index bac897a57..a7e762ac1 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -536,6 +536,8 @@ defp build_emoji_map(emoji, users, current_user) do end @spec build_application(map() | nil) :: map() | nil - defp build_application(%{type: _type, name: name, url: url}), do: %{name: name, website: url} + defp build_application(%{"type" => _type, "name" => name, "url" => url}), + do: %{name: name, website: url} + defp build_application(_), do: nil end -- cgit v1.2.3 From f0208980e48ee361f9eaa40352f519a1b95ace28 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Mar 2021 12:29:16 -0600 Subject: Test both ingestion of post in the status controller and the correct response during the view --- .../web/mastodon_api/controllers/status_controller_test.exs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index bd385bccd..634ebf79c 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -376,6 +376,17 @@ test "discloses application metadata when enabled" do "status" => "cofe is my copilot" }) + assert %{ + "content" => "cofe is my copilot" + } = json_response_and_validate_schema(result, 200) + + activity = result.assigns.activity.id + + result = + conn + |> put_req_header("content-type", "application/json") + |> get("api/v1/statuses/#{activity}") + assert %{ "content" => "cofe is my copilot", "application" => %{ -- cgit v1.2.3 From ccbf162088951e4b7f28291ca4cd9b9280b40857 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Mar 2021 12:33:32 -0600 Subject: Actually test viewing status after ingestion --- .../web/mastodon_api/controllers/status_controller_test.exs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 634ebf79c..39ab90ba6 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -407,6 +407,16 @@ test "hides application metadata when disabled" do "status" => "club mate is my wingman" }) + assert %{"content" => "club mate is my wingman"} = + json_response_and_validate_schema(result, 200) + + activity = result.assigns.activity.id + + result = + conn + |> put_req_header("content-type", "application/json") + |> get("api/v1/statuses/#{activity}") + assert %{ "content" => "club mate is my wingman", "application" => nil -- cgit v1.2.3 From 913d53b7d7301445fdb0fc8dbe5ecf8b59aafa43 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Mar 2021 14:04:50 -0600 Subject: Remove useless header on the get request --- test/pleroma/web/mastodon_api/controllers/status_controller_test.exs | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index 39ab90ba6..f616f405e 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -384,7 +384,6 @@ test "discloses application metadata when enabled" do result = conn - |> put_req_header("content-type", "application/json") |> get("api/v1/statuses/#{activity}") assert %{ @@ -414,7 +413,6 @@ test "hides application metadata when disabled" do result = conn - |> put_req_header("content-type", "application/json") |> get("api/v1/statuses/#{activity}") assert %{ -- cgit v1.2.3 From 8d601d3b234cfe2a6a942dd156712cc400af8500 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Mar 2021 14:14:38 -0600 Subject: Make the object reference in both render("show.json", _) functions consistently named --- lib/pleroma/web/mastodon_api/views/status_view.ex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index a7e762ac1..f3f54e03d 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -124,16 +124,16 @@ def render( ) do user = CommonAPI.get_user(activity.data["actor"]) created_at = Utils.to_masto_date(activity.data["published"]) - activity_object = Object.normalize(activity, fetch: false) + object = Object.normalize(activity, fetch: false) reblogged_parent_activity = if opts[:parent_activities] do Activity.Queries.find_by_object_ap_id( opts[:parent_activities], - activity_object.data["id"] + object.data["id"] ) else - Activity.create_by_object_ap_id(activity_object.data["id"]) + Activity.create_by_object_ap_id(object.data["id"]) |> Activity.with_preloaded_bookmark(opts[:for]) |> Activity.with_set_thread_muted_field(opts[:for]) |> Repo.one() @@ -142,7 +142,7 @@ def render( reblog_rendering_opts = Map.put(opts, :activity, reblogged_parent_activity) reblogged = render("show.json", reblog_rendering_opts) - favorited = opts[:for] && opts[:for].ap_id in (activity_object.data["likes"] || []) + favorited = opts[:for] && opts[:for].ap_id in (object.data["likes"] || []) bookmarked = Activity.get_bookmark(reblogged_parent_activity, opts[:for]) != nil @@ -154,8 +154,8 @@ def render( %{ id: to_string(activity.id), - uri: activity_object.data["id"], - url: activity_object.data["id"], + uri: object.data["id"], + url: object.data["id"], account: AccountView.render("show.json", %{ user: user, @@ -180,7 +180,7 @@ def render( media_attachments: reblogged[:media_attachments] || [], mentions: mentions, tags: reblogged[:tags] || [], - application: build_application(activity_object.data["generator"]), + application: build_application(object.data["generator"]), language: nil, emojis: [], pleroma: %{ -- cgit v1.2.3 From 5b8cceba09bda6a01adee4939e3c2521c2ea037e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 2 Mar 2021 18:17:32 -0600 Subject: Fix migration in cases where database name has a hyphen --- priv/repo/migrations/20210121080964_add_default_text_search_config.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/repo/migrations/20210121080964_add_default_text_search_config.exs b/priv/repo/migrations/20210121080964_add_default_text_search_config.exs index 09b6cccc9..27f600b70 100644 --- a/priv/repo/migrations/20210121080964_add_default_text_search_config.exs +++ b/priv/repo/migrations/20210121080964_add_default_text_search_config.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Repo.Migrations.AddDefaultTextSearchConfig do def change do execute("DO $$ BEGIN - execute 'ALTER DATABASE '||current_database()||' SET default_text_search_config = ''english'' '; + execute 'ALTER DATABASE \"'||current_database()||'\" SET default_text_search_config = ''english'' '; END $$;") end -- cgit v1.2.3 From c5352e90be363f88f011ed5a63129caf3ee1a9fc Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 3 Mar 2021 13:56:40 +0100 Subject: Changelog, mix: merge in stable --- CHANGELOG.md | 4 ++++ mix.exs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a55ebbf8a..40c423273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +## Unreleased (Patch) + ## [2.3.0] - 2020-03-01 ### Security diff --git a/mix.exs b/mix.exs index 436381f32..ec6e92df7 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do def project do [ app: :pleroma, - version: version("2.3.0"), + version: version("2.3.50"), elixir: "~> 1.9", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), -- cgit v1.2.3 From 2e296c079f0666a8239a0d3ce5b5fba6baf45a29 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 3 Mar 2021 15:33:06 +0100 Subject: Revert "StatusController: Deactivate application support for now." This reverts commit 024c11c18d289d4acd65d749f939ad3684f31905. --- .../mastodon_api/controllers/status_controller.ex | 20 +++++++++----------- .../controllers/status_controller_test.exs | 1 - 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index d1a58d5e1..b051fca74 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -21,7 +21,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusController do alias Pleroma.Web.CommonAPI alias Pleroma.Web.MastodonAPI.AccountView alias Pleroma.Web.MastodonAPI.ScheduledActivityView - # alias Pleroma.Web.OAuth.Token + alias Pleroma.Web.OAuth.Token alias Pleroma.Web.Plugs.OAuthScopesPlug alias Pleroma.Web.Plugs.RateLimiter @@ -420,16 +420,14 @@ def bookmarks(%{assigns: %{user: user}} = conn, params) do ) end - # Deactivated for 2.3.0 - # defp put_application(params, - # %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do - # if user.disclose_client do - # %{client_name: client_name, website: website} = Repo.preload(token, :app).app - # Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) - # else - # Map.put(params, :generator, nil) - # end - # end + defp put_application(params, %{assigns: %{token: %Token{user: %User{} = user} = token}} = _conn) do + if user.disclose_client do + %{client_name: client_name, website: website} = Repo.preload(token, :app).app + Map.put(params, :generator, %{type: "Application", name: client_name, url: website}) + else + Map.put(params, :generator, nil) + end + end defp put_application(params, _), do: Map.put(params, :generator, nil) end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index e76c2760d..bd385bccd 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -358,7 +358,6 @@ test "posting a direct status", %{conn: conn} do assert activity.data["cc"] == [] end - @tag :skip test "discloses application metadata when enabled" do user = insert(:user, disclose_client: true) %{user: _user, token: token, conn: conn} = oauth_access(["write:statuses"], user: user) -- cgit v1.2.3 From 10f402af6d0f088aa6ad8a3f26b5e226a2287634 Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 3 Mar 2021 15:35:25 +0100 Subject: Changelog: Re-add application support --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40c423273..ed08701fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +- The `application` metadata returned with statuses is no longer hardcoded. Apps that want to display these details will now have valid data for new posts after this change. + ## Unreleased (Patch) ## [2.3.0] - 2020-03-01 -- cgit v1.2.3 From 5856f51717c12f4c6b0b89e480ff689c8480393d Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Wed, 3 Mar 2021 23:09:30 +0300 Subject: [#3213] ActivityPub hashtags filtering refactoring. Test fix. --- lib/pleroma/repo.ex | 2 ++ lib/pleroma/web/activity_pub/activity_pub.ex | 29 +++++++--------------- mix.exs | 1 + mix.lock | 1 + .../pleroma/web/activity_pub/activity_pub_test.exs | 2 +- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/lib/pleroma/repo.ex b/lib/pleroma/repo.ex index 61b64ed3e..b8ea06e33 100644 --- a/lib/pleroma/repo.ex +++ b/lib/pleroma/repo.ex @@ -8,6 +8,8 @@ defmodule Pleroma.Repo do adapter: Ecto.Adapters.Postgres, migration_timestamps: [type: :naive_datetime_usec] + use Ecto.Explain + import Ecto.Query require Logger diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 9d557c2cd..a4b48ec9b 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -746,6 +746,13 @@ defp restrict_embedded_tag_reject_any(query, %{tag_reject: tag_reject}) defp restrict_embedded_tag_reject_any(query, _), do: query + defp object_ids_query_for_tags(tags) do + from(hto in "hashtags_objects") + |> join(:inner, [hto], ht in Pleroma.Hashtag, on: hto.hashtag_id == ht.id) + |> where([hto, ht], ht.name in ^tags) + |> select([hto], hto.object_id) + end + defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do raise_on_missing_preload() end @@ -784,16 +791,7 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do defp restrict_hashtag_any(query, %{tag: [_ | _] = tags}) do from( [_activity, object] in query, - where: - fragment( - """ - EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) - AND hashtags_objects.object_id = ? LIMIT 1) - """, - ^tags, - object.id - ) + where: object.id in subquery(object_ids_query_for_tags(tags)) ) end @@ -810,16 +808,7 @@ defp restrict_hashtag_reject_any(_query, %{tag_reject: _tag_reject, skip_preload defp restrict_hashtag_reject_any(query, %{tag_reject: [_ | _] = tags_reject}) do from( [_activity, object] in query, - where: - fragment( - """ - NOT EXISTS (SELECT 1 FROM hashtags JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id WHERE hashtags.name = ANY(?) - AND hashtags_objects.object_id = ? LIMIT 1) - """, - ^tags_reject, - object.id - ) + where: object.id not in subquery(object_ids_query_for_tags(tags_reject)) ) end diff --git a/mix.exs b/mix.exs index 50d4b4080..c06e27314 100644 --- a/mix.exs +++ b/mix.exs @@ -121,6 +121,7 @@ defp deps do {:phoenix_pubsub, "~> 2.0"}, {:phoenix_ecto, "~> 4.0"}, {:ecto_enum, "~> 1.4"}, + {:ecto_explain, "~> 0.1.2"}, {:ecto_sql, "~> 3.4.4"}, {:postgrex, ">= 0.15.5"}, {:oban, "~> 2.3.4"}, diff --git a/mix.lock b/mix.lock index 3e5631c72..cb09ffead 100644 --- a/mix.lock +++ b/mix.lock @@ -31,6 +31,7 @@ "earmark_parser": {:hex, :earmark_parser, "1.4.10", "6603d7a603b9c18d3d20db69921527f82ef09990885ed7525003c7fe7dc86c56", [:mix], [], "hexpm", "8e2d5370b732385db2c9b22215c3f59c84ac7dda7ed7e544d7c459496ae519c0"}, "ecto": {:hex, :ecto, "3.4.6", "08f7afad3257d6eb8613309af31037e16c36808dfda5a3cd0cb4e9738db030e4", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "6f13a9e2a62e75c2dcfc7207bfc65645ab387af8360db4c89fee8b5a4bf3f70b"}, "ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"}, + "ecto_explain": {:hex, :ecto_explain, "0.1.2", "a9d504cbd4adc809911f796d5ef7ebb17a576a6d32286c3d464c015bd39d5541", [:mix], [], "hexpm", "1d0e7798ae30ecf4ce34e912e5354a0c1c832b7ebceba39298270b9a9f316330"}, "ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"}, "eimp": {:hex, :eimp, "1.0.14", "fc297f0c7e2700457a95a60c7010a5f1dcb768a083b6d53f49cd94ab95a28f22", [:rebar3], [{:p1_utils, "1.0.18", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "501133f3112079b92d9e22da8b88bf4f0e13d4d67ae9c15c42c30bd25ceb83b6"}, "elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"}, diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index f92323abe..1e1e74074 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -220,7 +220,7 @@ test "it fetches the appropriate tag-restricted posts" do {:ok, status_four} = CommonAPI.post(user, %{status: ". #Any1 #any2"}) {:ok, status_five} = CommonAPI.post(user, %{status: ". #Any2 #any1"}) - for hashtag_timeline_strategy <- [:eanbled, :disabled] do + for hashtag_timeline_strategy <- [:enabled, :disabled] do clear_config([:features, :improved_hashtag_timeline], hashtag_timeline_strategy) fetch_one = ActivityPub.fetch_activities([], %{type: "Create", tag: "test"}) -- cgit v1.2.3 From 9876fa8e902e66a77193ebeef674a9f0e9f37657 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Thu, 4 Mar 2021 21:13:53 +0400 Subject: Add UserOperation to Redoc --- lib/pleroma/web/api_spec.ex | 5 +++-- .../web/api_spec/operations/admin/user_operation.ex | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/pleroma/web/api_spec.ex b/lib/pleroma/web/api_spec.ex index adc8762dc..528cd9cf4 100644 --- a/lib/pleroma/web/api_spec.ex +++ b/lib/pleroma/web/api_spec.ex @@ -92,9 +92,10 @@ def spec(opts \\ []) do "Invites", "MediaProxy cache", "OAuth application managment", - "Report managment", "Relays", - "Status administration" + "Report managment", + "Status administration", + "User administration" ] }, %{"name" => "Applications", "tags" => ["Applications", "Push subscriptions"]}, diff --git a/lib/pleroma/web/api_spec/operations/admin/user_operation.ex b/lib/pleroma/web/api_spec/operations/admin/user_operation.ex index 183c61236..c9d0bfd7c 100644 --- a/lib/pleroma/web/api_spec/operations/admin/user_operation.ex +++ b/lib/pleroma/web/api_spec/operations/admin/user_operation.ex @@ -17,7 +17,7 @@ def open_api_operation(action) do def index_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "List users", operationId: "AdminAPI.UserController.index", security: [%{"oAuth" => ["admin:read:accounts"]}], @@ -63,7 +63,7 @@ def index_operation do def create_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Create a single or multiple users", operationId: "AdminAPI.UserController.create", security: [%{"oAuth" => ["admin:write:accounts"]}], @@ -134,7 +134,7 @@ def create_operation do def show_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Show user", operationId: "AdminAPI.UserController.show", security: [%{"oAuth" => ["admin:read:accounts"]}], @@ -157,7 +157,7 @@ def show_operation do def follow_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Follow", operationId: "AdminAPI.UserController.follow", security: [%{"oAuth" => ["admin:write:follows"]}], @@ -182,7 +182,7 @@ def follow_operation do def unfollow_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Unfollow", operationId: "AdminAPI.UserController.unfollow", security: [%{"oAuth" => ["admin:write:follows"]}], @@ -207,7 +207,7 @@ def unfollow_operation do def approve_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Approve multiple users", operationId: "AdminAPI.UserController.approve", security: [%{"oAuth" => ["admin:write:accounts"]}], @@ -239,7 +239,7 @@ def approve_operation do def toggle_activation_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Toggle user activation", operationId: "AdminAPI.UserController.toggle_activation", security: [%{"oAuth" => ["admin:write:accounts"]}], @@ -256,7 +256,7 @@ def toggle_activation_operation do def activate_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Activate multiple users", operationId: "AdminAPI.UserController.activate", security: [%{"oAuth" => ["admin:write:accounts"]}], @@ -288,7 +288,7 @@ def activate_operation do def deactivate_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Deactivates multiple users", operationId: "AdminAPI.UserController.deactivate", security: [%{"oAuth" => ["admin:write:accounts"]}], @@ -320,7 +320,7 @@ def deactivate_operation do def delete_operation do %Operation{ - tags: ["Users"], + tags: ["User administration"], summary: "Removes a single or multiple users", operationId: "AdminAPI.UserController.delete", security: [%{"oAuth" => ["admin:write:accounts"]}], -- cgit v1.2.3 From 92ab72dbbb4f56a0e0c3d0882ce29d54739437c1 Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Fri, 5 Mar 2021 15:51:29 +0400 Subject: Update OpenApiSpex dependency --- lib/pleroma/web/api_spec/cast_and_validate.ex | 31 +++++++++------------- .../web/api_spec/operations/status_operation.ex | 2 +- lib/pleroma/web/api_spec/schemas/boolean_like.ex | 10 ++++--- .../controllers/instance_controller.ex | 2 +- .../pleroma_api/controllers/backup_controller.ex | 2 +- .../web/pleroma_api/controllers/chat_controller.ex | 2 +- .../controllers/user_import_controller.ex | 2 +- mix.exs | 4 +-- mix.lock | 2 +- test/support/conn_case.ex | 8 +++--- 10 files changed, 30 insertions(+), 35 deletions(-) diff --git a/lib/pleroma/web/api_spec/cast_and_validate.ex b/lib/pleroma/web/api_spec/cast_and_validate.ex index a3da856ff..d23a7dcb6 100644 --- a/lib/pleroma/web/api_spec/cast_and_validate.ex +++ b/lib/pleroma/web/api_spec/cast_and_validate.ex @@ -15,6 +15,7 @@ defmodule Pleroma.Web.ApiSpec.CastAndValidate do @behaviour Plug + alias OpenApiSpex.Plug.PutApiSpec alias Plug.Conn @impl Plug @@ -25,12 +26,10 @@ def init(opts) do end @impl Plug - def call(%{private: %{open_api_spex: private_data}} = conn, %{ - operation_id: operation_id, - render_error: render_error - }) do - spec = private_data.spec - operation = private_data.operation_lookup[operation_id] + + def call(conn, %{operation_id: operation_id, render_error: render_error}) do + {spec, operation_lookup} = PutApiSpec.get_spec_and_operation_lookup(conn) + operation = operation_lookup[operation_id] content_type = case Conn.get_req_header(conn, "content-type") do @@ -43,8 +42,7 @@ def call(%{private: %{open_api_spex: private_data}} = conn, %{ "application/json" end - private_data = Map.put(private_data, :operation_id, operation_id) - conn = Conn.put_private(conn, :open_api_spex, private_data) + conn = Conn.put_private(conn, :operation_id, operation_id) case cast_and_validate(spec, operation, conn, content_type, strict?()) do {:ok, conn} -> @@ -64,25 +62,22 @@ def call( private: %{ phoenix_controller: controller, phoenix_action: action, - open_api_spex: private_data + open_api_spex: %{spec_module: spec_module} } } = conn, opts ) do + {spec, operation_lookup} = PutApiSpec.get_spec_and_operation_lookup(conn) + operation = - case private_data.operation_lookup[{controller, action}] do + case operation_lookup[{controller, action}] do nil -> operation_id = controller.open_api_operation(action).operationId - operation = private_data.operation_lookup[operation_id] + operation = operation_lookup[operation_id] - operation_lookup = - private_data.operation_lookup - |> Map.put({controller, action}, operation) + operation_lookup = Map.put(operation_lookup, {controller, action}, operation) - OpenApiSpex.Plug.Cache.adapter().put( - private_data.spec_module, - {private_data.spec, operation_lookup} - ) + OpenApiSpex.Plug.Cache.adapter().put(spec_module, {spec, operation_lookup}) operation diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index 40edc747d..4bdb8e281 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -59,7 +59,7 @@ def create_operation do Operation.response( "Status. When `scheduled_at` is present, ScheduledStatus is returned instead", "application/json", - %Schema{oneOf: [Status, ScheduledStatus]} + %Schema{anyOf: [Status, ScheduledStatus]} ), 422 => Operation.response("Bad Request / MRF Rejection", "application/json", ApiError) } diff --git a/lib/pleroma/web/api_spec/schemas/boolean_like.ex b/lib/pleroma/web/api_spec/schemas/boolean_like.ex index eb001c5bb..778158f66 100644 --- a/lib/pleroma/web/api_spec/schemas/boolean_like.ex +++ b/lib/pleroma/web/api_spec/schemas/boolean_like.ex @@ -3,6 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Web.ApiSpec.Schemas.BooleanLike do + alias OpenApiSpex.Cast alias OpenApiSpex.Schema require OpenApiSpex @@ -27,10 +28,13 @@ defmodule Pleroma.Web.ApiSpec.Schemas.BooleanLike do %Schema{type: :boolean}, %Schema{type: :string}, %Schema{type: :integer} - ] + ], + "x-validate": __MODULE__ }) - def after_cast(value, _schmea) do - {:ok, Pleroma.Web.ControllerHelper.truthy_param?(value)} + def cast(%Cast{value: value} = context) do + context + |> Map.put(:value, Pleroma.Web.ControllerHelper.truthy_param?(value)) + |> Cast.ok() end end diff --git a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex index 267d0f03b..c7a5267d4 100644 --- a/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/instance_controller.ex @@ -5,7 +5,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceController do use Pleroma.Web, :controller - plug(OpenApiSpex.Plug.CastAndValidate) + plug(Pleroma.Web.ApiSpec.CastAndValidate) plug( :skip_plug, diff --git a/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex b/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex index 315657e9c..fc5d16771 100644 --- a/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/backup_controller.ex @@ -10,7 +10,7 @@ defmodule Pleroma.Web.PleromaAPI.BackupController do action_fallback(Pleroma.Web.MastodonAPI.FallbackController) plug(OAuthScopesPlug, %{scopes: ["read:accounts"]} when action in [:index, :create]) - plug(OpenApiSpex.Plug.CastAndValidate, render_error: Pleroma.Web.ApiSpec.RenderError) + plug(Pleroma.Web.ApiSpec.CastAndValidate) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaBackupOperation diff --git a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex index 4adc685fe..dcd54b1af 100644 --- a/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/chat_controller.ex @@ -38,7 +38,7 @@ defmodule Pleroma.Web.PleromaAPI.ChatController do %{scopes: ["read:chats"]} when action in [:messages, :index, :index2, :show] ) - plug(OpenApiSpex.Plug.CastAndValidate, render_error: Pleroma.Web.ApiSpec.RenderError) + plug(Pleroma.Web.ApiSpec.CastAndValidate) defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.ChatOperation diff --git a/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex b/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex index 6d9a11fb6..078d470d9 100644 --- a/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex +++ b/lib/pleroma/web/pleroma_api/controllers/user_import_controller.ex @@ -15,7 +15,7 @@ defmodule Pleroma.Web.PleromaAPI.UserImportController do plug(OAuthScopesPlug, %{scopes: ["follow", "write:blocks"]} when action == :blocks) plug(OAuthScopesPlug, %{scopes: ["follow", "write:mutes"]} when action == :mutes) - plug(OpenApiSpex.Plug.CastAndValidate) + plug(Pleroma.Web.ApiSpec.CastAndValidate) defdelegate open_api_operation(action), to: ApiSpec.UserImportOperation def follow(%{body_params: %{list: %Plug.Upload{path: path}}} = conn, _) do diff --git a/mix.exs b/mix.exs index ec6e92df7..7f8665ea1 100644 --- a/mix.exs +++ b/mix.exs @@ -195,9 +195,7 @@ defp deps do {:majic, git: "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", ref: "289cda1b6d0d70ccb2ba508a2b0bd24638db2880"}, - {:open_api_spex, - git: "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", - ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"}, + {:open_api_spex, "~> 3.10"}, ## dev & test {:ex_doc, "~> 0.22", only: :dev, runtime: false}, diff --git a/mix.lock b/mix.lock index 99be81826..61c79a7f9 100644 --- a/mix.lock +++ b/mix.lock @@ -82,7 +82,7 @@ "nimble_pool": {:hex, :nimble_pool, "0.1.0", "ffa9d5be27eee2b00b0c634eb649aa27f97b39186fec3c493716c2a33e784ec6", [:mix], [], "hexpm", "343a1eaa620ddcf3430a83f39f2af499fe2370390d4f785cd475b4df5acaf3f9"}, "nodex": {:git, "https://git.pleroma.social/pleroma/nodex", "cb6730f943cfc6aad674c92161be23a8411f15d1", [ref: "cb6730f943cfc6aad674c92161be23a8411f15d1"]}, "oban": {:hex, :oban, "2.3.4", "ec7509b9af2524d55f529cb7aee93d36131ae0bf0f37706f65d2fe707f4d9fd8", [:mix], [{:ecto_sql, ">= 3.4.3", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c70ca0434758fd1805422ea4446af5e910ddc697c0c861549c8f0eb0cfbd2fdf"}, - "open_api_spex": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", "f296ac0924ba3cf79c7a588c4c252889df4c2edd", [ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"]}, + "open_api_spex": {:hex, :open_api_spex, "3.10.0", "94e9521ad525b3fcf6dc77da7c45f87fdac24756d4de588cb0816b413e7c1844", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.1", [hex: :poison, repo: "hexpm", optional: true]}], "hexpm", "2dbb2bde3d2b821f06936e8dfaf3284331186556291946d84eeba3750ac28765"}, "p1_utils": {:hex, :p1_utils, "1.0.18", "3fe224de5b2e190d730a3c5da9d6e8540c96484cf4b4692921d1e28f0c32b01c", [:rebar3], [], "hexpm", "1fc8773a71a15553b179c986b22fbeead19b28fe486c332d4929700ffeb71f88"}, "parse_trans": {:git, "https://github.com/uwiger/parse_trans.git", "76abb347c3c1d00fb0ccf9e4b43e22b3d2288484", [tag: "3.3.0"]}, "pbkdf2_elixir": {:hex, :pbkdf2_elixir, "1.2.1", "9cbe354b58121075bd20eb83076900a3832324b7dd171a6895fab57b6bb2752c", [:mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}], "hexpm", "d3b40a4a4630f0b442f19eca891fcfeeee4c40871936fed2f68e1c4faa30481f"}, diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index 953aa010a..deee98599 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -67,13 +67,11 @@ defp empty_json_response(conn) do end defp json_response_and_validate_schema( - %{ - private: %{ - open_api_spex: %{operation_id: op_id, operation_lookup: lookup, spec: spec} - } - } = conn, + %{private: %{operation_id: op_id}} = conn, status ) do + {spec, lookup} = OpenApiSpex.Plug.PutApiSpec.get_spec_and_operation_lookup(conn) + content_type = conn |> Plug.Conn.get_resp_header("content-type") -- cgit v1.2.3 From e97b34f65d71b3dd11aab151fe7ce6def315635a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 5 Mar 2021 13:18:37 -0600 Subject: Add simple way to decode fully qualified mediaproxy URLs --- lib/pleroma/web/media_proxy.ex | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/pleroma/web/media_proxy.ex b/lib/pleroma/web/media_proxy.ex index 27f337138..d0d4bb4b3 100644 --- a/lib/pleroma/web/media_proxy.ex +++ b/lib/pleroma/web/media_proxy.ex @@ -121,6 +121,11 @@ def decode_url(sig, url) do end end + def decode_url(encoded) do + [_, "proxy", sig, base64 | _] = URI.parse(encoded).path |> String.split("/") + decode_url(sig, base64) + end + defp signed_url(url) do :crypto.hmac(:sha, Config.get([Web.Endpoint, :secret_key_base]), url) end -- cgit v1.2.3 From eaaa20e0f1ac56fee0a8a0eb6a21bc7bf11dbe48 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 5 Mar 2021 13:21:22 -0600 Subject: Make tests use it --- test/pleroma/web/media_proxy_test.exs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/pleroma/web/media_proxy_test.exs b/test/pleroma/web/media_proxy_test.exs index 7411d0a7a..b5ee6328d 100644 --- a/test/pleroma/web/media_proxy_test.exs +++ b/test/pleroma/web/media_proxy_test.exs @@ -11,8 +11,7 @@ defmodule Pleroma.Web.MediaProxyTest do alias Pleroma.Web.MediaProxy defp decode_result(encoded) do - [_, "proxy", sig, base64 | _] = URI.parse(encoded).path |> String.split("/") - {:ok, decoded} = MediaProxy.decode_url(sig, base64) + {:ok, decoded} = MediaProxy.decode_url(encoded) decoded end -- cgit v1.2.3 From 7f8785fd9be11fbb09283c2dbd32aeb7903a4f58 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Sun, 7 Mar 2021 11:33:21 +0300 Subject: [#3213] Performance optimization of filtering by hashtags ("any" condition). --- lib/pleroma/pagination.ex | 3 ++ lib/pleroma/web/activity_pub/activity_pub.ex | 47 ++++++++++++++++------ .../controllers/timeline_controller.ex | 43 ++++++++------------ 3 files changed, 55 insertions(+), 38 deletions(-) diff --git a/lib/pleroma/pagination.ex b/lib/pleroma/pagination.ex index 0d24e1010..33e45a0eb 100644 --- a/lib/pleroma/pagination.ex +++ b/lib/pleroma/pagination.ex @@ -93,6 +93,7 @@ defp cast_params(params) do max_id: :string, offset: :integer, limit: :integer, + skip_extra_order: :boolean, skip_order: :boolean } @@ -114,6 +115,8 @@ defp restrict(query, :max_id, %{max_id: max_id}, table_binding) do defp restrict(query, :order, %{skip_order: true}, _), do: query + defp restrict(%{order_bys: [_ | _]} = query, :order, %{skip_extra_order: true}, _), do: query + defp restrict(query, :order, %{min_id: _}, table_binding) do order_by( query, diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index a4b48ec9b..230faf024 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -466,6 +466,23 @@ def fetch_latest_direct_activity_id_for_context(context, opts \\ %{}) do |> Repo.one() end + defp fetch_paginated_optimized(query, opts, pagination) do + # Note: tag-filtering funcs may apply "ORDER BY objects.id DESC", + # and extra sorting on "activities.id DESC NULLS LAST" would worse the query plan + opts = Map.put(opts, :skip_extra_order, true) + + Pagination.fetch_paginated(query, opts, pagination) + end + + def fetch_activities(recipients, opts \\ %{}, pagination \\ :keyset) do + list_memberships = Pleroma.List.memberships(opts[:user]) + + fetch_activities_query(recipients ++ list_memberships, opts) + |> fetch_paginated_optimized(opts, pagination) + |> Enum.reverse() + |> maybe_update_cc(list_memberships, opts[:user]) + end + @spec fetch_public_or_unlisted_activities(map(), Pagination.type()) :: [Activity.t()] def fetch_public_or_unlisted_activities(opts \\ %{}, pagination \\ :keyset) do opts = Map.delete(opts, :user) @@ -473,7 +490,7 @@ def fetch_public_or_unlisted_activities(opts \\ %{}, pagination \\ :keyset) do [Constants.as_public()] |> fetch_activities_query(opts) |> restrict_unlisted(opts) - |> Pagination.fetch_paginated(opts, pagination) + |> fetch_paginated_optimized(opts, pagination) end @spec fetch_public_activities(map(), Pagination.type()) :: [Activity.t()] @@ -751,6 +768,7 @@ defp object_ids_query_for_tags(tags) do |> join(:inner, [hto], ht in Pleroma.Hashtag, on: hto.hashtag_id == ht.id) |> where([hto, ht], ht.name in ^tags) |> select([hto], hto.object_id) + |> distinct([hto], true) end defp restrict_hashtag_all(_query, %{tag_all: _tag, skip_preload: true}) do @@ -789,9 +807,18 @@ defp restrict_hashtag_any(_query, %{tag: _tag, skip_preload: true}) do end defp restrict_hashtag_any(query, %{tag: [_ | _] = tags}) do + hashtag_ids = + from(ht in Hashtag, where: ht.name in ^tags, select: ht.id) + |> Repo.all() + + # Note: NO extra ordering should be done on "activities.id desc nulls last" for optimal plan from( [_activity, object] in query, - where: object.id in subquery(object_ids_query_for_tags(tags)) + join: hto in "hashtags_objects", + on: hto.object_id == object.id, + where: hto.hashtag_id in ^hashtag_ids, + distinct: [desc: object.id], + order_by: [desc: object.id] ) end @@ -1188,7 +1215,12 @@ defp normalize_fetch_activities_query_opts(opts) do Map.put(opts, key, Hashtag.normalize_name(value)) value when is_list(value) -> - Map.put(opts, key, Enum.map(value, &Hashtag.normalize_name/1)) + normalized_value = + value + |> Enum.map(&Hashtag.normalize_name/1) + |> Enum.uniq() + + Map.put(opts, key, normalized_value) _ -> opts @@ -1275,15 +1307,6 @@ def fetch_activities_query(recipients, opts \\ %{}) do end end - def fetch_activities(recipients, opts \\ %{}, pagination \\ :keyset) do - list_memberships = Pleroma.List.memberships(opts[:user]) - - fetch_activities_query(recipients ++ list_memberships, opts) - |> Pagination.fetch_paginated(opts, pagination) - |> Enum.reverse() - |> maybe_update_cc(list_memberships, opts[:user]) - end - @doc """ Fetch favorites activities of user with order by sort adds to favorites """ diff --git a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex index 87effa00b..c611958be 100644 --- a/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex @@ -133,34 +133,25 @@ defp fail_on_bad_auth(conn) do end defp hashtag_fetching(params, user, local_only) do - tags = + # Note: not sanitizing tag options at this stage (may be mix-cased, have duplicates etc.) + tags_any = [params[:tag], params[:any]] |> List.flatten() - |> Enum.reject(&is_nil/1) - |> Enum.map(&String.downcase/1) - |> Enum.uniq() - - tag_all = - params - |> Map.get(:all, []) - |> Enum.map(&String.downcase/1) - - tag_reject = - params - |> Map.get(:none, []) - |> Enum.map(&String.downcase/1) - - _activities = - params - |> Map.put(:type, "Create") - |> Map.put(:local_only, local_only) - |> Map.put(:blocking_user, user) - |> Map.put(:muting_user, user) - |> Map.put(:user, user) - |> Map.put(:tag, tags) - |> Map.put(:tag_all, tag_all) - |> Map.put(:tag_reject, tag_reject) - |> ActivityPub.fetch_public_activities() + |> Enum.filter(& &1) + + tag_all = Map.get(params, :all, []) + tag_reject = Map.get(params, :none, []) + + params + |> Map.put(:type, "Create") + |> Map.put(:local_only, local_only) + |> Map.put(:blocking_user, user) + |> Map.put(:muting_user, user) + |> Map.put(:user, user) + |> Map.put(:tag, tags_any) + |> Map.put(:tag_all, tag_all) + |> Map.put(:tag_reject, tag_reject) + |> ActivityPub.fetch_public_activities() end # GET /api/v1/timelines/tag/:tag -- cgit v1.2.3 From 8feeb672c8ec0b916d94fb516ea05b464342e19b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 10 Mar 2021 13:03:14 -0600 Subject: Ensure we fetch deps during spec-build stage --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c7e8291d8..68644660c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,6 +40,7 @@ spec-build: paths: - spec.json script: + - mix deps.get - mix pleroma.openapi_spec spec.json benchmark: @@ -393,4 +394,4 @@ docker-adhoc: tags: - dind only: - - /^build-docker/.*$/@pleroma/pleroma \ No newline at end of file + - /^build-docker/.*$/@pleroma/pleroma -- cgit v1.2.3 From 502d166b7e44e36a94974df4770de6c6a239ad75 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 10 Mar 2021 16:19:18 -0600 Subject: See if switching to same image as releases fixes the build --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68644660c..ea6611947 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: elixir:1.9.4 +image: elixir:1.10.3 variables: &global_variables POSTGRES_DB: pleroma_test -- cgit v1.2.3 From fa75f11ca138e69952cf1a1483a8b848b3b0d1b9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 10 Mar 2021 16:37:24 -0600 Subject: Revert "See if switching to same image as releases fixes the build" This reverts commit 502d166b7e44e36a94974df4770de6c6a239ad75. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ea6611947..68644660c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: elixir:1.10.3 +image: elixir:1.9.4 variables: &global_variables POSTGRES_DB: pleroma_test -- cgit v1.2.3 From 8246db2a968943a0cab615b8b5c1439aa4cb2547 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 6 Mar 2021 12:02:32 -0600 Subject: Workaround for URI.merge/2 bug https://github.com/elixir-lang/elixir/issues/10771 If we avoid URI.merge unless we know we need it we reduce the edge cases we could encounter. The site would need to both have "//" in the %URI{:path} and the image needs to be a relative URL. --- lib/pleroma/web/mastodon_api/views/status_view.ex | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index f3f54e03d..cf8037abb 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -380,9 +380,15 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do page_url = page_url_data |> to_string image_url = - if is_binary(rich_media["image"]) do - URI.merge(page_url_data, URI.parse(rich_media["image"])) - |> to_string + cond do + !is_binary(rich_media["image"]) -> + nil + + String.starts_with?(rich_media["image"], "http") -> + rich_media["image"] + + true -> + URI.merge(page_url_data, URI.parse(rich_media["image"])) |> to_string end %{ -- cgit v1.2.3 From 029ff6538972b59c6259dd7345ad9c4465fb3f73 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Mar 2021 09:20:29 -0600 Subject: Leverage function pattern matching instead --- lib/pleroma/web/mastodon_api/views/status_view.ex | 36 ++++++++++++++++------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index cf8037abb..581b4e952 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -379,18 +379,15 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do page_url = page_url_data |> to_string - image_url = - cond do - !is_binary(rich_media["image"]) -> - nil - - String.starts_with?(rich_media["image"], "http") -> - rich_media["image"] - - true -> - URI.merge(page_url_data, URI.parse(rich_media["image"])) |> to_string + image_url_data = + if is_binary(rich_media["image"]) do + URI.parse(rich_media["image"]) + else + nil end + image_url = get_image_url(image_url_data, page_url_data) + %{ type: "link", provider_name: page_url_data.host, @@ -546,4 +543,23 @@ defp build_application(%{"type" => _type, "name" => name, "url" => url}), do: %{name: name, website: url} defp build_application(_), do: nil + + # Workaround for Elixir issue #10771 + # Avoid applying URI.merge unless necessary + # TODO: revert to always attempting URI.merge(image_url_data, page_url_data) + # when Elixir 1.12 is the minimum supported version + @spec get_image_url(struct() | nil, struct()) :: String.t() | nil + defp get_image_url( + %URI{scheme: image_scheme, host: image_host} = image_url_data, + %URI{} = _page_url_data + ) + when not is_nil(image_scheme) and not is_nil(image_host) do + image_url_data |> to_string + end + + defp get_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do + URI.merge(page_url_data, image_url_data) |> to_string + end + + defp get_image_url(_, _), do: nil end -- cgit v1.2.3 From 884584772bd7ff52825bbb3bd38ca7c6190c084a Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 11 Mar 2021 09:40:40 -0600 Subject: Execute mix deps.get earlier and avoid duplicate invocations if possible --- .gitlab-ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68644660c..2bc571971 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,13 +25,13 @@ before_script: - apt-get update && apt-get install -y cmake - mix local.hex --force - mix local.rebar --force + - mix deps.get - apt-get -qq update - apt-get install -y libmagic-dev build: stage: build script: - - mix deps.get - mix compile --force spec-build: @@ -40,7 +40,6 @@ spec-build: paths: - spec.json script: - - mix deps.get - mix pleroma.openapi_spec spec.json benchmark: @@ -53,7 +52,6 @@ benchmark: alias: postgres command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: - - mix deps.get - mix ecto.create - mix ecto.migrate - mix pleroma.load_testing @@ -71,7 +69,6 @@ unit-testing: command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"] script: - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg - - mix deps.get - mix ecto.create - mix ecto.migrate - mix coveralls --preload-modules @@ -105,7 +102,6 @@ unit-testing-rum: RUM_ENABLED: "true" script: - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg - - mix deps.get - mix ecto.create - mix ecto.migrate - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/" @@ -121,7 +117,6 @@ analysis: stage: test cache: *testing_cache_policy script: - - mix deps.get - mix credo --strict --only=warnings,todo,fixme,consistency,readability docs-deploy: -- cgit v1.2.3 From 3edf45021eb6c3fba06bc083b346f7db54cd073f Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Fri, 12 Mar 2021 12:18:11 +0300 Subject: [#3213] Background migration infrastructure refactoring. Extracted BaseMigrator and BaseMigratorState. --- lib/pleroma/application.ex | 11 +- lib/pleroma/migrators/hashtags_table_migrator.ex | 265 ++++----------------- .../migrators/hashtags_table_migrator/state.ex | 104 -------- lib/pleroma/migrators/support/base_migrator.ex | 210 ++++++++++++++++ .../migrators/support/base_migrator_state.ex | 116 +++++++++ 5 files changed, 385 insertions(+), 321 deletions(-) delete mode 100644 lib/pleroma/migrators/hashtags_table_migrator/state.ex create mode 100644 lib/pleroma/migrators/support/base_migrator.ex create mode 100644 lib/pleroma/migrators/support/base_migrator_state.ex diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 2ff7562e2..06d399b2e 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -103,10 +103,7 @@ def start(_type, _args) do task_children(@mix_env) ++ dont_run_in_test(@mix_env) ++ chat_child(chat_enabled?()) ++ - [ - Pleroma.Migrators.HashtagsTableMigrator, - Pleroma.Gopher.Server - ] + [Pleroma.Gopher.Server] # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html # for other strategies and supported options @@ -231,6 +228,12 @@ defp dont_run_in_test(_) do keys: :duplicate, partitions: System.schedulers_online() ]} + ] ++ background_migrators() + end + + defp background_migrators do + [ + Pleroma.Migrators.HashtagsTableMigrator ] end diff --git a/lib/pleroma/migrators/hashtags_table_migrator.ex b/lib/pleroma/migrators/hashtags_table_migrator.ex index 6123c88e0..b84058e11 100644 --- a/lib/pleroma/migrators/hashtags_table_migrator.ex +++ b/lib/pleroma/migrators/hashtags_table_migrator.ex @@ -3,88 +3,27 @@ # SPDX-License-Identifier: AGPL-3.0-only defmodule Pleroma.Migrators.HashtagsTableMigrator do - use GenServer + defmodule State do + use Pleroma.Migrators.Support.BaseMigratorState - require Logger + @impl Pleroma.Migrators.Support.BaseMigratorState + defdelegate data_migration(), to: Pleroma.DataMigration, as: :populate_hashtags_table + end - import Ecto.Query + use Pleroma.Migrators.Support.BaseMigrator - alias __MODULE__.State - alias Pleroma.Config alias Pleroma.Hashtag + alias Pleroma.Migrators.Support.BaseMigrator alias Pleroma.Object - alias Pleroma.Repo - - defdelegate data_migration(), to: Pleroma.DataMigration, as: :populate_hashtags_table - defdelegate data_migration_id(), to: State - - defdelegate state(), to: State - defdelegate persist_state(), to: State, as: :persist_to_db - defdelegate get_stat(key, value \\ nil), to: State, as: :get_data_key - defdelegate put_stat(key, value), to: State, as: :put_data_key - defdelegate increment_stat(key, increment), to: State, as: :increment_data_key - - @feature_config_path [:features, :improved_hashtag_timeline] - @reg_name {:global, __MODULE__} - - def whereis, do: GenServer.whereis(@reg_name) - - def feature_state, do: Config.get(@feature_config_path) - - def start_link(_) do - case whereis() do - nil -> - GenServer.start_link(__MODULE__, nil, name: @reg_name) - - pid -> - {:ok, pid} - end - end - - @impl true - def init(_) do - {:ok, nil, {:continue, :init_state}} - end - @impl true - def handle_continue(:init_state, _state) do - {:ok, _} = State.start_link(nil) + @impl BaseMigrator + def feature_config_path, do: [:features, :improved_hashtag_timeline] - data_migration = data_migration() - manual_migrations = Config.get([:instance, :manual_data_migrations], []) - - cond do - Config.get(:env) == :test -> - update_status(:noop) - - is_nil(data_migration) -> - message = "Data migration does not exist." - update_status(:failed, message) - Logger.error("#{__MODULE__}: #{message}") - - data_migration.state == :manual or data_migration.name in manual_migrations -> - message = "Data migration is in manual execution or manual fix mode." - update_status(:manual, message) - Logger.warn("#{__MODULE__}: #{message}") - - data_migration.state == :complete -> - on_complete(data_migration) - - true -> - send(self(), :migrate_hashtags) - end - - {:noreply, nil} - end - - @impl true - def handle_info(:migrate_hashtags, state) do - State.reinit() - - update_status(:running) - put_stat(:iteration_processed_count, 0) - put_stat(:started_at, NaiveDateTime.utc_now()) + @impl BaseMigrator + def fault_rate_allowance, do: Config.get([:populate_hashtags_table, :fault_rate_allowance], 0) + @impl BaseMigrator + def perform do data_migration_id = data_migration_id() max_processed_id = get_stat(:max_processed_id, 0) @@ -103,7 +42,7 @@ def handle_info(:migrate_hashtags, state) do |> Enum.filter(&(elem(&1, 0) == :error)) |> Enum.map(&elem(&1, 1)) - # Count of objects with hashtags (`{:noop, id}` is returned for objects having other AS2 tags) + # Count of objects with hashtags: `{:noop, id}` is returned for objects having other AS2 tags chunk_affected_count = results |> Enum.filter(&(elem(&1, 0) == :ok)) @@ -140,84 +79,10 @@ def handle_info(:migrate_hashtags, state) do Process.sleep(sleep_interval) end) |> Stream.run() - - fault_rate = fault_rate() - put_stat(:fault_rate, fault_rate) - fault_rate_allowance = Config.get([:populate_hashtags_table, :fault_rate_allowance], 0) - - cond do - fault_rate == 0 -> - set_complete() - - is_float(fault_rate) and fault_rate <= fault_rate_allowance -> - message = """ - Done with fault rate of #{fault_rate} which doesn't exceed #{fault_rate_allowance}. - Putting data migration to manual fix mode. Check `retry_failed/0`. - """ - - Logger.warn("#{__MODULE__}: #{message}") - update_status(:manual, message) - on_complete(data_migration()) - - true -> - message = "Too many failures. Check data_migration_failed_ids records / `retry_failed/0`." - Logger.error("#{__MODULE__}: #{message}") - update_status(:failed, message) - end - - persist_state() - {:noreply, state} - end - - def fault_rate do - with failures_count when is_integer(failures_count) <- failures_count() do - failures_count / Enum.max([get_stat(:affected_count, 0), 1]) - else - _ -> :error - end - end - - defp records_per_second do - get_stat(:iteration_processed_count, 0) / Enum.max([running_time(), 1]) - end - - defp running_time do - NaiveDateTime.diff(NaiveDateTime.utc_now(), get_stat(:started_at, NaiveDateTime.utc_now())) - end - - @hashtags_objects_cleanup_query """ - DELETE FROM hashtags_objects WHERE object_id IN - (SELECT DISTINCT objects.id FROM objects - JOIN hashtags_objects ON hashtags_objects.object_id = objects.id LEFT JOIN activities - ON COALESCE(activities.data->'object'->>'id', activities.data->>'object') = - (objects.data->>'id') - AND activities.data->>'type' = 'Create' - WHERE activities.id IS NULL); - """ - - @hashtags_cleanup_query """ - DELETE FROM hashtags WHERE id IN - (SELECT hashtags.id FROM hashtags - LEFT OUTER JOIN hashtags_objects - ON hashtags_objects.hashtag_id = hashtags.id - WHERE hashtags_objects.hashtag_id IS NULL); - """ - - @doc """ - Deletes `hashtags_objects` for legacy objects not asoociated with Create activity. - Also deletes unreferenced `hashtags` records (might occur after deletion of `hashtags_objects`). - """ - def delete_non_create_activities_hashtags do - {:ok, %{num_rows: hashtags_objects_count}} = - Repo.query(@hashtags_objects_cleanup_query, [], timeout: :infinity) - - {:ok, %{num_rows: hashtags_count}} = - Repo.query(@hashtags_cleanup_query, [], timeout: :infinity) - - {:ok, hashtags_objects_count, hashtags_count} end - defp query do + @impl BaseMigrator + def query do # Note: most objects have Mention-type AS2 tags and no hashtags (but we can't filter them out) # Note: not checking activity type, expecting remove_non_create_objects_hashtags/_ to clean up from( @@ -276,54 +141,7 @@ defp transfer_object_hashtags(object, hashtags) do end) end - @doc "Approximate count for current iteration (including processed records count)" - def count(force \\ false, timeout \\ :infinity) do - stored_count = get_stat(:count) - - if stored_count && !force do - stored_count - else - processed_count = get_stat(:processed_count, 0) - max_processed_id = get_stat(:max_processed_id, 0) - query = where(query(), [object], object.id > ^max_processed_id) - - count = Repo.aggregate(query, :count, :id, timeout: timeout) + processed_count - put_stat(:count, count) - persist_state() - - count - end - end - - defp on_complete(data_migration) do - if data_migration.feature_lock || feature_state() == :disabled do - Logger.warn("#{__MODULE__}: migration complete but feature is locked; consider enabling.") - :noop - else - Config.put(@feature_config_path, :enabled) - :ok - end - end - - def failed_objects_query do - from(o in Object) - |> join(:inner, [o], dmf in fragment("SELECT * FROM data_migration_failed_ids"), - on: dmf.record_id == o.id - ) - |> where([_o, dmf], dmf.data_migration_id == ^data_migration_id()) - |> order_by([o], asc: o.id) - end - - def failures_count do - with {:ok, %{rows: [[count]]}} <- - Repo.query( - "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", - [data_migration_id()] - ) do - count - end - end - + @impl BaseMigrator def retry_failed do data_migration_id = data_migration_id() @@ -347,23 +165,44 @@ def retry_failed do force_continue() end - def force_continue do - send(whereis(), :migrate_hashtags) + defp failed_objects_query do + from(o in Object) + |> join(:inner, [o], dmf in fragment("SELECT * FROM data_migration_failed_ids"), + on: dmf.record_id == o.id + ) + |> where([_o, dmf], dmf.data_migration_id == ^data_migration_id()) + |> order_by([o], asc: o.id) end - def force_restart do - :ok = State.reset() - force_continue() - end + @doc """ + Service func to delete `hashtags_objects` for legacy objects not associated with Create activity. + Also deletes unreferenced `hashtags` records (might occur after deletion of `hashtags_objects`). + """ + def delete_non_create_activities_hashtags do + hashtags_objects_cleanup_query = """ + DELETE FROM hashtags_objects WHERE object_id IN + (SELECT DISTINCT objects.id FROM objects + JOIN hashtags_objects ON hashtags_objects.object_id = objects.id LEFT JOIN activities + ON COALESCE(activities.data->'object'->>'id', activities.data->>'object') = + (objects.data->>'id') + AND activities.data->>'type' = 'Create' + WHERE activities.id IS NULL); + """ + + hashtags_cleanup_query = """ + DELETE FROM hashtags WHERE id IN + (SELECT hashtags.id FROM hashtags + LEFT OUTER JOIN hashtags_objects + ON hashtags_objects.hashtag_id = hashtags.id + WHERE hashtags_objects.hashtag_id IS NULL); + """ - def set_complete do - update_status(:complete) - persist_state() - on_complete(data_migration()) - end + {:ok, %{num_rows: hashtags_objects_count}} = + Repo.query(hashtags_objects_cleanup_query, [], timeout: :infinity) - defp update_status(status, message \\ nil) do - put_stat(:state, status) - put_stat(:message, message) + {:ok, %{num_rows: hashtags_count}} = + Repo.query(hashtags_cleanup_query, [], timeout: :infinity) + + {:ok, hashtags_objects_count, hashtags_count} end end diff --git a/lib/pleroma/migrators/hashtags_table_migrator/state.ex b/lib/pleroma/migrators/hashtags_table_migrator/state.ex deleted file mode 100644 index ee0009b2e..000000000 --- a/lib/pleroma/migrators/hashtags_table_migrator/state.ex +++ /dev/null @@ -1,104 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Migrators.HashtagsTableMigrator.State do - use Agent - - alias Pleroma.DataMigration - - defdelegate data_migration(), to: Pleroma.Migrators.HashtagsTableMigrator - - @reg_name {:global, __MODULE__} - - def start_link(_) do - Agent.start_link(fn -> load_state_from_db() end, name: @reg_name) - end - - defp load_state_from_db do - data_migration = data_migration() - - data = - if data_migration do - Map.new(data_migration.data, fn {k, v} -> {String.to_atom(k), v} end) - else - %{} - end - - %{ - data_migration_id: data_migration && data_migration.id, - data: data - } - end - - def persist_to_db do - %{data_migration_id: data_migration_id, data: data} = state() - - if data_migration_id do - DataMigration.update_one_by_id(data_migration_id, data: data) - else - {:error, :nil_data_migration_id} - end - end - - def reset do - %{data_migration_id: data_migration_id} = state() - - with false <- is_nil(data_migration_id), - :ok <- - DataMigration.update_one_by_id(data_migration_id, - state: :pending, - data: %{} - ) do - reinit() - else - true -> {:error, :nil_data_migration_id} - e -> e - end - end - - def reinit do - Agent.update(@reg_name, fn _state -> load_state_from_db() end) - end - - def state do - Agent.get(@reg_name, & &1) - end - - def get_data_key(key, default \\ nil) do - get_in(state(), [:data, key]) || default - end - - def put_data_key(key, value) do - _ = persist_non_data_change(key, value) - - Agent.update(@reg_name, fn state -> - put_in(state, [:data, key], value) - end) - end - - def increment_data_key(key, increment \\ 1) do - Agent.update(@reg_name, fn state -> - initial_value = get_in(state, [:data, key]) || 0 - updated_value = initial_value + increment - put_in(state, [:data, key], updated_value) - end) - end - - defp persist_non_data_change(:state, value) do - with true <- get_data_key(:state) != value, - true <- value in Pleroma.DataMigration.State.__valid_values__(), - %{data_migration_id: data_migration_id} when not is_nil(data_migration_id) <- state() do - DataMigration.update_one_by_id(data_migration_id, state: value) - else - false -> :ok - _ -> {:error, :nil_data_migration_id} - end - end - - defp persist_non_data_change(_, _) do - nil - end - - def data_migration_id, do: Map.get(state(), :data_migration_id) -end diff --git a/lib/pleroma/migrators/support/base_migrator.ex b/lib/pleroma/migrators/support/base_migrator.ex new file mode 100644 index 000000000..1f8a5402b --- /dev/null +++ b/lib/pleroma/migrators/support/base_migrator.ex @@ -0,0 +1,210 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Migrators.Support.BaseMigrator do + @moduledoc """ + Base background migrator functionality. + """ + + @callback perform() :: any() + @callback retry_failed() :: any() + @callback feature_config_path() :: list(atom()) + @callback query() :: Ecto.Query.t() + @callback fault_rate_allowance() :: integer() | float() + + defmacro __using__(_opts) do + quote do + use GenServer + + require Logger + + import Ecto.Query + + alias __MODULE__.State + alias Pleroma.Config + alias Pleroma.Repo + + @behaviour Pleroma.Migrators.Support.BaseMigrator + + defdelegate data_migration(), to: State + defdelegate data_migration_id(), to: State + defdelegate state(), to: State + defdelegate persist_state(), to: State, as: :persist_to_db + defdelegate get_stat(key, value \\ nil), to: State, as: :get_data_key + defdelegate put_stat(key, value), to: State, as: :put_data_key + defdelegate increment_stat(key, increment), to: State, as: :increment_data_key + + @reg_name {:global, __MODULE__} + + def whereis, do: GenServer.whereis(@reg_name) + + def start_link(_) do + case whereis() do + nil -> + GenServer.start_link(__MODULE__, nil, name: @reg_name) + + pid -> + {:ok, pid} + end + end + + @impl true + def init(_) do + {:ok, nil, {:continue, :init_state}} + end + + @impl true + def handle_continue(:init_state, _state) do + {:ok, _} = State.start_link(nil) + + data_migration = data_migration() + manual_migrations = Config.get([:instance, :manual_data_migrations], []) + + cond do + Config.get(:env) == :test -> + update_status(:noop) + + is_nil(data_migration) -> + message = "Data migration does not exist." + update_status(:failed, message) + Logger.error("#{__MODULE__}: #{message}") + + data_migration.state == :manual or data_migration.name in manual_migrations -> + message = "Data migration is in manual execution or manual fix mode." + update_status(:manual, message) + Logger.warn("#{__MODULE__}: #{message}") + + data_migration.state == :complete -> + on_complete(data_migration) + + true -> + send(self(), :perform) + end + + {:noreply, nil} + end + + @impl true + def handle_info(:perform, state) do + State.reinit() + + update_status(:running) + put_stat(:iteration_processed_count, 0) + put_stat(:started_at, NaiveDateTime.utc_now()) + + perform() + + fault_rate = fault_rate() + put_stat(:fault_rate, fault_rate) + fault_rate_allowance = fault_rate_allowance() + + cond do + fault_rate == 0 -> + set_complete() + + is_float(fault_rate) and fault_rate <= fault_rate_allowance -> + message = """ + Done with fault rate of #{fault_rate} which doesn't exceed #{fault_rate_allowance}. + Putting data migration to manual fix mode. Try running `#{__MODULE__}.retry_failed/0`. + """ + + Logger.warn("#{__MODULE__}: #{message}") + update_status(:manual, message) + on_complete(data_migration()) + + true -> + message = "Too many failures. Try running `#{__MODULE__}.retry_failed/0`." + Logger.error("#{__MODULE__}: #{message}") + update_status(:failed, message) + end + + persist_state() + {:noreply, state} + end + + defp on_complete(data_migration) do + if data_migration.feature_lock || feature_state() == :disabled do + Logger.warn( + "#{__MODULE__}: migration complete but feature is locked; consider enabling." + ) + + :noop + else + Config.put(feature_config_path(), :enabled) + :ok + end + end + + @doc "Approximate count for current iteration (including processed records count)" + def count(force \\ false, timeout \\ :infinity) do + stored_count = get_stat(:count) + + if stored_count && !force do + stored_count + else + processed_count = get_stat(:processed_count, 0) + max_processed_id = get_stat(:max_processed_id, 0) + query = where(query(), [entity], entity.id > ^max_processed_id) + + count = Repo.aggregate(query, :count, :id, timeout: timeout) + processed_count + put_stat(:count, count) + persist_state() + + count + end + end + + def failures_count do + with {:ok, %{rows: [[count]]}} <- + Repo.query( + "SELECT COUNT(record_id) FROM data_migration_failed_ids WHERE data_migration_id = $1;", + [data_migration_id()] + ) do + count + end + end + + def feature_state, do: Config.get(feature_config_path()) + + def force_continue do + send(whereis(), :perform) + end + + def force_restart do + :ok = State.reset() + force_continue() + end + + def set_complete do + update_status(:complete) + persist_state() + on_complete(data_migration()) + end + + defp update_status(status, message \\ nil) do + put_stat(:state, status) + put_stat(:message, message) + end + + defp fault_rate do + with failures_count when is_integer(failures_count) <- failures_count() do + failures_count / Enum.max([get_stat(:affected_count, 0), 1]) + else + _ -> :error + end + end + + defp records_per_second do + get_stat(:iteration_processed_count, 0) / Enum.max([running_time(), 1]) + end + + defp running_time do + NaiveDateTime.diff( + NaiveDateTime.utc_now(), + get_stat(:started_at, NaiveDateTime.utc_now()) + ) + end + end + end +end diff --git a/lib/pleroma/migrators/support/base_migrator_state.ex b/lib/pleroma/migrators/support/base_migrator_state.ex new file mode 100644 index 000000000..69724ae79 --- /dev/null +++ b/lib/pleroma/migrators/support/base_migrator_state.ex @@ -0,0 +1,116 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Migrators.Support.BaseMigratorState do + @moduledoc """ + Base background migrator state functionality. + """ + + @callback data_migration() :: Pleroma.DataMigration.t() + + defmacro __using__(_opts) do + quote do + use Agent + + alias Pleroma.DataMigration + + @behaviour Pleroma.Migrators.Support.BaseMigratorState + @reg_name {:global, __MODULE__} + + def start_link(_) do + Agent.start_link(fn -> load_state_from_db() end, name: @reg_name) + end + + def data_migration, do: raise("data_migration/0 is not implemented") + defoverridable data_migration: 0 + + defp load_state_from_db do + data_migration = data_migration() + + data = + if data_migration do + Map.new(data_migration.data, fn {k, v} -> {String.to_atom(k), v} end) + else + %{} + end + + %{ + data_migration_id: data_migration && data_migration.id, + data: data + } + end + + def persist_to_db do + %{data_migration_id: data_migration_id, data: data} = state() + + if data_migration_id do + DataMigration.update_one_by_id(data_migration_id, data: data) + else + {:error, :nil_data_migration_id} + end + end + + def reset do + %{data_migration_id: data_migration_id} = state() + + with false <- is_nil(data_migration_id), + :ok <- + DataMigration.update_one_by_id(data_migration_id, + state: :pending, + data: %{} + ) do + reinit() + else + true -> {:error, :nil_data_migration_id} + e -> e + end + end + + def reinit do + Agent.update(@reg_name, fn _state -> load_state_from_db() end) + end + + def state do + Agent.get(@reg_name, & &1) + end + + def get_data_key(key, default \\ nil) do + get_in(state(), [:data, key]) || default + end + + def put_data_key(key, value) do + _ = persist_non_data_change(key, value) + + Agent.update(@reg_name, fn state -> + put_in(state, [:data, key], value) + end) + end + + def increment_data_key(key, increment \\ 1) do + Agent.update(@reg_name, fn state -> + initial_value = get_in(state, [:data, key]) || 0 + updated_value = initial_value + increment + put_in(state, [:data, key], updated_value) + end) + end + + defp persist_non_data_change(:state, value) do + with true <- get_data_key(:state) != value, + true <- value in Pleroma.DataMigration.State.__valid_values__(), + %{data_migration_id: data_migration_id} when not is_nil(data_migration_id) <- state() do + DataMigration.update_one_by_id(data_migration_id, state: value) + else + false -> :ok + _ -> {:error, :nil_data_migration_id} + end + end + + defp persist_non_data_change(_, _) do + nil + end + + def data_migration_id, do: Map.get(state(), :data_migration_id) + end + end +end -- cgit v1.2.3 From cb734566093f406fc3db12de2408fc166486f417 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Fri, 12 Mar 2021 12:25:18 +0300 Subject: [#3213] Code formatting fix. --- lib/pleroma/migrators/support/base_migrator_state.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/migrators/support/base_migrator_state.ex b/lib/pleroma/migrators/support/base_migrator_state.ex index 69724ae79..b698587f2 100644 --- a/lib/pleroma/migrators/support/base_migrator_state.ex +++ b/lib/pleroma/migrators/support/base_migrator_state.ex @@ -98,7 +98,8 @@ def increment_data_key(key, increment \\ 1) do defp persist_non_data_change(:state, value) do with true <- get_data_key(:state) != value, true <- value in Pleroma.DataMigration.State.__valid_values__(), - %{data_migration_id: data_migration_id} when not is_nil(data_migration_id) <- state() do + %{data_migration_id: data_migration_id} when not is_nil(data_migration_id) <- + state() do DataMigration.update_one_by_id(data_migration_id, state: value) else false -> :ok -- cgit v1.2.3 From 2408363e2a5115e4856957ba46231211eec6b338 Mon Sep 17 00:00:00 2001 From: Ben Is Date: Thu, 11 Mar 2021 13:51:22 +0000 Subject: Translated using Weblate (Italian) Currently translated at 100.0% (106 of 106 strings) Translation: Pleroma/Pleroma backend Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma/it/ --- priv/gettext/it/LC_MESSAGES/errors.po | 44 +++++++++++++++++------------------ 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/priv/gettext/it/LC_MESSAGES/errors.po b/priv/gettext/it/LC_MESSAGES/errors.po index cd0cd6c65..6a6ec058e 100644 --- a/priv/gettext/it/LC_MESSAGES/errors.po +++ b/priv/gettext/it/LC_MESSAGES/errors.po @@ -3,8 +3,8 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-19 14:33+0000\n" -"PO-Revision-Date: 2020-07-09 14:40+0000\n" -"Last-Translator: Ben Is \n" +"PO-Revision-Date: 2021-03-13 09:40+0000\n" +"Last-Translator: Ben Is \n" "Language-Team: Italian \n" "Language: it\n" @@ -45,7 +45,7 @@ msgstr "ha una voce invalida" ## From Ecto.Changeset.validate_exclusion/3 msgid "is reserved" -msgstr "è vietato" +msgstr "è riservato" ## From Ecto.Changeset.validate_confirmation/3 msgid "does not match confirmation" @@ -123,7 +123,7 @@ msgstr "Richiesta invalida" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:425 #, elixir-format msgid "Can't delete object" -msgstr "Non puoi eliminare quest'oggetto" +msgstr "Oggetto non eliminabile" #: lib/pleroma/web/mastodon_api/controllers/status_controller.ex:196 #, elixir-format @@ -160,12 +160,12 @@ msgstr "Non puoi pubblicare un messaggio vuoto senza allegati" #: lib/pleroma/web/common_api/utils.ex:504 #, elixir-format msgid "Comment must be up to %{max_size} characters" -msgstr "I commenti posso al massimo consistere di %{max_size} caratteri" +msgstr "I commenti posso al massimo contenere %{max_size} caratteri" #: lib/pleroma/config/config_db.ex:222 #, elixir-format msgid "Config with params %{params} not found" -msgstr "Configurazione con parametri %{max_size} non trovata" +msgstr "Configurazione con parametri %{params} non trovata" #: lib/pleroma/web/common_api/common_api.ex:95 #, elixir-format @@ -200,7 +200,7 @@ msgstr "Non de-intestato" #: lib/pleroma/web/common_api/common_api.ex:126 #, elixir-format msgid "Could not unrepeat" -msgstr "Non de-ripetuto" +msgstr "Non de-condiviso" #: lib/pleroma/web/common_api/common_api.ex:428 #: lib/pleroma/web/common_api/common_api.ex:437 @@ -310,12 +310,12 @@ msgstr "Il messaggio ha superato la lunghezza massima" #: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31 #, elixir-format msgid "This resource requires authentication." -msgstr "Accedi per leggere." +msgstr "Accedi per poter leggere." #: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206 #, elixir-format msgid "Throttled" -msgstr "Strozzato" +msgstr "Limitato" #: lib/pleroma/web/common_api/common_api.ex:266 #, elixir-format @@ -347,17 +347,17 @@ msgstr "Devi aggiungere un indirizzo email valido" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:389 #, elixir-format msgid "can't read inbox of %{nickname} as %{as_nickname}" -msgstr "non puoi leggere i messaggi privati di %{nickname} come %{as_nickname}" +msgstr "non puoi leggere i messaggi di %{nickname} come %{as_nickname}" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:472 #, elixir-format msgid "can't update outbox of %{nickname} as %{as_nickname}" -msgstr "non puoi aggiornare gli inviati di %{nickname} come %{as_nickname}" +msgstr "non puoi inviare da %{nickname} come %{as_nickname}" #: lib/pleroma/web/common_api/common_api.ex:388 #, elixir-format msgid "conversation is already muted" -msgstr "la conversazione è già zittita" +msgstr "la conversazione è già silenziata" #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:316 #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:491 @@ -419,7 +419,7 @@ msgstr "Errore interno" #: lib/pleroma/web/oauth/fallback_controller.ex:29 #, elixir-format msgid "Invalid Username/Password" -msgstr "Nome utente/parola d'ordine invalidi" +msgstr "Nome utente/password invalidi" #: lib/pleroma/web/twitter_api/twitter_api.ex:118 #, elixir-format @@ -455,7 +455,7 @@ msgstr "Gestore OAuth non supportato: %{provider}." #: lib/pleroma/uploaders/uploader.ex:72 #, elixir-format msgid "Uploader callback timeout" -msgstr "Callback caricatmento scaduta" +msgstr "Callback caricamento scaduta" #: lib/pleroma/web/uploader_controller.ex:23 #, elixir-format @@ -496,7 +496,7 @@ msgstr "Parametro mancante: %{name}" #: lib/pleroma/web/oauth/oauth_controller.ex:322 #, elixir-format msgid "Password reset is required" -msgstr "Necessario reimpostare parola d'ordine" +msgstr "Necessario reimpostare password" #: lib/pleroma/tests/auth_test_controller.ex:9 #: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/admin_api_controller.ex:6 @@ -540,34 +540,32 @@ msgstr "" #: lib/pleroma/web/pleroma_api/controllers/emoji_api_controller.ex:210 #, elixir-format msgid "Unexpected error occurred while adding file to pack." -msgstr "Errore inaspettato durante l'aggiunta del file al pacchetto." +msgstr "Errore inatteso durante l'aggiunta del file al pacchetto." #: lib/pleroma/web/pleroma_api/controllers/emoji_api_controller.ex:138 #, elixir-format msgid "Unexpected error occurred while creating pack." -msgstr "Errore inaspettato durante la creazione del pacchetto." +msgstr "Errore inatteso durante la creazione del pacchetto." #: lib/pleroma/web/pleroma_api/controllers/emoji_api_controller.ex:278 #, elixir-format msgid "Unexpected error occurred while removing file from pack." -msgstr "Errore inaspettato durante la rimozione del file dal pacchetto." +msgstr "Errore inatteso durante la rimozione del file dal pacchetto." #: lib/pleroma/web/pleroma_api/controllers/emoji_api_controller.ex:250 #, elixir-format msgid "Unexpected error occurred while updating file in pack." -msgstr "Errore inaspettato durante l'aggiornamento del file nel pacchetto." +msgstr "Errore inatteso durante l'aggiornamento del file nel pacchetto." #: lib/pleroma/web/pleroma_api/controllers/emoji_api_controller.ex:179 #, elixir-format msgid "Unexpected error occurred while updating pack metadata." -msgstr "Errore inaspettato durante l'aggiornamento dei metadati del pacchetto." +msgstr "Errore inatteso durante l'aggiornamento dei metadati del pacchetto." #: lib/pleroma/plugs/user_is_admin_plug.ex:21 #, elixir-format msgid "User is not an admin." -msgstr "" -"L'utente non è un amministratore." -"OAuth." +msgstr "L'utente non è un amministratore." #: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61 #, elixir-format -- cgit v1.2.3 From b80f868c6b41d1407cf6e4f2df8913bdf7a954c0 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 13 Mar 2021 12:27:15 -0600 Subject: Prefer naming this function build_image_url/2 --- lib/pleroma/web/mastodon_api/views/status_view.ex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 581b4e952..71f659ba0 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -386,7 +386,7 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do nil end - image_url = get_image_url(image_url_data, page_url_data) + image_url = build_image_url(image_url_data, page_url_data) %{ type: "link", @@ -548,8 +548,8 @@ defp build_application(_), do: nil # Avoid applying URI.merge unless necessary # TODO: revert to always attempting URI.merge(image_url_data, page_url_data) # when Elixir 1.12 is the minimum supported version - @spec get_image_url(struct() | nil, struct()) :: String.t() | nil - defp get_image_url( + @spec build_image_url(struct() | nil, struct()) :: String.t() | nil + defp build_image_url( %URI{scheme: image_scheme, host: image_host} = image_url_data, %URI{} = _page_url_data ) @@ -557,9 +557,9 @@ defp get_image_url( image_url_data |> to_string end - defp get_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do + defp build_image_url(%URI{} = image_url_data, %URI{} = page_url_data) do URI.merge(page_url_data, image_url_data) |> to_string end - defp get_image_url(_, _), do: nil + defp build_image_url(_, _), do: nil end -- cgit v1.2.3 From b1d4b2b81ec97143c41d16ac3f5bc2825b836f4b Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 15 Mar 2021 06:43:12 +0100 Subject: Add support for actor icon being a list (Bridgy) --- lib/pleroma/web/activity_pub/activity_pub.ex | 26 +++---- test/fixtures/bridgy/actor.json | 80 ++++++++++++++++++++++ .../pleroma/web/activity_pub/activity_pub_test.exs | 27 ++++++++ 3 files changed, 118 insertions(+), 15 deletions(-) create mode 100644 test/fixtures/bridgy/actor.json diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 5b45e2ca1..ff478f44c 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1250,21 +1250,17 @@ defp get_actor_url(url) when is_list(url) do defp get_actor_url(_url), do: nil - defp object_to_user_data(data) do - avatar = - data["icon"]["url"] && - %{ - "type" => "Image", - "url" => [%{"href" => data["icon"]["url"]}] - } + defp normalize_image(%{"url" => url}) do + %{ + "type" => "Image", + "url" => [%{"href" => url}] + } + end - banner = - data["image"]["url"] && - %{ - "type" => "Image", - "url" => [%{"href" => data["image"]["url"]}] - } + defp normalize_image(urls) when is_list(urls), do: urls |> List.first() |> normalize_image() + defp normalize_image(_), do: nil + defp object_to_user_data(data) do fields = data |> Map.get("attachment", []) @@ -1308,13 +1304,13 @@ defp object_to_user_data(data) do ap_id: data["id"], uri: get_actor_url(data["url"]), ap_enabled: true, - banner: banner, + banner: normalize_image(data["image"]), fields: fields, emoji: emojis, is_locked: is_locked, is_discoverable: is_discoverable, invisible: invisible, - avatar: avatar, + avatar: normalize_image(data["icon"]), name: data["name"], follower_address: data["followers"], following_address: data["following"], diff --git a/test/fixtures/bridgy/actor.json b/test/fixtures/bridgy/actor.json new file mode 100644 index 000000000..5b2d8982b --- /dev/null +++ b/test/fixtures/bridgy/actor.json @@ -0,0 +1,80 @@ +{ + "id": "https://fed.brid.gy/jk.nipponalba.scot", + "url": "https://fed.brid.gy/r/https://jk.nipponalba.scot", + "urls": [ + { + "value": "https://jk.nipponalba.scot" + }, + { + "value": "https://social.nipponalba.scot/jk" + }, + { + "value": "https://px.nipponalba.scot/jk" + } + ], + "@context": "https://www.w3.org/ns/activitystreams", + "type": "Person", + "name": "J K 🇯🇵🏴󠁧󠁢󠁳󠁣󠁴󠁿", + "image": [ + { + "url": "https://jk.nipponalba.scot/images/profile.jpg", + "type": "Image", + "name": "profile picture" + } + ], + "tag": [ + { + "type": "Tag", + "name": "Craft Beer" + }, + { + "type": "Tag", + "name": "Single Malt Whisky" + }, + { + "type": "Tag", + "name": "Homebrewing" + }, + { + "type": "Tag", + "name": "Scottish Politics" + }, + { + "type": "Tag", + "name": "Scottish History" + }, + { + "type": "Tag", + "name": "Japanese History" + }, + { + "type": "Tag", + "name": "Tech" + }, + { + "type": "Tag", + "name": "Veganism" + }, + { + "type": "Tag", + "name": "Cooking" + } + ], + "icon": [ + { + "url": "https://jk.nipponalba.scot/images/profile.jpg", + "type": "Image", + "name": "profile picture" + } + ], + "preferredUsername": "jk.nipponalba.scot", + "summary": "", + "publicKey": { + "id": "jk.nipponalba.scot", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdarxwzxnNbJ2hneWOYHkYJowk\npyigQtxlUd0VjgSQHwxU9kWqfbrHBVADyTtcqi/4dAzQd3UnCI1TPNnn4LPZY9PW\noiWd3Zl1/EfLFxO7LU9GS7fcSLQkyj5JNhSlN3I8QPudZbybrgRDVZYooDe1D+52\n5KLGqC2ajrIVOiDRTQIDAQAB\n-----END PUBLIC KEY-----" + }, + "inbox": "https://fed.brid.gy/jk.nipponalba.scot/inbox", + "outbox": "https://fed.brid.gy/jk.nipponalba.scot/outbox", + "following": "https://fed.brid.gy/jk.nipponalba.scot/following", + "followers": "https://fed.brid.gy/jk.nipponalba.scot/followers" +} diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index f4023856c..57f12f821 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -208,6 +208,33 @@ test "works for guppe actors" do assert user.name == "Bernie2020 group" assert user.actor_type == "Group" end + + test "works for bridgy actors" do + user_id = "https://fed.brid.gy/jk.nipponalba.scot" + + Tesla.Mock.mock(fn + %{method: :get, url: ^user_id} -> + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/bridgy/actor.json"), + headers: [{"content-type", "application/activity+json"}] + } + end) + + {:ok, user} = ActivityPub.make_user_from_ap_id(user_id) + + assert user.actor_type == "Person" + + assert user.avatar == %{ + "type" => "Image", + "url" => [%{"href" => "https://jk.nipponalba.scot/images/profile.jpg"}] + } + + assert user.banner == %{ + "type" => "Image", + "url" => [%{"href" => "https://jk.nipponalba.scot/images/profile.jpg"}] + } + end end test "it fetches the appropriate tag-restricted posts" do -- cgit v1.2.3 From d7e51206a251b9da0180a4df3c879531ac302e1a Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 18 Mar 2021 13:49:03 +0300 Subject: respect content-type header in finger request --- lib/pleroma/web/web_finger.ex | 98 +++++++++++++++----------- lib/pleroma/web/xml.ex | 2 +- test/fixtures/tesla_mock/xn--q9jyb4c_host_meta | 4 -- test/pleroma/web/web_finger_test.exs | 67 ++++++++++++++++++ test/support/http_request_mock.ex | 47 ++++++------ 5 files changed, 145 insertions(+), 73 deletions(-) delete mode 100644 test/fixtures/tesla_mock/xn--q9jyb4c_host_meta diff --git a/lib/pleroma/web/web_finger.ex b/lib/pleroma/web/web_finger.ex index 15002b29f..21b10e654 100644 --- a/lib/pleroma/web/web_finger.ex +++ b/lib/pleroma/web/web_finger.ex @@ -94,52 +94,56 @@ def represent_user(user, "XML") do |> XmlBuilder.to_doc() end - defp webfinger_from_xml(doc) do - subject = XML.string_from_xpath("//Subject", doc) - - subscribe_address = - ~s{//Link[@rel="http://ostatus.org/schema/1.0/subscribe"]/@template} - |> XML.string_from_xpath(doc) - - ap_id = - ~s{//Link[@rel="self" and @type="application/activity+json"]/@href} - |> XML.string_from_xpath(doc) - - data = %{ - "subject" => subject, - "subscribe_address" => subscribe_address, - "ap_id" => ap_id - } + defp webfinger_from_xml(body) do + with {:ok, doc} <- XML.parse_document(body) do + subject = XML.string_from_xpath("//Subject", doc) + + subscribe_address = + ~s{//Link[@rel="http://ostatus.org/schema/1.0/subscribe"]/@template} + |> XML.string_from_xpath(doc) + + ap_id = + ~s{//Link[@rel="self" and @type="application/activity+json"]/@href} + |> XML.string_from_xpath(doc) + + data = %{ + "subject" => subject, + "subscribe_address" => subscribe_address, + "ap_id" => ap_id + } - {:ok, data} + {:ok, data} + end end - defp webfinger_from_json(doc) do - data = - Enum.reduce(doc["links"], %{"subject" => doc["subject"]}, fn link, data -> - case {link["type"], link["rel"]} do - {"application/activity+json", "self"} -> - Map.put(data, "ap_id", link["href"]) + defp webfinger_from_json(body) do + with {:ok, doc} <- Jason.decode(body) do + data = + Enum.reduce(doc["links"], %{"subject" => doc["subject"]}, fn link, data -> + case {link["type"], link["rel"]} do + {"application/activity+json", "self"} -> + Map.put(data, "ap_id", link["href"]) - {"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} -> - Map.put(data, "ap_id", link["href"]) + {"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} -> + Map.put(data, "ap_id", link["href"]) - {nil, "http://ostatus.org/schema/1.0/subscribe"} -> - Map.put(data, "subscribe_address", link["template"]) + {nil, "http://ostatus.org/schema/1.0/subscribe"} -> + Map.put(data, "subscribe_address", link["template"]) - _ -> - Logger.debug("Unhandled type: #{inspect(link["type"])}") - data - end - end) + _ -> + Logger.debug("Unhandled type: #{inspect(link["type"])}") + data + end + end) - {:ok, data} + {:ok, data} + end end def get_template_from_xml(body) do xpath = "//Link[@rel='lrdd']/@template" - with doc when doc != :error <- XML.parse_document(body), + with {:ok, doc} <- XML.parse_document(body), template when template != nil <- XML.string_from_xpath(xpath, doc) do {:ok, template} end @@ -192,15 +196,23 @@ def finger(account) do address, [{"accept", "application/xrd+xml,application/jrd+json"}] ), - {:ok, %{status: status, body: body}} when status in 200..299 <- response do - doc = XML.parse_document(body) - - if doc != :error do - webfinger_from_xml(doc) - else - with {:ok, doc} <- Jason.decode(body) do - webfinger_from_json(doc) - end + {:ok, %{status: status, body: body, headers: headers}} when status in 200..299 <- + response do + case List.keyfind(headers, "content-type", 0) do + {_, content_type} -> + case Plug.Conn.Utils.media_type(content_type) do + {:ok, "application", subtype, _} when subtype in ~w(xrd+xml xml) -> + webfinger_from_xml(body) + + {:ok, "application", subtype, _} when subtype in ~w(jrd+json json) -> + webfinger_from_json(body) + + _ -> + {:error, {:content_type, content_type}} + end + + _ -> + {:error, {:content_type, nil}} end else e -> diff --git a/lib/pleroma/web/xml.ex b/lib/pleroma/web/xml.ex index 2b34611ac..0ab6e9d32 100644 --- a/lib/pleroma/web/xml.ex +++ b/lib/pleroma/web/xml.ex @@ -31,7 +31,7 @@ def parse_document(text) do |> :binary.bin_to_list() |> :xmerl_scan.string(quiet: true) - doc + {:ok, doc} rescue _e -> Logger.debug("Couldn't parse XML: #{inspect(text)}") diff --git a/test/fixtures/tesla_mock/xn--q9jyb4c_host_meta b/test/fixtures/tesla_mock/xn--q9jyb4c_host_meta deleted file mode 100644 index 45d260e55..000000000 --- a/test/fixtures/tesla_mock/xn--q9jyb4c_host_meta +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/test/pleroma/web/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs index 84477d5a1..2d7b4a40b 100644 --- a/test/pleroma/web/web_finger_test.exs +++ b/test/pleroma/web/web_finger_test.exs @@ -45,6 +45,26 @@ test "returns error for nonsensical input" do assert {:error, _} = WebFinger.finger("pleroma.social") end + test "returns error when there is no content-type header" do + Tesla.Mock.mock(fn + %{url: "http://social.heldscal.la/.well-known/host-meta"} -> + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/social.heldscal.la_host_meta") + }} + + %{ + url: + "https://social.heldscal.la/.well-known/webfinger?resource=acct:invalid_content@social.heldscal.la" + } -> + {:ok, %Tesla.Env{status: 200, body: ""}} + end) + + user = "invalid_content@social.heldscal.la" + assert {:error, {:content_type, nil}} = WebFinger.finger(user) + end + test "returns error when fails parse xml or json" do user = "invalid_content@social.heldscal.la" assert {:error, %Jason.DecodeError{}} = WebFinger.finger(user) @@ -113,5 +133,52 @@ test "it works with idna domains as link" do ap_id = "https://" <> to_string(:idna.encode("zetsubou.みんな")) <> "/users/lain" {:ok, _data} = WebFinger.finger(ap_id) end + + test "respects json content-type" do + Tesla.Mock.mock(fn + %{ + url: + "https://mastodon.social/.well-known/webfinger?resource=acct:emelie@mastodon.social" + } -> + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/webfinger_emelie.json"), + headers: [{"content-type", "application/jrd+json"}] + }} + + %{url: "http://mastodon.social/.well-known/host-meta"} -> + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/mastodon.social_host_meta") + }} + end) + + {:ok, _data} = WebFinger.finger("emelie@mastodon.social") + end + + test "respects xml content-type" do + Tesla.Mock.mock(fn + %{ + url: "https://pawoo.net/.well-known/webfinger?resource=acct:pekorino@pawoo.net" + } -> + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/https___pawoo.net_users_pekorino.xml"), + headers: [{"content-type", "application/xrd+xml"}] + }} + + %{url: "http://pawoo.net/.well-known/host-meta"} -> + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/pawoo.net_host_meta") + }} + end) + + {:ok, _data} = WebFinger.finger("pekorino@pawoo.net") + end end end diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 1328d6225..1e98020f0 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -122,7 +122,7 @@ def get( %Tesla.Env{ status: 200, body: File.read!("test/fixtures/tesla_mock/mike@osada.macgirvin.com.json"), - headers: activitypub_object_headers() + headers: [{"content-type", "application/jrd+json"}] }} end @@ -187,7 +187,8 @@ def get( {:ok, %Tesla.Env{ status: 200, - body: File.read!("test/fixtures/tesla_mock/lain_squeet.me_webfinger.xml") + body: File.read!("test/fixtures/tesla_mock/lain_squeet.me_webfinger.xml"), + headers: [{"content-type", "application/xrd+xml"}] }} end @@ -526,22 +527,6 @@ def get( }} end - def get("http://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do - {:ok, - %Tesla.Env{ - status: 200, - body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta") - }} - end - - def get("https://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do - {:ok, - %Tesla.Env{ - status: 200, - body: File.read!("test/fixtures/tesla_mock/xn--q9jyb4c_host_meta") - }} - end - def get("http://pleroma.soykaf.com/.well-known/host-meta", _, _, _) do {:ok, %Tesla.Env{ @@ -786,7 +771,8 @@ def get( {:ok, %Tesla.Env{ status: 200, - body: File.read!("test/fixtures/tesla_mock/shp@social.heldscal.la.xml") + body: File.read!("test/fixtures/tesla_mock/shp@social.heldscal.la.xml"), + headers: [{"content-type", "application/xrd+xml"}] }} end @@ -796,7 +782,7 @@ def get( _, [{"accept", "application/xrd+xml,application/jrd+json"}] ) do - {:ok, %Tesla.Env{status: 200, body: ""}} + {:ok, %Tesla.Env{status: 200, body: "", headers: [{"content-type", "application/jrd+json"}]}} end def get("http://framatube.org/.well-known/host-meta", _, _, _) do @@ -816,7 +802,7 @@ def get( {:ok, %Tesla.Env{ status: 200, - headers: [{"content-type", "application/json"}], + headers: [{"content-type", "application/jrd+json"}], body: File.read!("test/fixtures/tesla_mock/framasoft@framatube.org.json") }} end @@ -876,7 +862,7 @@ def get( {:ok, %Tesla.Env{ status: 200, - headers: [{"content-type", "application/json"}], + headers: [{"content-type", "application/jrd+json"}], body: File.read!("test/fixtures/tesla_mock/kaniini@gerzilla.de.json") }} end @@ -1074,7 +1060,8 @@ def get( {:ok, %Tesla.Env{ status: 200, - body: File.read!("test/fixtures/lain.xml") + body: File.read!("test/fixtures/lain.xml"), + headers: [{"content-type", "application/xrd+xml"}] }} end @@ -1087,7 +1074,16 @@ def get( {:ok, %Tesla.Env{ status: 200, - body: File.read!("test/fixtures/lain.xml") + body: File.read!("test/fixtures/lain.xml"), + headers: [{"content-type", "application/xrd+xml"}] + }} + end + + def get("http://zetsubou.xn--q9jyb4c/.well-known/host-meta", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/host-meta-zetsubou.xn--q9jyb4c.xml") }} end @@ -1153,7 +1149,8 @@ def get("https://mstdn.jp/.well-known/webfinger?resource=acct:kpherox@mstdn.jp", {:ok, %Tesla.Env{ status: 200, - body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml") + body: File.read!("test/fixtures/tesla_mock/kpherox@mstdn.jp.xml"), + headers: [{"content-type", "application/xrd+xml"}] }} end -- cgit v1.2.3 From ef5b0510eb3e2c77c94fc5a6168180141a73361f Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 20 Mar 2021 08:29:02 +0300 Subject: updating timex --- mix.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mix.lock b/mix.lock index 6034ce5a8..19b90660b 100644 --- a/mix.lock +++ b/mix.lock @@ -52,7 +52,7 @@ "gen_smtp": {:hex, :gen_smtp, "0.15.0", "9f51960c17769b26833b50df0b96123605a8024738b62db747fece14eb2fbfcc", [:rebar3], [], "hexpm", "29bd14a88030980849c7ed2447b8db6d6c9278a28b11a44cafe41b791205440f"}, "gen_stage": {:hex, :gen_stage, "0.14.3", "d0c66f1c87faa301c1a85a809a3ee9097a4264b2edf7644bf5c123237ef732bf", [:mix], [], "hexpm"}, "gen_state_machine": {:hex, :gen_state_machine, "2.0.5", "9ac15ec6e66acac994cc442dcc2c6f9796cf380ec4b08267223014be1c728a95", [:mix], [], "hexpm"}, - "gettext": {:hex, :gettext, "0.18.0", "406d6b9e0e3278162c2ae1de0a60270452c553536772167e2d701f028116f870", [:mix], [], "hexpm", "c3f850be6367ebe1a08616c2158affe4a23231c70391050bf359d5f92f66a571"}, + "gettext": {:hex, :gettext, "0.18.2", "7df3ea191bb56c0309c00a783334b288d08a879f53a7014341284635850a6e55", [:mix], [], "hexpm", "f9f537b13d4fdd30f3039d33cb80144c3aa1f8d9698e47d7bcbcc8df93b1f5c5"}, "gun": {:git, "https://github.com/ninenines/gun.git", "921c47146b2d9567eac7e9a4d2ccc60fffd4f327", [ref: "921c47146b2d9567eac7e9a4d2ccc60fffd4f327"]}, "hackney": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/hackney.git", "7d7119f0651515d6d7669c78393fd90950a3ec6e", [ref: "7d7119f0651515d6d7669c78393fd90950a3ec6e"]}, "html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm", "30efab070904eb897ff05cd52fa61c1025d7f8ef3a9ca250bc4e6513d16c32de"}, @@ -117,9 +117,9 @@ "syslog": {:hex, :syslog, "1.1.0", "6419a232bea84f07b56dc575225007ffe34d9fdc91abe6f1b2f254fd71d8efc2", [:rebar3], [], "hexpm", "4c6a41373c7e20587be33ef841d3de6f3beba08519809329ecc4d27b15b659e1"}, "telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, "tesla": {:hex, :tesla, "1.4.0", "1081bef0124b8bdec1c3d330bbe91956648fb008cf0d3950a369cda466a31a87", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.3", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "bf1374a5569f5fca8e641363b63f7347d680d91388880979a33bc12a6eb3e0aa"}, - "timex": {:hex, :timex, "3.6.2", "845cdeb6119e2fef10751c0b247b6c59d86d78554c83f78db612e3290f819bc2", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5 or ~> 1.0.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "26030b46199d02a590be61c2394b37ea25a3664c02fafbeca0b24c972025d47a"}, + "timex": {:hex, :timex, "3.7.3", "df8a2ea814749d700d6878ab9eacac9fdb498ecee2f507cb0002ec172bc24d0f", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "8691c1d86ca3a7bc14a156e2199dc8927be95d1a8f0e3b69e4bb2d6262c53ac6"}, "trailing_format_plug": {:hex, :trailing_format_plug, "0.0.7", "64b877f912cf7273bed03379936df39894149e35137ac9509117e59866e10e45", [:mix], [{:plug, "> 0.12.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bd4fde4c15f3e993a999e019d64347489b91b7a9096af68b2bdadd192afa693f"}, - "tzdata": {:hex, :tzdata, "1.0.4", "a3baa4709ea8dba552dca165af6ae97c624a2d6ac14bd265165eaa8e8af94af6", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "b02637db3df1fd66dd2d3c4f194a81633d0e4b44308d36c1b2fdfd1e4e6f169b"}, + "tzdata": {:hex, :tzdata, "1.0.5", "69f1ee029a49afa04ad77801febaf69385f3d3e3d1e4b56b9469025677b89a28", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "55519aa2a99e5d2095c1e61cc74c9be69688f8ab75c27da724eb8279ff402a5a"}, "ueberauth": {:hex, :ueberauth, "0.6.3", "d42ace28b870e8072cf30e32e385579c57b9cc96ec74fa1f30f30da9c14f3cc0", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "afc293d8a1140d6591b53e3eaf415ca92842cb1d32fad3c450c6f045f7f91b60"}, "unicode_util_compat": {:git, "https://github.com/benoitc/unicode_util_compat.git", "38d7bc105f51159e8ea3279c40121db9db1e652f", [tag: "0.3.1"]}, "unsafe": {:hex, :unsafe, "1.0.1", "a27e1874f72ee49312e0a9ec2e0b27924214a05e3ddac90e91727bc76f8613d8", [:mix], [], "hexpm", "6c7729a2d214806450d29766abc2afaa7a2cbecf415be64f36a6691afebb50e5"}, -- cgit v1.2.3 From d3660b24d37862bb58cf309c582cfe7432fd7bb6 Mon Sep 17 00:00:00 2001 From: rinpatch Date: Mon, 22 Mar 2021 20:07:07 +0300 Subject: Copy emoji in the subject from parent post Sometimes people put emoji in the subject, which results in the subject looking broken if someone replies to it from a server that does not have the said emoji under the same shortcode. This patch solves the problem by extending the emoji set available in the summary to that of the parent post. --- lib/pleroma/web/common_api/activity_draft.ex | 27 ++++++++++++++ test/fixtures/tesla_mock/emoji-in-summary.json | 49 ++++++++++++++++++++++++++ test/pleroma/web/common_api_test.exs | 26 ++++++++++++++ test/support/http_request_mock.ex | 9 +++++ 4 files changed, 111 insertions(+) create mode 100644 test/fixtures/tesla_mock/emoji-in-summary.json diff --git a/lib/pleroma/web/common_api/activity_draft.ex b/lib/pleroma/web/common_api/activity_draft.ex index 8668b600e..80a9fa7bb 100644 --- a/lib/pleroma/web/common_api/activity_draft.ex +++ b/lib/pleroma/web/common_api/activity_draft.ex @@ -5,6 +5,7 @@ defmodule Pleroma.Web.CommonAPI.ActivityDraft do alias Pleroma.Activity alias Pleroma.Conversation.Participation + alias Pleroma.Object alias Pleroma.Web.CommonAPI alias Pleroma.Web.CommonAPI.Utils @@ -186,6 +187,32 @@ defp sensitive(draft) do defp object(draft) do emoji = Map.merge(Pleroma.Emoji.Formatter.get_emoji_map(draft.full_payload), draft.emoji) + # Sometimes people create posts with subject containing emoji, + # since subjects are usually copied this will result in a broken + # subject when someone replies from an instance that does not have + # the emoji or has it under different shortcode. This is an attempt + # to mitigate this by copying emoji from inReplyTo if they are present + # in the subject. + summary_emoji = + with %Activity{} <- draft.in_reply_to, + %Object{data: %{"tag" => [_ | _] = tag}} <- Object.normalize(draft.in_reply_to) do + Enum.reduce(tag, %{}, fn + %{"type" => "Emoji", "name" => name, "icon" => %{"url" => url}}, acc -> + if String.contains?(draft.summary, name) do + Map.put(acc, name, url) + else + acc + end + + _, acc -> + acc + end) + else + _ -> %{} + end + + emoji = Map.merge(emoji, summary_emoji) + object = Utils.make_note_data(draft) |> Map.put("emoji", emoji) diff --git a/test/fixtures/tesla_mock/emoji-in-summary.json b/test/fixtures/tesla_mock/emoji-in-summary.json new file mode 100644 index 000000000..f77c6e2e8 --- /dev/null +++ b/test/fixtures/tesla_mock/emoji-in-summary.json @@ -0,0 +1,49 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://patch.cx/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "actor": "https://patch.cx/users/rin", + "attachment": [], + "attributedTo": "https://patch.cx/users/rin", + "cc": [ + "https://patch.cx/users/rin/followers" + ], + "content": ":joker_disapprove:

just grabbing a test fixture, nevermind me", + "context": "https://patch.cx/contexts/2c3ce4b4-18b1-4b1a-8965-3932027b5326", + "conversation": "https://patch.cx/contexts/2c3ce4b4-18b1-4b1a-8965-3932027b5326", + "id": "https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f", + "published": "2021-03-22T16:54:46.461939Z", + "sensitive": null, + "source": ":joker_disapprove: \r\n\r\njust grabbing a test fixture, nevermind me", + "summary": ":joker_smile: ", + "tag": [ + { + "icon": { + "type": "Image", + "url": "https://patch.cx/emoji/custom/joker_disapprove.png" + }, + "id": "https://patch.cx/emoji/custom/joker_disapprove.png", + "name": ":joker_disapprove:", + "type": "Emoji", + "updated": "1970-01-01T00:00:00Z" + }, + { + "icon": { + "type": "Image", + "url": "https://patch.cx/emoji/custom/joker_smile.png" + }, + "id": "https://patch.cx/emoji/custom/joker_smile.png", + "name": ":joker_smile:", + "type": "Emoji", + "updated": "1970-01-01T00:00:00Z" + } + ], + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Note" +} diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 9d005697c..6619f8fc8 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -25,6 +25,11 @@ defmodule Pleroma.Web.CommonAPITest do require Pleroma.Constants + setup_all do + Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end) + :ok + end + setup do: clear_config([:instance, :safe_dm_mentions]) setup do: clear_config([:instance, :limit]) setup do: clear_config([:instance, :max_pinned_statuses]) @@ -517,6 +522,27 @@ test "it adds an emoji on an external site" do assert url == "#{Pleroma.Web.base_url()}/emoji/blank.png" end + test "it copies emoji from the subject of the parent post" do + %Object{} = + object = + Object.normalize("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f", + fetch: true + ) + + activity = Activity.get_create_by_object_ap_id(object.data["id"]) + user = insert(:user) + + {:ok, reply_activity} = + CommonAPI.post(user, %{ + in_reply_to_id: activity.id, + status: ":joker_disapprove:", + spoiler_text: ":joker_smile:" + }) + + assert Object.normalize(reply_activity).data["emoji"][":joker_smile:"] + refute Object.normalize(reply_activity).data["emoji"][":joker_disapprove:"] + end + test "deactivated users can't post" do user = insert(:user, is_active: false) assert {:error, _} = CommonAPI.post(user, %{status: "ye"}) diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 1e98020f0..eb692fab5 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -1278,6 +1278,15 @@ def get("https://osada.macgirvin.com/", _, "", [{"accept", "text/html"}]) do }} end + def get("https://patch.cx/objects/a399c28e-c821-4820-bc3e-4afeb044c16f", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: File.read!("test/fixtures/tesla_mock/emoji-in-summary.json"), + headers: activitypub_object_headers() + }} + end + def get(url, query, body, headers) do {:error, "Mock response not implemented for GET #{inspect(url)}, #{query}, #{inspect(body)}, #{ -- cgit v1.2.3 From 03843a53868860c0b6b2bebcf262bde746482f7e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Mar 2021 14:23:37 +0300 Subject: migrating config to tmp folder --- docs/administration/CLI_tasks/config.md | 10 +++++-- lib/mix/tasks/pleroma/config.ex | 49 +++++++++++++++++++++++---------- test/mix/tasks/pleroma/config_test.exs | 38 +++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 17 deletions(-) diff --git a/docs/administration/CLI_tasks/config.md b/docs/administration/CLI_tasks/config.md index 000ed4d98..fc9f3cbd5 100644 --- a/docs/administration/CLI_tasks/config.md +++ b/docs/administration/CLI_tasks/config.md @@ -32,16 +32,20 @@ config :pleroma, configurable_from_database: false ``` -To delete transferred settings from database optional flag `-d` can be used. `` is `prod` by default. +Options: + +- `` - where to save migrated config. E.g. `--path=/tmp`. If file saved into non standart folder, you must manually copy file into directory where Pleroma can read it. For OTP install path will be `PLEROMA_CONFIG_PATH` or `/etc/pleroma`. For installation from source - `config` directory in the pleroma folder. +- `` - environment, for which is migrated config. By default is `prod`. +- To delete transferred settings from database optional flag `-d` can be used === "OTP" ```sh - ./bin/pleroma_ctl config migrate_from_db [--env=] [-d] + ./bin/pleroma_ctl config migrate_from_db [--env=] [-d] [--path=] ``` === "From Source" ```sh - mix pleroma.config migrate_from_db [--env=] [-d] + mix pleroma.config migrate_from_db [--env=] [-d] [--path=] ``` ## Dump all of the config settings defined in the database diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index 1962154b9..ac89702ae 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -27,7 +27,7 @@ def run(["migrate_from_db" | options]) do {opts, _} = OptionParser.parse!(options, - strict: [env: :string, delete: :boolean], + strict: [env: :string, delete: :boolean, path: :string], aliases: [d: :delete] ) @@ -259,18 +259,43 @@ defp create(group, settings) do defp migrate_from_db(opts) do env = opts[:env] || Pleroma.Config.get(:env) + filename = "#{env}.exported_from_db.secret.exs" + config_path = - if Pleroma.Config.get(:release) do - :config_path - |> Pleroma.Config.get() - |> Path.dirname() - else - "config" + cond do + opts[:path] -> + opts[:path] + + Pleroma.Config.get(:release) -> + :config_path + |> Pleroma.Config.get() + |> Path.dirname() + + true -> + "config" end - |> Path.join("#{env}.exported_from_db.secret.exs") + |> Path.join(filename) - file = File.open!(config_path, [:write, :utf8]) + with {:ok, file} <- File.open(config_path, [:write, :utf8]) do + write_config(file, config_path, opts) + shell_info("Database configuration settings have been exported to #{config_path}") + else + _ -> + shell_error("Impossible to save settings to this directory #{Path.dirname(config_path)}") + tmp_config_path = Path.join("/tmp", filename) + file = File.open!(tmp_config_path) + + shell_info( + "Saving database configuration settings to #{tmp_config_path}. Copy it to the #{ + Path.dirname(config_path) + } manually." + ) + write_config(file, tmp_config_path, opts) + end + end + + defp write_config(file, path, opts) do IO.write(file, config_header()) ConfigDB @@ -278,11 +303,7 @@ defp migrate_from_db(opts) do |> Enum.each(&write_and_delete(&1, file, opts[:delete])) :ok = File.close(file) - System.cmd("mix", ["format", config_path]) - - shell_info( - "Database configuration settings have been exported to config/#{env}.exported_from_db.secret.exs" - ) + System.cmd("mix", ["format", path]) end if Code.ensure_loaded?(Config.Reader) do diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs index 21f8f2286..3ed1e94b8 100644 --- a/test/mix/tasks/pleroma/config_test.exs +++ b/test/mix/tasks/pleroma/config_test.exs @@ -200,6 +200,44 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil end end + describe "migrate_from_db/1" do + setup do: clear_config(:configurable_from_database, true) + + setup do + insert_config_record(:pleroma, :setting_first, key: "value", key2: ["Activity"]) + insert_config_record(:pleroma, :setting_second, key: "value2", key2: [Repo]) + insert_config_record(:quack, :level, :info) + + path = "test/instance_static" + file_path = Path.join(path, "temp.exported_from_db.secret.exs") + + on_exit(fn -> File.rm!(file_path) end) + + [file_path: file_path] + end + + test "with path parameter", %{file_path: file_path} do + MixTask.run(["migrate_from_db", "--env", "temp", "--path", Path.dirname(file_path)]) + + file = File.read!(file_path) + assert file =~ "config :pleroma, :setting_first," + assert file =~ "config :pleroma, :setting_second," + assert file =~ "config :quack, :level, :info" + end + + test "release", %{file_path: file_path} do + clear_config(:release, true) + clear_config(:config_path, file_path) + + MixTask.run(["migrate_from_db", "--env", "temp"]) + + file = File.read!(file_path) + assert file =~ "config :pleroma, :setting_first," + assert file =~ "config :pleroma, :setting_second," + assert file =~ "config :quack, :level, :info" + end + end + describe "operations on database config" do setup do: clear_config(:configurable_from_database, true) -- cgit v1.2.3 From 4cd34d019764fdd68829ebd4282118abc4534133 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Mar 2021 17:27:02 +0300 Subject: suggestion --- lib/mix/tasks/pleroma/config.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index ac89702ae..22502a522 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -282,7 +282,7 @@ defp migrate_from_db(opts) do else _ -> shell_error("Impossible to save settings to this directory #{Path.dirname(config_path)}") - tmp_config_path = Path.join("/tmp", filename) + tmp_config_path = Path.join(System.tmp_dir!(), filename) file = File.open!(tmp_config_path) shell_info( -- cgit v1.2.3 From ad907254fb47764869fecd5928bd863182421c8c Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 23 Mar 2021 19:37:25 +0300 Subject: changelog entry --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1fa22398..fb26c7a73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased (Patch) +### Fixed + +- Try to save exported ConfigDB settings (migrate_from_db) in the system temp directory if default location is not writable. + ## [2.3.0] - 2020-03-01 ### Security @@ -51,7 +55,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Pleroma API: Reroute `/api/pleroma/*` to `/api/v1/pleroma/*`
-- Improved hashtag timeline performance (requires a background migration). +- Improved hashtag timeline performance (requires a background migration). ### Added -- cgit v1.2.3 From 3ec1dbd9223aa44205e90967175f07cc532501ab Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 3 Feb 2021 16:09:28 +0300 Subject: Let pins federate - save object ids on pin, instead of activity ids - pins federation - removed pinned_activities field from the users table - activityPub endpoint for user pins - pulling remote users pins --- .../API/differences_in_mastoapi_responses.md | 1 + lib/pleroma/activity.ex | 81 ++++++++-------- lib/pleroma/activity/queries.ex | 5 + lib/pleroma/user.ex | 77 ++++++++------- lib/pleroma/web/activity_pub/activity_pub.ex | 60 +++++++++++- .../web/activity_pub/activity_pub_controller.ex | 8 ++ lib/pleroma/web/activity_pub/builder.ex | 32 +++++++ lib/pleroma/web/activity_pub/object_validator.ex | 11 +++ .../object_validators/pin_validator.ex | 42 +++++++++ lib/pleroma/web/activity_pub/side_effects.ex | 56 ++++++++++- lib/pleroma/web/activity_pub/transmogrifier.ex | 9 ++ lib/pleroma/web/activity_pub/views/user_view.ex | 21 +++++ .../web/api_spec/operations/status_operation.ex | 46 ++++++++- lib/pleroma/web/api_spec/schemas/status.ex | 7 ++ lib/pleroma/web/common_api.ex | 57 +++++++---- .../controllers/fallback_controller.ex | 6 ++ .../mastodon_api/controllers/status_controller.ex | 12 +++ lib/pleroma/web/mastodon_api/views/status_view.ex | 23 +++-- lib/pleroma/web/router.ex | 1 + .../20210202110641_add_pinned_objects_to_users.exs | 9 ++ ...0210203141144_add_featured_address_to_users.exs | 23 +++++ ..._move_pinned_activities_into_pinned_objects.exs | 28 ++++++ ...6045221_remove_pinned_activities_from_users.exs | 15 +++ test/fixtures/collections/featured.json | 39 ++++++++ test/fixtures/masto_pin.json | 41 ++++++++ test/fixtures/statuses/note.json | 27 ++++++ test/fixtures/users_mock/masto_featured.json | 18 ++++ test/fixtures/users_mock/user.json | 41 ++++++++ test/pleroma/user_test.exs | 45 +++++++++ .../activity_pub/activity_pub_controller_test.exs | 105 +++++++++++++++++++++ .../pleroma/web/activity_pub/activity_pub_test.exs | 77 +++++++++++++++ .../web/activity_pub/transmogrifier_test.exs | 74 +++++++++++++++ test/pleroma/web/common_api_test.exs | 60 ++++++++++-- .../controllers/status_controller_test.exs | 32 +++++-- .../web/mastodon_api/views/status_view_test.exs | 3 +- .../twitter_api/remote_follow_controller_test.exs | 30 ++++++ test/support/factory.ex | 6 +- test/support/http_request_mock.ex | 23 +++++ 38 files changed, 1128 insertions(+), 123 deletions(-) create mode 100644 lib/pleroma/web/activity_pub/object_validators/pin_validator.ex create mode 100644 priv/repo/migrations/20210202110641_add_pinned_objects_to_users.exs create mode 100644 priv/repo/migrations/20210203141144_add_featured_address_to_users.exs create mode 100644 priv/repo/migrations/20210205145000_move_pinned_activities_into_pinned_objects.exs create mode 100644 priv/repo/migrations/20210206045221_remove_pinned_activities_from_users.exs create mode 100644 test/fixtures/collections/featured.json create mode 100644 test/fixtures/masto_pin.json create mode 100644 test/fixtures/statuses/note.json create mode 100644 test/fixtures/users_mock/masto_featured.json create mode 100644 test/fixtures/users_mock/user.json diff --git a/docs/development/API/differences_in_mastoapi_responses.md b/docs/development/API/differences_in_mastoapi_responses.md index a14fcb416..2ff56d3ca 100644 --- a/docs/development/API/differences_in_mastoapi_responses.md +++ b/docs/development/API/differences_in_mastoapi_responses.md @@ -38,6 +38,7 @@ Has these additional fields under the `pleroma` object: - `thread_muted`: true if the thread the post belongs to is muted - `emoji_reactions`: A list with emoji / reaction maps. The format is `{name: "☕", count: 1, me: true}`. Contains no information about the reacting users, for that use the `/statuses/:id/reactions` endpoint. - `parent_visible`: If the parent of this post is visible to the user or not. +- `pinned_at`: a datetime (iso8601) when status was pinned, `null` otherwise. ## Scheduled statuses diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index d59403884..a4cfca4c5 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -184,40 +184,48 @@ def get_by_ap_id_with_object(ap_id) do |> Repo.one() end - @spec get_by_id(String.t()) :: Activity.t() | nil - def get_by_id(id) do - case FlakeId.flake_id?(id) do - true -> - Activity - |> where([a], a.id == ^id) - |> restrict_deactivated_users() - |> Repo.one() - - _ -> - nil - end - end - - def get_by_id_with_user_actor(id) do - case FlakeId.flake_id?(id) do - true -> - Activity - |> where([a], a.id == ^id) - |> with_preloaded_user_actor() - |> Repo.one() - - _ -> - nil + @doc """ + Gets activity by ID, doesn't load activities from deactivated actors by default. + """ + @spec get_by_id(String.t(), keyword()) :: t() | nil + def get_by_id(id, opts \\ [filter: [:restrict_deactivated]]), do: get_by_id_with_opts(id, opts) + + @spec get_by_id_with_user_actor(String.t()) :: t() | nil + def get_by_id_with_user_actor(id), do: get_by_id_with_opts(id, preload: [:user_actor]) + + @spec get_by_id_with_object(String.t()) :: t() | nil + def get_by_id_with_object(id), do: get_by_id_with_opts(id, preload: [:object]) + + defp get_by_id_with_opts(id, opts) do + if FlakeId.flake_id?(id) do + query = Queries.by_id(id) + + with_filters_query = + if is_list(opts[:filter]) do + Enum.reduce(opts[:filter], query, fn + {:type, type}, acc -> Queries.by_type(acc, type) + :restrict_deactivated, acc -> restrict_deactivated_users(acc) + _, acc -> acc + end) + else + query + end + + with_preloads_query = + if is_list(opts[:preload]) do + Enum.reduce(opts[:preload], with_filters_query, fn + :user_actor, acc -> with_preloaded_user_actor(acc) + :object, acc -> with_preloaded_object(acc) + _, acc -> acc + end) + else + with_filters_query + end + + Repo.one(with_preloads_query) end end - def get_by_id_with_object(id) do - Activity - |> where(id: ^id) - |> with_preloaded_object() - |> Repo.one() - end - def all_by_ids_with_object(ids) do Activity |> where([a], a.id in ^ids) @@ -269,6 +277,11 @@ def get_create_by_object_ap_id_with_object(ap_id) when is_binary(ap_id) do def get_create_by_object_ap_id_with_object(_), do: nil + @spec create_by_id_with_object(String.t()) :: t() | nil + def create_by_id_with_object(id) do + get_by_id_with_opts(id, preload: [:object], filter: [type: "Create"]) + end + defp get_in_reply_to_activity_from_object(%Object{data: %{"inReplyTo" => ap_id}}) do get_create_by_object_ap_id_with_object(ap_id) end @@ -368,12 +381,6 @@ def direct_conversation_id(activity, for_user) do end end - @spec pinned_by_actor?(Activity.t()) :: boolean() - def pinned_by_actor?(%Activity{} = activity) do - actor = user_actor(activity) - activity.id in actor.pinned_activities - end - @spec get_by_object_ap_id_with_object(String.t()) :: t() | nil def get_by_object_ap_id_with_object(ap_id) when is_binary(ap_id) do ap_id diff --git a/lib/pleroma/activity/queries.ex b/lib/pleroma/activity/queries.ex index a6b02a889..4632651b0 100644 --- a/lib/pleroma/activity/queries.ex +++ b/lib/pleroma/activity/queries.ex @@ -14,6 +14,11 @@ defmodule Pleroma.Activity.Queries do alias Pleroma.Activity alias Pleroma.User + @spec by_id(query(), String.t()) :: query() + def by_id(query \\ Activity, id) do + from(a in query, where: a.id == ^id) + end + @spec by_ap_id(query, String.t()) :: query def by_ap_id(query \\ Activity, ap_id) do from( diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index c1aa0f716..b78777141 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -99,6 +99,7 @@ defmodule Pleroma.User do field(:local, :boolean, default: true) field(:follower_address, :string) field(:following_address, :string) + field(:featured_address, :string) field(:search_rank, :float, virtual: true) field(:search_type, :integer, virtual: true) field(:tags, {:array, :string}, default: []) @@ -130,7 +131,6 @@ defmodule Pleroma.User do field(:hide_followers, :boolean, default: false) field(:hide_follows, :boolean, default: false) field(:hide_favorites, :boolean, default: true) - field(:pinned_activities, {:array, :string}, default: []) field(:email_notifications, :map, default: %{"digest" => false}) field(:mascot, :map, default: nil) field(:emoji, :map, default: %{}) @@ -148,6 +148,7 @@ defmodule Pleroma.User do field(:accepts_chat_messages, :boolean, default: nil) field(:last_active_at, :naive_datetime) field(:disclose_client, :boolean, default: true) + field(:pinned_objects, :map, default: %{}) embeds_one( :notification_settings, @@ -372,8 +373,10 @@ def banner_url(user, options \\ []) do end # Should probably be renamed or removed + @spec ap_id(User.t()) :: String.t() def ap_id(%User{nickname: nickname}), do: "#{Web.base_url()}/users/#{nickname}" + @spec ap_followers(User.t()) :: String.t() def ap_followers(%User{follower_address: fa}) when is_binary(fa), do: fa def ap_followers(%User{} = user), do: "#{ap_id(user)}/followers" @@ -381,6 +384,11 @@ def ap_followers(%User{} = user), do: "#{ap_id(user)}/followers" def ap_following(%User{following_address: fa}) when is_binary(fa), do: fa def ap_following(%User{} = user), do: "#{ap_id(user)}/following" + @spec ap_featured_collection(User.t()) :: String.t() + def ap_featured_collection(%User{featured_address: fa}) when is_binary(fa), do: fa + + def ap_featured_collection(%User{} = user), do: "#{ap_id(user)}/collections/featured" + defp truncate_fields_param(params) do if Map.has_key?(params, :fields) do Map.put(params, :fields, Enum.map(params[:fields], &truncate_field/1)) @@ -443,6 +451,7 @@ def remote_user_changeset(struct \\ %User{local: false}, params) do :uri, :follower_address, :following_address, + :featured_address, :hide_followers, :hide_follows, :hide_followers_count, @@ -454,7 +463,8 @@ def remote_user_changeset(struct \\ %User{local: false}, params) do :invisible, :actor_type, :also_known_as, - :accepts_chat_messages + :accepts_chat_messages, + :pinned_objects ] ) |> cast(params, [:name], empty_values: []) @@ -686,7 +696,7 @@ def register_changeset_ldap(struct, params = %{password: password}) |> validate_format(:nickname, local_nickname_regex()) |> put_ap_id() |> unique_constraint(:ap_id) - |> put_following_and_follower_address() + |> put_following_and_follower_and_featured_address() end def register_changeset(struct, params \\ %{}, opts \\ []) do @@ -747,7 +757,7 @@ def register_changeset(struct, params \\ %{}, opts \\ []) do |> put_password_hash |> put_ap_id() |> unique_constraint(:ap_id) - |> put_following_and_follower_address() + |> put_following_and_follower_and_featured_address() end def maybe_validate_required_email(changeset, true), do: changeset @@ -765,11 +775,16 @@ defp put_ap_id(changeset) do put_change(changeset, :ap_id, ap_id) end - defp put_following_and_follower_address(changeset) do - followers = ap_followers(%User{nickname: get_field(changeset, :nickname)}) + defp put_following_and_follower_and_featured_address(changeset) do + user = %User{nickname: get_field(changeset, :nickname)} + followers = ap_followers(user) + following = ap_following(user) + featured = ap_featured_collection(user) changeset |> put_change(:follower_address, followers) + |> put_change(:following_address, following) + |> put_change(:featured_address, featured) end defp autofollow_users(user) do @@ -2343,45 +2358,35 @@ def approval_changeset(user, set_approval: approved?) do cast(user, %{is_approved: approved?}, [:is_approved]) end - def add_pinnned_activity(user, %Pleroma.Activity{id: id}) do - if id not in user.pinned_activities do - max_pinned_statuses = Config.get([:instance, :max_pinned_statuses], 0) - params = %{pinned_activities: user.pinned_activities ++ [id]} - - # if pinned activity was scheduled for deletion, we remove job - if expiration = Pleroma.Workers.PurgeExpiredActivity.get_expiration(id) do - Oban.cancel_job(expiration.id) - end + @spec add_pinned_object_id(User.t(), String.t()) :: {:ok, User.t()} | {:error, term()} + def add_pinned_object_id(%User{} = user, object_id) do + if !user.pinned_objects[object_id] do + params = %{pinned_objects: Map.put(user.pinned_objects, object_id, NaiveDateTime.utc_now())} user - |> cast(params, [:pinned_activities]) - |> validate_length(:pinned_activities, - max: max_pinned_statuses, - message: "You have already pinned the maximum number of statuses" - ) + |> cast(params, [:pinned_objects]) + |> validate_change(:pinned_objects, fn :pinned_objects, pinned_objects -> + max_pinned_statuses = Config.get([:instance, :max_pinned_statuses], 0) + + if Enum.count(pinned_objects) <= max_pinned_statuses do + [] + else + [pinned_objects: "You have already pinned the maximum number of statuses"] + end + end) else change(user) end |> update_and_set_cache() end - def remove_pinnned_activity(user, %Pleroma.Activity{id: id, data: data}) do - params = %{pinned_activities: List.delete(user.pinned_activities, id)} - - # if pinned activity was scheduled for deletion, we reschedule it for deletion - if data["expires_at"] do - # MRF.ActivityExpirationPolicy used UTC timestamps for expires_at in original implementation - {:ok, expires_at} = - data["expires_at"] |> Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime.cast() - - Pleroma.Workers.PurgeExpiredActivity.enqueue(%{ - activity_id: id, - expires_at: expires_at - }) - end - + @spec remove_pinned_object_id(User.t(), String.t()) :: {:ok, t()} | {:error, term()} + def remove_pinned_object_id(%User{} = user, object_id) do user - |> cast(params, [:pinned_activities]) + |> cast( + %{pinned_objects: Map.delete(user.pinned_objects, object_id)}, + [:pinned_objects] + ) |> update_and_set_cache() end diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index efbf92c70..d0051d1cb 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -630,7 +630,7 @@ defp fetch_activities_for_user(user, reading_user, params) do |> Map.put(:type, ["Create", "Announce"]) |> Map.put(:user, reading_user) |> Map.put(:actor_id, user.ap_id) - |> Map.put(:pinned_activity_ids, user.pinned_activities) + |> Map.put(:pinned_object_ids, Map.keys(user.pinned_objects)) params = if User.blocks?(reading_user, user) do @@ -1075,8 +1075,18 @@ defp restrict_unlisted(query, %{restrict_unlisted: true}) do defp restrict_unlisted(query, _), do: query - defp restrict_pinned(query, %{pinned: true, pinned_activity_ids: ids}) do - from(activity in query, where: activity.id in ^ids) + defp restrict_pinned(query, %{pinned: true, pinned_object_ids: ids}) do + from( + [activity, object: o] in query, + where: + fragment( + "(?)->>'type' = 'Create' and coalesce((?)->'object'->>'id', (?)->>'object') = any (?)", + activity.data, + activity.data, + activity.data, + ^ids + ) + ) end defp restrict_pinned(query, _), do: query @@ -1419,6 +1429,9 @@ defp object_to_user_data(data) do invisible = data["invisible"] || false actor_type = data["type"] || "Person" + featured_address = data["featured"] + {:ok, pinned_objects} = fetch_and_prepare_featured_from_ap_id(featured_address) + public_key = if is_map(data["publicKey"]) && is_binary(data["publicKey"]["publicKeyPem"]) do data["publicKey"]["publicKeyPem"] @@ -1447,13 +1460,15 @@ defp object_to_user_data(data) do name: data["name"], follower_address: data["followers"], following_address: data["following"], + featured_address: featured_address, bio: data["summary"] || "", actor_type: actor_type, also_known_as: Map.get(data, "alsoKnownAs", []), public_key: public_key, inbox: data["inbox"], shared_inbox: shared_inbox, - accepts_chat_messages: accepts_chat_messages + accepts_chat_messages: accepts_chat_messages, + pinned_objects: pinned_objects } # nickname can be nil because of virtual actors @@ -1591,6 +1606,41 @@ def maybe_handle_clashing_nickname(data) do end end + def pin_data_from_featured_collection(%{ + "type" => type, + "orderedItems" => objects + }) + when type in ["OrderedCollection", "Collection"] do + Map.new(objects, fn %{"id" => object_ap_id} -> {object_ap_id, NaiveDateTime.utc_now()} end) + end + + def fetch_and_prepare_featured_from_ap_id(nil) do + {:ok, %{}} + end + + def fetch_and_prepare_featured_from_ap_id(ap_id) do + with {:ok, data} <- Fetcher.fetch_and_contain_remote_object_from_id(ap_id) do + {:ok, pin_data_from_featured_collection(data)} + else + e -> + Logger.error("Could not decode featured collection at fetch #{ap_id}, #{inspect(e)}") + {:ok, %{}} + end + end + + def pinned_fetch_task(nil), do: nil + + def pinned_fetch_task(%{pinned_objects: pins}) do + if Enum.all?(pins, fn {ap_id, _} -> + Object.get_cached_by_ap_id(ap_id) || + match?({:ok, _object}, Fetcher.fetch_object_from_id(ap_id)) + end) do + :ok + else + :error + end + end + def make_user_from_ap_id(ap_id) do user = User.get_cached_by_ap_id(ap_id) @@ -1598,6 +1648,8 @@ def make_user_from_ap_id(ap_id) do Transmogrifier.upgrade_user_from_ap_id(ap_id) else with {:ok, data} <- fetch_and_prepare_user_from_ap_id(ap_id) do + {:ok, _pid} = Task.start(fn -> pinned_fetch_task(data) end) + if user do user |> User.remote_user_changeset(data) diff --git a/lib/pleroma/web/activity_pub/activity_pub_controller.ex b/lib/pleroma/web/activity_pub/activity_pub_controller.ex index 9d3dcc7f9..5aa3b281a 100644 --- a/lib/pleroma/web/activity_pub/activity_pub_controller.ex +++ b/lib/pleroma/web/activity_pub/activity_pub_controller.ex @@ -543,4 +543,12 @@ def upload_media(%{assigns: %{user: %User{} = user}} = conn, %{"file" => file} = |> json(object.data) end end + + def pinned(conn, %{"nickname" => nickname}) do + with %User{} = user <- User.get_cached_by_nickname(nickname) do + conn + |> put_resp_header("content-type", "application/activity+json") + |> json(UserView.render("featured.json", %{user: user})) + end + end end diff --git a/lib/pleroma/web/activity_pub/builder.ex b/lib/pleroma/web/activity_pub/builder.ex index f56bfc600..91a45836f 100644 --- a/lib/pleroma/web/activity_pub/builder.ex +++ b/lib/pleroma/web/activity_pub/builder.ex @@ -273,4 +273,36 @@ defp object_action(actor, object) do "context" => object.data["context"] }, []} end + + @spec pin(User.t(), Object.t()) :: {:ok, map(), keyword()} + def pin(%User{} = user, object) do + {:ok, + %{ + "id" => Utils.generate_activity_id(), + "target" => pinned_url(user.nickname), + "object" => object.data["id"], + "actor" => user.ap_id, + "type" => "Add", + "to" => [Pleroma.Constants.as_public()], + "cc" => [user.follower_address] + }, []} + end + + @spec unpin(User.t(), Object.t()) :: {:ok, map, keyword()} + def unpin(%User{} = user, object) do + {:ok, + %{ + "id" => Utils.generate_activity_id(), + "target" => pinned_url(user.nickname), + "object" => object.data["id"], + "actor" => user.ap_id, + "type" => "Remove", + "to" => [Pleroma.Constants.as_public()], + "cc" => [user.follower_address] + }, []} + end + + defp pinned_url(nickname) when is_binary(nickname) do + Pleroma.Web.Router.Helpers.activity_pub_url(Pleroma.Web.Endpoint, :pinned, nickname) + end end diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 297c19cc0..11432ef38 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -30,6 +30,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.EventValidator alias Pleroma.Web.ActivityPub.ObjectValidators.FollowValidator alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator + alias Pleroma.Web.ActivityPub.ObjectValidators.PinValidator alias Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator alias Pleroma.Web.ActivityPub.ObjectValidators.UndoValidator alias Pleroma.Web.ActivityPub.ObjectValidators.UpdateValidator @@ -234,6 +235,16 @@ def validate(%{"type" => "Announce"} = object, meta) do end end + def validate(%{"type" => type} = object, meta) when type in ~w(Add Remove) do + with {:ok, object} <- + object + |> PinValidator.cast_and_validate() + |> Ecto.Changeset.apply_action(:insert) do + object = stringify_keys(object) + {:ok, object, meta} + end + end + def cast_and_apply(%{"type" => "ChatMessage"} = object) do ChatMessageValidator.cast_and_apply(object) end diff --git a/lib/pleroma/web/activity_pub/object_validators/pin_validator.ex b/lib/pleroma/web/activity_pub/object_validators/pin_validator.ex new file mode 100644 index 000000000..dca8cba6f --- /dev/null +++ b/lib/pleroma/web/activity_pub/object_validators/pin_validator.ex @@ -0,0 +1,42 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.ObjectValidators.PinValidator do + use Ecto.Schema + + import Ecto.Changeset + import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations + + alias Pleroma.EctoType.ActivityPub.ObjectValidators + + @primary_key false + + embedded_schema do + field(:id, ObjectValidators.ObjectID, primary_key: true) + field(:target) + field(:object, ObjectValidators.ObjectID) + field(:actor, ObjectValidators.ObjectID) + field(:type) + field(:to, ObjectValidators.Recipients, default: []) + field(:cc, ObjectValidators.Recipients, default: []) + end + + def cast_and_validate(data) do + data + |> cast_data() + |> validate_data() + end + + defp cast_data(data) do + cast(%__MODULE__{}, data, __schema__(:fields)) + end + + defp validate_data(changeset) do + changeset + |> validate_required([:id, :target, :object, :actor, :type, :to, :cc]) + |> validate_inclusion(:type, ~w(Add Remove)) + |> validate_actor_presence() + |> validate_object_presence() + end +end diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 0b9a9f0c5..9d22f9d3c 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -276,10 +276,10 @@ def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object, result = case deleted_object do %Object{} -> - with {:ok, deleted_object, activity} <- Object.delete(deleted_object), + with {:ok, deleted_object, _activity} <- Object.delete(deleted_object), {_, actor} when is_binary(actor) <- {:actor, deleted_object.data["actor"]}, %User{} = user <- User.get_cached_by_ap_id(actor) do - User.remove_pinnned_activity(user, activity) + User.remove_pinned_object_id(user, deleted_object.data["id"]) {:ok, user} = ActivityPub.decrease_note_count_if_public(user, deleted_object) @@ -312,6 +312,58 @@ def handle(%{data: %{"type" => "Delete", "object" => deleted_object}} = object, end end + # Tasks this handles: + # - adds pin to user + # - removes expiration job for pinned activity, if was set for expiration + @impl true + def handle(%{data: %{"type" => "Add"} = data} = object, meta) do + with %User{} = user <- User.get_cached_by_ap_id(data["actor"]), + {:ok, _user} <- User.add_pinned_object_id(user, data["object"]) do + # if pinned activity was scheduled for deletion, we remove job + if expiration = Pleroma.Workers.PurgeExpiredActivity.get_expiration(meta[:activity_id]) do + Oban.cancel_job(expiration.id) + end + + {:ok, object, meta} + else + nil -> + {:error, :user_not_found} + + {:error, changeset} -> + if changeset.errors[:pinned_objects] do + {:error, :pinned_statuses_limit_reached} + else + changeset.errors + end + end + end + + # Tasks this handles: + # - removes pin from user + # - if activity had expiration, recreates activity expiration job + @impl true + def handle(%{data: %{"type" => "Remove"} = data} = object, meta) do + with %User{} = user <- User.get_cached_by_ap_id(data["actor"]), + {:ok, _user} <- User.remove_pinned_object_id(user, data["object"]) do + # if pinned activity was scheduled for deletion, we reschedule it for deletion + if meta[:expires_at] do + # MRF.ActivityExpirationPolicy used UTC timestamps for expires_at in original implementation + {:ok, expires_at} = + Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime.cast(meta[:expires_at]) + + Pleroma.Workers.PurgeExpiredActivity.enqueue(%{ + activity_id: meta[:activity_id], + expires_at: expires_at + }) + end + + {:ok, object, meta} + else + nil -> {:error, :user_not_found} + error -> error + end + end + # Nothing to do @impl true def handle(object, meta) do diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 8c7d6a747..270cea6dc 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -556,6 +556,14 @@ def handle_incoming( end end + def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do + with :ok <- ObjectValidator.fetch_actor_and_object(data), + %Object{} <- Object.normalize(data["object"], fetch: true), + {:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do + {:ok, activity} + end + end + def handle_incoming( %{"type" => "Delete"} = data, _options @@ -1000,6 +1008,7 @@ def upgrade_user_from_ap_id(ap_id) do with %User{local: false} = user <- User.get_cached_by_ap_id(ap_id), {:ok, data} <- ActivityPub.fetch_and_prepare_user_from_ap_id(ap_id), {:ok, user} <- update_user(user, data) do + {:ok, _pid} = Task.start(fn -> ActivityPub.pinned_fetch_task(user) end) TransmogrifierWorker.enqueue("user_upgrade", %{"user_id" => user.id}) {:ok, user} else diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex index 8adc9878a..462f3b4a7 100644 --- a/lib/pleroma/web/activity_pub/views/user_view.ex +++ b/lib/pleroma/web/activity_pub/views/user_view.ex @@ -6,8 +6,10 @@ defmodule Pleroma.Web.ActivityPub.UserView do use Pleroma.Web, :view alias Pleroma.Keys + alias Pleroma.Object alias Pleroma.Repo alias Pleroma.User + alias Pleroma.Web.ActivityPub.ObjectView alias Pleroma.Web.ActivityPub.Transmogrifier alias Pleroma.Web.ActivityPub.Utils alias Pleroma.Web.Endpoint @@ -97,6 +99,7 @@ def render("user.json", %{user: user}) do "followers" => "#{user.ap_id}/followers", "inbox" => "#{user.ap_id}/inbox", "outbox" => "#{user.ap_id}/outbox", + "featured" => "#{user.ap_id}/collections/featured", "preferredUsername" => user.nickname, "name" => user.name, "summary" => user.bio, @@ -245,6 +248,24 @@ def render("activity_collection_page.json", %{ |> Map.merge(pagination) end + def render("featured.json", %{ + user: %{featured_address: featured_address, pinned_objects: pinned_objects} + }) do + objects = + pinned_objects + |> Enum.sort_by(fn {_, pinned_at} -> pinned_at end, &>=/2) + |> Enum.map(fn {id, _} -> + ObjectView.render("object.json", %{object: Object.get_cached_by_ap_id(id)}) + end) + + %{ + "id" => featured_address, + "type" => "OrderedCollection", + "orderedItems" => objects + } + |> Map.merge(Utils.make_json_ld_header()) + end + defp maybe_put_total_items(map, false, _total), do: map defp maybe_put_total_items(map, true, total) do diff --git a/lib/pleroma/web/api_spec/operations/status_operation.ex b/lib/pleroma/web/api_spec/operations/status_operation.ex index 4bdb8e281..802fbef3e 100644 --- a/lib/pleroma/web/api_spec/operations/status_operation.ex +++ b/lib/pleroma/web/api_spec/operations/status_operation.ex @@ -182,7 +182,34 @@ def pin_operation do parameters: [id_param()], responses: %{ 200 => status_response(), - 400 => Operation.response("Error", "application/json", ApiError) + 400 => + Operation.response("Bad Request", "application/json", %Schema{ + allOf: [ApiError], + title: "Unprocessable Entity", + example: %{ + "error" => "You have already pinned the maximum number of statuses" + } + }), + 404 => + Operation.response("Not found", "application/json", %Schema{ + allOf: [ApiError], + title: "Unprocessable Entity", + example: %{ + "error" => "Record not found" + } + }), + 422 => + Operation.response( + "Unprocessable Entity", + "application/json", + %Schema{ + allOf: [ApiError], + title: "Unprocessable Entity", + example: %{ + "error" => "Someone else's status cannot be pinned" + } + } + ) } } end @@ -197,7 +224,22 @@ def unpin_operation do parameters: [id_param()], responses: %{ 200 => status_response(), - 400 => Operation.response("Error", "application/json", ApiError) + 400 => + Operation.response("Bad Request", "application/json", %Schema{ + allOf: [ApiError], + title: "Unprocessable Entity", + example: %{ + "error" => "You have already pinned the maximum number of statuses" + } + }), + 404 => + Operation.response("Not found", "application/json", %Schema{ + allOf: [ApiError], + title: "Unprocessable Entity", + example: %{ + "error" => "Record not found" + } + }) } } end diff --git a/lib/pleroma/web/api_spec/schemas/status.ex b/lib/pleroma/web/api_spec/schemas/status.ex index 42fa98718..3d042dc19 100644 --- a/lib/pleroma/web/api_spec/schemas/status.ex +++ b/lib/pleroma/web/api_spec/schemas/status.ex @@ -194,6 +194,13 @@ defmodule Pleroma.Web.ApiSpec.Schemas.Status do parent_visible: %Schema{ type: :boolean, description: "`true` if the parent post is visible to the user" + }, + pinned_at: %Schema{ + type: :string, + format: "date-time", + nullable: true, + description: + "A datetime (ISO 8601) that states when the post was pinned or `null` if the post is not pinned" } } }, diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index b003e30c7..d35a0f219 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -411,29 +411,54 @@ def post(user, %{status: _} = data) do end end - def pin(id, %{ap_id: user_ap_id} = user) do - with %Activity{ - actor: ^user_ap_id, - data: %{"type" => "Create"}, - object: %Object{data: %{"type" => object_type}} - } = activity <- Activity.get_by_id_with_object(id), - true <- object_type in ["Note", "Article", "Question"], - true <- Visibility.is_public?(activity), - {:ok, _user} <- User.add_pinnned_activity(user, activity) do + @spec pin(String.t(), User.t()) :: {:ok, Activity.t()} | {:error, term()} + def pin(id, %User{ap_id: actor} = user) do + with %Activity{} = activity <- create_activity_by_id(id), + true <- activity_belongs_to_actor(activity, actor), + true <- object_type_is_allowed_for_pin(activity.object), + true <- activity_is_public(activity), + {:ok, pin_data, _} <- Builder.pin(user, activity.object), + {:ok, _pin, _} <- + Pipeline.common_pipeline(pin_data, local: true, activity_id: id) do {:ok, activity} else - {:error, %{errors: [pinned_activities: {err, _}]}} -> {:error, err} - _ -> {:error, dgettext("errors", "Could not pin")} + {:error, {:execute_side_effects, error}} -> error + error -> error end end + defp create_activity_by_id(id) do + with nil <- Activity.create_by_id_with_object(id) do + {:error, :not_found} + end + end + + defp activity_belongs_to_actor(%{actor: actor}, actor), do: true + defp activity_belongs_to_actor(_, _), do: {:error, :ownership_error} + + defp object_type_is_allowed_for_pin(%{data: %{"type" => type}}) do + with false <- type in ["Note", "Article", "Question"] do + {:error, :not_allowed} + end + end + + defp activity_is_public(activity) do + with false <- Visibility.is_public?(activity) do + {:error, :visibility_error} + end + end + + @spec unpin(String.t(), User.t()) :: {:ok, User.t()} | {:error, term()} def unpin(id, user) do - with %Activity{data: %{"type" => "Create"}} = activity <- Activity.get_by_id(id), - {:ok, _user} <- User.remove_pinnned_activity(user, activity) do + with %Activity{} = activity <- create_activity_by_id(id), + {:ok, unpin_data, _} <- Builder.unpin(user, activity.object), + {:ok, _unpin, _} <- + Pipeline.common_pipeline(unpin_data, + local: true, + activity_id: activity.id, + expires_at: activity.data["expires_at"] + ) do {:ok, activity} - else - {:error, %{errors: [pinned_activities: {err, _}]}} -> {:error, err} - _ -> {:error, dgettext("errors", "Could not unpin")} end end diff --git a/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex b/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex index d25f84837..84621500e 100644 --- a/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex @@ -30,6 +30,12 @@ def call(conn, {:error, error_message}) do |> json(%{error: error_message}) end + def call(conn, {:error, status, message}) do + conn + |> put_status(status) + |> json(%{error: message}) + end + def call(conn, _) do conn |> put_status(:internal_server_error) diff --git a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex index b051fca74..724dc5c5d 100644 --- a/lib/pleroma/web/mastodon_api/controllers/status_controller.ex +++ b/lib/pleroma/web/mastodon_api/controllers/status_controller.ex @@ -260,6 +260,18 @@ def unfavourite(%{assigns: %{user: user}} = conn, %{id: activity_id}) do def pin(%{assigns: %{user: user}} = conn, %{id: ap_id_or_id}) do with {:ok, activity} <- CommonAPI.pin(ap_id_or_id, user) do try_render(conn, "show.json", activity: activity, for: user, as: :activity) + else + {:error, :pinned_statuses_limit_reached} -> + {:error, "You have already pinned the maximum number of statuses"} + + {:error, :ownership_error} -> + {:error, :unprocessable_entity, "Someone else's status cannot be pinned"} + + {:error, :visibility_error} -> + {:error, :unprocessable_entity, "Non-public status cannot be pinned"} + + error -> + error end end diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index 3753588f2..d0247fa4a 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -152,6 +152,8 @@ def render( |> Enum.filter(& &1) |> Enum.map(fn user -> AccountView.render("mention.json", %{user: user}) end) + {pinned?, pinned_at} = pin_data(activity_object, user) + %{ id: to_string(activity.id), uri: object.data["id"], @@ -173,7 +175,7 @@ def render( favourited: present?(favorited), bookmarked: present?(bookmarked), muted: false, - pinned: pinned?(activity, user), + pinned: pinned?, sensitive: false, spoiler_text: "", visibility: get_visibility(activity), @@ -184,7 +186,8 @@ def render( language: nil, emojis: [], pleroma: %{ - local: activity.local + local: activity.local, + pinned_at: pinned_at } } end @@ -316,6 +319,8 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} fn for_user, user -> User.mutes?(for_user, user) end ) + {pinned?, pinned_at} = pin_data(object, user) + %{ id: to_string(activity.id), uri: object.data["id"], @@ -339,7 +344,7 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} favourited: present?(favorited), bookmarked: present?(bookmarked), muted: muted, - pinned: pinned?(activity, user), + pinned: pinned?, sensitive: sensitive, spoiler_text: summary, visibility: get_visibility(object), @@ -360,7 +365,8 @@ def render("show.json", %{activity: %{data: %{"object" => _object}} = activity} direct_conversation_id: direct_conversation_id, thread_muted: thread_muted?, emoji_reactions: emoji_reactions, - parent_visible: visible_for_user?(reply_to, opts[:for]) + parent_visible: visible_for_user?(reply_to, opts[:for]), + pinned_at: pinned_at } } end @@ -529,8 +535,13 @@ defp present?(nil), do: false defp present?(false), do: false defp present?(_), do: true - defp pinned?(%Activity{id: id}, %User{pinned_activities: pinned_activities}), - do: id in pinned_activities + defp pin_data(%Object{data: %{"id" => object_id}}, %User{pinned_objects: pinned_objects}) do + if pinned_at = pinned_objects[object_id] do + {true, Utils.to_masto_date(pinned_at)} + else + {false, nil} + end + end defp build_emoji_map(emoji, users, current_user) do %{ diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index de0bd27d7..ccf2ef796 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -704,6 +704,7 @@ defmodule Pleroma.Web.Router do # The following two are S2S as well, see `ActivityPub.fetch_follow_information_for_user/1`: get("/users/:nickname/followers", ActivityPubController, :followers) get("/users/:nickname/following", ActivityPubController, :following) + get("/users/:nickname/collections/featured", ActivityPubController, :pinned) end scope "/", Pleroma.Web.ActivityPub do diff --git a/priv/repo/migrations/20210202110641_add_pinned_objects_to_users.exs b/priv/repo/migrations/20210202110641_add_pinned_objects_to_users.exs new file mode 100644 index 000000000..644527246 --- /dev/null +++ b/priv/repo/migrations/20210202110641_add_pinned_objects_to_users.exs @@ -0,0 +1,9 @@ +defmodule Pleroma.Repo.Migrations.AddPinnedObjectsToUsers do + use Ecto.Migration + + def change do + alter table(:users) do + add(:pinned_objects, :map) + end + end +end diff --git a/priv/repo/migrations/20210203141144_add_featured_address_to_users.exs b/priv/repo/migrations/20210203141144_add_featured_address_to_users.exs new file mode 100644 index 000000000..0f6a21611 --- /dev/null +++ b/priv/repo/migrations/20210203141144_add_featured_address_to_users.exs @@ -0,0 +1,23 @@ +defmodule Pleroma.Repo.Migrations.AddFeaturedAddressToUsers do + use Ecto.Migration + + def up do + alter table(:users) do + add(:featured_address, :string) + end + + create(index(:users, [:featured_address])) + + execute(""" + + update users set featured_address = concat(ap_id, '/collections/featured') where local = true and featured_address is null; + + """) + end + + def down do + alter table(:users) do + remove(:featured_address) + end + end +end diff --git a/priv/repo/migrations/20210205145000_move_pinned_activities_into_pinned_objects.exs b/priv/repo/migrations/20210205145000_move_pinned_activities_into_pinned_objects.exs new file mode 100644 index 000000000..9aee545e3 --- /dev/null +++ b/priv/repo/migrations/20210205145000_move_pinned_activities_into_pinned_objects.exs @@ -0,0 +1,28 @@ +defmodule Pleroma.Repo.Migrations.MovePinnedActivitiesIntoPinnedObjects do + use Ecto.Migration + + import Ecto.Query + + alias Pleroma.Repo + alias Pleroma.User + + def up do + from(u in User) + |> select([u], {u.id, fragment("?.pinned_activities", u)}) + |> Repo.stream() + |> Stream.each(fn {user_id, pinned_activities_ids} -> + pinned_activities = Pleroma.Activity.all_by_ids_with_object(pinned_activities_ids) + + pins = + Map.new(pinned_activities, fn %{object: %{data: %{"id" => object_id}}} -> + {object_id, NaiveDateTime.utc_now()} + end) + + from(u in User, where: u.id == ^user_id) + |> Repo.update_all(set: [pinned_objects: pins]) + end) + |> Stream.run() + end + + def down, do: :noop +end diff --git a/priv/repo/migrations/20210206045221_remove_pinned_activities_from_users.exs b/priv/repo/migrations/20210206045221_remove_pinned_activities_from_users.exs new file mode 100644 index 000000000..a3ee93f48 --- /dev/null +++ b/priv/repo/migrations/20210206045221_remove_pinned_activities_from_users.exs @@ -0,0 +1,15 @@ +defmodule Pleroma.Repo.Migrations.RemovePinnedActivitiesFromUsers do + use Ecto.Migration + + def up do + alter table(:users) do + remove(:pinned_activities) + end + end + + def down do + alter table(:users) do + add(:pinned_activities, {:array, :string}, default: []) + end + end +end diff --git a/test/fixtures/collections/featured.json b/test/fixtures/collections/featured.json new file mode 100644 index 000000000..56f8f56fa --- /dev/null +++ b/test/fixtures/collections/featured.json @@ -0,0 +1,39 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://{{domain}}/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "id": "https://{{domain}}/users/{{nickname}}/collections/featured", + "orderedItems": [ + { + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://{{domain}}/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "actor": "https://{{domain}}/users/{{nickname}}", + "attachment": [], + "attributedTo": "https://{{domain}}/users/{{nickname}}", + "cc": [ + "https://{{domain}}/users/{{nickname}}/followers" + ], + "content": "", + "id": "https://{{domain}}/objects/{{object_id}}", + "published": "2021-02-12T15:13:43.915429Z", + "sensitive": false, + "source": "", + "summary": "", + "tag": [], + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Note" + } + ], + "type": "OrderedCollection" +} diff --git a/test/fixtures/masto_pin.json b/test/fixtures/masto_pin.json new file mode 100644 index 000000000..e57a34375 --- /dev/null +++ b/test/fixtures/masto_pin.json @@ -0,0 +1,41 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + { + "Emoji": "toot:Emoji", + "Hashtag": "as:Hashtag", + "PropertyValue": "schema:PropertyValue", + "alsoKnownAs": { + "@id": "as:alsoKnownAs", + "@type": "@id" + }, + "atomUri": "ostatus:atomUri", + "conversation": "ostatus:conversation", + "featured": { + "@id": "toot:featured", + "@type": "@id" + }, + "focalPoint": { + "@container": "@list", + "@id": "toot:focalPoint" + }, + "inReplyToAtomUri": "ostatus:inReplyToAtomUri", + "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "movedTo": { + "@id": "as:movedTo", + "@type": "@id" + }, + "ostatus": "http://ostatus.org#", + "schema": "http://schema.org#", + "sensitive": "as:sensitive", + "toot": "http://joinmastodon.org/ns#", + "value": "schema:value" + } + ], + "id": "https://example.com/users/nickname/statuses/{{id}}", + "actor": "https://example.com/users/nickname", + "object": "https://example.com/users/nickname/statuses/101355175004496751", + "target": "https://example.com/users/nickname/collections/featured", + "type": "{{type}}" +} diff --git a/test/fixtures/statuses/note.json b/test/fixtures/statuses/note.json new file mode 100644 index 000000000..41735cbc5 --- /dev/null +++ b/test/fixtures/statuses/note.json @@ -0,0 +1,27 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://example.com/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "actor": "https://example.com/users/{{nickname}}", + "attachment": [], + "attributedTo": "https://example.com/users/{{nickname}}", + "cc": [ + "https://example.com/users/{{nickname}}/followers" + ], + "content": "Content", + "context": "https://example.com/contexts/e4b180e1-7403-477f-aeb4-de57e7a3fe7f", + "conversation": "https://example.com/contexts/e4b180e1-7403-477f-aeb4-de57e7a3fe7f", + "id": "https://example.com/objects/{{object_id}}", + "published": "2019-12-15T22:00:05.279583Z", + "sensitive": false, + "summary": "", + "tag": [], + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Note" +} diff --git a/test/fixtures/users_mock/masto_featured.json b/test/fixtures/users_mock/masto_featured.json new file mode 100644 index 000000000..646a343ad --- /dev/null +++ b/test/fixtures/users_mock/masto_featured.json @@ -0,0 +1,18 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + { + "ostatus": "http://ostatus.org#", + "atomUri": "ostatus:atomUri", + "inReplyToAtomUri": "ostatus:inReplyToAtomUri", + "conversation": "ostatus:conversation", + "sensitive": "as:sensitive", + "toot": "http://joinmastodon.org/ns#", + "votersCount": "toot:votersCount" + } + ], + "id": "https://{{domain}}/users/{{nickname}}/collections/featured", + "type": "OrderedCollection", + "totalItems": 0, + "orderedItems": [] +} diff --git a/test/fixtures/users_mock/user.json b/test/fixtures/users_mock/user.json new file mode 100644 index 000000000..da2483d02 --- /dev/null +++ b/test/fixtures/users_mock/user.json @@ -0,0 +1,41 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://example.com/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "attachment": [], + "endpoints": { + "oauthAuthorizationEndpoint": "https://example.com/oauth/authorize", + "oauthRegistrationEndpoint": "https://example.com/api/v1/apps", + "oauthTokenEndpoint": "https://example.com/oauth/token", + "sharedInbox": "https://example.com/inbox" + }, + "followers": "https://example.com/users/{{nickname}}/followers", + "following": "https://example.com/users/{{nickname}}/following", + "icon": { + "type": "Image", + "url": "https://example.com/media/4e914f5b84e4a259a3f6c2d2edc9ab642f2ab05f3e3d9c52c81fc2d984b3d51e.jpg" + }, + "id": "https://example.com/users/{{nickname}}", + "image": { + "type": "Image", + "url": "https://example.com/media/f739efddefeee49c6e67e947c4811fdc911785c16ae43da4c3684051fbf8da6a.jpg?name=f739efddefeee49c6e67e947c4811fdc911785c16ae43da4c3684051fbf8da6a.jpg" + }, + "inbox": "https://example.com/users/{{nickname}}/inbox", + "manuallyApprovesFollowers": false, + "name": "{{nickname}}", + "outbox": "https://example.com/users/{{nickname}}/outbox", + "preferredUsername": "{{nickname}}", + "publicKey": { + "id": "https://example.com/users/{{nickname}}#main-key", + "owner": "https://example.com/users/{{nickname}}", + "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5DLtwGXNZElJyxFGfcVc\nXANhaMadj/iYYQwZjOJTV9QsbtiNBeIK54PJrYuU0/0YIdrvS1iqheX5IwXRhcwa\nhm3ZyLz7XeN9st7FBni4BmZMBtMpxAuYuu5p/jbWy13qAiYOhPreCx0wrWgm/lBD\n9mkgaxIxPooBE0S4ZWEJIDIV1Vft3AWcRUyWW1vIBK0uZzs6GYshbQZB952S0yo4\nFzI1hABGHncH8UvuFauh4EZ8tY7/X5I0pGRnDOcRN1dAht5w5yTA+6r5kebiFQjP\nIzN/eCO/a9Flrj9YGW7HDNtjSOH0A31PLRGlJtJO3yK57dnf5ppyCZGfL4emShQo\ncQIDAQAB\n-----END PUBLIC KEY-----\n\n" + }, + "summary": "your friendly neighborhood pleroma developer
I like cute things and distributed systems, and really hate delete and redrafts", + "tag": [], + "type": "Person", + "url": "https://example.com/users/{{nickname}}" +} diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index 6f5bcab57..d81c1b8eb 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -2338,4 +2338,49 @@ test "active_user_count/1" do assert User.active_user_count(6) == 3 assert User.active_user_count(1) == 1 end + + describe "pins" do + setup do + user = insert(:user) + + [user: user, object_id: object_id_from_created_activity(user)] + end + + test "unique pins", %{user: user, object_id: object_id} do + assert {:ok, %{pinned_objects: %{^object_id => pinned_at1} = pins} = updated_user} = + User.add_pinned_object_id(user, object_id) + + assert Enum.count(pins) == 1 + + assert {:ok, %{pinned_objects: %{^object_id => pinned_at2} = pins}} = + User.add_pinned_object_id(updated_user, object_id) + + assert pinned_at1 == pinned_at2 + + assert Enum.count(pins) == 1 + end + + test "respects max_pinned_statuses limit", %{user: user, object_id: object_id} do + clear_config([:instance, :max_pinned_statuses], 1) + {:ok, updated} = User.add_pinned_object_id(user, object_id) + + object_id2 = object_id_from_created_activity(user) + + {:error, %{errors: errors}} = User.add_pinned_object_id(updated, object_id2) + assert Keyword.has_key?(errors, :pinned_objects) + end + + test "remove_pinned_object_id/2", %{user: user, object_id: object_id} do + assert {:ok, updated} = User.add_pinned_object_id(user, object_id) + + {:ok, after_remove} = User.remove_pinned_object_id(updated, object_id) + assert after_remove.pinned_objects == %{} + end + end + + defp object_id_from_created_activity(user) do + %{id: id} = insert(:note_activity, user: user) + %{object: %{data: %{"id" => object_id}}} = Activity.get_by_id_with_object(id) + object_id + end end diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index 19e04d472..a9cbf90c3 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -636,6 +636,86 @@ test "without valid signature, " <> |> post("/inbox", non_create_data) |> json_response(400) end + + test "accepts Add/Remove activities", %{conn: conn} do + object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" + + status = + File.read!("test/fixtures/statuses/note.json") + |> String.replace("{{nickname}}", "lain") + |> String.replace("{{object_id}}", object_id) + + object_url = "https://example.com/objects/#{object_id}" + + user = + File.read!("test/fixtures/users_mock/user.json") + |> String.replace("{{nickname}}", "lain") + + actor = "https://example.com/users/lain" + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^object_url + } -> + %Tesla.Env{ + status: 200, + body: status, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^actor + } -> + %Tesla.Env{ + status: 200, + body: user, + headers: [{"content-type", "application/activity+json"}] + } + end) + + data = %{ + "id" => "https://example.com/objects/d61d6733-e256-4fe1-ab13-1e369789423f", + "actor" => actor, + "object" => object_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Add", + "to" => [Pleroma.Constants.as_public()] + } + + assert "ok" == + conn + |> assign(:valid_signature, true) + |> put_req_header("content-type", "application/activity+json") + |> post("/inbox", data) + |> json_response(200) + + ObanHelpers.perform(all_enqueued(worker: ReceiverWorker)) + assert Activity.get_by_ap_id(data["id"]) + user = User.get_cached_by_ap_id(data["actor"]) + assert user.pinned_objects[data["object"]] + + data = %{ + "id" => "https://example.com/objects/d61d6733-e256-4fe1-ab13-1e369789423d", + "actor" => actor, + "object" => object_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Remove", + "to" => [Pleroma.Constants.as_public()] + } + + assert "ok" == + conn + |> assign(:valid_signature, true) + |> put_req_header("content-type", "application/activity+json") + |> post("/inbox", data) + |> json_response(200) + + ObanHelpers.perform(all_enqueued(worker: ReceiverWorker)) + user = refresh_record(user) + refute user.pinned_objects[data["object"]] + end end describe "/users/:nickname/inbox" do @@ -1772,4 +1852,29 @@ test "POST /api/ap/upload_media", %{conn: conn} do |> json_response(403) end end + + test "pinned collection", %{conn: conn} do + clear_config([:instance, :max_pinned_statuses], 2) + user = insert(:user) + objects = insert_list(2, :note, user: user) + + Enum.reduce(objects, user, fn %{data: %{"id" => object_id}}, user -> + {:ok, updated} = User.add_pinned_object_id(user, object_id) + updated + end) + + %{nickname: nickname, featured_address: featured_address, pinned_objects: pinned_objects} = + refresh_record(user) + + %{"id" => ^featured_address, "orderedItems" => items} = + conn + |> get("/users/#{nickname}/collections/featured") + |> json_response(200) + + object_ids = Enum.map(items, & &1["id"]) + + assert Enum.all?(pinned_objects, fn {obj_id, _} -> + obj_id in object_ids + end) + end end diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index c7fa452f7..081d00d45 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -235,6 +235,83 @@ test "works for bridgy actors" do "url" => [%{"href" => "https://jk.nipponalba.scot/images/profile.jpg"}] } end + + test "fetches user featured collection" do + ap_id = "https://example.com/users/lain" + + featured_url = "https://example.com/users/lain/collections/featured" + + user_data = + "test/fixtures/users_mock/user.json" + |> File.read!() + |> String.replace("{{nickname}}", "lain") + |> Jason.decode!() + |> Map.put("featured", featured_url) + |> Jason.encode!() + + object_id = Ecto.UUID.generate() + + featured_data = + "test/fixtures/collections/featured.json" + |> File.read!() + |> String.replace("{{domain}}", "example.com") + |> String.replace("{{nickname}}", "lain") + |> String.replace("{{object_id}}", object_id) + + object_url = "https://example.com/objects/#{object_id}" + + object_data = + "test/fixtures/statuses/note.json" + |> File.read!() + |> String.replace("{{object_id}}", object_id) + |> String.replace("{{nickname}}", "lain") + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^ap_id + } -> + %Tesla.Env{ + status: 200, + body: user_data, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^featured_url + } -> + %Tesla.Env{ + status: 200, + body: featured_data, + headers: [{"content-type", "application/activity+json"}] + } + end) + + Tesla.Mock.mock_global(fn + %{ + method: :get, + url: ^object_url + } -> + %Tesla.Env{ + status: 200, + body: object_data, + headers: [{"content-type", "application/activity+json"}] + } + end) + + {:ok, user} = ActivityPub.make_user_from_ap_id(ap_id) + Process.sleep(50) + + assert user.featured_address == featured_url + assert Map.has_key?(user.pinned_objects, object_url) + + in_db = Pleroma.User.get_by_ap_id(ap_id) + assert in_db.featured_address == featured_url + assert Map.has_key?(user.pinned_objects, object_url) + + assert %{data: %{"id" => ^object_url}} = Object.get_by_ap_id(object_url) + end end test "it fetches the appropriate tag-restricted posts" do diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 4c3fcb44a..28d7e1e3c 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -6,6 +6,8 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do use Oban.Testing, repo: Pleroma.Repo use Pleroma.DataCase + require Pleroma.Constants + alias Pleroma.Activity alias Pleroma.Object alias Pleroma.Tests.ObanHelpers @@ -106,6 +108,78 @@ test "it accepts Move activities" do assert activity.data["target"] == new_user.ap_id assert activity.data["type"] == "Move" end + + test "it accepts Add/Remove activities" do + user = + "test/fixtures/users_mock/user.json" + |> File.read!() + |> String.replace("{{nickname}}", "lain") + + object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" + + object = + "test/fixtures/statuses/note.json" + |> File.read!() + |> String.replace("{{nickname}}", "lain") + |> String.replace("{{object_id}}", object_id) + + object_url = "https://example.com/objects/#{object_id}" + + actor = "https://example.com/users/lain" + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^actor + } -> + %Tesla.Env{ + status: 200, + body: user, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^object_url + } -> + %Tesla.Env{ + status: 200, + body: object, + headers: [{"content-type", "application/activity+json"}] + } + end) + + message = %{ + "id" => "https://example.com/objects/d61d6733-e256-4fe1-ab13-1e369789423f", + "actor" => actor, + "object" => object_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Add", + "to" => [Pleroma.Constants.as_public()], + "cc" => ["https://example.com/users/lain/followers"] + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(message) + assert activity.data == message + user = User.get_cached_by_ap_id(actor) + assert user.pinned_objects[object_url] + + remove = %{ + "id" => "http://localhost:400/objects/d61d6733-e256-4fe1-ab13-1e369789423d", + "actor" => actor, + "object" => object_url, + "target" => "http://example.com/users/lain/collections/featured", + "type" => "Remove", + "to" => [Pleroma.Constants.as_public()], + "cc" => ["https://example.com/users/lain/followers"] + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(remove) + assert activity.data == remove + + user = refresh_record(user) + refute user.pinned_objects[object_url] + end end describe "prepare outgoing" do diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs index 6619f8fc8..fa55c2832 100644 --- a/test/pleroma/web/common_api_test.exs +++ b/test/pleroma/web/common_api_test.exs @@ -827,13 +827,17 @@ test "favoriting a status twice returns ok, but without the like activity" do [user: user, activity: activity] end + test "activity not found error", %{user: user} do + assert {:error, :not_found} = CommonAPI.pin("id", user) + end + test "pin status", %{user: user, activity: activity} do assert {:ok, ^activity} = CommonAPI.pin(activity.id, user) - id = activity.id + %{data: %{"id" => object_id}} = Object.normalize(activity) user = refresh_record(user) - assert %User{pinned_activities: [^id]} = user + assert user.pinned_objects |> Map.keys() == [object_id] end test "pin poll", %{user: user} do @@ -845,10 +849,11 @@ test "pin poll", %{user: user} do assert {:ok, ^activity} = CommonAPI.pin(activity.id, user) - id = activity.id + %{data: %{"id" => object_id}} = Object.normalize(activity) + user = refresh_record(user) - assert %User{pinned_activities: [^id]} = user + assert user.pinned_objects |> Map.keys() == [object_id] end test "unlisted statuses can be pinned", %{user: user} do @@ -859,7 +864,7 @@ test "unlisted statuses can be pinned", %{user: user} do test "only self-authored can be pinned", %{activity: activity} do user = insert(:user) - assert {:error, "Could not pin"} = CommonAPI.pin(activity.id, user) + assert {:error, :ownership_error} = CommonAPI.pin(activity.id, user) end test "max pinned statuses", %{user: user, activity: activity_one} do @@ -869,8 +874,12 @@ test "max pinned statuses", %{user: user, activity: activity_one} do user = refresh_record(user) - assert {:error, "You have already pinned the maximum number of statuses"} = - CommonAPI.pin(activity_two.id, user) + assert {:error, :pinned_statuses_limit_reached} = CommonAPI.pin(activity_two.id, user) + end + + test "only public can be pinned", %{user: user} do + {:ok, activity} = CommonAPI.post(user, %{status: "private status", visibility: "private"}) + {:error, :visibility_error} = CommonAPI.pin(activity.id, user) end test "unpin status", %{user: user, activity: activity} do @@ -884,7 +893,7 @@ test "unpin status", %{user: user, activity: activity} do user = refresh_record(user) - assert %User{pinned_activities: []} = user + assert user.pinned_objects == %{} end test "should unpin when deleting a status", %{user: user, activity: activity} do @@ -896,7 +905,40 @@ test "should unpin when deleting a status", %{user: user, activity: activity} do user = refresh_record(user) - assert %User{pinned_activities: []} = user + assert user.pinned_objects == %{} + end + + test "ephemeral activity won't be deleted if was pinned", %{user: user} do + {:ok, activity} = CommonAPI.post(user, %{status: "Hello!", expires_in: 601}) + + assert Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id) + + {:ok, _activity} = CommonAPI.pin(activity.id, user) + refute Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id) + + user = refresh_record(user) + {:ok, _} = CommonAPI.unpin(activity.id, user) + + # recreates expiration job on unpin + assert Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity.id) + end + + test "ephemeral activity deletion job won't be deleted on pinning error", %{ + user: user, + activity: activity + } do + clear_config([:instance, :max_pinned_statuses], 1) + + {:ok, _activity} = CommonAPI.pin(activity.id, user) + + {:ok, activity2} = CommonAPI.post(user, %{status: "another status", expires_in: 601}) + + assert Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity2.id) + + user = refresh_record(user) + {:error, :pinned_statuses_limit_reached} = CommonAPI.pin(activity2.id, user) + + assert Pleroma.Workers.PurgeExpiredActivity.get_expiration(activity2.id) end end diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index f616f405e..e0d642910 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -1223,6 +1223,13 @@ test "pin status", %{conn: conn, user: user, activity: activity} do |> json_response_and_validate_schema(200) end + test "non authenticated user", %{activity: activity} do + assert build_conn() + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses/#{activity.id}/pin") + |> json_response(403) == %{"error" => "Invalid credentials."} + end + test "/pin: returns 400 error when activity is not public", %{conn: conn, user: user} do {:ok, dm} = CommonAPI.post(user, %{status: "test", visibility: "direct"}) @@ -1231,7 +1238,18 @@ test "/pin: returns 400 error when activity is not public", %{conn: conn, user: |> put_req_header("content-type", "application/json") |> post("/api/v1/statuses/#{dm.id}/pin") - assert json_response_and_validate_schema(conn, 400) == %{"error" => "Could not pin"} + assert json_response_and_validate_schema(conn, 422) == %{ + "error" => "Non-public status cannot be pinned" + } + end + + test "pin by another user", %{activity: activity} do + %{conn: conn} = oauth_access(["write:accounts"]) + + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses/#{activity.id}/pin") + |> json_response(422) == %{"error" => "Someone else's status cannot be pinned"} end test "unpin status", %{conn: conn, user: user, activity: activity} do @@ -1252,13 +1270,11 @@ test "unpin status", %{conn: conn, user: user, activity: activity} do |> json_response_and_validate_schema(200) end - test "/unpin: returns 400 error when activity is not exist", %{conn: conn} do - conn = - conn - |> put_req_header("content-type", "application/json") - |> post("/api/v1/statuses/1/unpin") - - assert json_response_and_validate_schema(conn, 400) == %{"error" => "Could not unpin"} + test "/unpin: returns 404 error when activity doesn't exist", %{conn: conn} do + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/v1/statuses/1/unpin") + |> json_response_and_validate_schema(404) == %{"error" => "Record not found"} end test "max pinned statuses", %{conn: conn, user: user, activity: activity_one} do 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 4172cc294..fbea25079 100644 --- a/test/pleroma/web/mastodon_api/views/status_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs @@ -286,7 +286,8 @@ test "a note activity" do direct_conversation_id: nil, thread_muted: false, emoji_reactions: [], - parent_visible: false + parent_visible: false, + pinned_at: nil } } diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs index f389c272b..fa3b29006 100644 --- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs +++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs @@ -27,6 +27,16 @@ test "adds status to pleroma instance if the `acct` is a status", %{conn: conn} body: File.read!("test/fixtures/tesla_mock/status.emelie.json") } + %{method: :get, url: "https://mastodon.social/users/emelie/collections/featured"} -> + %Tesla.Env{ + status: 200, + headers: [{"content-type", "application/activity+json"}], + body: + File.read!("test/fixtures/users_mock/masto_featured.json") + |> String.replace("{{domain}}", "mastodon.social") + |> String.replace("{{nickname}}", "emelie") + } + %{method: :get, url: "https://mastodon.social/users/emelie"} -> %Tesla.Env{ status: 200, @@ -52,6 +62,16 @@ test "show follow account page if the `acct` is a account link", %{conn: conn} d headers: [{"content-type", "application/activity+json"}], body: File.read!("test/fixtures/tesla_mock/emelie.json") } + + %{method: :get, url: "https://mastodon.social/users/emelie/collections/featured"} -> + %Tesla.Env{ + status: 200, + headers: [{"content-type", "application/activity+json"}], + body: + File.read!("test/fixtures/users_mock/masto_featured.json") + |> String.replace("{{domain}}", "mastodon.social") + |> String.replace("{{nickname}}", "emelie") + } end) response = @@ -70,6 +90,16 @@ test "show follow page if the `acct` is a account link", %{conn: conn} do headers: [{"content-type", "application/activity+json"}], body: File.read!("test/fixtures/tesla_mock/emelie.json") } + + %{method: :get, url: "https://mastodon.social/users/emelie/collections/featured"} -> + %Tesla.Env{ + status: 200, + headers: [{"content-type", "application/activity+json"}], + body: + File.read!("test/fixtures/users_mock/masto_featured.json") + |> String.replace("{{domain}}", "mastodon.social") + |> String.replace("{{nickname}}", "emelie") + } end) user = insert(:user) diff --git a/test/support/factory.ex b/test/support/factory.ex index af4fff45b..883cedf3c 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -48,13 +48,15 @@ def user_factory(attrs \\ %{}) do %{ ap_id: ap_id, follower_address: ap_id <> "/followers", - following_address: ap_id <> "/following" + following_address: ap_id <> "/following", + featured_address: ap_id <> "/collections/featured" } else %{ ap_id: User.ap_id(user), follower_address: User.ap_followers(user), - following_address: User.ap_following(user) + following_address: User.ap_following(user), + featured_address: User.ap_featured_collection(user) } end diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index eb692fab5..9e9f1c86c 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -89,6 +89,18 @@ def get("https://mastodon.sdf.org/users/rinpatch", _, _, _) do }} end + def get("https://mastodon.sdf.org/users/rinpatch/collections/featured", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: + File.read!("test/fixtures/users_mock/masto_featured.json") + |> String.replace("{{domain}}", "mastodon.sdf.org") + |> String.replace("{{nickname}}", "rinpatch"), + headers: [{"content-type", "application/activity+json"}] + }} + end + def get("https://patch.cx/objects/tesla_mock/poll_attachment", _, _, _) do {:ok, %Tesla.Env{ @@ -905,6 +917,17 @@ def get("https://mastodon.social/users/lambadalambda", _, _, _) do }} end + def get("https://mastodon.social/users/lambadalambda/collections/featured", _, _, _) do + {:ok, + %Tesla.Env{ + status: 200, + body: + File.read!("test/fixtures/users_mock/masto_featured.json") + |> String.replace("{{domain}}", "mastodon.social") + |> String.replace("{{nickname}}", "lambadalambda") + }} + end + def get("https://apfed.club/channel/indio", _, _, _) do {:ok, %Tesla.Env{ -- cgit v1.2.3 From 17f28c0507e3c34ce75e63747eed9abb66713e6e Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 25 Feb 2021 14:00:44 +0300 Subject: mastodon pins --- lib/pleroma/object/containment.ex | 8 +++ lib/pleroma/web/activity_pub/transmogrifier.ex | 17 +++-- test/fixtures/statuses/masto-note.json | 47 +++++++++++++ .../activity_pub/activity_pub_controller_test.exs | 78 ++++++++++++++++++++++ 4 files changed, 146 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/statuses/masto-note.json diff --git a/lib/pleroma/object/containment.ex b/lib/pleroma/object/containment.ex index fb0398f92..040537acf 100644 --- a/lib/pleroma/object/containment.ex +++ b/lib/pleroma/object/containment.ex @@ -71,6 +71,14 @@ def contain_origin_from_id(id, %{"id" => other_id} = _params) when is_binary(oth compare_uris(id_uri, other_uri) end + # Mastodon pin activities don't have an id, so we check the object field, which will be pinned. + def contain_origin_from_id(id, %{"object" => object}) when is_binary(object) do + id_uri = URI.parse(id) + object_uri = URI.parse(object) + + compare_uris(id_uri, object_uri) + end + def contain_origin_from_id(_id, _data), do: :error def contain_child(%{"object" => %{"id" => id, "attributedTo" => _} = object}), diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 270cea6dc..b662f5379 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -557,10 +557,19 @@ def handle_incoming( end def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do - with :ok <- ObjectValidator.fetch_actor_and_object(data), - %Object{} <- Object.normalize(data["object"], fetch: true), - {:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do - {:ok, activity} + with {:ok, user} <- ObjectValidator.fetch_actor(data), + %Object{} <- Object.normalize(data["object"], fetch: true) do + # Mastodon sends pin/unpin objects without id, to, cc fields + data = + data + |> Map.put_new("id", Utils.generate_activity_id()) + |> Map.put_new("to", [Pleroma.Constants.as_public()]) + |> Map.put_new("cc", [user.follower_address]) + + case Pipeline.common_pipeline(data, local: false) do + {:ok, activity, _meta} -> {:ok, activity} + error -> error + end end end diff --git a/test/fixtures/statuses/masto-note.json b/test/fixtures/statuses/masto-note.json new file mode 100644 index 000000000..6b96de473 --- /dev/null +++ b/test/fixtures/statuses/masto-note.json @@ -0,0 +1,47 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + { + "ostatus": "http://ostatus.org#", + "atomUri": "ostatus:atomUri", + "inReplyToAtomUri": "ostatus:inReplyToAtomUri", + "conversation": "ostatus:conversation", + "sensitive": "as:sensitive", + "toot": "http://joinmastodon.org/ns#", + "votersCount": "toot:votersCount" + } + ], + "id": "https://example.com/users/{{nickname}}/statuses/{{status_id}}", + "type": "Note", + "summary": null, + "inReplyTo": null, + "published": "2021-02-24T12:40:49Z", + "url": "https://example.com/@{{nickname}}/{{status_id}}", + "attributedTo": "https://example.com/users/{{nickname}}", + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "cc": [ + "https://example.com/users/{{nickname}}/followers" + ], + "sensitive": false, + "atomUri": "https://example.com/users/{{nickname}}/statuses/{{status_id}}", + "inReplyToAtomUri": null, + "conversation": "tag:example.com,2021-02-24:objectId=15:objectType=Conversation", + "content": "

", + "contentMap": { + "en": "

" + }, + "attachment": [], + "tag": [], + "replies": { + "id": "https://example.com/users/{{nickname}}/statuses/{{status_id}}/replies", + "type": "Collection", + "first": { + "type": "CollectionPage", + "next": "https://example.com/users/{{nickname}}/statuses/{{status_id}}/replies?only_other_accounts=true&page=true", + "partOf": "https://example.com/users/{{nickname}}/statuses/{{status_id}}/replies", + "items": [] + } + } +} diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index a9cbf90c3..d9fa25d94 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -716,6 +716,84 @@ test "accepts Add/Remove activities", %{conn: conn} do user = refresh_record(user) refute user.pinned_objects[data["object"]] end + + test "mastodon pin/unpin", %{conn: conn} do + status_id = "105786274556060421" + + status = + File.read!("test/fixtures/statuses/masto-note.json") + |> String.replace("{{nickname}}", "lain") + |> String.replace("{{status_id}}", status_id) + + status_url = "https://example.com/users/lain/statuses/#{status_id}" + + user = + File.read!("test/fixtures/users_mock/user.json") + |> String.replace("{{nickname}}", "lain") + + actor = "https://example.com/users/lain" + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^status_url + } -> + %Tesla.Env{ + status: 200, + body: status, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^actor + } -> + %Tesla.Env{ + status: 200, + body: user, + headers: [{"content-type", "application/activity+json"}] + } + end) + + data = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "actor" => actor, + "object" => status_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Add" + } + + assert "ok" == + conn + |> assign(:valid_signature, true) + |> put_req_header("content-type", "application/activity+json") + |> post("/inbox", data) + |> json_response(200) + + ObanHelpers.perform(all_enqueued(worker: ReceiverWorker)) + assert Activity.get_by_object_ap_id_with_object(data["object"]) + user = User.get_cached_by_ap_id(data["actor"]) + assert user.pinned_objects[data["object"]] + + data = %{ + "actor" => actor, + "object" => status_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Remove" + } + + assert "ok" == + conn + |> assign(:valid_signature, true) + |> put_req_header("content-type", "application/activity+json") + |> post("/inbox", data) + |> json_response(200) + + ObanHelpers.perform(all_enqueued(worker: ReceiverWorker)) + assert Activity.get_by_object_ap_id_with_object(data["object"]) + user = refresh_record(user) + refute user.pinned_objects[data["object"]] + end end describe "/users/:nickname/inbox" do -- cgit v1.2.3 From ff612750b1bae5223bca76b34a39e7d2bd05770c Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 2 Mar 2021 17:24:06 +0300 Subject: validator renaming & add validation for target --- lib/pleroma/web/activity_pub/object_validator.ex | 4 +- .../object_validators/add_remove_validator.ex | 53 ++++++++++++++++++++++ .../object_validators/common_validations.ex | 8 ++++ .../object_validators/pin_validator.ex | 42 ----------------- .../web/activity_pub/transmogrifier_test.exs | 2 +- .../controllers/status_controller_test.exs | 6 +-- test/support/http_request_mock.ex | 3 +- 7 files changed, 69 insertions(+), 49 deletions(-) create mode 100644 lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex delete mode 100644 lib/pleroma/web/activity_pub/object_validators/pin_validator.ex diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 11432ef38..14c3e8531 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -17,6 +17,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do alias Pleroma.Object.Containment alias Pleroma.User alias Pleroma.Web.ActivityPub.ObjectValidators.AcceptRejectValidator + alias Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator alias Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidator alias Pleroma.Web.ActivityPub.ObjectValidators.AnswerValidator alias Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidator @@ -30,7 +31,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.EventValidator alias Pleroma.Web.ActivityPub.ObjectValidators.FollowValidator alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator - alias Pleroma.Web.ActivityPub.ObjectValidators.PinValidator alias Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator alias Pleroma.Web.ActivityPub.ObjectValidators.UndoValidator alias Pleroma.Web.ActivityPub.ObjectValidators.UpdateValidator @@ -238,7 +238,7 @@ def validate(%{"type" => "Announce"} = object, meta) do def validate(%{"type" => type} = object, meta) when type in ~w(Add Remove) do with {:ok, object} <- object - |> PinValidator.cast_and_validate() + |> AddRemoveValidator.cast_and_validate() |> Ecto.Changeset.apply_action(:insert) do object = stringify_keys(object) {:ok, object, meta} diff --git a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex new file mode 100644 index 000000000..73d1c03f0 --- /dev/null +++ b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex @@ -0,0 +1,53 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator do + use Ecto.Schema + + import Ecto.Changeset + import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations + + alias Pleroma.EctoType.ActivityPub.ObjectValidators + + @primary_key false + + embedded_schema do + field(:id, ObjectValidators.ObjectID, primary_key: true) + field(:target) + field(:object, ObjectValidators.ObjectID) + field(:actor, ObjectValidators.ObjectID) + field(:type) + field(:to, ObjectValidators.Recipients, default: []) + field(:cc, ObjectValidators.Recipients, default: []) + end + + def cast_and_validate(data) do + data + |> cast_data() + |> validate_data() + end + + defp cast_data(data) do + cast(%__MODULE__{}, data, __schema__(:fields)) + end + + defp validate_data(changeset) do + changeset + |> validate_required([:id, :target, :object, :actor, :type, :to, :cc]) + |> validate_inclusion(:type, ~w(Add Remove)) + |> validate_actor_presence() + |> validate_collection_belongs_to_actor() + |> validate_object_presence() + end + + defp validate_collection_belongs_to_actor(changeset) do + validate_change(changeset, :target, fn :target, target -> + if String.starts_with?(target, changeset.changes[:actor]) do + [] + else + [target: "collection doesn't belong to actor"] + end + end) + end +end diff --git a/lib/pleroma/web/activity_pub/object_validators/common_validations.ex b/lib/pleroma/web/activity_pub/object_validators/common_validations.ex index 093549a45..940430588 100644 --- a/lib/pleroma/web/activity_pub/object_validators/common_validations.ex +++ b/lib/pleroma/web/activity_pub/object_validators/common_validations.ex @@ -9,6 +9,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations do alias Pleroma.Object alias Pleroma.User + @spec validate_any_presence(Ecto.Changeset.t(), [atom()]) :: Ecto.Changeset.t() def validate_any_presence(cng, fields) do non_empty = fields @@ -29,6 +30,7 @@ def validate_any_presence(cng, fields) do end end + @spec validate_actor_presence(Ecto.Changeset.t(), keyword()) :: Ecto.Changeset.t() def validate_actor_presence(cng, options \\ []) do field_name = Keyword.get(options, :field_name, :actor) @@ -47,6 +49,7 @@ def validate_actor_presence(cng, options \\ []) do end) end + @spec validate_object_presence(Ecto.Changeset.t(), keyword()) :: Ecto.Changeset.t() def validate_object_presence(cng, options \\ []) do field_name = Keyword.get(options, :field_name, :object) allowed_types = Keyword.get(options, :allowed_types, false) @@ -68,6 +71,7 @@ def validate_object_presence(cng, options \\ []) do end) end + @spec validate_object_or_user_presence(Ecto.Changeset.t(), keyword()) :: Ecto.Changeset.t() def validate_object_or_user_presence(cng, options \\ []) do field_name = Keyword.get(options, :field_name, :object) options = Keyword.put(options, :field_name, field_name) @@ -83,6 +87,7 @@ def validate_object_or_user_presence(cng, options \\ []) do if actor_cng.valid?, do: actor_cng, else: object_cng end + @spec validate_host_match(Ecto.Changeset.t(), [atom()]) :: Ecto.Changeset.t() def validate_host_match(cng, fields \\ [:id, :actor]) do if same_domain?(cng, fields) do cng @@ -95,6 +100,7 @@ def validate_host_match(cng, fields \\ [:id, :actor]) do end end + @spec validate_fields_match(Ecto.Changeset.t(), [atom()]) :: Ecto.Changeset.t() def validate_fields_match(cng, fields) do if map_unique?(cng, fields) do cng @@ -122,12 +128,14 @@ defp map_unique?(cng, fields, func \\ & &1) do end) end + @spec same_domain?(Ecto.Changeset.t(), [atom()]) :: boolean() def same_domain?(cng, fields \\ [:actor, :object]) do map_unique?(cng, fields, fn value -> URI.parse(value).host end) end # This figures out if a user is able to create, delete or modify something # based on the domain and superuser status + @spec validate_modification_rights(Ecto.Changeset.t()) :: Ecto.Changeset.t() def validate_modification_rights(cng) do actor = User.get_cached_by_ap_id(get_field(cng, :actor)) diff --git a/lib/pleroma/web/activity_pub/object_validators/pin_validator.ex b/lib/pleroma/web/activity_pub/object_validators/pin_validator.ex deleted file mode 100644 index dca8cba6f..000000000 --- a/lib/pleroma/web/activity_pub/object_validators/pin_validator.ex +++ /dev/null @@ -1,42 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.ActivityPub.ObjectValidators.PinValidator do - use Ecto.Schema - - import Ecto.Changeset - import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations - - alias Pleroma.EctoType.ActivityPub.ObjectValidators - - @primary_key false - - embedded_schema do - field(:id, ObjectValidators.ObjectID, primary_key: true) - field(:target) - field(:object, ObjectValidators.ObjectID) - field(:actor, ObjectValidators.ObjectID) - field(:type) - field(:to, ObjectValidators.Recipients, default: []) - field(:cc, ObjectValidators.Recipients, default: []) - end - - def cast_and_validate(data) do - data - |> cast_data() - |> validate_data() - end - - defp cast_data(data) do - cast(%__MODULE__{}, data, __schema__(:fields)) - end - - defp validate_data(changeset) do - changeset - |> validate_required([:id, :target, :object, :actor, :type, :to, :cc]) - |> validate_inclusion(:type, ~w(Add Remove)) - |> validate_actor_presence() - |> validate_object_presence() - end -end diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 28d7e1e3c..9bc27f89e 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -168,7 +168,7 @@ test "it accepts Add/Remove activities" do "id" => "http://localhost:400/objects/d61d6733-e256-4fe1-ab13-1e369789423d", "actor" => actor, "object" => object_url, - "target" => "http://example.com/users/lain/collections/featured", + "target" => "https://example.com/users/lain/collections/featured", "type" => "Remove", "to" => [Pleroma.Constants.as_public()], "cc" => ["https://example.com/users/lain/followers"] diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs index e0d642910..99ad87d05 100644 --- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs @@ -1209,15 +1209,15 @@ test "returns 404 error for a wrong id", %{conn: conn} do setup do: clear_config([:instance, :max_pinned_statuses], 1) test "pin status", %{conn: conn, user: user, activity: activity} do - id_str = to_string(activity.id) + id = activity.id - assert %{"id" => ^id_str, "pinned" => true} = + assert %{"id" => ^id, "pinned" => true} = conn |> put_req_header("content-type", "application/json") |> post("/api/v1/statuses/#{activity.id}/pin") |> json_response_and_validate_schema(200) - assert [%{"id" => ^id_str, "pinned" => true}] = + assert [%{"id" => ^id, "pinned" => true}] = conn |> get("/api/v1/accounts/#{user.id}/statuses?pinned=true") |> json_response_and_validate_schema(200) diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex index 9e9f1c86c..8807c2d14 100644 --- a/test/support/http_request_mock.ex +++ b/test/support/http_request_mock.ex @@ -924,7 +924,8 @@ def get("https://mastodon.social/users/lambadalambda/collections/featured", _, _ body: File.read!("test/fixtures/users_mock/masto_featured.json") |> String.replace("{{domain}}", "mastodon.social") - |> String.replace("{{nickname}}", "lambadalambda") + |> String.replace("{{nickname}}", "lambadalambda"), + headers: activitypub_object_headers() }} end -- cgit v1.2.3 From d1d2744ee3e6015064cf50ac5725bfe45b682466 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 3 Mar 2021 15:41:05 +0300 Subject: featured_address valition in AddRemoveValidator --- lib/pleroma/web/activity_pub/object_validator.ex | 2 +- .../object_validators/add_remove_validator.ex | 12 ++++++------ lib/pleroma/web/activity_pub/transmogrifier.ex | 7 +++++-- lib/pleroma/web/common_api.ex | 13 +++++++++---- test/fixtures/users_mock/user.json | 1 + .../activity_pub/activity_pub_controller_test.exs | 22 ++++++++++++++++++++++ .../web/activity_pub/transmogrifier_test.exs | 11 +++++++++++ 7 files changed, 55 insertions(+), 13 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 14c3e8531..3ca9136aa 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -238,7 +238,7 @@ def validate(%{"type" => "Announce"} = object, meta) do def validate(%{"type" => type} = object, meta) when type in ~w(Add Remove) do with {:ok, object} <- object - |> AddRemoveValidator.cast_and_validate() + |> AddRemoveValidator.cast_and_validate(meta) |> Ecto.Changeset.apply_action(:insert) do object = stringify_keys(object) {:ok, object, meta} diff --git a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex index 73d1c03f0..885282f32 100644 --- a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex @@ -22,28 +22,28 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator do field(:cc, ObjectValidators.Recipients, default: []) end - def cast_and_validate(data) do + def cast_and_validate(data, meta) do data |> cast_data() - |> validate_data() + |> validate_data(meta) end defp cast_data(data) do cast(%__MODULE__{}, data, __schema__(:fields)) end - defp validate_data(changeset) do + defp validate_data(changeset, meta) do changeset |> validate_required([:id, :target, :object, :actor, :type, :to, :cc]) |> validate_inclusion(:type, ~w(Add Remove)) |> validate_actor_presence() - |> validate_collection_belongs_to_actor() + |> validate_collection_belongs_to_actor(meta) |> validate_object_presence() end - defp validate_collection_belongs_to_actor(changeset) do + defp validate_collection_belongs_to_actor(changeset, meta) do validate_change(changeset, :target, fn :target, target -> - if String.starts_with?(target, changeset.changes[:actor]) do + if target == meta[:featured_address] do [] else [target: "collection doesn't belong to actor"] diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index b662f5379..fa62e0db2 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -557,7 +557,7 @@ def handle_incoming( end def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do - with {:ok, user} <- ObjectValidator.fetch_actor(data), + with {:ok, %User{} = user} <- ObjectValidator.fetch_actor(data), %Object{} <- Object.normalize(data["object"], fetch: true) do # Mastodon sends pin/unpin objects without id, to, cc fields data = @@ -566,7 +566,10 @@ def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remo |> Map.put_new("to", [Pleroma.Constants.as_public()]) |> Map.put_new("cc", [user.follower_address]) - case Pipeline.common_pipeline(data, local: false) do + case Pipeline.common_pipeline(data, + local: false, + featured_address: user.featured_address + ) do {:ok, activity, _meta} -> {:ok, activity} error -> error end diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index d35a0f219..175d690cc 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -412,14 +412,18 @@ def post(user, %{status: _} = data) do end @spec pin(String.t(), User.t()) :: {:ok, Activity.t()} | {:error, term()} - def pin(id, %User{ap_id: actor} = user) do + def pin(id, %User{} = user) do with %Activity{} = activity <- create_activity_by_id(id), - true <- activity_belongs_to_actor(activity, actor), + true <- activity_belongs_to_actor(activity, user.ap_id), true <- object_type_is_allowed_for_pin(activity.object), true <- activity_is_public(activity), {:ok, pin_data, _} <- Builder.pin(user, activity.object), {:ok, _pin, _} <- - Pipeline.common_pipeline(pin_data, local: true, activity_id: id) do + Pipeline.common_pipeline(pin_data, + local: true, + activity_id: id, + featured_address: user.featured_address + ) do {:ok, activity} else {:error, {:execute_side_effects, error}} -> error @@ -456,7 +460,8 @@ def unpin(id, user) do Pipeline.common_pipeline(unpin_data, local: true, activity_id: activity.id, - expires_at: activity.data["expires_at"] + expires_at: activity.data["expires_at"], + featured_address: user.featured_address ) do {:ok, activity} end diff --git a/test/fixtures/users_mock/user.json b/test/fixtures/users_mock/user.json index da2483d02..c722a1145 100644 --- a/test/fixtures/users_mock/user.json +++ b/test/fixtures/users_mock/user.json @@ -34,6 +34,7 @@ "owner": "https://example.com/users/{{nickname}}", "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5DLtwGXNZElJyxFGfcVc\nXANhaMadj/iYYQwZjOJTV9QsbtiNBeIK54PJrYuU0/0YIdrvS1iqheX5IwXRhcwa\nhm3ZyLz7XeN9st7FBni4BmZMBtMpxAuYuu5p/jbWy13qAiYOhPreCx0wrWgm/lBD\n9mkgaxIxPooBE0S4ZWEJIDIV1Vft3AWcRUyWW1vIBK0uZzs6GYshbQZB952S0yo4\nFzI1hABGHncH8UvuFauh4EZ8tY7/X5I0pGRnDOcRN1dAht5w5yTA+6r5kebiFQjP\nIzN/eCO/a9Flrj9YGW7HDNtjSOH0A31PLRGlJtJO3yK57dnf5ppyCZGfL4emShQo\ncQIDAQAB\n-----END PUBLIC KEY-----\n\n" }, + "featured": "https://example.com/users/{{nickname}}/collections/featured", "summary": "your friendly neighborhood pleroma developer
I like cute things and distributed systems, and really hate delete and redrafts", "tag": [], "type": "Person", diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs index d9fa25d94..cea4b3a97 100644 --- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs @@ -673,6 +673,17 @@ test "accepts Add/Remove activities", %{conn: conn} do body: user, headers: [{"content-type", "application/activity+json"}] } + + %{method: :get, url: "https://example.com/users/lain/collections/featured"} -> + %Tesla.Env{ + status: 200, + body: + "test/fixtures/users_mock/masto_featured.json" + |> File.read!() + |> String.replace("{{domain}}", "example.com") + |> String.replace("{{nickname}}", "lain"), + headers: [{"content-type", "application/activity+json"}] + } end) data = %{ @@ -753,6 +764,17 @@ test "mastodon pin/unpin", %{conn: conn} do body: user, headers: [{"content-type", "application/activity+json"}] } + + %{method: :get, url: "https://example.com/users/lain/collections/featured"} -> + %Tesla.Env{ + status: 200, + body: + "test/fixtures/users_mock/masto_featured.json" + |> File.read!() + |> String.replace("{{domain}}", "example.com") + |> String.replace("{{nickname}}", "lain"), + headers: [{"content-type", "application/activity+json"}] + } end) data = %{ diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 9bc27f89e..fb8284aaf 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -147,6 +147,17 @@ test "it accepts Add/Remove activities" do body: object, headers: [{"content-type", "application/activity+json"}] } + + %{method: :get, url: "https://example.com/users/lain/collections/featured"} -> + %Tesla.Env{ + status: 200, + body: + "test/fixtures/users_mock/masto_featured.json" + |> File.read!() + |> String.replace("{{domain}}", "example.com") + |> String.replace("{{nickname}}", "lain"), + headers: [{"content-type", "application/activity+json"}] + } end) message = %{ -- cgit v1.2.3 From 3adb43cc20751540ea590645b31b985807684202 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 3 Mar 2021 18:04:06 +0300 Subject: refetch user on incoming add/remove activity if featured_address is nil --- lib/pleroma/web/activity_pub/transmogrifier.ex | 8 +++ lib/pleroma/web/mastodon_api/views/status_view.ex | 2 +- .../web/activity_pub/transmogrifier_test.exs | 78 ++++++++++++++++++++++ test/support/factory.ex | 4 +- 4 files changed, 90 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index fa62e0db2..c4b11a655 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -558,6 +558,8 @@ def handle_incoming( def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do with {:ok, %User{} = user} <- ObjectValidator.fetch_actor(data), + # maybe locally user doesn't have featured_address + {:ok, user} <- maybe_refetch_user(user), %Object{} <- Object.normalize(data["object"], fetch: true) do # Mastodon sends pin/unpin objects without id, to, cc fields data = @@ -669,6 +671,12 @@ def handle_incoming( def handle_incoming(_, _), do: :error + defp maybe_refetch_user(%User{featured_address: address} = user) when is_binary(address) do + {:ok, user} + end + + defp maybe_refetch_user(%User{ap_id: ap_id}), do: upgrade_user_from_ap_id(ap_id) + @spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil def get_obj_helper(id, options \\ []) do options = Keyword.put(options, :fetch, true) diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index d0247fa4a..814b3d142 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -152,7 +152,7 @@ def render( |> Enum.filter(& &1) |> Enum.map(fn user -> AccountView.render("mention.json", %{user: user}) end) - {pinned?, pinned_at} = pin_data(activity_object, user) + {pinned?, pinned_at} = pin_data(object, user) %{ id: to_string(activity.id), diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index fb8284aaf..07ed3920f 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -191,6 +191,84 @@ test "it accepts Add/Remove activities" do user = refresh_record(user) refute user.pinned_objects[object_url] end + + test "Add/Remove activities for remote users without featured address" do + user = insert(:user, local: false, domain: "example.com") + + user = + user + |> Ecto.Changeset.change(featured_address: nil) + |> Repo.update!() + + %{host: host} = URI.parse(user.ap_id) + + user_data = + "test/fixtures/users_mock/user.json" + |> File.read!() + |> String.replace("{{nickname}}", user.nickname) + + object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" + + object = + "test/fixtures/statuses/note.json" + |> File.read!() + |> String.replace("{{nickname}}", user.nickname) + |> String.replace("{{object_id}}", object_id) + + object_url = "https://#{host}/objects/#{object_id}" + + actor = "https://#{host}/users/#{user.nickname}" + + featured = "https://#{host}/users/#{user.nickname}/collections/featured" + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^actor + } -> + %Tesla.Env{ + status: 200, + body: user_data, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^object_url + } -> + %Tesla.Env{ + status: 200, + body: object, + headers: [{"content-type", "application/activity+json"}] + } + + %{method: :get, url: ^featured} -> + %Tesla.Env{ + status: 200, + body: + "test/fixtures/users_mock/masto_featured.json" + |> File.read!() + |> String.replace("{{domain}}", "#{host}") + |> String.replace("{{nickname}}", user.nickname), + headers: [{"content-type", "application/activity+json"}] + } + end) + + message = %{ + "id" => "https://#{host}/objects/d61d6733-e256-4fe1-ab13-1e369789423f", + "actor" => actor, + "object" => object_url, + "target" => "https://#{host}/users/#{user.nickname}/collections/featured", + "type" => "Add", + "to" => [Pleroma.Constants.as_public()], + "cc" => ["https://#{host}/users/#{user.nickname}/followers"] + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(message) + assert activity.data == message + user = User.get_cached_by_ap_id(actor) + assert user.pinned_objects[object_url] + end end describe "prepare outgoing" do diff --git a/test/support/factory.ex b/test/support/factory.ex index 883cedf3c..867076d6a 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -41,7 +41,7 @@ def user_factory(attrs \\ %{}) do urls = if attrs[:local] == false do - base_domain = Enum.random(["domain1.com", "domain2.com", "domain3.com"]) + base_domain = attrs[:domain] || Enum.random(["domain1.com", "domain2.com", "domain3.com"]) ap_id = "https://#{base_domain}/users/#{user.nickname}" @@ -60,6 +60,8 @@ def user_factory(attrs \\ %{}) do } end + attrs = Map.delete(attrs, :domain) + user |> Map.put(:raw_bio, user.bio) |> Map.merge(urls) -- cgit v1.2.3 From 16c96966e9f7a039a969c06bdd6c4e18ab8d432c Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 9 Mar 2021 08:59:50 +0300 Subject: not needed --- test/fixtures/masto_pin.json | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 test/fixtures/masto_pin.json diff --git a/test/fixtures/masto_pin.json b/test/fixtures/masto_pin.json deleted file mode 100644 index e57a34375..000000000 --- a/test/fixtures/masto_pin.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "@context": [ - "https://www.w3.org/ns/activitystreams", - "https://w3id.org/security/v1", - { - "Emoji": "toot:Emoji", - "Hashtag": "as:Hashtag", - "PropertyValue": "schema:PropertyValue", - "alsoKnownAs": { - "@id": "as:alsoKnownAs", - "@type": "@id" - }, - "atomUri": "ostatus:atomUri", - "conversation": "ostatus:conversation", - "featured": { - "@id": "toot:featured", - "@type": "@id" - }, - "focalPoint": { - "@container": "@list", - "@id": "toot:focalPoint" - }, - "inReplyToAtomUri": "ostatus:inReplyToAtomUri", - "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", - "movedTo": { - "@id": "as:movedTo", - "@type": "@id" - }, - "ostatus": "http://ostatus.org#", - "schema": "http://schema.org#", - "sensitive": "as:sensitive", - "toot": "http://joinmastodon.org/ns#", - "value": "schema:value" - } - ], - "id": "https://example.com/users/nickname/statuses/{{id}}", - "actor": "https://example.com/users/nickname", - "object": "https://example.com/users/nickname/statuses/101355175004496751", - "target": "https://example.com/users/nickname/collections/featured", - "type": "{{type}}" -} -- cgit v1.2.3 From 8f0778166c2e7c76975d14937ef61c05d399b560 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 9 Mar 2021 09:00:20 +0300 Subject: moving fixture into mastodon folder --- test/fixtures/collections/featured.json | 39 ---------------------- test/fixtures/mastodon/collections/featured.json | 39 ++++++++++++++++++++++ .../pleroma/web/activity_pub/activity_pub_test.exs | 2 +- 3 files changed, 40 insertions(+), 40 deletions(-) delete mode 100644 test/fixtures/collections/featured.json create mode 100644 test/fixtures/mastodon/collections/featured.json diff --git a/test/fixtures/collections/featured.json b/test/fixtures/collections/featured.json deleted file mode 100644 index 56f8f56fa..000000000 --- a/test/fixtures/collections/featured.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "@context": [ - "https://www.w3.org/ns/activitystreams", - "https://{{domain}}/schemas/litepub-0.1.jsonld", - { - "@language": "und" - } - ], - "id": "https://{{domain}}/users/{{nickname}}/collections/featured", - "orderedItems": [ - { - "@context": [ - "https://www.w3.org/ns/activitystreams", - "https://{{domain}}/schemas/litepub-0.1.jsonld", - { - "@language": "und" - } - ], - "actor": "https://{{domain}}/users/{{nickname}}", - "attachment": [], - "attributedTo": "https://{{domain}}/users/{{nickname}}", - "cc": [ - "https://{{domain}}/users/{{nickname}}/followers" - ], - "content": "", - "id": "https://{{domain}}/objects/{{object_id}}", - "published": "2021-02-12T15:13:43.915429Z", - "sensitive": false, - "source": "", - "summary": "", - "tag": [], - "to": [ - "https://www.w3.org/ns/activitystreams#Public" - ], - "type": "Note" - } - ], - "type": "OrderedCollection" -} diff --git a/test/fixtures/mastodon/collections/featured.json b/test/fixtures/mastodon/collections/featured.json new file mode 100644 index 000000000..56f8f56fa --- /dev/null +++ b/test/fixtures/mastodon/collections/featured.json @@ -0,0 +1,39 @@ +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://{{domain}}/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "id": "https://{{domain}}/users/{{nickname}}/collections/featured", + "orderedItems": [ + { + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://{{domain}}/schemas/litepub-0.1.jsonld", + { + "@language": "und" + } + ], + "actor": "https://{{domain}}/users/{{nickname}}", + "attachment": [], + "attributedTo": "https://{{domain}}/users/{{nickname}}", + "cc": [ + "https://{{domain}}/users/{{nickname}}/followers" + ], + "content": "", + "id": "https://{{domain}}/objects/{{object_id}}", + "published": "2021-02-12T15:13:43.915429Z", + "sensitive": false, + "source": "", + "summary": "", + "tag": [], + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Note" + } + ], + "type": "OrderedCollection" +} diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs index 081d00d45..64e12066e 100644 --- a/test/pleroma/web/activity_pub/activity_pub_test.exs +++ b/test/pleroma/web/activity_pub/activity_pub_test.exs @@ -252,7 +252,7 @@ test "fetches user featured collection" do object_id = Ecto.UUID.generate() featured_data = - "test/fixtures/collections/featured.json" + "test/fixtures/mastodon/collections/featured.json" |> File.read!() |> String.replace("{{domain}}", "example.com") |> String.replace("{{nickname}}", "lain") -- cgit v1.2.3 From 5ae9b05600dd3dffc628ba25fe01b271f7bc0122 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 9 Mar 2021 09:00:44 +0300 Subject: separate test file for featured collection --- .../transmogrifier/add_remove_handling_test.exs | 172 +++++++++++++++++++++ .../web/activity_pub/transmogrifier_test.exs | 163 ------------------- 2 files changed, 172 insertions(+), 163 deletions(-) create mode 100644 test/pleroma/web/activity_pub/transmogrifier/add_remove_handling_test.exs diff --git a/test/pleroma/web/activity_pub/transmogrifier/add_remove_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/add_remove_handling_test.exs new file mode 100644 index 000000000..fc7757125 --- /dev/null +++ b/test/pleroma/web/activity_pub/transmogrifier/add_remove_handling_test.exs @@ -0,0 +1,172 @@ +defmodule Pleroma.Web.ActivityPub.Transmogrifier.AddRemoveHandlingTest do + use Oban.Testing, repo: Pleroma.Repo + use Pleroma.DataCase, async: true + + require Pleroma.Constants + + import Pleroma.Factory + + alias Pleroma.User + alias Pleroma.Web.ActivityPub.Transmogrifier + + test "it accepts Add/Remove activities" do + user = + "test/fixtures/users_mock/user.json" + |> File.read!() + |> String.replace("{{nickname}}", "lain") + + object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" + + object = + "test/fixtures/statuses/note.json" + |> File.read!() + |> String.replace("{{nickname}}", "lain") + |> String.replace("{{object_id}}", object_id) + + object_url = "https://example.com/objects/#{object_id}" + + actor = "https://example.com/users/lain" + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^actor + } -> + %Tesla.Env{ + status: 200, + body: user, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^object_url + } -> + %Tesla.Env{ + status: 200, + body: object, + headers: [{"content-type", "application/activity+json"}] + } + + %{method: :get, url: "https://example.com/users/lain/collections/featured"} -> + %Tesla.Env{ + status: 200, + body: + "test/fixtures/users_mock/masto_featured.json" + |> File.read!() + |> String.replace("{{domain}}", "example.com") + |> String.replace("{{nickname}}", "lain"), + headers: [{"content-type", "application/activity+json"}] + } + end) + + message = %{ + "id" => "https://example.com/objects/d61d6733-e256-4fe1-ab13-1e369789423f", + "actor" => actor, + "object" => object_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Add", + "to" => [Pleroma.Constants.as_public()], + "cc" => ["https://example.com/users/lain/followers"] + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(message) + assert activity.data == message + user = User.get_cached_by_ap_id(actor) + assert user.pinned_objects[object_url] + + remove = %{ + "id" => "http://localhost:400/objects/d61d6733-e256-4fe1-ab13-1e369789423d", + "actor" => actor, + "object" => object_url, + "target" => "https://example.com/users/lain/collections/featured", + "type" => "Remove", + "to" => [Pleroma.Constants.as_public()], + "cc" => ["https://example.com/users/lain/followers"] + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(remove) + assert activity.data == remove + + user = refresh_record(user) + refute user.pinned_objects[object_url] + end + + test "Add/Remove activities for remote users without featured address" do + user = insert(:user, local: false, domain: "example.com") + + user = + user + |> Ecto.Changeset.change(featured_address: nil) + |> Repo.update!() + + %{host: host} = URI.parse(user.ap_id) + + user_data = + "test/fixtures/users_mock/user.json" + |> File.read!() + |> String.replace("{{nickname}}", user.nickname) + + object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" + + object = + "test/fixtures/statuses/note.json" + |> File.read!() + |> String.replace("{{nickname}}", user.nickname) + |> String.replace("{{object_id}}", object_id) + + object_url = "https://#{host}/objects/#{object_id}" + + actor = "https://#{host}/users/#{user.nickname}" + + featured = "https://#{host}/users/#{user.nickname}/collections/featured" + + Tesla.Mock.mock(fn + %{ + method: :get, + url: ^actor + } -> + %Tesla.Env{ + status: 200, + body: user_data, + headers: [{"content-type", "application/activity+json"}] + } + + %{ + method: :get, + url: ^object_url + } -> + %Tesla.Env{ + status: 200, + body: object, + headers: [{"content-type", "application/activity+json"}] + } + + %{method: :get, url: ^featured} -> + %Tesla.Env{ + status: 200, + body: + "test/fixtures/users_mock/masto_featured.json" + |> File.read!() + |> String.replace("{{domain}}", "#{host}") + |> String.replace("{{nickname}}", user.nickname), + headers: [{"content-type", "application/activity+json"}] + } + end) + + message = %{ + "id" => "https://#{host}/objects/d61d6733-e256-4fe1-ab13-1e369789423f", + "actor" => actor, + "object" => object_url, + "target" => "https://#{host}/users/#{user.nickname}/collections/featured", + "type" => "Add", + "to" => [Pleroma.Constants.as_public()], + "cc" => ["https://#{host}/users/#{user.nickname}/followers"] + } + + assert {:ok, activity} = Transmogrifier.handle_incoming(message) + assert activity.data == message + user = User.get_cached_by_ap_id(actor) + assert user.pinned_objects[object_url] + end +end diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs index 07ed3920f..4c3fcb44a 100644 --- a/test/pleroma/web/activity_pub/transmogrifier_test.exs +++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -6,8 +6,6 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do use Oban.Testing, repo: Pleroma.Repo use Pleroma.DataCase - require Pleroma.Constants - alias Pleroma.Activity alias Pleroma.Object alias Pleroma.Tests.ObanHelpers @@ -108,167 +106,6 @@ test "it accepts Move activities" do assert activity.data["target"] == new_user.ap_id assert activity.data["type"] == "Move" end - - test "it accepts Add/Remove activities" do - user = - "test/fixtures/users_mock/user.json" - |> File.read!() - |> String.replace("{{nickname}}", "lain") - - object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" - - object = - "test/fixtures/statuses/note.json" - |> File.read!() - |> String.replace("{{nickname}}", "lain") - |> String.replace("{{object_id}}", object_id) - - object_url = "https://example.com/objects/#{object_id}" - - actor = "https://example.com/users/lain" - - Tesla.Mock.mock(fn - %{ - method: :get, - url: ^actor - } -> - %Tesla.Env{ - status: 200, - body: user, - headers: [{"content-type", "application/activity+json"}] - } - - %{ - method: :get, - url: ^object_url - } -> - %Tesla.Env{ - status: 200, - body: object, - headers: [{"content-type", "application/activity+json"}] - } - - %{method: :get, url: "https://example.com/users/lain/collections/featured"} -> - %Tesla.Env{ - status: 200, - body: - "test/fixtures/users_mock/masto_featured.json" - |> File.read!() - |> String.replace("{{domain}}", "example.com") - |> String.replace("{{nickname}}", "lain"), - headers: [{"content-type", "application/activity+json"}] - } - end) - - message = %{ - "id" => "https://example.com/objects/d61d6733-e256-4fe1-ab13-1e369789423f", - "actor" => actor, - "object" => object_url, - "target" => "https://example.com/users/lain/collections/featured", - "type" => "Add", - "to" => [Pleroma.Constants.as_public()], - "cc" => ["https://example.com/users/lain/followers"] - } - - assert {:ok, activity} = Transmogrifier.handle_incoming(message) - assert activity.data == message - user = User.get_cached_by_ap_id(actor) - assert user.pinned_objects[object_url] - - remove = %{ - "id" => "http://localhost:400/objects/d61d6733-e256-4fe1-ab13-1e369789423d", - "actor" => actor, - "object" => object_url, - "target" => "https://example.com/users/lain/collections/featured", - "type" => "Remove", - "to" => [Pleroma.Constants.as_public()], - "cc" => ["https://example.com/users/lain/followers"] - } - - assert {:ok, activity} = Transmogrifier.handle_incoming(remove) - assert activity.data == remove - - user = refresh_record(user) - refute user.pinned_objects[object_url] - end - - test "Add/Remove activities for remote users without featured address" do - user = insert(:user, local: false, domain: "example.com") - - user = - user - |> Ecto.Changeset.change(featured_address: nil) - |> Repo.update!() - - %{host: host} = URI.parse(user.ap_id) - - user_data = - "test/fixtures/users_mock/user.json" - |> File.read!() - |> String.replace("{{nickname}}", user.nickname) - - object_id = "c61d6733-e256-4fe1-ab13-1e369789423f" - - object = - "test/fixtures/statuses/note.json" - |> File.read!() - |> String.replace("{{nickname}}", user.nickname) - |> String.replace("{{object_id}}", object_id) - - object_url = "https://#{host}/objects/#{object_id}" - - actor = "https://#{host}/users/#{user.nickname}" - - featured = "https://#{host}/users/#{user.nickname}/collections/featured" - - Tesla.Mock.mock(fn - %{ - method: :get, - url: ^actor - } -> - %Tesla.Env{ - status: 200, - body: user_data, - headers: [{"content-type", "application/activity+json"}] - } - - %{ - method: :get, - url: ^object_url - } -> - %Tesla.Env{ - status: 200, - body: object, - headers: [{"content-type", "application/activity+json"}] - } - - %{method: :get, url: ^featured} -> - %Tesla.Env{ - status: 200, - body: - "test/fixtures/users_mock/masto_featured.json" - |> File.read!() - |> String.replace("{{domain}}", "#{host}") - |> String.replace("{{nickname}}", user.nickname), - headers: [{"content-type", "application/activity+json"}] - } - end) - - message = %{ - "id" => "https://#{host}/objects/d61d6733-e256-4fe1-ab13-1e369789423f", - "actor" => actor, - "object" => object_url, - "target" => "https://#{host}/users/#{user.nickname}/collections/featured", - "type" => "Add", - "to" => [Pleroma.Constants.as_public()], - "cc" => ["https://#{host}/users/#{user.nickname}/followers"] - } - - assert {:ok, activity} = Transmogrifier.handle_incoming(message) - assert activity.data == message - user = User.get_cached_by_ap_id(actor) - assert user.pinned_objects[object_url] - end end describe "prepare outgoing" do -- cgit v1.2.3 From 8857242c952dcac0bc5363e1c80160efaf7a1638 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Tue, 9 Mar 2021 11:57:20 +0300 Subject: removeing corresponding add activity --- lib/pleroma/activity.ex | 9 ++++++ lib/pleroma/web/activity_pub/side_effects.ex | 5 ++++ test/pleroma/activity_test.exs | 22 +++++++++++++++ test/support/factory.ex | 42 ++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index a4cfca4c5..53beca5e6 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -391,4 +391,13 @@ def get_by_object_ap_id_with_object(ap_id) when is_binary(ap_id) do end def get_by_object_ap_id_with_object(_), do: nil + + @spec add_by_params_query(String.t(), String.t(), String.t()) :: Ecto.Query.t() + def add_by_params_query(object_id, actor, target) do + object_id + |> Queries.by_object_id() + |> Queries.by_type("Add") + |> Queries.by_actor(actor) + |> where([a], fragment("?->>'target' = ?", a.data, ^target)) + end end diff --git a/lib/pleroma/web/activity_pub/side_effects.ex b/lib/pleroma/web/activity_pub/side_effects.ex index 9d22f9d3c..5fe143c2b 100644 --- a/lib/pleroma/web/activity_pub/side_effects.ex +++ b/lib/pleroma/web/activity_pub/side_effects.ex @@ -340,11 +340,16 @@ def handle(%{data: %{"type" => "Add"} = data} = object, meta) do # Tasks this handles: # - removes pin from user + # - removes corresponding Add activity # - if activity had expiration, recreates activity expiration job @impl true def handle(%{data: %{"type" => "Remove"} = data} = object, meta) do with %User{} = user <- User.get_cached_by_ap_id(data["actor"]), {:ok, _user} <- User.remove_pinned_object_id(user, data["object"]) do + data["object"] + |> Activity.add_by_params_query(user.ap_id, user.featured_address) + |> Repo.delete_all() + # if pinned activity was scheduled for deletion, we reschedule it for deletion if meta[:expires_at] do # MRF.ActivityExpirationPolicy used UTC timestamps for expires_at in original implementation diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs index 390a06344..962bc7e45 100644 --- a/test/pleroma/activity_test.exs +++ b/test/pleroma/activity_test.exs @@ -254,4 +254,26 @@ test "get_by_object_ap_id_with_object/1" do assert %{id: ^id} = Activity.get_by_object_ap_id_with_object(obj_id) end + + test "add_by_params_query/3" do + user = insert(:user) + + note = insert(:note_activity, user: user) + + insert(:add_activity, user: user, note: note) + insert(:add_activity, user: user, note: note) + insert(:add_activity, user: user) + + assert Repo.aggregate(Activity, :count, :id) == 4 + + add_query = + Activity.add_by_params_query(note.data["object"], user.ap_id, user.featured_address) + + assert Repo.aggregate(add_query, :count, :id) == 2 + + Repo.delete_all(add_query) + assert Repo.aggregate(add_query, :count, :id) == 0 + + assert Repo.aggregate(Activity, :count, :id) == 2 + end end diff --git a/test/support/factory.ex b/test/support/factory.ex index 867076d6a..5c4e65c81 100644 --- a/test/support/factory.ex +++ b/test/support/factory.ex @@ -4,6 +4,9 @@ defmodule Pleroma.Factory do use ExMachina.Ecto, repo: Pleroma.Repo + + require Pleroma.Constants + alias Pleroma.Object alias Pleroma.User @@ -225,6 +228,45 @@ def direct_note_activity_factory do } end + def add_activity_factory(attrs \\ %{}) do + featured_collection_activity(attrs, "Add") + end + + def remove_activity_factor(attrs \\ %{}) do + featured_collection_activity(attrs, "Remove") + end + + defp featured_collection_activity(attrs, type) do + user = attrs[:user] || insert(:user) + note = attrs[:note] || insert(:note, user: user) + + data_attrs = + attrs + |> Map.get(:data_attrs, %{}) + |> Map.put(:type, type) + + attrs = Map.drop(attrs, [:user, :note, :data_attrs]) + + data = + %{ + "id" => Pleroma.Web.ActivityPub.Utils.generate_activity_id(), + "target" => user.featured_address, + "object" => note.data["object"], + "actor" => note.data["actor"], + "type" => "Add", + "to" => [Pleroma.Constants.as_public()], + "cc" => [user.follower_address] + } + |> Map.merge(data_attrs) + + %Pleroma.Activity{ + data: data, + actor: data["actor"], + recipients: data["to"] + } + |> Map.merge(attrs) + end + def note_activity_factory(attrs \\ %{}) do user = attrs[:user] || insert(:user) note = attrs[:note] || insert(:note, user: user) -- cgit v1.2.3 From 2a520ba008f432e7e1fa297954966e0181245f01 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 19 Mar 2021 17:25:12 +0300 Subject: expanding AddRemoveValidator --- lib/pleroma/web/activity_pub/object_validator.ex | 2 +- .../object_validators/add_remove_validator.ex | 26 +++++++++++++++++----- lib/pleroma/web/activity_pub/transmogrifier.ex | 22 +++++------------- lib/pleroma/web/common_api.ex | 3 +-- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 3ca9136aa..14c3e8531 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -238,7 +238,7 @@ def validate(%{"type" => "Announce"} = object, meta) do def validate(%{"type" => type} = object, meta) when type in ~w(Add Remove) do with {:ok, object} <- object - |> AddRemoveValidator.cast_and_validate(meta) + |> AddRemoveValidator.cast_and_validate() |> Ecto.Changeset.apply_action(:insert) do object = stringify_keys(object) {:ok, object, meta} diff --git a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex index 885282f32..c38f86a0e 100644 --- a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex @@ -8,6 +8,8 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator do import Ecto.Changeset import Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations + require Pleroma.Constants + alias Pleroma.EctoType.ActivityPub.ObjectValidators @primary_key false @@ -22,28 +24,40 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator do field(:cc, ObjectValidators.Recipients, default: []) end - def cast_and_validate(data, meta) do + def cast_and_validate(data) do data + |> maybe_fix_data_for_mastodon() |> cast_data() - |> validate_data(meta) + |> validate_data() + end + + defp maybe_fix_data_for_mastodon(data) do + {:ok, actor} = Pleroma.User.get_or_fetch_by_ap_id(data["actor"]) + # Mastodon sends pin/unpin objects without id, to, cc fields + data + |> Map.put_new("id", Pleroma.Web.ActivityPub.Utils.generate_activity_id()) + |> Map.put_new("to", [Pleroma.Constants.as_public()]) + |> Map.put_new("cc", [actor.follower_address]) end defp cast_data(data) do cast(%__MODULE__{}, data, __schema__(:fields)) end - defp validate_data(changeset, meta) do + defp validate_data(changeset) do changeset |> validate_required([:id, :target, :object, :actor, :type, :to, :cc]) |> validate_inclusion(:type, ~w(Add Remove)) |> validate_actor_presence() - |> validate_collection_belongs_to_actor(meta) + |> validate_collection_belongs_to_actor() |> validate_object_presence() end - defp validate_collection_belongs_to_actor(changeset, meta) do + defp validate_collection_belongs_to_actor(changeset) do + {:ok, actor} = Pleroma.User.get_or_fetch_by_ap_id(changeset.changes[:actor]) + validate_change(changeset, :target, fn :target, target -> - if target == meta[:featured_address] do + if target == actor.featured_address do [] else [target: "collection doesn't belong to actor"] diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index c4b11a655..2172e7736 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -557,24 +557,12 @@ def handle_incoming( end def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do - with {:ok, %User{} = user} <- ObjectValidator.fetch_actor(data), + with :ok <- ObjectValidator.fetch_actor_and_object(data), + {:ok, actor} <- Pleroma.User.get_or_fetch_by_ap_id(data["actor"]), # maybe locally user doesn't have featured_address - {:ok, user} <- maybe_refetch_user(user), - %Object{} <- Object.normalize(data["object"], fetch: true) do - # Mastodon sends pin/unpin objects without id, to, cc fields - data = - data - |> Map.put_new("id", Utils.generate_activity_id()) - |> Map.put_new("to", [Pleroma.Constants.as_public()]) - |> Map.put_new("cc", [user.follower_address]) - - case Pipeline.common_pipeline(data, - local: false, - featured_address: user.featured_address - ) do - {:ok, activity, _meta} -> {:ok, activity} - error -> error - end + {:ok, _} <- maybe_refetch_user(actor), + {:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do + {:ok, activity} end end diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 175d690cc..b36be4d2a 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -421,8 +421,7 @@ def pin(id, %User{} = user) do {:ok, _pin, _} <- Pipeline.common_pipeline(pin_data, local: true, - activity_id: id, - featured_address: user.featured_address + activity_id: id ) do {:ok, activity} else -- cgit v1.2.3 From 1885268c9c242aca2a51bd15ed839bd65d6a52dc Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 25 Mar 2021 13:26:54 +0300 Subject: expanding validator --- .../object_validators/add_remove_validator.ex | 28 +++++++++++++++------- lib/pleroma/web/activity_pub/transmogrifier.ex | 18 +------------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex index c38f86a0e..f885aabe4 100644 --- a/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/add_remove_validator.ex @@ -11,6 +11,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator do require Pleroma.Constants alias Pleroma.EctoType.ActivityPub.ObjectValidators + alias Pleroma.User @primary_key false @@ -25,14 +26,17 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AddRemoveValidator do end def cast_and_validate(data) do + {:ok, actor} = User.get_or_fetch_by_ap_id(data["actor"]) + + {:ok, actor} = maybe_refetch_user(actor) + data - |> maybe_fix_data_for_mastodon() + |> maybe_fix_data_for_mastodon(actor) |> cast_data() - |> validate_data() + |> validate_data(actor) end - defp maybe_fix_data_for_mastodon(data) do - {:ok, actor} = Pleroma.User.get_or_fetch_by_ap_id(data["actor"]) + defp maybe_fix_data_for_mastodon(data, actor) do # Mastodon sends pin/unpin objects without id, to, cc fields data |> Map.put_new("id", Pleroma.Web.ActivityPub.Utils.generate_activity_id()) @@ -44,18 +48,16 @@ defp cast_data(data) do cast(%__MODULE__{}, data, __schema__(:fields)) end - defp validate_data(changeset) do + defp validate_data(changeset, actor) do changeset |> validate_required([:id, :target, :object, :actor, :type, :to, :cc]) |> validate_inclusion(:type, ~w(Add Remove)) |> validate_actor_presence() - |> validate_collection_belongs_to_actor() + |> validate_collection_belongs_to_actor(actor) |> validate_object_presence() end - defp validate_collection_belongs_to_actor(changeset) do - {:ok, actor} = Pleroma.User.get_or_fetch_by_ap_id(changeset.changes[:actor]) - + defp validate_collection_belongs_to_actor(changeset, actor) do validate_change(changeset, :target, fn :target, target -> if target == actor.featured_address do [] @@ -64,4 +66,12 @@ defp validate_collection_belongs_to_actor(changeset) do end end) end + + defp maybe_refetch_user(%User{featured_address: address} = user) when is_binary(address) do + {:ok, user} + end + + defp maybe_refetch_user(%User{ap_id: ap_id}) do + Pleroma.Web.ActivityPub.Transmogrifier.upgrade_user_from_ap_id(ap_id) + end end diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 2172e7736..c4caeff0a 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -534,7 +534,7 @@ def handle_incoming( end def handle_incoming(%{"type" => type} = data, _options) - when type in ~w{Like EmojiReact Announce} do + when type in ~w{Like EmojiReact Announce Add Remove} do with :ok <- ObjectValidator.fetch_actor_and_object(data), {:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do @@ -556,16 +556,6 @@ def handle_incoming( end end - def handle_incoming(%{"type" => type} = data, _options) when type in ~w(Add Remove) do - with :ok <- ObjectValidator.fetch_actor_and_object(data), - {:ok, actor} <- Pleroma.User.get_or_fetch_by_ap_id(data["actor"]), - # maybe locally user doesn't have featured_address - {:ok, _} <- maybe_refetch_user(actor), - {:ok, activity, _meta} <- Pipeline.common_pipeline(data, local: false) do - {:ok, activity} - end - end - def handle_incoming( %{"type" => "Delete"} = data, _options @@ -659,12 +649,6 @@ def handle_incoming( def handle_incoming(_, _), do: :error - defp maybe_refetch_user(%User{featured_address: address} = user) when is_binary(address) do - {:ok, user} - end - - defp maybe_refetch_user(%User{ap_id: ap_id}), do: upgrade_user_from_ap_id(ap_id) - @spec get_obj_helper(String.t(), Keyword.t()) :: {:ok, Object.t()} | nil def get_obj_helper(id, options \\ []) do options = Keyword.put(options, :fetch, true) -- cgit v1.2.3 From 6e108b8603de45d489d4aef7e3e271bc5e8c431d Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Fri, 26 Mar 2021 19:19:19 +0300 Subject: reading the file, instead of config keyword --- lib/pleroma/config/release_runtime_provider.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/config/release_runtime_provider.ex b/lib/pleroma/config/release_runtime_provider.ex index 8227195dc..70ef3bcc1 100644 --- a/lib/pleroma/config/release_runtime_provider.ex +++ b/lib/pleroma/config/release_runtime_provider.ex @@ -39,7 +39,7 @@ def load(config, _opts) do with_exported = if File.exists?(exported_config_path) do - exported_config = Config.Reader.read!(with_runtime_config) + exported_config = Config.Reader.read!(exported_config_path) Config.Reader.merge(with_runtime_config, exported_config) else with_runtime_config -- cgit v1.2.3 From 4d046afd2769cfdc16b2ee48e8c1d8f7f8e8ffa7 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Sat, 27 Mar 2021 09:05:33 +0300 Subject: tests for release config provider --- lib/pleroma/config/release_runtime_provider.ex | 17 ++++---- mix.exs | 13 +++++- .../config/temp.exported_from_db.secret.exs | 5 +++ .../config/release_runtime_provider_test.exs | 46 ++++++++++++++++++++++ 4 files changed, 70 insertions(+), 11 deletions(-) create mode 100644 test/fixtures/config/temp.exported_from_db.secret.exs create mode 100644 test/pleroma/config/release_runtime_provider_test.exs diff --git a/lib/pleroma/config/release_runtime_provider.ex b/lib/pleroma/config/release_runtime_provider.ex index 70ef3bcc1..46fa35559 100644 --- a/lib/pleroma/config/release_runtime_provider.ex +++ b/lib/pleroma/config/release_runtime_provider.ex @@ -1,6 +1,6 @@ defmodule Pleroma.Config.ReleaseRuntimeProvider do @moduledoc """ - Imports `runtime.exs` and `{env}.exported_from_db.secret.exs` for elixir releases. + Imports runtime config and `{env}.exported_from_db.secret.exs` for releases. """ @behaviour Config.Provider @@ -8,13 +8,13 @@ defmodule Pleroma.Config.ReleaseRuntimeProvider do def init(opts), do: opts @impl true - def load(config, _opts) do + def load(config, opts) do with_defaults = Config.Reader.merge(config, Pleroma.Config.Holder.release_defaults()) - config_path = System.get_env("PLEROMA_CONFIG_PATH") || "/etc/pleroma/config.exs" + config_path = opts[:config_path] with_runtime_config = - if File.exists?(config_path) do + if config_path && File.exists?(config_path) do runtime_config = Config.Reader.read!(config_path) with_defaults @@ -24,7 +24,7 @@ def load(config, _opts) do warning = [ IO.ANSI.red(), IO.ANSI.bright(), - "!!! #{config_path} not found! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file", + "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file", IO.ANSI.reset() ] @@ -32,13 +32,10 @@ def load(config, _opts) do with_defaults end - exported_config_path = - config_path - |> Path.dirname() - |> Path.join("prod.exported_from_db.secret.exs") + exported_config_path = opts[:exported_config_path] with_exported = - if File.exists?(exported_config_path) do + if exported_config_path && File.exists?(exported_config_path) do exported_config = Config.Reader.read!(exported_config_path) Config.Reader.merge(with_runtime_config, exported_config) else diff --git a/mix.exs b/mix.exs index ae74f50a3..7328b533b 100644 --- a/mix.exs +++ b/mix.exs @@ -38,7 +38,7 @@ def project do include_executables_for: [:unix], applications: [ex_syslogger: :load, syslog: :load, eldap: :transient], steps: [:assemble, &put_otp_version/1, ©_files/1, ©_nginx_config/1], - config_providers: [{Pleroma.Config.ReleaseRuntimeProvider, nil}] + config_providers: [{Pleroma.Config.ReleaseRuntimeProvider, release_config_paths()}] ] ] ] @@ -67,6 +67,17 @@ def copy_nginx_config(%{path: target_path} = release) do release end + defp release_config_paths do + config_path = System.get_env("PLEROMA_CONFIG_PATH") || "/etc/pleroma/config.exs" + + exported_config_path = + config_path + |> Path.dirname() + |> Path.join("#{Mix.env()}.exported_from_db.secret.exs") + + [config_path: config_path, exported_config_path: exported_config_path] + end + # Configuration for the OTP application. # # Type `mix help compile.app` for more information. diff --git a/test/fixtures/config/temp.exported_from_db.secret.exs b/test/fixtures/config/temp.exported_from_db.secret.exs new file mode 100644 index 000000000..64bee7f32 --- /dev/null +++ b/test/fixtures/config/temp.exported_from_db.secret.exs @@ -0,0 +1,5 @@ +use Mix.Config + +config :pleroma, exported_config_merged: true + +config :pleroma, :first_setting, key: "new value" diff --git a/test/pleroma/config/release_runtime_provider_test.exs b/test/pleroma/config/release_runtime_provider_test.exs new file mode 100644 index 000000000..1921698c5 --- /dev/null +++ b/test/pleroma/config/release_runtime_provider_test.exs @@ -0,0 +1,46 @@ +defmodule Pleroma.Config.ReleaseRuntimeProviderTest do + use ExUnit.Case, async: true + + alias Pleroma.Config.ReleaseRuntimeProvider + + describe "load/2" do + test "loads release defaults config and warns about non-existent runtime config" do + ExUnit.CaptureIO.capture_io(fn -> + merged = ReleaseRuntimeProvider.load([], []) + assert merged == Pleroma.Config.Holder.release_defaults() + IO.inspect(merged) + end) =~ + "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file" + end + + test "merged runtime config" do + merged = + ReleaseRuntimeProvider.load([], config_path: "test/fixtures/config/temp.secret.exs") + + assert merged[:pleroma][:first_setting] == [key: "value", key2: [Pleroma.Repo]] + assert merged[:pleroma][:second_setting] == [key: "value2", key2: ["Activity"]] + end + + test "merged exported config" do + ExUnit.CaptureIO.capture_io(fn -> + merged = + ReleaseRuntimeProvider.load([], + exported_config_path: "test/fixtures/config/temp.exported_from_db.secret.exs" + ) + + assert merged[:pleroma][:exported_config_merged] + end) =~ + "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file" + end + + test "runtime config is merged with exported config" do + merged = + ReleaseRuntimeProvider.load([], + config_path: "test/fixtures/config/temp.secret.exs", + exported_config_path: "test/fixtures/config/temp.exported_from_db.secret.exs" + ) + + assert merged[:pleroma][:first_setting] == [key2: [Pleroma.Repo], key: "new value"] + end + end +end -- cgit v1.2.3 From 8b81d6222773180c9632b7b53ebe7f5ee19f4f65 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 8 Oct 2020 11:55:35 -0500 Subject: Upstream original followbot implementation --- config/config.exs | 2 ++ .../web/activity_pub/mrf/follow_bot_policy.ex | 41 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex diff --git a/config/config.exs b/config/config.exs index 8d1e17b42..4381068ac 100644 --- a/config/config.exs +++ b/config/config.exs @@ -409,6 +409,8 @@ threshold: 604_800, actions: [:delist, :strip_followers] +config :pleroma, :mrf_follow_bot, follower_nickname: nil + config :pleroma, :rich_media, enabled: true, ignore_hosts: [], diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex new file mode 100644 index 000000000..fb123dbd3 --- /dev/null +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -0,0 +1,41 @@ +defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do + @behaviour Pleroma.Web.ActivityPub.MRF + alias Pleroma.User + alias Pleroma.Web.CommonAPI + require Logger + + @impl true + def filter(message) do + Task.start(fn -> + follower_nickname = Pleroma.Config.get([:mrf_follow_bot, :follower_nickname]) + + with %User{} = follower <- User.get_cached_by_nickname(follower_nickname), + %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do + to = Map.get(message, "to", []) + cc = Map.get(message, "cc", []) + actor = [message["actor"]] + + Enum.concat([to, cc, actor]) + |> List.flatten() + |> User.get_all_by_ap_id() + |> Enum.each(fn user -> + Logger.info("Checking if #{user.nickname} can be followed") + + with false <- User.following?(follower, user), + false <- user.locked, + false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do + Logger.info("Following #{user.nickname}") + CommonAPI.follow(follower, user) + end + end) + end + end) + + {:ok, message} + end + + @impl true + def describe do + {:ok, %{}} + end +end -- cgit v1.2.3 From fba770b3ea861d0fdf7811b61a297278a617136b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 8 Oct 2020 12:09:31 -0500 Subject: Try to handle misconfiguration scenarios gracefully --- .../web/activity_pub/mrf/follow_bot_policy.ex | 59 ++++++++++++++-------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex index fb123dbd3..52ac9aef7 100644 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -1,34 +1,49 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do @behaviour Pleroma.Web.ActivityPub.MRF + alias Pleroma.Config alias Pleroma.User alias Pleroma.Web.CommonAPI require Logger @impl true def filter(message) do + with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), + %User{} = follower <- User.get_cached_by_nickname(follower_nickname), + %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do + try_follow(follower, message) + else + nil -> + Logger.warn( + "#{__MODULE__} skipped because of missing :mrf_follow_bot, :follower_nickname configuration or the account + does not exist." + ) + + {:ok, message} + + _ -> + {:ok, message} + end + end + + defp try_follow(follower, message) do Task.start(fn -> - follower_nickname = Pleroma.Config.get([:mrf_follow_bot, :follower_nickname]) - - with %User{} = follower <- User.get_cached_by_nickname(follower_nickname), - %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do - to = Map.get(message, "to", []) - cc = Map.get(message, "cc", []) - actor = [message["actor"]] - - Enum.concat([to, cc, actor]) - |> List.flatten() - |> User.get_all_by_ap_id() - |> Enum.each(fn user -> - Logger.info("Checking if #{user.nickname} can be followed") - - with false <- User.following?(follower, user), - false <- user.locked, - false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do - Logger.info("Following #{user.nickname}") - CommonAPI.follow(follower, user) - end - end) - end + to = Map.get(message, "to", []) + cc = Map.get(message, "cc", []) + actor = [message["actor"]] + + Enum.concat([to, cc, actor]) + |> List.flatten() + |> User.get_all_by_ap_id() + |> Enum.each(fn user -> + Logger.info("Checking if #{user.nickname} can be followed") + + with false <- User.following?(follower, user), + false <- user.locked, + false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do + Logger.info("Following #{user.nickname}") + CommonAPI.follow(follower, user) + end + end) end) {:ok, message} -- cgit v1.2.3 From 840dc4b44ba3ea2613b1a8dc110a9008ffc618c3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 30 Mar 2021 11:10:34 -0500 Subject: Document :mrf_follow_bot --- docs/configuration/cheatsheet.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 8f2c4347e..6e52cd181 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -124,6 +124,7 @@ To add configuration to your config file, you can copy it from the base config. * `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)). * `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.Workers.PurgeExpiredActivity` to be enabled for processing the scheduled delections. * `Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy`: Makes all bot posts to disappear from public timelines. + * `Pleroma.Web.ActivityPub.MRF.FollowBotPolicy`: Automatically follows newly discovered users from the specified bot account. * `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo). * `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value. @@ -220,6 +221,11 @@ Notes: - The hashtags in the configuration do not have a leading `#`. - This MRF Policy is always enabled, if you want to disable it you have to set empty lists +#### :mrf_follow_bot + +* `follower_nickname`: The name of the bot account to use for following newly discovered users. + + ### :activitypub * `unfollow_blocked`: Whether blocks result in people getting unfollowed * `outgoing_blocks`: Whether to federate blocks to other instances -- cgit v1.2.3 From e78738173aefd512bbce33c12b4ee3372bdc904b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 8 Oct 2020 12:41:01 -0500 Subject: Enforce that the followbot must be marked as a bot. --- lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex index 52ac9aef7..d10b7b480 100644 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -8,14 +8,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do @impl true def filter(message) do with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), - %User{} = follower <- User.get_cached_by_nickname(follower_nickname), + %User{actor_type: "Service"} = follower <- + User.get_cached_by_nickname(follower_nickname), %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do try_follow(follower, message) else nil -> Logger.warn( - "#{__MODULE__} skipped because of missing :mrf_follow_bot, :follower_nickname configuration or the account - does not exist." + "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname + account does not exist, or the account is not correctly configured as a bot." ) {:ok, message} -- cgit v1.2.3 From 2557e805a3034f363f0dfaa38cb8b174d89e3d1b Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 8 Oct 2020 12:46:27 -0500 Subject: Support for configuration via AdminFE --- config/description.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config/description.exs b/config/description.exs index 41e5e4056..bb1f43305 100644 --- a/config/description.exs +++ b/config/description.exs @@ -2942,6 +2942,23 @@ } ] }, + %{ + group: :pleroma, + key: :mrf_follow_bot, + tab: :mrf, + related_policy: "Pleroma.Web.ActivityPub.MRF.FollowBotPolicy", + label: "MRF FollowBot Policy", + type: :group, + description: "Automatically follows newly discovered accounts.", + children: [ + %{ + key: :follower_nickname, + type: :string, + description: "The name of the bot account to use for following newly discovered users.", + suggestions: ["followbot"] + } + ] + }, %{ group: :pleroma, key: :modules, -- cgit v1.2.3 From 2689463c7e8e99f25964072360b4c6955b7fcea0 Mon Sep 17 00:00:00 2001 From: feld Date: Thu, 8 Oct 2020 19:48:09 +0000 Subject: Apply 1 suggestion(s) to 1 file(s) --- docs/configuration/cheatsheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index 6e52cd181..d30f4cbdd 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -223,7 +223,7 @@ Notes: #### :mrf_follow_bot -* `follower_nickname`: The name of the bot account to use for following newly discovered users. +* `follower_nickname`: The name of the bot account to use for following newly discovered users. Using `followbot` or similar is strongly suggested. ### :activitypub -- cgit v1.2.3 From 3949cfdc249bb508c1171851fa2ec076126003cc Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 09:47:25 -0600 Subject: Make the followbot only dispatch follow requests once per 30 day period --- .../web/activity_pub/mrf/follow_bot_policy.ex | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex index d10b7b480..044febe0c 100644 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -1,10 +1,14 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do @behaviour Pleroma.Web.ActivityPub.MRF + alias Pleroma.Activity.Queries alias Pleroma.Config + alias Pleroma.Repo alias Pleroma.User alias Pleroma.Web.CommonAPI require Logger + import Ecto.Query + @impl true def filter(message) do with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), @@ -36,12 +40,13 @@ defp try_follow(follower, message) do |> List.flatten() |> User.get_all_by_ap_id() |> Enum.each(fn user -> - Logger.info("Checking if #{user.nickname} can be followed") + since_thirty_days_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(86_400 * 30)) with false <- User.following?(follower, user), - false <- user.locked, - false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do - Logger.info("Following #{user.nickname}") + false <- User.locked?(user), + false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot"), + false <- outstanding_follow_request_since?(follower, user, since_thirty_days_ago) do + Logger.info("#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}") CommonAPI.follow(follower, user) end end) @@ -50,6 +55,20 @@ defp try_follow(follower, message) do {:ok, message} end + defp outstanding_follow_request_since?( + %User{ap_id: follower_id}, + %User{ap_id: followee_id}, + since_datetime + ) do + followee_id + |> Queries.by_object_id() + |> Queries.by_type("Follow") + |> where([a], a.inserted_at > ^since_datetime) + |> where([a], fragment("? ->> 'state' = 'pending'", a.data)) + |> where([a], a.actor == ^follower_id) + |> Repo.exists?() + end + @impl true def describe do {:ok, %{}} -- cgit v1.2.3 From 3989ec508c00a66d9093ead06deb8b1272b0b985 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 09:59:30 -0600 Subject: Prevent duplicates from being processed --- lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex index 044febe0c..2fd5d5612 100644 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -38,6 +38,7 @@ defp try_follow(follower, message) do Enum.concat([to, cc, actor]) |> List.flatten() + |> Enum.uniq() |> User.get_all_by_ap_id() |> Enum.each(fn user -> since_thirty_days_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(86_400 * 30)) -- cgit v1.2.3 From a176914c73456eea7926235eb48e342ac1ab112d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 14:42:20 -0600 Subject: Better checking of previous follow request attempts --- lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex index 2fd5d5612..c7aaa6386 100644 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -65,7 +65,7 @@ defp outstanding_follow_request_since?( |> Queries.by_object_id() |> Queries.by_type("Follow") |> where([a], a.inserted_at > ^since_datetime) - |> where([a], fragment("? ->> 'state' = 'pending'", a.data)) + |> where([a], fragment("? ->> 'state' != 'accept'", a.data)) |> where([a], a.actor == ^follower_id) |> Repo.exists?() end -- cgit v1.2.3 From f0dcc1ca692fb5d6a5aca4f8a9ccb255baef9c1d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 14:55:05 -0600 Subject: Lint --- lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex index c7aaa6386..441ce553e 100644 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -47,7 +47,10 @@ defp try_follow(follower, message) do false <- User.locked?(user), false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot"), false <- outstanding_follow_request_since?(follower, user, since_thirty_days_ago) do - Logger.info("#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}") + Logger.info( + "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" + ) + CommonAPI.follow(follower, user) end end) -- cgit v1.2.3 From 1926d0804ba6ade106a509c027af6bf56e6a8791 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 15:16:55 -0600 Subject: Add follow_requests_outstanding_since?/3 to Pleroma.Activity --- lib/pleroma/activity.ex | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index d59403884..b0f1a900d 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -345,6 +345,20 @@ def following_requests_for_actor(%User{ap_id: ap_id}) do |> Repo.all() end + def follow_requests_outstanding_since?( + %User{ap_id: follower_id}, + %User{ap_id: followee_id}, + since_datetime + ) do + followee_id + |> Queries.by_object_id() + |> Queries.by_type("Follow") + |> where([a], a.inserted_at > ^since_datetime) + |> where([a], fragment("? ->> 'state' != 'accept'", a.data)) + |> where([a], a.actor == ^follower_id) + |> Repo.exists?() + end + def restrict_deactivated_users(query) do deactivated_users = from(u in User.Query.build(%{deactivated: true}), select: u.ap_id) -- cgit v1.2.3 From 86182ef8e445ee8a89ce2e49f33cab3dac2d2b12 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 15:17:33 -0600 Subject: Change module name to FollowbotPolicy --- .../web/activity_pub/mrf/follow_bot_policy.ex | 80 ---------------------- .../web/activity_pub/mrf/followbot_policy.ex | 65 ++++++++++++++++++ 2 files changed, 65 insertions(+), 80 deletions(-) delete mode 100644 lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex create mode 100644 lib/pleroma/web/activity_pub/mrf/followbot_policy.ex diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex deleted file mode 100644 index 441ce553e..000000000 --- a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex +++ /dev/null @@ -1,80 +0,0 @@ -defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do - @behaviour Pleroma.Web.ActivityPub.MRF - alias Pleroma.Activity.Queries - alias Pleroma.Config - alias Pleroma.Repo - alias Pleroma.User - alias Pleroma.Web.CommonAPI - require Logger - - import Ecto.Query - - @impl true - def filter(message) do - with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), - %User{actor_type: "Service"} = follower <- - User.get_cached_by_nickname(follower_nickname), - %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do - try_follow(follower, message) - else - nil -> - Logger.warn( - "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname - account does not exist, or the account is not correctly configured as a bot." - ) - - {:ok, message} - - _ -> - {:ok, message} - end - end - - defp try_follow(follower, message) do - Task.start(fn -> - to = Map.get(message, "to", []) - cc = Map.get(message, "cc", []) - actor = [message["actor"]] - - Enum.concat([to, cc, actor]) - |> List.flatten() - |> Enum.uniq() - |> User.get_all_by_ap_id() - |> Enum.each(fn user -> - since_thirty_days_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(86_400 * 30)) - - with false <- User.following?(follower, user), - false <- User.locked?(user), - false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot"), - false <- outstanding_follow_request_since?(follower, user, since_thirty_days_ago) do - Logger.info( - "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" - ) - - CommonAPI.follow(follower, user) - end - end) - end) - - {:ok, message} - end - - defp outstanding_follow_request_since?( - %User{ap_id: follower_id}, - %User{ap_id: followee_id}, - since_datetime - ) do - followee_id - |> Queries.by_object_id() - |> Queries.by_type("Follow") - |> where([a], a.inserted_at > ^since_datetime) - |> where([a], fragment("? ->> 'state' != 'accept'", a.data)) - |> where([a], a.actor == ^follower_id) - |> Repo.exists?() - end - - @impl true - def describe do - {:ok, %{}} - end -end diff --git a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex new file mode 100644 index 000000000..838d39c88 --- /dev/null +++ b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex @@ -0,0 +1,65 @@ +defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicy do + @behaviour Pleroma.Web.ActivityPub.MRF + alias Pleroma.Activity + alias Pleroma.Config + alias Pleroma.User + alias Pleroma.Web.CommonAPI + + require Logger + + @impl true + def filter(message) do + with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), + %User{actor_type: "Service"} = follower <- + User.get_cached_by_nickname(follower_nickname), + %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do + try_follow(follower, message) + else + nil -> + Logger.warn( + "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname + account does not exist, or the account is not correctly configured as a bot." + ) + + {:ok, message} + + _ -> + {:ok, message} + end + end + + defp try_follow(follower, message) do + Task.start(fn -> + to = Map.get(message, "to", []) + cc = Map.get(message, "cc", []) + actor = [message["actor"]] + + Enum.concat([to, cc, actor]) + |> List.flatten() + |> Enum.uniq() + |> User.get_all_by_ap_id() + |> Enum.each(fn user -> + since_thirty_days_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(86_400 * 30)) + + with false <- User.following?(follower, user), + false <- User.locked?(user), + false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot"), + false <- + Activity.follow_requests_outstanding_since?(follower, user, since_thirty_days_ago) do + Logger.info( + "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" + ) + + CommonAPI.follow(follower, user) + end + end) + end) + + {:ok, message} + end + + @impl true + def describe do + {:ok, %{}} + end +end -- cgit v1.2.3 From 778010ef8e1f4509bd554e65556336e5e8457ef6 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 15:25:26 -0600 Subject: Do not try to follow local users. Their posts are already available locally on the instance. --- lib/pleroma/web/activity_pub/mrf/followbot_policy.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex index 838d39c88..5c8834536 100644 --- a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex @@ -41,7 +41,8 @@ defp try_follow(follower, message) do |> Enum.each(fn user -> since_thirty_days_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(86_400 * 30)) - with false <- User.following?(follower, user), + with false <- user.local, + false <- User.following?(follower, user), false <- User.locked?(user), false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot"), false <- -- cgit v1.2.3 From c252ac71d4ea4f3b08bd3524f32ee3fe9308be06 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 18:34:52 -0600 Subject: Revert --- lib/pleroma/activity.ex | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/pleroma/activity.ex b/lib/pleroma/activity.ex index b0f1a900d..d59403884 100644 --- a/lib/pleroma/activity.ex +++ b/lib/pleroma/activity.ex @@ -345,20 +345,6 @@ def following_requests_for_actor(%User{ap_id: ap_id}) do |> Repo.all() end - def follow_requests_outstanding_since?( - %User{ap_id: follower_id}, - %User{ap_id: followee_id}, - since_datetime - ) do - followee_id - |> Queries.by_object_id() - |> Queries.by_type("Follow") - |> where([a], a.inserted_at > ^since_datetime) - |> where([a], fragment("? ->> 'state' != 'accept'", a.data)) - |> where([a], a.actor == ^follower_id) - |> Repo.exists?() - end - def restrict_deactivated_users(query) do deactivated_users = from(u in User.Query.build(%{deactivated: true}), select: u.ap_id) -- cgit v1.2.3 From f73d1667854fc4c6c721bf49a7deeefde1f569e3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 18:36:21 -0600 Subject: Only need to validate a follow request is generated for now --- .../web/activity_pub/mrf/followbot_policy_test.exs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs diff --git a/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs new file mode 100644 index 000000000..283e9b12c --- /dev/null +++ b/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs @@ -0,0 +1,42 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicyTest do + use Pleroma.DataCase, async: true + + alias Pleroma.User + alias Pleroma.Web.ActivityPub.MRF.FollowbotPolicy + + import Pleroma.Factory + + describe "FollowBotPolicy" do + test "follows remote users" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, local: false) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "Test post", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 1 + end + end +end -- cgit v1.2.3 From 4796df0bc39a57b2581168cb8d8fde7779068f2d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 19 Feb 2021 18:36:35 -0600 Subject: Remove Task.async as it is broken here and probably a premature optimization anyway --- .../web/activity_pub/mrf/followbot_policy.ex | 43 +++++++++------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex index 5c8834536..ca99e429c 100644 --- a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex +++ b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex @@ -1,6 +1,5 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicy do @behaviour Pleroma.Web.ActivityPub.MRF - alias Pleroma.Activity alias Pleroma.Config alias Pleroma.User alias Pleroma.Web.CommonAPI @@ -29,31 +28,25 @@ def filter(message) do end defp try_follow(follower, message) do - Task.start(fn -> - to = Map.get(message, "to", []) - cc = Map.get(message, "cc", []) - actor = [message["actor"]] - - Enum.concat([to, cc, actor]) - |> List.flatten() - |> Enum.uniq() - |> User.get_all_by_ap_id() - |> Enum.each(fn user -> - since_thirty_days_ago = NaiveDateTime.utc_now() |> NaiveDateTime.add(-(86_400 * 30)) - - with false <- user.local, - false <- User.following?(follower, user), - false <- User.locked?(user), - false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot"), - false <- - Activity.follow_requests_outstanding_since?(follower, user, since_thirty_days_ago) do - Logger.info( - "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" - ) + to = Map.get(message, "to", []) + cc = Map.get(message, "cc", []) + actor = [message["actor"]] + + Enum.concat([to, cc, actor]) + |> List.flatten() + |> Enum.uniq() + |> User.get_all_by_ap_id() + |> Enum.each(fn user -> + with false <- user.local, + false <- User.following?(follower, user), + false <- User.locked?(user), + false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do + Logger.debug( + "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" + ) - CommonAPI.follow(follower, user) - end - end) + CommonAPI.follow(follower, user) + end end) {:ok, message} -- cgit v1.2.3 From fef4f3772cf035cefb939bdfaaa4b12d6444b553 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 11:52:03 -0600 Subject: More tests to validate Followbot is behaving --- .../web/activity_pub/mrf/followbot_policy_test.exs | 84 ++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs index 283e9b12c..4c39e04e8 100644 --- a/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs @@ -38,5 +38,89 @@ test "follows remote users" do assert User.get_follow_requests(remote_user) |> length == 1 end + + test "does not follow users with #nobot in bio" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, %{local: false, bio: "go away bots! #nobot"}) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "I don't like follow bots", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 0 + end + + test "does not follow local users" do + bot = insert(:user, actor_type: "Service") + local_user = insert(:user, local: true) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [local_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "Hi I'm a local user", + "type" => "Note", + "attributedTo" => local_user.ap_id, + "inReplyTo" => nil + }, + "actor" => local_user.ap_id + } + + refute User.following?(bot, local_user) + + assert User.get_follow_requests(local_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(local_user) |> length == 0 + end + + test "does not follow users requiring follower approval" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, %{local: false, is_locked: true}) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "I don't like randos following me", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 0 + end end end -- cgit v1.2.3 From 7eab98d5c856097c0cfe09a02adfd4c05fb5d240 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 11:58:09 -0600 Subject: Document new FollowBot MRF --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb26c7a73..43f2bb638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) +- MRF (`FollowBotPolicy`): New MRF Policy which makes a designated local Bot account attempt to follow all users in public Notes received by your instance. Users who require approving follower requests or have #nobot in their profile are excluded.
API Changes -- cgit v1.2.3 From 03f38ac4ebd97e792b0ff2a6ac804adefed85a41 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 11:59:11 -0600 Subject: Prefer FollowBot naming convention vs Followbot --- .../web/activity_pub/mrf/follow_bot_policy.ex | 59 ++++++++++ .../web/activity_pub/mrf/followbot_policy.ex | 59 ---------- .../activity_pub/mrf/follow_bot_policy_test.exs | 126 +++++++++++++++++++++ .../activity_pub/mrf/follow_bot_policy_test.exs~ | 126 +++++++++++++++++++++ .../web/activity_pub/mrf/followbot_policy_test.exs | 126 --------------------- 5 files changed, 311 insertions(+), 185 deletions(-) create mode 100644 lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex delete mode 100644 lib/pleroma/web/activity_pub/mrf/followbot_policy.ex create mode 100644 test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs create mode 100644 test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ delete mode 100644 test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs diff --git a/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex new file mode 100644 index 000000000..7307c9c14 --- /dev/null +++ b/lib/pleroma/web/activity_pub/mrf/follow_bot_policy.ex @@ -0,0 +1,59 @@ +defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do + @behaviour Pleroma.Web.ActivityPub.MRF + alias Pleroma.Config + alias Pleroma.User + alias Pleroma.Web.CommonAPI + + require Logger + + @impl true + def filter(message) do + with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), + %User{actor_type: "Service"} = follower <- + User.get_cached_by_nickname(follower_nickname), + %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do + try_follow(follower, message) + else + nil -> + Logger.warn( + "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname + account does not exist, or the account is not correctly configured as a bot." + ) + + {:ok, message} + + _ -> + {:ok, message} + end + end + + defp try_follow(follower, message) do + to = Map.get(message, "to", []) + cc = Map.get(message, "cc", []) + actor = [message["actor"]] + + Enum.concat([to, cc, actor]) + |> List.flatten() + |> Enum.uniq() + |> User.get_all_by_ap_id() + |> Enum.each(fn user -> + with false <- user.local, + false <- User.following?(follower, user), + false <- User.locked?(user), + false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do + Logger.debug( + "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" + ) + + CommonAPI.follow(follower, user) + end + end) + + {:ok, message} + end + + @impl true + def describe do + {:ok, %{}} + end +end diff --git a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex b/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex deleted file mode 100644 index ca99e429c..000000000 --- a/lib/pleroma/web/activity_pub/mrf/followbot_policy.ex +++ /dev/null @@ -1,59 +0,0 @@ -defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicy do - @behaviour Pleroma.Web.ActivityPub.MRF - alias Pleroma.Config - alias Pleroma.User - alias Pleroma.Web.CommonAPI - - require Logger - - @impl true - def filter(message) do - with follower_nickname <- Config.get([:mrf_follow_bot, :follower_nickname]), - %User{actor_type: "Service"} = follower <- - User.get_cached_by_nickname(follower_nickname), - %{"type" => "Create", "object" => %{"type" => "Note"}} <- message do - try_follow(follower, message) - else - nil -> - Logger.warn( - "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname - account does not exist, or the account is not correctly configured as a bot." - ) - - {:ok, message} - - _ -> - {:ok, message} - end - end - - defp try_follow(follower, message) do - to = Map.get(message, "to", []) - cc = Map.get(message, "cc", []) - actor = [message["actor"]] - - Enum.concat([to, cc, actor]) - |> List.flatten() - |> Enum.uniq() - |> User.get_all_by_ap_id() - |> Enum.each(fn user -> - with false <- user.local, - false <- User.following?(follower, user), - false <- User.locked?(user), - false <- (user.bio || "") |> String.downcase() |> String.contains?("nobot") do - Logger.debug( - "#{__MODULE__}: Follow request from #{follower.nickname} to #{user.nickname}" - ) - - CommonAPI.follow(follower, user) - end - end) - - {:ok, message} - end - - @impl true - def describe do - {:ok, %{}} - end -end diff --git a/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs new file mode 100644 index 000000000..3f63f11ef --- /dev/null +++ b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs @@ -0,0 +1,126 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicyTest do + use Pleroma.DataCase, async: true + + alias Pleroma.User + alias Pleroma.Web.ActivityPub.MRF.FollowBotPolicy + + import Pleroma.Factory + + describe "FollowBotPolicy" do + test "follows remote users" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, local: false) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "Test post", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 1 + end + + test "does not follow users with #nobot in bio" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, %{local: false, bio: "go away bots! #nobot"}) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "I don't like follow bots", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 0 + end + + test "does not follow local users" do + bot = insert(:user, actor_type: "Service") + local_user = insert(:user, local: true) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [local_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "Hi I'm a local user", + "type" => "Note", + "attributedTo" => local_user.ap_id, + "inReplyTo" => nil + }, + "actor" => local_user.ap_id + } + + refute User.following?(bot, local_user) + + assert User.get_follow_requests(local_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(local_user) |> length == 0 + end + + test "does not follow users requiring follower approval" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, %{local: false, is_locked: true}) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "I don't like randos following me", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 0 + end + end +end diff --git a/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ new file mode 100644 index 000000000..4c39e04e8 --- /dev/null +++ b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ @@ -0,0 +1,126 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicyTest do + use Pleroma.DataCase, async: true + + alias Pleroma.User + alias Pleroma.Web.ActivityPub.MRF.FollowbotPolicy + + import Pleroma.Factory + + describe "FollowBotPolicy" do + test "follows remote users" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, local: false) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "Test post", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 1 + end + + test "does not follow users with #nobot in bio" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, %{local: false, bio: "go away bots! #nobot"}) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "I don't like follow bots", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 0 + end + + test "does not follow local users" do + bot = insert(:user, actor_type: "Service") + local_user = insert(:user, local: true) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [local_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "Hi I'm a local user", + "type" => "Note", + "attributedTo" => local_user.ap_id, + "inReplyTo" => nil + }, + "actor" => local_user.ap_id + } + + refute User.following?(bot, local_user) + + assert User.get_follow_requests(local_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(local_user) |> length == 0 + end + + test "does not follow users requiring follower approval" do + bot = insert(:user, actor_type: "Service") + remote_user = insert(:user, %{local: false, is_locked: true}) + clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) + + message = %{ + "@context" => "https://www.w3.org/ns/activitystreams", + "to" => [remote_user.follower_address], + "cc" => ["https://www.w3.org/ns/activitystreams#Public"], + "type" => "Create", + "object" => %{ + "content" => "I don't like randos following me", + "type" => "Note", + "attributedTo" => remote_user.ap_id, + "inReplyTo" => nil + }, + "actor" => remote_user.ap_id + } + + refute User.following?(bot, remote_user) + + assert User.get_follow_requests(remote_user) |> length == 0 + + FollowbotPolicy.filter(message) + + assert User.get_follow_requests(remote_user) |> length == 0 + end + end +end diff --git a/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs deleted file mode 100644 index 4c39e04e8..000000000 --- a/test/pleroma/web/activity_pub/mrf/followbot_policy_test.exs +++ /dev/null @@ -1,126 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicyTest do - use Pleroma.DataCase, async: true - - alias Pleroma.User - alias Pleroma.Web.ActivityPub.MRF.FollowbotPolicy - - import Pleroma.Factory - - describe "FollowBotPolicy" do - test "follows remote users" do - bot = insert(:user, actor_type: "Service") - remote_user = insert(:user, local: false) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [remote_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "Test post", - "type" => "Note", - "attributedTo" => remote_user.ap_id, - "inReplyTo" => nil - }, - "actor" => remote_user.ap_id - } - - refute User.following?(bot, remote_user) - - assert User.get_follow_requests(remote_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(remote_user) |> length == 1 - end - - test "does not follow users with #nobot in bio" do - bot = insert(:user, actor_type: "Service") - remote_user = insert(:user, %{local: false, bio: "go away bots! #nobot"}) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [remote_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "I don't like follow bots", - "type" => "Note", - "attributedTo" => remote_user.ap_id, - "inReplyTo" => nil - }, - "actor" => remote_user.ap_id - } - - refute User.following?(bot, remote_user) - - assert User.get_follow_requests(remote_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(remote_user) |> length == 0 - end - - test "does not follow local users" do - bot = insert(:user, actor_type: "Service") - local_user = insert(:user, local: true) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [local_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "Hi I'm a local user", - "type" => "Note", - "attributedTo" => local_user.ap_id, - "inReplyTo" => nil - }, - "actor" => local_user.ap_id - } - - refute User.following?(bot, local_user) - - assert User.get_follow_requests(local_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(local_user) |> length == 0 - end - - test "does not follow users requiring follower approval" do - bot = insert(:user, actor_type: "Service") - remote_user = insert(:user, %{local: false, is_locked: true}) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [remote_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "I don't like randos following me", - "type" => "Note", - "attributedTo" => remote_user.ap_id, - "inReplyTo" => nil - }, - "actor" => remote_user.ap_id - } - - refute User.following?(bot, remote_user) - - assert User.get_follow_requests(remote_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(remote_user) |> length == 0 - end - end -end -- cgit v1.2.3 From d29f6d6b6ef896d0fa47b4f5136fc6714e3425f3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 12:02:33 -0600 Subject: Add more details to the cheatsheat for FollowBot MRF --- docs/configuration/cheatsheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/configuration/cheatsheet.md b/docs/configuration/cheatsheet.md index d30f4cbdd..069421722 100644 --- a/docs/configuration/cheatsheet.md +++ b/docs/configuration/cheatsheet.md @@ -124,7 +124,7 @@ To add configuration to your config file, you can copy it from the base config. * `Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy`: Rejects or delists posts based on their age when received. (See [`:mrf_object_age`](#mrf_object_age)). * `Pleroma.Web.ActivityPub.MRF.ActivityExpirationPolicy`: Sets a default expiration on all posts made by users of the local instance. Requires `Pleroma.Workers.PurgeExpiredActivity` to be enabled for processing the scheduled delections. * `Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy`: Makes all bot posts to disappear from public timelines. - * `Pleroma.Web.ActivityPub.MRF.FollowBotPolicy`: Automatically follows newly discovered users from the specified bot account. + * `Pleroma.Web.ActivityPub.MRF.FollowBotPolicy`: Automatically follows newly discovered users from the specified bot account. Local accounts, locked accounts, and users with "#nobot" in their bio are respected and excluded from being followed. * `transparency`: Make the content of your Message Rewrite Facility settings public (via nodeinfo). * `transparency_exclusions`: Exclude specific instance names from MRF transparency. The use of the exclusions feature will be disclosed in nodeinfo as a boolean value. -- cgit v1.2.3 From bfcdcd4f6937bfc0b123a6ec0bbf1d3e6968f0fb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 24 Feb 2021 12:07:40 -0600 Subject: Temp file leaked, oops --- .../activity_pub/mrf/follow_bot_policy_test.exs~ | 126 --------------------- 1 file changed, 126 deletions(-) delete mode 100644 test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ diff --git a/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ deleted file mode 100644 index 4c39e04e8..000000000 --- a/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs~ +++ /dev/null @@ -1,126 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors -# SPDX-License-Identifier: AGPL-3.0-only - -defmodule Pleroma.Web.ActivityPub.MRF.FollowbotPolicyTest do - use Pleroma.DataCase, async: true - - alias Pleroma.User - alias Pleroma.Web.ActivityPub.MRF.FollowbotPolicy - - import Pleroma.Factory - - describe "FollowBotPolicy" do - test "follows remote users" do - bot = insert(:user, actor_type: "Service") - remote_user = insert(:user, local: false) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [remote_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "Test post", - "type" => "Note", - "attributedTo" => remote_user.ap_id, - "inReplyTo" => nil - }, - "actor" => remote_user.ap_id - } - - refute User.following?(bot, remote_user) - - assert User.get_follow_requests(remote_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(remote_user) |> length == 1 - end - - test "does not follow users with #nobot in bio" do - bot = insert(:user, actor_type: "Service") - remote_user = insert(:user, %{local: false, bio: "go away bots! #nobot"}) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [remote_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "I don't like follow bots", - "type" => "Note", - "attributedTo" => remote_user.ap_id, - "inReplyTo" => nil - }, - "actor" => remote_user.ap_id - } - - refute User.following?(bot, remote_user) - - assert User.get_follow_requests(remote_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(remote_user) |> length == 0 - end - - test "does not follow local users" do - bot = insert(:user, actor_type: "Service") - local_user = insert(:user, local: true) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [local_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "Hi I'm a local user", - "type" => "Note", - "attributedTo" => local_user.ap_id, - "inReplyTo" => nil - }, - "actor" => local_user.ap_id - } - - refute User.following?(bot, local_user) - - assert User.get_follow_requests(local_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(local_user) |> length == 0 - end - - test "does not follow users requiring follower approval" do - bot = insert(:user, actor_type: "Service") - remote_user = insert(:user, %{local: false, is_locked: true}) - clear_config([:mrf_follow_bot, :follower_nickname], bot.nickname) - - message = %{ - "@context" => "https://www.w3.org/ns/activitystreams", - "to" => [remote_user.follower_address], - "cc" => ["https://www.w3.org/ns/activitystreams#Public"], - "type" => "Create", - "object" => %{ - "content" => "I don't like randos following me", - "type" => "Note", - "attributedTo" => remote_user.ap_id, - "inReplyTo" => nil - }, - "actor" => remote_user.ap_id - } - - refute User.following?(bot, remote_user) - - assert User.get_follow_requests(remote_user) |> length == 0 - - FollowbotPolicy.filter(message) - - assert User.get_follow_requests(remote_user) |> length == 0 - end - end -end -- cgit v1.2.3 From 16a7ffb1ea9dc8e2c7a70d9243424b40d594bd63 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 26 Feb 2021 11:04:27 -0600 Subject: Fix function calls due to module name change --- test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs index 3f63f11ef..a61562558 100644 --- a/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs +++ b/test/pleroma/web/activity_pub/mrf/follow_bot_policy_test.exs @@ -34,7 +34,7 @@ test "follows remote users" do assert User.get_follow_requests(remote_user) |> length == 0 - FollowbotPolicy.filter(message) + FollowBotPolicy.filter(message) assert User.get_follow_requests(remote_user) |> length == 1 end @@ -62,7 +62,7 @@ test "does not follow users with #nobot in bio" do assert User.get_follow_requests(remote_user) |> length == 0 - FollowbotPolicy.filter(message) + FollowBotPolicy.filter(message) assert User.get_follow_requests(remote_user) |> length == 0 end @@ -90,7 +90,7 @@ test "does not follow local users" do assert User.get_follow_requests(local_user) |> length == 0 - FollowbotPolicy.filter(message) + FollowBotPolicy.filter(message) assert User.get_follow_requests(local_user) |> length == 0 end @@ -118,7 +118,7 @@ test "does not follow users requiring follower approval" do assert User.get_follow_requests(remote_user) |> length == 0 - FollowbotPolicy.filter(message) + FollowBotPolicy.filter(message) assert User.get_follow_requests(remote_user) |> length == 0 end -- cgit v1.2.3 From 863010ea637d6670076dba3f6da54daa144cce67 Mon Sep 17 00:00:00 2001 From: Miss Pasture Date: Wed, 31 Mar 2021 06:51:22 +0000 Subject: date-times are always strings --- lib/pleroma/web/api_spec/operations/account_operation.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 54e5ebc76..08d68893a 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -482,7 +482,7 @@ defp create_response do access_token: %Schema{type: :string}, refresh_token: %Schema{type: :string}, scope: %Schema{type: :string}, - created_at: %Schema{type: :integer, format: :"date-time"}, + created_at: %Schema{type: :string, format: :"date-time"}, me: %Schema{type: :string}, expires_in: %Schema{type: :integer}, # -- cgit v1.2.3 From af1cd28f9b8005dff563c0df7f80db47df4e8488 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 1 Apr 2021 11:50:45 +0200 Subject: object_validator: Refactor most of validate/2 to a generic block --- lib/pleroma/web/activity_pub/object_validator.ex | 135 ++++------------------- 1 file changed, 22 insertions(+), 113 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 297c19cc0..f75744203 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -37,37 +37,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do @impl true def validate(object, meta) - def validate(%{"type" => type} = object, meta) - when type in ~w[Accept Reject] do - with {:ok, object} <- - object - |> AcceptRejectValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "Event"} = object, meta) do - with {:ok, object} <- - object - |> EventValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "Follow"} = object, meta) do - with {:ok, object} <- - object - |> FollowValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - def validate(%{"type" => "Block"} = block_activity, meta) do with {:ok, block_activity} <- block_activity @@ -87,16 +56,6 @@ def validate(%{"type" => "Block"} = block_activity, meta) do end end - def validate(%{"type" => "Update"} = update_activity, meta) do - with {:ok, update_activity} <- - update_activity - |> UpdateValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - update_activity = stringify_keys(update_activity) - {:ok, update_activity, meta} - end - end - def validate(%{"type" => "Undo"} = object, meta) do with {:ok, object} <- object @@ -123,76 +82,6 @@ def validate(%{"type" => "Delete"} = object, meta) do end end - def validate(%{"type" => "Like"} = object, meta) do - with {:ok, object} <- - object - |> LikeValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "ChatMessage"} = object, meta) do - with {:ok, object} <- - object - |> ChatMessageValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "Question"} = object, meta) do - with {:ok, object} <- - object - |> QuestionValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => type} = object, meta) when type in ~w[Audio Video] do - with {:ok, object} <- - object - |> AudioVideoValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "Article"} = object, meta) do - with {:ok, object} <- - object - |> ArticleNoteValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "Answer"} = object, meta) do - with {:ok, object} <- - object - |> AnswerValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - - def validate(%{"type" => "EmojiReact"} = object, meta) do - with {:ok, object} <- - object - |> EmojiReactValidator.cast_and_validate() - |> Ecto.Changeset.apply_action(:insert) do - object = stringify_keys(object) - {:ok, object, meta} - end - end - def validate( %{"type" => "Create", "object" => %{"type" => "ChatMessage"} = object} = create_activity, meta @@ -224,10 +113,30 @@ def validate( end end - def validate(%{"type" => "Announce"} = object, meta) do + def validate(%{"type" => type} = object, meta) + when type in ~w[Accept Reject Follow Update Like EmojiReact Announce + Event ChatMessage Question Audio Video Article Answer] do + validator = + case type do + "Accept" -> AcceptRejectValidator + "Reject" -> AcceptRejectValidator + "Follow" -> FollowValidator + "Update" -> UpdateValidator + "Like" -> LikeValidator + "EmojiReact" -> EmojiReactValidator + "Announce" -> AnnounceValidator + "Event" -> EventValidator + "ChatMessage" -> ChatMessageValidator + "Question" -> QuestionValidator + "Audio" -> AudioVideoValidator + "Video" -> AudioVideoValidator + "Article" -> ArticleNoteValidator + "Answer" -> AnswerValidator + end + with {:ok, object} <- object - |> AnnounceValidator.cast_and_validate() + |> validator.cast_and_validate() |> Ecto.Changeset.apply_action(:insert) do object = stringify_keys(object) {:ok, object, meta} -- cgit v1.2.3 From 1e3db075861198417bca36f4f2b0f29c2367c77e Mon Sep 17 00:00:00 2001 From: Haelwenn Date: Thu, 1 Apr 2021 12:00:58 +0000 Subject: Revert "Merge branch 'patch-fix-open-api-spec' into 'develop'" This reverts merge request !3382 --- lib/pleroma/web/api_spec/operations/account_operation.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/api_spec/operations/account_operation.ex b/lib/pleroma/web/api_spec/operations/account_operation.ex index 08d68893a..54e5ebc76 100644 --- a/lib/pleroma/web/api_spec/operations/account_operation.ex +++ b/lib/pleroma/web/api_spec/operations/account_operation.ex @@ -482,7 +482,7 @@ defp create_response do access_token: %Schema{type: :string}, refresh_token: %Schema{type: :string}, scope: %Schema{type: :string}, - created_at: %Schema{type: :string, format: :"date-time"}, + created_at: %Schema{type: :integer, format: :"date-time"}, me: %Schema{type: :string}, expires_in: %Schema{type: :integer}, # -- cgit v1.2.3 From 9015df22291ab60c0efad328557936fd14eab2e6 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 7 Jan 2021 18:23:01 +0100 Subject: TagValidator: New --- .../object_validators/article_note_validator.ex | 7 +- .../object_validators/attachment_validator.ex | 1 - .../object_validators/audio_video_validator.ex | 7 +- .../object_validators/event_validator.ex | 7 +- .../object_validators/question_validator.ex | 7 +- .../object_validators/tag_validator.ex | 77 ++++++++++++++++++++++ 6 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 lib/pleroma/web/activity_pub/object_validators/tag_validator.ex diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex index b0388ef3b..5910f4060 100644 --- a/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex @@ -9,6 +9,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations + alias Pleroma.Web.ActivityPub.ObjectValidators.TagValidator alias Pleroma.Web.ActivityPub.Transmogrifier import Ecto.Changeset @@ -22,8 +23,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidator do field(:cc, ObjectValidators.Recipients, default: []) field(:bto, ObjectValidators.Recipients, default: []) field(:bcc, ObjectValidators.Recipients, default: []) - # TODO: Write type - field(:tag, {:array, :map}, default: []) + embeds_many(:tag, TagValidator) field(:type, :string) field(:name, :string) @@ -90,8 +90,9 @@ def changeset(struct, data) do data = fix(data) struct - |> cast(data, __schema__(:fields) -- [:attachment]) + |> cast(data, __schema__(:fields) -- [:attachment, :tag]) |> cast_embed(:attachment) + |> cast_embed(:tag) end def validate_data(data_cng) do diff --git a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex index 3175427ad..e7b3a3922 100644 --- a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex @@ -6,7 +6,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator do use Ecto.Schema alias Pleroma.EctoType.ActivityPub.ObjectValidators - alias Pleroma.Web.ActivityPub.ObjectValidators.UrlObjectValidator import Ecto.Changeset diff --git a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex index 4a96fef52..a04c95f4b 100644 --- a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations + alias Pleroma.Web.ActivityPub.ObjectValidators.TagValidator alias Pleroma.Web.ActivityPub.Transmogrifier import Ecto.Changeset @@ -23,8 +24,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.AudioVideoValidator do field(:cc, ObjectValidators.Recipients, default: []) field(:bto, ObjectValidators.Recipients, default: []) field(:bcc, ObjectValidators.Recipients, default: []) - # TODO: Write type - field(:tag, {:array, :map}, default: []) + embeds_many(:tag, TagValidator) field(:type, :string) field(:name, :string) @@ -132,8 +132,9 @@ def changeset(struct, data) do data = fix(data) struct - |> cast(data, __schema__(:fields) -- [:attachment]) + |> cast(data, __schema__(:fields) -- [:attachment, :tag]) |> cast_embed(:attachment) + |> cast_embed(:tag) end def validate_data(data_cng) do diff --git a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex index 2e26726f8..0112a074d 100644 --- a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex @@ -9,6 +9,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EventValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations + alias Pleroma.Web.ActivityPub.ObjectValidators.TagValidator alias Pleroma.Web.ActivityPub.Transmogrifier import Ecto.Changeset @@ -23,8 +24,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.EventValidator do field(:cc, ObjectValidators.Recipients, default: []) field(:bto, ObjectValidators.Recipients, default: []) field(:bcc, ObjectValidators.Recipients, default: []) - # TODO: Write type - field(:tag, {:array, :map}, default: []) + embeds_many(:tag, TagValidator) field(:type, :string) field(:name, :string) @@ -81,8 +81,9 @@ def changeset(struct, data) do data = fix(data) struct - |> cast(data, __schema__(:fields) -- [:attachment]) + |> cast(data, __schema__(:fields) -- [:attachment, :tag]) |> cast_embed(:attachment) + |> cast_embed(:tag) end def validate_data(data_cng) do diff --git a/lib/pleroma/web/activity_pub/object_validators/question_validator.ex b/lib/pleroma/web/activity_pub/object_validators/question_validator.ex index 6b746c997..7acb1e928 100644 --- a/lib/pleroma/web/activity_pub/object_validators/question_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/question_validator.ex @@ -10,6 +10,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do alias Pleroma.Web.ActivityPub.ObjectValidators.CommonFixes alias Pleroma.Web.ActivityPub.ObjectValidators.CommonValidations alias Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsValidator + alias Pleroma.Web.ActivityPub.ObjectValidators.TagValidator alias Pleroma.Web.ActivityPub.Transmogrifier import Ecto.Changeset @@ -24,8 +25,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionValidator do field(:cc, ObjectValidators.Recipients, default: []) field(:bto, ObjectValidators.Recipients, default: []) field(:bcc, ObjectValidators.Recipients, default: []) - # TODO: Write type - field(:tag, {:array, :map}, default: []) + embeds_many(:tag, TagValidator) field(:type, :string) field(:content, :string) field(:context, :string) @@ -93,10 +93,11 @@ def changeset(struct, data) do data = fix(data) struct - |> cast(data, __schema__(:fields) -- [:anyOf, :oneOf, :attachment]) + |> cast(data, __schema__(:fields) -- [:anyOf, :oneOf, :attachment, :tag]) |> cast_embed(:attachment) |> cast_embed(:anyOf) |> cast_embed(:oneOf) + |> cast_embed(:tag) end def validate_data(data_cng) do diff --git a/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex b/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex new file mode 100644 index 000000000..751021585 --- /dev/null +++ b/lib/pleroma/web/activity_pub/object_validators/tag_validator.ex @@ -0,0 +1,77 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2021 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.ActivityPub.ObjectValidators.TagValidator do + use Ecto.Schema + + alias Pleroma.EctoType.ActivityPub.ObjectValidators + + import Ecto.Changeset + + @primary_key false + embedded_schema do + # Common + field(:type, :string) + field(:name, :string) + + # Mention, Hashtag + field(:href, ObjectValidators.Uri) + + # Emoji + embeds_one :icon, IconObjectValidator, primary_key: false do + field(:type, :string) + field(:url, ObjectValidators.Uri) + end + + field(:updated, ObjectValidators.DateTime) + field(:id, ObjectValidators.Uri) + end + + def cast_and_validate(data) do + data + |> cast_data() + end + + def cast_data(data) do + %__MODULE__{} + |> changeset(data) + end + + def changeset(struct, %{"type" => "Mention"} = data) do + struct + |> cast(data, [:type, :name, :href]) + |> validate_required([:type, :href]) + end + + def changeset(struct, %{"type" => "Hashtag", "name" => name} = data) do + name = + cond do + "#" <> name -> name + name -> name + end + |> String.downcase() + + data = Map.put(data, "name", name) + + struct + |> cast(data, [:type, :name, :href]) + |> validate_required([:type, :name]) + end + + def changeset(struct, %{"type" => "Emoji"} = data) do + data = Map.put(data, "name", String.trim(data["name"], ":")) + + struct + |> cast(data, [:type, :name, :updated, :id]) + |> cast_embed(:icon, with: &icon_changeset/2) + |> validate_required([:type, :name, :icon]) + end + + def icon_changeset(struct, data) do + struct + |> cast(data, [:type, :url]) + |> validate_inclusion(:type, ~w[Image]) + |> validate_required([:type, :url]) + end +end -- cgit v1.2.3 From 5ae27c8451a7012b43ef9113713132158701364b Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 12 Jan 2021 14:11:29 +0100 Subject: pipeline_test: Fix usage of %Activity{} --- lib/pleroma/web/activity_pub/object_validator.ex | 2 +- lib/pleroma/web/activity_pub/pipeline.ex | 2 ++ test/pleroma/web/activity_pub/pipeline_test.exs | 23 ++++++++++++++++------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index f75744203..15784b28c 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -169,7 +169,7 @@ def cast_and_apply(%{"type" => "Article"} = object) do def cast_and_apply(o), do: {:error, {:validator_not_set, o}} - # is_struct/1 isn't present in Elixir 1.8.x + # is_struct/1 appears in Elixir 1.11 def stringify_keys(%{__struct__: _} = object) do object |> Map.from_struct() diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index 195596f94..0aa504e72 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -40,6 +40,8 @@ def common_pipeline(object, meta) do end end + def do_common_pipeline(%{__struct__: _}, _meta), do: {:error, :is_struct} + def do_common_pipeline(object, meta) do with {_, {:ok, validated_object, meta}} <- {:validate_object, @object_validator.validate(object, meta)}, diff --git a/test/pleroma/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs index 52fa933ee..e606fa3d1 100644 --- a/test/pleroma/web/activity_pub/pipeline_test.exs +++ b/test/pleroma/web/activity_pub/pipeline_test.exs @@ -25,9 +25,6 @@ defmodule Pleroma.Web.ActivityPub.PipelineTest do MRFMock |> expect(:pipeline_filter, fn o, m -> {:ok, o, m} end) - ActivityPubMock - |> expect(:persist, fn o, m -> {:ok, o, m} end) - SideEffectsMock |> expect(:handle, fn o, m -> {:ok, o, m} end) |> expect(:handle_after_transaction, fn m -> m end) @@ -42,6 +39,9 @@ test "when given an `object_data` in meta, Federation will receive a the origina activity_with_object = %{activity | data: Map.put(activity.data, "object", object)} + ActivityPubMock + |> expect(:persist, fn _, m -> {:ok, activity, m} end) + FederatorMock |> expect(:publish, fn ^activity_with_object -> :ok end) @@ -50,7 +50,7 @@ test "when given an `object_data` in meta, Federation will receive a the origina assert {:ok, ^activity, ^meta} = Pleroma.Web.ActivityPub.Pipeline.common_pipeline( - activity, + activity.data, meta ) end @@ -59,6 +59,9 @@ test "it goes through validation, filtering, persisting, side effects and federa activity = insert(:note_activity) meta = [local: true] + ActivityPubMock + |> expect(:persist, fn _, m -> {:ok, activity, m} end) + FederatorMock |> expect(:publish, fn ^activity -> :ok end) @@ -66,29 +69,35 @@ test "it goes through validation, filtering, persisting, side effects and federa |> expect(:get, fn [:instance, :federating] -> true end) assert {:ok, ^activity, ^meta} = - Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta) + Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity.data, meta) end test "it goes through validation, filtering, persisting, side effects without federation for remote activities" do activity = insert(:note_activity) meta = [local: false] + ActivityPubMock + |> expect(:persist, fn _, m -> {:ok, activity, m} end) + ConfigMock |> expect(:get, fn [:instance, :federating] -> true end) assert {:ok, ^activity, ^meta} = - Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta) + Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity.data, meta) end test "it goes through validation, filtering, persisting, side effects without federation for local activities if federation is deactivated" do activity = insert(:note_activity) meta = [local: true] + ActivityPubMock + |> expect(:persist, fn _, m -> {:ok, activity, m} end) + ConfigMock |> expect(:get, fn [:instance, :federating] -> false end) assert {:ok, ^activity, ^meta} = - Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta) + Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity.data, meta) end end end -- cgit v1.2.3 From 37a7f521fd4778cde48f1b003ad9695e6ea45d1f Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 12 Jan 2021 09:30:22 +0100 Subject: Insert string-hashtags in Pipeline Cannot be done in Ecto schemas because only one type is allowed in arrays, and needs to be done before the MRFs. --- lib/pleroma/web/activity_pub/pipeline.ex | 34 +++++++++++++++++--------- lib/pleroma/web/activity_pub/transmogrifier.ex | 2 +- lib/pleroma/web/common_api.ex | 12 +-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index 0aa504e72..e184a9376 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -42,23 +42,33 @@ def common_pipeline(object, meta) do def do_common_pipeline(%{__struct__: _}, _meta), do: {:error, :is_struct} - def do_common_pipeline(object, meta) do - with {_, {:ok, validated_object, meta}} <- - {:validate_object, @object_validator.validate(object, meta)}, - {_, {:ok, mrfd_object, meta}} <- - {:mrf_object, @mrf.pipeline_filter(validated_object, meta)}, - {_, {:ok, activity, meta}} <- - {:persist_object, @activity_pub.persist(mrfd_object, meta)}, - {_, {:ok, activity, meta}} <- - {:execute_side_effects, @side_effects.handle(activity, meta)}, - {_, {:ok, _}} <- {:federation, maybe_federate(activity, meta)} do - {:ok, activity, meta} + def do_common_pipeline(message, meta) do + with {_, {:ok, message, meta}} <- {:validate, @object_validator.validate(message, meta)}, + {_, {:ok, message, meta}} <- {:fixup, validation_fixups(message, meta)}, + {_, {:ok, message, meta}} <- {:mrf, @mrf.pipeline_filter(message, meta)}, + {_, {:ok, message, meta}} <- {:persist, @activity_pub.persist(message, meta)}, + {_, {:ok, message, meta}} <- {:side_effects, @side_effects.handle(message, meta)}, + {_, {:ok, _}} <- {:federation, maybe_federate(message, meta)} do + {:ok, message, meta} else - {:mrf_object, {:reject, message, _}} -> {:reject, message} + {:mrf, {:reject, message, _}} -> {:reject, message} e -> {:error, e} end end + defp validation_fixups(message, meta) do + # Insert copy of hashtags as strings for the non-hashtag table indexing + message = + if message["tag"] do + tag = Object.hashtags(%Object{data: message}) ++ (message["tag"] || []) + Map.put(message, "tag", tag) + else + message + end + + {:ok, message, meta} + end + defp maybe_federate(%Object{}, _), do: {:ok, :not_federated} defp maybe_federate(%Activity{} = activity, meta) do diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex index 8c7d6a747..4070ed14d 100644 --- a/lib/pleroma/web/activity_pub/transmogrifier.ex +++ b/lib/pleroma/web/activity_pub/transmogrifier.ex @@ -564,7 +564,7 @@ def handle_incoming( Pipeline.common_pipeline(data, local: false) do {:ok, activity} else - {:error, {:validate_object, _}} = e -> + {:error, {:validate, _}} = e -> # Check if we have a create activity for this with {:ok, object_id} <- ObjectValidators.ObjectID.cast(data["object"]), %Activity{data: %{"actor" => actor}} <- diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index b003e30c7..895baebc9 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -228,17 +228,7 @@ def favorite_helper(user, id) do {:find_object, _} -> {:error, :not_found} - {:common_pipeline, - { - :error, - { - :validate_object, - { - :error, - changeset - } - } - }} = e -> + {:common_pipeline, {:error, {:validate, {:error, changeset}}}} = e -> if {:object, {"already liked by this actor", []}} in changeset.errors do {:ok, :already_liked} else -- cgit v1.2.3 From 7ebfe899007002f5bbf8744a8f0b582e0e13342e Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 12 Jan 2021 11:14:09 +0100 Subject: object_validators: Mark validate_data as private --- .../web/activity_pub/object_validators/accept_reject_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/announce_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/answer_validator.ex | 2 +- .../web/activity_pub/object_validators/article_note_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/block_validator.ex | 2 +- .../web/activity_pub/object_validators/chat_message_validator.ex | 2 +- .../web/activity_pub/object_validators/create_chat_message_validator.ex | 2 +- .../web/activity_pub/object_validators/create_generic_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/delete_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/event_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/follow_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/like_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/question_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/undo_validator.ex | 2 +- lib/pleroma/web/activity_pub/object_validators/update_validator.ex | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex b/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex index d31e780c3..b577a1044 100644 --- a/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/accept_reject_validator.ex @@ -27,7 +27,7 @@ def cast_data(data) do |> cast(data, __schema__(:fields)) end - def validate_data(cng) do + defp validate_data(cng) do cng |> validate_required([:id, :type, :actor, :to, :cc, :object]) |> validate_inclusion(:type, ["Accept", "Reject"]) diff --git a/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex b/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex index b08a33e68..576341790 100644 --- a/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/announce_validator.ex @@ -50,7 +50,7 @@ def fix_after_cast(cng) do cng end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Announce"]) |> validate_required([:id, :type, :object, :actor, :to, :cc]) diff --git a/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex b/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex index 15e4413cd..c9bd9e42d 100644 --- a/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/answer_validator.ex @@ -50,7 +50,7 @@ def changeset(struct, data) do |> cast(data, __schema__(:fields)) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Answer"]) |> validate_required([:id, :inReplyTo, :name, :attributedTo, :actor]) diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex index 5910f4060..39ef6dc29 100644 --- a/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/article_note_validator.ex @@ -95,7 +95,7 @@ def changeset(struct, data) do |> cast_embed(:tag) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Article", "Note"]) |> validate_required([:id, :actor, :attributedTo, :type, :context, :context_id]) diff --git a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex index e7b3a3922..4a0d1473d 100644 --- a/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/attachment_validator.ex @@ -89,7 +89,7 @@ defp fix_url(data) do end end - def validate_data(cng) do + defp validate_data(cng) do cng |> validate_inclusion(:type, ~w[Document Audio Image Video]) |> validate_required([:mediaType, :url, :type]) diff --git a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex index a04c95f4b..8a5a60526 100644 --- a/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/audio_video_validator.ex @@ -137,7 +137,7 @@ def changeset(struct, data) do |> cast_embed(:tag) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Audio", "Video"]) |> validate_required([:id, :actor, :attributedTo, :type, :context, :attachment]) diff --git a/lib/pleroma/web/activity_pub/object_validators/block_validator.ex b/lib/pleroma/web/activity_pub/object_validators/block_validator.ex index c5f77bb76..88948135f 100644 --- a/lib/pleroma/web/activity_pub/object_validators/block_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/block_validator.ex @@ -26,7 +26,7 @@ def cast_data(data) do |> cast(data, __schema__(:fields)) end - def validate_data(cng) do + defp validate_data(cng) do cng |> validate_required([:id, :type, :actor, :to, :cc, :object]) |> validate_inclusion(:type, ["Block"]) diff --git a/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex b/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex index 1189778f2..b153156b0 100644 --- a/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/chat_message_validator.ex @@ -67,7 +67,7 @@ def changeset(struct, data) do |> cast_embed(:attachment) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["ChatMessage"]) |> validate_required([:id, :actor, :to, :type, :published]) diff --git a/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex b/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex index 8384c16a7..7a31a99bf 100644 --- a/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/create_chat_message_validator.ex @@ -39,7 +39,7 @@ def cast_and_validate(data, meta \\ []) do |> validate_data(meta) end - def validate_data(cng, meta \\ []) do + defp validate_data(cng, meta) do cng |> validate_required([:id, :actor, :to, :type, :object]) |> validate_inclusion(:type, ["Create"]) diff --git a/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex b/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex index bf56a918c..e06e442f4 100644 --- a/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/create_generic_validator.ex @@ -79,7 +79,7 @@ defp fix(data, meta) do |> CommonFixes.fix_actor() end - def validate_data(cng, meta \\ []) do + defp validate_data(cng, meta) do cng |> validate_required([:actor, :type, :object]) |> validate_inclusion(:type, ["Create"]) diff --git a/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex b/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex index fc1a79a72..7da67bf16 100644 --- a/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/delete_validator.ex @@ -53,7 +53,7 @@ def add_deleted_activity_id(cng) do Tombstone Video } - def validate_data(cng) do + defp validate_data(cng) do cng |> validate_required([:id, :type, :actor, :to, :cc, :object]) |> validate_inclusion(:type, ["Delete"]) diff --git a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex index 1906e597e..ec7566515 100644 --- a/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/emoji_react_validator.ex @@ -70,7 +70,7 @@ def validate_emoji(cng) do end end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["EmojiReact"]) |> validate_required([:id, :type, :object, :actor, :context, :to, :cc, :content]) diff --git a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex index 0112a074d..d42458ef5 100644 --- a/lib/pleroma/web/activity_pub/object_validators/event_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/event_validator.ex @@ -86,7 +86,7 @@ def changeset(struct, data) do |> cast_embed(:tag) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Event"]) |> validate_required([:id, :actor, :attributedTo, :type, :context, :context_id]) diff --git a/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex b/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex index 6e428bacc..239cee5e7 100644 --- a/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/follow_validator.ex @@ -27,7 +27,7 @@ def cast_data(data) do |> cast(data, __schema__(:fields)) end - def validate_data(cng) do + defp validate_data(cng) do cng |> validate_required([:id, :type, :actor, :to, :cc, :object]) |> validate_inclusion(:type, ["Follow"]) diff --git a/lib/pleroma/web/activity_pub/object_validators/like_validator.ex b/lib/pleroma/web/activity_pub/object_validators/like_validator.ex index 30c40b238..509da507b 100644 --- a/lib/pleroma/web/activity_pub/object_validators/like_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/like_validator.ex @@ -76,7 +76,7 @@ def fix_recipients(cng) do end end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Like"]) |> validate_required([:id, :type, :object, :actor, :context, :to, :cc]) diff --git a/lib/pleroma/web/activity_pub/object_validators/question_validator.ex b/lib/pleroma/web/activity_pub/object_validators/question_validator.ex index 7acb1e928..7012e2e1d 100644 --- a/lib/pleroma/web/activity_pub/object_validators/question_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/question_validator.ex @@ -100,7 +100,7 @@ def changeset(struct, data) do |> cast_embed(:tag) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Question"]) |> validate_required([:id, :actor, :attributedTo, :type, :context, :context_id]) diff --git a/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex b/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex index 783a79ddb..e8af60ffa 100644 --- a/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/undo_validator.ex @@ -38,7 +38,7 @@ def changeset(struct, data) do |> cast(data, __schema__(:fields)) end - def validate_data(data_cng) do + defp validate_data(data_cng) do data_cng |> validate_inclusion(:type, ["Undo"]) |> validate_required([:id, :type, :object, :actor, :to, :cc]) diff --git a/lib/pleroma/web/activity_pub/object_validators/update_validator.ex b/lib/pleroma/web/activity_pub/object_validators/update_validator.ex index a66d41400..6bb1dc7fa 100644 --- a/lib/pleroma/web/activity_pub/object_validators/update_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/update_validator.ex @@ -28,7 +28,7 @@ def cast_data(data) do |> cast(data, __schema__(:fields)) end - def validate_data(cng) do + defp validate_data(cng) do cng |> validate_required([:id, :type, :actor, :to, :cc, :object]) |> validate_inclusion(:type, ["Update"]) -- cgit v1.2.3 From 4ecf6ceea6062d68c382918010dc577151d0131c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 1 Apr 2021 10:01:31 -0500 Subject: Enforce user.notification_settings is NOT NULL --- .../20210401143153_user_notification_settings_fix.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 priv/repo/migrations/20210401143153_user_notification_settings_fix.exs diff --git a/priv/repo/migrations/20210401143153_user_notification_settings_fix.exs b/priv/repo/migrations/20210401143153_user_notification_settings_fix.exs new file mode 100644 index 000000000..cf68f1be6 --- /dev/null +++ b/priv/repo/migrations/20210401143153_user_notification_settings_fix.exs @@ -0,0 +1,17 @@ +defmodule Pleroma.Repo.Migrations.UserNotificationSettingsFix do + use Ecto.Migration + + def up do + execute(~s(UPDATE users + SET + notification_settings = '{"followers": true, "follows": true, "non_follows": true, "non_followers": true}'::jsonb WHERE notification_settings IS NULL +)) + + execute("ALTER TABLE users + ALTER COLUMN notification_settings SET NOT NULL") + end + + def down do + :ok + end +end -- cgit v1.2.3 From 765f0907dfa9371038188ee35fc3b241be796d26 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 1 Apr 2021 10:07:57 -0500 Subject: Document user login failure fix for NULL notification_settings --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f2bb638..31a22bb31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Try to save exported ConfigDB settings (migrate_from_db) in the system temp directory if default location is not writable. +- User login failures if their `notification_settings` were in a NULL state. ## [2.3.0] - 2020-03-01 -- cgit v1.2.3 From 31ce8a37304e24381b26d678dfbbc7b7a6b1ba35 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 1 Apr 2021 10:09:32 -0500 Subject: Fix CHANGELOG entry meant for next release --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43f2bb638..6c45cad85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Changed + - The `application` metadata returned with statuses is no longer hardcoded. Apps that want to display these details will now have valid data for new posts after this change. +### Added + +- MRF (`FollowBotPolicy`): New MRF Policy which makes a designated local Bot account attempt to follow all users in public Notes received by your instance. Users who require approving follower requests or have #nobot in their profile are excluded. + ## Unreleased (Patch) ### Fixed @@ -75,7 +81,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to define custom HTTP headers per each frontend - MRF (`NoEmptyPolicy`): New MRF Policy which will deny empty statuses or statuses of only mentions from being created by local users - New users will receive a simple email confirming their registration if no other emails will be dispatched. (e.g., Welcome, Confirmation, or Approval Required) -- MRF (`FollowBotPolicy`): New MRF Policy which makes a designated local Bot account attempt to follow all users in public Notes received by your instance. Users who require approving follower requests or have #nobot in their profile are excluded.
API Changes -- cgit v1.2.3 From ef36f7fa5cff0a0d364aff192954556b0d2b0d2a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 1 Apr 2021 13:49:04 +0200 Subject: Move tag fixup to object_validator --- lib/pleroma/web/activity_pub/object_validator.ex | 32 +++++++++++++++++++----- lib/pleroma/web/activity_pub/pipeline.ex | 14 ----------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 15784b28c..70d9a35a9 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -113,9 +113,34 @@ def validate( end end + def validate(%{"type" => type} = object, meta) + when type in ~w[Event Question Audio Video Article] do + validator = + case type do + "Event" -> EventValidator + "Question" -> QuestionValidator + "Audio" -> AudioVideoValidator + "Video" -> AudioVideoValidator + "Article" -> ArticleNoteValidator + end + + with {:ok, object} <- + object + |> validator.cast_and_validate() + |> Ecto.Changeset.apply_action(:insert) do + object = stringify_keys(object) + + # Insert copy of hashtags as strings for the non-hashtag table indexing + tag = (object["tag"] || []) ++ Object.hashtags(%Object{data: object}) + object = Map.put(object, "tag", tag) + + {:ok, object, meta} + end + end + def validate(%{"type" => type} = object, meta) when type in ~w[Accept Reject Follow Update Like EmojiReact Announce - Event ChatMessage Question Audio Video Article Answer] do + ChatMessage Answer] do validator = case type do "Accept" -> AcceptRejectValidator @@ -125,12 +150,7 @@ def validate(%{"type" => type} = object, meta) "Like" -> LikeValidator "EmojiReact" -> EmojiReactValidator "Announce" -> AnnounceValidator - "Event" -> EventValidator "ChatMessage" -> ChatMessageValidator - "Question" -> QuestionValidator - "Audio" -> AudioVideoValidator - "Video" -> AudioVideoValidator - "Article" -> ArticleNoteValidator "Answer" -> AnswerValidator end diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index e184a9376..377eccb92 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -44,7 +44,6 @@ def do_common_pipeline(%{__struct__: _}, _meta), do: {:error, :is_struct} def do_common_pipeline(message, meta) do with {_, {:ok, message, meta}} <- {:validate, @object_validator.validate(message, meta)}, - {_, {:ok, message, meta}} <- {:fixup, validation_fixups(message, meta)}, {_, {:ok, message, meta}} <- {:mrf, @mrf.pipeline_filter(message, meta)}, {_, {:ok, message, meta}} <- {:persist, @activity_pub.persist(message, meta)}, {_, {:ok, message, meta}} <- {:side_effects, @side_effects.handle(message, meta)}, @@ -56,19 +55,6 @@ def do_common_pipeline(message, meta) do end end - defp validation_fixups(message, meta) do - # Insert copy of hashtags as strings for the non-hashtag table indexing - message = - if message["tag"] do - tag = Object.hashtags(%Object{data: message}) ++ (message["tag"] || []) - Map.put(message, "tag", tag) - else - message - end - - {:ok, message, meta} - end - defp maybe_federate(%Object{}, _), do: {:ok, :not_federated} defp maybe_federate(%Activity{} = activity, meta) do -- cgit v1.2.3 From 681a42c359b4fbae74285363c670dff18aac5918 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Thu, 8 Apr 2021 15:45:31 +0300 Subject: release runtime provider fix for paths --- lib/pleroma/config/release_runtime_provider.ex | 13 +++++++++---- mix.exs | 13 +------------ test/pleroma/config/release_runtime_provider_test.exs | 1 - 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lib/pleroma/config/release_runtime_provider.ex b/lib/pleroma/config/release_runtime_provider.ex index 46fa35559..e5e9d3dcd 100644 --- a/lib/pleroma/config/release_runtime_provider.ex +++ b/lib/pleroma/config/release_runtime_provider.ex @@ -11,10 +11,11 @@ def init(opts), do: opts def load(config, opts) do with_defaults = Config.Reader.merge(config, Pleroma.Config.Holder.release_defaults()) - config_path = opts[:config_path] + config_path = + opts[:config_path] || System.get_env("PLEROMA_CONFIG_PATH") || "/etc/pleroma/config.exs" with_runtime_config = - if config_path && File.exists?(config_path) do + if File.exists?(config_path) do runtime_config = Config.Reader.read!(config_path) with_defaults @@ -32,10 +33,14 @@ def load(config, opts) do with_defaults end - exported_config_path = opts[:exported_config_path] + exported_config_path = + opts[:exported_config_path] || + config_path + |> Path.dirname() + |> Path.join("#{Pleroma.Config.get(:env)}.exported_from_db.secret.exs") with_exported = - if exported_config_path && File.exists?(exported_config_path) do + if File.exists?(exported_config_path) do exported_config = Config.Reader.read!(exported_config_path) Config.Reader.merge(with_runtime_config, exported_config) else diff --git a/mix.exs b/mix.exs index 7328b533b..fe5d9d963 100644 --- a/mix.exs +++ b/mix.exs @@ -38,7 +38,7 @@ def project do include_executables_for: [:unix], applications: [ex_syslogger: :load, syslog: :load, eldap: :transient], steps: [:assemble, &put_otp_version/1, ©_files/1, ©_nginx_config/1], - config_providers: [{Pleroma.Config.ReleaseRuntimeProvider, release_config_paths()}] + config_providers: [{Pleroma.Config.ReleaseRuntimeProvider, []}] ] ] ] @@ -67,17 +67,6 @@ def copy_nginx_config(%{path: target_path} = release) do release end - defp release_config_paths do - config_path = System.get_env("PLEROMA_CONFIG_PATH") || "/etc/pleroma/config.exs" - - exported_config_path = - config_path - |> Path.dirname() - |> Path.join("#{Mix.env()}.exported_from_db.secret.exs") - - [config_path: config_path, exported_config_path: exported_config_path] - end - # Configuration for the OTP application. # # Type `mix help compile.app` for more information. diff --git a/test/pleroma/config/release_runtime_provider_test.exs b/test/pleroma/config/release_runtime_provider_test.exs index 1921698c5..6578d3268 100644 --- a/test/pleroma/config/release_runtime_provider_test.exs +++ b/test/pleroma/config/release_runtime_provider_test.exs @@ -8,7 +8,6 @@ test "loads release defaults config and warns about non-existent runtime config" ExUnit.CaptureIO.capture_io(fn -> merged = ReleaseRuntimeProvider.load([], []) assert merged == Pleroma.Config.Holder.release_defaults() - IO.inspect(merged) end) =~ "!!! Config path is not declared! Please ensure it exists and that PLEROMA_CONFIG_PATH is unset or points to an existing file" end -- cgit v1.2.3 From 0feafcc20cec168258f592b9d509c1e6ccc8efba Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Fri, 9 Apr 2021 10:30:27 -0500 Subject: Use URI.merge to prevent concatenating two canonical URLs when a custom instance thumbnail was uploaded via AdminFE --- lib/pleroma/web/mastodon_api/views/instance_view.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex index 73205fb6d..dac68d8e6 100644 --- a/lib/pleroma/web/mastodon_api/views/instance_view.ex +++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex @@ -23,7 +23,8 @@ def render("show.json", _) do streaming_api: Pleroma.Web.Endpoint.websocket_url() }, stats: Pleroma.Stats.get_stats(), - thumbnail: Pleroma.Web.base_url() <> Keyword.get(instance, :instance_thumbnail), + thumbnail: + URI.merge(Pleroma.Web.base_url(), Keyword.get(instance, :instance_thumbnail)) |> to_string, languages: ["en"], registrations: Keyword.get(instance, :registrations_open), approval_required: Keyword.get(instance, :account_approval_required), -- cgit v1.2.3 From 9fbcdc15b11dedf27bc5c78d09048ba354906c16 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Apr 2021 10:52:53 -0500 Subject: Validate custom instance thumbnail set via AdminAPI produces correct URL --- CHANGELOG.md | 1 + .../controllers/config_controller_test.exs | 42 ++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c45cad85..1553245e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Try to save exported ConfigDB settings (migrate_from_db) in the system temp directory if default location is not writable. +- Uploading custom instance thumbnail via AdminAPI/AdminFE generated invalid URL to the image ## [2.3.0] - 2020-03-01 diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 578a4c914..71151712e 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1410,6 +1410,48 @@ test "enables the welcome messages", %{conn: conn} do "need_reboot" => false } end + + test "custom instance thumbnail", %{conn: conn} do + clear_config([:instance]) + + params = %{ + "group" => ":pleroma", + "key" => ":instance", + "value" => [ + %{ + "tuple" => [ + ":instance_thumbnail", + "https://example.com/media/new_thumbnail.jpg" + ] + } + ] + } + + res = + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/pleroma/admin/config", %{"configs" => [params]}) + |> json_response_and_validate_schema(200) + + assert res == %{ + "configs" => [ + %{ + "db" => [":instance_thumbnail"], + "group" => ":pleroma", + "key" => ":instance", + "value" => params["value"] + } + ], + "need_reboot" => false + } + + assert res = + conn + |> get("/api/v1/instance") + |> json_response_and_validate_schema(200) + + assert res = %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"} + end end describe "GET /api/pleroma/admin/config/descriptions" do -- cgit v1.2.3 From cdd271b0655799e65bb9a13016dc82441ec34f87 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Apr 2021 10:55:54 -0500 Subject: Fix assignment / assertion --- test/pleroma/web/admin_api/controllers/config_controller_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 71151712e..c4d07d61c 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1445,8 +1445,8 @@ test "custom instance thumbnail", %{conn: conn} do "need_reboot" => false } - assert res = - conn + _res = + assert conn |> get("/api/v1/instance") |> json_response_and_validate_schema(200) -- cgit v1.2.3 From 905efc57e9f2a96519bf1ac84b56f88d1818cca3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Apr 2021 11:15:52 -0500 Subject: Initial test validating the AdminAPI issue --- .../controllers/config_controller_test.exs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index c4d07d61c..d26fd3150 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1452,6 +1452,41 @@ test "custom instance thumbnail", %{conn: conn} do assert res = %{"thumbnail" => "https://example.com/media/new_thumbnail.jpg"} end + + test "Concurrent Limiter", %{conn: conn} do + clear_config([ConcurrentLimiter]) + + params = %{ + "group" => ":pleroma", + "key" => "ConcurrentLimiter", + "value" => [ + %{ + "tuple" => [ + "Pleroma.Web.RichMedia.Helpers", + [ + %{"tuple" => [":max_running", 6]}, + %{"tuple" => [":max_waiting", 6]} + ] + ] + }, + %{ + "tuple" => [ + "Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy", + [ + %{"tuple" => [":max_running", 7]}, + %{"tuple" => [":max_waiting", 7]} + ] + ] + } + ] + } + + _res = + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/pleroma/admin/config", %{"configs" => [params]}) + |> json_response_and_validate_schema(200) + end end describe "GET /api/pleroma/admin/config/descriptions" do -- cgit v1.2.3 From ee53ad4d7705328a5a583680c6f551c4c3bf2302 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Apr 2021 12:09:18 -0500 Subject: Add ConcurrentLimiter to module_name?/1 and apply string_to_elixir_types/1 to search_opts keys during update_or_create/1 --- lib/pleroma/config_db.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex index b874e0e37..03905c06b 100644 --- a/lib/pleroma/config_db.ex +++ b/lib/pleroma/config_db.ex @@ -141,7 +141,9 @@ defp deep_merge(_key, value1, value2) do @spec update_or_create(map()) :: {:ok, ConfigDB.t()} | {:error, Changeset.t()} def update_or_create(params) do params = Map.put(params, :value, to_elixir_types(params[:value])) - search_opts = Map.take(params, [:group, :key]) + + search_opts = + Map.take(params, [:group, :key]) |> Map.update!(:key, &string_to_elixir_types(&1)) with %ConfigDB{} = config <- ConfigDB.get_by_params(search_opts), {_, true, config} <- {:partial_update, can_be_partially_updated?(config), config}, @@ -387,6 +389,6 @@ defp find_valid_delimiter([delimiter | others], pattern, regex_delimiter) do @spec module_name?(String.t()) :: boolean() def module_name?(string) do Regex.match?(~r/^(Pleroma|Phoenix|Tesla|Quack|Ueberauth|Swoosh)\./, string) or - string in ["Oban", "Ueberauth", "ExSyslogger"] + string in ["Oban", "Ueberauth", "ExSyslogger", "ConcurrentLimiter"] end end -- cgit v1.2.3 From 861f1928526930eeb78f79c4840c69cee5c2f215 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Apr 2021 14:39:44 -0500 Subject: Document fixed ability to save ConcurrentLimiter settings in ConfigDB --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1553245e5..6e13b3875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Try to save exported ConfigDB settings (migrate_from_db) in the system temp directory if default location is not writable. - Uploading custom instance thumbnail via AdminAPI/AdminFE generated invalid URL to the image +- Applying ConcurrentLimiter settings via AdminAPI ## [2.3.0] - 2020-03-01 -- cgit v1.2.3 From c3b8c77967b0c42f93286f864236b7d6f1471c13 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 13 Apr 2021 14:25:15 -0500 Subject: Improve string_to_elixir_types/1 with guards --- lib/pleroma/config_db.ex | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex index 03905c06b..eeeb026c1 100644 --- a/lib/pleroma/config_db.ex +++ b/lib/pleroma/config_db.ex @@ -327,7 +327,7 @@ def to_elixir_types(entity), do: entity @spec string_to_elixir_types(String.t()) :: atom() | Regex.t() | module() | String.t() | no_return() - def string_to_elixir_types("~r" <> _pattern = regex) do + def string_to_elixir_types("~r" <> _pattern = regex) when is_binary(regex) do pattern = ~r/^~r(?'delimiter'[\/|"'([{<]{1})(?'pattern'.+)[\/|"')\]}>]{1}(?'modifier'[uismxfU]*)/u @@ -341,9 +341,9 @@ def string_to_elixir_types("~r" <> _pattern = regex) do end end - def string_to_elixir_types(":" <> atom), do: String.to_atom(atom) + def string_to_elixir_types(":" <> atom) when is_binary(atom), do: String.to_atom(atom) - def string_to_elixir_types(value) do + def string_to_elixir_types(value) when is_binary(value) do if module_name?(value) do String.to_existing_atom("Elixir." <> value) else @@ -351,6 +351,8 @@ def string_to_elixir_types(value) do end end + def string_to_elixir_types(value) when is_atom(value), do: value + defp parse_host("localhost"), do: :localhost defp parse_host(host) do -- cgit v1.2.3 From f95b52255b2d7373a3e0bf4adff81f83c080b2ef Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 14 Apr 2021 09:39:57 -0500 Subject: Revert guards on string_to_elixir_types/1, remove unnecessary assignment in test --- lib/pleroma/config_db.ex | 12 ++++-------- .../web/admin_api/controllers/config_controller_test.exs | 9 ++++----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/pleroma/config_db.ex b/lib/pleroma/config_db.ex index eeeb026c1..cb57673e3 100644 --- a/lib/pleroma/config_db.ex +++ b/lib/pleroma/config_db.ex @@ -141,9 +141,7 @@ defp deep_merge(_key, value1, value2) do @spec update_or_create(map()) :: {:ok, ConfigDB.t()} | {:error, Changeset.t()} def update_or_create(params) do params = Map.put(params, :value, to_elixir_types(params[:value])) - - search_opts = - Map.take(params, [:group, :key]) |> Map.update!(:key, &string_to_elixir_types(&1)) + search_opts = Map.take(params, [:group, :key]) with %ConfigDB{} = config <- ConfigDB.get_by_params(search_opts), {_, true, config} <- {:partial_update, can_be_partially_updated?(config), config}, @@ -327,7 +325,7 @@ def to_elixir_types(entity), do: entity @spec string_to_elixir_types(String.t()) :: atom() | Regex.t() | module() | String.t() | no_return() - def string_to_elixir_types("~r" <> _pattern = regex) when is_binary(regex) do + def string_to_elixir_types("~r" <> _pattern = regex) do pattern = ~r/^~r(?'delimiter'[\/|"'([{<]{1})(?'pattern'.+)[\/|"')\]}>]{1}(?'modifier'[uismxfU]*)/u @@ -341,9 +339,9 @@ def string_to_elixir_types("~r" <> _pattern = regex) when is_binary(regex) do end end - def string_to_elixir_types(":" <> atom) when is_binary(atom), do: String.to_atom(atom) + def string_to_elixir_types(":" <> atom), do: String.to_atom(atom) - def string_to_elixir_types(value) when is_binary(value) do + def string_to_elixir_types(value) do if module_name?(value) do String.to_existing_atom("Elixir." <> value) else @@ -351,8 +349,6 @@ def string_to_elixir_types(value) when is_binary(value) do end end - def string_to_elixir_types(value) when is_atom(value), do: value - defp parse_host("localhost"), do: :localhost defp parse_host(host) do diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index d26fd3150..c39c1b1e1 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1481,11 +1481,10 @@ test "Concurrent Limiter", %{conn: conn} do ] } - _res = - assert conn - |> put_req_header("content-type", "application/json") - |> post("/api/pleroma/admin/config", %{"configs" => [params]}) - |> json_response_and_validate_schema(200) + assert conn + |> put_req_header("content-type", "application/json") + |> post("/api/pleroma/admin/config", %{"configs" => [params]}) + |> json_response_and_validate_schema(200) end end -- cgit v1.2.3 From d9fce0133ef3444ef7d09ae7e2760583540d1cd2 Mon Sep 17 00:00:00 2001 From: Sean King Date: Wed, 14 Apr 2021 14:01:33 -0600 Subject: Fix Mastodon interface link --- docs/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 1a90d0a8d..80c5d2631 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ The default front-end used by Pleroma is Pleroma-FE. You can find more informati ### Mastodon interface If the Pleroma interface isn't your thing, or you're just trying something new but you want to keep using the familiar Mastodon interface, we got that too! -Just add a "/web" after your instance url (e.g. ) and you'll end on the Mastodon web interface, but with a Pleroma backend! MAGIC! +Just add a "/web" after your instance url (e.g. ) and you'll end on the Mastodon web interface, but with a Pleroma backend! MAGIC! The Mastodon interface is from the Glitch-soc fork. For more information on the Mastodon interface you can check the [Mastodon](https://docs.joinmastodon.org/) and [Glitch-soc](https://glitch-soc.github.io/docs/) documentation. Remember, what you see is only the frontend part of Mastodon, the backend is still Pleroma. -- cgit v1.2.3 From 2b4f958b2ad653ee8e294ade18aa4482e4d372e1 Mon Sep 17 00:00:00 2001 From: Sean King Date: Sun, 18 Apr 2021 14:00:18 -0600 Subject: Add opting out of Google FLoC to HTTPSecurityPlug headers --- lib/pleroma/web/plugs/http_security_plug.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/plugs/http_security_plug.ex b/lib/pleroma/web/plugs/http_security_plug.ex index 0025b042a..d1e6cc9d3 100644 --- a/lib/pleroma/web/plugs/http_security_plug.ex +++ b/lib/pleroma/web/plugs/http_security_plug.ex @@ -48,7 +48,8 @@ def headers do {"x-content-type-options", "nosniff"}, {"referrer-policy", referrer_policy}, {"x-download-options", "noopen"}, - {"content-security-policy", csp_string()} + {"content-security-policy", csp_string()}, + {"permissions-policy", "interest-cohort=()"} ] headers = -- cgit v1.2.3 From efed94a23e30260bcf1b297910906b11d6e4d895 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Apr 2021 16:23:57 -0500 Subject: Fix error response which was breaking tests related to pinned posts --- lib/pleroma/web/common_api.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/common_api.ex b/lib/pleroma/web/common_api.ex index 3970c19a8..1b5f8491e 100644 --- a/lib/pleroma/web/common_api.ex +++ b/lib/pleroma/web/common_api.ex @@ -415,7 +415,7 @@ def pin(id, %User{} = user) do ) do {:ok, activity} else - {:error, {:execute_side_effects, error}} -> error + {:error, {:side_effects, error}} -> error error -> error end end -- cgit v1.2.3 From 2780cdd4e7acde0f4bf4719b7c82bc7e2d1bf3b5 Mon Sep 17 00:00:00 2001 From: Sean King Date: Mon, 19 Apr 2021 16:06:19 -0600 Subject: Add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b0678023..bfa76a89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - The `application` metadata returned with statuses is no longer hardcoded. Apps that want to display these details will now have valid data for new posts after this change. +- HTTPSecurityPlug now sends a response header to opt out of Google's FLoC (Federated Learning of Cohorts) targeted advertising. ### Added -- cgit v1.2.3 From 7eded7218922b46c5cc085e715b6031ffff9b6ce Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 20 Apr 2021 12:31:14 -0500 Subject: Fix incorrect shell command Can't be in /opt/pleroma/bin and then call ./bin/pleroma_ctl :) --- docs/installation/otp_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installation/otp_en.md b/docs/installation/otp_en.md index 42e264e65..13f9636f3 100644 --- a/docs/installation/otp_en.md +++ b/docs/installation/otp_en.md @@ -290,7 +290,7 @@ nginx -t ## Create your first user and set as admin ```sh -cd /opt/pleroma/bin +cd /opt/pleroma su pleroma -s $SHELL -lc "./bin/pleroma_ctl user new joeuser joeuser@sld.tld --admin" ``` This will create an account withe the username of 'joeuser' with the email address of joeuser@sld.tld, and set that user's account as an admin. This will result in a link that you can paste into the browser, which logs you in and enables you to set the password. -- cgit v1.2.3 From 0effcd2cfed36baec1d960b64c901da7e56710a8 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 19 Apr 2021 15:43:17 -0500 Subject: Set Repo.transaction/2 timeout to infinity. Fixes pleroma.user delete_activities mix task. --- lib/pleroma/web/activity_pub/pipeline.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index 377eccb92..400823094 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -24,7 +24,7 @@ defmodule Pleroma.Web.ActivityPub.Pipeline do @spec common_pipeline(map(), keyword()) :: {:ok, Activity.t() | Object.t(), keyword()} | {:error, any()} def common_pipeline(object, meta) do - case Repo.transaction(fn -> do_common_pipeline(object, meta) end) do + case Repo.transaction(fn -> do_common_pipeline(object, meta) end, timeout: :infinity) do {:ok, {:ok, activity, meta}} -> @side_effects.handle_after_transaction(meta) {:ok, activity, meta} -- cgit v1.2.3 From 9bc69196d5dfbd3fb37c0e62da19ce08fb9bf28d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 20 Apr 2021 11:10:39 -0500 Subject: Add utility function to return infinite timeout for SQL transactions if we detect it was called from a Mix Task --- lib/pleroma/utils.ex | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index bc0c95332..5e2fa8bf7 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -63,4 +63,13 @@ def posix_error_message(code) when code in @posix_error_codes do end def posix_error_message(_), do: "" + + def query_timeout do + {parent, _, _, _} = Process.info(self(), :current_stacktrace) |> elem(1) |> Enum.fetch!(2) + + cond do + parent |> to_string |> String.starts_with?("Elixir.Mix.Task") -> [timeout: :infinity] + true -> [timeout: 15_000] + end + end end -- cgit v1.2.3 From 9f711ddcf84bdb5a5680e1b55afa83768014906d Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 20 Apr 2021 11:16:24 -0500 Subject: Try to set query timeout intelligently --- lib/pleroma/web/activity_pub/pipeline.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/web/activity_pub/pipeline.ex b/lib/pleroma/web/activity_pub/pipeline.ex index 400823094..a0f2e0312 100644 --- a/lib/pleroma/web/activity_pub/pipeline.ex +++ b/lib/pleroma/web/activity_pub/pipeline.ex @@ -7,6 +7,7 @@ defmodule Pleroma.Web.ActivityPub.Pipeline do alias Pleroma.Config alias Pleroma.Object alias Pleroma.Repo + alias Pleroma.Utils alias Pleroma.Web.ActivityPub.ActivityPub alias Pleroma.Web.ActivityPub.MRF alias Pleroma.Web.ActivityPub.ObjectValidator @@ -24,7 +25,7 @@ defmodule Pleroma.Web.ActivityPub.Pipeline do @spec common_pipeline(map(), keyword()) :: {:ok, Activity.t() | Object.t(), keyword()} | {:error, any()} def common_pipeline(object, meta) do - case Repo.transaction(fn -> do_common_pipeline(object, meta) end, timeout: :infinity) do + case Repo.transaction(fn -> do_common_pipeline(object, meta) end, Utils.query_timeout()) do {:ok, {:ok, activity, meta}} -> @side_effects.handle_after_transaction(meta) {:ok, activity, meta} -- cgit v1.2.3 From 99fd9c5e38ad08973f435f1a67d6af60d004c578 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Tue, 20 Apr 2021 12:00:02 -0500 Subject: OTP releases executing commands via pleroma_ctl show the parent of the process is :erl_eval --- lib/pleroma/utils.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index 5e2fa8bf7..55aecc509 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -69,6 +69,7 @@ def query_timeout do cond do parent |> to_string |> String.starts_with?("Elixir.Mix.Task") -> [timeout: :infinity] + parent == :erl_eval -> [timeout: :infinity] true -> [timeout: 15_000] end end -- cgit v1.2.3 From 959dc6e6fc95b33700fb7e08689afb701b2877f2 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 22 Apr 2021 10:11:08 -0500 Subject: Cleanup and ensure we obey custom Repo timeout --- lib/pleroma/utils.ex | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/utils.ex b/lib/pleroma/utils.ex index 55aecc509..a446d3ae6 100644 --- a/lib/pleroma/utils.ex +++ b/lib/pleroma/utils.ex @@ -11,6 +11,8 @@ defmodule Pleroma.Utils do eperm epipe erange erofs espipe esrch estale etxtbsy exdev )a + @repo_timeout Pleroma.Config.get([Pleroma.Repo, :timeout], 15_000) + def compile_dir(dir) when is_binary(dir) do dir |> File.ls!() @@ -64,13 +66,20 @@ def posix_error_message(code) when code in @posix_error_codes do def posix_error_message(_), do: "" + @doc """ + Returns [timeout: integer] suitable for passing as an option to Repo functions. + + This function detects if the execution was triggered from IEx shell, Mix task, or + ./bin/pleroma_ctl and sets the timeout to :infinity, else returns the default timeout value. + """ + @spec query_timeout() :: [timeout: integer] def query_timeout do {parent, _, _, _} = Process.info(self(), :current_stacktrace) |> elem(1) |> Enum.fetch!(2) cond do parent |> to_string |> String.starts_with?("Elixir.Mix.Task") -> [timeout: :infinity] parent == :erl_eval -> [timeout: :infinity] - true -> [timeout: 15_000] + true -> [timeout: @repo_timeout] end end end -- cgit v1.2.3 From d7a71a275abea6286ee116d092ddc9440a9419a5 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 22 Apr 2021 10:15:05 -0500 Subject: Fixed pleroma.user delete_activities mix task. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfa76a89a..a1173414d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Uploading custom instance thumbnail via AdminAPI/AdminFE generated invalid URL to the image - Applying ConcurrentLimiter settings via AdminAPI - User login failures if their `notification_settings` were in a NULL state. +- Mix task `pleroma.user delete_activities` query transaction timeout is now :infinity ## [2.3.0] - 2020-03-01 -- cgit v1.2.3 From b9a99ac0d4b245ff3df6a9aa1b4db46ee75e9d22 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 27 Apr 2021 11:54:28 -0500 Subject: Cache gitlab-ci based on mix.lock --- .gitlab-ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2bc571971..2651ff9e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,7 +8,9 @@ variables: &global_variables MIX_ENV: test cache: &global_cache_policy - key: ${CI_COMMIT_REF_SLUG} + key: + files: + - mix.lock paths: - deps - _build @@ -171,8 +173,8 @@ spec-deploy: - apk add curl script: - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline - - + + stop_review_app: image: alpine:3.9 stage: deploy @@ -231,7 +233,7 @@ amd64-musl: stage: release artifacts: *release-artifacts only: *release-only - image: elixir:1.10.3-alpine + image: elixir:1.10.3-alpine cache: *release-cache variables: *release-variables before_script: &before-release-musl -- cgit v1.2.3