support nip94 and fix some bugs

This commit is contained in:
Ren Amamiya
2023-08-09 09:04:16 +07:00
parent e6c6793f6e
commit d1d0a462f4
11 changed files with 285 additions and 166 deletions

View File

@@ -1,4 +1,4 @@
import { FetchOptions, ResponseType, fetch } from '@tauri-apps/plugin-http';
import { fetch } from '@tauri-apps/plugin-http';
import * as cheerio from 'cheerio';
import { OPENGRAPH } from '@stores/constants';
@@ -332,10 +332,9 @@ function parseResponse(response: IPreFetchedResource, options?: ILinkPreviewOpti
export async function getLinkPreview(text: string) {
const fetchUrl = text;
const options: FetchOptions = {
const options = {
method: 'GET',
timeout: 5,
responseType: ResponseType.Text,
};
let response = await fetch(fetchUrl, options);