From 2c106e4dbb580cfda9c1ebc7bcfca9a3e882e177 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Tue, 27 Feb 2024 18:03:05 +0000 Subject: [PATCH] Revert "Removed useless UTF-8 decleration" This reverts commit 0c0f265667e6a899989e40f706744b467e7472ae. --- APIDOCS.md | 2 +- static/js/login.js | 10 +++++++-- static/js/main.js | 55 ++++++++++++++++++++++++++++++++++++--------- static/js/signup.js | 5 ++++- 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/APIDOCS.md b/APIDOCS.md index 205c6c2..c49dfbc 100644 --- a/APIDOCS.md +++ b/APIDOCS.md @@ -1,7 +1,7 @@ # Burgernotes API docs Use the Burgernotes API to automate tasks, build your own client, and more! -Content-type should be "application/json" for all POSTs +Headers should be: "Content-type: application/json; charset=UTF-8" for all POSTs ## Authentication diff --git a/static/js/login.js b/static/js/login.js index 57daff2..e20da4c 100644 --- a/static/js/login.js +++ b/static/js/login.js @@ -116,7 +116,10 @@ signupButton.addEventListener("click", (event) => { password: await hashpass(password), passwordchange: "no", newpass: "null" - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -137,7 +140,10 @@ signupButton.addEventListener("click", (event) => { password: await hashpassold(password), passwordchange: "yes", newpass: await hashpass(password) - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { diff --git a/static/js/main.js b/static/js/main.js index 2c5de4b..11d5b18 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -201,7 +201,10 @@ function updateUserInfo() { method: "POST", body: JSON.stringify({ secretKey: secretkey - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -245,7 +248,10 @@ deleteMyAccountButton.addEventListener("click", (event) => { method: "POST", body: JSON.stringify({ secretKey: secretkey - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -265,7 +271,10 @@ sessionManagerButton.addEventListener("click", (event) => { method: "POST", body: JSON.stringify({ secretKey: secretkey - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -303,7 +312,10 @@ sessionManagerButton.addEventListener("click", (event) => { body: JSON.stringify({ secretKey: secretkey, sessionId: responseData[i]["id"] - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -351,7 +363,10 @@ function selectNote(nameithink) { body: JSON.stringify({ secretKey: secretkey, noteId: nameithink, - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .catch((error) => { noteBox.readOnly = true @@ -387,7 +402,10 @@ function selectNote(nameithink) { secretKey: secretkey, noteId: nameithink, content: encryptedText, - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -411,7 +429,10 @@ function updateNotes() { method: "POST", body: JSON.stringify({ secretKey: secretkey - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -443,7 +464,10 @@ function updateNotes() { body: JSON.stringify({ secretKey: secretkey, noteId: responseData[i]["id"] - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -480,7 +504,10 @@ newNote.addEventListener("click", (event) => { body: JSON.stringify({ secretKey: secretkey, noteName: encryptedName, - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .catch((error) => { displayError("Failed to create new note, please try again later...") @@ -512,7 +539,10 @@ function exportNotes() { method: "POST", body: JSON.stringify({ secretKey: secretkey - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { @@ -569,7 +599,10 @@ removeBox.addEventListener("click", (event) => { body: JSON.stringify({ secretKey: secretkey, noteId: selectedNote - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => { diff --git a/static/js/signup.js b/static/js/signup.js index 45b424a..9452651 100644 --- a/static/js/signup.js +++ b/static/js/signup.js @@ -66,7 +66,10 @@ signupButton.addEventListener("click", (event) => { body: JSON.stringify({ username: username, password: await hashpass(password) - }) + }), + headers: { + "Content-Type": "application/json; charset=UTF-8" + } }) .then((response) => response) .then((response) => {