changes to how authorized fetch works

This commit is contained in:
Ashley 2024-08-24 10:49:58 +00:00
parent a7910e5f78
commit e0d21c04e2
3 changed files with 36 additions and 47 deletions

View file

@ -18,20 +18,6 @@ const PATH_REGEX = {
cohost: /^\/[A-Za-z0-9]+\/post\/\d+-[A-Za-z0-9-]+\/?/,
};
const PLATFORM_COLORS = {
mastodon: 0x2791da,
pleroma: 0xfba457,
akkoma: 0x593196,
misskey: 0x99c203,
calckey: 0x31748f,
firefish: 0xf07a5b, // YCbCr interpolated from the two logo colors
gotosocial: 0xff853e,
lemmy: 0x14854f,
birdsitelive: 0x1da1f2,
iceshrimp: 0x8e82f9, // YCbCr interpolated as the accent color is a gradient
cohost: 0x83254f,
};
const domainCache = new Map();
domainCache.set("cohost.org", "cohost"); // no nodeinfo
@ -124,7 +110,6 @@ async function processUrl(url) {
}
let platform = (await resolvePlatform(url)) ?? "<no nodeinfo>";
let color = PLATFORM_COLORS[platform];
let platformName = platform
.replace("gotosocial", "GoToSocial")
.replace("birdsitelive", '"Twitter" (BirdsiteLive)')
@ -359,7 +344,6 @@ async function processUrl(url) {
const realUrlObj = new URL(postData.id);
if(realUrlObj.origin != urlObj.origin) {
platform = await resolvePlatform(postData.id);
color = PLATFORM_COLORS[platform];
platformName = platform.replace("gotosocial", "GoToSocial").replace(/^(.)/, (_, c) => c.toUpperCase());
url = postData.id;
}
@ -514,7 +498,6 @@ async function processUrl(url) {
const user = author.name ? `${author.name} (${author.handle})` : author.handle;
const baseEmbed = {
color,
url,
timestamp,
description: desc,