Merge pull request #3866 from omnivore-app/feature/data-loader

feat: use dataloader for labels and highlights
This commit is contained in:
Hongbo Wu
2024-04-29 15:20:53 +08:00
committed by GitHub
22 changed files with 224 additions and 118 deletions

View File

@ -33,7 +33,7 @@ import {
makeHighlightNodeAttributes,
} from './highlightGenerator'
import { createImageProxyUrl } from './imageproxy'
import { buildLogger, LogRecord } from './logger'
import { logger, LogRecord } from './logger'
interface Feed {
title: string
@ -43,7 +43,6 @@ interface Feed {
description?: string
}
const logger = buildLogger('utils.parse')
const signToken = promisify(jwt.sign)
const axiosInstance = axios.create({
@ -647,7 +646,6 @@ export const contentConverter = (
return htmlToMarkdown
case ArticleFormat.HighlightedMarkdown:
return htmlToHighlightedMarkdown
case ArticleFormat.Html:
default:
return undefined
}
@ -671,7 +669,7 @@ export const htmlToHighlightedMarkdown = (
throw new Error('Invalid html content')
}
} catch (err) {
logger.info(err)
logger.error(err)
return nhm.translate(/* html */ html)
}
@ -691,7 +689,7 @@ export const htmlToHighlightedMarkdown = (
articleTextNodes
)
} catch (err) {
logger.info(err)
logger.error(err)
}
})
html = document.documentElement.outerHTML