From a4a9163efc3be06faae38ee9cf2c8943acc832a4 Mon Sep 17 00:00:00 2001 From: theo1 Date: Thu, 1 Oct 2020 19:53:50 +0200 Subject: [PATCH] fixed utf-8 decoding of toot content --- app.py | 2 ++ deezer-tooter/browserAction/script.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 24c563e..fbc9d55 100644 --- a/app.py +++ b/app.py @@ -18,5 +18,7 @@ def toot(): toot_content = request.data if(toot_content == None): return "No content, aborting" + toot_content = toot_content.decode("utf-8") + print(toot_content) print(mastodon.status_post(toot_content, spoiler_text="Musique")) return "Tooted !" \ No newline at end of file diff --git a/deezer-tooter/browserAction/script.js b/deezer-tooter/browserAction/script.js index 7fef49c..aecb798 100644 --- a/deezer-tooter/browserAction/script.js +++ b/deezer-tooter/browserAction/script.js @@ -7,7 +7,7 @@ function tootInfo(message) { url = "http://localhost:5000/toot" fetch(url, { method: 'POST', - body: JSON.stringify(tootContent), + body: tootContent }) .then(function (response) { return response.json(); @@ -18,8 +18,8 @@ function tootInfo(message) { } function handleResponse(message) { - document.getElementById("toot-info").innerHTML = message.artist + " - " + message.title - document.getElementById("toot-hashtags").value = "#radio #np #musique #music" + document.getElementById("toot-info").innerHTML = message.artist + " - " + message.title + '\n\n' + document.getElementById("toot-hashtags").value = "#radio #np #musique #music" + '\n' } function handleError(error) {