From 9f908b37a510e099bb50a4ee6cfd3fd703084ae0 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sat, 2 Jul 2022 13:59:00 +0100 Subject: [PATCH 1/3] Update eblurhash to a non-bugged version Draws from https://codeberg.org/newroma-dev/newroma/pulls/42/ --- .woodpecker/.release.yml | 4 ++-- mix.exs | 2 +- mix.lock | 2 +- test/pleroma/upload/filter/analyze_metadata_test.exs | 2 +- .../web/admin_api/controllers/config_controller_test.exs | 8 ++------ test/pleroma/web/preload/providers/instance_test.exs | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.woodpecker/.release.yml b/.woodpecker/.release.yml index 28043aa65..899027e2d 100644 --- a/.woodpecker/.release.yml +++ b/.woodpecker/.release.yml @@ -27,7 +27,7 @@ pipeline: environment: MIX_ENV: prod commands: - - apt-get update && apt-get install -y cmake libmagic-dev rclone zip + - apt-get update && apt-get install -y cmake libmagic-dev rclone zip imagemagick libmagic-dev - wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64 - mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli - chmod +x scaleway-cli @@ -58,7 +58,7 @@ pipeline: environment: MIX_ENV: prod commands: - - apk add git gcc g++ musl-dev make cmake file-dev rclone wget zip + - apk add git gcc g++ musl-dev make cmake file-dev rclone wget zip imagemagick - rm -rf release || true - rm -rf _build || true - rm -rf /root/.mix diff --git a/mix.exs b/mix.exs index 558e71262..6b4b4289c 100644 --- a/mix.exs +++ b/mix.exs @@ -194,7 +194,7 @@ defp deps do ref: "e0f16822d578866e186a0974d65ad58cddc1e2ab"}, {:restarter, path: "./restarter"}, {:majic, "~> 1.0"}, - {:eblurhash, "~> 1.1.0"}, + {:eblurhash, "~> 1.2.2"}, {:open_api_spex, "~> 3.10"}, {:elastix, ">= 0.0.0"}, {:search_parser, diff --git a/mix.lock b/mix.lock index 422bbea5e..6c2a88ef4 100644 --- a/mix.lock +++ b/mix.lock @@ -29,7 +29,7 @@ "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "earmark": {:hex, :earmark, "1.4.18", "618c4ff1563450d1832b7fb41dc6755e470f91a6fd4c70f350a58b14f64a7db8", [:mix], [{:earmark_parser, ">= 1.4.17", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "57ac3b6da3958ed09c669a9b159e86377fcccda56bacde8a209fa4dcdef52560"}, "earmark_parser": {:hex, :earmark_parser, "1.4.17", "6f3c7e94170377ba45241d394389e800fb15adc5de51d0a3cd52ae766aafd63f", [:mix], [], "hexpm", "f93ac89c9feca61c165b264b5837bf82344d13bebc634cd575cb711e2e342023"}, - "eblurhash": {:hex, :eblurhash, "1.1.0", "e10ccae762598507ebfacf0b645ed49520f2afa3e7e9943e73a91117dffce415", [:rebar3], [], "hexpm", "2e6b889d09fddd374e3c5ac57c486138768763264e99ac1074ae5fa7fc9ab51d"}, + "eblurhash": {:hex, :eblurhash, "1.2.2", "7da4255aaea984b31bb71155f673257353b0e0554d0d30dcf859547e74602582", [:rebar3], [], "hexpm", "8c20ca00904de023a835a9dcb7b7762fed32264c85a80c3cafa85288e405044c"}, "ecto": {:hex, :ecto, "3.6.2", "efdf52acfc4ce29249bab5417415bd50abd62db7b0603b8bab0d7b996548c2bc", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "efad6dfb04e6f986b8a3047822b0f826d9affe8e4ebdd2aeedbfcb14fd48884e"}, "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_psql_extras": {:hex, :ecto_psql_extras, "0.7.4", "5d43fd088d39a158c860b17e8d210669587f63ec89ea122a4654861c8c6e2db4", [:mix], [{:ecto_sql, "~> 3.4", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:postgrex, ">= 0.15.7", [hex: :postgrex, repo: "hexpm", optional: false]}, {:table_rex, "~> 3.1.1", [hex: :table_rex, repo: "hexpm", optional: false]}], "hexpm", "311db02f1b772e3d0dc7f56a05044b5e1499d78ed6abf38885e1ca70059449e5"}, diff --git a/test/pleroma/upload/filter/analyze_metadata_test.exs b/test/pleroma/upload/filter/analyze_metadata_test.exs index 4b636a684..b12a96b12 100644 --- a/test/pleroma/upload/filter/analyze_metadata_test.exs +++ b/test/pleroma/upload/filter/analyze_metadata_test.exs @@ -16,7 +16,7 @@ test "adds the dimensions and blurhash for images" do {:ok, :filtered, meta} = AnalyzeMetadata.filter(upload) - assert %{width: 1024, height: 768} = meta + assert %{width: 1024, height: 768, blurhash: "V6Dv1P?^IS.6InIEIqV^xtWE$$M|D,RnM}%1RitPR%X3"} = meta assert meta.blurhash end diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs index 7c786c389..9c9e8513c 100644 --- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs @@ -1501,15 +1501,14 @@ test "filters by database configuration whitelist", %{conn: conn} do clear_config(:database_config_whitelist, [ {:pleroma, :instance}, {:pleroma, :activitypub}, - {:pleroma, Pleroma.Upload}, - {:esshd} + {:pleroma, Pleroma.Upload} ]) conn = get(conn, "/api/pleroma/admin/config/descriptions") children = json_response_and_validate_schema(conn, 200) - assert length(children) == 4 + assert length(children) == 3 assert Enum.count(children, fn c -> c["group"] == ":pleroma" end) == 3 @@ -1521,9 +1520,6 @@ test "filters by database configuration whitelist", %{conn: conn} do web_endpoint = Enum.find(children, fn c -> c["key"] == "Pleroma.Upload" end) assert web_endpoint["children"] - - esshd = Enum.find(children, fn c -> c["group"] == ":esshd" end) - assert esshd["children"] end end end diff --git a/test/pleroma/web/preload/providers/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs index a401475ee..8afa6ec5a 100644 --- a/test/pleroma/web/preload/providers/instance_test.exs +++ b/test/pleroma/web/preload/providers/instance_test.exs @@ -15,7 +15,7 @@ test "it renders the info", %{"/api/v1/instance" => info} do registrations: true } = info - assert String.equivalent?(description, "Pleroma: An efficient and flexible fediverse server") + assert String.equivalent?(description, "Akkoma: The cooler fediverse server") end test "it renders the panel", %{"/instance/panel.html" => panel} do -- 2.43.0 From a0da52f0137b2c07ebf69640b0d8aade7e4ed7e0 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sat, 2 Jul 2022 14:00:28 +0100 Subject: [PATCH 2/3] Mix format --- test/pleroma/upload/filter/analyze_metadata_test.exs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/pleroma/upload/filter/analyze_metadata_test.exs b/test/pleroma/upload/filter/analyze_metadata_test.exs index b12a96b12..ad7404e3d 100644 --- a/test/pleroma/upload/filter/analyze_metadata_test.exs +++ b/test/pleroma/upload/filter/analyze_metadata_test.exs @@ -16,7 +16,9 @@ test "adds the dimensions and blurhash for images" do {:ok, :filtered, meta} = AnalyzeMetadata.filter(upload) - assert %{width: 1024, height: 768, blurhash: "V6Dv1P?^IS.6InIEIqV^xtWE$$M|D,RnM}%1RitPR%X3"} = meta + assert %{width: 1024, height: 768, blurhash: "V6Dv1P?^IS.6InIEIqV^xtWE$$M|D,RnM}%1RitPR%X3"} = + meta + assert meta.blurhash end -- 2.43.0 From fa2fe392109d8a6dac78e1ec599d2053bb242f71 Mon Sep 17 00:00:00 2001 From: FloatingGhost Date: Sat, 2 Jul 2022 14:33:05 +0100 Subject: [PATCH 3/3] Assert on base83 --- test/pleroma/upload/filter/analyze_metadata_test.exs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/pleroma/upload/filter/analyze_metadata_test.exs b/test/pleroma/upload/filter/analyze_metadata_test.exs index ad7404e3d..10f9828c4 100644 --- a/test/pleroma/upload/filter/analyze_metadata_test.exs +++ b/test/pleroma/upload/filter/analyze_metadata_test.exs @@ -16,10 +16,10 @@ test "adds the dimensions and blurhash for images" do {:ok, :filtered, meta} = AnalyzeMetadata.filter(upload) - assert %{width: 1024, height: 768, blurhash: "V6Dv1P?^IS.6InIEIqV^xtWE$$M|D,RnM}%1RitPR%X3"} = - meta - + assert %{width: 1024, height: 768} = meta assert meta.blurhash + # Blurhashes should be a valid base83 string + assert meta.blurhash =~ ~r/^[A-Za-z0-9#$%*\+,-\.:;=\?@\[\]\^_{|}~]{6,}$/ end test "adds the dimensions for videos" do -- 2.43.0