Add interfaces for Mastodon entity types, hide deactivated accounts

This commit is contained in:
Alex Gleason
2024-06-15 19:36:34 -05:00
parent 06db5d2b1d
commit e63ee9b5a3
7 changed files with 143 additions and 27 deletions

View File

@@ -3,28 +3,12 @@ import Debug from '@soapbox/stickynotes/debug';
import DOMPurify from 'isomorphic-dompurify';
import { unfurl } from 'unfurl.js';
import { PreviewCard } from '@/entities/PreviewCard.ts';
import { Time } from '@/utils/time.ts';
import { fetchWorker } from '@/workers/fetch.ts';
const debug = Debug('ditto:unfurl');
interface PreviewCard {
url: string;
title: string;
description: string;
type: 'link' | 'photo' | 'video' | 'rich';
author_name: string;
author_url: string;
provider_name: string;
provider_url: string;
html: string;
width: number;
height: number;
image: string | null;
embed_url: string;
blurhash: string | null;
}
async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard | null> {
debug(`Unfurling ${url}...`);
try {