kiosko-plugin-news 0.2.3 → 0.3.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/README.md +9 -1
- package/dist/index.js +99 -25
- package/kiosko-manifest.json +68 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ Uses: `news/deck`, `weather/current`.
|
|
|
40
40
|
|---|---|---|---|
|
|
41
41
|
| `rotateMs` | duration (ms) | `30000` | Each story for |
|
|
42
42
|
| `outlets` | list | `[]` | Outlets. Empty: all. Feed names as in the news source (El País, Xataka IA…), comma-separated; * matches anything, a leading ! leaves out. A story carried by several shows the version of one of these. |
|
|
43
|
+
| `topics` | list | `[]` | Topics. Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds «IA», not «familia»). |
|
|
43
44
|
| `showStandfirst` | boolean | `true` | Standfirst. The summary under the headline. Off: the headline alone, with room for longer ones. |
|
|
44
45
|
| `offset` | number | `0` | Skip stories. So two news widgets on one screen don't show the same story. |
|
|
45
46
|
| `showContrast` | boolean | `true` | Two versions side by side. On wide tiles, when two outlets tell the same fact differently. |
|
|
@@ -57,15 +58,22 @@ Uses: `news/deck`, `weather/current`.
|
|
|
57
58
|
|---|---|---|---|
|
|
58
59
|
| `rotateMs` | duration (ms) | `30000` | Each story for |
|
|
59
60
|
| `outlets` | list | `[]` | Outlets. Empty: all. Feed names as in the news source (El País, Xataka IA…), comma-separated; * matches anything, a leading ! leaves out. A story carried by several shows the version of one of these. |
|
|
61
|
+
| `topics` | list | `[]` | Topics. Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds «IA», not «familia»). |
|
|
60
62
|
| `showStandfirst` | boolean | `true` | Standfirst. The summary under the headline. Off: the headline alone, with room for longer ones. |
|
|
61
63
|
| `offset` | number | `1` | Skip stories. So it doesn't repeat the story of a headline widget on the same screen. |
|
|
62
64
|
| `showCorner` | boolean | `true` | Clock and temperature |
|
|
63
65
|
|
|
66
|
+
### Topics without profiles
|
|
67
|
+
|
|
68
|
+
`topics` keeps only the stories that mention some words, in the headline or the standfirst of any outlet's version: `fútbol, liga` for sports, `ia, !apple` for AI without Apple. With the general feeds this already gives a themed tile; profiles are for when the topic has feeds of its own.
|
|
69
|
+
|
|
64
70
|
## Data sources
|
|
65
71
|
|
|
66
72
|
### News deck — `news/deck`
|
|
67
73
|
|
|
68
|
-
Reads the RSS feeds, drops junk and stale items, groups the same story across outlets and orders what to show. Read every 10 min while a widget uses it. Options are set
|
|
74
|
+
Reads the RSS feeds, drops junk and stale items, groups the same story across outlets and orders what to show. Read every 10 min while a widget uses it. Options are set in Kiosko → Settings → Data sources.
|
|
75
|
+
|
|
76
|
+
**Profiles** (Kiosko 0.2.12 and later): the deck can have several named configurations, say «General», «Technology» and «Sports», each with its own feeds (the sections of each paper have their own RSS). Each profile is read on its own and groups its own stories, so «carried by 4 outlets» counts within the profile. A widget picks its profile in the inspector (**Source profile**), where **New profile…** makes one from the tile itself; Settings → Data sources shows them as tabs. A feed that two profiles list is downloaded once. With older Kiosko versions there is one deck, as before.
|
|
69
77
|
|
|
70
78
|
| Option | Type | Default | |
|
|
71
79
|
|---|---|---|---|
|
package/dist/index.js
CHANGED
|
@@ -209,9 +209,9 @@ function overlap(a, b) {
|
|
|
209
209
|
return sharedTerms(a, b) / min;
|
|
210
210
|
}
|
|
211
211
|
function sharedTerms(a, b) {
|
|
212
|
-
let
|
|
213
|
-
for (const w of a) if (b.has(w))
|
|
214
|
-
return
|
|
212
|
+
let shared3 = 0;
|
|
213
|
+
for (const w of a) if (b.has(w)) shared3 += 1;
|
|
214
|
+
return shared3;
|
|
215
215
|
}
|
|
216
216
|
var CJK_LABEL = /^\s*(?:[[【〔((][^\]】〕))]{1,6}[\]】〕))]|[^\s》//||]{1,4}[》//||])\s*/u;
|
|
217
217
|
function withoutLabels(title) {
|
|
@@ -536,8 +536,8 @@ var ZH_HANT = (now) => [
|
|
|
536
536
|
),
|
|
537
537
|
item(
|
|
538
538
|
"\u65B0\u805E 24",
|
|
539
|
-
"\u8DE8\u5E74\
|
|
540
|
-
"12 \u6708
|
|
539
|
+
"\u8DE8\u5E74\u591C\u6377\u904B\u901A\u5BB5\u884C\u99DB",
|
|
540
|
+
"12 \u6708 31 \u65E5\u4E3B\u8981\u8DEF\u7DDA\u4E0D\u6536\u73ED\uFF0C\u51CC\u6668 1 \u9EDE\u5F8C\u6BCF 15 \u5206\u9418\u4E00\u73ED\u3002",
|
|
541
541
|
"city",
|
|
542
542
|
48,
|
|
543
543
|
now,
|
|
@@ -601,8 +601,8 @@ var ZH_HANS = (now) => [
|
|
|
601
601
|
),
|
|
602
602
|
item(
|
|
603
603
|
"\u65B0\u95FB 24",
|
|
604
|
-
"\
|
|
605
|
-
"12 \u6708
|
|
604
|
+
"\u8DE8\u5E74\u591C\u5730\u94C1\u901A\u5BB5\u8FD0\u8425",
|
|
605
|
+
"12 \u6708 31 \u65E5\u4E3B\u8981\u7EBF\u8DEF\u4E0D\u505C\u8FD0\uFF0C\u51CC\u6668 1 \u70B9\u540E\u6BCF 15 \u5206\u949F\u4E00\u73ED\u3002",
|
|
606
606
|
"city",
|
|
607
607
|
48,
|
|
608
608
|
now,
|
|
@@ -773,15 +773,18 @@ function demoDeck(now, locale = "en") {
|
|
|
773
773
|
return { stories, updated: now - 3 * MIN, failed: [] };
|
|
774
774
|
}
|
|
775
775
|
function demoCornerWeather(now, locale = "en") {
|
|
776
|
+
const city2 = localize({ en: "madrid", es: "madrid", de: "madrid", "zh-Hant": "taipei", "zh-Hans": "shanghai" }, locale);
|
|
777
|
+
const warmer = city2 === "taipei" ? 7 : 0;
|
|
778
|
+
const place = city2 === "taipei" ? { en: "Taipei", es: "Taip\xE9i", de: "Taipeh", "zh-Hant": "\u81FA\u5317", "zh-Hans": "\u53F0\u5317" } : city2 === "shanghai" ? { en: "Shanghai", es: "Shangh\xE1i", de: "Shanghai", "zh-Hant": "\u4E0A\u6D77", "zh-Hans": "\u4E0A\u6D77" } : { en: "Madrid", es: "Madrid", de: "Madrid", "zh-Hant": "\u99AC\u5FB7\u91CC", "zh-Hans": "\u9A6C\u5FB7\u91CC" };
|
|
776
779
|
return {
|
|
777
|
-
place: localize(
|
|
778
|
-
temp: 14,
|
|
779
|
-
feels: 12,
|
|
780
|
+
place: localize(place, locale),
|
|
781
|
+
temp: 14 + warmer,
|
|
782
|
+
feels: 12 + warmer,
|
|
780
783
|
code: 2,
|
|
781
784
|
humidity: 60,
|
|
782
785
|
wind: 10,
|
|
783
786
|
night: false,
|
|
784
|
-
days: [{ date: new Date(now).toISOString().slice(0, 10), code: 2, min: 6, max: 16, rain: 10 }],
|
|
787
|
+
days: [{ date: new Date(now).toISOString().slice(0, 10), code: 2, min: 6 + warmer, max: 16 + warmer, rain: 10 }],
|
|
785
788
|
hours: [],
|
|
786
789
|
fetched: now - 5 * MIN
|
|
787
790
|
};
|
|
@@ -966,6 +969,29 @@ function applyFilter(items, feed, log = () => {
|
|
|
966
969
|
}
|
|
967
970
|
return items.filter((it) => re.test(it.title));
|
|
968
971
|
}
|
|
972
|
+
var FEED_SHARE_MS = 9e4;
|
|
973
|
+
var shared = /* @__PURE__ */ new Map();
|
|
974
|
+
function fetchShared(url, timeoutMs, signal, now = Date.now()) {
|
|
975
|
+
for (const [k, v] of shared) if (now - v.at >= FEED_SHARE_MS) shared.delete(k);
|
|
976
|
+
let hit = shared.get(url);
|
|
977
|
+
if (!hit) {
|
|
978
|
+
const text = fetchText(url, timeoutMs);
|
|
979
|
+
hit = { at: now, text };
|
|
980
|
+
shared.set(url, hit);
|
|
981
|
+
text.catch(() => {
|
|
982
|
+
if (shared.get(url)?.text === text) shared.delete(url);
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
return signal ? untilAborted(hit.text, signal) : hit.text;
|
|
986
|
+
}
|
|
987
|
+
function untilAborted(p, signal) {
|
|
988
|
+
if (signal.aborted) return Promise.reject(signal.reason);
|
|
989
|
+
return new Promise((resolve, reject) => {
|
|
990
|
+
const stop = () => reject(signal.reason);
|
|
991
|
+
signal.addEventListener("abort", stop, { once: true });
|
|
992
|
+
p.then(resolve, reject).finally(() => signal.removeEventListener("abort", stop));
|
|
993
|
+
});
|
|
994
|
+
}
|
|
969
995
|
async function fetchText(url, timeoutMs, signal) {
|
|
970
996
|
const timeout = AbortSignal.timeout(timeoutMs);
|
|
971
997
|
const res = await fetch(url, {
|
|
@@ -990,7 +1016,7 @@ async function fetchAllFeeds(feeds, o) {
|
|
|
990
1016
|
}
|
|
991
1017
|
const results = await Promise.allSettled(
|
|
992
1018
|
feeds.map(async (f) => {
|
|
993
|
-
const parsed = parseFeed(await
|
|
1019
|
+
const parsed = parseFeed(await fetchShared(f.url, o.timeoutMs, o.signal), f.name);
|
|
994
1020
|
return { parsed, kept: applyFilter(parsed, f, log) };
|
|
995
1021
|
})
|
|
996
1022
|
);
|
|
@@ -1515,10 +1541,10 @@ function interleaveBySource(stories, limit) {
|
|
|
1515
1541
|
var LEAD_STORIES = 6;
|
|
1516
1542
|
function buildDeck(items, poolSize) {
|
|
1517
1543
|
const stories = clusterStories(items);
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
const lead =
|
|
1521
|
-
const rest = [...
|
|
1544
|
+
const shared3 = stories.filter((s) => s.consensus > 1);
|
|
1545
|
+
shared3.sort((a, b) => b.consensus - a.consensus || b.lead.published - a.lead.published);
|
|
1546
|
+
const lead = shared3.slice(0, LEAD_STORIES);
|
|
1547
|
+
const rest = [...shared3.slice(LEAD_STORIES), ...stories.filter((s) => s.consensus === 1)];
|
|
1522
1548
|
const deck2 = lead.slice(0, poolSize);
|
|
1523
1549
|
if (deck2.length < poolSize) deck2.push(...interleaveBySource(rest, poolSize - deck2.length));
|
|
1524
1550
|
return deck2;
|
|
@@ -1529,8 +1555,41 @@ function storyAt(deck2, now, rotateMs, ahead = 0) {
|
|
|
1529
1555
|
return deck2[(slot % deck2.length + deck2.length) % deck2.length];
|
|
1530
1556
|
}
|
|
1531
1557
|
|
|
1558
|
+
// src/topics.ts
|
|
1559
|
+
function foldText(text) {
|
|
1560
|
+
return foldHan(text.normalize("NFD").replace(new RegExp("\\p{M}", "gu"), "").normalize("NFC").toLowerCase()).replace(/\s+/g, " ").trim();
|
|
1561
|
+
}
|
|
1562
|
+
var HAN = new RegExp("\\p{Script=Han}", "u");
|
|
1563
|
+
var escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1564
|
+
function matcher(word) {
|
|
1565
|
+
const w = foldText(word);
|
|
1566
|
+
if (!w) return () => false;
|
|
1567
|
+
if (HAN.test(w)) return (text) => text.includes(w);
|
|
1568
|
+
const re = new RegExp(`(?:^|[^\\p{L}\\p{N}])${escape(w)}`, "u");
|
|
1569
|
+
return (text) => re.test(text);
|
|
1570
|
+
}
|
|
1571
|
+
function parseTopics(topics) {
|
|
1572
|
+
const list = (typeof topics === "string" ? topics.split(/[,\n]/) : topics ?? []).map((x) => x.trim()).filter((x) => x && x !== "!");
|
|
1573
|
+
return {
|
|
1574
|
+
include: list.filter((x) => !x.startsWith("!")).map(matcher),
|
|
1575
|
+
exclude: list.filter((x) => x.startsWith("!")).map((x) => matcher(x.slice(1).trim()))
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
function storyMatches(story, t2) {
|
|
1579
|
+
if (!t2.include.length && !t2.exclude.length) return true;
|
|
1580
|
+
const text = foldText(story.items.map((it) => `${it.title}
|
|
1581
|
+
${it.summary}`).join(" \n "));
|
|
1582
|
+
if (t2.exclude.some((m) => m(text))) return false;
|
|
1583
|
+
return !t2.include.length || t2.include.some((m) => m(text));
|
|
1584
|
+
}
|
|
1585
|
+
function storiesAbout(stories, topics) {
|
|
1586
|
+
const t2 = parseTopics(topics);
|
|
1587
|
+
return t2.include.length || t2.exclude.length ? stories.filter((s) => storyMatches(s, t2)) : [...stories];
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1532
1590
|
// src/index.ts
|
|
1533
1591
|
var DECK_FILE = "deck.json";
|
|
1592
|
+
var deckFile = (profile) => profile ? `deck-${profile.replace(/[^a-z0-9_-]/gi, "_")}.json` : DECK_FILE;
|
|
1534
1593
|
var DECK_MAX_AGE_MS = 24 * 36e5;
|
|
1535
1594
|
var IMAGE_MAX_AGE_HOURS = 12;
|
|
1536
1595
|
var cacheOf = (ctx) => ctx.cacheDir || ctx.dataDir;
|
|
@@ -1539,7 +1598,7 @@ var PHOTO_TRIES = 4;
|
|
|
1539
1598
|
var feedItem = t.object({
|
|
1540
1599
|
name: t.string({ label: { en: "Name", es: "Nombre", "zh-Hant": "\u540D\u7A31", "zh-Hans": "\u540D\u79F0", de: "Name" }, placeholder: "El Pa\xEDs", help: { en: 'Shown on screen. Ending in " IA" marks a topic feed of the same outlet.', es: "Sale en pantalla. Acabar en \xAB IA\xBB marca un feed tem\xE1tico de la misma cabecera.", "zh-Hant": "\u986F\u793A\u5728\u87A2\u5E55\u4E0A\u3002\u4EE5\u300C IA\u300D\u7D50\u5C3E\u8868\u793A\u540C\u4E00\u5BB6\u5A92\u9AD4\u7684\u4E3B\u984C\u8A02\u95B1\u6E90\u3002", "zh-Hans": "\u663E\u793A\u5728\u5C4F\u5E55\u4E0A\u3002\u4EE5\u201C IA\u201D\u7ED3\u5C3E\u8868\u793A\u540C\u4E00\u5BB6\u5A92\u4F53\u7684\u4E3B\u9898\u8BA2\u9605\u6E90\u3002", de: "Wird auf dem Bildschirm angezeigt. Endet der Name auf \u201E KI\u201C (oder \u201E IA\u201C, \u201E AI\u201C), ist es ein Themen-Feed desselben Mediums." } }),
|
|
1541
1600
|
url: t.string({ format: "url", risk: "network", label: { en: "RSS URL", es: "URL del RSS", "zh-Hant": "RSS \u7DB2\u5740", "zh-Hans": "RSS \u7F51\u5740", de: "RSS-URL" } }),
|
|
1542
|
-
titleFilter: t.string({ advanced: true, label: { en: "Headline filter (regex)", es: "Filtro de titular (regex)", "zh-Hant": "\u6A19\u984C\u7BE9\u9078\
|
|
1601
|
+
titleFilter: t.string({ advanced: true, label: { en: "Headline filter (regex)", es: "Filtro de titular (regex)", "zh-Hant": "\u6A19\u984C\u7BE9\u9078\uFF08\u6B63\u898F\u8868\u793A\u5F0F\uFF09", "zh-Hans": "\u6807\u9898\u8FC7\u6EE4\uFF08\u6B63\u5219\uFF09", de: "Schlagzeilenfilter (Regex)" }, help: { en: "Only headlines matching it stay.", es: "S\xF3lo quedan los titulares que casan.", "zh-Hant": "\u53EA\u4FDD\u7559\u7B26\u5408\u7684\u6A19\u984C\u3002", "zh-Hans": "\u53EA\u4FDD\u7559\u5339\u914D\u7684\u6807\u9898\u3002", de: "Nur passende Schlagzeilen bleiben." } }),
|
|
1543
1602
|
maxAgeMs: t.duration({ default: 0, max: 30 * 24 * 36e5, advanced: true, label: { en: "Maximum age", es: "Antig\xFCedad m\xE1xima", "zh-Hant": "\u6700\u9577\u6642\u6548", "zh-Hans": "\u6700\u957F\u65F6\u6548", de: "Maximales Alter" }, help: { en: "0: the general one.", es: "0: la general.", "zh-Hant": "0\uFF1A\u4F7F\u7528\u6574\u9AD4\u8A2D\u5B9A\u3002", "zh-Hans": "0\uFF1A\u4F7F\u7528\u603B\u4F53\u8BBE\u7F6E\u3002", de: "0: der allgemeine Wert." } })
|
|
1544
1603
|
});
|
|
1545
1604
|
var deck = defineSource({
|
|
@@ -1568,9 +1627,11 @@ var deck = defineSource({
|
|
|
1568
1627
|
}),
|
|
1569
1628
|
topic: t.enum(["all", "ai"], { label: { en: "Topic", es: "Tema", "zh-Hant": "\u4E3B\u984C", "zh-Hans": "\u4E3B\u9898", de: "Thema" }, labels: { all: { en: "Everything", es: "Todo", "zh-Hant": "\u5168\u90E8", "zh-Hans": "\u5168\u90E8", de: "Alles" }, ai: { en: "Only AI", es: "S\xF3lo IA", "zh-Hant": "\u53EA\u770B AI", "zh-Hans": "\u53EA\u770B AI", de: "Nur KI" } } }),
|
|
1570
1629
|
maxAgeMs: t.duration({ default: DEFAULT_MAX_AGE_MS, max: 30 * 24 * 36e5, label: { en: "Maximum age", es: "Antig\xFCedad m\xE1xima", "zh-Hant": "\u6700\u9577\u6642\u6548", "zh-Hans": "\u6700\u957F\u65F6\u6548", de: "Maximales Alter" }, help: { en: "0: no limit (undated items then pass too).", es: "0: sin l\xEDmite (pasan tambi\xE9n las que no traen fecha).", "zh-Hant": "0\uFF1A\u4E0D\u9650\uFF08\u6C92\u6709\u65E5\u671F\u7684\u9805\u76EE\u4E5F\u6703\u901A\u904E\uFF09\u3002", "zh-Hans": "0\uFF1A\u4E0D\u9650\uFF08\u6CA1\u6709\u65E5\u671F\u7684\u6761\u76EE\u4E5F\u4F1A\u901A\u8FC7\uFF09\u3002", de: "0: unbegrenzt (dann kommen auch Meldungen ohne Datum durch)." } }),
|
|
1571
|
-
rejectFilter: t.string({ default: JUNK_TITLE_FILTER, advanced: true, multiline: true, label: { en: "Discard headlines (regex)", es: "Descartar titulares (regex)", "zh-Hant": "\u6392\u9664\u6A19\u984C\
|
|
1630
|
+
rejectFilter: t.string({ default: JUNK_TITLE_FILTER, advanced: true, multiline: true, label: { en: "Discard headlines (regex)", es: "Descartar titulares (regex)", "zh-Hant": "\u6392\u9664\u6A19\u984C\uFF08\u6B63\u898F\u8868\u793A\u5F0F\uFF09", "zh-Hans": "\u6392\u9664\u6807\u9898\uFF08\u6B63\u5219\uFF09", de: "Schlagzeilen verwerfen (Regex)" }, help: { en: "Case-insensitive. Empty: keep everything.", es: "Sin distinguir may\xFAsculas. Vac\xEDo: no se descarta nada.", "zh-Hant": "\u4E0D\u5206\u5927\u5C0F\u5BEB\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u4FDD\u7559\u3002", "zh-Hans": "\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u3002\u7559\u7A7A\uFF1A\u5168\u90E8\u4FDD\u7559\u3002", de: "Gro\xDF-/Kleinschreibung egal. Leer: nichts wird verworfen." } }),
|
|
1572
1631
|
maxStories: t.integer({ min: 5, max: 200, default: 60, advanced: true, label: { en: "Stories in the deck", es: "Historias en el mazo", "zh-Hant": "\u724C\u7D44\u4E2D\u7684\u65B0\u805E\u6578", "zh-Hans": "\u5361\u7EC4\u4E2D\u7684\u65B0\u95FB\u6570", de: "Meldungen im Stapel" } })
|
|
1573
1632
|
}),
|
|
1633
|
+
// Several decks («General», «Technology»…), each with its feeds: Kiosko 0.2.12 and later; older ones ignore it.
|
|
1634
|
+
...{ profiles: true },
|
|
1574
1635
|
intervalMs: 10 * 6e4,
|
|
1575
1636
|
// A dozen outlets per read: more often than every two minutes is only noise for them.
|
|
1576
1637
|
minIntervalMs: 2 * 6e4,
|
|
@@ -1587,7 +1648,7 @@ var deck = defineSource({
|
|
|
1587
1648
|
titleFilter: (ai2 ? AI_TITLE_FILTER : f.titleFilter.trim()) || void 0,
|
|
1588
1649
|
maxAgeMs: f.maxAgeMs || (ai2 ? AI_MAX_AGE_MS : void 0)
|
|
1589
1650
|
}));
|
|
1590
|
-
const file = join2(cacheOf(ctx),
|
|
1651
|
+
const file = join2(cacheOf(ctx), deckFile(ctx.profile));
|
|
1591
1652
|
pruneImageCache(imageDir(ctx), IMAGE_MAX_AGE_HOURS, ctx.now);
|
|
1592
1653
|
const timeoutMs = Math.max(1e3, Math.round(ctx.timeoutMs * 0.6));
|
|
1593
1654
|
const harvest = await fetchAllFeeds(feeds, { timeoutMs, log: ctx.log, rejectFilter: o.rejectFilter.trim(), maxAgeMs: o.maxAgeMs, now: ctx.now, signal: ctx.signal });
|
|
@@ -1623,7 +1684,7 @@ function loadDeck(file, now) {
|
|
|
1623
1684
|
return null;
|
|
1624
1685
|
}
|
|
1625
1686
|
}
|
|
1626
|
-
var
|
|
1687
|
+
var shared2 = {
|
|
1627
1688
|
rotateMs: t.duration({ min: 1e4, max: 36e5, default: 3e4, label: { en: "Each story for", es: "Cada noticia durante", "zh-Hant": "\u6BCF\u5247\u65B0\u805E\u986F\u793A", "zh-Hans": "\u6BCF\u6761\u65B0\u95FB\u663E\u793A", de: "Jede Meldung f\xFCr" } }),
|
|
1628
1689
|
outlets: t.filter({
|
|
1629
1690
|
choices: { source: "news/deck", list: "outlets" },
|
|
@@ -1636,6 +1697,18 @@ var shared = {
|
|
|
1636
1697
|
de: "Leer: alle. Feed-Namen wie in der Nachrichten-Datenquelle (tagesschau, heise KI\u2026), durch Kommas getrennt; * steht f\xFCr beliebigen Text, ein vorangestelltes ! schlie\xDFt aus. Von einer Meldung mehrerer Medien wird die Fassung eines dieser Medien gezeigt."
|
|
1637
1698
|
}
|
|
1638
1699
|
}),
|
|
1700
|
+
// A filter (one line, comma-separated) of words, not of names: its own placeholder.
|
|
1701
|
+
topics: t.list(t.string({ placeholder: "NASA, Mars, !SpaceX" }), {
|
|
1702
|
+
filter: true,
|
|
1703
|
+
label: { en: "Topics", es: "Temas", "zh-Hant": "\u4E3B\u984C", "zh-Hans": "\u4E3B\u9898", de: "Themen" },
|
|
1704
|
+
help: {
|
|
1705
|
+
en: "Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds \xABIA\xBB, not \xABfamilia\xBB).",
|
|
1706
|
+
es: "Vac\xEDo: todas las noticias. Palabras que se buscan en el titular y la entradilla, separadas por comas: queda la noticia que mencione alguna; un ! delante deja fuera las que la mencionan. Da igual may\xFAsculas y tildes, y la palabra casa al principio de palabra (ia encuentra \xABIA\xBB, no \xABfamilia\xBB).",
|
|
1707
|
+
"zh-Hant": "\u7559\u7A7A\uFF1A\u5168\u90E8\u65B0\u805E\u3002\u5728\u6A19\u984C\u8207\u5C0E\u8A00\u4E2D\u5C0B\u627E\u7684\u8A5E\uFF0C\u4EE5\u9017\u865F\u5206\u9694\uFF1A\u63D0\u5230\u5176\u4E2D\u4EFB\u4E00\u8A5E\u7684\u65B0\u805E\u6703\u4FDD\u7559\uFF1B\u958B\u982D\u52A0 ! \u5247\u6392\u9664\u63D0\u5230\u5B83\u7684\u65B0\u805E\u3002\u4E0D\u5206\u5927\u5C0F\u5BEB\u8207\u91CD\u97F3\uFF0C\u7E41\u9AD4\u8207\u7C21\u9AD4\u7686\u53EF\u3002",
|
|
1708
|
+
"zh-Hans": "\u7559\u7A7A\uFF1A\u5168\u90E8\u65B0\u95FB\u3002\u5728\u6807\u9898\u548C\u5BFC\u8BED\u4E2D\u67E5\u627E\u7684\u8BCD\uFF0C\u7528\u9017\u53F7\u5206\u9694\uFF1A\u63D0\u5230\u5176\u4E2D\u4EFB\u4E00\u8BCD\u7684\u65B0\u95FB\u4F1A\u4FDD\u7559\uFF1B\u5F00\u5934\u52A0 ! \u5219\u6392\u9664\u63D0\u5230\u5B83\u7684\u65B0\u95FB\u3002\u4E0D\u533A\u5206\u5927\u5C0F\u5199\u548C\u91CD\u97F3\uFF0C\u7E41\u4F53\u548C\u7B80\u4F53\u5747\u53EF\u3002",
|
|
1709
|
+
de: "Leer: alle Meldungen. W\xF6rter, die in Schlagzeile und Vorspann gesucht werden, durch Kommas getrennt: Eine Meldung bleibt, wenn sie eines davon erw\xE4hnt; ein vorangestelltes ! schlie\xDFt die aus, die es erw\xE4hnen. Gro\xDF-/Kleinschreibung und Akzente egal; ein Wort passt am Wortanfang (ki findet \u201EKI\u201C, nicht \u201EWiki\u201C)."
|
|
1710
|
+
}
|
|
1711
|
+
}),
|
|
1639
1712
|
showStandfirst: t.boolean({ default: true, label: { en: "Standfirst", es: "Entradilla", "zh-Hant": "\u5C0E\u8A00", "zh-Hans": "\u5BFC\u8BED", de: "Vorspann" }, help: { en: "The summary under the headline. Off: the headline alone, with room for longer ones.", es: "El resumen bajo el titular. Apagado: el titular solo, con sitio para los largos.", "zh-Hant": "\u6A19\u984C\u4E0B\u65B9\u7684\u6458\u8981\u3002\u95DC\u9589\uFF1A\u53EA\u986F\u793A\u6A19\u984C\uFF0C\u53EF\u5BB9\u7D0D\u8F03\u9577\u7684\u6A19\u984C\u3002", "zh-Hans": "\u6807\u9898\u4E0B\u65B9\u7684\u6458\u8981\u3002\u5173\u95ED\uFF1A\u53EA\u663E\u793A\u6807\u9898\uFF0C\u53EF\u5BB9\u7EB3\u8F83\u957F\u7684\u6807\u9898\u3002", de: "Die Zusammenfassung unter der Schlagzeile. Aus: nur die Schlagzeile, mit Platz f\xFCr l\xE4ngere." } })
|
|
1640
1713
|
};
|
|
1641
1714
|
var DEMO_PHOTO = "demo:";
|
|
@@ -1650,7 +1723,7 @@ function storiesFor(stories, outlets) {
|
|
|
1650
1723
|
}
|
|
1651
1724
|
return out;
|
|
1652
1725
|
}
|
|
1653
|
-
var storiesOf = (sources, o) => storiesFor(deckOf(sources)?.stories ?? [], o.outlets);
|
|
1726
|
+
var storiesOf = (sources, o) => storiesAbout(storiesFor(deckOf(sources)?.stories ?? [], o.outlets), o.topics);
|
|
1654
1727
|
async function pickShot(ctx) {
|
|
1655
1728
|
const stories = storiesOf(ctx.sources, ctx.options);
|
|
1656
1729
|
if (!stories.length) return void 0;
|
|
@@ -1684,7 +1757,7 @@ function painter(ctx, g) {
|
|
|
1684
1757
|
var demoOf = (url) => url?.startsWith(DEMO_PHOTO) ? url.slice(DEMO_PHOTO.length) : null;
|
|
1685
1758
|
function demoShot(o, now, locale = "en") {
|
|
1686
1759
|
const d = demoDeck(now, locale);
|
|
1687
|
-
const s = storyAt(storiesFor(d.stories, o.outlets ?? []), now, o.rotateMs, o.offset) ?? d.stories[0];
|
|
1760
|
+
const s = storyAt(storiesAbout(storiesFor(d.stories, o.outlets ?? []), o.topics), now, o.rotateMs, o.offset) ?? d.stories[0];
|
|
1688
1761
|
return { data: { link: s.lead.link, photo: s.lead.image }, sources: { "news/deck": d, "weather/current": demoCornerWeather(now, locale) } };
|
|
1689
1762
|
}
|
|
1690
1763
|
var headline = defineWidget({
|
|
@@ -1703,7 +1776,7 @@ var headline = defineWidget({
|
|
|
1703
1776
|
chrome: "bare",
|
|
1704
1777
|
size: { min: { w: 480, h: 200 }, preferred: { w: 1920, h: 462 } },
|
|
1705
1778
|
options: t.object({
|
|
1706
|
-
...
|
|
1779
|
+
...shared2,
|
|
1707
1780
|
offset: t.integer({ min: 0, max: 50, default: 0, advanced: true, label: { en: "Skip stories", es: "Saltar noticias", "zh-Hant": "\u7565\u904E\u65B0\u805E", "zh-Hans": "\u8DF3\u8FC7\u65B0\u95FB", de: "Meldungen \xFCberspringen" }, help: { en: "So two news widgets on one screen don't show the same story.", es: "Para que dos widgets de noticias en una pantalla no ense\xF1en la misma.", "zh-Hant": "\u8B93\u540C\u4E00\u87A2\u5E55\u4E0A\u7684\u5169\u500B\u65B0\u805E\u5C0F\u5DE5\u5177\u4E0D\u6703\u986F\u793A\u540C\u4E00\u5247\u65B0\u805E\u3002", "zh-Hans": "\u8BA9\u540C\u4E00\u5C4F\u5E55\u4E0A\u7684\u4E24\u4E2A\u65B0\u95FB\u5C0F\u7EC4\u4EF6\u4E0D\u4F1A\u663E\u793A\u540C\u4E00\u6761\u65B0\u95FB\u3002", de: "Damit zwei Nachrichten-Widgets auf einem Bildschirm nicht dieselbe Meldung zeigen." } }),
|
|
1708
1781
|
showContrast: t.boolean({ default: true, label: { en: "Two versions side by side", es: "Dos versiones lado a lado", "zh-Hant": "\u5169\u500B\u7248\u672C\u4E26\u6392", "zh-Hans": "\u4E24\u4E2A\u7248\u672C\u5E76\u6392", de: "Zwei Fassungen nebeneinander" }, help: { en: "On wide tiles, when two outlets tell the same fact differently.", es: "En teselas anchas, cuando dos cabeceras cuentan el mismo hecho de forma distinta.", "zh-Hant": "\u7528\u65BC\u5BEC\u65B9\u683C\uFF0C\u7576\u5169\u5BB6\u5A92\u9AD4\u5C0D\u540C\u4E00\u4EF6\u4E8B\u8AAA\u6CD5\u4E0D\u540C\u6642\u3002", "zh-Hans": "\u7528\u4E8E\u5BBD\u683C\u5B50\uFF0C\u5F53\u4E24\u5BB6\u5A92\u4F53\u5BF9\u540C\u4E00\u4EF6\u4E8B\u8BF4\u6CD5\u4E0D\u540C\u65F6\u3002", de: "Auf breiten Kacheln, wenn zwei Medien dasselbe unterschiedlich erz\xE4hlen." } }),
|
|
1709
1782
|
showCorner: t.boolean({ default: true, label: { en: "Clock and weather", es: "Reloj y tiempo", "zh-Hant": "\u6642\u9418\u8207\u5929\u6C23", "zh-Hans": "\u65F6\u949F\u548C\u5929\u6C14", de: "Uhr und Wetter" } })
|
|
@@ -1739,7 +1812,7 @@ var column = defineWidget({
|
|
|
1739
1812
|
chrome: "bare",
|
|
1740
1813
|
size: { min: { w: 240, h: 240 }, preferred: { w: 600, h: 462 } },
|
|
1741
1814
|
options: t.object({
|
|
1742
|
-
...
|
|
1815
|
+
...shared2,
|
|
1743
1816
|
offset: t.integer({ min: 0, max: 50, default: 1, advanced: true, label: { en: "Skip stories", es: "Saltar noticias", "zh-Hant": "\u7565\u904E\u65B0\u805E", "zh-Hans": "\u8DF3\u8FC7\u65B0\u95FB", de: "Meldungen \xFCberspringen" }, help: { en: "So it doesn't repeat the story of a headline widget on the same screen.", es: "Para no repetir la noticia de un titular en la misma pantalla.", "zh-Hant": "\u907F\u514D\u91CD\u8907\u540C\u4E00\u87A2\u5E55\u4E0A\u982D\u689D\u5C0F\u5DE5\u5177\u7684\u65B0\u805E\u3002", "zh-Hans": "\u907F\u514D\u91CD\u590D\u540C\u4E00\u5C4F\u5E55\u4E0A\u5934\u6761\u5C0F\u7EC4\u4EF6\u7684\u65B0\u95FB\u3002", de: "Damit es nicht die Meldung eines Schlagzeilen-Widgets auf demselben Bildschirm wiederholt." } }),
|
|
1744
1817
|
showCorner: t.boolean({ default: true, label: { en: "Clock and temperature", es: "Reloj y temperatura", "zh-Hant": "\u6642\u9418\u8207\u6EAB\u5EA6", "zh-Hans": "\u65F6\u949F\u548C\u6E29\u5EA6", de: "Uhr und Temperatur" } })
|
|
1745
1818
|
}),
|
|
@@ -1760,7 +1833,7 @@ var column = defineWidget({
|
|
|
1760
1833
|
var index_default = definePlugin({
|
|
1761
1834
|
id: "news",
|
|
1762
1835
|
name: { en: "News", es: "Noticias", "zh-Hant": "\u65B0\u805E", "zh-Hans": "\u65B0\u95FB", de: "Nachrichten" },
|
|
1763
|
-
version: "0.
|
|
1836
|
+
version: "0.3.0",
|
|
1764
1837
|
languages: ["en", "es", "zh-Hant", "zh-Hans", "de"],
|
|
1765
1838
|
sdk: "^0.2.0",
|
|
1766
1839
|
permissions: { network: ["user"] },
|
|
@@ -1804,6 +1877,7 @@ var index_default = definePlugin({
|
|
|
1804
1877
|
export {
|
|
1805
1878
|
column,
|
|
1806
1879
|
deck,
|
|
1880
|
+
deckFile,
|
|
1807
1881
|
index_default as default,
|
|
1808
1882
|
headline,
|
|
1809
1883
|
storiesFor
|
package/kiosko-manifest.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"zh-Hans": "新闻",
|
|
10
10
|
"de": "Nachrichten"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.3.0",
|
|
13
13
|
"description": {
|
|
14
14
|
"en": "Press headlines from RSS feeds with their photos. No keys and no AI: consensus across outlets measured with plain set overlap.",
|
|
15
15
|
"es": "Titulares de prensa de los RSS con su foto. Sin claves ni IA: el consenso entre cabeceras se mide con solapamiento de términos.",
|
|
@@ -115,6 +115,7 @@
|
|
|
115
115
|
"default": {
|
|
116
116
|
"rotateMs": 30000,
|
|
117
117
|
"outlets": [],
|
|
118
|
+
"topics": [],
|
|
118
119
|
"showStandfirst": true,
|
|
119
120
|
"offset": 0,
|
|
120
121
|
"showContrast": true,
|
|
@@ -179,6 +180,37 @@
|
|
|
179
180
|
},
|
|
180
181
|
"x-filter": true
|
|
181
182
|
},
|
|
183
|
+
"topics": {
|
|
184
|
+
"title": "Topics",
|
|
185
|
+
"description": "Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds «IA», not «familia»).",
|
|
186
|
+
"default": [],
|
|
187
|
+
"x-ui": {
|
|
188
|
+
"label": {
|
|
189
|
+
"en": "Topics",
|
|
190
|
+
"es": "Temas",
|
|
191
|
+
"zh-Hant": "主題",
|
|
192
|
+
"zh-Hans": "主题",
|
|
193
|
+
"de": "Themen"
|
|
194
|
+
},
|
|
195
|
+
"help": {
|
|
196
|
+
"en": "Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds «IA», not «familia»).",
|
|
197
|
+
"es": "Vacío: todas las noticias. Palabras que se buscan en el titular y la entradilla, separadas por comas: queda la noticia que mencione alguna; un ! delante deja fuera las que la mencionan. Da igual mayúsculas y tildes, y la palabra casa al principio de palabra (ia encuentra «IA», no «familia»).",
|
|
198
|
+
"zh-Hant": "留空:全部新聞。在標題與導言中尋找的詞,以逗號分隔:提到其中任一詞的新聞會保留;開頭加 ! 則排除提到它的新聞。不分大小寫與重音,繁體與簡體皆可。",
|
|
199
|
+
"zh-Hans": "留空:全部新闻。在标题和导语中查找的词,用逗号分隔:提到其中任一词的新闻会保留;开头加 ! 则排除提到它的新闻。不区分大小写和重音,繁体和简体均可。",
|
|
200
|
+
"de": "Leer: alle Meldungen. Wörter, die in Schlagzeile und Vorspann gesucht werden, durch Kommas getrennt: Eine Meldung bleibt, wenn sie eines davon erwähnt; ein vorangestelltes ! schließt die aus, die es erwähnen. Groß-/Kleinschreibung und Akzente egal; ein Wort passt am Wortanfang (ki findet „KI“, nicht „Wiki“)."
|
|
201
|
+
},
|
|
202
|
+
"widget": "filter"
|
|
203
|
+
},
|
|
204
|
+
"type": "array",
|
|
205
|
+
"items": {
|
|
206
|
+
"default": "",
|
|
207
|
+
"x-ui": {
|
|
208
|
+
"placeholder": "NASA, Mars, !SpaceX"
|
|
209
|
+
},
|
|
210
|
+
"type": "string"
|
|
211
|
+
},
|
|
212
|
+
"x-filter": true
|
|
213
|
+
},
|
|
182
214
|
"showStandfirst": {
|
|
183
215
|
"title": "Standfirst",
|
|
184
216
|
"description": "The summary under the headline. Off: the headline alone, with room for longer ones.",
|
|
@@ -311,6 +343,7 @@
|
|
|
311
343
|
"default": {
|
|
312
344
|
"rotateMs": 30000,
|
|
313
345
|
"outlets": [],
|
|
346
|
+
"topics": [],
|
|
314
347
|
"showStandfirst": true,
|
|
315
348
|
"offset": 1,
|
|
316
349
|
"showCorner": true
|
|
@@ -374,6 +407,37 @@
|
|
|
374
407
|
},
|
|
375
408
|
"x-filter": true
|
|
376
409
|
},
|
|
410
|
+
"topics": {
|
|
411
|
+
"title": "Topics",
|
|
412
|
+
"description": "Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds «IA», not «familia»).",
|
|
413
|
+
"default": [],
|
|
414
|
+
"x-ui": {
|
|
415
|
+
"label": {
|
|
416
|
+
"en": "Topics",
|
|
417
|
+
"es": "Temas",
|
|
418
|
+
"zh-Hant": "主題",
|
|
419
|
+
"zh-Hans": "主题",
|
|
420
|
+
"de": "Themen"
|
|
421
|
+
},
|
|
422
|
+
"help": {
|
|
423
|
+
"en": "Empty: every story. Words looked for in the headline and standfirst, comma-separated: a story stays if it mentions any; a leading ! leaves out the ones that mention it. Case and accents don't matter, and a word matches at the start of a word (ia finds «IA», not «familia»).",
|
|
424
|
+
"es": "Vacío: todas las noticias. Palabras que se buscan en el titular y la entradilla, separadas por comas: queda la noticia que mencione alguna; un ! delante deja fuera las que la mencionan. Da igual mayúsculas y tildes, y la palabra casa al principio de palabra (ia encuentra «IA», no «familia»).",
|
|
425
|
+
"zh-Hant": "留空:全部新聞。在標題與導言中尋找的詞,以逗號分隔:提到其中任一詞的新聞會保留;開頭加 ! 則排除提到它的新聞。不分大小寫與重音,繁體與簡體皆可。",
|
|
426
|
+
"zh-Hans": "留空:全部新闻。在标题和导语中查找的词,用逗号分隔:提到其中任一词的新闻会保留;开头加 ! 则排除提到它的新闻。不区分大小写和重音,繁体和简体均可。",
|
|
427
|
+
"de": "Leer: alle Meldungen. Wörter, die in Schlagzeile und Vorspann gesucht werden, durch Kommas getrennt: Eine Meldung bleibt, wenn sie eines davon erwähnt; ein vorangestelltes ! schließt die aus, die es erwähnen. Groß-/Kleinschreibung und Akzente egal; ein Wort passt am Wortanfang (ki findet „KI“, nicht „Wiki“)."
|
|
428
|
+
},
|
|
429
|
+
"widget": "filter"
|
|
430
|
+
},
|
|
431
|
+
"type": "array",
|
|
432
|
+
"items": {
|
|
433
|
+
"default": "",
|
|
434
|
+
"x-ui": {
|
|
435
|
+
"placeholder": "NASA, Mars, !SpaceX"
|
|
436
|
+
},
|
|
437
|
+
"type": "string"
|
|
438
|
+
},
|
|
439
|
+
"x-filter": true
|
|
440
|
+
},
|
|
377
441
|
"showStandfirst": {
|
|
378
442
|
"title": "Standfirst",
|
|
379
443
|
"description": "The summary under the headline. Off: the headline alone, with room for longer ones.",
|
|
@@ -461,6 +525,7 @@
|
|
|
461
525
|
},
|
|
462
526
|
"polled": true,
|
|
463
527
|
"intervalMs": 600000,
|
|
528
|
+
"profiles": true,
|
|
464
529
|
"options": {
|
|
465
530
|
"default": {
|
|
466
531
|
"feeds": [],
|
|
@@ -550,7 +615,7 @@
|
|
|
550
615
|
"label": {
|
|
551
616
|
"en": "Headline filter (regex)",
|
|
552
617
|
"es": "Filtro de titular (regex)",
|
|
553
|
-
"zh-Hant": "
|
|
618
|
+
"zh-Hant": "標題篩選(正規表示式)",
|
|
554
619
|
"zh-Hans": "标题过滤(正则)",
|
|
555
620
|
"de": "Schlagzeilenfilter (Regex)"
|
|
556
621
|
},
|
|
@@ -661,7 +726,7 @@
|
|
|
661
726
|
"label": {
|
|
662
727
|
"en": "Discard headlines (regex)",
|
|
663
728
|
"es": "Descartar titulares (regex)",
|
|
664
|
-
"zh-Hant": "
|
|
729
|
+
"zh-Hant": "排除標題(正規表示式)",
|
|
665
730
|
"zh-Hans": "排除标题(正则)",
|
|
666
731
|
"de": "Schlagzeilen verwerfen (Regex)"
|
|
667
732
|
},
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kiosko-plugin-news",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Press headlines from RSS feeds, no keys and no AI: stories grouped across outlets, a full-bleed photo frame and a news column.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"author": "Loksly",
|
|
7
|
+
"author": "Loksly <info@kioskolcd.dev> (https://kioskolcd.dev)",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"kiosko",
|
|
10
10
|
"kiosko-plugin",
|