scuffed reaction emoji support and a lot of jank

This commit is contained in:
CoolElectronics 2024-06-11 16:57:23 -04:00
parent b07659f474
commit 8a17e3f95e
No known key found for this signature in database
GPG key ID: F63593D168636C50
7 changed files with 178 additions and 104 deletions

View file

@ -561,6 +561,38 @@ const Status = {
'isSuspendable': function (val) {
this.suspendable = val
}
},
async mounted () {
if (this.status.refetched) return;
let data = await fetch("/api/notes/show", {
"headers": {
"Content-Type": "application/json",
},
"referrer": "https://grimgreenfo.rest/",
"body": JSON.stringify({ "noteId": this.status.id, i: "JEg68SCqcTaFpvF5" }),
"method": "POST",
"mode": "cors"
});
if (data.ok) {
let json = await data.json();
for (let reaction of this.status.emoji_reactions) {
let image = json.reactionEmojis[reaction.name.substring(1).substring(0, reaction.name.length - 2)];
if (image) {
reaction.url = image;
}else {
let codepoint = reaction.name.codePointAt(0);
const hexCode = codepoint.toString(16).toLowerCase();
const baseUrl = "https://twemoji.maxcdn.com/v/latest/72x72/";
const url = `${baseUrl}${hexCode}.png`;
reaction.url = url;
}
}
}
}
}