Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions plugins/links/article/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ export default {

const articleHtml = utils.encodeText(meta.charset, readability.getHTML());
const $p = cheerio.load(articleHtml)('p');
const articleText = $p.text();

if ($p.text()) {
if (articleText) {
return {
articlebody: articleHtml
articlebody: __readabilityEnabled === 'html' ? articleHtml : articleText.replace(/\.([^\.\d\s\n\r\'\"\”\)\]])/g, '. $1')
}
}
},
Expand Down
9 changes: 6 additions & 3 deletions plugins/links/article/check-article.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ export default {
|| meta.twitter?.card === 'summary_large_image'
|| meta.article))

&& (options.getRequestOptions('readability.articlebody', false) || CONFIG.providerOptions?.app?.allow_readability === true)) {
&& (options.getRequestOptions('readability.articlebody') || CONFIG.providerOptions?.app?.allow_readability === true)) {

if (ld?.articlebody && /\/>/.test(ld.articlebody)) {
const article_format = (options.getRequestOptions('readability.articlebody') === 'html'
|| CONFIG.providerOptions?.app?.allow_readability === true) ? 'html' : 'txt';

if (ld?.articlebody && (article_format !== 'html' || /\/>/.test(ld.articlebody))) {
return {
articlebody: ld.articlebody
}
} else if (options.getProviderOptions('app.allow_readability')) {
return {
__readabilityEnabled: true
__readabilityEnabled: article_format
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/links/article/reader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {

getData: function(articlebody) {
if (CONFIG.providerOptions?.app?.allow_readability === true && !CONFIG.SKIP_IFRAMELY_RENDERS) {
getData: function(__readabilityEnabled, articlebody) {
if (__readabilityEnabled === 'html' && CONFIG.providerOptions?.app?.allow_readability === true && !CONFIG.SKIP_IFRAMELY_RENDERS) {
return {
safe_html: articlebody
}
Expand Down