Fix types in summaly connector

This commit is contained in:
Michcio 2022-09-25 16:57:24 +02:00
parent 79c71bf22a
commit 9f3b85527d

View file

@ -31,7 +31,7 @@ export const urlPreviewHandler = async (ctx: Koa.Context): Promise<void> => {
const summary = meta.summalyProxy ? await getJson(`${meta.summalyProxy}?${query({ const summary = meta.summalyProxy ? await getJson(`${meta.summalyProxy}?${query({
url, url,
lang: lang ?? 'ja-JP', lang: lang ?? 'ja-JP',
})}`) : await summaly.default(url, { })}`) as Awaited<ReturnType<typeof summaly.default>> : await summaly.default(url, {
followRedirects: false, followRedirects: false,
lang: lang ?? 'ja-JP', lang: lang ?? 'ja-JP',
}); });
@ -53,8 +53,8 @@ export const urlPreviewHandler = async (ctx: Koa.Context): Promise<void> => {
} }
}; };
function wrap(url?: string): string | null { function wrap(url: string|null): string|null {
return url != null return url !== null
? url.match(/^https?:\/\//) ? url.match(/^https?:\/\//)
? `${config.url}/proxy/preview.webp?${query({ ? `${config.url}/proxy/preview.webp?${query({
url, url,