logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/
commit: ae2c97fad8121a26146643c7e4a361d8f4d289a7
parent 93ce56418e89eb097e87b49d47df4454db19e90c
Author: nicole mikołajczyk <git@mkljczk.pl>
Date:   Wed,  4 Jun 2025 21:32:30 +0200

Use JSON for DeepL API requests

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>

Diffstat:

Achangelog.d/deepl-json.fix1+
Mlib/pleroma/language/translation/deepl.ex18++++++++----------
2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/changelog.d/deepl-json.fix b/changelog.d/deepl-json.fix @@ -0,0 +1 @@ +Use JSON for DeepL API requests diff --git a/lib/pleroma/language/translation/deepl.ex b/lib/pleroma/language/translation/deepl.ex @@ -24,17 +24,15 @@ defmodule Pleroma.Language.Translation.Deepl do |> URI.to_string() case Pleroma.HTTP.post( - endpoint <> - "?" <> - URI.encode_query(%{ - text: content, - source_lang: source_language |> String.upcase(), - target_lang: target_language, - tag_handling: "html" - }), - "", + endpoint, + Jason.encode!(%{ + text: [content], + source_lang: source_language |> String.upcase(), + target_lang: target_language, + tag_handling: "html" + }), [ - {"Content-Type", "application/x-www-form-urlencoded"}, + {"Content-Type", "application/json"}, {"Authorization", "DeepL-Auth-Key #{api_key()}"} ] ) do