From 0f22ce5c305ed4824d10edcabd61b5ef2d9ee8ed Mon Sep 17 00:00:00 2001 From: CatAClock Date: Mon, 5 May 2025 16:54:10 -0700 Subject: [PATCH] fixed a newline bug --- JS/BlueskyAPI.js | 6 +++--- JS/MastodonAPI.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/JS/BlueskyAPI.js b/JS/BlueskyAPI.js index 4e659c7..c5ce038 100644 --- a/JS/BlueskyAPI.js +++ b/JS/BlueskyAPI.js @@ -24,7 +24,7 @@ export async function CreatePost(DID, Text) { if (body.message.includes("claim timestamp check failed")) { await RefreshTokens(); } - body = await CreatePost(PDS, DID, Text); + body = await CreatePost(DID, Text); } return body; } @@ -55,7 +55,7 @@ export async function SetThreadGate(DID, Post, VisibilitySettings) { if (body.message.includes("claim timestamp check failed")) { await RefreshTokens(); } - body = await SetThreadGate(PDS, DID, Post, RKey, VisibilitySettings); + body = await SetThreadGate(DID, Post, VisibilitySettings); } return body; } @@ -226,7 +226,7 @@ export async function GainTokens() { localStorage.setItem(Variables.BlueskyRefreshToken, Auth.refresh_token); // That long string just gets the payload // aud = PDS server we are communicating with; sub = user DID - localStorage.setItem(Variables.BlueskyPDS, KJUR.jws.JWS.readSafeJSONString(b64utoutf8(localStorage.getItem(Variables.BlueskyAccessToken).split(".")[1])).aud); + localStorage.setItem(Variables.BlueskyPDS, "https://" + KJUR.jws.JWS.readSafeJSONString(b64utoutf8(localStorage.getItem(Variables.BlueskyAccessToken).split(".")[1])).aud.split(":")[2]); localStorage.setItem(Variables.BlueskyDID, KJUR.jws.JWS.readSafeJSONString(b64utoutf8(localStorage.getItem(Variables.BlueskyAccessToken).split(".")[1])).sub); } } diff --git a/JS/MastodonAPI.js b/JS/MastodonAPI.js index 554ef6c..d5701fa 100644 --- a/JS/MastodonAPI.js +++ b/JS/MastodonAPI.js @@ -65,6 +65,8 @@ export async function GetNotifications() { // Make a status export async function CreateStatus(Text, Visibility = "public") { + // Stolen from StackOverflow + Text = Text.replace(/(?:\r|\n|\r\n)/g, '
'); // Check for a token if (localStorage.getItem(Variables.MastodonAccessToken) != null) { let Website = localStorage.getItem(Variables.MastodonWebsite);