Save article from forwarding emails

This commit is contained in:
Hongbo Wu
2022-07-26 22:08:10 +08:00
parent d184ca8d04
commit 6f11ccacb1
7 changed files with 101 additions and 40 deletions

View File

@ -18,6 +18,7 @@ import { parseHTML } from 'linkedom'
import { getRepository } from '../entity/utils'
import { User } from '../entity/user'
import { ILike } from 'typeorm'
import { v4 as uuid } from 'uuid'
const logger = buildLogger('utils.parse')
@ -559,3 +560,10 @@ export const isProbablyArticle = async (
})
return !!user || subject.includes(ARTICLE_PREFIX)
}
export const generateUniqueUrl = () => 'https://omnivore.app/no_url?q=' + uuid()
export const getTitleFromEmailSubject = (subject: string) => {
const title = subject.replace(ARTICLE_PREFIX, '')
return title.trim()
}