mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
prettier
This commit is contained in:
parent
65ce8353dc
commit
484cd78ac5
2 changed files with 8 additions and 4 deletions
|
|
@ -57,7 +57,9 @@ export function emailsServiceRouter() {
|
|||
title: data.subject,
|
||||
content: data.html,
|
||||
author: data.from,
|
||||
url: (await findNewsletterUrl(data.html)) || 'https://omnivore.app/no_url',
|
||||
url:
|
||||
(await findNewsletterUrl(data.html)) ||
|
||||
'https://omnivore.app/no_url',
|
||||
})
|
||||
res.status(200).send('Newsletter')
|
||||
return
|
||||
|
|
|
|||
|
|
@ -402,7 +402,9 @@ export const isProbablyNewsletter = (html: string): boolean => {
|
|||
|
||||
// Given an HTML blob tries to find a URL to use for
|
||||
// a canonical URL.
|
||||
export const findNewsletterUrl = async (html: string): Promise<string | undefined> => {
|
||||
export const findNewsletterUrl = async (
|
||||
html: string
|
||||
): Promise<string | undefined> => {
|
||||
const dom = new JSDOM(html).window
|
||||
|
||||
// If there is an <h1 element with a URL, use that
|
||||
|
|
@ -416,8 +418,8 @@ export const findNewsletterUrl = async (html: string): Promise<string | undefine
|
|||
method: 'HEAD',
|
||||
url: href,
|
||||
})
|
||||
.then(res => res.request.res.responseUrl)
|
||||
.catch((e) => href)
|
||||
.then((res) => res.request.res.responseUrl as string | undefined)
|
||||
.catch((e) => href)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue