fixed a newline bug

This commit is contained in:
CatAClock 2025-05-05 16:54:10 -07:00
parent 2a896c4fe2
commit 0f22ce5c30
2 changed files with 5 additions and 3 deletions

View file

@ -24,7 +24,7 @@ export async function CreatePost(DID, Text) {
if (body.message.includes("claim timestamp check failed")) { if (body.message.includes("claim timestamp check failed")) {
await RefreshTokens(); await RefreshTokens();
} }
body = await CreatePost(PDS, DID, Text); body = await CreatePost(DID, Text);
} }
return body; return body;
} }
@ -55,7 +55,7 @@ export async function SetThreadGate(DID, Post, VisibilitySettings) {
if (body.message.includes("claim timestamp check failed")) { if (body.message.includes("claim timestamp check failed")) {
await RefreshTokens(); await RefreshTokens();
} }
body = await SetThreadGate(PDS, DID, Post, RKey, VisibilitySettings); body = await SetThreadGate(DID, Post, VisibilitySettings);
} }
return body; return body;
} }
@ -226,7 +226,7 @@ export async function GainTokens() {
localStorage.setItem(Variables.BlueskyRefreshToken, Auth.refresh_token); localStorage.setItem(Variables.BlueskyRefreshToken, Auth.refresh_token);
// That long string just gets the payload // That long string just gets the payload
// aud = PDS server we are communicating with; sub = user DID // 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); localStorage.setItem(Variables.BlueskyDID, KJUR.jws.JWS.readSafeJSONString(b64utoutf8(localStorage.getItem(Variables.BlueskyAccessToken).split(".")[1])).sub);
} }
} }

View file

@ -65,6 +65,8 @@ export async function GetNotifications() {
// Make a status // Make a status
export async function CreateStatus(Text, Visibility = "public") { export async function CreateStatus(Text, Visibility = "public") {
// Stolen from StackOverflow
Text = Text.replace(/(?:\r|\n|\r\n)/g, '<br>');
// Check for a token // Check for a token
if (localStorage.getItem(Variables.MastodonAccessToken) != null) { if (localStorage.getItem(Variables.MastodonAccessToken) != null) {
let Website = localStorage.getItem(Variables.MastodonWebsite); let Website = localStorage.getItem(Variables.MastodonWebsite);