forked from AkkomaGang/akkoma
Merge branch 'release/2.2.2' into 'stable'
Release/2.2.2 See merge request pleroma/pleroma!3216
This commit is contained in:
commit
c2186a62d5
105 changed files with 130 additions and 79 deletions
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -3,6 +3,17 @@ 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/).
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
## [2.2.2] - 2020-01-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- StealEmojiPolicy creates dir for emojis, if it doesn't exist.
|
||||||
|
- Updated `elixir_make` to a non-retired version
|
||||||
|
|
||||||
|
### Upgrade notes
|
||||||
|
|
||||||
|
1. Restart Pleroma
|
||||||
|
|
||||||
## [2.2.1] - 2020-12-22
|
## [2.2.1] - 2020-12-22
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@ -17,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
- Rich Media Previews sometimes showed the wrong preview due to a bug following redirects.
|
- Rich Media Previews sometimes showed the wrong preview due to a bug following redirects.
|
||||||
- Fixes for the autolinker.
|
- Fixes for the autolinker.
|
||||||
- Forwarded reports duplication from Pleroma instances.
|
- Forwarded reports duplication from Pleroma instances.
|
||||||
|
- Emoji Reaction activity filtering from blocked and muted accounts.
|
||||||
|
|
||||||
- <details>
|
- <details>
|
||||||
<summary>API</summary>
|
<summary>API</summary>
|
||||||
|
|
|
@ -10,22 +10,15 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
|
||||||
@moduledoc "Detect new emojis by their shortcode and steals them"
|
@moduledoc "Detect new emojis by their shortcode and steals them"
|
||||||
@behaviour Pleroma.Web.ActivityPub.MRF
|
@behaviour Pleroma.Web.ActivityPub.MRF
|
||||||
|
|
||||||
defp remote_host?(host), do: host != Config.get([Pleroma.Web.Endpoint, :url, :host])
|
|
||||||
|
|
||||||
defp accept_host?(host), do: host in Config.get([:mrf_steal_emoji, :hosts], [])
|
defp accept_host?(host), do: host in Config.get([:mrf_steal_emoji, :hosts], [])
|
||||||
|
|
||||||
defp steal_emoji({shortcode, url}) do
|
defp steal_emoji({shortcode, url}, emoji_dir_path) do
|
||||||
url = Pleroma.Web.MediaProxy.url(url)
|
url = Pleroma.Web.MediaProxy.url(url)
|
||||||
{:ok, response} = Pleroma.HTTP.get(url)
|
|
||||||
|
with {:ok, %{status: status} = response} when status in 200..299 <- Pleroma.HTTP.get(url) do
|
||||||
size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000)
|
size_limit = Config.get([:mrf_steal_emoji, :size_limit], 50_000)
|
||||||
|
|
||||||
if byte_size(response.body) <= size_limit do
|
if byte_size(response.body) <= size_limit do
|
||||||
emoji_dir_path =
|
|
||||||
Config.get(
|
|
||||||
[:mrf_steal_emoji, :path],
|
|
||||||
Path.join(Config.get([:instance, :static_dir]), "emoji/stolen")
|
|
||||||
)
|
|
||||||
|
|
||||||
extension =
|
extension =
|
||||||
url
|
url
|
||||||
|> URI.parse()
|
|> URI.parse()
|
||||||
|
@ -33,13 +26,12 @@ defp steal_emoji({shortcode, url}) do
|
||||||
|> Path.basename()
|
|> Path.basename()
|
||||||
|> Path.extname()
|
|> Path.extname()
|
||||||
|
|
||||||
file_path = Path.join([emoji_dir_path, shortcode <> (extension || ".png")])
|
file_path = Path.join(emoji_dir_path, shortcode <> (extension || ".png"))
|
||||||
|
|
||||||
try do
|
|
||||||
:ok = File.write(file_path, response.body)
|
|
||||||
|
|
||||||
|
case File.write(file_path, response.body) do
|
||||||
|
:ok ->
|
||||||
shortcode
|
shortcode
|
||||||
rescue
|
|
||||||
e ->
|
e ->
|
||||||
Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}")
|
Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}")
|
||||||
nil
|
nil
|
||||||
|
@ -53,30 +45,40 @@ defp steal_emoji({shortcode, url}) do
|
||||||
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
rescue
|
else
|
||||||
e ->
|
e ->
|
||||||
Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}")
|
Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}")
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = message) do
|
def filter(%{"object" => %{"emoji" => foreign_emojis, "actor" => actor}} = message) do
|
||||||
host = URI.parse(actor).host
|
host = URI.parse(actor).host
|
||||||
|
|
||||||
if remote_host?(host) and accept_host?(host) do
|
if host != Pleroma.Web.Endpoint.host() and accept_host?(host) do
|
||||||
installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end)
|
installed_emoji = Pleroma.Emoji.get_all() |> Enum.map(fn {k, _} -> k end)
|
||||||
|
|
||||||
|
emoji_dir_path =
|
||||||
|
Config.get(
|
||||||
|
[:mrf_steal_emoji, :path],
|
||||||
|
Path.join(Config.get([:instance, :static_dir]), "emoji/stolen")
|
||||||
|
)
|
||||||
|
|
||||||
|
File.mkdir_p(emoji_dir_path)
|
||||||
|
|
||||||
new_emojis =
|
new_emojis =
|
||||||
foreign_emojis
|
foreign_emojis
|
||||||
|> Enum.filter(fn {shortcode, _url} -> shortcode not in installed_emoji end)
|
|> Enum.reject(fn {shortcode, _url} -> shortcode in installed_emoji end)
|
||||||
|> Enum.filter(fn {shortcode, _url} ->
|
|> Enum.filter(fn {shortcode, _url} ->
|
||||||
reject_emoji? =
|
reject_emoji? =
|
||||||
Config.get([:mrf_steal_emoji, :rejected_shortcodes], [])
|
[:mrf_steal_emoji, :rejected_shortcodes]
|
||||||
|
|> Config.get([])
|
||||||
|> Enum.find(false, fn regex -> String.match?(shortcode, regex) end)
|
|> Enum.find(false, fn regex -> String.match?(shortcode, regex) end)
|
||||||
|
|
||||||
!reject_emoji?
|
!reject_emoji?
|
||||||
end)
|
end)
|
||||||
|> Enum.map(&steal_emoji(&1))
|
|> Enum.map(&steal_emoji(&1, emoji_dir_path))
|
||||||
|> Enum.filter(& &1)
|
|> Enum.filter(& &1)
|
||||||
|
|
||||||
if !Enum.empty?(new_emojis) do
|
if !Enum.empty?(new_emojis) do
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :pleroma,
|
app: :pleroma,
|
||||||
version: version("2.2.1"),
|
version: version("2.2.2"),
|
||||||
elixir: "~> 1.9",
|
elixir: "~> 1.9",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||||
|
|
2
mix.lock
2
mix.lock
|
@ -33,7 +33,7 @@
|
||||||
"ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"},
|
"ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"},
|
||||||
"ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"},
|
"ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"},
|
||||||
"eimp": {:hex, :eimp, "1.0.14", "fc297f0c7e2700457a95a60c7010a5f1dcb768a083b6d53f49cd94ab95a28f22", [:rebar3], [{:p1_utils, "1.0.18", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "501133f3112079b92d9e22da8b88bf4f0e13d4d67ae9c15c42c30bd25ceb83b6"},
|
"eimp": {:hex, :eimp, "1.0.14", "fc297f0c7e2700457a95a60c7010a5f1dcb768a083b6d53f49cd94ab95a28f22", [:rebar3], [{:p1_utils, "1.0.18", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "501133f3112079b92d9e22da8b88bf4f0e13d4d67ae9c15c42c30bd25ceb83b6"},
|
||||||
"elixir_make": {:hex, :elixir_make, "0.6.1", "8faa29a5597faba999aeeb72bbb9c91694ef8068f0131192fb199f98d32994ef", [:mix], [], "hexpm", "35d33270680f8d839a4003c3e9f43afb595310a592405a00afc12de4c7f55a18"},
|
"elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
|
||||||
"esshd": {:hex, :esshd, "0.1.1", "d4dd4c46698093a40a56afecce8a46e246eb35463c457c246dacba2e056f31b5", [:mix], [], "hexpm", "d73e341e3009d390aa36387dc8862860bf9f874c94d9fd92ade2926376f49981"},
|
"esshd": {:hex, :esshd, "0.1.1", "d4dd4c46698093a40a56afecce8a46e246eb35463c457c246dacba2e056f31b5", [:mix], [], "hexpm", "d73e341e3009d390aa36387dc8862860bf9f874c94d9fd92ade2926376f49981"},
|
||||||
"eternal": {:hex, :eternal, "1.2.1", "d5b6b2499ba876c57be2581b5b999ee9bdf861c647401066d3eeed111d096bc4", [:mix], [], "hexpm", "b14f1dc204321429479c569cfbe8fb287541184ed040956c8862cb7a677b8406"},
|
"eternal": {:hex, :eternal, "1.2.1", "d5b6b2499ba876c57be2581b5b999ee9bdf861c647401066d3eeed111d096bc4", [:mix], [], "hexpm", "b14f1dc204321429479c569cfbe8fb287541184ed040956c8862cb7a677b8406"},
|
||||||
"ex2ms": {:hex, :ex2ms, "1.5.0", "19e27f9212be9a96093fed8cdfbef0a2b56c21237196d26760f11dfcfae58e97", [:mix], [], "hexpm"},
|
"ex2ms": {:hex, :ex2ms, "1.5.0", "19e27f9212be9a96093fed8cdfbef0a2b56c21237196d26760f11dfcfae58e97", [:mix], [], "hexpm"},
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no"><!--server-generated-meta--><link rel=icon type=image/png href=/favicon.png><link href=/static/css/app.9a4c5ede37b2f0230836.css rel=stylesheet></head><body class=hidden><noscript>To use Pleroma, please enable JavaScript.</noscript><div id=app></div><script type=text/javascript src=/static/js/vendors~app.4103f03e428eb765f04d.js></script><script type=text/javascript src=/static/js/app.c4f570328dc17a633803.js></script></body></html>
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1,user-scalable=no"><!--server-generated-meta--><link rel=icon type=image/png href=/favicon.png><link href=/static/css/app.9a4c5ede37b2f0230836.css rel=stylesheet></head><body class=hidden><noscript>To use Pleroma, please enable JavaScript.</noscript><div id=app></div><script type=text/javascript src=/static/js/vendors~app.54838a79dee084ec3dad.js></script><script type=text/javascript src=/static/js/app.8f473d84b69949770654.js></script></body></html>
|
Binary file not shown.
BIN
priv/static/static/js/10.a11a612e4c1ef51ded17.js
Normal file
BIN
priv/static/static/js/10.a11a612e4c1ef51ded17.js
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map
Normal file
BIN
priv/static/static/js/14.e560f5e2f902b9ad2d0d.js.map
Normal file
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map
Normal file
BIN
priv/static/static/js/15.2893c12f1ca2bcdc3cbf.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/16.be7f4b788716bec25023.js.map
Normal file
BIN
priv/static/static/js/16.be7f4b788716bec25023.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/17.4ddba89b4f8c284f6392.js.map
Normal file
BIN
priv/static/static/js/17.4ddba89b4f8c284f6392.js.map
Normal file
Binary file not shown.
BIN
priv/static/static/js/18.990b88b57bf3a6809098.js
Normal file
BIN
priv/static/static/js/18.990b88b57bf3a6809098.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/18.990b88b57bf3a6809098.js.map
Normal file
BIN
priv/static/static/js/18.990b88b57bf3a6809098.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/19.783715f17e3f98e8898e.js.map
Normal file
BIN
priv/static/static/js/19.783715f17e3f98e8898e.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/2.a91966242b7de2b214d4.js
Normal file
BIN
priv/static/static/js/2.a91966242b7de2b214d4.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/2.a91966242b7de2b214d4.js.map
Normal file
BIN
priv/static/static/js/2.a91966242b7de2b214d4.js.map
Normal file
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/20.96c40f6c9db8c08633bd.js.map
Normal file
BIN
priv/static/static/js/20.96c40f6c9db8c08633bd.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map
Normal file
BIN
priv/static/static/js/21.5a9f8e39a7833c1aa117.js.map
Normal file
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/22.d65671b9e5e00a0eb625.js.map
Normal file
BIN
priv/static/static/js/22.d65671b9e5e00a0eb625.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/23.bf697d60801d277815e0.js.map
Normal file
BIN
priv/static/static/js/23.bf697d60801d277815e0.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/24.914e51bfcfc620a93c0e.js.map
Normal file
BIN
priv/static/static/js/24.914e51bfcfc620a93c0e.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/25.fa8acda1a0ba7de2ab58.js
Normal file
BIN
priv/static/static/js/25.fa8acda1a0ba7de2ab58.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map
Normal file
BIN
priv/static/static/js/25.fa8acda1a0ba7de2ab58.js.map
Normal file
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/26.5233739c17e00ab514f7.js.map
Normal file
BIN
priv/static/static/js/26.5233739c17e00ab514f7.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/27.79a2337abb067d8a36ce.js.map
Normal file
BIN
priv/static/static/js/27.79a2337abb067d8a36ce.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/28.ed355decbad274c26485.js
Normal file
BIN
priv/static/static/js/28.ed355decbad274c26485.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/28.ed355decbad274c26485.js.map
Normal file
BIN
priv/static/static/js/28.ed355decbad274c26485.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/29.d3d8f3c066d579644c9a.js.map
Normal file
BIN
priv/static/static/js/29.d3d8f3c066d579644c9a.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/30.04694ca04ca2fb3b9695.js
Normal file
BIN
priv/static/static/js/30.04694ca04ca2fb3b9695.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/30.04694ca04ca2fb3b9695.js.map
Normal file
BIN
priv/static/static/js/30.04694ca04ca2fb3b9695.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js
Normal file
BIN
priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map
Normal file
BIN
priv/static/static/js/31.ef44f6a2b08f7f78dd8e.js.map
Normal file
Binary file not shown.
BIN
priv/static/static/js/32.044555dd7095261d9faf.js
Normal file
BIN
priv/static/static/js/32.044555dd7095261d9faf.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/32.044555dd7095261d9faf.js.map
Normal file
BIN
priv/static/static/js/32.044555dd7095261d9faf.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/9.7d9dd95c4a1c9aa47453.js
Normal file
BIN
priv/static/static/js/9.7d9dd95c4a1c9aa47453.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map
Normal file
BIN
priv/static/static/js/9.7d9dd95c4a1c9aa47453.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
priv/static/static/js/app.8f473d84b69949770654.js
Normal file
BIN
priv/static/static/js/app.8f473d84b69949770654.js
Normal file
Binary file not shown.
BIN
priv/static/static/js/app.8f473d84b69949770654.js.map
Normal file
BIN
priv/static/static/js/app.8f473d84b69949770654.js.map
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue