refactor: use link preview from nostr-services api

This commit is contained in:
2024-01-15 11:16:28 +00:00
parent ad79091356
commit 21d7df0eac
4 changed files with 59 additions and 13 deletions

View File

@ -5,11 +5,11 @@ import { LRUCache } from "typescript-lru-cache";
import { MediaElement } from "@/Components/Embed/MediaElement";
import Spinner from "@/Components/Icons/Spinner";
import SnortApi, { LinkPreviewData } from "@/External/SnortApi";
import { LinkPreviewData, NostrServices } from "@/External/NostrServices";
import useImgProxy from "@/Hooks/useImgProxy";
async function fetchUrlPreviewInfo(url: string) {
const api = new SnortApi();
const api = new NostrServices("https://nostr.api.v0l.io");
try {
return await api.linkPreview(url.endsWith(")") ? url.slice(0, -1) : url);
} catch (e) {