Fedi.CrowdedGames.Group/JS/post.js
CatAClock 89e2c54d3e Bug fixes (#10)
Another somewhat overhaul & fixing a couple of stupid bugs that just so happen to crop up.

Reviewed-on: #10
2025-05-03 22:22:40 +00:00

27 lines
867 B
JavaScript

import * as MastodonAPI from "./MastodonAPI.js";
import * as BlueskyAPI from "./BlueskyAPI.js";
import * as TumblrAPI from "./TumblrAPI.js";
import * as Cookie from "./Cookies.js";
// Elements.
let PostButton = document.getElementsByClassName("button")[0];
let InputArea = document.getElementsByClassName("text")[0];
// Clicking the beeg POST button.
PostButton.onclick = (event) => {
Post();
}
async function Post() {
let Text = InputArea.value;
// Mastodon posting.
if (Cookie.IsCookieReal(Cookie.MastodonAccessToken)) {
MastodonAPI.CreateStatus(Text);
}
// Bluesky posting.
if (Cookie.IsCookieReal(Cookie.BlueskyAccessToken)) {
let DID = await BlueskyAPI.GetBlueskyDID("https://woodear.us-west.host.bsky.network", "crowdedgames.group");
BlueskyAPI.CreatePost("https://woodear.us-west.host.bsky.network", DID.did, Text);
}
InputArea.value = "";
}