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 +1 -1
- package/server/dist/feeds/archive.js +1 -1
- package/server/dist/feeds/batchSubscribe.js +7 -5
- package/server/dist/feeds/extractorParser.js +2 -4
- package/server/package.json +1 -1
- package/web/dist/assets/{index-DX6YOuhF.js → index-D1WpLIOR.js} +7 -7
- package/web/dist/assets/index-DzTYkw0D.css +2 -0
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +1 -1
- package/web/dist/assets/index-C4E4b1Mp.css +0 -2
package/package.json
CHANGED
|
@@ -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(
|
|
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
|
|
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,
|
|
32
|
-
while (next <
|
|
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
|
|
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
|
|
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
|
-
|
|
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 ((
|
|
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" };
|