mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix title not fetched correctly when using preview content in rss feeds
This commit is contained in:
parent
e031f4f81c
commit
315c625482
3 changed files with 22 additions and 5 deletions
|
|
@ -48,12 +48,14 @@ export const isRefreshFeedRequest = (data: any): data is RefreshFeedRequest => {
|
|||
|
||||
// link can be a string or an object
|
||||
type RssFeedItemLink = string | { $: { rel?: string; href: string } }
|
||||
type RssFeedItemAuthor = string | { name: string }
|
||||
type RssFeed = Parser.Output<{
|
||||
published?: string
|
||||
updated?: string
|
||||
created?: string
|
||||
link?: RssFeedItemLink
|
||||
links?: RssFeedItemLink[]
|
||||
author?: RssFeedItemAuthor
|
||||
}> & {
|
||||
lastBuildDate?: string
|
||||
'syn:updatePeriod'?: string
|
||||
|
|
@ -386,6 +388,7 @@ const parser = new Parser({
|
|||
'created',
|
||||
['media:content', 'media:content', { keepArray: true }],
|
||||
['media:thumbnail'],
|
||||
'author',
|
||||
],
|
||||
feed: [
|
||||
'lastBuildDate',
|
||||
|
|
@ -473,6 +476,14 @@ const getLink = (
|
|||
return url
|
||||
}
|
||||
|
||||
// get author
|
||||
const getAuthor = (author: RssFeedItemAuthor) => {
|
||||
if (typeof author === 'string') {
|
||||
return author
|
||||
}
|
||||
return author.name
|
||||
}
|
||||
|
||||
const processSubscription = async (
|
||||
fetchContentTasks: Map<string, FetchContentTask>,
|
||||
subscriptionId: string,
|
||||
|
|
@ -536,10 +547,13 @@ const processSubscription = async (
|
|||
throw new Error('Invalid feed item link')
|
||||
}
|
||||
|
||||
const creator = item.creator || (item.author && getAuthor(item.author))
|
||||
|
||||
const feedItem = {
|
||||
...item,
|
||||
isoDate,
|
||||
link,
|
||||
creator,
|
||||
}
|
||||
|
||||
const publishedAt = feedItem.isoDate
|
||||
|
|
|
|||
|
|
@ -229,8 +229,8 @@ export const subscribeResolver = authorized<
|
|||
...existingSubscription,
|
||||
fetchContentType: input.fetchContentType
|
||||
? (input.fetchContentType as FetchContentType)
|
||||
: undefined,
|
||||
folder: input.folder ?? undefined,
|
||||
: existingSubscription.fetchContentType,
|
||||
folder: input.folder ?? existingSubscription.folder,
|
||||
isPrivate: input.isPrivate,
|
||||
status: SubscriptionStatus.Active,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export const savePage = async (
|
|||
}
|
||||
}
|
||||
|
||||
const parseResult = await parsePreparedContent(input.url, {
|
||||
const preparedDocument: PreparedDocumentInput = {
|
||||
document: input.originalContent,
|
||||
pageInfo: {
|
||||
title: input.title,
|
||||
|
|
@ -111,7 +111,9 @@ export const savePage = async (
|
|||
previewImage: input.previewImage,
|
||||
author: input.author,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const parseResult = await parsePreparedContent(input.url, preparedDocument)
|
||||
|
||||
const itemToSave = parsedContentToLibraryItem({
|
||||
itemId: clientRequestId,
|
||||
|
|
@ -131,6 +133,7 @@ export const savePage = async (
|
|||
folder: input.folder,
|
||||
feedContent: input.feedContent,
|
||||
dir: parseResult.parsedContent?.dir,
|
||||
preparedDocument,
|
||||
})
|
||||
const isImported =
|
||||
input.source === 'csv-importer' || input.source === 'pocket'
|
||||
|
|
@ -247,7 +250,7 @@ export const parsedContentToLibraryItem = ({
|
|||
croppedPathname ||
|
||||
parsedContent?.siteName ||
|
||||
url,
|
||||
author: parsedContent?.byline,
|
||||
author: preparedDocument?.pageInfo.author || parsedContent?.byline,
|
||||
originalUrl: cleanUrl(canonicalUrl || url),
|
||||
itemType,
|
||||
textContentHash:
|
||||
|
|
|
|||
Loading…
Reference in a new issue