forked from AkkomaGang/akkoma
giant massive dep upgrade and dialyxir-found error emporium (#371)
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk> Reviewed-on: AkkomaGang/akkoma#371
This commit is contained in:
parent
7f4d218cff
commit
07a48b9293
75 changed files with 688 additions and 555 deletions
|
@ -8,11 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Non-finch HTTP adapters
|
- Non-finch HTTP adapters
|
||||||
### Upgrade notes
|
- Legacy redirect from /api/pleroma/admin to /api/v1/pleroma/admin
|
||||||
- Ensure `config :tesla, :adapter` is either unset, or set to `{Tesla.Adapter.Finch, name: MyFinch}` in your .exs config
|
|
||||||
### Changed
|
### Changed
|
||||||
- Return HTTP error 413 when uploading an avatar or banner that's above the configured upload limit instead of a 500.
|
- Return HTTP error 413 when uploading an avatar or banner that's above the configured upload limit instead of a 500.
|
||||||
|
|
||||||
|
### Upgrade notes
|
||||||
|
- Ensure `config :tesla, :adapter` is either unset, or set to `{Tesla.Adapter.Finch, name: MyFinch}` in your .exs config
|
||||||
|
|
||||||
## 2022.12
|
## 2022.12
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# credo:disable-for-this-file
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
|
@ -115,7 +115,6 @@ def run(["prune_task"]) do
|
||||||
|
|
||||||
nil
|
nil
|
||||||
|> Pleroma.Workers.Cron.PruneDatabaseWorker.perform()
|
|> Pleroma.Workers.Cron.PruneDatabaseWorker.perform()
|
||||||
|> IO.inspect()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["fix_likes_collections"]) do
|
def run(["fix_likes_collections"]) do
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# credo:disable-for-this-file
|
||||||
defmodule Mix.Tasks.Pleroma.Diagnostics do
|
defmodule Mix.Tasks.Pleroma.Diagnostics do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
|
|
@ -247,9 +247,13 @@ def run(["gen" | rest]) do
|
||||||
config_dir = Path.dirname(config_path)
|
config_dir = Path.dirname(config_path)
|
||||||
psql_dir = Path.dirname(psql_path)
|
psql_dir = Path.dirname(psql_path)
|
||||||
|
|
||||||
[config_dir, psql_dir, static_dir, uploads_dir]
|
to_create =
|
||||||
|> Enum.reject(&File.exists?/1)
|
[config_dir, psql_dir, static_dir, uploads_dir]
|
||||||
|> Enum.map(&File.mkdir_p!/1)
|
|> Enum.reject(&File.exists?/1)
|
||||||
|
|
||||||
|
for dir <- to_create do
|
||||||
|
File.mkdir_p!(dir)
|
||||||
|
end
|
||||||
|
|
||||||
shell_info("Writing config to #{config_path}.")
|
shell_info("Writing config to #{config_path}.")
|
||||||
|
|
||||||
|
@ -319,6 +323,4 @@ defp upload_filters(filters) when is_map(filters) do
|
||||||
|
|
||||||
enabled_filters
|
enabled_filters
|
||||||
end
|
end
|
||||||
|
|
||||||
defp upload_filters(_), do: []
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,14 +10,11 @@ defmodule Mix.Tasks.Pleroma.Search do
|
||||||
|
|
||||||
def run(["import", "activities" | _rest]) do
|
def run(["import", "activities" | _rest]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
IO.inspect(Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities]))
|
|
||||||
|
|
||||||
IO.inspect(
|
Elasticsearch.Index.Bulk.upload(
|
||||||
Elasticsearch.Index.Bulk.upload(
|
Pleroma.Search.Elasticsearch.Cluster,
|
||||||
Pleroma.Search.Elasticsearch.Cluster,
|
"activities",
|
||||||
"activities",
|
Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities])
|
||||||
Pleroma.Config.get([Pleroma.Search.Elasticsearch.Cluster, :indexes, :activities])
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -378,9 +378,11 @@ def run(["change_email", nickname, email]) do
|
||||||
def run(["show", nickname]) do
|
def run(["show", nickname]) do
|
||||||
start_pleroma()
|
start_pleroma()
|
||||||
|
|
||||||
nickname
|
user =
|
||||||
|> User.get_cached_by_nickname()
|
nickname
|
||||||
|> IO.inspect()
|
|> User.get_cached_by_nickname()
|
||||||
|
|
||||||
|
shell_info("#{inspect(user)}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def run(["send_confirmation", nickname]) do
|
def run(["send_confirmation", nickname]) do
|
||||||
|
@ -389,7 +391,6 @@ def run(["send_confirmation", nickname]) do
|
||||||
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||||
user
|
user
|
||||||
|> Pleroma.Emails.UserEmail.account_confirmation_email()
|
|> Pleroma.Emails.UserEmail.account_confirmation_email()
|
||||||
|> IO.inspect()
|
|
||||||
|> Pleroma.Emails.Mailer.deliver!()
|
|> Pleroma.Emails.Mailer.deliver!()
|
||||||
|
|
||||||
shell_info("#{nickname}'s email sent")
|
shell_info("#{nickname}'s email sent")
|
||||||
|
@ -465,7 +466,7 @@ def run(["blocking", nickname]) do
|
||||||
|
|
||||||
with %User{local: true} = user <- User.get_cached_by_nickname(nickname) do
|
with %User{local: true} = user <- User.get_cached_by_nickname(nickname) do
|
||||||
blocks = User.following_ap_ids(user)
|
blocks = User.following_ap_ids(user)
|
||||||
IO.inspect(blocks, limit: :infinity)
|
IO.puts("#{inspect(blocks)}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,11 @@ defp add_cache_key_for(activity_id, additional_key) do
|
||||||
|
|
||||||
def invalidate_cache_for(activity_id) do
|
def invalidate_cache_for(activity_id) do
|
||||||
keys = get_cache_keys_for(activity_id)
|
keys = get_cache_keys_for(activity_id)
|
||||||
Enum.map(keys, &@cachex.del(:scrubber_cache, &1))
|
|
||||||
|
for key <- keys do
|
||||||
|
@cachex.del(:scrubber_cache, key)
|
||||||
|
end
|
||||||
|
|
||||||
@cachex.del(:scrubber_management_cache, activity_id)
|
@cachex.del(:scrubber_management_cache, activity_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,10 @@ defmodule Pleroma.Announcement do
|
||||||
end
|
end
|
||||||
|
|
||||||
def change(struct, params \\ %{}) do
|
def change(struct, params \\ %{}) do
|
||||||
|
params = validate_params(struct, params)
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|> cast(validate_params(struct, params), [:data, :starts_at, :ends_at, :rendered])
|
|> cast(params, [:data, :starts_at, :ends_at, :rendered])
|
||||||
|> validate_required([:data])
|
|> validate_required([:data])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,8 @@ defp background_migrators do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec task_children(atom()) :: [map()]
|
||||||
|
|
||||||
defp task_children(:test) do
|
defp task_children(:test) do
|
||||||
[
|
[
|
||||||
%{
|
%{
|
||||||
|
@ -223,6 +225,7 @@ defp task_children(_) do
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec elasticsearch_children :: [Pleroma.Search.Elasticsearch.Cluster]
|
||||||
def elasticsearch_children do
|
def elasticsearch_children do
|
||||||
config = Config.get([Pleroma.Search, :module])
|
config = Config.get([Pleroma.Search, :module])
|
||||||
|
|
||||||
|
|
|
@ -194,8 +194,6 @@ defp check_system_commands!(:ok) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp check_system_commands!(result), do: result
|
|
||||||
|
|
||||||
defp check_repo_pool_size!(:ok) do
|
defp check_repo_pool_size!(:ok) do
|
||||||
if Pleroma.Config.get([Pleroma.Repo, :pool_size], 10) != 10 and
|
if Pleroma.Config.get([Pleroma.Repo, :pool_size], 10) != 10 and
|
||||||
not Pleroma.Config.get([:dangerzone, :override_repo_pool_size], false) do
|
not Pleroma.Config.get([:dangerzone, :override_repo_pool_size], false) do
|
||||||
|
|
|
@ -209,7 +209,9 @@ def list_remote(opts) do
|
||||||
|
|
||||||
with :ok <- validate_shareable_packs_available(uri) do
|
with :ok <- validate_shareable_packs_available(uri) do
|
||||||
uri
|
uri
|
||||||
|> URI.merge("/api/pleroma/emoji/packs?page=#{opts[:page]}&page_size=#{opts[:page_size]}")
|
|> URI.merge(
|
||||||
|
"/api/v1/pleroma/emoji/packs?page=#{opts[:page]}&page_size=#{opts[:page_size]}"
|
||||||
|
)
|
||||||
|> http_get()
|
|> http_get()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -250,7 +252,7 @@ def download(name, url, as) do
|
||||||
|
|
||||||
with :ok <- validate_shareable_packs_available(uri),
|
with :ok <- validate_shareable_packs_available(uri),
|
||||||
{:ok, remote_pack} <-
|
{:ok, remote_pack} <-
|
||||||
uri |> URI.merge("/api/pleroma/emoji/pack?name=#{name}") |> http_get(),
|
uri |> URI.merge("/api/v1/pleroma/emoji/pack?name=#{name}") |> http_get(),
|
||||||
{:ok, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name),
|
{:ok, %{sha: sha, url: url} = pack_info} <- fetch_pack_info(remote_pack, uri, name),
|
||||||
{:ok, archive} <- download_archive(url, sha),
|
{:ok, archive} <- download_archive(url, sha),
|
||||||
pack <- copy_as(remote_pack, as || name),
|
pack <- copy_as(remote_pack, as || name),
|
||||||
|
@ -591,7 +593,7 @@ defp fetch_pack_info(remote_pack, uri, name) do
|
||||||
{:ok,
|
{:ok,
|
||||||
%{
|
%{
|
||||||
sha: sha,
|
sha: sha,
|
||||||
url: URI.merge(uri, "/api/pleroma/emoji/packs/archive?name=#{name}") |> to_string()
|
url: URI.merge(uri, "/api/v1/pleroma/emoji/packs/archive?name=#{name}") |> to_string()
|
||||||
}}
|
}}
|
||||||
|
|
||||||
%{"fallback-src" => src, "fallback-src-sha256" => sha} when is_binary(src) ->
|
%{"fallback-src" => src, "fallback-src-sha256" => sha} when is_binary(src) ->
|
||||||
|
|
|
@ -14,6 +14,8 @@ defmodule Pleroma.FollowingRelationship do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
|
||||||
|
@type follow_state :: :follow_pending | :follow_accept | :follow_reject | :unfollow
|
||||||
|
|
||||||
schema "following_relationships" do
|
schema "following_relationships" do
|
||||||
field(:state, State, default: :follow_pending)
|
field(:state, State, default: :follow_pending)
|
||||||
|
|
||||||
|
@ -72,6 +74,7 @@ def update(%User{} = follower, %User{} = following, state) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec follow(User.t(), User.t()) :: {:ok, User.t(), User.t()} | {:error, any}
|
||||||
def follow(%User{} = follower, %User{} = following, state \\ :follow_accept) do
|
def follow(%User{} = follower, %User{} = following, state \\ :follow_accept) do
|
||||||
with {:ok, _following_relationship} <-
|
with {:ok, _following_relationship} <-
|
||||||
%__MODULE__{}
|
%__MODULE__{}
|
||||||
|
@ -81,6 +84,7 @@ def follow(%User{} = follower, %User{} = following, state \\ :follow_accept) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec unfollow(User.t(), User.t()) :: {:ok, User.t(), User.t()} | {:error, any}
|
||||||
def unfollow(%User{} = follower, %User{} = following) do
|
def unfollow(%User{} = follower, %User{} = following) do
|
||||||
case get(follower, following) do
|
case get(follower, following) do
|
||||||
%__MODULE__{} = following_relationship ->
|
%__MODULE__{} = following_relationship ->
|
||||||
|
@ -89,10 +93,12 @@ def unfollow(%User{} = follower, %User{} = following) do
|
||||||
end
|
end
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
{:ok, nil}
|
{:ok, follower, following}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec after_update(follow_state(), User.t(), User.t()) ::
|
||||||
|
{:ok, User.t(), User.t()} | {:error, any()}
|
||||||
defp after_update(state, %User{} = follower, %User{} = following) do
|
defp after_update(state, %User{} = follower, %User{} = following) do
|
||||||
with {:ok, following} <- User.update_follower_count(following),
|
with {:ok, following} <- User.update_follower_count(following),
|
||||||
{:ok, follower} <- User.update_following_count(follower) do
|
{:ok, follower} <- User.update_following_count(follower) do
|
||||||
|
@ -103,6 +109,8 @@ defp after_update(state, %User{} = follower, %User{} = following) do
|
||||||
})
|
})
|
||||||
|
|
||||||
{:ok, follower, following}
|
{:ok, follower, following}
|
||||||
|
else
|
||||||
|
err -> {:error, err}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,10 @@ defp run_fifo(fifo_path, env, executable, args) do
|
||||||
args: args
|
args: args
|
||||||
])
|
])
|
||||||
|
|
||||||
fifo = Port.open(to_charlist(fifo_path), [:eof, :binary, :stream, :out])
|
fifo = File.open!(fifo_path, [:append, :binary])
|
||||||
fix = Pleroma.Helpers.QtFastStart.fix(env.body)
|
fix = Pleroma.Helpers.QtFastStart.fix(env.body)
|
||||||
true = Port.command(fifo, fix)
|
IO.binwrite(fifo, fix)
|
||||||
:erlang.port_close(fifo)
|
File.close(fifo)
|
||||||
loop_recv(pid)
|
loop_recv(pid)
|
||||||
after
|
after
|
||||||
File.rm(fifo_path)
|
File.rm(fifo_path)
|
||||||
|
|
|
@ -14,9 +14,7 @@ defmodule Pleroma.HTTP.AdapterHelper do
|
||||||
alias Pleroma.HTTP.AdapterHelper
|
alias Pleroma.HTTP.AdapterHelper
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@type proxy ::
|
@type proxy :: {Connection.proxy_type(), Connection.host(), pos_integer(), list()}
|
||||||
{Connection.host(), pos_integer()}
|
|
||||||
| {Connection.proxy_type(), Connection.host(), pos_integer()}
|
|
||||||
|
|
||||||
@callback options(keyword(), URI.t()) :: keyword()
|
@callback options(keyword(), URI.t()) :: keyword()
|
||||||
|
|
||||||
|
@ -25,7 +23,6 @@ def format_proxy(nil), do: nil
|
||||||
|
|
||||||
def format_proxy(proxy_url) do
|
def format_proxy(proxy_url) do
|
||||||
case parse_proxy(proxy_url) do
|
case parse_proxy(proxy_url) do
|
||||||
{:ok, host, port} -> {:http, host, port, []}
|
|
||||||
{:ok, type, host, port} -> {type, host, port, []}
|
{:ok, type, host, port} -> {type, host, port, []}
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
@ -94,8 +91,7 @@ defp proxy_type("https"), do: {:ok, :https}
|
||||||
defp proxy_type(_), do: {:error, :unknown}
|
defp proxy_type(_), do: {:error, :unknown}
|
||||||
|
|
||||||
@spec parse_proxy(String.t() | tuple() | nil) ::
|
@spec parse_proxy(String.t() | tuple() | nil) ::
|
||||||
{:ok, host(), pos_integer()}
|
{:ok, proxy_type(), host(), pos_integer()}
|
||||||
| {:ok, proxy_type(), host(), pos_integer()}
|
|
||||||
| {:error, atom()}
|
| {:error, atom()}
|
||||||
| nil
|
| nil
|
||||||
def parse_proxy(nil), do: nil
|
def parse_proxy(nil), do: nil
|
||||||
|
|
|
@ -14,7 +14,7 @@ defmodule Pleroma.Migrators.Support.BaseMigrator do
|
||||||
@callback fault_rate_allowance() :: integer() | float()
|
@callback fault_rate_allowance() :: integer() | float()
|
||||||
|
|
||||||
defmacro __using__(_opts) do
|
defmacro __using__(_opts) do
|
||||||
quote do
|
quote generated: true do
|
||||||
use GenServer
|
use GenServer
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -237,7 +237,8 @@ def insert_log(%{actor: %User{}, action: action, target: target} = attrs)
|
||||||
insert_log_entry_with_message(%ModerationLog{data: data})
|
insert_log_entry_with_message(%ModerationLog{data: data})
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec insert_log_entry_with_message(ModerationLog) :: {:ok, ModerationLog} | {:error, any}
|
@spec insert_log_entry_with_message(ModerationLog.t()) ::
|
||||||
|
{:ok, ModerationLog.t()} | {:error, any}
|
||||||
defp insert_log_entry_with_message(entry) do
|
defp insert_log_entry_with_message(entry) do
|
||||||
entry.data["message"]
|
entry.data["message"]
|
||||||
|> put_in(get_log_entry_message(entry))
|
|> put_in(get_log_entry_message(entry))
|
||||||
|
|
|
@ -240,7 +240,7 @@ def delete(%Object{data: %{"id" => id}} = object) do
|
||||||
{:ok, _} <- invalid_object_cache(object) do
|
{:ok, _} <- invalid_object_cache(object) do
|
||||||
cleanup_attachments(
|
cleanup_attachments(
|
||||||
Config.get([:instance, :cleanup_attachments]),
|
Config.get([:instance, :cleanup_attachments]),
|
||||||
%{"object" => object}
|
%{object: object}
|
||||||
)
|
)
|
||||||
|
|
||||||
{:ok, object, deleted_activity}
|
{:ok, object, deleted_activity}
|
||||||
|
@ -249,7 +249,7 @@ def delete(%Object{data: %{"id" => id}} = object) do
|
||||||
|
|
||||||
@spec cleanup_attachments(boolean(), %{required(:object) => map()}) ::
|
@spec cleanup_attachments(boolean(), %{required(:object) => map()}) ::
|
||||||
{:ok, Oban.Job.t() | nil}
|
{:ok, Oban.Job.t() | nil}
|
||||||
def cleanup_attachments(true, %{"object" => _} = params) do
|
def cleanup_attachments(true, %{object: _} = params) do
|
||||||
AttachmentsCleanupWorker.enqueue("cleanup_attachments", params)
|
AttachmentsCleanupWorker.enqueue("cleanup_attachments", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,6 @@ def create do
|
||||||
IO.puts("The database for #{inspect(@repo)} has already been created")
|
IO.puts("The database for #{inspect(@repo)} has already been created")
|
||||||
|
|
||||||
{:error, term} when is_binary(term) ->
|
{:error, term} when is_binary(term) ->
|
||||||
IO.puts(:stderr, "The database for #{inspect(@repo)} couldn't be created: #{term}")
|
|
||||||
|
|
||||||
{:error, term} ->
|
|
||||||
IO.puts(
|
IO.puts(
|
||||||
:stderr,
|
:stderr,
|
||||||
"The database for #{inspect(@repo)} couldn't be created: #{inspect(term)}"
|
"The database for #{inspect(@repo)} couldn't be created: #{inspect(term)}"
|
||||||
|
|
|
@ -66,6 +66,7 @@ defp read_chunk!(%{pid: pid, stream: stream, opts: opts}) do
|
||||||
@impl true
|
@impl true
|
||||||
@spec close(map) :: :ok | no_return()
|
@spec close(map) :: :ok | no_return()
|
||||||
def close(%{pid: _pid}) do
|
def close(%{pid: _pid}) do
|
||||||
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
defp check_adapter do
|
defp check_adapter do
|
||||||
|
|
|
@ -13,25 +13,21 @@ defmodule Pleroma.Search.Elasticsearch do
|
||||||
def es_query(:activity, query, offset, limit) do
|
def es_query(:activity, query, offset, limit) do
|
||||||
must = Parsers.Activity.parse(query)
|
must = Parsers.Activity.parse(query)
|
||||||
|
|
||||||
if must == [] do
|
%{
|
||||||
:skip
|
size: limit,
|
||||||
else
|
from: offset,
|
||||||
%{
|
terminate_after: 50,
|
||||||
size: limit,
|
timeout: "5s",
|
||||||
from: offset,
|
sort: [
|
||||||
terminate_after: 50,
|
"_score",
|
||||||
timeout: "5s",
|
%{"_timestamp" => %{order: "desc", format: "basic_date_time"}}
|
||||||
sort: [
|
],
|
||||||
"_score",
|
query: %{
|
||||||
%{"_timestamp" => %{order: "desc", format: "basic_date_time"}}
|
bool: %{
|
||||||
],
|
must: must
|
||||||
query: %{
|
|
||||||
bool: %{
|
|
||||||
must: must
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_fetch(:activity, search_query) do
|
defp maybe_fetch(:activity, search_query) do
|
||||||
|
|
|
@ -57,5 +57,5 @@ def encode(activity) do
|
||||||
defimpl Elasticsearch.Document, for: Pleroma.Object do
|
defimpl Elasticsearch.Document, for: Pleroma.Object do
|
||||||
def id(obj), do: obj.id
|
def id(obj), do: obj.id
|
||||||
def routing(_), do: false
|
def routing(_), do: false
|
||||||
def encode(_), do: nil
|
def encode(_), do: %{}
|
||||||
end
|
end
|
||||||
|
|
|
@ -154,10 +154,11 @@ def add_to_index(activity) do
|
||||||
|
|
||||||
with {:ok, res} <- result,
|
with {:ok, res} <- result,
|
||||||
true <- Map.has_key?(res, "taskUid") do
|
true <- Map.has_key?(res, "taskUid") do
|
||||||
# Do nothing
|
{:ok, res}
|
||||||
else
|
else
|
||||||
_ ->
|
err ->
|
||||||
Logger.error("Failed to add activity #{activity.id} to index: #{inspect(result)}")
|
Logger.error("Failed to add activity #{activity.id} to index: #{inspect(result)}")
|
||||||
|
{:error, err}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ defmodule Pleroma.Search.SearchBackend do
|
||||||
|
|
||||||
The whole activity is passed, to allow filtering on things such as scope.
|
The whole activity is passed, to allow filtering on things such as scope.
|
||||||
"""
|
"""
|
||||||
@callback add_to_index(activity :: Pleroma.Activity.t()) :: nil
|
@callback add_to_index(activity :: Pleroma.Activity.t()) :: {:ok, any()} | {:error, any()}
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Remove the object from the index.
|
Remove the object from the index.
|
||||||
|
@ -13,5 +13,5 @@ defmodule Pleroma.Search.SearchBackend do
|
||||||
is what contains the actual content and there is no need for fitlering when removing
|
is what contains the actual content and there is no need for fitlering when removing
|
||||||
from index.
|
from index.
|
||||||
"""
|
"""
|
||||||
@callback remove_from_index(object :: Pleroma.Object.t()) :: nil
|
@callback remove_from_index(object :: Pleroma.Object.t()) :: {:ok, any()} | {:error, any()}
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,7 +27,7 @@ def key_id_to_actor_id(key_id) do
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
case Pleroma.Web.WebFinger.finger(maybe_ap_id) do
|
case Pleroma.Web.WebFinger.finger(maybe_ap_id) do
|
||||||
%{"ap_id" => ap_id} -> {:ok, ap_id}
|
{:ok, %{"ap_id" => ap_id}} -> {:ok, ap_id}
|
||||||
_ -> {:error, maybe_ap_id}
|
_ -> {:error, maybe_ap_id}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -162,7 +162,7 @@ defp prepare_upload(%Plug.Upload{} = file, opts) do
|
||||||
defp prepare_upload(%{img: "data:image/" <> image_data}, opts) do
|
defp prepare_upload(%{img: "data:image/" <> image_data}, opts) do
|
||||||
parsed = Regex.named_captures(~r/(?<filetype>jpeg|png|gif);base64,(?<data>.*)/, image_data)
|
parsed = Regex.named_captures(~r/(?<filetype>jpeg|png|gif);base64,(?<data>.*)/, image_data)
|
||||||
data = Base.decode64!(parsed["data"], ignore: :whitespace)
|
data = Base.decode64!(parsed["data"], ignore: :whitespace)
|
||||||
hash = Base.encode16(:crypto.hash(:sha256, data), lower: true)
|
hash = Base.encode16(:crypto.hash(:sha256, data), case: :lower)
|
||||||
|
|
||||||
with :ok <- check_binary_size(data, opts.size_limit),
|
with :ok <- check_binary_size(data, opts.size_limit),
|
||||||
tmp_path <- tempfile_for_image(data),
|
tmp_path <- tempfile_for_image(data),
|
||||||
|
|
|
@ -77,7 +77,6 @@ defp media_dimensions(file) do
|
||||||
%{width: width, height: height}
|
%{width: width, height: height}
|
||||||
else
|
else
|
||||||
nil -> {:error, {:ffprobe, :command_not_found}}
|
nil -> {:error, {:ffprobe, :command_not_found}}
|
||||||
{:error, _} = error -> error
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,7 @@ defmodule Pleroma.Upload.Filter.Exiftool do
|
||||||
"""
|
"""
|
||||||
@behaviour Pleroma.Upload.Filter
|
@behaviour Pleroma.Upload.Filter
|
||||||
|
|
||||||
@spec filter(Pleroma.Upload.t()) :: {:ok, any()} | {:error, String.t()}
|
@spec filter(Pleroma.Upload.t()) :: {:ok, :noop} | {:ok, :filtered} | {:error, String.t()}
|
||||||
|
|
||||||
# Formats 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/heic"}), do: {:ok, :noop}
|
||||||
|
|
|
@ -38,7 +38,7 @@ defmodule Pleroma.Upload.Filter.Mogrifun do
|
||||||
[{"fill", "yellow"}, {"tint", "40"}]
|
[{"fill", "yellow"}, {"tint", "40"}]
|
||||||
]
|
]
|
||||||
|
|
||||||
@spec filter(Pleroma.Upload.t()) :: {:ok, atom()} | {:error, String.t()}
|
@spec filter(Pleroma.Upload.t()) :: {:ok, :filtered | :noop} | {:error, String.t()}
|
||||||
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
def filter(%Pleroma.Upload{tempfile: file, content_type: "image" <> _}) do
|
||||||
try do
|
try do
|
||||||
Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
|
Filter.Mogrify.do_filter(file, [Enum.random(@filters)])
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
defmodule Pleroma.User do
|
defmodule Pleroma.User do
|
||||||
|
@moduledoc """
|
||||||
|
A user, local or remote
|
||||||
|
"""
|
||||||
|
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
|
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
@ -549,9 +553,17 @@ def update_changeset(struct, params \\ %{}) do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp put_fields(changeset) do
|
defp put_fields(changeset) do
|
||||||
|
# These fields are inconsistent in tests when it comes to binary/atom keys
|
||||||
if raw_fields = get_change(changeset, :raw_fields) do
|
if raw_fields = get_change(changeset, :raw_fields) do
|
||||||
raw_fields =
|
raw_fields =
|
||||||
raw_fields
|
raw_fields
|
||||||
|
|> Enum.map(fn
|
||||||
|
%{name: name, value: value} ->
|
||||||
|
%{"name" => name, "value" => value}
|
||||||
|
|
||||||
|
%{"name" => _} = field ->
|
||||||
|
field
|
||||||
|
end)
|
||||||
|> Enum.filter(fn %{"name" => n} -> n != "" end)
|
|> Enum.filter(fn %{"name" => n} -> n != "" end)
|
||||||
|
|
||||||
fields =
|
fields =
|
||||||
|
@ -705,7 +717,8 @@ def register_changeset_ldap(struct, params = %{password: password})
|
||||||
|> put_private_key()
|
|> put_private_key()
|
||||||
end
|
end
|
||||||
|
|
||||||
def register_changeset(struct, params \\ %{}, opts \\ []) do
|
@spec register_changeset(User.t(), map(), keyword()) :: Changeset.t()
|
||||||
|
def register_changeset(%User{} = struct, params \\ %{}, opts \\ []) do
|
||||||
bio_limit = Config.get([:instance, :user_bio_length], 5000)
|
bio_limit = Config.get([:instance, :user_bio_length], 5000)
|
||||||
name_limit = Config.get([:instance, :user_name_length], 100)
|
name_limit = Config.get([:instance, :user_name_length], 100)
|
||||||
reason_limit = Config.get([:instance, :registration_reason_length], 500)
|
reason_limit = Config.get([:instance, :registration_reason_length], 500)
|
||||||
|
@ -819,12 +832,14 @@ defp autofollowing_users(user) do
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc "Inserts provided changeset, performs post-registration actions (confirmation email sending etc.)"
|
@doc "Inserts provided changeset, performs post-registration actions (confirmation email sending etc.)"
|
||||||
|
@spec register(Changeset.t()) :: {:ok, User.t()} | {:error, any} | nil
|
||||||
def register(%Ecto.Changeset{} = changeset) do
|
def register(%Ecto.Changeset{} = changeset) do
|
||||||
with {:ok, user} <- Repo.insert(changeset) do
|
with {:ok, user} <- Repo.insert(changeset) do
|
||||||
post_register_action(user)
|
post_register_action(user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec post_register_action(User.t()) :: {:error, any} | {:ok, User.t()}
|
||||||
def post_register_action(%User{is_confirmed: false} = user) do
|
def post_register_action(%User{is_confirmed: false} = user) do
|
||||||
with {:ok, _} <- maybe_send_confirmation_email(user) do
|
with {:ok, _} <- maybe_send_confirmation_email(user) do
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
|
@ -939,7 +954,8 @@ def needs_update?(%User{local: false} = user) do
|
||||||
|
|
||||||
def needs_update?(_), do: true
|
def needs_update?(_), do: true
|
||||||
|
|
||||||
@spec maybe_direct_follow(User.t(), User.t()) :: {:ok, User.t()} | {:error, String.t()}
|
@spec maybe_direct_follow(User.t(), User.t()) ::
|
||||||
|
{:ok, User.t(), User.t()} | {:error, String.t()}
|
||||||
|
|
||||||
# "Locked" (self-locked) users demand explicit authorization of follow requests
|
# "Locked" (self-locked) users demand explicit authorization of follow requests
|
||||||
def maybe_direct_follow(%User{} = follower, %User{local: true, is_locked: true} = followed) do
|
def maybe_direct_follow(%User{} = follower, %User{local: true, is_locked: true} = followed) do
|
||||||
|
@ -1072,6 +1088,11 @@ def get_by_guessed_nickname(ap_id) do
|
||||||
get_cached_by_nickname(nickname)
|
get_cached_by_nickname(nickname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec set_cache(
|
||||||
|
{:error, any}
|
||||||
|
| {:ok, User.t()}
|
||||||
|
| User.t()
|
||||||
|
) :: {:ok, User.t()} | {:error, any}
|
||||||
def set_cache({:ok, user}), do: set_cache(user)
|
def set_cache({:ok, user}), do: set_cache(user)
|
||||||
def set_cache({:error, err}), do: {:error, err}
|
def set_cache({:error, err}), do: {:error, err}
|
||||||
|
|
||||||
|
@ -1082,12 +1103,14 @@ def set_cache(%User{} = user) do
|
||||||
{:ok, user}
|
{:ok, user}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec update_and_set_cache(User.t(), map()) :: {:ok, User.t()} | {:error, any}
|
||||||
def update_and_set_cache(struct, params) do
|
def update_and_set_cache(struct, params) do
|
||||||
struct
|
struct
|
||||||
|> update_changeset(params)
|
|> update_changeset(params)
|
||||||
|> update_and_set_cache()
|
|> update_and_set_cache()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec update_and_set_cache(Changeset.t()) :: {:ok, User.t()} | {:error, any}
|
||||||
def update_and_set_cache(%{data: %Pleroma.User{} = user} = changeset) do
|
def update_and_set_cache(%{data: %Pleroma.User{} = user} = changeset) do
|
||||||
was_superuser_before_update = User.superuser?(user)
|
was_superuser_before_update = User.superuser?(user)
|
||||||
|
|
||||||
|
@ -1142,6 +1165,7 @@ def get_cached_by_ap_id(ap_id) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec get_cached_by_id(String.t()) :: nil | Pleroma.User.t()
|
||||||
def get_cached_by_id(id) do
|
def get_cached_by_id(id) do
|
||||||
key = "id:#{id}"
|
key = "id:#{id}"
|
||||||
|
|
||||||
|
@ -2302,6 +2326,7 @@ def add_alias(user, new_alias_user) do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec delete_alias(User.t(), User.t()) :: {:error, :no_such_alias}
|
||||||
def delete_alias(user, alias_user) do
|
def delete_alias(user, alias_user) do
|
||||||
current_aliases = user.also_known_as || []
|
current_aliases = user.also_known_as || []
|
||||||
alias_ap_id = alias_user.ap_id
|
alias_ap_id = alias_user.ap_id
|
||||||
|
@ -2417,7 +2442,7 @@ def confirmation_changeset(user, set_confirmation: confirmed?) do
|
||||||
cast(user, params, [:is_confirmed, :confirmation_token])
|
cast(user, params, [:is_confirmed, :confirmation_token])
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec approval_changeset(User.t(), keyword()) :: Changeset.t()
|
@spec approval_changeset(Changeset.t(), keyword()) :: Changeset.t()
|
||||||
def approval_changeset(user, set_approval: approved?) do
|
def approval_changeset(user, set_approval: approved?) do
|
||||||
cast(user, %{is_approved: approved?}, [:is_approved])
|
cast(user, %{is_approved: approved?}, [:is_approved])
|
||||||
end
|
end
|
||||||
|
@ -2492,15 +2517,19 @@ defp add_to_block(%User{} = user, %User{} = blocked) do
|
||||||
with {:ok, relationship} <- UserRelationship.create_block(user, blocked) do
|
with {:ok, relationship} <- UserRelationship.create_block(user, blocked) do
|
||||||
@cachex.del(:user_cache, "blocked_users_ap_ids:#{user.ap_id}")
|
@cachex.del(:user_cache, "blocked_users_ap_ids:#{user.ap_id}")
|
||||||
{:ok, relationship}
|
{:ok, relationship}
|
||||||
|
else
|
||||||
|
err -> err
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec add_to_block(User.t(), User.t()) ::
|
@spec remove_from_block(User.t(), User.t()) ::
|
||||||
{:ok, UserRelationship.t()} | {:ok, nil} | {:error, Ecto.Changeset.t()}
|
{:ok, UserRelationship.t()} | {:ok, nil} | {:error, Ecto.Changeset.t()}
|
||||||
defp remove_from_block(%User{} = user, %User{} = blocked) do
|
defp remove_from_block(%User{} = user, %User{} = blocked) do
|
||||||
with {:ok, relationship} <- UserRelationship.delete_block(user, blocked) do
|
with {:ok, relationship} <- UserRelationship.delete_block(user, blocked) do
|
||||||
@cachex.del(:user_cache, "blocked_users_ap_ids:#{user.ap_id}")
|
@cachex.del(:user_cache, "blocked_users_ap_ids:#{user.ap_id}")
|
||||||
{:ok, relationship}
|
{:ok, relationship}
|
||||||
|
else
|
||||||
|
err -> err
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,8 @@ def export(%__MODULE__{} = backup) do
|
||||||
:ok <- statuses(dir, backup.user),
|
:ok <- statuses(dir, backup.user),
|
||||||
:ok <- likes(dir, backup.user),
|
:ok <- likes(dir, backup.user),
|
||||||
:ok <- bookmarks(dir, backup.user),
|
:ok <- bookmarks(dir, backup.user),
|
||||||
{:ok, zip_path} <- :zip.create(String.to_charlist(dir <> ".zip"), @files, cwd: dir),
|
{:ok, zip_path} <-
|
||||||
|
:zip.create(String.to_charlist(dir <> ".zip"), @files, cwd: String.to_charlist(dir)),
|
||||||
{:ok, _} <- File.rm_rf(dir) do
|
{:ok, _} <- File.rm_rf(dir) do
|
||||||
{:ok, to_string(zip_path)}
|
{:ok, to_string(zip_path)}
|
||||||
end
|
end
|
||||||
|
|
|
@ -56,7 +56,10 @@ defp skip_plug(conn, plug_modules) do
|
||||||
plug_module.skip_plug(conn)
|
plug_module.skip_plug(conn)
|
||||||
rescue
|
rescue
|
||||||
UndefinedFunctionError ->
|
UndefinedFunctionError ->
|
||||||
raise "`#{plug_module}` is not skippable. Append `use Pleroma.Web, :plug` to its code."
|
reraise(
|
||||||
|
"`#{plug_module}` is not skippable. Append `use Pleroma.Web, :plug` to its code.",
|
||||||
|
__STACKTRACE__
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
|
@ -1531,6 +1531,10 @@ defp normalize_image(%{"url" => url}) do
|
||||||
defp normalize_image(urls) when is_list(urls), do: urls |> List.first() |> normalize_image()
|
defp normalize_image(urls) when is_list(urls), do: urls |> List.first() |> normalize_image()
|
||||||
defp normalize_image(_), do: nil
|
defp normalize_image(_), do: nil
|
||||||
|
|
||||||
|
defp normalize_also_known_as(aka) when is_list(aka), do: aka
|
||||||
|
defp normalize_also_known_as(aka) when is_binary(aka), do: [aka]
|
||||||
|
defp normalize_also_known_as(nil), do: []
|
||||||
|
|
||||||
defp object_to_user_data(data, additional) do
|
defp object_to_user_data(data, additional) do
|
||||||
fields =
|
fields =
|
||||||
data
|
data
|
||||||
|
@ -1576,6 +1580,7 @@ defp object_to_user_data(data, additional) do
|
||||||
also_known_as =
|
also_known_as =
|
||||||
data
|
data
|
||||||
|> Map.get("alsoKnownAs", [])
|
|> Map.get("alsoKnownAs", [])
|
||||||
|
|> normalize_also_known_as()
|
||||||
|> Enum.filter(fn url ->
|
|> Enum.filter(fn url ->
|
||||||
case URI.parse(url) do
|
case URI.parse(url) do
|
||||||
%URI{scheme: "http"} -> true
|
%URI{scheme: "http"} -> true
|
||||||
|
|
|
@ -3,6 +3,8 @@ defmodule Pleroma.Web.AkkomaAPI.TranslationController do
|
||||||
|
|
||||||
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
alias Pleroma.Web.Plugs.OAuthScopesPlug
|
||||||
|
|
||||||
|
require Logger
|
||||||
|
|
||||||
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
@cachex Pleroma.Config.get([:cachex, :provider], Cachex)
|
||||||
|
|
||||||
@unauthenticated_access %{fallback: :proceed_unauthenticated, scopes: []}
|
@unauthenticated_access %{fallback: :proceed_unauthenticated, scopes: []}
|
||||||
|
@ -26,8 +28,12 @@ def languages(conn, _params) do
|
||||||
conn
|
conn
|
||||||
|> json(%{source: source_languages, target: dest_languages})
|
|> json(%{source: source_languages, target: dest_languages})
|
||||||
else
|
else
|
||||||
{:enabled, false} -> json(conn, %{})
|
{:enabled, false} ->
|
||||||
e -> IO.inspect(e)
|
json(conn, %{})
|
||||||
|
|
||||||
|
e ->
|
||||||
|
Logger.error("Translation language list error: #{inspect(e)}")
|
||||||
|
{:error, e}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -231,9 +231,18 @@ defp emoji_packs_response do
|
||||||
"application/json",
|
"application/json",
|
||||||
%Schema{
|
%Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
additionalProperties: emoji_pack(),
|
properties: %{
|
||||||
|
count: %Schema{type: :integer},
|
||||||
|
packs: %Schema{
|
||||||
|
type: :object,
|
||||||
|
additionalProperties: emoji_pack()
|
||||||
|
}
|
||||||
|
},
|
||||||
example: %{
|
example: %{
|
||||||
"emojos" => emoji_pack().example
|
"count" => 4,
|
||||||
|
"packs" => %{
|
||||||
|
"emojos" => emoji_pack().example
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -60,6 +60,8 @@ def get_registration(%Plug.Conn{
|
||||||
def get_registration(%Plug.Conn{} = _conn), do: {:error, :missing_credentials}
|
def get_registration(%Plug.Conn{} = _conn), do: {:error, :missing_credentials}
|
||||||
|
|
||||||
@doc "Creates Pleroma.User record basing on params and Pleroma.Registration record."
|
@doc "Creates Pleroma.User record basing on params and Pleroma.Registration record."
|
||||||
|
@spec create_from_registration(Plug.Conn.t(), Registration.t()) ::
|
||||||
|
{:ok, User.t()} | {:error, any()}
|
||||||
def create_from_registration(
|
def create_from_registration(
|
||||||
%Plug.Conn{params: %{"authorization" => registration_attrs}},
|
%Plug.Conn{params: %{"authorization" => registration_attrs}},
|
||||||
%Registration{} = registration
|
%Registration{} = registration
|
||||||
|
@ -89,6 +91,8 @@ def create_from_registration(
|
||||||
{:ok, _} <-
|
{:ok, _} <-
|
||||||
Registration.changeset(registration, %{user_id: new_user.id}) |> Repo.update() do
|
Registration.changeset(registration, %{user_id: new_user.id}) |> Repo.update() do
|
||||||
{:ok, new_user}
|
{:ok, new_user}
|
||||||
|
else
|
||||||
|
err -> err
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -87,16 +87,18 @@ def get_pagination_fields(conn, entries, extra_params \\ %{}) do
|
||||||
|
|
||||||
def assign_account_by_id(conn, _) do
|
def assign_account_by_id(conn, _) do
|
||||||
case Pleroma.User.get_cached_by_id(conn.params.id) do
|
case Pleroma.User.get_cached_by_id(conn.params.id) do
|
||||||
%Pleroma.User{} = account -> assign(conn, :account, account)
|
%Pleroma.User{} = account ->
|
||||||
nil -> Pleroma.Web.MastodonAPI.FallbackController.call(conn, {:error, :not_found}) |> halt()
|
assign(conn, :account, account)
|
||||||
|
|
||||||
|
nil ->
|
||||||
|
Pleroma.Web.MastodonAPI.FallbackController.call(conn, {:error, :not_found})
|
||||||
|
|> halt()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec try_render(Plug.Conn.t(), any, any) :: Plug.Conn.t()
|
||||||
def try_render(conn, target, params) when is_binary(target) do
|
def try_render(conn, target, params) when is_binary(target) do
|
||||||
case render(conn, target, params) do
|
render(conn, target, params)
|
||||||
nil -> render_error(conn, :not_implemented, "Can't display this activity")
|
|
||||||
res -> res
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_render(conn, _, _) do
|
def try_render(conn, _, _) do
|
||||||
|
|
|
@ -123,7 +123,7 @@ defmodule Pleroma.Web.Endpoint do
|
||||||
plug(Plug.Parsers,
|
plug(Plug.Parsers,
|
||||||
parsers: [
|
parsers: [
|
||||||
:urlencoded,
|
:urlencoded,
|
||||||
{:multipart, length: {Config, :get, [[:instance, :upload_limit]]}},
|
Pleroma.Web.Plugs.Parsers.Multipart,
|
||||||
:json
|
:json
|
||||||
],
|
],
|
||||||
pass: ["*/*"],
|
pass: ["*/*"],
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# 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
|
|
|
@ -30,6 +30,10 @@ def scrub_html_and_truncate(%{data: %{"content" => content}} = object) do
|
||||||
|> scrub_html_and_truncate_object_field(object)
|
|> scrub_html_and_truncate_object_field(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def scrub_html_and_truncate(%{data: _}) do
|
||||||
|
""
|
||||||
|
end
|
||||||
|
|
||||||
def scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do
|
def scrub_html_and_truncate(content, max_length \\ 200) when is_binary(content) do
|
||||||
content
|
content
|
||||||
|> scrub_html
|
|> scrub_html
|
||||||
|
|
|
@ -558,10 +558,9 @@ def register(%Plug.Conn{} = conn, %{"authorization" => _, "op" => "register"} =
|
||||||
else
|
else
|
||||||
{:error, changeset} ->
|
{:error, changeset} ->
|
||||||
message =
|
message =
|
||||||
Enum.map(changeset.errors, fn {field, {error, _}} ->
|
Enum.map_join(changeset.errors, "; ", fn {field, {error, _}} ->
|
||||||
"#{field} #{error}"
|
"#{field} #{error}"
|
||||||
end)
|
end)
|
||||||
|> Enum.join("; ")
|
|
||||||
|
|
||||||
message =
|
message =
|
||||||
String.replace(
|
String.replace(
|
||||||
|
|
21
lib/pleroma/web/plugs/parsers/multipart.ex
Normal file
21
lib/pleroma/web/plugs/parsers/multipart.ex
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
defmodule Pleroma.Web.Plugs.Parsers.Multipart do
|
||||||
|
@multipart Plug.Parsers.MULTIPART
|
||||||
|
|
||||||
|
alias Pleroma.Config
|
||||||
|
|
||||||
|
def init(opts) do
|
||||||
|
opts
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse(conn, "multipart", subtype, headers, opts) do
|
||||||
|
length = Config.get([:instance, :upload_limit])
|
||||||
|
|
||||||
|
opts = @multipart.init([length: length] ++ opts)
|
||||||
|
|
||||||
|
@multipart.parse(conn, "multipart", subtype, headers, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse(conn, _type, _subtype, _headers, _opts) do
|
||||||
|
{:next, conn}
|
||||||
|
end
|
||||||
|
end
|
|
@ -8,7 +8,6 @@ defmodule Pleroma.Web.Plugs.RemoteIp do
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Pleroma.Config
|
alias Pleroma.Config
|
||||||
import Plug.Conn
|
|
||||||
|
|
||||||
@behaviour Plug
|
@behaviour Plug
|
||||||
|
|
||||||
|
@ -16,15 +15,21 @@ def init(_), do: nil
|
||||||
|
|
||||||
def call(%{remote_ip: original_remote_ip} = conn, _) do
|
def call(%{remote_ip: original_remote_ip} = conn, _) do
|
||||||
if Config.get([__MODULE__, :enabled]) do
|
if Config.get([__MODULE__, :enabled]) do
|
||||||
%{remote_ip: new_remote_ip} = conn = RemoteIp.call(conn, remote_ip_opts())
|
{headers, proxies} = remote_ip_opts()
|
||||||
assign(conn, :remote_ip_found, original_remote_ip != new_remote_ip)
|
new_remote_ip = RemoteIp.from(conn.req_headers, headers: headers, proxies: proxies)
|
||||||
|
|
||||||
|
if new_remote_ip != original_remote_ip do
|
||||||
|
Map.put(conn, :remote_ip, new_remote_ip)
|
||||||
|
else
|
||||||
|
conn
|
||||||
|
end
|
||||||
else
|
else
|
||||||
conn
|
conn
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp remote_ip_opts do
|
defp remote_ip_opts do
|
||||||
headers = Config.get([__MODULE__, :headers], []) |> MapSet.new()
|
headers = Config.get([__MODULE__, :headers], [])
|
||||||
reserved = Config.get([__MODULE__, :reserved], [])
|
reserved = Config.get([__MODULE__, :reserved], [])
|
||||||
|
|
||||||
proxies =
|
proxies =
|
||||||
|
@ -36,13 +41,10 @@ defp remote_ip_opts do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp maybe_add_cidr(proxy) when is_binary(proxy) do
|
defp maybe_add_cidr(proxy) when is_binary(proxy) do
|
||||||
proxy =
|
cond do
|
||||||
cond do
|
"/" in String.codepoints(proxy) -> proxy
|
||||||
"/" in String.codepoints(proxy) -> proxy
|
InetCidr.v4?(InetCidr.parse_address!(proxy)) -> proxy <> "/32"
|
||||||
InetCidr.v4?(InetCidr.parse_address!(proxy)) -> proxy <> "/32"
|
InetCidr.v6?(InetCidr.parse_address!(proxy)) -> proxy <> "/128"
|
||||||
InetCidr.v6?(InetCidr.parse_address!(proxy)) -> proxy <> "/128"
|
end
|
||||||
end
|
|
||||||
|
|
||||||
InetCidr.parse(proxy, true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -906,8 +906,6 @@ defmodule Pleroma.Web.Router do
|
||||||
scope "/", Pleroma.Web.Fallback do
|
scope "/", Pleroma.Web.Fallback do
|
||||||
get("/registration/:token", RedirectController, :registration_page)
|
get("/registration/:token", RedirectController, :registration_page)
|
||||||
get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
|
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)
|
get("/*path", RedirectController, :redirector_with_preload)
|
||||||
|
|
||||||
options("/*path", RedirectController, :empty)
|
options("/*path", RedirectController, :empty)
|
||||||
|
|
|
@ -150,7 +150,10 @@ def remote_subscribe(conn, %{"status" => %{"status_id" => id, "profile" => profi
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_interaction(%{body_params: %{ap_id: ap_id, profile: profile}} = conn, _params) do
|
def remote_interaction(
|
||||||
|
%Plug.Conn{body_params: %{ap_id: ap_id, profile: profile}} = conn,
|
||||||
|
_params
|
||||||
|
) do
|
||||||
with {:ok, %{"subscribe_address" => template}} <- WebFinger.finger(profile) do
|
with {:ok, %{"subscribe_address" => template}} <- WebFinger.finger(profile) do
|
||||||
conn
|
conn
|
||||||
|> json(%{url: String.replace(template, "{uri}", ap_id)})
|
|> json(%{url: String.replace(template, "{uri}", ap_id)})
|
||||||
|
|
|
@ -100,6 +100,7 @@ defp domain do
|
||||||
Pleroma.Config.get([__MODULE__, :domain]) || Pleroma.Web.Endpoint.host()
|
Pleroma.Config.get([__MODULE__, :domain]) || Pleroma.Web.Endpoint.host()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@spec webfinger_from_xml(binary()) :: {:ok, map()} | nil
|
||||||
defp webfinger_from_xml(body) do
|
defp webfinger_from_xml(body) do
|
||||||
with {:ok, doc} <- XML.parse_document(body) do
|
with {:ok, doc} <- XML.parse_document(body) do
|
||||||
subject = XML.string_from_xpath("//Subject", doc)
|
subject = XML.string_from_xpath("//Subject", doc)
|
||||||
|
|
|
@ -36,7 +36,7 @@ def webfinger(%{assigns: %{format: format}} = conn, %{"resource" => resource})
|
||||||
else
|
else
|
||||||
_e ->
|
_e ->
|
||||||
conn
|
conn
|
||||||
|> put_status(404)
|
|> put_status(:not_found)
|
||||||
|> json("Couldn't find user")
|
|> json("Couldn't find user")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
49
mix.exs
49
mix.exs
|
@ -7,7 +7,7 @@ def project do
|
||||||
version: version("3.5.0"),
|
version: version("3.5.0"),
|
||||||
elixir: "~> 1.12",
|
elixir: "~> 1.12",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
compilers: [:phoenix] ++ Mix.compilers(),
|
||||||
elixirc_options: [warnings_as_errors: warnings_as_errors()],
|
elixirc_options: [warnings_as_errors: warnings_as_errors()],
|
||||||
xref: [exclude: [:eldap]],
|
xref: [exclude: [:eldap]],
|
||||||
start_permanent: Mix.env() == :prod,
|
start_permanent: Mix.env() == :prod,
|
||||||
|
@ -94,7 +94,8 @@ defp warnings_as_errors, do: System.get_env("CI") == "true"
|
||||||
# Specifies OAuth dependencies.
|
# Specifies OAuth dependencies.
|
||||||
defp oauth_deps do
|
defp oauth_deps do
|
||||||
oauth_strategy_packages =
|
oauth_strategy_packages =
|
||||||
System.get_env("OAUTH_CONSUMER_STRATEGIES")
|
"OAUTH_CONSUMER_STRATEGIES"
|
||||||
|
|> System.get_env()
|
||||||
|> to_string()
|
|> to_string()
|
||||||
|> String.split()
|
|> String.split()
|
||||||
|> Enum.map(fn strategy_entry ->
|
|> Enum.map(fn strategy_entry ->
|
||||||
|
@ -113,32 +114,29 @@ defp oauth_deps do
|
||||||
# Type `mix help deps` for examples and options.
|
# Type `mix help deps` for examples and options.
|
||||||
defp deps do
|
defp deps do
|
||||||
[
|
[
|
||||||
{:phoenix, "~> 1.6.11"},
|
{:phoenix, "~> 1.6.15"},
|
||||||
{:tzdata, "~> 1.1.1"},
|
{:tzdata, "~> 1.1.1"},
|
||||||
{:plug_cowboy, "~> 2.5"},
|
{:plug_cowboy, "~> 2.6"},
|
||||||
{:phoenix_pubsub, "~> 2.1"},
|
{:phoenix_pubsub, "~> 2.1"},
|
||||||
{:phoenix_ecto, "~> 4.4"},
|
{:phoenix_ecto, "~> 4.4"},
|
||||||
|
{:inet_cidr, "~> 1.0.0"},
|
||||||
{:ecto_enum, "~> 1.4"},
|
{:ecto_enum, "~> 1.4"},
|
||||||
{:ecto_sql, "~> 3.9.0"},
|
{:ecto_sql, "~> 3.9.0"},
|
||||||
{:postgrex, ">= 0.16.3"},
|
{:postgrex, ">= 0.16.3"},
|
||||||
{:oban, "~> 2.12.1"},
|
{:oban, "~> 2.12.1"},
|
||||||
{:gettext,
|
{:gettext, "~> 0.20.0"},
|
||||||
git: "https://github.com/tusooa/gettext.git",
|
|
||||||
ref: "72fb2496b6c5280ed911bdc3756890e7f38a4808",
|
|
||||||
override: true},
|
|
||||||
{:bcrypt_elixir, "~> 2.2"},
|
{:bcrypt_elixir, "~> 2.2"},
|
||||||
{:trailing_format_plug, "~> 0.0.7"},
|
|
||||||
{:fast_sanitize, "~> 0.2.3"},
|
{:fast_sanitize, "~> 0.2.3"},
|
||||||
{:html_entities, "~> 0.5", override: true},
|
{:html_entities, "~> 0.5"},
|
||||||
{:phoenix_html, "~> 3.1", override: true},
|
{:phoenix_html, "~> 3.2"},
|
||||||
{:calendar, "~> 1.0"},
|
{:calendar, "~> 1.0"},
|
||||||
{:cachex, "~> 3.4"},
|
{:cachex, "~> 3.4"},
|
||||||
{:poison, "~> 5.0", override: true},
|
{:tesla, "~> 1.4.4"},
|
||||||
{:tesla, "~> 1.4.4", override: true},
|
|
||||||
{:castore, "~> 0.1"},
|
{:castore, "~> 0.1"},
|
||||||
{:cowlib, "~> 2.9", override: true},
|
{:cowlib, "~> 2.9"},
|
||||||
{:finch, "~> 0.14.0"},
|
{:finch, "~> 0.14.0"},
|
||||||
{:jason, "~> 1.2"},
|
{:jason, "~> 1.2"},
|
||||||
|
{:trailing_format_plug, "~> 0.0.7"},
|
||||||
{:mogrify, "~> 0.9.1"},
|
{:mogrify, "~> 0.9.1"},
|
||||||
{:ex_aws, "~> 2.1.6"},
|
{:ex_aws, "~> 2.1.6"},
|
||||||
{:ex_aws_s3, "~> 2.0"},
|
{:ex_aws_s3, "~> 2.0"},
|
||||||
|
@ -172,39 +170,40 @@ defp deps do
|
||||||
{:plug_static_index_html, "~> 1.0.0"},
|
{:plug_static_index_html, "~> 1.0.0"},
|
||||||
{:flake_id, "~> 0.1.0"},
|
{:flake_id, "~> 0.1.0"},
|
||||||
{:concurrent_limiter, "~> 0.1.1"},
|
{:concurrent_limiter, "~> 0.1.1"},
|
||||||
{:remote_ip,
|
{:remote_ip, "~> 1.1.0"},
|
||||||
git: "https://git.pleroma.social/pleroma/remote_ip.git",
|
|
||||||
ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"},
|
|
||||||
{:captcha,
|
{:captcha,
|
||||||
git: "https://git.pleroma.social/pleroma/elixir-libraries/elixir-captcha.git",
|
git: "https://git.pleroma.social/pleroma/elixir-libraries/elixir-captcha.git",
|
||||||
ref: "e0f16822d578866e186a0974d65ad58cddc1e2ab"},
|
ref: "e0f16822d578866e186a0974d65ad58cddc1e2ab"},
|
||||||
{:restarter, path: "./restarter"},
|
{:restarter, path: "./restarter"},
|
||||||
{:majic, "~> 1.0"},
|
{:majic, "~> 1.0"},
|
||||||
{:eblurhash, "~> 1.2.2"},
|
{:eblurhash, "~> 1.2.2"},
|
||||||
{:open_api_spex, "3.10.0"},
|
{:open_api_spex, "~> 3.16.0"},
|
||||||
{:search_parser,
|
{:search_parser,
|
||||||
git: "https://github.com/FloatingGhost/pleroma-contrib-search-parser.git",
|
git: "https://github.com/FloatingGhost/pleroma-contrib-search-parser.git",
|
||||||
ref: "08971a81e68686f9ac465cfb6661d51c5e4e1e7f"},
|
ref: "08971a81e68686f9ac465cfb6661d51c5e4e1e7f"},
|
||||||
{:nimble_parsec, "~> 1.0", override: true},
|
{:nimble_parsec, "~> 1.0", override: true},
|
||||||
{:phoenix_live_dashboard, "~> 0.6.2"},
|
{:phoenix_live_dashboard, "~> 0.7.2"},
|
||||||
{:ecto_psql_extras, "~> 0.6"},
|
{:ecto_psql_extras, "~> 0.6"},
|
||||||
{:elasticsearch,
|
{:elasticsearch,
|
||||||
git: "https://akkoma.dev/AkkomaGang/elasticsearch-elixir.git", ref: "main"},
|
git: "https://akkoma.dev/AkkomaGang/elasticsearch-elixir.git", ref: "main"},
|
||||||
{:mfm_parser,
|
{:mfm_parser,
|
||||||
git: "https://akkoma.dev/AkkomaGang/mfm-parser.git",
|
git: "https://akkoma.dev/AkkomaGang/mfm-parser.git",
|
||||||
ref: "912fba81152d4d572e457fd5427f9875b2bc3dbe"},
|
ref: "912fba81152d4d572e457fd5427f9875b2bc3dbe"},
|
||||||
|
{:poison, ">= 0.0.0"},
|
||||||
# indirect dependency version override
|
|
||||||
{:plug, "~> 1.10.4", override: true},
|
|
||||||
|
|
||||||
## dev & test
|
## dev & test
|
||||||
{:ex_doc, "~> 0.22", only: :dev, runtime: false},
|
{:ex_doc, "~> 0.22", only: :dev, runtime: false},
|
||||||
{:ex_machina, "~> 2.4", only: :test},
|
{:ex_machina, "~> 2.4", only: :test},
|
||||||
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
|
{:credo,
|
||||||
|
git: "https://github.com/rrrene/credo.git",
|
||||||
|
ref: "1c1b99ea41a457761383d81aaf6a606913996fe7",
|
||||||
|
only: [:dev, :test],
|
||||||
|
runtime: false},
|
||||||
{:mock, "~> 0.3.5", only: :test},
|
{:mock, "~> 0.3.5", only: :test},
|
||||||
{:excoveralls, "0.15.1", only: :test},
|
{:excoveralls, "0.15.1", only: :test},
|
||||||
{:mox, "~> 1.0", only: :test},
|
{:mox, "~> 1.0", only: :test},
|
||||||
{:websockex, "~> 0.4.3", only: :test}
|
{:websockex, "~> 0.4.3", only: :test},
|
||||||
|
{:dialyxir, "~> 1.0", only: [:dev], runtime: false}
|
||||||
] ++ oauth_deps()
|
] ++ oauth_deps()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -336,7 +335,7 @@ defp add_copyright(_) do
|
||||||
# Pleroma: A lightweight social networking server
|
# Pleroma: A lightweight social networking server
|
||||||
# Copyright © 2017-#{year} Pleroma Authors <https://pleroma.social/>
|
# Copyright © 2017-#{year} Pleroma Authors <https://pleroma.social/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
# Akkoma: The cooler pleroma
|
# Akkoma: Magically expressive social media
|
||||||
# Copyright © 2022-#{year} Akkoma Authors <https://akkoma.dev/>
|
# Copyright © 2022-#{year} Akkoma Authors <https://akkoma.dev/>
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
|
21
mix.lock
21
mix.lock
|
@ -17,13 +17,14 @@
|
||||||
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
|
"cowboy": {:hex, :cowboy, "2.9.0", "865dd8b6607e14cf03282e10e934023a1bd8be6f6bacf921a7e2a96d800cd452", [:make, :rebar3], [{:cowlib, "2.11.0", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "2c729f934b4e1aa149aff882f57c6372c15399a20d54f65c8d67bef583021bde"},
|
||||||
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"},
|
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"},
|
||||||
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
|
"cowlib": {:hex, :cowlib, "2.11.0", "0b9ff9c346629256c42ebe1eeb769a83c6cb771a6ee5960bd110ab0b9b872063", [:make, :rebar3], [], "hexpm", "2b3e9da0b21c4565751a6d4901c20d1b4cc25cbb7fd50d91d2ab6dd287bc86a9"},
|
||||||
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"},
|
"credo": {:git, "https://github.com/rrrene/credo.git", "1c1b99ea41a457761383d81aaf6a606913996fe7", [ref: "1c1b99ea41a457761383d81aaf6a606913996fe7"]},
|
||||||
"crypt": {:git, "https://github.com/msantos/crypt.git", "f75cd55325e33cbea198fb41fe41871392f8fb76", [ref: "f75cd55325e33cbea198fb41fe41871392f8fb76"]},
|
"crypt": {:git, "https://github.com/msantos/crypt.git", "f75cd55325e33cbea198fb41fe41871392f8fb76", [ref: "f75cd55325e33cbea198fb41fe41871392f8fb76"]},
|
||||||
"custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"},
|
"custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"},
|
||||||
"db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
|
"db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
|
||||||
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
|
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
|
||||||
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
|
"deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
|
||||||
"earmark": {:hex, :earmark, "1.4.33", "2b33a505180583f98bfa17317f03973b52081bdb24a11be05a7f4fa6d64dd8bf", [:mix], [{:earmark_parser, "~> 1.4.29", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "21b31363d6a0a70802cfbaf2de88355778aa76654298a072bce2e01d1858ae06"},
|
"dialyxir": {:hex, :dialyxir, "1.2.0", "58344b3e87c2e7095304c81a9ae65cb68b613e28340690dfe1a5597fd08dec37", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "61072136427a851674cab81762be4dbeae7679f85b1272b6d25c3a839aff8463"},
|
||||||
|
"earmark": {:hex, :earmark, "1.4.34", "d7f89d3bbd7567a0bffc465e0a949f8f8dcbe43909c3acf96f4761a302cea10c", [:mix], [{:earmark_parser, "~> 1.4.29", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "90b106f3dad85b133b10d7d628167c88246123fd1cecb4557d83d21ec9e65504"},
|
||||||
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
|
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
|
||||||
"eblurhash": {:hex, :eblurhash, "1.2.2", "7da4255aaea984b31bb71155f673257353b0e0554d0d30dcf859547e74602582", [:rebar3], [], "hexpm", "8c20ca00904de023a835a9dcb7b7762fed32264c85a80c3cafa85288e405044c"},
|
"eblurhash": {:hex, :eblurhash, "1.2.2", "7da4255aaea984b31bb71155f673257353b0e0554d0d30dcf859547e74602582", [:rebar3], [], "hexpm", "8c20ca00904de023a835a9dcb7b7762fed32264c85a80c3cafa85288e405044c"},
|
||||||
"ecto": {:hex, :ecto, "3.9.2", "017db3bc786ff64271108522c01a5d3f6ba0aea5c84912cfb0dd73bf13684108", [: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 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21466d5177e09e55289ac7eade579a642578242c7a3a9f91ad5c6583337a9d15"},
|
"ecto": {:hex, :ecto, "3.9.2", "017db3bc786ff64271108522c01a5d3f6ba0aea5c84912cfb0dd73bf13684108", [: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 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21466d5177e09e55289ac7eade579a642578242c7a3a9f91ad5c6583337a9d15"},
|
||||||
|
@ -32,6 +33,7 @@
|
||||||
"ecto_sql": {:hex, :ecto_sql, "3.9.1", "9bd5894eecc53d5b39d0c95180d4466aff00e10679e13a5cfa725f6f85c03c22", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5fd470a4fff2e829bbf9dcceb7f3f9f6d1e49b4241e802f614de6b8b67c51118"},
|
"ecto_sql": {:hex, :ecto_sql, "3.9.1", "9bd5894eecc53d5b39d0c95180d4466aff00e10679e13a5cfa725f6f85c03c22", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5fd470a4fff2e829bbf9dcceb7f3f9f6d1e49b4241e802f614de6b8b67c51118"},
|
||||||
"elasticsearch": {:git, "https://akkoma.dev/AkkomaGang/elasticsearch-elixir.git", "6cd946f75f6ab9042521a009d1d32d29a90113ca", [ref: "main"]},
|
"elasticsearch": {:git, "https://akkoma.dev/AkkomaGang/elasticsearch-elixir.git", "6cd946f75f6ab9042521a009d1d32d29a90113ca", [ref: "main"]},
|
||||||
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"},
|
"elixir_make": {:hex, :elixir_make, "0.6.3", "bc07d53221216838d79e03a8019d0839786703129599e9619f4ab74c8c096eac", [:mix], [], "hexpm", "f5cbd651c5678bcaabdbb7857658ee106b12509cd976c2c2fca99688e1daf716"},
|
||||||
|
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
|
||||||
"eternal": {:hex, :eternal, "1.2.2", "d1641c86368de99375b98d183042dd6c2b234262b8d08dfd72b9eeaafc2a1abd", [:mix], [], "hexpm", "2c9fe32b9c3726703ba5e1d43a1d255a4f3f2d8f8f9bc19f094c7cb1a7a9e782"},
|
"eternal": {:hex, :eternal, "1.2.2", "d1641c86368de99375b98d183042dd6c2b234262b8d08dfd72b9eeaafc2a1abd", [:mix], [], "hexpm", "2c9fe32b9c3726703ba5e1d43a1d255a4f3f2d8f8f9bc19f094c7cb1a7a9e782"},
|
||||||
"ex_aws": {:hex, :ex_aws, "2.1.9", "dc4865ecc20a05190a34a0ac5213e3e5e2b0a75a0c2835e923ae7bfeac5e3c31", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "3e6c776703c9076001fbe1f7c049535f042cb2afa0d2cbd3b47cbc4e92ac0d10"},
|
"ex_aws": {:hex, :ex_aws, "2.1.9", "dc4865ecc20a05190a34a0ac5213e3e5e2b0a75a0c2835e923ae7bfeac5e3c31", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "3e6c776703c9076001fbe1f7c049535f042cb2afa0d2cbd3b47cbc4e92ac0d10"},
|
||||||
"ex_aws_s3": {:hex, :ex_aws_s3, "2.3.3", "61412e524616ea31d3f31675d8bc4c73f277e367dee0ae8245610446f9b778aa", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "0044f0b6f9ce925666021eafd630de64c2b3404d79c85245cc7c8a9a32d7f104"},
|
"ex_aws_s3": {:hex, :ex_aws_s3, "2.3.3", "61412e524616ea31d3f31675d8bc4c73f277e367dee0ae8245610446f9b778aa", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "0044f0b6f9ce925666021eafd630de64c2b3404d79c85245cc7c8a9a32d7f104"},
|
||||||
|
@ -47,7 +49,7 @@
|
||||||
"flake_id": {:hex, :flake_id, "0.1.0", "7716b086d2e405d09b647121a166498a0d93d1a623bead243e1f74216079ccb3", [:mix], [{:base62, "~> 1.2", [hex: :base62, repo: "hexpm", optional: false]}, {:ecto, ">= 2.0.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "31fc8090fde1acd267c07c36ea7365b8604055f897d3a53dd967658c691bd827"},
|
"flake_id": {:hex, :flake_id, "0.1.0", "7716b086d2e405d09b647121a166498a0d93d1a623bead243e1f74216079ccb3", [:mix], [{:base62, "~> 1.2", [hex: :base62, repo: "hexpm", optional: false]}, {:ecto, ">= 2.0.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm", "31fc8090fde1acd267c07c36ea7365b8604055f897d3a53dd967658c691bd827"},
|
||||||
"floki": {:hex, :floki, "0.34.0", "002d0cc194b48794d74711731db004fafeb328fe676976f160685262d43706a8", [:mix], [], "hexpm", "9c3a9f43f40dde00332a589bd9d389b90c1f518aef500364d00636acc5ebc99c"},
|
"floki": {:hex, :floki, "0.34.0", "002d0cc194b48794d74711731db004fafeb328fe676976f160685262d43706a8", [:mix], [], "hexpm", "9c3a9f43f40dde00332a589bd9d389b90c1f518aef500364d00636acc5ebc99c"},
|
||||||
"gen_smtp": {:hex, :gen_smtp, "0.15.0", "9f51960c17769b26833b50df0b96123605a8024738b62db747fece14eb2fbfcc", [:rebar3], [], "hexpm", "29bd14a88030980849c7ed2447b8db6d6c9278a28b11a44cafe41b791205440f"},
|
"gen_smtp": {:hex, :gen_smtp, "0.15.0", "9f51960c17769b26833b50df0b96123605a8024738b62db747fece14eb2fbfcc", [:rebar3], [], "hexpm", "29bd14a88030980849c7ed2447b8db6d6c9278a28b11a44cafe41b791205440f"},
|
||||||
"gettext": {:git, "https://github.com/tusooa/gettext.git", "72fb2496b6c5280ed911bdc3756890e7f38a4808", [ref: "72fb2496b6c5280ed911bdc3756890e7f38a4808"]},
|
"gettext": {:hex, :gettext, "0.20.0", "75ad71de05f2ef56991dbae224d35c68b098dd0e26918def5bb45591d5c8d429", [:mix], [], "hexpm", "1c03b177435e93a47441d7f681a7040bd2a816ece9e2666d1c9001035121eb3d"},
|
||||||
"hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},
|
"hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"},
|
||||||
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
|
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
|
||||||
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
|
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
|
||||||
|
@ -78,18 +80,18 @@
|
||||||
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
|
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
|
||||||
"nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"},
|
"nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"},
|
||||||
"oban": {:hex, :oban, "2.12.1", "f604d7e6a8be9fda4a9b0f6cebbd633deba569f85dbff70c4d25d99a6f023177", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9b1844c2b74e0d788b73e5144b0c9d5674cb775eae29d88a36f3c3b48d42d058"},
|
"oban": {:hex, :oban, "2.12.1", "f604d7e6a8be9fda4a9b0f6cebbd633deba569f85dbff70c4d25d99a6f023177", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "9b1844c2b74e0d788b73e5144b0c9d5674cb775eae29d88a36f3c3b48d42d058"},
|
||||||
"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"},
|
"open_api_spex": {:hex, :open_api_spex, "3.16.0", "9843af4e87550cd8ac5821b10e4c74f1d51f0d4e3310f824d780614743423b25", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 3.0 or ~> 4.0 or ~> 5.0", [hex: :poison, repo: "hexpm", optional: true]}, {:ymlr, "~> 2.0 or ~> 3.0", [hex: :ymlr, repo: "hexpm", optional: true]}], "hexpm", "bb0be24a648b73e8fc8cbda17f514b8486262275e8b33e8b5ae66283df972129"},
|
||||||
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
|
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
|
||||||
"phoenix": {:hex, :phoenix, "1.6.15", "0a1d96bbc10747fd83525370d691953cdb6f3ccbac61aa01b4acb012474b047d", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d70ab9fbf6b394755ea88b644d34d79d8b146e490973151f248cacd122d20672"},
|
"phoenix": {:hex, :phoenix, "1.6.15", "0a1d96bbc10747fd83525370d691953cdb6f3ccbac61aa01b4acb012474b047d", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d70ab9fbf6b394755ea88b644d34d79d8b146e490973151f248cacd122d20672"},
|
||||||
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"},
|
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"},
|
||||||
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
|
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
|
||||||
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.6.5", "1495bb014be12c9a9252eca04b9af54246f6b5c1e4cd1f30210cd00ec540cf8e", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.3", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.7", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "ef4fa50dd78364409039c99cf6f98ab5209b4c5f8796c17f4db118324f0db852"},
|
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.7.2", "97cc4ff2dba1ebe504db72cb45098cb8e91f11160528b980bd282cc45c73b29c", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.18.3", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "0e5fdf063c7a3b620c566a30fcf68b7ee02e5e46fe48ee46a6ec3ba382dc05b7"},
|
||||||
"phoenix_live_view": {:hex, :phoenix_live_view, "0.17.12", "74f4c0ad02d7deac2d04f50b52827a5efdc5c6e7fac5cede145f5f0e4183aedc", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.0 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "af6dd5e0aac16ff43571f527a8e0616d62cb80b10eb87aac82170243e50d99c8"},
|
"phoenix_live_view": {:hex, :phoenix_live_view, "0.18.3", "2e3d009422addf8b15c3dccc65ce53baccbe26f7cfd21d264680b5867789a9c1", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.1", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c8845177a866e017dcb7083365393c8f00ab061b8b6b2bda575891079dce81b2"},
|
||||||
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
|
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
|
||||||
"phoenix_swoosh": {:hex, :phoenix_swoosh, "0.3.4", "615f8f393135de7e0cbb4bd00ba238b1e0cd324b0d90efbaee613c2f02ca5e5c", [:mix], [{:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:swoosh, "~> 1.0", [hex: :swoosh, repo: "hexpm", optional: false]}], "hexpm", "3971221846232021ab5e3c7489fd62ec5bfd6a2e01cae10a317ccf6fb350571c"},
|
"phoenix_swoosh": {:hex, :phoenix_swoosh, "0.3.4", "615f8f393135de7e0cbb4bd00ba238b1e0cd324b0d90efbaee613c2f02ca5e5c", [:mix], [{:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:swoosh, "~> 1.0", [hex: :swoosh, repo: "hexpm", optional: false]}], "hexpm", "3971221846232021ab5e3c7489fd62ec5bfd6a2e01cae10a317ccf6fb350571c"},
|
||||||
"phoenix_template": {:hex, :phoenix_template, "1.0.0", "c57bc5044f25f007dc86ab21895688c098a9f846a8dda6bc40e2d0ddc146e38f", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "1b066f99a26fd22064c12b2600a9a6e56700f591bf7b20b418054ea38b4d4357"},
|
"phoenix_template": {:hex, :phoenix_template, "1.0.0", "c57bc5044f25f007dc86ab21895688c098a9f846a8dda6bc40e2d0ddc146e38f", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "1b066f99a26fd22064c12b2600a9a6e56700f591bf7b20b418054ea38b4d4357"},
|
||||||
"phoenix_view": {:hex, :phoenix_view, "2.0.2", "6bd4d2fd595ef80d33b439ede6a19326b78f0f1d8d62b9a318e3d9c1af351098", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "a929e7230ea5c7ee0e149ffcf44ce7cf7f4b6d2bfe1752dd7c084cdff152d36f"},
|
"phoenix_view": {:hex, :phoenix_view, "2.0.2", "6bd4d2fd595ef80d33b439ede6a19326b78f0f1d8d62b9a318e3d9c1af351098", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}], "hexpm", "a929e7230ea5c7ee0e149ffcf44ce7cf7f4b6d2bfe1752dd7c084cdff152d36f"},
|
||||||
"plug": {:hex, :plug, "1.10.4", "41eba7d1a2d671faaf531fa867645bd5a3dce0957d8e2a3f398ccff7d2ef017f", [:mix], [{:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "ad1e233fe73d2eec56616568d260777b67f53148a999dc2d048f4eb9778fe4a0"},
|
"plug": {:hex, :plug, "1.14.0", "ba4f558468f69cbd9f6b356d25443d0b796fbdc887e03fa89001384a9cac638f", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "bf020432c7d4feb7b3af16a0c2701455cbbbb95e5b6866132cb09eb0c29adc14"},
|
||||||
"plug_cowboy": {:hex, :plug_cowboy, "2.6.0", "d1cf12ff96a1ca4f52207c5271a6c351a4733f413803488d75b70ccf44aebec2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "073cf20b753ce6682ed72905cd62a2d4bd9bad1bf9f7feb02a1b8e525bd94fa6"},
|
"plug_cowboy": {:hex, :plug_cowboy, "2.6.0", "d1cf12ff96a1ca4f52207c5271a6c351a4733f413803488d75b70ccf44aebec2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "073cf20b753ce6682ed72905cd62a2d4bd9bad1bf9f7feb02a1b8e525bd94fa6"},
|
||||||
"plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"},
|
"plug_crypto": {:hex, :plug_crypto, "1.2.3", "8f77d13aeb32bfd9e654cb68f0af517b371fb34c56c9f2b58fe3df1235c1251a", [:mix], [], "hexpm", "b5672099c6ad5c202c45f5a403f21a3411247f164e4a8fab056e5cd8a290f4a2"},
|
||||||
"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"},
|
"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"},
|
||||||
|
@ -97,16 +99,15 @@
|
||||||
"poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"},
|
"poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"},
|
||||||
"postgrex": {:hex, :postgrex, "0.16.5", "fcc4035cc90e23933c5d69a9cd686e329469446ef7abba2cf70f08e2c4b69810", [:mix], [{:connection, "~> 1.1", [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]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "edead639dc6e882618c01d8fc891214c481ab9a3788dfe38dd5e37fd1d5fb2e8"},
|
"postgrex": {:hex, :postgrex, "0.16.5", "fcc4035cc90e23933c5d69a9cd686e329469446ef7abba2cf70f08e2c4b69810", [:mix], [{:connection, "~> 1.1", [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]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "edead639dc6e882618c01d8fc891214c481ab9a3788dfe38dd5e37fd1d5fb2e8"},
|
||||||
"pot": {:hex, :pot, "1.0.2", "13abb849139fdc04ab8154986abbcb63bdee5de6ed2ba7e1713527e33df923dd", [:rebar3], [], "hexpm", "78fe127f5a4f5f919d6ea5a2a671827bd53eb9d37e5b4128c0ad3df99856c2e0"},
|
"pot": {:hex, :pot, "1.0.2", "13abb849139fdc04ab8154986abbcb63bdee5de6ed2ba7e1713527e33df923dd", [:rebar3], [], "hexpm", "78fe127f5a4f5f919d6ea5a2a671827bd53eb9d37e5b4128c0ad3df99856c2e0"},
|
||||||
"quack": {:hex, :quack, "0.1.1", "cca7b4da1a233757fdb44b3334fce80c94785b3ad5a602053b7a002b5a8967bf", [:mix], [{:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: false]}, {:tesla, "~> 1.2.0", [hex: :tesla, repo: "hexpm", optional: false]}], "hexpm", "d736bfa7444112eb840027bb887832a0e403a4a3437f48028c3b29a2dbbd2543"},
|
|
||||||
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
|
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
|
||||||
"recon": {:hex, :recon, "2.5.2", "cba53fa8db83ad968c9a652e09c3ed7ddcc4da434f27c3eaa9ca47ffb2b1ff03", [:mix, :rebar3], [], "hexpm", "2c7523c8dee91dff41f6b3d63cba2bd49eb6d2fe5bf1eec0df7f87eb5e230e1c"},
|
"recon": {:hex, :recon, "2.5.2", "cba53fa8db83ad968c9a652e09c3ed7ddcc4da434f27c3eaa9ca47ffb2b1ff03", [:mix, :rebar3], [], "hexpm", "2c7523c8dee91dff41f6b3d63cba2bd49eb6d2fe5bf1eec0df7f87eb5e230e1c"},
|
||||||
"remote_ip": {:git, "https://git.pleroma.social/pleroma/remote_ip.git", "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8", [ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"]},
|
"remote_ip": {:hex, :remote_ip, "1.1.0", "cb308841595d15df3f9073b7c39243a1dd6ca56e5020295cb012c76fbec50f2d", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "616ffdf66aaad6a72fc546dabf42eed87e2a99e97b09cbd92b10cc180d02ed74"},
|
||||||
"search_parser": {:git, "https://github.com/FloatingGhost/pleroma-contrib-search-parser.git", "08971a81e68686f9ac465cfb6661d51c5e4e1e7f", [ref: "08971a81e68686f9ac465cfb6661d51c5e4e1e7f"]},
|
"search_parser": {:git, "https://github.com/FloatingGhost/pleroma-contrib-search-parser.git", "08971a81e68686f9ac465cfb6661d51c5e4e1e7f", [ref: "08971a81e68686f9ac465cfb6661d51c5e4e1e7f"]},
|
||||||
"sleeplocks": {:hex, :sleeplocks, "1.1.2", "d45aa1c5513da48c888715e3381211c859af34bee9b8290490e10c90bb6ff0ca", [:rebar3], [], "hexpm", "9fe5d048c5b781d6305c1a3a0f40bb3dfc06f49bf40571f3d2d0c57eaa7f59a5"},
|
"sleeplocks": {:hex, :sleeplocks, "1.1.2", "d45aa1c5513da48c888715e3381211c859af34bee9b8290490e10c90bb6ff0ca", [:rebar3], [], "hexpm", "9fe5d048c5b781d6305c1a3a0f40bb3dfc06f49bf40571f3d2d0c57eaa7f59a5"},
|
||||||
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
|
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
|
||||||
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
|
"statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"},
|
||||||
"sweet_xml": {:hex, :sweet_xml, "0.7.3", "debb256781c75ff6a8c5cbf7981146312b66f044a2898f453709a53e5031b45b", [:mix], [], "hexpm", "e110c867a1b3fe74bfc7dd9893aa851f0eed5518d0d7cad76d7baafd30e4f5ba"},
|
"sweet_xml": {:hex, :sweet_xml, "0.7.3", "debb256781c75ff6a8c5cbf7981146312b66f044a2898f453709a53e5031b45b", [:mix], [], "hexpm", "e110c867a1b3fe74bfc7dd9893aa851f0eed5518d0d7cad76d7baafd30e4f5ba"},
|
||||||
"swoosh": {:hex, :swoosh, "1.8.2", "af9a22ab2c0d20b266f61acca737fa11a121902de9466a39e91bacdce012101c", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d058ba750eafadb6c09a84a352c14c5d1eeeda6e84945fcc95785b7f3067b7db"},
|
"swoosh": {:hex, :swoosh, "1.8.3", "733357d9a65da19c162171f08d1e42a6259236cf44d02a64711b776afbbbaa78", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c699abbac7a296c205055a7501c5d5261320ea1f08bde2392699a9e899815bc7"},
|
||||||
"syslog": {:hex, :syslog, "1.1.0", "6419a232bea84f07b56dc575225007ffe34d9fdc91abe6f1b2f254fd71d8efc2", [:rebar3], [], "hexpm", "4c6a41373c7e20587be33ef841d3de6f3beba08519809329ecc4d27b15b659e1"},
|
"syslog": {:hex, :syslog, "1.1.0", "6419a232bea84f07b56dc575225007ffe34d9fdc91abe6f1b2f254fd71d8efc2", [:rebar3], [], "hexpm", "4c6a41373c7e20587be33ef841d3de6f3beba08519809329ecc4d27b15b659e1"},
|
||||||
"table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"},
|
"table_rex": {:hex, :table_rex, "3.1.1", "0c67164d1714b5e806d5067c1e96ff098ba7ae79413cc075973e17c38a587caa", [:mix], [], "hexpm", "678a23aba4d670419c23c17790f9dcd635a4a89022040df7d5d772cb21012490"},
|
||||||
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
|
"telemetry": {:hex, :telemetry, "0.4.3", "a06428a514bdbc63293cd9a6263aad00ddeb66f608163bdec7c8995784080818", [:rebar3], [], "hexpm", "eb72b8365ffda5bed68a620d1da88525e326cb82a75ee61354fc24b844768041"},
|
||||||
|
|
|
@ -163,4 +163,8 @@ defp error(issue_meta, module, expected_file) do
|
||||||
line_no: 1
|
line_no: 1
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp append_issues_and_timings(_issues, exec) do
|
||||||
|
exec
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -116,7 +116,7 @@ test "it deduces the actor id for gotoSocial" do
|
||||||
|
|
||||||
test "it calls webfinger for 'acct:' accounts" do
|
test "it calls webfinger for 'acct:' accounts" do
|
||||||
with_mock(Pleroma.Web.WebFinger,
|
with_mock(Pleroma.Web.WebFinger,
|
||||||
finger: fn _ -> %{"ap_id" => "https://gensokyo.2hu/users/raymoo"} end
|
finger: fn _ -> {:ok, %{"ap_id" => "https://gensokyo.2hu/users/raymoo"}} end
|
||||||
) do
|
) do
|
||||||
assert Signature.key_id_to_actor_id("acct:raymoo@gensokyo.2hu") ==
|
assert Signature.key_id_to_actor_id("acct:raymoo@gensokyo.2hu") ==
|
||||||
{:ok, "https://gensokyo.2hu/users/raymoo"}
|
{:ok, "https://gensokyo.2hu/users/raymoo"}
|
||||||
|
|
|
@ -41,15 +41,16 @@ test "with valid `admin_token` query parameter, skips OAuth scopes check" do
|
||||||
|
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn = get(build_conn(), "/api/pleroma/admin/users/#{user.nickname}?admin_token=password123")
|
conn =
|
||||||
|
get(build_conn(), "/api/v1/pleroma/admin/users/#{user.nickname}?admin_token=password123")
|
||||||
|
|
||||||
assert json_response(conn, 200)
|
assert json_response(conn, 200)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope",
|
test "GET /api/v1/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope",
|
||||||
%{admin: admin} do
|
%{admin: admin} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
url = "/api/pleroma/admin/users/#{user.nickname}"
|
url = "/api/v1/pleroma/admin/users/#{user.nickname}"
|
||||||
|
|
||||||
good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"])
|
good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"])
|
||||||
good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"])
|
good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"])
|
||||||
|
@ -90,7 +91,7 @@ test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or bro
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PUT /api/pleroma/admin/users/tag" do
|
describe "PUT /api/v1/pleroma/admin/users/tag" do
|
||||||
setup %{conn: conn} do
|
setup %{conn: conn} do
|
||||||
user1 = insert(:user, %{tags: ["x"]})
|
user1 = insert(:user, %{tags: ["x"]})
|
||||||
user2 = insert(:user, %{tags: ["y"]})
|
user2 = insert(:user, %{tags: ["y"]})
|
||||||
|
@ -100,7 +101,7 @@ test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or bro
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put(
|
|> put(
|
||||||
"/api/pleroma/admin/users/tag?nicknames[]=#{user1.nickname}&nicknames[]=" <>
|
"/api/v1/pleroma/admin/users/tag?nicknames[]=#{user1.nickname}&nicknames[]=" <>
|
||||||
"#{user2.nickname}&tags[]=foo&tags[]=bar"
|
"#{user2.nickname}&tags[]=foo&tags[]=bar"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ test "it does not modify tags of not specified users", %{conn: conn, user3: user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE /api/pleroma/admin/users/tag" do
|
describe "DELETE /api/v1/pleroma/admin/users/tag" do
|
||||||
setup %{conn: conn} do
|
setup %{conn: conn} do
|
||||||
user1 = insert(:user, %{tags: ["x"]})
|
user1 = insert(:user, %{tags: ["x"]})
|
||||||
user2 = insert(:user, %{tags: ["y", "z"]})
|
user2 = insert(:user, %{tags: ["y", "z"]})
|
||||||
|
@ -146,7 +147,7 @@ test "it does not modify tags of not specified users", %{conn: conn, user3: user
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> delete(
|
|> delete(
|
||||||
"/api/pleroma/admin/users/tag?nicknames[]=#{user1.nickname}&nicknames[]=" <>
|
"/api/v1/pleroma/admin/users/tag?nicknames[]=#{user1.nickname}&nicknames[]=" <>
|
||||||
"#{user2.nickname}&tags[]=x&tags[]=z"
|
"#{user2.nickname}&tags[]=x&tags[]=z"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -182,12 +183,12 @@ test "it does not modify tags of not specified users", %{conn: conn, user3: user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/admin/users/:nickname/permission_group" do
|
describe "/api/v1/pleroma/admin/users/:nickname/permission_group" do
|
||||||
test "GET is giving user_info", %{admin: admin, conn: conn} do
|
test "GET is giving user_info", %{admin: admin, conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> get("/api/pleroma/admin/users/#{admin.nickname}/permission_group/")
|
|> get("/api/v1/pleroma/admin/users/#{admin.nickname}/permission_group/")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{
|
assert json_response(conn, 200) == %{
|
||||||
"is_admin" => true,
|
"is_admin" => true,
|
||||||
|
@ -201,7 +202,7 @@ test "/:right POST, can add to a permission group", %{admin: admin, conn: conn}
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/#{user.nickname}/permission_group/admin")
|
|> post("/api/v1/pleroma/admin/users/#{user.nickname}/permission_group/admin")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{
|
assert json_response(conn, 200) == %{
|
||||||
"is_admin" => true
|
"is_admin" => true
|
||||||
|
@ -220,7 +221,7 @@ test "/:right POST, can add to a permission group (multiple)", %{admin: admin, c
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/permission_group/admin", %{
|
|> post("/api/v1/pleroma/admin/users/permission_group/admin", %{
|
||||||
nicknames: [user_one.nickname, user_two.nickname]
|
nicknames: [user_one.nickname, user_two.nickname]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -238,7 +239,7 @@ test "/:right DELETE, can remove from a permission group", %{admin: admin, conn:
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> delete("/api/pleroma/admin/users/#{user.nickname}/permission_group/admin")
|
|> delete("/api/v1/pleroma/admin/users/#{user.nickname}/permission_group/admin")
|
||||||
|
|
||||||
assert json_response(conn, 200) == %{"is_admin" => false}
|
assert json_response(conn, 200) == %{"is_admin" => false}
|
||||||
|
|
||||||
|
@ -258,7 +259,7 @@ test "/:right DELETE, can remove from a permission group (multiple)", %{
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> delete("/api/pleroma/admin/users/permission_group/admin", %{
|
|> delete("/api/v1/pleroma/admin/users/permission_group/admin", %{
|
||||||
nicknames: [user_one.nickname, user_two.nickname]
|
nicknames: [user_one.nickname, user_two.nickname]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -271,13 +272,13 @@ test "/:right DELETE, can remove from a permission group (multiple)", %{
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "/api/pleroma/admin/users/:nickname/password_reset", %{conn: conn} do
|
test "/api/v1/pleroma/admin/users/:nickname/password_reset", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> get("/api/pleroma/admin/users/#{user.nickname}/password_reset")
|
|> get("/api/v1/pleroma/admin/users/#{user.nickname}/password_reset")
|
||||||
|
|
||||||
resp = json_response(conn, 200)
|
resp = json_response(conn, 200)
|
||||||
|
|
||||||
|
@ -296,7 +297,7 @@ test "returns 200 and disable 2fa", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put("/api/pleroma/admin/users/disable_mfa", %{nickname: user.nickname})
|
|> put("/api/v1/pleroma/admin/users/disable_mfa", %{nickname: user.nickname})
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert response == user.nickname
|
assert response == user.nickname
|
||||||
|
@ -309,19 +310,19 @@ test "returns 200 and disable 2fa", %{conn: conn} do
|
||||||
test "returns 404 if user not found", %{conn: conn} do
|
test "returns 404 if user not found", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put("/api/pleroma/admin/users/disable_mfa", %{nickname: "nickname"})
|
|> put("/api/v1/pleroma/admin/users/disable_mfa", %{nickname: "nickname"})
|
||||||
|> json_response(404)
|
|> json_response(404)
|
||||||
|
|
||||||
assert response == %{"error" => "Not found"}
|
assert response == %{"error" => "Not found"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/restart" do
|
describe "GET /api/v1/pleroma/admin/restart" do
|
||||||
setup do: clear_config(:configurable_from_database, true)
|
setup do: clear_config(:configurable_from_database, true)
|
||||||
|
|
||||||
test "pleroma restarts", %{conn: conn} do
|
test "pleroma restarts", %{conn: conn} do
|
||||||
capture_log(fn ->
|
capture_log(fn ->
|
||||||
assert conn |> get("/api/pleroma/admin/restart") |> json_response(200) == %{}
|
assert conn |> get("/api/v1/pleroma/admin/restart") |> json_response(200) == %{}
|
||||||
end) =~ "pleroma restarted"
|
end) =~ "pleroma restarted"
|
||||||
|
|
||||||
refute Restarter.Pleroma.need_reboot?()
|
refute Restarter.Pleroma.need_reboot?()
|
||||||
|
@ -330,19 +331,19 @@ test "pleroma restarts", %{conn: conn} do
|
||||||
|
|
||||||
test "need_reboot flag", %{conn: conn} do
|
test "need_reboot flag", %{conn: conn} do
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/admin/need_reboot")
|
|> get("/api/v1/pleroma/admin/need_reboot")
|
||||||
|> json_response(200) == %{"need_reboot" => false}
|
|> json_response(200) == %{"need_reboot" => false}
|
||||||
|
|
||||||
Restarter.Pleroma.need_reboot()
|
Restarter.Pleroma.need_reboot()
|
||||||
|
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/admin/need_reboot")
|
|> get("/api/v1/pleroma/admin/need_reboot")
|
||||||
|> json_response(200) == %{"need_reboot" => true}
|
|> json_response(200) == %{"need_reboot" => true}
|
||||||
|
|
||||||
on_exit(fn -> Restarter.Pleroma.refresh() end)
|
on_exit(fn -> Restarter.Pleroma.refresh() end)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/users/:nickname/statuses" do
|
describe "GET /api/v1/pleroma/admin/users/:nickname/statuses" do
|
||||||
setup do
|
setup do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
|
@ -354,7 +355,7 @@ test "need_reboot flag", %{conn: conn} do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "renders user's statuses", %{conn: conn, user: user} do
|
test "renders user's statuses", %{conn: conn, user: user} do
|
||||||
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses")
|
conn = get(conn, "/api/v1/pleroma/admin/users/#{user.nickname}/statuses")
|
||||||
|
|
||||||
assert %{"total" => 3, "activities" => activities} = json_response(conn, 200)
|
assert %{"total" => 3, "activities" => activities} = json_response(conn, 200)
|
||||||
assert length(activities) == 3
|
assert length(activities) == 3
|
||||||
|
@ -363,12 +364,12 @@ test "renders user's statuses", %{conn: conn, user: user} do
|
||||||
test "renders user's statuses with pagination", %{conn: conn, user: user} do
|
test "renders user's statuses with pagination", %{conn: conn, user: user} do
|
||||||
%{"total" => 3, "activities" => [activity1]} =
|
%{"total" => 3, "activities" => [activity1]} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=1")
|
|> get("/api/v1/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=1")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
%{"total" => 3, "activities" => [activity2]} =
|
%{"total" => 3, "activities" => [activity2]} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=2")
|
|> get("/api/v1/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=2")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
refute activity1 == activity2
|
refute activity1 == activity2
|
||||||
|
@ -381,7 +382,7 @@ test "doesn't return private statuses by default", %{conn: conn, user: user} do
|
||||||
|
|
||||||
%{"total" => 4, "activities" => activities} =
|
%{"total" => 4, "activities" => activities} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users/#{user.nickname}/statuses")
|
|> get("/api/v1/pleroma/admin/users/#{user.nickname}/statuses")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert length(activities) == 4
|
assert length(activities) == 4
|
||||||
|
@ -394,7 +395,7 @@ test "returns private statuses with godmode on", %{conn: conn, user: user} do
|
||||||
|
|
||||||
%{"total" => 5, "activities" => activities} =
|
%{"total" => 5, "activities" => activities} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users/#{user.nickname}/statuses?godmode=true")
|
|> get("/api/v1/pleroma/admin/users/#{user.nickname}/statuses?godmode=true")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert length(activities) == 5
|
assert length(activities) == 5
|
||||||
|
@ -407,19 +408,19 @@ test "excludes reblogs by default", %{conn: conn, user: user} do
|
||||||
|
|
||||||
assert %{"total" => 0, "activities" => []} ==
|
assert %{"total" => 0, "activities" => []} ==
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users/#{other_user.nickname}/statuses")
|
|> get("/api/v1/pleroma/admin/users/#{other_user.nickname}/statuses")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert %{"total" => 1, "activities" => [_]} =
|
assert %{"total" => 1, "activities" => [_]} =
|
||||||
conn
|
conn
|
||||||
|> get(
|
|> get(
|
||||||
"/api/pleroma/admin/users/#{other_user.nickname}/statuses?with_reblogs=true"
|
"/api/v1/pleroma/admin/users/#{other_user.nickname}/statuses?with_reblogs=true"
|
||||||
)
|
)
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/moderation_log" do
|
describe "GET /api/v1/pleroma/admin/moderation_log" do
|
||||||
setup do
|
setup do
|
||||||
moderator = insert(:user, is_moderator: true)
|
moderator = insert(:user, is_moderator: true)
|
||||||
|
|
||||||
|
@ -453,7 +454,7 @@ test "returns the log", %{conn: conn, admin: admin} do
|
||||||
inserted_at: NaiveDateTime.truncate(~N[2017-08-16 15:47:06.597036], :second)
|
inserted_at: NaiveDateTime.truncate(~N[2017-08-16 15:47:06.597036], :second)
|
||||||
})
|
})
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/moderation_log")
|
conn = get(conn, "/api/v1/pleroma/admin/moderation_log")
|
||||||
|
|
||||||
response = json_response(conn, 200)
|
response = json_response(conn, 200)
|
||||||
[first_entry, second_entry] = response["items"]
|
[first_entry, second_entry] = response["items"]
|
||||||
|
@ -497,7 +498,7 @@ test "returns the log with pagination", %{conn: conn, admin: admin} do
|
||||||
inserted_at: NaiveDateTime.truncate(~N[2017-08-16 15:47:06.597036], :second)
|
inserted_at: NaiveDateTime.truncate(~N[2017-08-16 15:47:06.597036], :second)
|
||||||
})
|
})
|
||||||
|
|
||||||
conn1 = get(conn, "/api/pleroma/admin/moderation_log?page_size=1&page=1")
|
conn1 = get(conn, "/api/v1/pleroma/admin/moderation_log?page_size=1&page=1")
|
||||||
|
|
||||||
response1 = json_response(conn1, 200)
|
response1 = json_response(conn1, 200)
|
||||||
[first_entry] = response1["items"]
|
[first_entry] = response1["items"]
|
||||||
|
@ -509,7 +510,7 @@ test "returns the log with pagination", %{conn: conn, admin: admin} do
|
||||||
assert first_entry["message"] ==
|
assert first_entry["message"] ==
|
||||||
"@#{admin.nickname} unfollowed relay: https://example.org/relay"
|
"@#{admin.nickname} unfollowed relay: https://example.org/relay"
|
||||||
|
|
||||||
conn2 = get(conn, "/api/pleroma/admin/moderation_log?page_size=1&page=2")
|
conn2 = get(conn, "/api/v1/pleroma/admin/moderation_log?page_size=1&page=2")
|
||||||
|
|
||||||
response2 = json_response(conn2, 200)
|
response2 = json_response(conn2, 200)
|
||||||
[second_entry] = response2["items"]
|
[second_entry] = response2["items"]
|
||||||
|
@ -555,7 +556,7 @@ test "filters log by date", %{conn: conn, admin: admin} do
|
||||||
conn1 =
|
conn1 =
|
||||||
get(
|
get(
|
||||||
conn,
|
conn,
|
||||||
"/api/pleroma/admin/moderation_log?start_date=#{second_date}"
|
"/api/v1/pleroma/admin/moderation_log?start_date=#{second_date}"
|
||||||
)
|
)
|
||||||
|
|
||||||
response1 = json_response(conn1, 200)
|
response1 = json_response(conn1, 200)
|
||||||
|
@ -593,7 +594,7 @@ test "returns log filtered by user", %{conn: conn, admin: admin, moderator: mode
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
conn1 = get(conn, "/api/pleroma/admin/moderation_log?user_id=#{moderator.id}")
|
conn1 = get(conn, "/api/v1/pleroma/admin/moderation_log?user_id=#{moderator.id}")
|
||||||
|
|
||||||
response1 = json_response(conn1, 200)
|
response1 = json_response(conn1, 200)
|
||||||
[first_entry] = response1["items"]
|
[first_entry] = response1["items"]
|
||||||
|
@ -615,7 +616,7 @@ test "returns log filtered by search", %{conn: conn, moderator: moderator} do
|
||||||
target: "https://example.org/relay"
|
target: "https://example.org/relay"
|
||||||
})
|
})
|
||||||
|
|
||||||
conn1 = get(conn, "/api/pleroma/admin/moderation_log?search=unfo")
|
conn1 = get(conn, "/api/v1/pleroma/admin/moderation_log?search=unfo")
|
||||||
|
|
||||||
response1 = json_response(conn1, 200)
|
response1 = json_response(conn1, 200)
|
||||||
[first_entry] = response1["items"]
|
[first_entry] = response1["items"]
|
||||||
|
@ -631,7 +632,7 @@ test "gets a remote users when [:instance, :limit_to_local_content] is set to :u
|
||||||
%{conn: conn} do
|
%{conn: conn} do
|
||||||
clear_config(Pleroma.Config.get([:instance, :limit_to_local_content]), :unauthenticated)
|
clear_config(Pleroma.Config.get([:instance, :limit_to_local_content]), :unauthenticated)
|
||||||
user = insert(:user, %{local: false, nickname: "u@peer1.com"})
|
user = insert(:user, %{local: false, nickname: "u@peer1.com"})
|
||||||
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/credentials")
|
conn = get(conn, "/api/v1/pleroma/admin/users/#{user.nickname}/credentials")
|
||||||
|
|
||||||
assert json_response(conn, 200)
|
assert json_response(conn, 200)
|
||||||
end
|
end
|
||||||
|
@ -639,7 +640,7 @@ test "gets a remote users when [:instance, :limit_to_local_content] is set to :u
|
||||||
describe "GET /users/:nickname/credentials" do
|
describe "GET /users/:nickname/credentials" do
|
||||||
test "gets the user credentials", %{conn: conn} do
|
test "gets the user credentials", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/credentials")
|
conn = get(conn, "/api/v1/pleroma/admin/users/#{user.nickname}/credentials")
|
||||||
|
|
||||||
response = assert json_response(conn, 200)
|
response = assert json_response(conn, 200)
|
||||||
assert response["email"] == user.email
|
assert response["email"] == user.email
|
||||||
|
@ -651,7 +652,7 @@ test "returns 403 if requested by a non-admin" do
|
||||||
conn =
|
conn =
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> get("/api/pleroma/admin/users/#{user.nickname}/credentials")
|
|> get("/api/v1/pleroma/admin/users/#{user.nickname}/credentials")
|
||||||
|
|
||||||
assert json_response(conn, :forbidden)
|
assert json_response(conn, :forbidden)
|
||||||
end
|
end
|
||||||
|
@ -667,7 +668,7 @@ test "changes password and email", %{conn: conn, admin: admin, user: user} do
|
||||||
assert user.password_reset_pending == false
|
assert user.password_reset_pending == false
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
patch(conn, "/api/pleroma/admin/users/#{user.nickname}/credentials", %{
|
patch(conn, "/api/v1/pleroma/admin/users/#{user.nickname}/credentials", %{
|
||||||
"password" => "new_password",
|
"password" => "new_password",
|
||||||
"email" => "new_email@example.com",
|
"email" => "new_email@example.com",
|
||||||
"name" => "new_name"
|
"name" => "new_name"
|
||||||
|
@ -697,7 +698,7 @@ test "returns 403 if requested by a non-admin", %{user: user} do
|
||||||
conn =
|
conn =
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> patch("/api/pleroma/admin/users/#{user.nickname}/credentials", %{
|
|> patch("/api/v1/pleroma/admin/users/#{user.nickname}/credentials", %{
|
||||||
"password" => "new_password",
|
"password" => "new_password",
|
||||||
"email" => "new_email@example.com",
|
"email" => "new_email@example.com",
|
||||||
"name" => "new_name"
|
"name" => "new_name"
|
||||||
|
@ -709,7 +710,7 @@ test "returns 403 if requested by a non-admin", %{user: user} do
|
||||||
test "changes actor type from permitted list", %{conn: conn, user: user} do
|
test "changes actor type from permitted list", %{conn: conn, user: user} do
|
||||||
assert user.actor_type == "Person"
|
assert user.actor_type == "Person"
|
||||||
|
|
||||||
assert patch(conn, "/api/pleroma/admin/users/#{user.nickname}/credentials", %{
|
assert patch(conn, "/api/v1/pleroma/admin/users/#{user.nickname}/credentials", %{
|
||||||
"actor_type" => "Service"
|
"actor_type" => "Service"
|
||||||
})
|
})
|
||||||
|> json_response(200) == %{"status" => "success"}
|
|> json_response(200) == %{"status" => "success"}
|
||||||
|
@ -718,14 +719,14 @@ test "changes actor type from permitted list", %{conn: conn, user: user} do
|
||||||
|
|
||||||
assert updated_user.actor_type == "Service"
|
assert updated_user.actor_type == "Service"
|
||||||
|
|
||||||
assert patch(conn, "/api/pleroma/admin/users/#{user.nickname}/credentials", %{
|
assert patch(conn, "/api/v1/pleroma/admin/users/#{user.nickname}/credentials", %{
|
||||||
"actor_type" => "Application"
|
"actor_type" => "Application"
|
||||||
})
|
})
|
||||||
|> json_response(400) == %{"errors" => %{"actor_type" => "is invalid"}}
|
|> json_response(400) == %{"errors" => %{"actor_type" => "is invalid"}}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "update non existing user", %{conn: conn} do
|
test "update non existing user", %{conn: conn} do
|
||||||
assert patch(conn, "/api/pleroma/admin/users/non-existing/credentials", %{
|
assert patch(conn, "/api/v1/pleroma/admin/users/non-existing/credentials", %{
|
||||||
"password" => "new_password"
|
"password" => "new_password"
|
||||||
})
|
})
|
||||||
|> json_response(404) == %{"error" => "Not found"}
|
|> json_response(404) == %{"error" => "Not found"}
|
||||||
|
@ -738,7 +739,9 @@ test "sets password_reset_pending to true", %{conn: conn} do
|
||||||
assert user.password_reset_pending == false
|
assert user.password_reset_pending == false
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
patch(conn, "/api/pleroma/admin/users/force_password_reset", %{nicknames: [user.nickname]})
|
patch(conn, "/api/v1/pleroma/admin/users/force_password_reset", %{
|
||||||
|
nicknames: [user.nickname]
|
||||||
|
})
|
||||||
|
|
||||||
assert empty_json_response(conn) == ""
|
assert empty_json_response(conn) == ""
|
||||||
|
|
||||||
|
@ -756,7 +759,7 @@ test "it confirms emails of two users", %{conn: conn, admin: admin} do
|
||||||
refute second_user.is_confirmed
|
refute second_user.is_confirmed
|
||||||
|
|
||||||
ret_conn =
|
ret_conn =
|
||||||
patch(conn, "/api/pleroma/admin/users/confirm_email", %{
|
patch(conn, "/api/v1/pleroma/admin/users/confirm_email", %{
|
||||||
nicknames: [
|
nicknames: [
|
||||||
first_user.nickname,
|
first_user.nickname,
|
||||||
second_user.nickname
|
second_user.nickname
|
||||||
|
@ -783,7 +786,7 @@ test "it resend emails for two users", %{conn: conn, admin: admin} do
|
||||||
[first_user, second_user] = insert_pair(:user, is_confirmed: false)
|
[first_user, second_user] = insert_pair(:user, is_confirmed: false)
|
||||||
|
|
||||||
ret_conn =
|
ret_conn =
|
||||||
patch(conn, "/api/pleroma/admin/users/resend_confirmation_email", %{
|
patch(conn, "/api/v1/pleroma/admin/users/resend_confirmation_email", %{
|
||||||
nicknames: [
|
nicknames: [
|
||||||
first_user.nickname,
|
first_user.nickname,
|
||||||
second_user.nickname
|
second_user.nickname
|
||||||
|
@ -804,7 +807,7 @@ test "it resend emails for two users", %{conn: conn, admin: admin} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/admin/stats" do
|
describe "/api/v1/pleroma/admin/stats" do
|
||||||
test "status visibility count", %{conn: conn} do
|
test "status visibility count", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
CommonAPI.post(user, %{visibility: "public", status: "hey"})
|
CommonAPI.post(user, %{visibility: "public", status: "hey"})
|
||||||
|
@ -813,7 +816,7 @@ test "status visibility count", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/stats")
|
|> get("/api/v1/pleroma/admin/stats")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert %{"direct" => 0, "private" => 0, "public" => 1, "unlisted" => 2} =
|
assert %{"direct" => 0, "private" => 0, "public" => 1, "unlisted" => 2} =
|
||||||
|
@ -831,7 +834,7 @@ test "by instance", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/stats", instance: instance2)
|
|> get("/api/v1/pleroma/admin/stats", instance: instance2)
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert %{"direct" => 0, "private" => 1, "public" => 0, "unlisted" => 1} =
|
assert %{"direct" => 0, "private" => 1, "public" => 0, "unlisted" => 1} =
|
||||||
|
@ -839,7 +842,7 @@ test "by instance", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/backups" do
|
describe "/api/v1/pleroma/backups" do
|
||||||
test "it creates a backup", %{conn: conn} do
|
test "it creates a backup", %{conn: conn} do
|
||||||
admin = %{id: admin_id, nickname: admin_nickname} = insert(:user, is_admin: true)
|
admin = %{id: admin_id, nickname: admin_nickname} = insert(:user, is_admin: true)
|
||||||
token = insert(:oauth_admin_token, user: admin)
|
token = insert(:oauth_admin_token, user: admin)
|
||||||
|
@ -849,7 +852,7 @@ test "it creates a backup", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> post("/api/pleroma/admin/backups", %{nickname: user.nickname})
|
|> post("/api/v1/pleroma/admin/backups", %{nickname: user.nickname})
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert [backup] = Repo.all(Pleroma.User.Backup)
|
assert [backup] = Repo.all(Pleroma.User.Backup)
|
||||||
|
@ -890,7 +893,7 @@ test "it doesn't limit admins", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> post("/api/pleroma/admin/backups", %{nickname: user.nickname})
|
|> post("/api/v1/pleroma/admin/backups", %{nickname: user.nickname})
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert [_backup] = Repo.all(Pleroma.User.Backup)
|
assert [_backup] = Repo.all(Pleroma.User.Backup)
|
||||||
|
@ -899,7 +902,7 @@ test "it doesn't limit admins", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> post("/api/pleroma/admin/backups", %{nickname: user.nickname})
|
|> post("/api/v1/pleroma/admin/backups", %{nickname: user.nickname})
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert Repo.aggregate(Pleroma.User.Backup, :count) == 2
|
assert Repo.aggregate(Pleroma.User.Backup, :count) == 2
|
||||||
|
|
|
@ -30,11 +30,11 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/frontends" do
|
describe "GET /api/v1/pleroma/admin/frontends" do
|
||||||
test "it lists available frontends", %{conn: conn} do
|
test "it lists available frontends", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/frontends")
|
|> get("/api/v1/pleroma/admin/frontends")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert Enum.map(response, & &1["name"]) ==
|
assert Enum.map(response, & &1["name"]) ==
|
||||||
|
@ -48,7 +48,7 @@ test "it lists available frontends when no frontend folder was created yet", %{c
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/frontends")
|
|> get("/api/v1/pleroma/admin/frontends")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert Enum.map(response, & &1["name"]) ==
|
assert Enum.map(response, & &1["name"]) ==
|
||||||
|
@ -58,7 +58,7 @@ test "it lists available frontends when no frontend folder was created yet", %{c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/frontends/install" do
|
describe "POST /api/v1/pleroma/admin/frontends/install" do
|
||||||
test "from available frontends", %{conn: conn} do
|
test "from available frontends", %{conn: conn} do
|
||||||
clear_config([:frontends, :available], %{
|
clear_config([:frontends, :available], %{
|
||||||
"pleroma" => %{
|
"pleroma" => %{
|
||||||
|
@ -74,14 +74,14 @@ test "from available frontends", %{conn: conn} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/frontends/install", %{name: "pleroma"})
|
|> post("/api/v1/pleroma/admin/frontends/install", %{name: "pleroma"})
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
|
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/frontends")
|
|> get("/api/v1/pleroma/admin/frontends")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert response == [
|
assert response == [
|
||||||
|
@ -106,7 +106,7 @@ test "from a file", %{conn: conn} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/frontends/install", %{
|
|> post("/api/v1/pleroma/admin/frontends/install", %{
|
||||||
name: "pleroma",
|
name: "pleroma",
|
||||||
file: "test/fixtures/tesla_mock/frontend.zip"
|
file: "test/fixtures/tesla_mock/frontend.zip"
|
||||||
})
|
})
|
||||||
|
@ -122,7 +122,7 @@ test "from an URL", %{conn: conn} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/frontends/install", %{
|
|> post("/api/v1/pleroma/admin/frontends/install", %{
|
||||||
name: "unknown",
|
name: "unknown",
|
||||||
ref: "baka",
|
ref: "baka",
|
||||||
build_url: "http://gensokyo.2hu/madeup.zip",
|
build_url: "http://gensokyo.2hu/madeup.zip",
|
||||||
|
@ -141,7 +141,7 @@ test "failing returns an error", %{conn: conn} do
|
||||||
result =
|
result =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/frontends/install", %{
|
|> post("/api/v1/pleroma/admin/frontends/install", %{
|
||||||
name: "unknown",
|
name: "unknown",
|
||||||
ref: "baka",
|
ref: "baka",
|
||||||
build_url: "http://gensokyo.2hu/madeup.zip",
|
build_url: "http://gensokyo.2hu/madeup.zip",
|
||||||
|
|
|
@ -37,26 +37,28 @@ test "GET /instances/:instance/statuses", %{conn: conn} do
|
||||||
activity = insert(:note_activity, user: user2)
|
activity = insert(:note_activity, user: user2)
|
||||||
|
|
||||||
%{"total" => 2, "activities" => activities} =
|
%{"total" => 2, "activities" => activities} =
|
||||||
conn |> get("/api/pleroma/admin/instances/archae.me/statuses") |> json_response(200)
|
conn |> get("/api/v1/pleroma/admin/instances/archae.me/statuses") |> json_response(200)
|
||||||
|
|
||||||
assert length(activities) == 2
|
assert length(activities) == 2
|
||||||
|
|
||||||
%{"total" => 1, "activities" => [_]} =
|
%{"total" => 1, "activities" => [_]} =
|
||||||
conn |> get("/api/pleroma/admin/instances/test.com/statuses") |> json_response(200)
|
conn |> get("/api/v1/pleroma/admin/instances/test.com/statuses") |> json_response(200)
|
||||||
|
|
||||||
%{"total" => 0, "activities" => []} =
|
%{"total" => 0, "activities" => []} =
|
||||||
conn |> get("/api/pleroma/admin/instances/nonexistent.com/statuses") |> json_response(200)
|
conn
|
||||||
|
|> get("/api/v1/pleroma/admin/instances/nonexistent.com/statuses")
|
||||||
|
|> json_response(200)
|
||||||
|
|
||||||
CommonAPI.repeat(activity.id, user)
|
CommonAPI.repeat(activity.id, user)
|
||||||
|
|
||||||
%{"total" => 2, "activities" => activities} =
|
%{"total" => 2, "activities" => activities} =
|
||||||
conn |> get("/api/pleroma/admin/instances/archae.me/statuses") |> json_response(200)
|
conn |> get("/api/v1/pleroma/admin/instances/archae.me/statuses") |> json_response(200)
|
||||||
|
|
||||||
assert length(activities) == 2
|
assert length(activities) == 2
|
||||||
|
|
||||||
%{"total" => 3, "activities" => activities} =
|
%{"total" => 3, "activities" => activities} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/instances/archae.me/statuses?with_reblogs=true")
|
|> get("/api/v1/pleroma/admin/instances/archae.me/statuses?with_reblogs=true")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
assert length(activities) == 3
|
assert length(activities) == 3
|
||||||
|
@ -68,7 +70,7 @@ test "DELETE /instances/:instance", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> delete("/api/pleroma/admin/instances/lain.com")
|
|> delete("/api/v1/pleroma/admin/instances/lain.com")
|
||||||
|> json_response(200)
|
|> json_response(200)
|
||||||
|
|
||||||
[:ok] = ObanHelpers.perform_all()
|
[:ok] = ObanHelpers.perform_all()
|
||||||
|
|
|
@ -28,9 +28,9 @@ defmodule Pleroma.Web.AdminAPI.InstanceDocumentControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/instance_document/:name" do
|
describe "GET /api/v1/pleroma/admin/instance_document/:name" do
|
||||||
test "return the instance document url", %{conn: conn} do
|
test "return the instance document url", %{conn: conn} do
|
||||||
conn = get(conn, "/api/pleroma/admin/instance_document/instance-panel")
|
conn = get(conn, "/api/v1/pleroma/admin/instance_document/instance-panel")
|
||||||
|
|
||||||
assert content = html_response(conn, 200)
|
assert content = html_response(conn, 200)
|
||||||
assert String.contains?(content, @default_instance_panel)
|
assert String.contains?(content, @default_instance_panel)
|
||||||
|
@ -44,7 +44,7 @@ test "it returns 403 if requested by a non-admin" do
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, non_admin_user)
|
|> assign(:user, non_admin_user)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> get("/api/pleroma/admin/instance_document/instance-panel")
|
|> get("/api/v1/pleroma/admin/instance_document/instance-panel")
|
||||||
|
|
||||||
assert json_response(conn, :forbidden)
|
assert json_response(conn, :forbidden)
|
||||||
end
|
end
|
||||||
|
@ -52,13 +52,13 @@ test "it returns 403 if requested by a non-admin" do
|
||||||
test "it returns 404 if the instance document with the given name doesn't exist", %{
|
test "it returns 404 if the instance document with the given name doesn't exist", %{
|
||||||
conn: conn
|
conn: conn
|
||||||
} do
|
} do
|
||||||
conn = get(conn, "/api/pleroma/admin/instance_document/1234")
|
conn = get(conn, "/api/v1/pleroma/admin/instance_document/1234")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 404)
|
assert json_response_and_validate_schema(conn, 404)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PATCH /api/pleroma/admin/instance_document/:name" do
|
describe "PATCH /api/v1/pleroma/admin/instance_document/:name" do
|
||||||
test "uploads the instance document", %{conn: conn} do
|
test "uploads the instance document", %{conn: conn} do
|
||||||
image = %Plug.Upload{
|
image = %Plug.Upload{
|
||||||
content_type: "text/html",
|
content_type: "text/html",
|
||||||
|
@ -69,7 +69,7 @@ test "uploads the instance document", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/admin/instance_document/instance-panel", %{
|
|> patch("/api/v1/pleroma/admin/instance_document/instance-panel", %{
|
||||||
"file" => image
|
"file" => image
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -79,24 +79,24 @@ test "uploads the instance document", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE /api/pleroma/admin/instance_document/:name" do
|
describe "DELETE /api/v1/pleroma/admin/instance_document/:name" do
|
||||||
test "deletes the instance document", %{conn: conn} do
|
test "deletes the instance document", %{conn: conn} do
|
||||||
File.mkdir!(@dir <> "/instance/")
|
File.mkdir!(@dir <> "/instance/")
|
||||||
File.write!(@dir <> "/instance/panel.html", "Custom instance panel")
|
File.write!(@dir <> "/instance/panel.html", "Custom instance panel")
|
||||||
|
|
||||||
conn_resp =
|
conn_resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/instance_document/instance-panel")
|
|> get("/api/v1/pleroma/admin/instance_document/instance-panel")
|
||||||
|
|
||||||
assert html_response(conn_resp, 200) == "Custom instance panel"
|
assert html_response(conn_resp, 200) == "Custom instance panel"
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> delete("/api/pleroma/admin/instance_document/instance-panel")
|
|> delete("/api/v1/pleroma/admin/instance_document/instance-panel")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
conn_resp =
|
conn_resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/instance_document/instance-panel")
|
|> get("/api/v1/pleroma/admin/instance_document/instance-panel")
|
||||||
|
|
||||||
assert content = html_response(conn_resp, 200)
|
assert content = html_response(conn_resp, 200)
|
||||||
assert String.contains?(content, @default_instance_panel)
|
assert String.contains?(content, @default_instance_panel)
|
||||||
|
|
|
@ -22,7 +22,7 @@ defmodule Pleroma.Web.AdminAPI.InviteControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/users/email_invite, with valid config" do
|
describe "POST /api/v1/pleroma/admin/users/email_invite, with valid config" do
|
||||||
setup do: clear_config([:instance, :registrations_open], false)
|
setup do: clear_config([:instance, :registrations_open], false)
|
||||||
setup do: clear_config([:instance, :invites_enabled], true)
|
setup do: clear_config([:instance, :invites_enabled], true)
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ test "sends invitation and returns 204", %{admin: admin, conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json;charset=utf-8")
|
|> put_req_header("content-type", "application/json;charset=utf-8")
|
||||||
|> post("/api/pleroma/admin/users/email_invite", %{
|
|> post("/api/v1/pleroma/admin/users/email_invite", %{
|
||||||
email: recipient_email,
|
email: recipient_email,
|
||||||
name: recipient_name
|
name: recipient_name
|
||||||
})
|
})
|
||||||
|
@ -71,7 +71,7 @@ test "it returns 403 if requested by a non-admin" do
|
||||||
|> assign(:user, non_admin_user)
|
|> assign(:user, non_admin_user)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> put_req_header("content-type", "application/json;charset=utf-8")
|
|> put_req_header("content-type", "application/json;charset=utf-8")
|
||||||
|> post("/api/pleroma/admin/users/email_invite", %{
|
|> post("/api/v1/pleroma/admin/users/email_invite", %{
|
||||||
email: "foo@bar.com",
|
email: "foo@bar.com",
|
||||||
name: "JD"
|
name: "JD"
|
||||||
})
|
})
|
||||||
|
@ -84,7 +84,7 @@ test "email with +", %{conn: conn, admin: admin} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json;charset=utf-8")
|
|> put_req_header("content-type", "application/json;charset=utf-8")
|
||||||
|> post("/api/pleroma/admin/users/email_invite", %{email: recipient_email})
|
|> post("/api/v1/pleroma/admin/users/email_invite", %{email: recipient_email})
|
||||||
|> json_response_and_validate_schema(:no_content)
|
|> json_response_and_validate_schema(:no_content)
|
||||||
|
|
||||||
token_record =
|
token_record =
|
||||||
|
@ -113,7 +113,7 @@ test "email with +", %{conn: conn, admin: admin} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/users/email_invite, with invalid config" do
|
describe "POST /api/v1/pleroma/admin/users/email_invite, with invalid config" do
|
||||||
setup do: clear_config([:instance, :registrations_open])
|
setup do: clear_config([:instance, :registrations_open])
|
||||||
setup do: clear_config([:instance, :invites_enabled])
|
setup do: clear_config([:instance, :invites_enabled])
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ test "it returns 500 if `invites_enabled` is not enabled", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/email_invite", %{
|
|> post("/api/v1/pleroma/admin/users/email_invite", %{
|
||||||
email: "foo@bar.com",
|
email: "foo@bar.com",
|
||||||
name: "JD"
|
name: "JD"
|
||||||
})
|
})
|
||||||
|
@ -143,7 +143,7 @@ test "it returns 500 if `registrations_open` is enabled", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/email_invite", %{
|
|> post("/api/v1/pleroma/admin/users/email_invite", %{
|
||||||
email: "foo@bar.com",
|
email: "foo@bar.com",
|
||||||
name: "JD"
|
name: "JD"
|
||||||
})
|
})
|
||||||
|
@ -156,12 +156,12 @@ test "it returns 500 if `registrations_open` is enabled", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/users/invite_token" do
|
describe "POST /api/v1/pleroma/admin/users/invite_token" do
|
||||||
test "without options", %{conn: conn} do
|
test "without options", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/invite_token")
|
|> post("/api/v1/pleroma/admin/users/invite_token")
|
||||||
|
|
||||||
invite_json = json_response_and_validate_schema(conn, 200)
|
invite_json = json_response_and_validate_schema(conn, 200)
|
||||||
invite = UserInviteToken.find_by_token!(invite_json["token"])
|
invite = UserInviteToken.find_by_token!(invite_json["token"])
|
||||||
|
@ -175,7 +175,7 @@ test "with expires_at", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/invite_token", %{
|
|> post("/api/v1/pleroma/admin/users/invite_token", %{
|
||||||
"expires_at" => Date.to_string(Date.utc_today())
|
"expires_at" => Date.to_string(Date.utc_today())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ test "with max_use", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/invite_token", %{"max_use" => 150})
|
|> post("/api/v1/pleroma/admin/users/invite_token", %{"max_use" => 150})
|
||||||
|
|
||||||
invite_json = json_response_and_validate_schema(conn, 200)
|
invite_json = json_response_and_validate_schema(conn, 200)
|
||||||
invite = UserInviteToken.find_by_token!(invite_json["token"])
|
invite = UserInviteToken.find_by_token!(invite_json["token"])
|
||||||
|
@ -206,7 +206,7 @@ test "with max use and expires_at", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/invite_token", %{
|
|> post("/api/v1/pleroma/admin/users/invite_token", %{
|
||||||
"max_use" => 150,
|
"max_use" => 150,
|
||||||
"expires_at" => Date.to_string(Date.utc_today())
|
"expires_at" => Date.to_string(Date.utc_today())
|
||||||
})
|
})
|
||||||
|
@ -220,9 +220,9 @@ test "with max use and expires_at", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/users/invites" do
|
describe "GET /api/v1/pleroma/admin/users/invites" do
|
||||||
test "no invites", %{conn: conn} do
|
test "no invites", %{conn: conn} do
|
||||||
conn = get(conn, "/api/pleroma/admin/users/invites")
|
conn = get(conn, "/api/v1/pleroma/admin/users/invites")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{"invites" => []}
|
assert json_response_and_validate_schema(conn, 200) == %{"invites" => []}
|
||||||
end
|
end
|
||||||
|
@ -230,7 +230,7 @@ test "no invites", %{conn: conn} do
|
||||||
test "with invite", %{conn: conn} do
|
test "with invite", %{conn: conn} do
|
||||||
{:ok, invite} = UserInviteToken.create_invite()
|
{:ok, invite} = UserInviteToken.create_invite()
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users/invites")
|
conn = get(conn, "/api/v1/pleroma/admin/users/invites")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"invites" => [
|
"invites" => [
|
||||||
|
@ -248,14 +248,14 @@ test "with invite", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/users/revoke_invite" do
|
describe "POST /api/v1/pleroma/admin/users/revoke_invite" do
|
||||||
test "with token", %{conn: conn} do
|
test "with token", %{conn: conn} do
|
||||||
{:ok, invite} = UserInviteToken.create_invite()
|
{:ok, invite} = UserInviteToken.create_invite()
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/revoke_invite", %{"token" => invite.token})
|
|> post("/api/v1/pleroma/admin/users/revoke_invite", %{"token" => invite.token})
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"expires_at" => nil,
|
"expires_at" => nil,
|
||||||
|
@ -272,7 +272,7 @@ test "with invalid token", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/revoke_invite", %{"token" => "foo"})
|
|> post("/api/v1/pleroma/admin/users/revoke_invite", %{"token" => "foo"})
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, :not_found) == %{"error" => "Not found"}
|
assert json_response_and_validate_schema(conn, :not_found) == %{"error" => "Not found"}
|
||||||
end
|
end
|
||||||
|
|
|
@ -28,7 +28,7 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/media_proxy_caches" do
|
describe "GET /api/v1/pleroma/admin/media_proxy_caches" do
|
||||||
test "shows banned MediaProxy URLs", %{conn: conn} do
|
test "shows banned MediaProxy URLs", %{conn: conn} do
|
||||||
MediaProxy.put_in_banned_urls([
|
MediaProxy.put_in_banned_urls([
|
||||||
"http://localhost:4001/media/a688346.jpg",
|
"http://localhost:4001/media/a688346.jpg",
|
||||||
|
@ -41,7 +41,7 @@ test "shows banned MediaProxy URLs", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/media_proxy_caches?page_size=2")
|
|> get("/api/v1/pleroma/admin/media_proxy_caches?page_size=2")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert response["page_size"] == 2
|
assert response["page_size"] == 2
|
||||||
|
@ -51,7 +51,7 @@ test "shows banned MediaProxy URLs", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/media_proxy_caches?page_size=2&page=2")
|
|> get("/api/v1/pleroma/admin/media_proxy_caches?page_size=2&page=2")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert response["page_size"] == 2
|
assert response["page_size"] == 2
|
||||||
|
@ -61,7 +61,7 @@ test "shows banned MediaProxy URLs", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/media_proxy_caches?page_size=2&page=3")
|
|> get("/api/v1/pleroma/admin/media_proxy_caches?page_size=2&page=3")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
results = results ++ response["urls"]
|
results = results ++ response["urls"]
|
||||||
|
@ -89,7 +89,7 @@ test "search banned MediaProxy URLs", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/media_proxy_caches?page_size=2&query=F44")
|
|> get("/api/v1/pleroma/admin/media_proxy_caches?page_size=2&query=F44")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert response["urls"] |> Enum.sort() == [
|
assert response["urls"] |> Enum.sort() == [
|
||||||
|
@ -102,7 +102,7 @@ test "search banned MediaProxy URLs", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/media_proxy_caches/delete" do
|
describe "POST /api/v1/pleroma/admin/media_proxy_caches/delete" do
|
||||||
test "deleted MediaProxy URLs from banned", %{conn: conn} do
|
test "deleted MediaProxy URLs from banned", %{conn: conn} do
|
||||||
MediaProxy.put_in_banned_urls([
|
MediaProxy.put_in_banned_urls([
|
||||||
"http://localhost:4001/media/a688346.jpg",
|
"http://localhost:4001/media/a688346.jpg",
|
||||||
|
@ -111,7 +111,7 @@ test "deleted MediaProxy URLs from banned", %{conn: conn} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/media_proxy_caches/delete", %{
|
|> post("/api/v1/pleroma/admin/media_proxy_caches/delete", %{
|
||||||
urls: ["http://localhost:4001/media/a688346.jpg"]
|
urls: ["http://localhost:4001/media/a688346.jpg"]
|
||||||
})
|
})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
@ -121,7 +121,7 @@ test "deleted MediaProxy URLs from banned", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/media_proxy_caches/purge" do
|
describe "POST /api/v1/pleroma/admin/media_proxy_caches/purge" do
|
||||||
test "perform invalidates cache of MediaProxy", %{conn: conn} do
|
test "perform invalidates cache of MediaProxy", %{conn: conn} do
|
||||||
urls = [
|
urls = [
|
||||||
"http://example.com/media/a688346.jpg",
|
"http://example.com/media/a688346.jpg",
|
||||||
|
@ -136,7 +136,7 @@ test "perform invalidates cache of MediaProxy", %{conn: conn} do
|
||||||
] do
|
] do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/media_proxy_caches/purge", %{urls: urls, ban: false})
|
|> post("/api/v1/pleroma/admin/media_proxy_caches/purge", %{urls: urls, ban: false})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
refute MediaProxy.in_banned_urls("http://example.com/media/a688346.jpg")
|
refute MediaProxy.in_banned_urls("http://example.com/media/a688346.jpg")
|
||||||
|
@ -154,7 +154,7 @@ test "perform invalidates cache of MediaProxy and adds url to banned", %{conn: c
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post(
|
|> post(
|
||||||
"/api/pleroma/admin/media_proxy_caches/purge",
|
"/api/v1/pleroma/admin/media_proxy_caches/purge",
|
||||||
%{urls: urls, ban: true}
|
%{urls: urls, ban: true}
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
|
@ -22,12 +22,12 @@ defmodule Pleroma.Web.AdminAPI.OAuthAppControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/oauth_app" do
|
describe "POST /api/v1/pleroma/admin/oauth_app" do
|
||||||
test "errors", %{conn: conn} do
|
test "errors", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/oauth_app", %{})
|
|> post("/api/v1/pleroma/admin/oauth_app", %{})
|
||||||
|> json_response_and_validate_schema(400)
|
|> json_response_and_validate_schema(400)
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
|
@ -42,7 +42,7 @@ test "success", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/oauth_app", %{
|
|> post("/api/v1/pleroma/admin/oauth_app", %{
|
||||||
name: app_name,
|
name: app_name,
|
||||||
redirect_uris: base_url
|
redirect_uris: base_url
|
||||||
})
|
})
|
||||||
|
@ -64,7 +64,7 @@ test "with trusted", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/oauth_app", %{
|
|> post("/api/v1/pleroma/admin/oauth_app", %{
|
||||||
name: app_name,
|
name: app_name,
|
||||||
redirect_uris: base_url,
|
redirect_uris: base_url,
|
||||||
trusted: true
|
trusted: true
|
||||||
|
@ -81,7 +81,7 @@ test "with trusted", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/oauth_app" do
|
describe "GET /api/v1/pleroma/admin/oauth_app" do
|
||||||
setup do
|
setup do
|
||||||
app = insert(:oauth_app)
|
app = insert(:oauth_app)
|
||||||
{:ok, app: app}
|
{:ok, app: app}
|
||||||
|
@ -90,7 +90,7 @@ test "with trusted", %{conn: conn} do
|
||||||
test "list", %{conn: conn} do
|
test "list", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/oauth_app")
|
|> get("/api/v1/pleroma/admin/oauth_app")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert %{"apps" => apps, "count" => count, "page_size" => _} = response
|
assert %{"apps" => apps, "count" => count, "page_size" => _} = response
|
||||||
|
@ -104,7 +104,7 @@ test "with page size", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/oauth_app?page_size=#{page_size}")
|
|> get("/api/v1/pleroma/admin/oauth_app?page_size=#{page_size}")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert %{"apps" => apps, "count" => _, "page_size" => ^page_size} = response
|
assert %{"apps" => apps, "count" => _, "page_size" => ^page_size} = response
|
||||||
|
@ -115,7 +115,7 @@ test "with page size", %{conn: conn} do
|
||||||
test "search by client name", %{conn: conn, app: app} do
|
test "search by client name", %{conn: conn, app: app} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/oauth_app?name=#{app.client_name}")
|
|> get("/api/v1/pleroma/admin/oauth_app?name=#{app.client_name}")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert %{"apps" => [returned], "count" => _, "page_size" => _} = response
|
assert %{"apps" => [returned], "count" => _, "page_size" => _} = response
|
||||||
|
@ -127,7 +127,7 @@ test "search by client name", %{conn: conn, app: app} do
|
||||||
test "search by client id", %{conn: conn, app: app} do
|
test "search by client id", %{conn: conn, app: app} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/oauth_app?client_id=#{app.client_id}")
|
|> get("/api/v1/pleroma/admin/oauth_app?client_id=#{app.client_id}")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert %{"apps" => [returned], "count" => _, "page_size" => _} = response
|
assert %{"apps" => [returned], "count" => _, "page_size" => _} = response
|
||||||
|
@ -141,7 +141,7 @@ test "only trusted", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/oauth_app?trusted=true")
|
|> get("/api/v1/pleroma/admin/oauth_app?trusted=true")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert %{"apps" => [returned], "count" => _, "page_size" => _} = response
|
assert %{"apps" => [returned], "count" => _, "page_size" => _} = response
|
||||||
|
@ -151,13 +151,13 @@ test "only trusted", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE /api/pleroma/admin/oauth_app/:id" do
|
describe "DELETE /api/v1/pleroma/admin/oauth_app/:id" do
|
||||||
test "with id", %{conn: conn} do
|
test "with id", %{conn: conn} do
|
||||||
app = insert(:oauth_app)
|
app = insert(:oauth_app)
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> delete("/api/pleroma/admin/oauth_app/" <> to_string(app.id))
|
|> delete("/api/v1/pleroma/admin/oauth_app/" <> to_string(app.id))
|
||||||
|> json_response_and_validate_schema(:no_content)
|
|> json_response_and_validate_schema(:no_content)
|
||||||
|
|
||||||
assert response == ""
|
assert response == ""
|
||||||
|
@ -166,14 +166,14 @@ test "with id", %{conn: conn} do
|
||||||
test "with non existance id", %{conn: conn} do
|
test "with non existance id", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> delete("/api/pleroma/admin/oauth_app/0")
|
|> delete("/api/v1/pleroma/admin/oauth_app/0")
|
||||||
|> json_response_and_validate_schema(:bad_request)
|
|> json_response_and_validate_schema(:bad_request)
|
||||||
|
|
||||||
assert response == ""
|
assert response == ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PATCH /api/pleroma/admin/oauth_app/:id" do
|
describe "PATCH /api/v1/pleroma/admin/oauth_app/:id" do
|
||||||
test "with id", %{conn: conn} do
|
test "with id", %{conn: conn} do
|
||||||
app = insert(:oauth_app)
|
app = insert(:oauth_app)
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ test "with id", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/oauth_app/#{id}", %{
|
|> patch("/api/v1/pleroma/admin/oauth_app/#{id}", %{
|
||||||
name: name,
|
name: name,
|
||||||
trusted: true,
|
trusted: true,
|
||||||
redirect_uris: url,
|
redirect_uris: url,
|
||||||
|
@ -210,7 +210,7 @@ test "without id", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/oauth_app/0")
|
|> patch("/api/v1/pleroma/admin/oauth_app/0")
|
||||||
|> json_response_and_validate_schema(:bad_request)
|
|> json_response_and_validate_schema(:bad_request)
|
||||||
|
|
||||||
assert response == ""
|
assert response == ""
|
||||||
|
|
|
@ -34,7 +34,7 @@ test "POST /relay", %{conn: conn, admin: admin} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/relay", %{
|
|> post("/api/v1/pleroma/admin/relay", %{
|
||||||
relay_url: "http://mastodon.example.org/users/admin"
|
relay_url: "http://mastodon.example.org/users/admin"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ test "GET /relay", %{conn: conn} do
|
||||||
User.follow(relay_user, user)
|
User.follow(relay_user, user)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/relay")
|
conn = get(conn, "/api/v1/pleroma/admin/relay")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200)["relays"] |> Enum.sort() == [
|
assert json_response_and_validate_schema(conn, 200)["relays"] |> Enum.sort() == [
|
||||||
%{
|
%{
|
||||||
|
@ -72,14 +72,14 @@ test "GET /relay", %{conn: conn} do
|
||||||
test "DELETE /relay", %{conn: conn, admin: admin} do
|
test "DELETE /relay", %{conn: conn, admin: admin} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/relay", %{
|
|> post("/api/v1/pleroma/admin/relay", %{
|
||||||
relay_url: "http://mastodon.example.org/users/admin"
|
relay_url: "http://mastodon.example.org/users/admin"
|
||||||
})
|
})
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> delete("/api/pleroma/admin/relay", %{
|
|> delete("/api/v1/pleroma/admin/relay", %{
|
||||||
relay_url: "http://mastodon.example.org/users/admin"
|
relay_url: "http://mastodon.example.org/users/admin"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/reports/:id" do
|
describe "GET /api/v1/pleroma/admin/reports/:id" do
|
||||||
test "returns report by its id", %{conn: conn} do
|
test "returns report by its id", %{conn: conn} do
|
||||||
[reporter, target_user] = insert_pair(:user)
|
[reporter, target_user] = insert_pair(:user)
|
||||||
activity = insert(:note_activity, user: target_user)
|
activity = insert(:note_activity, user: target_user)
|
||||||
|
@ -39,13 +39,13 @@ test "returns report by its id", %{conn: conn} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/reports/#{report_id}/notes", %{
|
|> post("/api/v1/pleroma/admin/reports/#{report_id}/notes", %{
|
||||||
content: "this is an admin note"
|
content: "this is an admin note"
|
||||||
})
|
})
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/reports/#{report_id}")
|
|> get("/api/v1/pleroma/admin/reports/#{report_id}")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert response["id"] == report_id
|
assert response["id"] == report_id
|
||||||
|
@ -55,13 +55,13 @@ test "returns report by its id", %{conn: conn} do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns 404 when report id is invalid", %{conn: conn} do
|
test "returns 404 when report id is invalid", %{conn: conn} do
|
||||||
conn = get(conn, "/api/pleroma/admin/reports/test")
|
conn = get(conn, "/api/v1/pleroma/admin/reports/test")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, :not_found) == %{"error" => "Not found"}
|
assert json_response_and_validate_schema(conn, :not_found) == %{"error" => "Not found"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PATCH /api/pleroma/admin/reports" do
|
describe "PATCH /api/v1/pleroma/admin/reports" do
|
||||||
setup do
|
setup do
|
||||||
[reporter, target_user] = insert_pair(:user)
|
[reporter, target_user] = insert_pair(:user)
|
||||||
activity = insert(:note_activity, user: target_user)
|
activity = insert(:note_activity, user: target_user)
|
||||||
|
@ -94,7 +94,7 @@ test "requires admin:write:reports scope", %{conn: conn, id: id, admin: admin} d
|
||||||
conn
|
conn
|
||||||
|> assign(:token, read_token)
|
|> assign(:token, read_token)
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [%{"state" => "resolved", "id" => id}]
|
"reports" => [%{"state" => "resolved", "id" => id}]
|
||||||
})
|
})
|
||||||
|> json_response_and_validate_schema(403)
|
|> json_response_and_validate_schema(403)
|
||||||
|
@ -106,7 +106,7 @@ test "requires admin:write:reports scope", %{conn: conn, id: id, admin: admin} d
|
||||||
conn
|
conn
|
||||||
|> assign(:token, write_token)
|
|> assign(:token, write_token)
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [%{"state" => "resolved", "id" => id}]
|
"reports" => [%{"state" => "resolved", "id" => id}]
|
||||||
})
|
})
|
||||||
|> json_response_and_validate_schema(:no_content)
|
|> json_response_and_validate_schema(:no_content)
|
||||||
|
@ -115,7 +115,7 @@ test "requires admin:write:reports scope", %{conn: conn, id: id, admin: admin} d
|
||||||
test "mark report as resolved", %{conn: conn, id: id, admin: admin} do
|
test "mark report as resolved", %{conn: conn, id: id, admin: admin} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [
|
"reports" => [
|
||||||
%{"state" => "resolved", "id" => id}
|
%{"state" => "resolved", "id" => id}
|
||||||
]
|
]
|
||||||
|
@ -134,7 +134,7 @@ test "mark report as resolved", %{conn: conn, id: id, admin: admin} do
|
||||||
test "closes report", %{conn: conn, id: id, admin: admin} do
|
test "closes report", %{conn: conn, id: id, admin: admin} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [
|
"reports" => [
|
||||||
%{"state" => "closed", "id" => id}
|
%{"state" => "closed", "id" => id}
|
||||||
]
|
]
|
||||||
|
@ -154,7 +154,7 @@ test "returns 400 when state is unknown", %{conn: conn, id: id} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [
|
"reports" => [
|
||||||
%{"state" => "test", "id" => id}
|
%{"state" => "test", "id" => id}
|
||||||
]
|
]
|
||||||
|
@ -168,7 +168,7 @@ test "returns 404 when report is not exist", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [
|
"reports" => [
|
||||||
%{"state" => "closed", "id" => "test"}
|
%{"state" => "closed", "id" => "test"}
|
||||||
]
|
]
|
||||||
|
@ -185,7 +185,7 @@ test "updates state of multiple reports", %{
|
||||||
} do
|
} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/reports", %{
|
|> patch("/api/v1/pleroma/admin/reports", %{
|
||||||
"reports" => [
|
"reports" => [
|
||||||
%{"state" => "resolved", "id" => id},
|
%{"state" => "resolved", "id" => id},
|
||||||
%{"state" => "closed", "id" => second_report_id}
|
%{"state" => "closed", "id" => second_report_id}
|
||||||
|
@ -208,7 +208,7 @@ test "updates state of multiple reports", %{
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/reports" do
|
describe "GET /api/v1/pleroma/admin/reports" do
|
||||||
test "returns empty response when no reports created", %{conn: conn} do
|
test "returns empty response when no reports created", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|
@ -300,14 +300,14 @@ test "returns 403 when requested by a non-admin" do
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> get("/api/pleroma/admin/reports")
|
|> get("/api/v1/pleroma/admin/reports")
|
||||||
|
|
||||||
assert json_response(conn, :forbidden) ==
|
assert json_response(conn, :forbidden) ==
|
||||||
%{"error" => "User is not a staff member."}
|
%{"error" => "User is not a staff member."}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns 403 when requested by anonymous" do
|
test "returns 403 when requested by anonymous" do
|
||||||
conn = get(build_conn(), "/api/pleroma/admin/reports")
|
conn = get(build_conn(), "/api/v1/pleroma/admin/reports")
|
||||||
|
|
||||||
assert json_response(conn, :forbidden) == %{
|
assert json_response(conn, :forbidden) == %{
|
||||||
"error" => "Invalid credentials."
|
"error" => "Invalid credentials."
|
||||||
|
@ -315,7 +315,7 @@ test "returns 403 when requested by anonymous" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/admin/reports/:id/notes" do
|
describe "POST /api/v1/pleroma/admin/reports/:id/notes" do
|
||||||
setup %{conn: conn, admin: admin} do
|
setup %{conn: conn, admin: admin} do
|
||||||
[reporter, target_user] = insert_pair(:user)
|
[reporter, target_user] = insert_pair(:user)
|
||||||
activity = insert(:note_activity, user: target_user)
|
activity = insert(:note_activity, user: target_user)
|
||||||
|
@ -329,13 +329,13 @@ test "returns 403 when requested by anonymous" do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/reports/#{report_id}/notes", %{
|
|> post("/api/v1/pleroma/admin/reports/#{report_id}/notes", %{
|
||||||
content: "this is disgusting!"
|
content: "this is disgusting!"
|
||||||
})
|
})
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/reports/#{report_id}/notes", %{
|
|> post("/api/v1/pleroma/admin/reports/#{report_id}/notes", %{
|
||||||
content: "this is disgusting2!"
|
content: "this is disgusting2!"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ test "it creates report note", %{admin_id: admin_id, report_id: report_id} do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns reports with notes", %{conn: conn, admin: admin} do
|
test "it returns reports with notes", %{conn: conn, admin: admin} do
|
||||||
conn = get(conn, "/api/pleroma/admin/reports")
|
conn = get(conn, "/api/v1/pleroma/admin/reports")
|
||||||
|
|
||||||
response = json_response_and_validate_schema(conn, 200)
|
response = json_response_and_validate_schema(conn, 200)
|
||||||
notes = hd(response["reports"])["notes"]
|
notes = hd(response["reports"])["notes"]
|
||||||
|
@ -379,7 +379,7 @@ test "it deletes the note", %{conn: conn, report_id: report_id} do
|
||||||
assert ReportNote |> Repo.all() |> length() == 2
|
assert ReportNote |> Repo.all() |> length() == 2
|
||||||
assert [note, _] = Repo.all(ReportNote)
|
assert [note, _] = Repo.all(ReportNote)
|
||||||
|
|
||||||
delete(conn, "/api/pleroma/admin/reports/#{report_id}/notes/#{note.id}")
|
delete(conn, "/api/v1/pleroma/admin/reports/#{report_id}/notes/#{note.id}")
|
||||||
|
|
||||||
assert ReportNote |> Repo.all() |> length() == 1
|
assert ReportNote |> Repo.all() |> length() == 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,10 +25,10 @@ defmodule Pleroma.Web.AdminAPI.StatusControllerTest do
|
||||||
{:ok, %{admin: admin, token: token, conn: conn}}
|
{:ok, %{admin: admin, token: token, conn: conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/statuses/:id" do
|
describe "GET /api/v1/pleroma/admin/statuses/:id" do
|
||||||
test "not found", %{conn: conn} do
|
test "not found", %{conn: conn} do
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/admin/statuses/not_found")
|
|> get("/api/v1/pleroma/admin/statuses/not_found")
|
||||||
|> json_response_and_validate_schema(:not_found)
|
|> json_response_and_validate_schema(:not_found)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ test "shows activity", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/statuses/#{activity.id}")
|
|> get("/api/v1/pleroma/admin/statuses/#{activity.id}")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert response["id"] == activity.id
|
assert response["id"] == activity.id
|
||||||
|
@ -52,7 +52,7 @@ test "shows activity", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PUT /api/pleroma/admin/statuses/:id" do
|
describe "PUT /api/v1/pleroma/admin/statuses/:id" do
|
||||||
setup do
|
setup do
|
||||||
activity = insert(:note_activity)
|
activity = insert(:note_activity)
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ test "toggle sensitive flag", %{conn: conn, id: id, admin: admin} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> put("/api/pleroma/admin/statuses/#{id}", %{"sensitive" => "true"})
|
|> put("/api/v1/pleroma/admin/statuses/#{id}", %{"sensitive" => "true"})
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert response["sensitive"]
|
assert response["sensitive"]
|
||||||
|
@ -76,7 +76,7 @@ test "toggle sensitive flag", %{conn: conn, id: id, admin: admin} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> put("/api/pleroma/admin/statuses/#{id}", %{"sensitive" => "false"})
|
|> put("/api/v1/pleroma/admin/statuses/#{id}", %{"sensitive" => "false"})
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
refute response["sensitive"]
|
refute response["sensitive"]
|
||||||
|
@ -86,7 +86,7 @@ test "change visibility flag", %{conn: conn, id: id, admin: admin} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> put("/api/pleroma/admin/statuses/#{id}", %{visibility: "public"})
|
|> put("/api/v1/pleroma/admin/statuses/#{id}", %{visibility: "public"})
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert response["visibility"] == "public"
|
assert response["visibility"] == "public"
|
||||||
|
@ -99,7 +99,7 @@ test "change visibility flag", %{conn: conn, id: id, admin: admin} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> put("/api/pleroma/admin/statuses/#{id}", %{visibility: "private"})
|
|> put("/api/v1/pleroma/admin/statuses/#{id}", %{visibility: "private"})
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert response["visibility"] == "private"
|
assert response["visibility"] == "private"
|
||||||
|
@ -107,7 +107,7 @@ test "change visibility flag", %{conn: conn, id: id, admin: admin} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> put("/api/pleroma/admin/statuses/#{id}", %{visibility: "unlisted"})
|
|> put("/api/v1/pleroma/admin/statuses/#{id}", %{visibility: "unlisted"})
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
assert response["visibility"] == "unlisted"
|
assert response["visibility"] == "unlisted"
|
||||||
|
@ -117,14 +117,14 @@ test "returns 400 when visibility is unknown", %{conn: conn, id: id} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> put("/api/pleroma/admin/statuses/#{id}", %{visibility: "test"})
|
|> put("/api/v1/pleroma/admin/statuses/#{id}", %{visibility: "test"})
|
||||||
|
|
||||||
assert %{"error" => "test - Invalid value for enum."} =
|
assert %{"error" => "test - Invalid value for enum."} =
|
||||||
json_response_and_validate_schema(conn, :bad_request)
|
json_response_and_validate_schema(conn, :bad_request)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE /api/pleroma/admin/statuses/:id" do
|
describe "DELETE /api/v1/pleroma/admin/statuses/:id" do
|
||||||
setup do
|
setup do
|
||||||
activity = insert(:note_activity)
|
activity = insert(:note_activity)
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ test "returns 400 when visibility is unknown", %{conn: conn, id: id} do
|
||||||
|
|
||||||
test "deletes status", %{conn: conn, id: id, admin: admin} do
|
test "deletes status", %{conn: conn, id: id, admin: admin} do
|
||||||
conn
|
conn
|
||||||
|> delete("/api/pleroma/admin/statuses/#{id}")
|
|> delete("/api/v1/pleroma/admin/statuses/#{id}")
|
||||||
|> json_response_and_validate_schema(:ok)
|
|> json_response_and_validate_schema(:ok)
|
||||||
|
|
||||||
refute Activity.get_by_id(id)
|
refute Activity.get_by_id(id)
|
||||||
|
@ -145,13 +145,13 @@ test "deletes status", %{conn: conn, id: id, admin: admin} do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "returns 404 when the status does not exist", %{conn: conn} do
|
test "returns 404 when the status does not exist", %{conn: conn} do
|
||||||
conn = delete(conn, "/api/pleroma/admin/statuses/test")
|
conn = delete(conn, "/api/v1/pleroma/admin/statuses/test")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, :not_found) == %{"error" => "Not found"}
|
assert json_response_and_validate_schema(conn, :not_found) == %{"error" => "Not found"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/statuses" do
|
describe "GET /api/v1/pleroma/admin/statuses" do
|
||||||
test "returns all public and unlisted statuses", %{conn: conn, admin: admin} do
|
test "returns all public and unlisted statuses", %{conn: conn, admin: admin} do
|
||||||
blocked = insert(:user)
|
blocked = insert(:user)
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
@ -166,7 +166,7 @@ test "returns all public and unlisted statuses", %{conn: conn, admin: admin} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/statuses")
|
|> get("/api/v1/pleroma/admin/statuses")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
refute "private" in Enum.map(response, & &1["visibility"])
|
refute "private" in Enum.map(response, & &1["visibility"])
|
||||||
|
@ -181,7 +181,7 @@ test "returns only local statuses with local_only on", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/statuses?local_only=true")
|
|> get("/api/v1/pleroma/admin/statuses?local_only=true")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert length(response) == 1
|
assert length(response) == 1
|
||||||
|
@ -194,7 +194,7 @@ test "returns private and direct statuses with godmode on", %{conn: conn, admin:
|
||||||
|
|
||||||
{:ok, _} = CommonAPI.post(user, %{status: ".", visibility: "private"})
|
{:ok, _} = CommonAPI.post(user, %{status: ".", visibility: "private"})
|
||||||
{:ok, _} = CommonAPI.post(user, %{status: ".", visibility: "public"})
|
{:ok, _} = CommonAPI.post(user, %{status: ".", visibility: "public"})
|
||||||
conn = get(conn, "/api/pleroma/admin/statuses?godmode=true")
|
conn = get(conn, "/api/v1/pleroma/admin/statuses?godmode=true")
|
||||||
assert json_response_and_validate_schema(conn, 200) |> length() == 3
|
assert json_response_and_validate_schema(conn, 200) |> length() == 3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,15 +42,16 @@ test "with valid `admin_token` query parameter, skips OAuth scopes check" do
|
||||||
|
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn = get(build_conn(), "/api/pleroma/admin/users/#{user.nickname}?admin_token=password123")
|
conn =
|
||||||
|
get(build_conn(), "/api/v1/pleroma/admin/users/#{user.nickname}?admin_token=password123")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200)
|
assert json_response_and_validate_schema(conn, 200)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope",
|
test "GET /api/v1/pleroma/admin/users/:nickname requires admin:read:accounts or broader scope",
|
||||||
%{admin: admin} do
|
%{admin: admin} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
url = "/api/pleroma/admin/users/#{user.nickname}"
|
url = "/api/v1/pleroma/admin/users/#{user.nickname}"
|
||||||
|
|
||||||
good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"])
|
good_token1 = insert(:oauth_token, user: admin, scopes: ["admin"])
|
||||||
good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"])
|
good_token2 = insert(:oauth_token, user: admin, scopes: ["admin:read"])
|
||||||
|
@ -91,7 +92,7 @@ test "GET /api/pleroma/admin/users/:nickname requires admin:read:accounts or bro
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "DELETE /api/pleroma/admin/users" do
|
describe "DELETE /api/v1/pleroma/admin/users" do
|
||||||
test "single user", %{admin: admin, conn: conn} do
|
test "single user", %{admin: admin, conn: conn} do
|
||||||
clear_config([:instance, :federating], true)
|
clear_config([:instance, :federating], true)
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ test "single user", %{admin: admin, conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> delete("/api/pleroma/admin/users?nickname=#{user.nickname}")
|
|> delete("/api/v1/pleroma/admin/users?nickname=#{user.nickname}")
|
||||||
|
|
||||||
ObanHelpers.perform_all()
|
ObanHelpers.perform_all()
|
||||||
|
|
||||||
|
@ -156,7 +157,7 @@ test "multiple users", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> delete("/api/pleroma/admin/users", %{
|
|> delete("/api/v1/pleroma/admin/users", %{
|
||||||
nicknames: [user_one.nickname, user_two.nickname]
|
nicknames: [user_one.nickname, user_two.nickname]
|
||||||
})
|
})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
@ -170,13 +171,13 @@ test "multiple users", %{admin: admin, conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/admin/users" do
|
describe "/api/v1/pleroma/admin/users" do
|
||||||
test "Create", %{conn: conn} do
|
test "Create", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users", %{
|
|> post("/api/v1/pleroma/admin/users", %{
|
||||||
"users" => [
|
"users" => [
|
||||||
%{
|
%{
|
||||||
"nickname" => "lain",
|
"nickname" => "lain",
|
||||||
|
@ -207,7 +208,7 @@ test "Cannot create user with existing email", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users", %{
|
|> post("/api/v1/pleroma/admin/users", %{
|
||||||
"users" => [
|
"users" => [
|
||||||
%{
|
%{
|
||||||
"nickname" => "lain",
|
"nickname" => "lain",
|
||||||
|
@ -237,7 +238,7 @@ test "Cannot create user with existing nickname", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users", %{
|
|> post("/api/v1/pleroma/admin/users", %{
|
||||||
"users" => [
|
"users" => [
|
||||||
%{
|
%{
|
||||||
"nickname" => user.nickname,
|
"nickname" => user.nickname,
|
||||||
|
@ -267,7 +268,7 @@ test "Multiple user creation works in transaction", %{conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users", %{
|
|> post("/api/v1/pleroma/admin/users", %{
|
||||||
"users" => [
|
"users" => [
|
||||||
%{
|
%{
|
||||||
"nickname" => "newuser",
|
"nickname" => "newuser",
|
||||||
|
@ -307,11 +308,11 @@ test "Multiple user creation works in transaction", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/admin/users/:nickname" do
|
describe "/api/v1/pleroma/admin/users/:nickname" do
|
||||||
test "Show", %{conn: conn} do
|
test "Show", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}")
|
conn = get(conn, "/api/v1/pleroma/admin/users/#{user.nickname}")
|
||||||
|
|
||||||
assert user_response(user) == json_response_and_validate_schema(conn, 200)
|
assert user_response(user) == json_response_and_validate_schema(conn, 200)
|
||||||
end
|
end
|
||||||
|
@ -319,13 +320,13 @@ test "Show", %{conn: conn} do
|
||||||
test "when the user doesn't exist", %{conn: conn} do
|
test "when the user doesn't exist", %{conn: conn} do
|
||||||
user = build(:user)
|
user = build(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}")
|
conn = get(conn, "/api/v1/pleroma/admin/users/#{user.nickname}")
|
||||||
|
|
||||||
assert %{"error" => "Not found"} == json_response_and_validate_schema(conn, 404)
|
assert %{"error" => "Not found"} == json_response_and_validate_schema(conn, 404)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/admin/users/follow" do
|
describe "/api/v1/pleroma/admin/users/follow" do
|
||||||
test "allows to force-follow another user", %{admin: admin, conn: conn} do
|
test "allows to force-follow another user", %{admin: admin, conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
follower = insert(:user)
|
follower = insert(:user)
|
||||||
|
@ -333,7 +334,7 @@ test "allows to force-follow another user", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/follow", %{
|
|> post("/api/v1/pleroma/admin/users/follow", %{
|
||||||
"follower" => follower.nickname,
|
"follower" => follower.nickname,
|
||||||
"followed" => user.nickname
|
"followed" => user.nickname
|
||||||
})
|
})
|
||||||
|
@ -350,7 +351,7 @@ test "allows to force-follow another user", %{admin: admin, conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/admin/users/unfollow" do
|
describe "/api/v1/pleroma/admin/users/unfollow" do
|
||||||
test "allows to force-unfollow another user", %{admin: admin, conn: conn} do
|
test "allows to force-unfollow another user", %{admin: admin, conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
follower = insert(:user)
|
follower = insert(:user)
|
||||||
|
@ -360,7 +361,7 @@ test "allows to force-unfollow another user", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("accept", "application/json")
|
|> put_req_header("accept", "application/json")
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("/api/pleroma/admin/users/unfollow", %{
|
|> post("/api/v1/pleroma/admin/users/unfollow", %{
|
||||||
"follower" => follower.nickname,
|
"follower" => follower.nickname,
|
||||||
"followed" => user.nickname
|
"followed" => user.nickname
|
||||||
})
|
})
|
||||||
|
@ -377,12 +378,12 @@ test "allows to force-unfollow another user", %{admin: admin, conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/admin/users" do
|
describe "GET /api/v1/pleroma/admin/users" do
|
||||||
test "renders users array for the first page", %{conn: conn, admin: admin} do
|
test "renders users array for the first page", %{conn: conn, admin: admin} do
|
||||||
user = insert(:user, local: false, tags: ["foo", "bar"])
|
user = insert(:user, local: false, tags: ["foo", "bar"])
|
||||||
user2 = insert(:user, is_approved: false, 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")
|
conn = get(conn, "/api/v1/pleroma/admin/users?page=1")
|
||||||
|
|
||||||
users = [
|
users = [
|
||||||
user_response(
|
user_response(
|
||||||
|
@ -415,7 +416,7 @@ test "pagination works correctly with service users", %{conn: conn} do
|
||||||
|
|
||||||
assert %{"count" => 26, "page_size" => 10, "users" => users1} =
|
assert %{"count" => 26, "page_size" => 10, "users" => users1} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users?page=1&filters=", %{page_size: "10"})
|
|> get("/api/v1/pleroma/admin/users?page=1&filters=", %{page_size: "10"})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert Enum.count(users1) == 10
|
assert Enum.count(users1) == 10
|
||||||
|
@ -423,7 +424,7 @@ test "pagination works correctly with service users", %{conn: conn} do
|
||||||
|
|
||||||
assert %{"count" => 26, "page_size" => 10, "users" => users2} =
|
assert %{"count" => 26, "page_size" => 10, "users" => users2} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users?page=2&filters=", %{page_size: "10"})
|
|> get("/api/v1/pleroma/admin/users?page=2&filters=", %{page_size: "10"})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert Enum.count(users2) == 10
|
assert Enum.count(users2) == 10
|
||||||
|
@ -431,7 +432,7 @@ test "pagination works correctly with service users", %{conn: conn} do
|
||||||
|
|
||||||
assert %{"count" => 26, "page_size" => 10, "users" => users3} =
|
assert %{"count" => 26, "page_size" => 10, "users" => users3} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users?page=3&filters=", %{page_size: "10"})
|
|> get("/api/v1/pleroma/admin/users?page=3&filters=", %{page_size: "10"})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert Enum.count(users3) == 6
|
assert Enum.count(users3) == 6
|
||||||
|
@ -441,7 +442,7 @@ test "pagination works correctly with service users", %{conn: conn} do
|
||||||
test "renders empty array for the second page", %{conn: conn} do
|
test "renders empty array for the second page", %{conn: conn} do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?page=2")
|
conn = get(conn, "/api/v1/pleroma/admin/users?page=2")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 2,
|
"count" => 2,
|
||||||
|
@ -453,7 +454,7 @@ test "renders empty array for the second page", %{conn: conn} do
|
||||||
test "regular search", %{conn: conn} do
|
test "regular search", %{conn: conn} do
|
||||||
user = insert(:user, nickname: "bob")
|
user = insert(:user, nickname: "bob")
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?query=bo")
|
conn = get(conn, "/api/v1/pleroma/admin/users?query=bo")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -466,7 +467,7 @@ test "search by domain", %{conn: conn} do
|
||||||
user = insert(:user, nickname: "nickname@domain.com")
|
user = insert(:user, nickname: "nickname@domain.com")
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?query=domain.com")
|
conn = get(conn, "/api/v1/pleroma/admin/users?query=domain.com")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -479,7 +480,7 @@ test "search by full nickname", %{conn: conn} do
|
||||||
user = insert(:user, nickname: "nickname@domain.com")
|
user = insert(:user, nickname: "nickname@domain.com")
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?query=nickname@domain.com")
|
conn = get(conn, "/api/v1/pleroma/admin/users?query=nickname@domain.com")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -492,7 +493,7 @@ test "search by display name", %{conn: conn} do
|
||||||
user = insert(:user, name: "Display name")
|
user = insert(:user, name: "Display name")
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?name=display")
|
conn = get(conn, "/api/v1/pleroma/admin/users?name=display")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -505,7 +506,7 @@ test "search by email", %{conn: conn} do
|
||||||
user = insert(:user, email: "email@example.com")
|
user = insert(:user, email: "email@example.com")
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?email=email@example.com")
|
conn = get(conn, "/api/v1/pleroma/admin/users?email=email@example.com")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -518,7 +519,7 @@ test "regular search with page size", %{conn: conn} do
|
||||||
user = insert(:user, nickname: "aalice")
|
user = insert(:user, nickname: "aalice")
|
||||||
user2 = insert(:user, nickname: "alice")
|
user2 = insert(:user, nickname: "alice")
|
||||||
|
|
||||||
conn1 = get(conn, "/api/pleroma/admin/users?query=a&page_size=1&page=1")
|
conn1 = get(conn, "/api/v1/pleroma/admin/users?query=a&page_size=1&page=1")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn1, 200) == %{
|
assert json_response_and_validate_schema(conn1, 200) == %{
|
||||||
"count" => 2,
|
"count" => 2,
|
||||||
|
@ -526,7 +527,7 @@ test "regular search with page size", %{conn: conn} do
|
||||||
"users" => [user_response(user2)]
|
"users" => [user_response(user2)]
|
||||||
}
|
}
|
||||||
|
|
||||||
conn2 = get(conn, "/api/pleroma/admin/users?query=a&page_size=1&page=2")
|
conn2 = get(conn, "/api/v1/pleroma/admin/users?query=a&page_size=1&page=2")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn2, 200) == %{
|
assert json_response_and_validate_schema(conn2, 200) == %{
|
||||||
"count" => 2,
|
"count" => 2,
|
||||||
|
@ -546,7 +547,7 @@ test "only local users" do
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> get("/api/pleroma/admin/users?query=bo&filters=local")
|
|> get("/api/v1/pleroma/admin/users?query=bo&filters=local")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -561,7 +562,7 @@ test "only local users with no query", %{conn: conn, admin: old_admin} do
|
||||||
|
|
||||||
insert(:user, nickname: "bobb", local: false)
|
insert(:user, nickname: "bobb", local: false)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?filters=local")
|
conn = get(conn, "/api/v1/pleroma/admin/users?filters=local")
|
||||||
|
|
||||||
users = [
|
users = [
|
||||||
user_response(user),
|
user_response(user),
|
||||||
|
@ -590,7 +591,7 @@ test "only unconfirmed users", %{conn: conn} do
|
||||||
|
|
||||||
result =
|
result =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/admin/users?filters=unconfirmed")
|
|> get("/api/v1/pleroma/admin/users?filters=unconfirmed")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
users =
|
users =
|
||||||
|
@ -614,7 +615,7 @@ test "only unapproved users", %{conn: conn} do
|
||||||
|
|
||||||
insert(:user, nickname: "happyboy", is_approved: true)
|
insert(:user, nickname: "happyboy", is_approved: true)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?filters=need_approval")
|
conn = get(conn, "/api/v1/pleroma/admin/users?filters=need_approval")
|
||||||
|
|
||||||
users = [
|
users = [
|
||||||
user_response(
|
user_response(
|
||||||
|
@ -635,7 +636,7 @@ test "load only admins", %{conn: conn, admin: admin} do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?filters=is_admin")
|
conn = get(conn, "/api/v1/pleroma/admin/users?filters=is_admin")
|
||||||
|
|
||||||
users = [
|
users = [
|
||||||
user_response(second_admin, %{
|
user_response(second_admin, %{
|
||||||
|
@ -660,7 +661,7 @@ test "load only moderators", %{conn: conn} do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?filters=is_moderator")
|
conn = get(conn, "/api/v1/pleroma/admin/users?filters=is_moderator")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -739,7 +740,7 @@ test "load users with tags list", %{conn: conn} do
|
||||||
insert(:user)
|
insert(:user)
|
||||||
insert(:user)
|
insert(:user)
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users?tags[]=first&tags[]=second")
|
conn = get(conn, "/api/v1/pleroma/admin/users?tags[]=first&tags[]=second")
|
||||||
|
|
||||||
users = [
|
users = [
|
||||||
user_response(user2, %{"tags" => ["second"]}),
|
user_response(user2, %{"tags" => ["second"]}),
|
||||||
|
@ -762,7 +763,7 @@ test "`active` filters out users pending approval", %{token: token} do
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, token.user)
|
|> assign(:user, token.user)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> get("/api/pleroma/admin/users?filters=active")
|
|> get("/api/v1/pleroma/admin/users?filters=active")
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
"count" => 2,
|
"count" => 2,
|
||||||
|
@ -786,7 +787,7 @@ test "it works with multiple filters" do
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, admin)
|
|> assign(:user, admin)
|
||||||
|> assign(:token, token)
|
|> assign(:token, token)
|
||||||
|> get("/api/pleroma/admin/users?filters=deactivated,external")
|
|> get("/api/v1/pleroma/admin/users?filters=deactivated,external")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -798,7 +799,7 @@ test "it works with multiple filters" do
|
||||||
test "it omits relay user", %{admin: admin, conn: conn} do
|
test "it omits relay user", %{admin: admin, conn: conn} do
|
||||||
assert %User{} = Relay.get_actor()
|
assert %User{} = Relay.get_actor()
|
||||||
|
|
||||||
conn = get(conn, "/api/pleroma/admin/users")
|
conn = get(conn, "/api/v1/pleroma/admin/users")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{
|
assert json_response_and_validate_schema(conn, 200) == %{
|
||||||
"count" => 1,
|
"count" => 1,
|
||||||
|
@ -810,7 +811,7 @@ test "it omits relay user", %{admin: admin, conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do
|
test "PATCH /api/v1/pleroma/admin/users/activate", %{admin: admin, conn: conn} do
|
||||||
user_one = insert(:user, is_active: false)
|
user_one = insert(:user, is_active: false)
|
||||||
user_two = insert(:user, is_active: false)
|
user_two = insert(:user, is_active: false)
|
||||||
|
|
||||||
|
@ -818,7 +819,7 @@ test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch(
|
|> patch(
|
||||||
"/api/pleroma/admin/users/activate",
|
"/api/v1/pleroma/admin/users/activate",
|
||||||
%{nicknames: [user_one.nickname, user_two.nickname]}
|
%{nicknames: [user_one.nickname, user_two.nickname]}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -831,7 +832,7 @@ test "PATCH /api/pleroma/admin/users/activate", %{admin: admin, conn: conn} do
|
||||||
"@#{admin.nickname} activated users: @#{user_one.nickname}, @#{user_two.nickname}"
|
"@#{admin.nickname} activated users: @#{user_one.nickname}, @#{user_two.nickname}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do
|
test "PATCH /api/v1/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do
|
||||||
user_one = insert(:user, is_active: true)
|
user_one = insert(:user, is_active: true)
|
||||||
user_two = insert(:user, is_active: true)
|
user_two = insert(:user, is_active: true)
|
||||||
|
|
||||||
|
@ -839,7 +840,7 @@ test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch(
|
|> patch(
|
||||||
"/api/pleroma/admin/users/deactivate",
|
"/api/v1/pleroma/admin/users/deactivate",
|
||||||
%{nicknames: [user_one.nickname, user_two.nickname]}
|
%{nicknames: [user_one.nickname, user_two.nickname]}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -852,7 +853,7 @@ test "PATCH /api/pleroma/admin/users/deactivate", %{admin: admin, conn: conn} do
|
||||||
"@#{admin.nickname} deactivated users: @#{user_one.nickname}, @#{user_two.nickname}"
|
"@#{admin.nickname} deactivated users: @#{user_one.nickname}, @#{user_two.nickname}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
|
test "PATCH /api/v1/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
|
||||||
user_one = insert(:user, is_approved: false)
|
user_one = insert(:user, is_approved: false)
|
||||||
user_two = insert(:user, is_approved: false)
|
user_two = insert(:user, is_approved: false)
|
||||||
|
|
||||||
|
@ -860,7 +861,7 @@ test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch(
|
|> patch(
|
||||||
"/api/pleroma/admin/users/approve",
|
"/api/v1/pleroma/admin/users/approve",
|
||||||
%{nicknames: [user_one.nickname, user_two.nickname]}
|
%{nicknames: [user_one.nickname, user_two.nickname]}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -873,7 +874,7 @@ test "PATCH /api/pleroma/admin/users/approve", %{admin: admin, conn: conn} do
|
||||||
"@#{admin.nickname} approved users: @#{user_one.nickname}, @#{user_two.nickname}"
|
"@#{admin.nickname} approved users: @#{user_one.nickname}, @#{user_two.nickname}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/suggest", %{admin: admin, conn: conn} do
|
test "PATCH /api/v1/pleroma/admin/users/suggest", %{admin: admin, conn: conn} do
|
||||||
user1 = insert(:user, is_suggested: false)
|
user1 = insert(:user, is_suggested: false)
|
||||||
user2 = insert(:user, is_suggested: false)
|
user2 = insert(:user, is_suggested: false)
|
||||||
|
|
||||||
|
@ -881,7 +882,7 @@ test "PATCH /api/pleroma/admin/users/suggest", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch(
|
|> patch(
|
||||||
"/api/pleroma/admin/users/suggest",
|
"/api/v1/pleroma/admin/users/suggest",
|
||||||
%{nicknames: [user1.nickname, user2.nickname]}
|
%{nicknames: [user1.nickname, user2.nickname]}
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
@ -898,7 +899,7 @@ test "PATCH /api/pleroma/admin/users/suggest", %{admin: admin, conn: conn} do
|
||||||
"@#{admin.nickname} added suggested users: @#{user1.nickname}, @#{user2.nickname}"
|
"@#{admin.nickname} added suggested users: @#{user1.nickname}, @#{user2.nickname}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/unsuggest", %{admin: admin, conn: conn} do
|
test "PATCH /api/v1/pleroma/admin/users/unsuggest", %{admin: admin, conn: conn} do
|
||||||
user1 = insert(:user, is_suggested: true)
|
user1 = insert(:user, is_suggested: true)
|
||||||
user2 = insert(:user, is_suggested: true)
|
user2 = insert(:user, is_suggested: true)
|
||||||
|
|
||||||
|
@ -906,7 +907,7 @@ test "PATCH /api/pleroma/admin/users/unsuggest", %{admin: admin, conn: conn} do
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch(
|
|> patch(
|
||||||
"/api/pleroma/admin/users/unsuggest",
|
"/api/v1/pleroma/admin/users/unsuggest",
|
||||||
%{nicknames: [user1.nickname, user2.nickname]}
|
%{nicknames: [user1.nickname, user2.nickname]}
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
@ -923,13 +924,16 @@ test "PATCH /api/pleroma/admin/users/unsuggest", %{admin: admin, conn: conn} do
|
||||||
"@#{admin.nickname} removed suggested users: @#{user1.nickname}, @#{user2.nickname}"
|
"@#{admin.nickname} removed suggested users: @#{user1.nickname}, @#{user2.nickname}"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "PATCH /api/pleroma/admin/users/:nickname/toggle_activation", %{admin: admin, conn: conn} do
|
test "PATCH /api/v1/pleroma/admin/users/:nickname/toggle_activation", %{
|
||||||
|
admin: admin,
|
||||||
|
conn: conn
|
||||||
|
} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> patch("/api/pleroma/admin/users/#{user.nickname}/toggle_activation")
|
|> patch("/api/v1/pleroma/admin/users/#{user.nickname}/toggle_activation")
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) ==
|
assert json_response_and_validate_schema(conn, 200) ==
|
||||||
user_response(
|
user_response(
|
||||||
|
|
|
@ -72,12 +72,6 @@ test "GET /main/all", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api*path", %{conn: conn} do
|
|
||||||
assert conn
|
|
||||||
|> get("/api/foo")
|
|
||||||
|> json_response(404) == %{"error" => "Not implemented"}
|
|
||||||
end
|
|
||||||
|
|
||||||
test "GET /pleroma/admin -> /pleroma/admin/", %{conn: conn} do
|
test "GET /pleroma/admin -> /pleroma/admin/", %{conn: conn} do
|
||||||
assert redirected_to(get(conn, "/pleroma/admin")) =~ "/pleroma/admin/"
|
assert redirected_to(get(conn, "/pleroma/admin")) =~ "/pleroma/admin/"
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ test "posting a status does not increment reblog_count when relaying", %{conn: c
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"content_type" => "text/plain",
|
"content_type" => "text/plain",
|
||||||
"source" => "Pleroma FE",
|
"source" => "Pleroma FE",
|
||||||
"status" => "Hello world",
|
"status" => "Hello world",
|
||||||
|
@ -51,7 +51,7 @@ test "posting a status does not increment reblog_count when relaying", %{conn: c
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("api/v1/statuses/#{response["id"]}", %{})
|
|> get("/api/v1/statuses/#{response["id"]}", %{})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert response["reblogs_count"] == 0
|
assert response["reblogs_count"] == 0
|
||||||
|
@ -110,7 +110,7 @@ test "posting a status", %{conn: conn} do
|
||||||
conn_four =
|
conn_four =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"status" => "oolong",
|
"status" => "oolong",
|
||||||
"expires_in" => expires_in
|
"expires_in" => expires_in
|
||||||
})
|
})
|
||||||
|
@ -133,7 +133,7 @@ test "automatically setting a post expiry if status_ttl_days is set" do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"status" => "aa chikichiki banban"
|
"status" => "aa chikichiki banban"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ test "it fails to create a status if `expires_in` is less or equal than an hour"
|
||||||
assert %{"error" => "Expiry date is too soon"} =
|
assert %{"error" => "Expiry date is too soon"} =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"status" => "oolong",
|
"status" => "oolong",
|
||||||
"expires_in" => expires_in
|
"expires_in" => expires_in
|
||||||
})
|
})
|
||||||
|
@ -176,7 +176,7 @@ test "it fails to create a status if `expires_in` is less or equal than an hour"
|
||||||
assert %{"error" => "Expiry date is too soon"} =
|
assert %{"error" => "Expiry date is too soon"} =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"status" => "oolong",
|
"status" => "oolong",
|
||||||
"expires_in" => expires_in
|
"expires_in" => expires_in
|
||||||
})
|
})
|
||||||
|
@ -190,7 +190,7 @@ test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do
|
||||||
assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} =
|
assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{"status" => "GNO/Linux"})
|
|> post("/api/v1/statuses", %{"status" => "GNO/Linux"})
|
||||||
|> json_response_and_validate_schema(422)
|
|> json_response_and_validate_schema(422)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ test "posting a direct status", %{conn: conn} do
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{"status" => content, "visibility" => "direct"})
|
|> post("/api/v1/statuses", %{"status" => content, "visibility" => "direct"})
|
||||||
|
|
||||||
assert %{"id" => id} = response = json_response_and_validate_schema(conn, 200)
|
assert %{"id" => id} = response = json_response_and_validate_schema(conn, 200)
|
||||||
assert response["visibility"] == "direct"
|
assert response["visibility"] == "direct"
|
||||||
|
@ -420,7 +420,7 @@ test "discloses application metadata when enabled" do
|
||||||
|
|
||||||
result =
|
result =
|
||||||
conn
|
conn
|
||||||
|> get("api/v1/statuses/#{activity}")
|
|> get("/api/v1/statuses/#{activity}")
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
"content" => "cofe is my copilot",
|
"content" => "cofe is my copilot",
|
||||||
|
@ -449,7 +449,7 @@ test "hides application metadata when disabled" do
|
||||||
|
|
||||||
result =
|
result =
|
||||||
conn
|
conn
|
||||||
|> get("api/v1/statuses/#{activity}")
|
|> get("/api/v1/statuses/#{activity}")
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
"content" => "club mate is my wingman",
|
"content" => "club mate is my wingman",
|
||||||
|
@ -1342,7 +1342,7 @@ test "on pin removes deletion job, on unpin reschedule deletion" do
|
||||||
assert %{"id" => id} =
|
assert %{"id" => id} =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> post("api/v1/statuses", %{
|
|> post("/api/v1/statuses", %{
|
||||||
"status" => "oolong",
|
"status" => "oolong",
|
||||||
"expires_in" => expires_in
|
"expires_in" => expires_in
|
||||||
})
|
})
|
||||||
|
@ -1511,7 +1511,7 @@ test "Repeated posts that are replies incorrectly have in_reply_to_id null", %{c
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user3)
|
|> assign(:user, user3)
|
||||||
|> assign(:token, insert(:oauth_token, user: user3, scopes: ["read:statuses"]))
|
|> assign(:token, insert(:oauth_token, user: user3, scopes: ["read:statuses"]))
|
||||||
|> get("api/v1/timelines/home")
|
|> get("/api/v1/timelines/home")
|
||||||
|
|
||||||
[reblogged_activity] = json_response_and_validate_schema(conn3, 200)
|
[reblogged_activity] = json_response_and_validate_schema(conn3, 200)
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,7 @@ test "doesn't return posts from users who blocked you when :blockers_visible is
|
||||||
get(conn, "/api/v1/timelines/public")
|
get(conn, "/api/v1/timelines/public")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert length(response) == 0
|
assert response == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "doesn't return replies if follow is posting with users from blocked domain" do
|
test "doesn't return replies if follow is posting with users from blocked domain" do
|
||||||
|
@ -527,7 +527,7 @@ test "direct timeline", %{conn: conn} do
|
||||||
|> assign(:token, insert(:oauth_token, user: user_two, scopes: ["read:statuses"]))
|
|> assign(:token, insert(:oauth_token, user: user_two, scopes: ["read:statuses"]))
|
||||||
|
|
||||||
# Only direct should be visible here
|
# Only direct should be visible here
|
||||||
res_conn = get(conn_user_two, "api/v1/timelines/direct")
|
res_conn = get(conn_user_two, "/api/v1/timelines/direct")
|
||||||
|
|
||||||
assert [status] = json_response_and_validate_schema(res_conn, :ok)
|
assert [status] = json_response_and_validate_schema(res_conn, :ok)
|
||||||
|
|
||||||
|
@ -539,14 +539,14 @@ test "direct timeline", %{conn: conn} do
|
||||||
build_conn()
|
build_conn()
|
||||||
|> assign(:user, user_one)
|
|> assign(:user, user_one)
|
||||||
|> assign(:token, insert(:oauth_token, user: user_one, scopes: ["read:statuses"]))
|
|> assign(:token, insert(:oauth_token, user: user_one, scopes: ["read:statuses"]))
|
||||||
|> get("api/v1/timelines/direct")
|
|> get("/api/v1/timelines/direct")
|
||||||
|
|
||||||
[status] = json_response_and_validate_schema(res_conn, :ok)
|
[status] = json_response_and_validate_schema(res_conn, :ok)
|
||||||
|
|
||||||
assert %{"visibility" => "direct"} = status
|
assert %{"visibility" => "direct"} = status
|
||||||
|
|
||||||
# Both should be visible here
|
# Both should be visible here
|
||||||
res_conn = get(conn_user_two, "api/v1/timelines/home")
|
res_conn = get(conn_user_two, "/api/v1/timelines/home")
|
||||||
|
|
||||||
[_s1, _s2] = json_response_and_validate_schema(res_conn, :ok)
|
[_s1, _s2] = json_response_and_validate_schema(res_conn, :ok)
|
||||||
|
|
||||||
|
@ -559,14 +559,14 @@ test "direct timeline", %{conn: conn} do
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
res_conn = get(conn_user_two, "api/v1/timelines/direct")
|
res_conn = get(conn_user_two, "/api/v1/timelines/direct")
|
||||||
|
|
||||||
statuses = json_response_and_validate_schema(res_conn, :ok)
|
statuses = json_response_and_validate_schema(res_conn, :ok)
|
||||||
assert length(statuses) == 20
|
assert length(statuses) == 20
|
||||||
|
|
||||||
max_id = List.last(statuses)["id"]
|
max_id = List.last(statuses)["id"]
|
||||||
|
|
||||||
res_conn = get(conn_user_two, "api/v1/timelines/direct?max_id=#{max_id}")
|
res_conn = get(conn_user_two, "/api/v1/timelines/direct?max_id=#{max_id}")
|
||||||
|
|
||||||
assert [status] = json_response_and_validate_schema(res_conn, :ok)
|
assert [status] = json_response_and_validate_schema(res_conn, :ok)
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ test "doesn't include DMs from blocked users" do
|
||||||
visibility: "direct"
|
visibility: "direct"
|
||||||
})
|
})
|
||||||
|
|
||||||
res_conn = get(conn, "api/v1/timelines/direct")
|
res_conn = get(conn, "/api/v1/timelines/direct")
|
||||||
|
|
||||||
[status] = json_response_and_validate_schema(res_conn, :ok)
|
[status] = json_response_and_validate_schema(res_conn, :ok)
|
||||||
assert status["id"] == direct.id
|
assert status["id"] == direct.id
|
||||||
|
|
|
@ -388,7 +388,7 @@ test "updates the user's background, upload_limit, returns a HTTP 413", %{
|
||||||
"pleroma_background_image" => new_background_oversized
|
"pleroma_background_image" => new_background_oversized
|
||||||
})
|
})
|
||||||
|
|
||||||
assert user_response = json_response_and_validate_schema(res, 413)
|
assert json_response_and_validate_schema(res, 413)
|
||||||
assert user.background == %{}
|
assert user.background == %{}
|
||||||
|
|
||||||
clear_config([:instance, :upload_limit], upload_limit)
|
clear_config([:instance, :upload_limit], upload_limit)
|
||||||
|
@ -439,13 +439,13 @@ test "updates profile emojos", %{user: user, conn: conn} do
|
||||||
|
|
||||||
test "update fields", %{conn: conn} do
|
test "update fields", %{conn: conn} do
|
||||||
fields = [
|
fields = [
|
||||||
%{"name" => "<a href=\"http://google.com\">foo</a>", "value" => "<script>bar</script>"},
|
%{name: "<a href=\"http://google.com\">foo</a>", value: "<script>bar</script>"},
|
||||||
%{"name" => "link.io", "value" => "cofe.io"}
|
%{name: "link.io", value: "cofe.io"}
|
||||||
]
|
]
|
||||||
|
|
||||||
account_data =
|
account_data =
|
||||||
conn
|
conn
|
||||||
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|
|> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert account_data["fields"] == [
|
assert account_data["fields"] == [
|
||||||
|
@ -467,13 +467,13 @@ test "update fields", %{conn: conn} do
|
||||||
|
|
||||||
test "emojis in fields labels", %{conn: conn} do
|
test "emojis in fields labels", %{conn: conn} do
|
||||||
fields = [
|
fields = [
|
||||||
%{"name" => ":firefox:", "value" => "is best 2hu"},
|
%{name: ":firefox:", value: "is best 2hu"},
|
||||||
%{"name" => "they wins", "value" => ":blank:"}
|
%{name: "they wins", value: ":blank:"}
|
||||||
]
|
]
|
||||||
|
|
||||||
account_data =
|
account_data =
|
||||||
conn
|
conn
|
||||||
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|
|> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert account_data["fields"] == [
|
assert account_data["fields"] == [
|
||||||
|
@ -521,13 +521,13 @@ test "update fields via x-www-form-urlencoded", %{conn: conn} do
|
||||||
|
|
||||||
test "update fields with empty name", %{conn: conn} do
|
test "update fields with empty name", %{conn: conn} do
|
||||||
fields = [
|
fields = [
|
||||||
%{"name" => "foo", "value" => ""},
|
%{name: "foo", value: ""},
|
||||||
%{"name" => "", "value" => "bar"}
|
%{name: "", value: "bar"}
|
||||||
]
|
]
|
||||||
|
|
||||||
account =
|
account =
|
||||||
conn
|
conn
|
||||||
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|
|> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert account["fields"] == [
|
assert account["fields"] == [
|
||||||
|
@ -542,30 +542,30 @@ test "update fields when invalid request", %{conn: conn} do
|
||||||
long_name = Enum.map(0..name_limit, fn _ -> "x" end) |> Enum.join()
|
long_name = Enum.map(0..name_limit, fn _ -> "x" end) |> Enum.join()
|
||||||
long_value = Enum.map(0..value_limit, fn _ -> "x" end) |> Enum.join()
|
long_value = Enum.map(0..value_limit, fn _ -> "x" end) |> Enum.join()
|
||||||
|
|
||||||
fields = [%{"name" => "foo", "value" => long_value}]
|
fields = [%{name: "foo", value: long_value}]
|
||||||
|
|
||||||
assert %{"error" => "Invalid request"} ==
|
assert %{"error" => "Invalid request"} ==
|
||||||
conn
|
conn
|
||||||
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|
|> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
|
||||||
|> json_response_and_validate_schema(403)
|
|> json_response_and_validate_schema(403)
|
||||||
|
|
||||||
fields = [%{"name" => long_name, "value" => "bar"}]
|
fields = [%{name: long_name, value: "bar"}]
|
||||||
|
|
||||||
assert %{"error" => "Invalid request"} ==
|
assert %{"error" => "Invalid request"} ==
|
||||||
conn
|
conn
|
||||||
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|
|> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
|
||||||
|> json_response_and_validate_schema(403)
|
|> json_response_and_validate_schema(403)
|
||||||
|
|
||||||
clear_config([:instance, :max_account_fields], 1)
|
clear_config([:instance, :max_account_fields], 1)
|
||||||
|
|
||||||
fields = [
|
fields = [
|
||||||
%{"name" => "foo", "value" => "bar"},
|
%{name: "foo", value: "bar"},
|
||||||
%{"name" => "link", "value" => "cofe.io"}
|
%{"name" => "link", "value" => "cofe.io"}
|
||||||
]
|
]
|
||||||
|
|
||||||
assert %{"error" => "Invalid request"} ==
|
assert %{"error" => "Invalid request"} ==
|
||||||
conn
|
conn
|
||||||
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|
|> patch("/api/v1/accounts/update_credentials", %{fields_attributes: fields})
|
||||||
|> json_response_and_validate_schema(403)
|
|> json_response_and_validate_schema(403)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -133,7 +133,7 @@ test "returns favorited DM only when user is logged in and he is one of recipien
|
||||||
|> get("/api/v1/pleroma/accounts/#{user.id}/favourites")
|
|> get("/api/v1/pleroma/accounts/#{user.id}/favourites")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert length(response) == 0
|
assert response == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not return others' favorited DM when user is not one of recipients", %{
|
test "does not return others' favorited DM when user is not one of recipients", %{
|
||||||
|
|
|
@ -28,7 +28,7 @@ defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do
|
||||||
{:ok, %{admin_conn: admin_conn}}
|
{:ok, %{admin_conn: admin_conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST/PATCH/DELETE /api/pleroma/emoji/packs/files?name=:name" do
|
describe "POST/PATCH/DELETE /api/v1/pleroma/emoji/packs/files?name=:name" do
|
||||||
setup do
|
setup do
|
||||||
pack_file = "#{@emoji_path}/test_pack/pack.json"
|
pack_file = "#{@emoji_path}/test_pack/pack.json"
|
||||||
original_content = File.read!(pack_file)
|
original_content = File.read!(pack_file)
|
||||||
|
@ -55,7 +55,7 @@ test "upload zip file with emojies", %{admin_conn: admin_conn} do
|
||||||
resp =
|
resp =
|
||||||
admin_conn
|
admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
content_type: "application/zip",
|
content_type: "application/zip",
|
||||||
filename: "emojis.zip",
|
filename: "emojis.zip",
|
||||||
|
@ -82,7 +82,7 @@ test "upload zip file with emojies", %{admin_conn: admin_conn} do
|
||||||
test "create shortcode exists", %{admin_conn: admin_conn} do
|
test "create shortcode exists", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank",
|
shortcode: "blank",
|
||||||
filename: "dir/blank.png",
|
filename: "dir/blank.png",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -100,7 +100,7 @@ test "don't rewrite old emoji", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank3",
|
shortcode: "blank3",
|
||||||
filename: "dir/blank.png",
|
filename: "dir/blank.png",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -118,7 +118,7 @@ test "don't rewrite old emoji", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> patch("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank",
|
shortcode: "blank",
|
||||||
new_shortcode: "blank2",
|
new_shortcode: "blank2",
|
||||||
new_filename: "dir_2/blank_3.png"
|
new_filename: "dir_2/blank_3.png"
|
||||||
|
@ -134,7 +134,7 @@ test "rewrite old emoji with force option", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank3",
|
shortcode: "blank3",
|
||||||
filename: "dir/blank.png",
|
filename: "dir/blank.png",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -152,7 +152,7 @@ test "rewrite old emoji with force option", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> patch("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank3",
|
shortcode: "blank3",
|
||||||
new_shortcode: "blank4",
|
new_shortcode: "blank4",
|
||||||
new_filename: "dir_2/blank_3.png",
|
new_filename: "dir_2/blank_3.png",
|
||||||
|
@ -170,7 +170,7 @@ test "rewrite old emoji with force option", %{admin_conn: admin_conn} do
|
||||||
test "with empty filename", %{admin_conn: admin_conn} do
|
test "with empty filename", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank2",
|
shortcode: "blank2",
|
||||||
filename: "",
|
filename: "",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -186,7 +186,7 @@ test "with empty filename", %{admin_conn: admin_conn} do
|
||||||
test "add file with not loaded pack", %{admin_conn: admin_conn} do
|
test "add file with not loaded pack", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=not_loaded", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=not_loaded", %{
|
||||||
shortcode: "blank3",
|
shortcode: "blank3",
|
||||||
filename: "dir/blank.png",
|
filename: "dir/blank.png",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -209,7 +209,7 @@ test "returns an error on add file when file system is not writable", %{
|
||||||
]) do
|
]) do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=not_loaded", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=not_loaded", %{
|
||||||
shortcode: "blank3",
|
shortcode: "blank3",
|
||||||
filename: "dir/blank.png",
|
filename: "dir/blank.png",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -226,7 +226,7 @@ test "returns an error on add file when file system is not writable", %{
|
||||||
|
|
||||||
test "remove file with not loaded pack", %{admin_conn: admin_conn} do
|
test "remove file with not loaded pack", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/packs/files?name=not_loaded&shortcode=blank3")
|
|> delete("/api/v1/pleroma/emoji/packs/files?name=not_loaded&shortcode=blank3")
|
||||||
|> json_response_and_validate_schema(:not_found) == %{
|
|> json_response_and_validate_schema(:not_found) == %{
|
||||||
"error" => "pack \"not_loaded\" is not found"
|
"error" => "pack \"not_loaded\" is not found"
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ test "remove file with not loaded pack", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
test "remove file with empty shortcode", %{admin_conn: admin_conn} do
|
test "remove file with empty shortcode", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/packs/files?name=not_loaded&shortcode=")
|
|> delete("/api/v1/pleroma/emoji/packs/files?name=not_loaded&shortcode=")
|
||||||
|> json_response_and_validate_schema(:not_found) == %{
|
|> json_response_and_validate_schema(:not_found) == %{
|
||||||
"error" => "pack \"not_loaded\" is not found"
|
"error" => "pack \"not_loaded\" is not found"
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ test "remove file with empty shortcode", %{admin_conn: admin_conn} do
|
||||||
test "update file with not loaded pack", %{admin_conn: admin_conn} do
|
test "update file with not loaded pack", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/packs/files?name=not_loaded", %{
|
|> patch("/api/v1/pleroma/emoji/packs/files?name=not_loaded", %{
|
||||||
shortcode: "blank4",
|
shortcode: "blank4",
|
||||||
new_shortcode: "blank3",
|
new_shortcode: "blank3",
|
||||||
new_filename: "dir_2/blank_3.png"
|
new_filename: "dir_2/blank_3.png"
|
||||||
|
@ -256,7 +256,7 @@ test "update file with not loaded pack", %{admin_conn: admin_conn} do
|
||||||
test "new with shortcode as file with update", %{admin_conn: admin_conn} do
|
test "new with shortcode as file with update", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank4",
|
shortcode: "blank4",
|
||||||
filename: "dir/blank.png",
|
filename: "dir/blank.png",
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
|
@ -274,7 +274,7 @@ test "new with shortcode as file with update", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> patch("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank4",
|
shortcode: "blank4",
|
||||||
new_shortcode: "blank3",
|
new_shortcode: "blank3",
|
||||||
new_filename: "dir_2/blank_3.png"
|
new_filename: "dir_2/blank_3.png"
|
||||||
|
@ -289,7 +289,7 @@ test "new with shortcode as file with update", %{admin_conn: admin_conn} do
|
||||||
assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png")
|
assert File.exists?("#{@emoji_path}/test_pack/dir_2/blank_3.png")
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/packs/files?name=test_pack&shortcode=blank3")
|
|> delete("/api/v1/pleroma/emoji/packs/files?name=test_pack&shortcode=blank3")
|
||||||
|> json_response_and_validate_schema(200) == %{
|
|> json_response_and_validate_schema(200) == %{
|
||||||
"blank" => "blank.png",
|
"blank" => "blank.png",
|
||||||
"blank2" => "blank2.png"
|
"blank2" => "blank2.png"
|
||||||
|
@ -311,7 +311,7 @@ test "new with shortcode from url", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank_url",
|
shortcode: "blank_url",
|
||||||
file: "https://test-blank/blank_url.png"
|
file: "https://test-blank/blank_url.png"
|
||||||
})
|
})
|
||||||
|
@ -331,7 +331,7 @@ test "new without shortcode", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> post("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
file: %Plug.Upload{
|
file: %Plug.Upload{
|
||||||
filename: "shortcode.png",
|
filename: "shortcode.png",
|
||||||
path: "#{Pleroma.Config.get([:instance, :static_dir])}/add/shortcode.png"
|
path: "#{Pleroma.Config.get([:instance, :static_dir])}/add/shortcode.png"
|
||||||
|
@ -346,7 +346,7 @@ test "new without shortcode", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
test "remove non existing shortcode in pack.json", %{admin_conn: admin_conn} do
|
test "remove non existing shortcode in pack.json", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/packs/files?name=test_pack&shortcode=blank3")
|
|> delete("/api/v1/pleroma/emoji/packs/files?name=test_pack&shortcode=blank3")
|
||||||
|> json_response_and_validate_schema(:bad_request) == %{
|
|> json_response_and_validate_schema(:bad_request) == %{
|
||||||
"error" => "Emoji \"blank3\" does not exist"
|
"error" => "Emoji \"blank3\" does not exist"
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ test "remove non existing shortcode in pack.json", %{admin_conn: admin_conn} do
|
||||||
test "update non existing emoji", %{admin_conn: admin_conn} do
|
test "update non existing emoji", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> patch("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank3",
|
shortcode: "blank3",
|
||||||
new_shortcode: "blank4",
|
new_shortcode: "blank4",
|
||||||
new_filename: "dir_2/blank_3.png"
|
new_filename: "dir_2/blank_3.png"
|
||||||
|
@ -371,7 +371,7 @@ test "update with empty shortcode", %{admin_conn: admin_conn} do
|
||||||
} =
|
} =
|
||||||
admin_conn
|
admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/packs/files?name=test_pack", %{
|
|> patch("/api/v1/pleroma/emoji/packs/files?name=test_pack", %{
|
||||||
shortcode: "blank",
|
shortcode: "blank",
|
||||||
new_filename: "dir_2/blank_3.png"
|
new_filename: "dir_2/blank_3.png"
|
||||||
})
|
})
|
||||||
|
|
|
@ -29,13 +29,16 @@ defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do
|
||||||
{:ok, %{admin_conn: admin_conn}}
|
{:ok, %{admin_conn: admin_conn}}
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api/pleroma/emoji/packs when :public: false", %{conn: conn} do
|
test "GET /api/v1/pleroma/emoji/packs when :public: false", %{conn: conn} do
|
||||||
clear_config([:instance, :public], false)
|
clear_config([:instance, :public], false)
|
||||||
conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
|
conn |> get("/api/v1/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "GET /api/pleroma/emoji/packs", %{conn: conn} do
|
test "GET /api/v1/pleroma/emoji/packs", %{conn: conn} do
|
||||||
resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
|
resp =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/pleroma/emoji/packs")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["count"] == 4
|
assert resp["count"] == 4
|
||||||
|
|
||||||
|
@ -55,7 +58,7 @@ test "GET /api/pleroma/emoji/packs", %{conn: conn} do
|
||||||
|
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs?page_size=1")
|
|> get("/api/v1/pleroma/emoji/packs?page_size=1")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["count"] == 4
|
assert resp["count"] == 4
|
||||||
|
@ -68,7 +71,7 @@ test "GET /api/pleroma/emoji/packs", %{conn: conn} do
|
||||||
|
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs?page_size=1&page=2")
|
|> get("/api/v1/pleroma/emoji/packs?page_size=1&page=2")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["count"] == 4
|
assert resp["count"] == 4
|
||||||
|
@ -78,7 +81,7 @@ test "GET /api/pleroma/emoji/packs", %{conn: conn} do
|
||||||
|
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs?page_size=1&page=3")
|
|> get("/api/v1/pleroma/emoji/packs?page_size=1&page=3")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["count"] == 4
|
assert resp["count"] == 4
|
||||||
|
@ -88,7 +91,7 @@ test "GET /api/pleroma/emoji/packs", %{conn: conn} do
|
||||||
|
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs?page_size=1&page=4")
|
|> get("/api/v1/pleroma/emoji/packs?page_size=1&page=4")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["count"] == 4
|
assert resp["count"] == 4
|
||||||
|
@ -98,11 +101,11 @@ test "GET /api/pleroma/emoji/packs", %{conn: conn} do
|
||||||
assert [pack1, pack2, pack3, pack4] |> Enum.uniq() |> length() == 4
|
assert [pack1, pack2, pack3, pack4] |> Enum.uniq() |> length() == 4
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/emoji/packs/remote" do
|
describe "GET /api/v1/pleroma/emoji/packs/remote" do
|
||||||
test "shareable instance", %{admin_conn: admin_conn, conn: conn} do
|
test "shareable instance", %{admin_conn: admin_conn, conn: conn} do
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs?page=2&page_size=1")
|
|> get("/api/v1/pleroma/emoji/packs?page=2&page_size=1")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
mock(fn
|
mock(fn
|
||||||
|
@ -112,12 +115,17 @@ test "shareable instance", %{admin_conn: admin_conn, conn: conn} do
|
||||||
%{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
|
%{method: :get, url: "https://example.com/nodeinfo/2.1.json"} ->
|
||||||
json(%{metadata: %{features: ["shareable_emoji_packs"]}})
|
json(%{metadata: %{features: ["shareable_emoji_packs"]}})
|
||||||
|
|
||||||
%{method: :get, url: "https://example.com/api/pleroma/emoji/packs?page=2&page_size=1"} ->
|
%{
|
||||||
|
method: :get,
|
||||||
|
url: "https://example.com/api/v1/pleroma/emoji/packs?page=2&page_size=1"
|
||||||
|
} ->
|
||||||
json(resp)
|
json(resp)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> get("/api/pleroma/emoji/packs/remote?url=https://example.com&page=2&page_size=1")
|
|> get(
|
||||||
|
"/api/v1/pleroma/emoji/packs/remote?url=https://example.com&page=2&page_size=1"
|
||||||
|
)
|
||||||
|> json_response_and_validate_schema(200) == resp
|
|> json_response_and_validate_schema(200) == resp
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -131,18 +139,18 @@ test "non shareable instance", %{admin_conn: admin_conn} do
|
||||||
end)
|
end)
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> get("/api/pleroma/emoji/packs/remote?url=https://example.com")
|
|> get("/api/v1/pleroma/emoji/packs/remote?url=https://example.com")
|
||||||
|> json_response_and_validate_schema(500) == %{
|
|> json_response_and_validate_schema(500) == %{
|
||||||
"error" => "The requested instance does not support sharing emoji packs"
|
"error" => "The requested instance does not support sharing emoji packs"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/emoji/packs/archive?name=:name" do
|
describe "GET /api/v1/pleroma/emoji/packs/archive?name=:name" do
|
||||||
test "download shared pack", %{conn: conn} do
|
test "download shared pack", %{conn: conn} do
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs/archive?name=test_pack")
|
|> get("/api/v1/pleroma/emoji/packs/archive?name=test_pack")
|
||||||
|> response(200)
|
|> response(200)
|
||||||
|
|
||||||
{:ok, arch} = :zip.unzip(resp, [:memory])
|
{:ok, arch} = :zip.unzip(resp, [:memory])
|
||||||
|
@ -153,7 +161,7 @@ test "download shared pack", %{conn: conn} do
|
||||||
|
|
||||||
test "non existing pack", %{conn: conn} do
|
test "non existing pack", %{conn: conn} do
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/emoji/packs/archive?name=test_pack_for_import")
|
|> get("/api/v1/pleroma/emoji/packs/archive?name=test_pack_for_import")
|
||||||
|> json_response_and_validate_schema(:not_found) == %{
|
|> json_response_and_validate_schema(:not_found) == %{
|
||||||
"error" => "Pack test_pack_for_import does not exist"
|
"error" => "Pack test_pack_for_import does not exist"
|
||||||
}
|
}
|
||||||
|
@ -161,7 +169,7 @@ test "non existing pack", %{conn: conn} do
|
||||||
|
|
||||||
test "non downloadable pack", %{conn: conn} do
|
test "non downloadable pack", %{conn: conn} do
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/emoji/packs/archive?name=test_pack_nonshared")
|
|> get("/api/v1/pleroma/emoji/packs/archive?name=test_pack_nonshared")
|
||||||
|> json_response_and_validate_schema(:forbidden) == %{
|
|> json_response_and_validate_schema(:forbidden) == %{
|
||||||
"error" =>
|
"error" =>
|
||||||
"Pack test_pack_nonshared cannot be downloaded from this instance, either pack sharing was disabled for this pack or some files are missing"
|
"Pack test_pack_nonshared cannot be downloaded from this instance, either pack sharing was disabled for this pack or some files are missing"
|
||||||
|
@ -169,7 +177,7 @@ test "non downloadable pack", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/emoji/packs/download" do
|
describe "POST /api/v1/pleroma/emoji/packs/download" do
|
||||||
test "shared pack from remote and non shared from fallback-src", %{
|
test "shared pack from remote and non shared from fallback-src", %{
|
||||||
admin_conn: admin_conn,
|
admin_conn: admin_conn,
|
||||||
conn: conn
|
conn: conn
|
||||||
|
@ -183,28 +191,28 @@ test "shared pack from remote and non shared from fallback-src", %{
|
||||||
|
|
||||||
%{
|
%{
|
||||||
method: :get,
|
method: :get,
|
||||||
url: "https://example.com/api/pleroma/emoji/pack?name=test_pack"
|
url: "https://example.com/api/v1/pleroma/emoji/pack?name=test_pack"
|
||||||
} ->
|
} ->
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=test_pack")
|
|> get("/api/v1/pleroma/emoji/pack?name=test_pack")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|> json()
|
|> json()
|
||||||
|
|
||||||
%{
|
%{
|
||||||
method: :get,
|
method: :get,
|
||||||
url: "https://example.com/api/pleroma/emoji/packs/archive?name=test_pack"
|
url: "https://example.com/api/v1/pleroma/emoji/packs/archive?name=test_pack"
|
||||||
} ->
|
} ->
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/packs/archive?name=test_pack")
|
|> get("/api/v1/pleroma/emoji/packs/archive?name=test_pack")
|
||||||
|> response(200)
|
|> response(200)
|
||||||
|> text()
|
|> text()
|
||||||
|
|
||||||
%{
|
%{
|
||||||
method: :get,
|
method: :get,
|
||||||
url: "https://example.com/api/pleroma/emoji/pack?name=test_pack_nonshared"
|
url: "https://example.com/api/v1/pleroma/emoji/pack?name=test_pack_nonshared"
|
||||||
} ->
|
} ->
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=test_pack_nonshared")
|
|> get("/api/v1/pleroma/emoji/pack?name=test_pack_nonshared")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|> json()
|
|> json()
|
||||||
|
|
||||||
|
@ -217,7 +225,7 @@ test "shared pack from remote and non shared from fallback-src", %{
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/download", %{
|
|> post("/api/v1/pleroma/emoji/packs/download", %{
|
||||||
url: "https://example.com",
|
url: "https://example.com",
|
||||||
name: "test_pack",
|
name: "test_pack",
|
||||||
as: "test_pack2"
|
as: "test_pack2"
|
||||||
|
@ -228,7 +236,7 @@ test "shared pack from remote and non shared from fallback-src", %{
|
||||||
assert File.exists?("#{@emoji_path}/test_pack2/blank.png")
|
assert File.exists?("#{@emoji_path}/test_pack2/blank.png")
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/pack?name=test_pack2")
|
|> delete("/api/v1/pleroma/emoji/pack?name=test_pack2")
|
||||||
|> json_response_and_validate_schema(200) == "ok"
|
|> json_response_and_validate_schema(200) == "ok"
|
||||||
|
|
||||||
refute File.exists?("#{@emoji_path}/test_pack2")
|
refute File.exists?("#{@emoji_path}/test_pack2")
|
||||||
|
@ -236,7 +244,7 @@ test "shared pack from remote and non shared from fallback-src", %{
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post(
|
|> post(
|
||||||
"/api/pleroma/emoji/packs/download",
|
"/api/v1/pleroma/emoji/packs/download",
|
||||||
%{
|
%{
|
||||||
url: "https://example.com",
|
url: "https://example.com",
|
||||||
name: "test_pack_nonshared",
|
name: "test_pack_nonshared",
|
||||||
|
@ -249,7 +257,7 @@ test "shared pack from remote and non shared from fallback-src", %{
|
||||||
assert File.exists?("#{@emoji_path}/test_pack_nonshared2/blank.png")
|
assert File.exists?("#{@emoji_path}/test_pack_nonshared2/blank.png")
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/pack?name=test_pack_nonshared2")
|
|> delete("/api/v1/pleroma/emoji/pack?name=test_pack_nonshared2")
|
||||||
|> json_response_and_validate_schema(200) == "ok"
|
|> json_response_and_validate_schema(200) == "ok"
|
||||||
|
|
||||||
refute File.exists?("#{@emoji_path}/test_pack_nonshared2")
|
refute File.exists?("#{@emoji_path}/test_pack_nonshared2")
|
||||||
|
@ -267,7 +275,7 @@ test "nonshareable instance", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post(
|
|> post(
|
||||||
"/api/pleroma/emoji/packs/download",
|
"/api/v1/pleroma/emoji/packs/download",
|
||||||
%{
|
%{
|
||||||
url: "https://old-instance",
|
url: "https://old-instance",
|
||||||
name: "test_pack",
|
name: "test_pack",
|
||||||
|
@ -289,14 +297,14 @@ test "checksum fail", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
%{
|
%{
|
||||||
method: :get,
|
method: :get,
|
||||||
url: "https://example.com/api/pleroma/emoji/pack?name=pack_bad_sha"
|
url: "https://example.com/api/v1/pleroma/emoji/pack?name=pack_bad_sha"
|
||||||
} ->
|
} ->
|
||||||
{:ok, pack} = Pleroma.Emoji.Pack.load_pack("pack_bad_sha")
|
{:ok, pack} = Pleroma.Emoji.Pack.load_pack("pack_bad_sha")
|
||||||
%Tesla.Env{status: 200, body: Jason.encode!(pack)}
|
%Tesla.Env{status: 200, body: Jason.encode!(pack)}
|
||||||
|
|
||||||
%{
|
%{
|
||||||
method: :get,
|
method: :get,
|
||||||
url: "https://example.com/api/pleroma/emoji/packs/archive?name=pack_bad_sha"
|
url: "https://example.com/api/v1/pleroma/emoji/packs/archive?name=pack_bad_sha"
|
||||||
} ->
|
} ->
|
||||||
%Tesla.Env{
|
%Tesla.Env{
|
||||||
status: 200,
|
status: 200,
|
||||||
|
@ -306,7 +314,7 @@ test "checksum fail", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/download", %{
|
|> post("/api/v1/pleroma/emoji/packs/download", %{
|
||||||
url: "https://example.com",
|
url: "https://example.com",
|
||||||
name: "pack_bad_sha",
|
name: "pack_bad_sha",
|
||||||
as: "pack_bad_sha2"
|
as: "pack_bad_sha2"
|
||||||
|
@ -326,7 +334,7 @@ test "other error", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
%{
|
%{
|
||||||
method: :get,
|
method: :get,
|
||||||
url: "https://example.com/api/pleroma/emoji/pack?name=test_pack"
|
url: "https://example.com/api/v1/pleroma/emoji/pack?name=test_pack"
|
||||||
} ->
|
} ->
|
||||||
{:ok, pack} = Pleroma.Emoji.Pack.load_pack("test_pack")
|
{:ok, pack} = Pleroma.Emoji.Pack.load_pack("test_pack")
|
||||||
%Tesla.Env{status: 200, body: Jason.encode!(pack)}
|
%Tesla.Env{status: 200, body: Jason.encode!(pack)}
|
||||||
|
@ -334,7 +342,7 @@ test "other error", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/emoji/packs/download", %{
|
|> post("/api/v1/pleroma/emoji/packs/download", %{
|
||||||
url: "https://example.com",
|
url: "https://example.com",
|
||||||
name: "test_pack",
|
name: "test_pack",
|
||||||
as: "test_pack2"
|
as: "test_pack2"
|
||||||
|
@ -346,7 +354,7 @@ test "other error", %{admin_conn: admin_conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "PATCH/update /api/pleroma/emoji/pack?name=:name" do
|
describe "PATCH/update /api/v1/pleroma/emoji/pack?name=:name" do
|
||||||
setup do
|
setup do
|
||||||
pack_file = "#{@emoji_path}/test_pack/pack.json"
|
pack_file = "#{@emoji_path}/test_pack/pack.json"
|
||||||
original_content = File.read!(pack_file)
|
original_content = File.read!(pack_file)
|
||||||
|
@ -372,7 +380,7 @@ test "returns error when file system not writable", %{admin_conn: conn} = ctx do
|
||||||
assert conn
|
assert conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch(
|
|> patch(
|
||||||
"/api/pleroma/emoji/pack?name=test_pack",
|
"/api/v1/pleroma/emoji/pack?name=test_pack",
|
||||||
%{"metadata" => ctx[:new_data]}
|
%{"metadata" => ctx[:new_data]}
|
||||||
)
|
)
|
||||||
|> json_response_and_validate_schema(500)
|
|> json_response_and_validate_schema(500)
|
||||||
|
@ -382,7 +390,7 @@ test "returns error when file system not writable", %{admin_conn: conn} = ctx do
|
||||||
test "for a pack without a fallback source", ctx do
|
test "for a pack without a fallback source", ctx do
|
||||||
assert ctx[:admin_conn]
|
assert ctx[:admin_conn]
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/pack?name=test_pack", %{
|
|> patch("/api/v1/pleroma/emoji/pack?name=test_pack", %{
|
||||||
"metadata" => ctx[:new_data]
|
"metadata" => ctx[:new_data]
|
||||||
})
|
})
|
||||||
|> json_response_and_validate_schema(200) == ctx[:new_data]
|
|> json_response_and_validate_schema(200) == ctx[:new_data]
|
||||||
|
@ -410,7 +418,7 @@ test "for a pack with a fallback source", ctx do
|
||||||
|
|
||||||
assert ctx[:admin_conn]
|
assert ctx[:admin_conn]
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/pack?name=test_pack", %{metadata: new_data})
|
|> patch("/api/v1/pleroma/emoji/pack?name=test_pack", %{metadata: new_data})
|
||||||
|> json_response_and_validate_schema(200) == new_data_with_sha
|
|> json_response_and_validate_schema(200) == new_data_with_sha
|
||||||
|
|
||||||
assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == new_data_with_sha
|
assert Jason.decode!(File.read!(ctx[:pack_file]))["pack"] == new_data_with_sha
|
||||||
|
@ -430,14 +438,14 @@ test "when the fallback source doesn't have all the files", ctx do
|
||||||
|
|
||||||
assert ctx[:admin_conn]
|
assert ctx[:admin_conn]
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> patch("/api/pleroma/emoji/pack?name=test_pack", %{metadata: new_data})
|
|> patch("/api/v1/pleroma/emoji/pack?name=test_pack", %{metadata: new_data})
|
||||||
|> json_response_and_validate_schema(:bad_request) == %{
|
|> json_response_and_validate_schema(:bad_request) == %{
|
||||||
"error" => "The fallback archive does not have all files specified in pack.json"
|
"error" => "The fallback archive does not have all files specified in pack.json"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST/DELETE /api/pleroma/emoji/pack?name=:name" do
|
describe "POST/DELETE /api/v1/pleroma/emoji/pack?name=:name" do
|
||||||
test "returns an error on creates pack when file system not writable", %{
|
test "returns an error on creates pack when file system not writable", %{
|
||||||
admin_conn: admin_conn
|
admin_conn: admin_conn
|
||||||
} do
|
} do
|
||||||
|
@ -447,7 +455,7 @@ test "returns an error on creates pack when file system not writable", %{
|
||||||
{File, [:passthrough], [mkdir: fn ^path_pack -> {:error, :eacces} end]}
|
{File, [:passthrough], [mkdir: fn ^path_pack -> {:error, :eacces} end]}
|
||||||
]) do
|
]) do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> post("/api/pleroma/emoji/pack?name=test_pack")
|
|> post("/api/v1/pleroma/emoji/pack?name=test_pack")
|
||||||
|> json_response_and_validate_schema(500) == %{
|
|> json_response_and_validate_schema(500) == %{
|
||||||
"error" =>
|
"error" =>
|
||||||
"Unexpected error occurred while creating pack. (POSIX error: Permission denied)"
|
"Unexpected error occurred while creating pack. (POSIX error: Permission denied)"
|
||||||
|
@ -467,7 +475,7 @@ test "returns an error on deletes pack when the file system is not writable", %{
|
||||||
{File, [:passthrough], [rm_rf: fn ^path_pack -> {:error, :eacces, path_pack} end]}
|
{File, [:passthrough], [rm_rf: fn ^path_pack -> {:error, :eacces, path_pack} end]}
|
||||||
]) do
|
]) do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/pack?name=test_emoji_pack")
|
|> delete("/api/v1/pleroma/emoji/pack?name=test_emoji_pack")
|
||||||
|> json_response_and_validate_schema(500) == %{
|
|> json_response_and_validate_schema(500) == %{
|
||||||
"error" =>
|
"error" =>
|
||||||
"Couldn't delete the `test_emoji_pack` pack (POSIX error: Permission denied)"
|
"Couldn't delete the `test_emoji_pack` pack (POSIX error: Permission denied)"
|
||||||
|
@ -480,7 +488,7 @@ test "returns an error on deletes pack when the file system is not writable", %{
|
||||||
|
|
||||||
test "creating and deleting a pack", %{admin_conn: admin_conn} do
|
test "creating and deleting a pack", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> post("/api/pleroma/emoji/pack?name=test_created")
|
|> post("/api/v1/pleroma/emoji/pack?name=test_created")
|
||||||
|> json_response_and_validate_schema(200) == "ok"
|
|> json_response_and_validate_schema(200) == "ok"
|
||||||
|
|
||||||
assert File.exists?("#{@emoji_path}/test_created/pack.json")
|
assert File.exists?("#{@emoji_path}/test_created/pack.json")
|
||||||
|
@ -492,7 +500,7 @@ test "creating and deleting a pack", %{admin_conn: admin_conn} do
|
||||||
}
|
}
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/pack?name=test_created")
|
|> delete("/api/v1/pleroma/emoji/pack?name=test_created")
|
||||||
|> json_response_and_validate_schema(200) == "ok"
|
|> json_response_and_validate_schema(200) == "ok"
|
||||||
|
|
||||||
refute File.exists?("#{@emoji_path}/test_created/pack.json")
|
refute File.exists?("#{@emoji_path}/test_created/pack.json")
|
||||||
|
@ -505,7 +513,7 @@ test "if pack exists", %{admin_conn: admin_conn} do
|
||||||
File.write!(Path.join(path, "pack.json"), pack_file)
|
File.write!(Path.join(path, "pack.json"), pack_file)
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> post("/api/pleroma/emoji/pack?name=test_created")
|
|> post("/api/v1/pleroma/emoji/pack?name=test_created")
|
||||||
|> json_response_and_validate_schema(:conflict) == %{
|
|> json_response_and_validate_schema(:conflict) == %{
|
||||||
"error" => "A pack named \"test_created\" already exists"
|
"error" => "A pack named \"test_created\" already exists"
|
||||||
}
|
}
|
||||||
|
@ -515,7 +523,7 @@ test "if pack exists", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
test "with empty name", %{admin_conn: admin_conn} do
|
test "with empty name", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> post("/api/pleroma/emoji/pack?name= ")
|
|> post("/api/v1/pleroma/emoji/pack?name= ")
|
||||||
|> json_response_and_validate_schema(:bad_request) == %{
|
|> json_response_and_validate_schema(:bad_request) == %{
|
||||||
"error" => "pack name cannot be empty"
|
"error" => "pack name cannot be empty"
|
||||||
}
|
}
|
||||||
|
@ -524,7 +532,7 @@ test "with empty name", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
test "deleting nonexisting pack", %{admin_conn: admin_conn} do
|
test "deleting nonexisting pack", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/pack?name=non_existing")
|
|> delete("/api/v1/pleroma/emoji/pack?name=non_existing")
|
||||||
|> json_response_and_validate_schema(:not_found) == %{
|
|> json_response_and_validate_schema(:not_found) == %{
|
||||||
"error" => "Pack non_existing does not exist"
|
"error" => "Pack non_existing does not exist"
|
||||||
}
|
}
|
||||||
|
@ -532,7 +540,7 @@ test "deleting nonexisting pack", %{admin_conn: admin_conn} do
|
||||||
|
|
||||||
test "deleting with empty name", %{admin_conn: admin_conn} do
|
test "deleting with empty name", %{admin_conn: admin_conn} do
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> delete("/api/pleroma/emoji/pack?name= ")
|
|> delete("/api/v1/pleroma/emoji/pack?name= ")
|
||||||
|> json_response_and_validate_schema(:bad_request) == %{
|
|> json_response_and_validate_schema(:bad_request) == %{
|
||||||
"error" => "pack name cannot be empty"
|
"error" => "pack name cannot be empty"
|
||||||
}
|
}
|
||||||
|
@ -544,15 +552,22 @@ test "filesystem import", %{admin_conn: admin_conn, conn: conn} do
|
||||||
File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
|
File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
|
resp =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/pleroma/emoji/packs")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
refute Map.has_key?(resp["packs"], "test_pack_for_import")
|
refute Map.has_key?(resp["packs"], "test_pack_for_import")
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> get("/api/pleroma/emoji/packs/import")
|
|> get("/api/v1/pleroma/emoji/packs/import")
|
||||||
|> json_response_and_validate_schema(200) == ["test_pack_for_import"]
|
|> json_response_and_validate_schema(200) == ["test_pack_for_import"]
|
||||||
|
|
||||||
resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
|
resp =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/pleroma/emoji/packs")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["packs"]["test_pack_for_import"]["files"] == %{"blank" => "blank.png"}
|
assert resp["packs"]["test_pack_for_import"]["files"] == %{"blank" => "blank.png"}
|
||||||
|
|
||||||
File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
|
File.rm!("#{@emoji_path}/test_pack_for_import/pack.json")
|
||||||
|
@ -568,10 +583,13 @@ test "filesystem import", %{admin_conn: admin_conn, conn: conn} do
|
||||||
File.write!("#{@emoji_path}/test_pack_for_import/emoji.txt", emoji_txt_content)
|
File.write!("#{@emoji_path}/test_pack_for_import/emoji.txt", emoji_txt_content)
|
||||||
|
|
||||||
assert admin_conn
|
assert admin_conn
|
||||||
|> get("/api/pleroma/emoji/packs/import")
|
|> get("/api/v1/pleroma/emoji/packs/import")
|
||||||
|> json_response_and_validate_schema(200) == ["test_pack_for_import"]
|
|> json_response_and_validate_schema(200) == ["test_pack_for_import"]
|
||||||
|
|
||||||
resp = conn |> get("/api/pleroma/emoji/packs") |> json_response_and_validate_schema(200)
|
resp =
|
||||||
|
conn
|
||||||
|
|> get("/api/v1/pleroma/emoji/packs")
|
||||||
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert resp["packs"]["test_pack_for_import"]["files"] == %{
|
assert resp["packs"]["test_pack_for_import"]["files"] == %{
|
||||||
"blank" => "blank.png",
|
"blank" => "blank.png",
|
||||||
|
@ -580,7 +598,7 @@ test "filesystem import", %{admin_conn: admin_conn, conn: conn} do
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/emoji/pack?name=:name" do
|
describe "GET /api/v1/pleroma/emoji/pack?name=:name" do
|
||||||
test "shows pack.json", %{conn: conn} do
|
test "shows pack.json", %{conn: conn} do
|
||||||
assert %{
|
assert %{
|
||||||
"files" => files,
|
"files" => files,
|
||||||
|
@ -595,7 +613,7 @@ test "shows pack.json", %{conn: conn} do
|
||||||
}
|
}
|
||||||
} =
|
} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=test_pack")
|
|> get("/api/v1/pleroma/emoji/pack?name=test_pack")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert files == %{"blank" => "blank.png", "blank2" => "blank2.png"}
|
assert files == %{"blank" => "blank.png", "blank2" => "blank2.png"}
|
||||||
|
@ -605,7 +623,7 @@ test "shows pack.json", %{conn: conn} do
|
||||||
"files_count" => 2
|
"files_count" => 2
|
||||||
} =
|
} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=test_pack&page_size=1")
|
|> get("/api/v1/pleroma/emoji/pack?name=test_pack&page_size=1")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert files |> Map.keys() |> length() == 1
|
assert files |> Map.keys() |> length() == 1
|
||||||
|
@ -615,7 +633,7 @@ test "shows pack.json", %{conn: conn} do
|
||||||
"files_count" => 2
|
"files_count" => 2
|
||||||
} =
|
} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=test_pack&page_size=1&page=2")
|
|> get("/api/v1/pleroma/emoji/pack?name=test_pack&page_size=1&page=2")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert files |> Map.keys() |> length() == 1
|
assert files |> Map.keys() |> length() == 1
|
||||||
|
@ -635,13 +653,13 @@ test "for pack name with special chars", %{conn: conn} do
|
||||||
}
|
}
|
||||||
} =
|
} =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=blobs.gg")
|
|> get("/api/v1/pleroma/emoji/pack?name=blobs.gg")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "non existing pack", %{conn: conn} do
|
test "non existing pack", %{conn: conn} do
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/emoji/pack?name=non_existing")
|
|> get("/api/v1/pleroma/emoji/pack?name=non_existing")
|
||||||
|> json_response_and_validate_schema(:not_found) == %{
|
|> json_response_and_validate_schema(:not_found) == %{
|
||||||
"error" => "Pack non_existing does not exist"
|
"error" => "Pack non_existing does not exist"
|
||||||
}
|
}
|
||||||
|
@ -649,7 +667,7 @@ test "non existing pack", %{conn: conn} do
|
||||||
|
|
||||||
test "error name", %{conn: conn} do
|
test "error name", %{conn: conn} do
|
||||||
assert conn
|
assert conn
|
||||||
|> get("/api/pleroma/emoji/pack?name= ")
|
|> get("/api/v1/pleroma/emoji/pack?name= ")
|
||||||
|> json_response_and_validate_schema(:bad_request) == %{
|
|> json_response_and_validate_schema(:bad_request) == %{
|
||||||
"error" => "pack name cannot be empty"
|
"error" => "pack name cannot be empty"
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,10 @@ test "returns success result", %{conn: conn} do
|
||||||
|
|
||||||
assert conn
|
assert conn
|
||||||
|> put_req_header("authorization", "Bearer #{token.token}")
|
|> put_req_header("authorization", "Bearer #{token.token}")
|
||||||
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{password: "test", code: code})
|
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{
|
||||||
|
password: "test",
|
||||||
|
code: code
|
||||||
|
})
|
||||||
|> json_response(:ok)
|
|> json_response(:ok)
|
||||||
|
|
||||||
settings = refresh_record(user).multi_factor_authentication_settings
|
settings = refresh_record(user).multi_factor_authentication_settings
|
||||||
|
@ -162,7 +165,10 @@ test "returns success result", %{conn: conn} do
|
||||||
|
|
||||||
assert conn
|
assert conn
|
||||||
|> put_req_header("authorization", "Bearer #{token2.token}")
|
|> put_req_header("authorization", "Bearer #{token2.token}")
|
||||||
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{password: "test", code: code})
|
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{
|
||||||
|
password: "test",
|
||||||
|
code: code
|
||||||
|
})
|
||||||
|> json_response(403) == %{
|
|> json_response(403) == %{
|
||||||
"error" => "Insufficient permissions: write:security."
|
"error" => "Insufficient permissions: write:security."
|
||||||
}
|
}
|
||||||
|
@ -185,7 +191,10 @@ test "returns error if password incorrect", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("authorization", "Bearer #{token.token}")
|
|> put_req_header("authorization", "Bearer #{token.token}")
|
||||||
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{password: "xxx", code: code})
|
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{
|
||||||
|
password: "xxx",
|
||||||
|
code: code
|
||||||
|
})
|
||||||
|> json_response(422)
|
|> json_response(422)
|
||||||
|
|
||||||
settings = refresh_record(user).multi_factor_authentication_settings
|
settings = refresh_record(user).multi_factor_authentication_settings
|
||||||
|
@ -212,7 +221,10 @@ test "returns error if code incorrect", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("authorization", "Bearer #{token.token}")
|
|> put_req_header("authorization", "Bearer #{token.token}")
|
||||||
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{password: "test", code: "code"})
|
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{
|
||||||
|
password: "test",
|
||||||
|
code: "code"
|
||||||
|
})
|
||||||
|> json_response(422)
|
|> json_response(422)
|
||||||
|
|
||||||
settings = refresh_record(user).multi_factor_authentication_settings
|
settings = refresh_record(user).multi_factor_authentication_settings
|
||||||
|
@ -223,7 +235,10 @@ test "returns error if code incorrect", %{conn: conn} do
|
||||||
|
|
||||||
assert conn
|
assert conn
|
||||||
|> put_req_header("authorization", "Bearer #{token2.token}")
|
|> put_req_header("authorization", "Bearer #{token2.token}")
|
||||||
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{password: "test", code: "code"})
|
|> post("/api/pleroma/accounts/mfa/confirm/totp", %{
|
||||||
|
password: "test",
|
||||||
|
code: "code"
|
||||||
|
})
|
||||||
|> json_response(403) == %{
|
|> json_response(403) == %{
|
||||||
"error" => "Insufficient permissions: write:security."
|
"error" => "Insufficient permissions: write:security."
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,28 +10,32 @@ defmodule Pleroma.Web.Plugs.RemoteIpTest do
|
||||||
|
|
||||||
import Pleroma.Tests.Helpers, only: [clear_config: 2]
|
import Pleroma.Tests.Helpers, only: [clear_config: 2]
|
||||||
|
|
||||||
setup do:
|
setup do
|
||||||
clear_config(RemoteIp,
|
clear_config([RemoteIp, :enabled], true)
|
||||||
enabled: true,
|
clear_config([RemoteIp, :headers], ["x-forwarded-for"])
|
||||||
headers: ["x-forwarded-for"],
|
clear_config([RemoteIp, :proxies], [])
|
||||||
proxies: [],
|
|
||||||
reserved: [
|
clear_config(
|
||||||
"127.0.0.0/8",
|
[RemoteIp, :reserved],
|
||||||
"::1/128",
|
[
|
||||||
"fc00::/7",
|
"127.0.0.0/8",
|
||||||
"10.0.0.0/8",
|
"::1/128",
|
||||||
"172.16.0.0/12",
|
"fc00::/7",
|
||||||
"192.168.0.0/16"
|
"10.0.0.0/8",
|
||||||
]
|
"172.16.0.0/12",
|
||||||
)
|
"192.168.0.0/16"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
test "disabled" do
|
test "disabled" do
|
||||||
clear_config(RemoteIp, enabled: false)
|
clear_config([RemoteIp, :enabled], false)
|
||||||
|
|
||||||
%{remote_ip: remote_ip} = conn(:get, "/")
|
%{remote_ip: remote_ip} = conn(:get, "/")
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "1.1.1.1")
|
|> put_req_header("x-forwarded-for", "1.1.1.1")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
@ -40,7 +44,8 @@ test "disabled" do
|
||||||
|
|
||||||
test "enabled" do
|
test "enabled" do
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "1.1.1.1")
|
|> put_req_header("x-forwarded-for", "1.1.1.1")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
@ -48,17 +53,20 @@ test "enabled" do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "custom headers" do
|
test "custom headers" do
|
||||||
clear_config(RemoteIp, enabled: true, headers: ["cf-connecting-ip"])
|
clear_config([RemoteIp, :enabled], true)
|
||||||
|
clear_config([RemoteIp, :headers], ["cf-connecting-ip"])
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "1.1.1.1")
|
|> put_req_header("x-forwarded-for", "1.1.1.1")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
refute conn.remote_ip == {1, 1, 1, 1}
|
refute conn.remote_ip == {1, 1, 1, 1}
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("cf-connecting-ip", "1.1.1.1")
|
|> put_req_header("cf-connecting-ip", "1.1.1.1")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
@ -67,7 +75,8 @@ test "custom headers" do
|
||||||
|
|
||||||
test "custom proxies" do
|
test "custom proxies" do
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1, 173.245.48.2")
|
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1, 173.245.48.2")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
@ -76,7 +85,8 @@ test "custom proxies" do
|
||||||
clear_config([RemoteIp, :proxies], ["173.245.48.0/20"])
|
clear_config([RemoteIp, :proxies], ["173.245.48.0/20"])
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1, 173.245.48.2")
|
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1, 173.245.48.2")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
@ -87,7 +97,8 @@ test "proxies set without CIDR format" do
|
||||||
clear_config([RemoteIp, :proxies], ["173.245.48.1"])
|
clear_config([RemoteIp, :proxies], ["173.245.48.1"])
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1")
|
|> put_req_header("x-forwarded-for", "173.245.48.1, 1.1.1.1")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
@ -99,7 +110,8 @@ test "proxies set `nonsensical` CIDR" do
|
||||||
clear_config([RemoteIp, :proxies], ["10.0.0.3/24"])
|
clear_config([RemoteIp, :proxies], ["10.0.0.3/24"])
|
||||||
|
|
||||||
conn =
|
conn =
|
||||||
conn(:get, "/")
|
:get
|
||||||
|
|> conn("/")
|
||||||
|> put_req_header("x-forwarded-for", "10.0.0.3, 1.1.1.1")
|
|> put_req_header("x-forwarded-for", "10.0.0.3, 1.1.1.1")
|
||||||
|> RemoteIp.call(nil)
|
|> RemoteIp.call(nil)
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ defmodule Pleroma.Web.TwitterAPI.PasswordControllerTest do
|
||||||
import Pleroma.Factory
|
import Pleroma.Factory
|
||||||
import Swoosh.TestAssertions
|
import Swoosh.TestAssertions
|
||||||
|
|
||||||
describe "GET /api/pleroma/password_reset/token" do
|
describe "GET /api/v1/pleroma/password_reset/token" do
|
||||||
test "it returns error when token invalid", %{conn: conn} do
|
test "it returns error when token invalid", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/password_reset/token")
|
|> get("/api/v1/pleroma/password_reset/token")
|
||||||
|> html_response(:ok)
|
|> html_response(:ok)
|
||||||
|
|
||||||
assert response =~ "<h2>Invalid Token</h2>"
|
assert response =~ "<h2>Invalid Token</h2>"
|
||||||
|
@ -30,7 +30,7 @@ test "it shows password reset form", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/password_reset/#{token.token}")
|
|> get("/api/v1/pleroma/password_reset/#{token.token}")
|
||||||
|> html_response(:ok)
|
|> html_response(:ok)
|
||||||
|
|
||||||
assert response =~ "<h2>Password Reset for #{user.nickname}</h2>"
|
assert response =~ "<h2>Password Reset for #{user.nickname}</h2>"
|
||||||
|
@ -45,14 +45,14 @@ test "it returns an error when the token has expired", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/password_reset/#{token.token}")
|
|> get("/api/v1/pleroma/password_reset/#{token.token}")
|
||||||
|> html_response(:ok)
|
|> html_response(:ok)
|
||||||
|
|
||||||
assert response =~ "<h2>Invalid Token</h2>"
|
assert response =~ "<h2>Invalid Token</h2>"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /api/pleroma/password_reset" do
|
describe "POST /api/v1/pleroma/password_reset" do
|
||||||
test "it fails for an expired token", %{conn: conn} do
|
test "it fails for an expired token", %{conn: conn} do
|
||||||
clear_config([:instance, :password_reset_token_validity], 0)
|
clear_config([:instance, :password_reset_token_validity], 0)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ test "it fails for an expired token", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/pleroma/password_reset", %{data: params})
|
|> post("/api/v1/pleroma/password_reset", %{data: params})
|
||||||
|> html_response(:ok)
|
|> html_response(:ok)
|
||||||
|
|
||||||
refute response =~ "<h2>Password changed!</h2>"
|
refute response =~ "<h2>Password changed!</h2>"
|
||||||
|
@ -90,7 +90,7 @@ test "it returns HTTP 200", %{conn: conn} do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/pleroma/password_reset", %{data: params})
|
|> post("/api/v1/pleroma/password_reset", %{data: params})
|
||||||
|> html_response(:ok)
|
|> html_response(:ok)
|
||||||
|
|
||||||
assert response =~ "<h2>Password changed!</h2>"
|
assert response =~ "<h2>Password changed!</h2>"
|
||||||
|
@ -114,7 +114,7 @@ test "it sets password_reset_pending to false", %{conn: conn} do
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> post("/api/pleroma/password_reset", %{data: params})
|
|> post("/api/v1/pleroma/password_reset", %{data: params})
|
||||||
|> html_response(:ok)
|
|> html_response(:ok)
|
||||||
|
|
||||||
assert User.get_by_id(user.id).password_reset_pending == false
|
assert User.get_by_id(user.id).password_reset_pending == false
|
||||||
|
|
|
@ -77,11 +77,11 @@ test "returns everything in :pleroma, :frontend_configurations", %{conn: conn} d
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "/api/pleroma/emoji" do
|
describe "/api/v1/pleroma/emoji" do
|
||||||
test "returns json with custom emoji with tags", %{conn: conn} do
|
test "returns json with custom emoji with tags", %{conn: conn} do
|
||||||
emoji =
|
emoji =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/emoji")
|
|> get("/api/v1/pleroma/emoji")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert Enum.all?(emoji, fn
|
assert Enum.all?(emoji, fn
|
||||||
|
@ -95,7 +95,7 @@ test "returns json with custom emoji with tags", %{conn: conn} do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/pleroma/healthcheck" do
|
describe "GET /api/v1/pleroma/healthcheck" do
|
||||||
setup do: clear_config([:instance, :healthcheck])
|
setup do: clear_config([:instance, :healthcheck])
|
||||||
|
|
||||||
test "returns 503 when healthcheck disabled", %{conn: conn} do
|
test "returns 503 when healthcheck disabled", %{conn: conn} do
|
||||||
|
@ -103,7 +103,7 @@ test "returns 503 when healthcheck disabled", %{conn: conn} do
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/healthcheck")
|
|> get("/api/v1/pleroma/healthcheck")
|
||||||
|> json_response_and_validate_schema(503)
|
|> json_response_and_validate_schema(503)
|
||||||
|
|
||||||
assert response == %{}
|
assert response == %{}
|
||||||
|
@ -116,7 +116,7 @@ test "returns 200 when healthcheck enabled and all ok", %{conn: conn} do
|
||||||
system_info: fn -> %Pleroma.Healthcheck{healthy: true} end do
|
system_info: fn -> %Pleroma.Healthcheck{healthy: true} end do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/healthcheck")
|
|> get("/api/v1/pleroma/healthcheck")
|
||||||
|> json_response_and_validate_schema(200)
|
|> json_response_and_validate_schema(200)
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
|
@ -136,7 +136,7 @@ test "returns 503 when healthcheck enabled and health is false", %{conn: conn} d
|
||||||
system_info: fn -> %Pleroma.Healthcheck{healthy: false} end do
|
system_info: fn -> %Pleroma.Healthcheck{healthy: false} end do
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/healthcheck")
|
|> get("/api/v1/pleroma/healthcheck")
|
||||||
|> json_response_and_validate_schema(503)
|
|> json_response_and_validate_schema(503)
|
||||||
|
|
||||||
assert %{
|
assert %{
|
||||||
|
@ -334,7 +334,7 @@ test "it returns new captcha", %{conn: conn} do
|
||||||
new: fn -> "test_captcha" end do
|
new: fn -> "test_captcha" end do
|
||||||
resp =
|
resp =
|
||||||
conn
|
conn
|
||||||
|> get("/api/pleroma/captcha")
|
|> get("/api/v1/pleroma/captcha")
|
||||||
|> response(200)
|
|> response(200)
|
||||||
|
|
||||||
assert resp == "\"test_captcha\""
|
assert resp == "\"test_captcha\""
|
||||||
|
@ -459,7 +459,10 @@ test "with proper permissions, valid password and valid email", %{
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "multipart/form-data")
|
|> put_req_header("content-type", "multipart/form-data")
|
||||||
|> post("/api/pleroma/change_email", %{password: "test", email: "cofe@foobar.com"})
|
|> post("/api/pleroma/change_email", %{
|
||||||
|
password: "test",
|
||||||
|
email: "cofe@foobar.com"
|
||||||
|
})
|
||||||
|
|
||||||
assert json_response_and_validate_schema(conn, 200) == %{"status" => "success"}
|
assert json_response_and_validate_schema(conn, 200) == %{"status" => "success"}
|
||||||
end
|
end
|
||||||
|
@ -961,7 +964,9 @@ test "with permissions, account does not have such alias", %{
|
||||||
conn =
|
conn =
|
||||||
conn
|
conn
|
||||||
|> put_req_header("content-type", "application/json")
|
|> put_req_header("content-type", "application/json")
|
||||||
|> delete("/api/pleroma/aliases", %{alias: non_alias_user |> User.full_nickname()})
|
|> delete("/api/pleroma/aliases", %{
|
||||||
|
alias: non_alias_user |> User.full_nickname()
|
||||||
|
})
|
||||||
|
|
||||||
assert %{"error" => "Account has no such alias."} =
|
assert %{"error" => "Account has no such alias."} =
|
||||||
json_response_and_validate_schema(conn, 404)
|
json_response_and_validate_schema(conn, 404)
|
||||||
|
|
|
@ -123,7 +123,10 @@ def eval_quoted(block, binding) do
|
||||||
|
|
||||||
defp start_peer({node_host, override_configs}) do
|
defp start_peer({node_host, override_configs}) do
|
||||||
log(node_host, "booting federated VM")
|
log(node_host, "booting federated VM")
|
||||||
{:ok, node} = :peer.start(%{host: ~c"127.0.0.1", name: node_name(node_host), args: vm_args()})
|
|
||||||
|
{:ok, _pid, node} =
|
||||||
|
:peer.start(%{host: ~c"127.0.0.1", name: node_name(node_host), args: vm_args()})
|
||||||
|
|
||||||
add_code_paths(node)
|
add_code_paths(node)
|
||||||
load_apps_and_transfer_configuration(node, override_configs)
|
load_apps_and_transfer_configuration(node, override_configs)
|
||||||
ensure_apps_started(node)
|
ensure_apps_started(node)
|
||||||
|
|
Loading…
Reference in a new issue