forked from AkkomaGang/akkoma
Merge branch 'otp26' into develop
This commit is contained in:
commit
165c2485ff
20 changed files with 299 additions and 52 deletions
|
@ -12,9 +12,8 @@ matrix:
|
|||
OTP_VERSION: 25
|
||||
- ELIXIR_VERSION: 1.15
|
||||
OTP_VERSION: 25
|
||||
# Soon
|
||||
#- ELIXIR_VERSION: 1.15
|
||||
# OTP_VERSION: 26
|
||||
- ELIXIR_VERSION: 1.15
|
||||
OTP_VERSION: 26
|
||||
|
||||
variables:
|
||||
- &scw-secrets
|
||||
|
|
|
@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
## Added
|
||||
- Full compatibility with Erlang OTP26
|
||||
|
||||
## 2023.08
|
||||
|
||||
## Added
|
||||
|
|
|
@ -170,6 +170,10 @@
|
|||
"application/ld+json" => ["activity+json"]
|
||||
}
|
||||
|
||||
config :mime, :extensions, %{
|
||||
"activity+json" => "application/activity+json"
|
||||
}
|
||||
|
||||
config :tesla, :adapter, {Tesla.Adapter.Finch, name: MyFinch}
|
||||
|
||||
# Configures http settings, upstream proxy etc.
|
||||
|
|
|
@ -34,7 +34,9 @@ def perform(%Plug.Conn{assigns: assigns} = conn, %{scopes: scopes} = options) do
|
|||
permissions = Enum.join(missing_scopes, " #{op} ")
|
||||
|
||||
error_message =
|
||||
dgettext("errors", "Insufficient permissions: %{permissions}.", permissions: permissions)
|
||||
dgettext("errors", "Insufficient permissions: %{permissions}.",
|
||||
permissions: permissions
|
||||
)
|
||||
|
||||
conn
|
||||
|> put_resp_content_type("application/json")
|
||||
|
|
|
@ -26,13 +26,7 @@ def string_from_xpath(xpath, doc) do
|
|||
|
||||
def parse_document(text) do
|
||||
try do
|
||||
{doc, _rest} =
|
||||
text
|
||||
|> :binary.bin_to_list()
|
||||
|> :xmerl_scan.string(
|
||||
quiet: true,
|
||||
allow_entities: false
|
||||
)
|
||||
doc = SweetXml.parse(text, dtd: :none)
|
||||
|
||||
{:ok, doc}
|
||||
rescue
|
||||
|
|
14
mix.exs
14
mix.exs
|
@ -156,7 +156,9 @@ defp deps do
|
|||
{:timex, "~> 3.7"},
|
||||
{:ueberauth, "~> 0.10"},
|
||||
{:linkify, git: "https://akkoma.dev/AkkomaGang/linkify.git"},
|
||||
{:http_signatures, "~> 0.1.1"},
|
||||
{:http_signatures,
|
||||
git: "https://akkoma.dev/AkkomaGang/http_signatures.git",
|
||||
ref: "6640ce7d24c783ac2ef56e27d00d12e8dc85f396"},
|
||||
{:telemetry, "~> 1.2"},
|
||||
{:telemetry_poller, "~> 1.0"},
|
||||
{:telemetry_metrics, "~> 0.6"},
|
||||
|
@ -177,7 +179,9 @@ defp deps do
|
|||
git: "https://git.pleroma.social/pleroma/elixir-libraries/elixir-captcha.git",
|
||||
ref: "3bbfa8b5ea13accc1b1c40579a380d8e5cfd6ad2"},
|
||||
{:restarter, path: "./restarter"},
|
||||
{:majic, "~> 1.0"},
|
||||
{:majic,
|
||||
git: "https://akkoma.dev/AkkomaGang/majic.git",
|
||||
ref: "80540b36939ec83f48e76c61e5000e0fd67706f0"},
|
||||
{:eblurhash, "~> 1.2.2"},
|
||||
{:open_api_spex, "~> 3.17"},
|
||||
{:search_parser,
|
||||
|
@ -190,7 +194,7 @@ defp deps do
|
|||
git: "https://akkoma.dev/AkkomaGang/elasticsearch-elixir.git", ref: "main"},
|
||||
{:mfm_parser,
|
||||
git: "https://akkoma.dev/AkkomaGang/mfm-parser.git",
|
||||
ref: "912fba81152d4d572e457fd5427f9875b2bc3dbe"},
|
||||
ref: "b21ab7754024af096f2d14247574f55f0063295b"},
|
||||
|
||||
## dev & test
|
||||
{:ex_doc, "~> 0.30", only: :dev, runtime: false},
|
||||
|
@ -201,7 +205,9 @@ defp deps do
|
|||
{:mox, "~> 1.0", only: :test},
|
||||
{:websockex, "~> 0.4.3", only: :test},
|
||||
{:dialyxir, "~> 1.3", only: [:dev], runtime: false},
|
||||
{:mint, "~> 1.5.1", override: true}
|
||||
{:elixir_xml_to_map, "~> 3.0", only: :test},
|
||||
{:mint, "~> 1.5.1", override: true},
|
||||
{:nimble_pool, "~> 1.0", override: true}
|
||||
] ++ oauth_deps()
|
||||
end
|
||||
|
||||
|
|
15
mix.lock
15
mix.lock
|
@ -32,8 +32,10 @@
|
|||
"ecto_psql_extras": {:hex, :ecto_psql_extras, "0.7.12", "e3bd8318702b069263d0118e7cdb6c66c5ff0a034f540f4c0158bd769e7dff6a", [:mix], [{:ecto_sql, "~> 3.7", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16.0 or ~> 0.17.0", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.1.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "4a1d1d10b74ce033a428a99272038c90e444a0a1912a074e38a71ee9f667714c"},
|
||||
"ecto_sql": {:hex, :ecto_sql, "3.10.1", "6ea6b3036a0b0ca94c2a02613fd9f742614b5cfe494c41af2e6571bb034dd94c", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.10.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 0.17.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", "f6a25bdbbd695f12c8171eaff0851fa4c8e72eec1e98c7364402dda9ce11c56b"},
|
||||
"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.7.7", "7128c60c2476019ed978210c245badf08b03dbec4f24d05790ef791da11aa17c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5bc19fff950fad52bbe5f211b12db9ec82c6b34a9647da0c2224b8b8464c7e6c"},
|
||||
"elixir_xml_to_map": {:hex, :elixir_xml_to_map, "3.0.0", "67dcff30ecf72aed37ab08525133e4420717a749436e22bfece431e7dddeea7e", [:mix], [{:erlsom, "~> 1.4", [hex: :erlsom, repo: "hexpm", optional: false]}], "hexpm", "11222dd7f029f8db7a6662b41c992dbdb0e1c6e4fdea6a42056f9d27c847efbb"},
|
||||
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
|
||||
"erlsom": {:hex, :erlsom, "1.5.1", "c8fe2babd33ff0846403f6522328b8ab676f896b793634cfe7ef181c05316c03", [:rebar3], [], "hexpm", "7965485494c5844dd127656ac40f141aadfa174839ec1be1074e7edf5b4239eb"},
|
||||
"eternal": {:hex, :eternal, "1.2.2", "d1641c86368de99375b98d183042dd6c2b234262b8d08dfd72b9eeaafc2a1abd", [:mix], [], "hexpm", "2c9fe32b9c3726703ba5e1d43a1d255a4f3f2d8f8f9bc19f094c7cb1a7a9e782"},
|
||||
"ex_aws": {:hex, :ex_aws, "2.4.4", "d7886eaca7e10f7bd3d9e9d2d5414cb336737b3ab2fddd4fa30358b725293fe0", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8 or ~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:mime, "~> 1.2 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "a7d63e485ca2b16fb804f3f20097827aa69885eea6e69fa75c98f353c9c91dc7"},
|
||||
"ex_aws_s3": {:hex, :ex_aws_s3, "2.4.0", "ce8decb6b523381812798396bc0e3aaa62282e1b40520125d1f4eff4abdff0f4", [: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", "85dda6e27754d94582869d39cba3241d9ea60b6aa4167f9c88e309dc687e56bb"},
|
||||
|
@ -45,6 +47,7 @@
|
|||
"expo": {:hex, :expo, "0.4.1", "1c61d18a5df197dfda38861673d392e642649a9cef7694d2f97a587b2cfb319b", [:mix], [], "hexpm", "2ff7ba7a798c8c543c12550fa0e2cbc81b95d4974c65855d8d15ba7b37a1ce47"},
|
||||
"fast_html": {:hex, :fast_html, "2.2.0", "6c5ef1be087a4ed613b0379c13f815c4d11742b36b67bb52cee7859847c84520", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}], "hexpm", "064c4f23b4a6168f9187dac8984b056f2c531bb0787f559fd6a8b34b38aefbae"},
|
||||
"fast_sanitize": {:hex, :fast_sanitize, "0.2.3", "67b93dfb34e302bef49fec3aaab74951e0f0602fd9fa99085987af05bd91c7a5", [:mix], [{:fast_html, "~> 2.0", [hex: :fast_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "e8ad286d10d0386e15d67d0ee125245ebcfbc7d7290b08712ba9013c8c5e56e2"},
|
||||
"file_ex": {:git, "https://akkoma.dev/AkkomaGang/file_ex.git", "cc7067c7d446c2526e9ecf91d40896b088851569", [ref: "cc7067c7d446c2526e9ecf91d40896b088851569"]},
|
||||
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
|
||||
"finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"},
|
||||
"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"},
|
||||
|
@ -54,7 +57,7 @@
|
|||
"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"},
|
||||
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
|
||||
"http_signatures": {:hex, :http_signatures, "0.1.1", "ca7ebc1b61542b163644c8c3b1f0e0f41037d35f2395940d3c6c7deceab41fd8", [:mix], [], "hexpm", "cc3b8a007322cc7b624c0c15eec49ee58ac977254ff529a3c482f681465942a3"},
|
||||
"http_signatures": {:git, "https://akkoma.dev/AkkomaGang/http_signatures.git", "6640ce7d24c783ac2ef56e27d00d12e8dc85f396", [ref: "6640ce7d24c783ac2ef56e27d00d12e8dc85f396"]},
|
||||
"httpoison": {:hex, :httpoison, "1.8.2", "9eb9c63ae289296a544842ef816a85d881d4a31f518a0fec089aaa744beae290", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "2bb350d26972e30c96e2ca74a1aaf8293d61d0742ff17f01e0279fef11599921"},
|
||||
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
|
||||
"inet_cidr": {:hex, :inet_cidr, "1.0.4", "a05744ab7c221ca8e395c926c3919a821eb512e8f36547c062f62c4ca0cf3d6e", [:mix], [], "hexpm", "64a2d30189704ae41ca7dbdd587f5291db5d1dda1414e0774c29ffc81088c1bc"},
|
||||
|
@ -64,14 +67,14 @@
|
|||
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"},
|
||||
"linkify": {:git, "https://akkoma.dev/AkkomaGang/linkify.git", "2567e2c1073fa371fd26fd66dfa5bc77b6919c16", []},
|
||||
"mail": {:hex, :mail, "0.3.0", "f353ef5f41d9f2e483ba7c5df92cdfe27b990b2d8c8c41d84c7b2b40ec33989f", [:mix], [], "hexpm", "523d700b2231d887dc4ee41d3bb13f48358f6f118e55a67cef6d630d7907116c"},
|
||||
"majic": {:hex, :majic, "1.0.0", "37e50648db5f5c2ff0c9fb46454d034d11596c03683807b9fb3850676ffdaab3", [:make, :mix], [{:elixir_make, "~> 0.6.1", [hex: :elixir_make, repo: "hexpm", optional: false]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "7905858f76650d49695f14ea55cd9aaaee0c6654fa391671d4cf305c275a0a9e"},
|
||||
"majic": {:git, "https://akkoma.dev/AkkomaGang/majic.git", "80540b36939ec83f48e76c61e5000e0fd67706f0", [ref: "80540b36939ec83f48e76c61e5000e0fd67706f0"]},
|
||||
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
|
||||
"makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},
|
||||
"makeup_erlang": {:hex, :makeup_erlang, "0.1.2", "ad87296a092a46e03b7e9b0be7631ddcf64c790fa68a9ef5323b6cbb36affc72", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f3f5a1ca93ce6e092d92b6d9c049bcda58a3b617a8d888f8e7231c85630e8108"},
|
||||
"meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"},
|
||||
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
|
||||
"mfm_parser": {:git, "https://akkoma.dev/AkkomaGang/mfm-parser.git", "912fba81152d4d572e457fd5427f9875b2bc3dbe", [ref: "912fba81152d4d572e457fd5427f9875b2bc3dbe"]},
|
||||
"mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"},
|
||||
"mfm_parser": {:git, "https://akkoma.dev/AkkomaGang/mfm-parser.git", "b21ab7754024af096f2d14247574f55f0063295b", [ref: "b21ab7754024af096f2d14247574f55f0063295b"]},
|
||||
"mime": {:hex, :mime, "2.0.5", "dc34c8efd439abe6ae0343edbb8556f4d63f178594894720607772a041b04b02", [:mix], [], "hexpm", "da0d64a365c45bc9935cc5c8a7fc5e49a0e0f9932a761c55d6c52b142780a05c"},
|
||||
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
|
||||
"mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"},
|
||||
"mock": {:hex, :mock, "0.3.8", "7046a306b71db2488ef54395eeb74df0a7f335a7caca4a3d3875d1fc81c884dd", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "7fa82364c97617d79bb7d15571193fc0c4fe5afd0c932cef09426b3ee6fe2022"},
|
||||
|
@ -79,7 +82,7 @@
|
|||
"mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"},
|
||||
"nimble_options": {:hex, :nimble_options, "1.0.2", "92098a74df0072ff37d0c12ace58574d26880e522c22801437151a159392270e", [:mix], [], "hexpm", "fd12a8db2021036ce12a309f26f564ec367373265b53e25403f0ee697380f1b8"},
|
||||
"nimble_parsec": {:hex, :nimble_parsec, "1.3.1", "2c54013ecf170e249e9291ed0a62e5832f70a476c61da16f6aac6dca0189f2af", [:mix], [], "hexpm", "2682e3c0b2eb58d90c6375fc0cc30bc7be06f365bf72608804fb9cffa5e1b167"},
|
||||
"nimble_pool": {:hex, :nimble_pool, "0.2.6", "91f2f4c357da4c4a0a548286c84a3a28004f68f05609b4534526871a22053cde", [:mix], [], "hexpm", "1c715055095d3f2705c4e236c18b618420a35490da94149ff8b580a2144f653f"},
|
||||
"nimble_pool": {:hex, :nimble_pool, "1.0.0", "5eb82705d138f4dd4423f69ceb19ac667b3b492ae570c9f5c900bb3d2f50a847", [:mix], [], "hexpm", "80be3b882d2d351882256087078e1b1952a28bf98d0a287be87e4a24a710b67a"},
|
||||
"oban": {:hex, :oban, "2.15.2", "8f934a49db39163633965139c8846d8e24c2beb4180f34a005c2c7c3f69a6aa2", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, "~> 0.9", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0f4a579ea48fc7489e0d84facf8b01566e142bdc6542d7dabce32c10e664f1e9"},
|
||||
"open_api_spex": {:hex, :open_api_spex, "3.17.3", "ada8e352eb786050dd639db2439d3316e92f3798eb2abd051f55bb9af825b37e", [: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", "165db21a85ca83cffc8e7c8890f35b354eddda8255de7404a2848ed652b9f0fe"},
|
||||
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
|
||||
|
|
44
test/fixtures/xml_normal.xml
vendored
Normal file
44
test/fixtures/xml_normal.xml
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?xml version="1.05" encoding="UTF-8"?>
|
||||
<game>
|
||||
<matchups>
|
||||
<matchup winner-id="1">
|
||||
<name>Match One</name>
|
||||
<teams>
|
||||
<team>
|
||||
<id>1</id>
|
||||
<name>Team One</name>
|
||||
</team>
|
||||
<team>
|
||||
<id>2</id>
|
||||
<name>Team Two</name>
|
||||
</team>
|
||||
</teams>
|
||||
</matchup>
|
||||
<matchup winner-id="2">
|
||||
<name>Match Two</name>
|
||||
<teams>
|
||||
<team>
|
||||
<id>2</id>
|
||||
<name>Team Two</name>
|
||||
</team>
|
||||
<team>
|
||||
<id>3</id>
|
||||
<name>Team Three</name>
|
||||
</team>
|
||||
</teams>
|
||||
</matchup>
|
||||
<matchup winner-id="1">
|
||||
<name>Match Three</name>
|
||||
<teams>
|
||||
<team>
|
||||
<id>1</id>
|
||||
<name>Team One</name>
|
||||
</team>
|
||||
<team>
|
||||
<id>3</id>
|
||||
<name>Team Three</name>
|
||||
</team>
|
||||
</teams>
|
||||
</matchup>
|
||||
</matchups>
|
||||
</game>
|
|
@ -182,8 +182,81 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil
|
|||
assert File.exists?(temp_file)
|
||||
{:ok, file} = File.read(temp_file)
|
||||
|
||||
assert file ==
|
||||
"import Config\n\nconfig :pleroma, :instance,\n name: \"Pleroma\",\n email: \"example@example.com\",\n notify_email: \"noreply@example.com\",\n description: \"A Pleroma instance, an alternative fediverse server\",\n limit: 5000,\n remote_limit: 100_000,\n upload_limit: 16_000_000,\n avatar_upload_limit: 2_000_000,\n background_upload_limit: 4_000_000,\n banner_upload_limit: 4_000_000,\n poll_limits: %{\n max_expiration: 31_536_000,\n max_option_chars: 200,\n max_options: 20,\n min_expiration: 0\n },\n registrations_open: true,\n federating: true,\n federation_incoming_replies_max_depth: 100,\n federation_reachability_timeout_days: 7,\n federation_publisher_modules: [Pleroma.Web.ActivityPub.Publisher],\n allow_relay: true,\n public: true,\n quarantined_instances: [],\n managed_config: true,\n static_dir: \"instance/static/\",\n allowed_post_formats: [\"text/plain\", \"text/html\", \"text/markdown\", \"text/bbcode\"],\n autofollowed_nicknames: [],\n max_pinned_statuses: 1,\n attachment_links: false,\n max_report_comment_size: 1000,\n safe_dm_mentions: false,\n healthcheck: false,\n remote_post_retention_days: 90,\n skip_thread_containment: true,\n limit_to_local_content: :unauthenticated,\n user_bio_length: 5000,\n user_name_length: 100,\n max_account_fields: 10,\n max_remote_account_fields: 20,\n account_field_name_length: 512,\n account_field_value_length: 2048,\n external_user_synchronization: true,\n extended_nickname_format: true,\n multi_factor_authentication: [\n totp: [digits: 6, period: 30],\n backup_codes: [number: 2, length: 6]\n ]\n"
|
||||
{:ok, file_quote} = Code.string_to_quoted(file)
|
||||
|
||||
{:__block__, [],
|
||||
[
|
||||
_,
|
||||
{:config, _, config_quote}
|
||||
]} = file_quote
|
||||
|
||||
assert [
|
||||
:pleroma,
|
||||
:instance,
|
||||
[
|
||||
name: "Pleroma",
|
||||
email: "example@example.com",
|
||||
notify_email: "noreply@example.com",
|
||||
description: "A Pleroma instance, an alternative fediverse server",
|
||||
limit: 5000,
|
||||
remote_limit: 100_000,
|
||||
upload_limit: 16_000_000,
|
||||
avatar_upload_limit: 2_000_000,
|
||||
background_upload_limit: 4_000_000,
|
||||
banner_upload_limit: 4_000_000,
|
||||
poll_limits: {_, _, poll_limits},
|
||||
registrations_open: true,
|
||||
federating: true,
|
||||
federation_incoming_replies_max_depth: 100,
|
||||
federation_reachability_timeout_days: 7,
|
||||
federation_publisher_modules: [
|
||||
{_, _, [:Pleroma, :Web, :ActivityPub, :Publisher]}
|
||||
],
|
||||
allow_relay: true,
|
||||
public: true,
|
||||
quarantined_instances: [],
|
||||
managed_config: true,
|
||||
static_dir: "instance/static/",
|
||||
allowed_post_formats: ["text/plain", "text/html", "text/markdown", "text/bbcode"],
|
||||
autofollowed_nicknames: [],
|
||||
max_pinned_statuses: 1,
|
||||
attachment_links: false,
|
||||
max_report_comment_size: 1000,
|
||||
safe_dm_mentions: false,
|
||||
healthcheck: false,
|
||||
remote_post_retention_days: 90,
|
||||
skip_thread_containment: true,
|
||||
limit_to_local_content: :unauthenticated,
|
||||
user_bio_length: 5000,
|
||||
user_name_length: 100,
|
||||
max_account_fields: 10,
|
||||
max_remote_account_fields: 20,
|
||||
account_field_name_length: 512,
|
||||
account_field_value_length: 2048,
|
||||
external_user_synchronization: true,
|
||||
extended_nickname_format: true,
|
||||
multi_factor_authentication: [
|
||||
{:totp,
|
||||
[
|
||||
digits: 6,
|
||||
period: 30
|
||||
]},
|
||||
{:backup_codes,
|
||||
[
|
||||
number: 2,
|
||||
length: 6
|
||||
]}
|
||||
]
|
||||
]
|
||||
] = config_quote
|
||||
|
||||
assert Keyword.equal?(
|
||||
poll_limits,
|
||||
max_options: 20,
|
||||
max_option_chars: 200,
|
||||
min_expiration: 0,
|
||||
max_expiration: 31_536_000
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,17 +6,19 @@ defmodule Pleroma.HealthcheckTest do
|
|||
use Pleroma.DataCase, async: true
|
||||
alias Pleroma.Healthcheck
|
||||
|
||||
import Pleroma.Test.Matchers.List
|
||||
|
||||
test "system_info/0" do
|
||||
result = Healthcheck.system_info() |> Map.from_struct()
|
||||
|
||||
assert Map.keys(result) == [
|
||||
assert_unordered_list_equal(Map.keys(result), [
|
||||
:active,
|
||||
:healthy,
|
||||
:idle,
|
||||
:job_queue_stats,
|
||||
:memory_used,
|
||||
:pool_size
|
||||
]
|
||||
])
|
||||
end
|
||||
|
||||
describe "check_health/1" do
|
||||
|
|
|
@ -6,16 +6,19 @@ defmodule Pleroma.MFA.TOTPTest do
|
|||
use Pleroma.DataCase, async: true
|
||||
|
||||
alias Pleroma.MFA.TOTP
|
||||
import Pleroma.Test.Matchers.URI
|
||||
|
||||
test "create provisioning_uri to generate qrcode" do
|
||||
uri =
|
||||
TOTP.provisioning_uri("test-secrcet", "test@example.com",
|
||||
TOTP.provisioning_uri("test-secret", "test@example.com",
|
||||
issuer: "Plerome-42",
|
||||
digits: 8,
|
||||
period: 60
|
||||
)
|
||||
|
||||
assert uri ==
|
||||
"otpauth://totp/test@example.com?digits=8&issuer=Plerome-42&period=60&secret=test-secrcet"
|
||||
assert_uri_equals(
|
||||
uri,
|
||||
"otpauth://totp/test@example.com?digits=8&issuer=Plerome-42&period=60&secret=test-secret"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,13 +29,13 @@ test "change/0 converts auto_linker opts for Pleroma.Formatter", %{migration: mi
|
|||
|
||||
%{value: new_opts} = ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Formatter})
|
||||
|
||||
assert new_opts == [
|
||||
assert Keyword.equal?(new_opts,
|
||||
class: false,
|
||||
extra: true,
|
||||
new_window: false,
|
||||
rel: "testing",
|
||||
strip_prefix: false
|
||||
]
|
||||
)
|
||||
|
||||
clear_config(Pleroma.Formatter, new_opts)
|
||||
assert new_opts == Pleroma.Config.get(Pleroma.Formatter)
|
||||
|
@ -67,6 +67,6 @@ test "transform_opts/1 returns a list of compatible opts", %{migration: migratio
|
|||
strip_prefix: false
|
||||
]
|
||||
|
||||
assert migration.transform_opts(old_opts) == expected_opts
|
||||
assert Keyword.equal?(migration.transform_opts(old_opts), expected_opts)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,16 +26,16 @@ test "change/0 converts a map into a list", %{migration: migration} do
|
|||
|
||||
%{value: new_opts} = ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Formatter})
|
||||
|
||||
assert new_opts == [
|
||||
assert Keyword.equal?(new_opts,
|
||||
class: false,
|
||||
extra: true,
|
||||
new_window: false,
|
||||
rel: "F",
|
||||
strip_prefix: false
|
||||
]
|
||||
)
|
||||
|
||||
clear_config(Pleroma.Formatter, new_opts)
|
||||
assert new_opts == Pleroma.Config.get(Pleroma.Formatter)
|
||||
assert Keyword.equal?(new_opts, Pleroma.Config.get(Pleroma.Formatter))
|
||||
|
||||
{text, _mentions, []} =
|
||||
Pleroma.Formatter.linkify(
|
||||
|
@ -61,7 +61,7 @@ test "change/0 skips if Pleroma.Formatter config is already a list", %{migration
|
|||
|
||||
%{value: new_opts} = ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Formatter})
|
||||
|
||||
assert new_opts == opts
|
||||
assert Keyword.equal?(new_opts, opts)
|
||||
end
|
||||
|
||||
test "change/0 skips if Pleroma.Formatter is empty", %{migration: migration} do
|
||||
|
|
|
@ -71,6 +71,35 @@ test "it returns error when not found user" do
|
|||
end
|
||||
end
|
||||
|
||||
defp split_signature(sig) do
|
||||
sig
|
||||
|> String.split(",")
|
||||
|> Enum.map(fn part ->
|
||||
[key, value] = String.split(part, "=", parts: 2)
|
||||
[key, String.trim(value, ~s|"|)]
|
||||
end)
|
||||
|> Enum.sort_by(fn [k, _] -> k end)
|
||||
end
|
||||
|
||||
# Break up a signature and check by parts
|
||||
defp assert_signature_equal(sig_a, sig_b) when is_binary(sig_a) and is_binary(sig_b) do
|
||||
parts_a = split_signature(sig_a)
|
||||
parts_b = split_signature(sig_b)
|
||||
|
||||
parts_a
|
||||
|> Enum.with_index()
|
||||
|> Enum.each(fn {part_a, index} ->
|
||||
part_b = Enum.at(parts_b, index)
|
||||
assert_part_equal(part_a, part_b)
|
||||
end)
|
||||
end
|
||||
|
||||
defp assert_part_equal(part_a, part_b) do
|
||||
if part_a != part_b do
|
||||
flunk("Signature check failed - expected #{part_a} to equal #{part_b}")
|
||||
end
|
||||
end
|
||||
|
||||
describe "sign/2" do
|
||||
test "it returns signature headers" do
|
||||
user =
|
||||
|
@ -79,14 +108,18 @@ test "it returns signature headers" do
|
|||
keys: @private_key
|
||||
})
|
||||
|
||||
assert Signature.sign(
|
||||
user,
|
||||
%{
|
||||
headers = %{
|
||||
host: "test.test",
|
||||
"content-length": 100
|
||||
}
|
||||
) ==
|
||||
|
||||
assert_signature_equal(
|
||||
Signature.sign(
|
||||
user,
|
||||
headers
|
||||
),
|
||||
"keyId=\"https://mastodon.social/users/lambadalambda#main-key\",algorithm=\"rsa-sha256\",headers=\"content-length host\",signature=\"sibUOoqsFfTDerquAkyprxzDjmJm6erYc42W5w1IyyxusWngSinq5ILTjaBxFvfarvc7ci1xAi+5gkBwtshRMWm7S+Uqix24Yg5EYafXRun9P25XVnYBEIH4XQ+wlnnzNIXQkU3PU9e6D8aajDZVp3hPJNeYt1gIPOA81bROI8/glzb1SAwQVGRbqUHHHKcwR8keiR/W2h7BwG3pVRy4JgnIZRSW7fQogKedDg02gzRXwUDFDk0pr2p3q6bUWHUXNV8cZIzlMK+v9NlyFbVYBTHctAR26GIAN6Hz0eV0mAQAePHDY1mXppbA8Gpp6hqaMuYfwifcXmcc+QFm4e+n3A==\""
|
||||
)
|
||||
end
|
||||
|
||||
test "it returns error" do
|
||||
|
|
|
@ -1883,7 +1883,7 @@ test "favorites paginate correctly" do
|
|||
|
||||
# Using the header for pagination works correctly
|
||||
[next, _] = get_resp_header(result, "link") |> hd() |> String.split(", ")
|
||||
[_, max_id] = Regex.run(~r/max_id=([^&]+)/, next)
|
||||
[_, max_id] = Regex.run(~r/max_id=([^&>]+)/, next)
|
||||
|
||||
assert max_id == third_favorite.id
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ defmodule Pleroma.Web.WebFinger.WebFingerControllerTest do
|
|||
import ExUnit.CaptureLog
|
||||
import Pleroma.Factory
|
||||
import Tesla.Mock
|
||||
import Pleroma.Test.Matchers.XML
|
||||
|
||||
setup do
|
||||
mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
|
||||
|
@ -23,8 +24,10 @@ test "GET host-meta" do
|
|||
|
||||
assert response.status == 200
|
||||
|
||||
assert response.resp_body ==
|
||||
assert_xml_equals(
|
||||
response.resp_body,
|
||||
~s(<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="#{Pleroma.Web.Endpoint.url()}/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /></XRD>)
|
||||
)
|
||||
end
|
||||
|
||||
test "Webfinger JRD" do
|
||||
|
|
|
@ -3,6 +3,11 @@ defmodule Pleroma.Web.XMLTest do
|
|||
|
||||
alias Pleroma.Web.XML
|
||||
|
||||
test "parses normal XML" do
|
||||
data = File.read!("test/fixtures/xml_normal.xml")
|
||||
assert {:ok, _} = XML.parse_document(data)
|
||||
end
|
||||
|
||||
test "refuses to parse any entities from XML" do
|
||||
data = File.read!("test/fixtures/xml_billion_laughs.xml")
|
||||
assert(:error == XML.parse_document(data))
|
||||
|
|
16
test/support/matchers/list.ex
Normal file
16
test/support/matchers/list.ex
Normal file
|
@ -0,0 +1,16 @@
|
|||
defmodule Pleroma.Test.Matchers.List do
|
||||
import ExUnit.Assertions
|
||||
|
||||
def assert_unordered_list_equal(list_a, list_b) when is_list(list_a) and is_list(list_b) do
|
||||
list_a = Enum.sort(list_a)
|
||||
list_b = Enum.sort(list_b)
|
||||
|
||||
if list_a != list_b do
|
||||
flunk("Expected list
|
||||
#{inspect(list_a)}
|
||||
to have the same elements as
|
||||
#{inspect(list_b)}
|
||||
")
|
||||
end
|
||||
end
|
||||
end
|
37
test/support/matchers/uri.ex
Normal file
37
test/support/matchers/uri.ex
Normal file
|
@ -0,0 +1,37 @@
|
|||
defmodule Pleroma.Test.Matchers.URI do
|
||||
import ExUnit.Assertions
|
||||
|
||||
def assert_uri_equals(%URI{} = uri_a, %URI{} = uri_b) do
|
||||
[:scheme, :authority, :userinfo, :host, :port, :path, :fragment]
|
||||
|> Enum.each(fn attribute ->
|
||||
if Map.get(uri_a, attribute) == Map.get(uri_b, attribute) do
|
||||
:ok
|
||||
else
|
||||
flunk("Expected #{uri_a} to match #{uri_b} - #{attribute} does not match")
|
||||
end
|
||||
end)
|
||||
|
||||
# And the query string
|
||||
query_a = URI.decode_query(uri_a.query)
|
||||
query_b = URI.decode_query(uri_b.query)
|
||||
|
||||
if query_a == query_b do
|
||||
:ok
|
||||
else
|
||||
flunk(
|
||||
"Expected #{uri_a} to match #{uri_b} - query parameters #{inspect(query_a)} do not match #{inspect(query_b)}"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def assert_uri_equals(uri_a, uri_b) when is_binary(uri_a) do
|
||||
uri_a
|
||||
|> URI.parse()
|
||||
|> assert_uri_equals(uri_b)
|
||||
end
|
||||
|
||||
def assert_uri_equals(%URI{} = uri_a, uri_b) when is_binary(uri_b) do
|
||||
uri_b = URI.parse(uri_b)
|
||||
assert_uri_equals(uri_a, uri_b)
|
||||
end
|
||||
end
|
18
test/support/matchers/xml.ex
Normal file
18
test/support/matchers/xml.ex
Normal file
|
@ -0,0 +1,18 @@
|
|||
defmodule Pleroma.Test.Matchers.XML do
|
||||
import ExUnit.Assertions
|
||||
|
||||
def assert_xml_equals(xml_a, xml_b) do
|
||||
map_a = XmlToMap.naive_map(xml_a)
|
||||
map_b = XmlToMap.naive_map(xml_b)
|
||||
|
||||
if map_a != map_b do
|
||||
flunk(~s|Expected XML
|
||||
#{xml_a}
|
||||
|
||||
to equal
|
||||
|
||||
#{xml_b}
|
||||
|)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue