Here's the rundown: The public timeline no longer exists. However: your private timelines now exist and can be scrolled back and forth. This is an addition to content warnings, boosts, and plenty of bug fixes. A code cleanup has been put into place as well to cut down on some of the crap. Overall it's pretty good. Reviewed-on: #14
71 lines
1.9 KiB
JavaScript
71 lines
1.9 KiB
JavaScript
import * as MastodonAPI from "./MastodonAPI.js";
|
|
import * as BlueskyAPI from "./BlueskyAPI.js";
|
|
import * as TumblrAPI from "./TumblrAPI.js";
|
|
import * as Variables from "./Variables.js";
|
|
|
|
// Elements.
|
|
let PostButton = document.getElementsByClassName("Button")[0];
|
|
let VisibilityDropdown = document.getElementsByClassName("PostVisibility")[0];
|
|
let InputArea = document.getElementsByClassName("Text")[0];
|
|
|
|
// Extra Variables
|
|
|
|
|
|
// Clicking the beeg POST button.
|
|
PostButton.onclick = (event) => {
|
|
Post();
|
|
}
|
|
|
|
async function Post() {
|
|
let Text = InputArea.value;
|
|
let Visible = VisibilityDropdown.value;
|
|
// don't do anything if there is no value
|
|
if (Text == "") {
|
|
return;
|
|
}
|
|
// Mastodon posting.
|
|
if (localStorage.getItem(Variables.MastodonAccessToken) != null) {
|
|
let TempVisible;
|
|
switch(Visible) {
|
|
case "Public":
|
|
TempVisible = "public";
|
|
break;
|
|
case "Quiet":
|
|
TempVisible = "unlisted";
|
|
break;
|
|
case "Friend":
|
|
TempVisible = "private";
|
|
break;
|
|
case "Private":
|
|
TempVisible = "direct";
|
|
break;
|
|
}
|
|
MastodonAPI.CreateStatus(Text, TempVisible);
|
|
}
|
|
// Bluesky posting.
|
|
if (localStorage.getItem(Variables.BlueskyAccessToken) != null) {
|
|
let TempVisible;
|
|
switch(Visible) {
|
|
case "Public":
|
|
TempVisible = undefined;
|
|
break;
|
|
case "Quiet":
|
|
TempVisible = undefined;
|
|
break;
|
|
case "Friend":
|
|
TempVisible = [{"$type": "app.bsky.feed.threadgate#followingRule"}, {"$type": "app.bsky.feed.threadgate#followerRule"}];
|
|
break;
|
|
case "Private":
|
|
TempVisible = [];
|
|
break;
|
|
}
|
|
let Post = await BlueskyAPI.CreatePost(localStorage.getItem(Variables.BlueskyDID), Text);
|
|
let ThreadGate = await BlueskyAPI.SetThreadGate(localStorage.getItem(Variables.BlueskyDID), Post.uri, TempVisible);
|
|
}
|
|
InputArea.value = "";
|
|
}
|
|
|
|
// Check if you can interact with the textbox
|
|
if (localStorage.getItem(Variables.MastodonAccessToken) == null && localStorage.getItem(Variables.BlueskyAccessToken) == null) {
|
|
InputArea.disabled = true;
|
|
}
|