Bug fix and new bullshit! yay!

This commit is contained in:
CatAClock 2025-06-01 14:57:01 -07:00
parent 75b7b1d2f8
commit da0bfc22a3
5 changed files with 91 additions and 1 deletions

View file

@ -247,6 +247,11 @@ html {
.Time { .Time {
font-size: 4ch; font-size: 4ch;
text-decoration: none;
}
.Time:hover {
text-decoration: underline;
} }
.MainFooter, .MainBlackedFooter { .MainFooter, .MainBlackedFooter {
@ -260,6 +265,8 @@ html {
border-width: 2px; border-width: 2px;
border-color: #00FFFF; border-color: #00FFFF;
padding: auto;
height: 20vh; height: 20vh;
} }

View file

@ -17,12 +17,16 @@
</header> </header>
<div> <div>
<h2 class="Account"></h2> <h2 class="Account"></h2>
<img class="AccountImage" /> <img class="AccountImage" width="20%" height="20%"/>
<p class="AccountDescription"></p> <p class="AccountDescription"></p>
<div style="display: flex; justify-content: center;"> <div style="display: flex; justify-content: center;">
<p class="Button Follow">Follow!</p> <p class="Button Follow">Follow!</p>
<p class="Button Block">Block!</p> <p class="Button Block">Block!</p>
</div> </div>
<h2 class="Account"></h2>
<img class="AccountImage"/>
<p class="AccountDescription"></p>
<hr/>
<div class="Posts"> <div class="Posts">
<p>Not implemented. Posts should populate here.</p> <p>Not implemented. Posts should populate here.</p>
</div> </div>

View file

@ -93,6 +93,42 @@ export async function GetStatus(ID) {
.then((response) => response.json()); .then((response) => response.json());
} }
// Get your own account by verifying your credentials.
export async function GetOwnAccount() {
if (Token == null || TokenType == null) {
return "";
}
return await fetch(localStorage.getItem(Variables.MastodonWebsite) + "/api/v1/accounts/verify_credentials", {method: "GET", headers: {"Authorization": TokenType + " " + Token}})
.then((response) => response.json());
}
// Get your own account blocks.
export async function GetOwnAccountBlocks() {
if (Token == null || TokenType == null) {
return "";
}
return await fetch(localStorage.getItem(Variables.MastodonWebsite) + "/api/v1/blocks/", {method: "GET", headers: {"Authorization": TokenType + " " + Token}})
.then((response) => response.json());
}
// Get another account's statuses.
export async function GetAccountStatuses(ID) {
if (Token == null || TokenType == null) {
return "";
}
return await fetch(localStorage.getItem(Variables.MastodonWebsite) + "/api/v1/accounts/" + ID + "/statuses", {method: "GET", headers: {"Authorization": TokenType + " " + Token}})
.then((response) => response.json());
}
// Get another account.
export async function GetAccount(ID) {
if (Token == null || TokenType == null) {
return "";
}
return await fetch(localStorage.getItem(Variables.MastodonWebsite) + "/api/v1/accounts/" + ID, {method: "GET", headers: {"Authorization": TokenType + " " + Token}})
.then((response) => response.json());
}
// Creators // Creators
// Make a status // Make a status
export async function CreateStatus(Text, Visibility = "public", SpoilerText = undefined, ReplyID = undefined) { export async function CreateStatus(Text, Visibility = "public", SpoilerText = undefined, ReplyID = undefined) {

View file

@ -10,6 +10,9 @@ let post = JSON.parse(localStorage.getItem("post"));
let AccountName = document.getElementsByClassName("Account")[0]; let AccountName = document.getElementsByClassName("Account")[0];
let AccountImage = document.getElementsByClassName("AccountImage")[0]; let AccountImage = document.getElementsByClassName("AccountImage")[0];
let AccountDescription = document.getElementsByClassName("AccountDescription")[0]; let AccountDescription = document.getElementsByClassName("AccountDescription")[0];
let AlternateAccountName = document.getElementsByClassName("Account")[1];
let AlternateAccountImage = document.getElementsByClassName("AccountImage")[1];
let AlternateAccountDescription = document.getElementsByClassName("AccountDescription")[1];
let FollowButton = document.getElementsByClassName("Follow")[0]; let FollowButton = document.getElementsByClassName("Follow")[0];
let BlockButton = document.getElementsByClassName("Block")[0]; let BlockButton = document.getElementsByClassName("Block")[0];
@ -17,8 +20,10 @@ let BlockButton = document.getElementsByClassName("Block")[0];
let Following = false; let Following = false;
let Blocking = false; let Blocking = false;
// SPAWN
GetAccount(); GetAccount();
// The interaction is given to another function for async.
FollowButton.onclick = (event) => { FollowButton.onclick = (event) => {
FollowBoop(); FollowBoop();
} }
@ -33,6 +38,7 @@ async function FollowBoop() {
SetFollow(); SetFollow();
} }
// Extra thing for the frontend to say "hey I am the follow meister".
function SetFollow() { function SetFollow() {
Following = !(Following); Following = !(Following);
if (Following == true) { if (Following == true) {
@ -42,6 +48,7 @@ function SetFollow() {
} }
} }
// The interaction is given to another function for async.
BlockButton.onclick = (event) => { BlockButton.onclick = (event) => {
BlockBoop(); BlockBoop();
} }
@ -56,6 +63,7 @@ async function BlockBoop() {
SetBlock(); SetBlock();
} }
// Extra thing for the frontend to say "hey I am the block meister".
function SetBlock() { function SetBlock() {
Blocking = !(Blocking); Blocking = !(Blocking);
if (Blocking == true) { if (Blocking == true) {
@ -108,5 +116,33 @@ async function GetAccount() {
AccountName.innerHTML = account.handle; AccountName.innerHTML = account.handle;
AccountDescription.innerHTML = account.description; AccountDescription.innerHTML = account.description;
AccountImage.setAttribute("src", account.avatar); AccountImage.setAttribute("src", account.avatar);
} else {
FollowButton.setAttribute("hidden", "");
BlockButton.setAttribute("hidden", "");
// This is meant for the regular account. A big ol' you :3
let Token = localStorage.getItem(Variables.MastodonAccessToken);
if (Token != null) {
let MastoProfile = await MastodonAPI.GetOwnAccount();
AccountName.innerHTML = MastoProfile.username;
AccountDescription.innerHTML = MastoProfile.note;
AccountImage.setAttribute("src", MastoProfile.avatar);
// Build the fields
let Field = "<div style=\"display: flex; justify-content: center;\">";
for (let i of MastoProfile.fields) {
Field += "<b class=\"Entry\">" + i.name + "</b><em class=\"Exitry\">" + i.value + "</em>";
}
Field += "</div>";
AccountDescription.innerHTML += Field;
}
Token = localStorage.getItem(Variables.BlueskyAccessToken);
if (Token != null) {
let BlueProfile = await BlueskyAPI.GetProfile(localStorage.getItem(Variables.BlueskyDID));
AlternateAccountImage.setAttribute("width", "20%");
AlternateAccountImage.setAttribute("height", "20%");
AlternateAccountName.innerHTML = BlueProfile.handle;
AlternateAccountDescription.innerHTML = BlueProfile.description;
AlternateAccountImage.setAttribute("src", BlueProfile.avatar);
}
} }
} }

View file

@ -19,6 +19,7 @@ let SettingButton = document.getElementsByClassName("Setting")[0];
let MailButton = document.getElementsByClassName("Mail")[0]; let MailButton = document.getElementsByClassName("Mail")[0];
let PostingButton = document.getElementsByClassName("Posting")[0]; let PostingButton = document.getElementsByClassName("Posting")[0];
let FeedButton = document.getElementsByClassName("Feed")[0]; let FeedButton = document.getElementsByClassName("Feed")[0];
let TimeAccountButton = document.getElementsByClassName("Time")[0];
// Sounds // Sounds
const ButtonSound = new Audio("Audio/button-305770.mp3"); const ButtonSound = new Audio("Audio/button-305770.mp3");
@ -340,6 +341,12 @@ MailButton.onclick = (event) => {
window.location.href = "./HTML/mail.html"; window.location.href = "./HTML/mail.html";
} }
// A quick way of opening the account.
// In theory, this should be in another "channel" or the mail area, but those areas are crowded.
TimeAccountButton.onclick = (event) => {
window.location.href = "./HTML/account.html";
}
// Open the posting area. // Open the posting area.
PostingButton.onclick = (event) => { PostingButton.onclick = (event) => {
window.location.href = "./HTML/post.html"; window.location.href = "./HTML/post.html";