feedkeeper 0.36.10 → 0.37.0
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/content/index.js +3 -1
- package/server/dist/feeds/content/noise/boilerplate.js +26 -0
- package/server/dist/feeds/content/noise/emptyContents.js +42 -0
- package/server/dist/feeds/content/noise/stateHidden.js +49 -0
- package/server/dist/feeds/content/patterns/boilerplate/de.js +2 -0
- package/server/dist/feeds/content/patterns/boilerplate/en.js +1 -1
- package/server/dist/feeds/content/patterns/boilerplate/ja.js +1 -0
- package/server/dist/feeds/content/patterns/contents/de.js +5 -0
- package/server/dist/feeds/content/patterns/contents/en.js +8 -0
- package/server/dist/feeds/content/patterns/contents/index.js +6 -0
- package/server/dist/feeds/content/patterns/contents/ja.js +5 -0
- package/server/dist/feeds/content/patterns/loading/de.js +2 -0
- package/server/dist/feeds/content/patterns/loading/en.js +2 -0
- package/server/dist/feeds/content/patterns/loading/ja.js +2 -0
- package/server/dist/feeds/contentNoise.js +6 -0
- package/server/dist/feeds/extractor.js +1 -1
- package/server/dist/feeds/fullText.js +6 -0
- package/server/dist/feeds/fullTextBackoff.js +46 -0
- package/server/dist/feeds/fullTextQueue.js +14 -6
- package/server/dist/oauth/pages.js +8 -8
- package/server/package.json +1 -1
- package/web/dist/assets/{index-D-4I1D7w.js → index-JhZPH8vz.js} +1 -1
- package/web/dist/index.html +1 -1
- package/web/dist/sw.js +1 -1
package/package.json
CHANGED
|
@@ -2,18 +2,20 @@ import { lazyImages } from "./noise/lazyImages.js";
|
|
|
2
2
|
import { EMBED_RULES, resolveEmbeds } from "./embeds/index.js";
|
|
3
3
|
import { embedHeadings } from "./embeds/headings.js";
|
|
4
4
|
import { boilerplate } from "./noise/boilerplate.js";
|
|
5
|
+
import { emptyContents } from "./noise/emptyContents.js";
|
|
5
6
|
import { loadingPlaceholders } from "./noise/loading.js";
|
|
6
7
|
import { pageChrome } from "./noise/pageChrome.js";
|
|
7
8
|
import { trackingPixels } from "./noise/pixels.js";
|
|
8
9
|
import { permalinkGlyphs } from "./noise/permalinkGlyphs.js";
|
|
9
10
|
import { sidebars } from "./noise/sidebars.js";
|
|
11
|
+
import { stateHidden } from "./noise/stateHidden.js";
|
|
10
12
|
import { teaserLinks } from "./noise/teaserLinks.js";
|
|
11
13
|
/**
|
|
12
14
|
* Every rule of the content pipeline, in the order they run on a fetched page: embeds first (their address sits in
|
|
13
15
|
* tags that are removed next), then the clutter around the story. The tests check each rule against its fixtures in
|
|
14
16
|
* `test/fixtures/content/<rule name>` and that running it twice changes nothing. See `docs/content-rules.md`.
|
|
15
17
|
*/
|
|
16
|
-
export const PAGE_RULES = [lazyImages, ...EMBED_RULES, embedHeadings, pageChrome, sidebars, loadingPlaceholders, trackingPixels, boilerplate, teaserLinks, permalinkGlyphs];
|
|
18
|
+
export const PAGE_RULES = [lazyImages, ...EMBED_RULES, embedHeadings, pageChrome, stateHidden, sidebars, loadingPlaceholders, trackingPixels, boilerplate, emptyContents, teaserLinks, permalinkGlyphs];
|
|
17
19
|
export { resolveEmbeds };
|
|
18
20
|
/** What a fetched page goes through before its scripts, frames and `noscript` blocks are removed. */
|
|
19
21
|
export function cleanPage(root, stats = {}) {
|
|
@@ -64,9 +64,35 @@ export const boilerplate = {
|
|
|
64
64
|
count(stats, "boilerplate");
|
|
65
65
|
changed = true;
|
|
66
66
|
}
|
|
67
|
+
if (inlineCalls(root, stats))
|
|
68
|
+
changed = true;
|
|
67
69
|
return lineFooters(root, stats, total) || changed;
|
|
68
70
|
},
|
|
69
71
|
};
|
|
72
|
+
/** A short line holds more than the call ("November 12, 2026 · Add as a preferred source on Google"): longer text is prose and is left alone. */
|
|
73
|
+
const SHORT_LINE = 200;
|
|
74
|
+
/**
|
|
75
|
+
* The same calls as a link inside a short line of other words, or in front of a picture in the same paragraph: the link goes, the rest stays.
|
|
76
|
+
* A block that holds nothing else was dealt with above.
|
|
77
|
+
*/
|
|
78
|
+
function inlineCalls(root, stats) {
|
|
79
|
+
let changed = false;
|
|
80
|
+
for (const link of [...root.querySelectorAll("a[href]")]) {
|
|
81
|
+
const parent = link.parentElement;
|
|
82
|
+
if (!parent || !root.contains(link) || link.querySelector("img, picture, video, audio, iframe"))
|
|
83
|
+
continue;
|
|
84
|
+
const text = flat(link.textContent);
|
|
85
|
+
if (text === "" || text.length > 120 || !BOILERPLATE_ANYWHERE.some(pattern => pattern.test(text)))
|
|
86
|
+
continue;
|
|
87
|
+
const line = flat(parent.textContent);
|
|
88
|
+
if (line.length > SHORT_LINE)
|
|
89
|
+
continue;
|
|
90
|
+
link.remove();
|
|
91
|
+
count(stats, "boilerplate");
|
|
92
|
+
changed = true;
|
|
93
|
+
}
|
|
94
|
+
return changed;
|
|
95
|
+
}
|
|
70
96
|
/**
|
|
71
97
|
* Footers that stand as bare text between `<br>` ("This article … first appeared on …", "Discuss this article in our forums"), not in a block of
|
|
72
98
|
* their own. Each such line is checked like a block; the breaks left at the end of the container go with them.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CONTENTS_HEADINGS } from "../patterns/contents/index.js";
|
|
2
|
+
import { count, flat, pruneEmpty } from "../shared.js";
|
|
3
|
+
const LIST_LIKE = "ul, ol, nav, details, dl, table";
|
|
4
|
+
/** How far down a block's first children a list may start and still count as the list under the heading. */
|
|
5
|
+
const LIST_DEPTH = 3;
|
|
6
|
+
/** Whether an element is a list or opens with one (a wrapper around the table of contents). */
|
|
7
|
+
function startsWithList(element, depth = 0) {
|
|
8
|
+
if (element.matches(LIST_LIKE))
|
|
9
|
+
return true;
|
|
10
|
+
const first = element.firstElementChild;
|
|
11
|
+
return depth < LIST_DEPTH && first !== null && startsWithList(first, depth + 1);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The heading of a table of contents that a script fills: "Table of Contents", "Inhaltsverzeichnis", "目次". Without the script
|
|
15
|
+
* nothing follows it but the story. A heading goes only when the element after it neither is a list nor opens with one and holds no
|
|
16
|
+
* links within the page; a table of contents that is there stays with its heading.
|
|
17
|
+
*/
|
|
18
|
+
export const emptyContents = {
|
|
19
|
+
name: "empty-contents",
|
|
20
|
+
description: "A \"Table of Contents\" heading with no list of links after it (a script builds the list) is removed.",
|
|
21
|
+
apply(root, stats) {
|
|
22
|
+
let changed = false;
|
|
23
|
+
for (const heading of [...root.querySelectorAll("h1, h2, h3, h4, h5, h6")]) {
|
|
24
|
+
if (!root.contains(heading) || !CONTENTS_HEADINGS.some(pattern => pattern.test(flat(heading.textContent))))
|
|
25
|
+
continue;
|
|
26
|
+
// A wrapper that holds nothing but the heading belongs to it.
|
|
27
|
+
let target = heading;
|
|
28
|
+
while (target.parentElement && target.parentElement.children.length === 1 && flat(target.parentElement.textContent) === flat(heading.textContent))
|
|
29
|
+
target = target.parentElement;
|
|
30
|
+
const next = target.nextElementSibling;
|
|
31
|
+
if (next && (startsWithList(next) || next.querySelectorAll("a[href^='#']").length >= 2))
|
|
32
|
+
continue;
|
|
33
|
+
const parent = target.parentNode;
|
|
34
|
+
target.remove();
|
|
35
|
+
pruneEmpty(parent);
|
|
36
|
+
count(stats, "empty-contents");
|
|
37
|
+
changed = true;
|
|
38
|
+
}
|
|
39
|
+
return changed;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=emptyContents.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { count, pruneEmpty } from "../shared.js";
|
|
2
|
+
/** An expression that is nothing but the name of a state variable. */
|
|
3
|
+
const STATE_NAME = /^[A-Za-z_$][\w$]*$/;
|
|
4
|
+
/** Whether an `x-data` object declares the variable and starts it out as `false` (`{ open: false }`). */
|
|
5
|
+
function declaration(data, name) {
|
|
6
|
+
const escaped = name.replace(/\$/g, "\\$");
|
|
7
|
+
if (!new RegExp(`(?:^|[{,\\s])${escaped}\\s*:`).test(data))
|
|
8
|
+
return null;
|
|
9
|
+
return new RegExp(`(?:^|[{,\\s])${escaped}\\s*:\\s*false\\b`).test(data) ? "false" : "other";
|
|
10
|
+
}
|
|
11
|
+
/** Whether the state that an element's `x-show` names starts out as false in the nearest scope that declares it. */
|
|
12
|
+
function startsHidden(element) {
|
|
13
|
+
const name = (element.getAttribute("x-show") ?? "").trim();
|
|
14
|
+
if (!STATE_NAME.test(name))
|
|
15
|
+
return false;
|
|
16
|
+
for (let scope = element; scope; scope = scope.parentElement) {
|
|
17
|
+
const data = scope.getAttribute("x-data");
|
|
18
|
+
if (data === null)
|
|
19
|
+
continue;
|
|
20
|
+
const declared = declaration(data, name);
|
|
21
|
+
if (declared)
|
|
22
|
+
return declared === "false";
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Hover cards, menus and dialogs that a framework shows only after a click or a hover. Alpine writes it as `x-show="open"` with
|
|
28
|
+
* `x-data="{ open: false }"` on the wrapper: the card is hidden until a script flips the state. A reader runs no script, so the
|
|
29
|
+
* state never changes and what sits in the card (an author's biography, a menu of the site) would be read as part of the story.
|
|
30
|
+
* Only a bare state name that starts out `false` counts; any other expression is left alone.
|
|
31
|
+
*/
|
|
32
|
+
export const stateHidden = {
|
|
33
|
+
name: "state-hidden",
|
|
34
|
+
description: "Elements that Alpine shows only while a state that starts out false is true (hover cards, menus, dialogs) are removed.",
|
|
35
|
+
apply(root, stats) {
|
|
36
|
+
let changed = false;
|
|
37
|
+
for (const element of [...root.querySelectorAll("[x-show]")]) {
|
|
38
|
+
if (!root.contains(element) || !startsHidden(element))
|
|
39
|
+
continue;
|
|
40
|
+
const parent = element.parentNode;
|
|
41
|
+
element.remove();
|
|
42
|
+
pruneEmpty(parent);
|
|
43
|
+
count(stats, "state-hidden");
|
|
44
|
+
changed = true;
|
|
45
|
+
}
|
|
46
|
+
return changed;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=stateHidden.js.map
|
|
@@ -6,6 +6,8 @@ export const ANYWHERE = [
|
|
|
6
6
|
// Aufrufe, der Seite bei Google oder in anderen Diensten zu folgen.
|
|
7
7
|
/^(?:Uns|Folge uns|Folgen Sie uns) (?:auf|bei) Google(?: News| Discover)? folgen$/i,
|
|
8
8
|
/^(?:Wähle|Wählen Sie|Füge|Fügen Sie) [^.!?]{2,50} (?:als )?(?:bevorzugte|bevorzugten|bevorzugter)\b[^.!?]{0,30}$/i,
|
|
9
|
+
// „Als bevorzugte Quelle bei Google hinzufügen“, ohne den Namen der Seite.
|
|
10
|
+
/^Als bevorzugte[nr]? (?:Google-)?Quelle (?:bei Google )?(?:hinzufügen|auswählen|wählen)$/i,
|
|
9
11
|
// „★ ifun.de bei Google bevorzugen ★“ und ähnliche Bitten, die Seite als bevorzugte Quelle zu wählen.
|
|
10
12
|
/^★?\s*[^★!?]{2,40} bei Google bevorzugen\s*★?$/i,
|
|
11
13
|
// Texte von Download-Schaltflächen, deren Grafik nicht mehr da ist.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export const ANYWHERE = [
|
|
6
6
|
// Calls to follow the site on Google or elsewhere.
|
|
7
|
-
/^(?:Follow us on Google(?: News| Discover)?|Add [^.!?]{2,50} as a preferred (?:source|publisher)(?: on Google)?)$/i,
|
|
7
|
+
/^(?:Follow us on Google(?: News| Discover)?|Add(?: [^.!?]{2,50})? as a preferred (?:source|publisher)(?: on Google)?)$/i,
|
|
8
8
|
// The text of download buttons whose picture is gone.
|
|
9
9
|
/^(?:Download on the (?:App|Mac App) Store|Get it on Google Play|Available on Google Play)$/i,
|
|
10
10
|
];
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export const ANYWHERE = [
|
|
6
6
|
// Calls to follow the site on Google or elsewhere.
|
|
7
7
|
/^(?:Google(?: ニュース)?でフォロー(?:する)?|Google ニュースで[^.!?]{2,40}をフォロー)$/i,
|
|
8
|
+
/^(?:Googleで)?優先(?:ソース|的なソース)(?:として|に)(?:追加|設定)(?:する)?$/i,
|
|
8
9
|
// The text of download buttons whose picture is gone.
|
|
9
10
|
/^(?:App Storeからダウンロード|Google Playで手に入れよう|Google Playで入手|App Storeでダウンロード)$/i,
|
|
10
11
|
// A picture's filename shown as text.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headings, in English, that introduce a table of contents. A script builds the list under such a heading on many sites; without the
|
|
3
|
+
* script only the heading is left. The whole text of the heading must be one of these (see `noise/emptyContents.ts`).
|
|
4
|
+
*/
|
|
5
|
+
export default [
|
|
6
|
+
/^(?:table of contents|contents|in this (?:article|guide|post|story)|on this page|jump to)\s*:?$/i,
|
|
7
|
+
];
|
|
8
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import de from "./de.js";
|
|
2
|
+
import en from "./en.js";
|
|
3
|
+
import ja from "./ja.js";
|
|
4
|
+
/** One file per language, searched all at once. To add a language, add a file next to these and list it here. */
|
|
5
|
+
export const CONTENTS_HEADINGS = [de, en, ja].flat();
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Placeholders, in German, that a script replaces with content. Without the script they stay in the text. See `en.ts`. */
|
|
2
2
|
export default [
|
|
3
3
|
/^(?:wird geladen|lädt|bitte warten)(?:\s*(?:\.{3}|…))?$/i,
|
|
4
|
+
// Die Überschrift eines Kommentarfelds, das ein Skript füllt.
|
|
5
|
+
/^(?:was (?:denkst|meinst) du(?: bisher)?|was denken sie(?: bisher)?|diskutieren sie mit|diskutiere mit)\??$/i,
|
|
4
6
|
];
|
|
5
7
|
//# sourceMappingURL=de.js.map
|
|
@@ -7,8 +7,10 @@ import { SIDEBAR_HEADINGS } from "./content/patterns/sidebars/index.js";
|
|
|
7
7
|
import { resolveEmbeds } from "./content/embeds/index.js";
|
|
8
8
|
import { loadingPlaceholders } from "./content/noise/loading.js";
|
|
9
9
|
import { trackingPixels } from "./content/noise/pixels.js";
|
|
10
|
+
import { emptyContents } from "./content/noise/emptyContents.js";
|
|
10
11
|
import { pageChrome } from "./content/noise/pageChrome.js";
|
|
11
12
|
import { permalinkGlyphs } from "./content/noise/permalinkGlyphs.js";
|
|
13
|
+
import { stateHidden } from "./content/noise/stateHidden.js";
|
|
12
14
|
import { teaserLinks } from "./content/noise/teaserLinks.js";
|
|
13
15
|
import { markVideoTeasers } from "./content/noise/videoTeasers.js";
|
|
14
16
|
import { flat, pruneEmpty } from "./content/shared.js";
|
|
@@ -105,6 +107,10 @@ function removeReaderNoise(root, title, stats, author) {
|
|
|
105
107
|
changed = true;
|
|
106
108
|
if (pageChrome.apply(root, stats))
|
|
107
109
|
changed = true;
|
|
110
|
+
if (stateHidden.apply(root, stats))
|
|
111
|
+
changed = true;
|
|
112
|
+
if (emptyContents.apply(root, stats))
|
|
113
|
+
changed = true;
|
|
108
114
|
for (const selector of BREADCRUMB_MARKERS) {
|
|
109
115
|
try {
|
|
110
116
|
root.querySelectorAll(selector).forEach(element => drop(element, "breadcrumb"));
|
|
@@ -261,7 +261,7 @@ async function extractArticleContent(rawUrl, fetchImpl, signal) {
|
|
|
261
261
|
if (error instanceof ArticleHttpError && [429, 503].includes(error.status))
|
|
262
262
|
return { status: "throttled", retryAt: error.retryAt, host: error.host };
|
|
263
263
|
if (error instanceof ArticleHttpError && error.status === 403)
|
|
264
|
-
return { status: "bot_blocked" };
|
|
264
|
+
return { status: "bot_blocked", host: error.host };
|
|
265
265
|
return { status: "failed" };
|
|
266
266
|
}
|
|
267
267
|
finally {
|
|
@@ -7,6 +7,8 @@ import { SsrfBlockedError } from "./ssrfGuard.js";
|
|
|
7
7
|
import { improvesContent } from "./articleContent.js";
|
|
8
8
|
import { refreshLead } from "./lead.js";
|
|
9
9
|
import { canAccessItem, findItemById, findSubscriptionFullTextMode, updateItemFullContent } from "./repository.js";
|
|
10
|
+
import { clearFullTextBlocks, recordFullTextBlock } from "./fullTextBackoff.js";
|
|
11
|
+
import { sourceHost } from "./requestGate.js";
|
|
10
12
|
// Kept for integrations importing the old constant; retries now belong to individual articles.
|
|
11
13
|
export const FULL_TEXT_BLOCK_THRESHOLD = 2;
|
|
12
14
|
function recordAttempt(id, status) {
|
|
@@ -64,6 +66,10 @@ export async function executeFullText(userId, itemId, force, priority) {
|
|
|
64
66
|
return { ok: false, error: "capability_not_available" };
|
|
65
67
|
if (result.status === "throttled")
|
|
66
68
|
return { ok: false, error: "source_busy", retryable: true, retryAt: result.retryAt, host: result.host, deferred: result.deferred };
|
|
69
|
+
if (result.status === "bot_blocked")
|
|
70
|
+
recordFullTextBlock(result.host);
|
|
71
|
+
if (result.status === "ok" || result.status === "partial")
|
|
72
|
+
clearFullTextBlocks(sourceHost(item.link));
|
|
67
73
|
if (result.status !== "ok") {
|
|
68
74
|
recordAttempt(itemId, result.status);
|
|
69
75
|
return { ok: false, error: result.status === "failed" ? "could_not_extract_content" : result.status,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { sourceHost } from "./requestGate.js";
|
|
2
|
+
const BLOCK_THRESHOLD = 3;
|
|
3
|
+
const BLOCK_WINDOW_MS = 5 * 60_000;
|
|
4
|
+
const PAUSE_MS = 30 * 60_000;
|
|
5
|
+
const MAX_TRACKED_HOSTS = 1024;
|
|
6
|
+
const hosts = new Map();
|
|
7
|
+
export function recordFullTextBlock(host, now = Date.now()) {
|
|
8
|
+
const previous = hosts.get(host);
|
|
9
|
+
const current = previous && previous.expiresAt > now ? previous : undefined;
|
|
10
|
+
if (current && current.failures >= BLOCK_THRESHOLD)
|
|
11
|
+
return;
|
|
12
|
+
const failures = (current?.failures ?? 0) + 1;
|
|
13
|
+
const expiresAt = failures >= BLOCK_THRESHOLD ? now + PAUSE_MS : current?.expiresAt ?? now + BLOCK_WINDOW_MS;
|
|
14
|
+
hosts.delete(host);
|
|
15
|
+
if (hosts.size >= MAX_TRACKED_HOSTS)
|
|
16
|
+
hosts.delete(hosts.keys().next().value);
|
|
17
|
+
hosts.set(host, { failures, expiresAt });
|
|
18
|
+
}
|
|
19
|
+
export function clearFullTextBlocks(host) {
|
|
20
|
+
hosts.delete(host);
|
|
21
|
+
}
|
|
22
|
+
export function isBackgroundFullTextPaused(host, now = Date.now()) {
|
|
23
|
+
const state = hosts.get(host);
|
|
24
|
+
return !!state && state.expiresAt > now && state.failures >= BLOCK_THRESHOLD;
|
|
25
|
+
}
|
|
26
|
+
export function pruneFullTextBlocks(now = Date.now()) {
|
|
27
|
+
let paused = 0;
|
|
28
|
+
for (const [host, state] of hosts) {
|
|
29
|
+
if (state.expiresAt <= now)
|
|
30
|
+
hosts.delete(host);
|
|
31
|
+
else if (state.failures >= BLOCK_THRESHOLD)
|
|
32
|
+
paused++;
|
|
33
|
+
}
|
|
34
|
+
return paused;
|
|
35
|
+
}
|
|
36
|
+
export function isBackgroundFullTextLinkPaused(link) {
|
|
37
|
+
if (!hosts.size)
|
|
38
|
+
return false;
|
|
39
|
+
try {
|
|
40
|
+
return isBackgroundFullTextPaused(sourceHost(link));
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=fullTextBackoff.js.map
|
|
@@ -6,6 +6,8 @@ import { loadFullText, executeFullText } from "./fullText.js";
|
|
|
6
6
|
import { articleWorkPool, restartArticleWorkPool } from "./articleWorkPool.js";
|
|
7
7
|
import { sourceHost } from "./requestGate.js";
|
|
8
8
|
import { canAccessItem, findSubscriptionFullTextMode, findItemById } from "./repository.js";
|
|
9
|
+
import { isBackgroundFullTextLinkPaused, isBackgroundFullTextPaused, pruneFullTextBlocks } from "./fullTextBackoff.js";
|
|
10
|
+
db.function("background_full_text_paused", (link) => Number(isBackgroundFullTextLinkPaused(link)));
|
|
9
11
|
/** Refillable durable queue, bounded independently of library size. */
|
|
10
12
|
export function scheduleFullTexts() {
|
|
11
13
|
const queued = db.prepare("SELECT COUNT(*) n FROM full_text_jobs").get();
|
|
@@ -17,7 +19,7 @@ export function scheduleFullTexts() {
|
|
|
17
19
|
return 0;
|
|
18
20
|
const candidates = db.prepare(`
|
|
19
21
|
WITH candidate_articles AS (
|
|
20
|
-
SELECT ids.value AS item_id, e.user_id, 3 AS priority, i.created_at
|
|
22
|
+
SELECT ids.value AS item_id, e.user_id, 3 AS priority, i.created_at, i.link
|
|
21
23
|
FROM editions e, json_each(e.item_ids) ids
|
|
22
24
|
JOIN items i ON i.id = ids.value
|
|
23
25
|
WHERE e.user_id IN (SELECT value FROM json_each(?))
|
|
@@ -30,7 +32,7 @@ export function scheduleFullTexts() {
|
|
|
30
32
|
|
|
31
33
|
UNION ALL
|
|
32
34
|
|
|
33
|
-
SELECT b.item_id, b.user_id, 2 AS priority, i.created_at
|
|
35
|
+
SELECT b.item_id, b.user_id, 2 AS priority, i.created_at, i.link
|
|
34
36
|
FROM item_bookmarks b
|
|
35
37
|
JOIN items i ON i.id = b.item_id
|
|
36
38
|
WHERE b.user_id IN (SELECT value FROM json_each(?))
|
|
@@ -42,7 +44,7 @@ export function scheduleFullTexts() {
|
|
|
42
44
|
|
|
43
45
|
UNION ALL
|
|
44
46
|
|
|
45
|
-
SELECT n.item_id, n.user_id, 2 AS priority, i.created_at
|
|
47
|
+
SELECT n.item_id, n.user_id, 2 AS priority, i.created_at, i.link
|
|
46
48
|
FROM item_notes n
|
|
47
49
|
JOIN items i ON i.id = n.item_id
|
|
48
50
|
WHERE n.user_id IN (SELECT value FROM json_each(?))
|
|
@@ -54,7 +56,7 @@ export function scheduleFullTexts() {
|
|
|
54
56
|
|
|
55
57
|
UNION ALL
|
|
56
58
|
|
|
57
|
-
SELECT i.id AS item_id, s.user_id, 1 AS priority, i.created_at
|
|
59
|
+
SELECT i.id AS item_id, s.user_id, 1 AS priority, i.created_at, i.link
|
|
58
60
|
FROM subscriptions s
|
|
59
61
|
JOIN items i ON i.feed_id = s.feed_id
|
|
60
62
|
WHERE s.user_id IN (SELECT value FROM json_each(?))
|
|
@@ -66,8 +68,9 @@ export function scheduleFullTexts() {
|
|
|
66
68
|
)
|
|
67
69
|
SELECT item_id AS id, user_id, MAX(priority) AS priority
|
|
68
70
|
FROM candidate_articles
|
|
71
|
+
WHERE ? = 0 OR background_full_text_paused(link) = 0
|
|
69
72
|
GROUP BY item_id
|
|
70
|
-
ORDER BY (priority + CAST((julianday('now')-julianday(created_at))*1440 / 60 AS INTEGER)) DESC, created_at ASC LIMIT ?`).all(JSON.stringify(eligible), JSON.stringify(eligible), JSON.stringify(eligible), JSON.stringify(eligible), room);
|
|
73
|
+
ORDER BY (priority + CAST((julianday('now')-julianday(created_at))*1440 / 60 AS INTEGER)) DESC, created_at ASC LIMIT ?`).all(JSON.stringify(eligible), JSON.stringify(eligible), JSON.stringify(eligible), JSON.stringify(eligible), pruneFullTextBlocks(), room);
|
|
71
74
|
const add = db.prepare("INSERT OR IGNORE INTO full_text_jobs(item_id, user_id, priority, created_at) VALUES (?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ','now'))");
|
|
72
75
|
let count = 0;
|
|
73
76
|
db.transaction(() => {
|
|
@@ -251,6 +254,11 @@ function pump() {
|
|
|
251
254
|
finishListeners(job.item_id, { ok: false, error: "item_has_no_link" });
|
|
252
255
|
continue;
|
|
253
256
|
}
|
|
257
|
+
// Drop planned work so paused sources cannot fill the queue. The planner can select it again after the pause.
|
|
258
|
+
if (job.priority < 4 && isBackgroundFullTextPaused(host)) {
|
|
259
|
+
db.prepare("DELETE FROM full_text_jobs WHERE item_id=?").run(job.item_id);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
254
262
|
const cooldown = db.prepare("SELECT retry_at FROM full_text_hosts WHERE host=?").get(host);
|
|
255
263
|
if (cooldown && Date.parse(cooldown.retry_at) > Date.now()) {
|
|
256
264
|
db.prepare("UPDATE full_text_jobs SET available_at=? WHERE item_id=?").run(cooldown.retry_at, job.item_id);
|
|
@@ -337,7 +345,7 @@ export function startFullTextScheduler() {
|
|
|
337
345
|
db.prepare("DELETE FROM full_text_hosts WHERE julianday(retry_at) <= julianday(?)").run(new Date().toISOString());
|
|
338
346
|
scheduleFullTexts();
|
|
339
347
|
wake();
|
|
340
|
-
console.log(JSON.stringify({ event: "fulltext_queue", ...fullTextMetrics() }));
|
|
348
|
+
console.log(JSON.stringify({ event: "fulltext_queue", ...fullTextMetrics(), pausedHosts: pruneFullTextBlocks() }));
|
|
341
349
|
};
|
|
342
350
|
// Repair old consent-only caches once; the normal bounded planner performs network work.
|
|
343
351
|
const cached = db.prepare("SELECT id,full_content_html FROM items WHERE full_content_html IS NOT NULL AND (lower(full_content_html) LIKE '%cookie%' OR lower(full_content_html) LIKE '%consent%') LIMIT 100").all();
|
|
@@ -50,23 +50,23 @@ const strings = {
|
|
|
50
50
|
forbidden: "Die Anfrage kam von einer anderen Website und wurde blockiert.",
|
|
51
51
|
},
|
|
52
52
|
ja: {
|
|
53
|
-
passkey: "
|
|
54
|
-
loginTitle: "FeedKeeper
|
|
55
|
-
loginIntro: "{client}
|
|
53
|
+
passkey: "パスキーでログイン",
|
|
54
|
+
loginTitle: "FeedKeeperにログイン",
|
|
55
|
+
loginIntro: "{client}がFeedKeeperアカウントへの接続を求めています。続けるにはログインしてください。",
|
|
56
56
|
email: "メールアドレス",
|
|
57
57
|
password: "パスワード",
|
|
58
|
-
signIn: "
|
|
58
|
+
signIn: "ログイン",
|
|
59
59
|
badLogin: "メールアドレスまたはパスワードが正しくありません。",
|
|
60
60
|
consentTitle: "アクセスを許可しますか?",
|
|
61
|
-
consentIntro: "{client}
|
|
62
|
-
returnsTo: "選択後は
|
|
61
|
+
consentIntro: "{client}がMCP経由でFeedKeeperアカウントにアクセスしようとしています。",
|
|
62
|
+
returnsTo: "選択後は{host}に戻ります。",
|
|
63
63
|
readOnly: "読み取りのみ",
|
|
64
64
|
readOnlyHint: "フィードと記事を参照します。変更はしません。",
|
|
65
65
|
readWrite: "読み取りと書き込み",
|
|
66
|
-
readWriteHint: "
|
|
66
|
+
readWriteHint: "記事の既読化や保存、フィードとフォルダーの管理も行えます。",
|
|
67
67
|
allow: "許可",
|
|
68
68
|
deny: "拒否",
|
|
69
|
-
signedInAs: "{user}
|
|
69
|
+
signedInAs: "{user}としてログイン中",
|
|
70
70
|
errorTitle: "このリクエストは完了できません",
|
|
71
71
|
unknownClient: "このアプリはこのサーバーに登録されていません。",
|
|
72
72
|
badRedirect: "戻り先のアドレスがアプリの登録と一致しません。",
|