feedkeeper 0.42.3 → 0.42.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feedkeeper",
3
- "version": "0.42.3",
3
+ "version": "0.42.4",
4
4
  "description": "A lightweight, self-hosted RSS reader and remote MCP server for your news, blogs, and AI workflows.",
5
5
  "keywords": [
6
6
  "rss",
@@ -199,7 +199,7 @@ async function drain() {
199
199
  try {
200
200
  while (queue.length > 0) {
201
201
  const itemId = queue.shift();
202
- await archiveItem(itemId).catch((error) => console.warn(`[archive] item ${itemId}:`, error));
202
+ await archiveItem(itemId).catch((error) => console.warn("[archive] item %d:", Number(itemId), error));
203
203
  }
204
204
  }
205
205
  finally {
@@ -26,10 +26,11 @@ async function checkAddress(raw) {
26
26
  }
27
27
  }
28
28
  async function checkAll(items) {
29
- const checked = new Array(items.length);
29
+ const total = Math.min(items.length, MAX_SUBSCRIPTION_BATCH);
30
+ const checked = new Array(total);
30
31
  let next = 0;
31
- await Promise.all(Array.from({ length: Math.min(CHECK_CONCURRENCY, items.length) }, async () => {
32
- while (next < items.length) {
32
+ await Promise.all(Array.from({ length: Math.min(CHECK_CONCURRENCY, total) }, async () => {
33
+ while (next < total) {
33
34
  const index = next++;
34
35
  checked[index] = await checkAddress(items[index].url);
35
36
  }
@@ -43,11 +44,12 @@ async function checkAll(items) {
43
44
  * usual schedule. Sending the same list again changes nothing (`exists`).
44
45
  */
45
46
  export async function subscribeBatch(userId, items) {
46
- const checked = await checkAll(items);
47
+ const bounded = items.slice(0, MAX_SUBSCRIPTION_BATCH);
48
+ const checked = await checkAll(bounded);
47
49
  const created = [];
48
50
  const results = db.transaction(() => {
49
51
  const folders = new Map();
50
- return items.map((item, index) => {
52
+ return bounded.map((item, index) => {
51
53
  const check = checked[index];
52
54
  if ("reason" in check)
53
55
  return { url: item.url, status: "invalid", reason: check.reason };
@@ -116,21 +116,19 @@ function paywallNotice(pageUrl) {
116
116
  export function parseArticleHtml(html, url) {
117
117
  const dom = new JSDOM(html, { url });
118
118
  let parsed;
119
- let paywalled = false;
119
+ const paywalled = /"isAccessibleForFree"\s*:\s*(?:false|"false")/i.test(html);
120
120
  try {
121
121
  // The content rules run first: players and consent plugins keep the address of an embed in the very tags removed next.
122
122
  cleanPage(dom.window.document);
123
123
  dom.window.document.querySelectorAll("script, style, svg, iframe, noscript").forEach(element => element.remove());
124
- const paywall = /"isAccessibleForFree"\s*:\s*(?:false|"false")/i.test(html);
125
124
  cleanConsentDom(dom.window.document);
126
125
  resolveLazyImages(dom.window.document);
127
126
  parsed = new Readability(dom.window.document, { charThreshold: 60 }).parse();
128
- paywalled = paywall;
129
127
  if (isConsentContent(url, parsed?.content ?? html, parsed?.title, parsed?.textContent)) {
130
128
  return { status: "consent_wall" };
131
129
  }
132
130
  // Publishers flag a whole article as not free although the page carries its text; enough of it is the article.
133
- if ((paywall && (parsed?.textContent?.length ?? 0) < PAYWALL_TEXT_MIN) ||
131
+ if ((paywalled && (parsed?.textContent?.length ?? 0) < PAYWALL_TEXT_MIN) ||
134
132
  ((parsed?.textContent?.length ?? 0) < PAYWALL_TEXT_MIN &&
135
133
  /(?:subscribe to (?:continue|read)|sign in to (?:continue|read)|abonnieren und weiterlesen|nur für abonnenten|jetzt abonnieren.{0,40}weiterlesen)/i.test(parsed?.textContent ?? ""))) {
136
134
  return { status: "paywall" };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedkeeper/server",
3
- "version": "0.42.3",
3
+ "version": "0.42.4",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }