kiosko-plugin-news 0.1.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -5
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1047,7 +1047,9 @@ function storyAt(deck2, now, rotateMs, ahead = 0) {
1047
1047
  // src/index.ts
1048
1048
  var DECK_FILE = "deck.json";
1049
1049
  var DECK_MAX_AGE_MS = 24 * 36e5;
1050
- var IMAGE_MAX_AGE_HOURS = 48;
1050
+ var IMAGE_MAX_AGE_HOURS = 12;
1051
+ var cacheOf = (ctx) => ctx.cacheDir || ctx.dataDir;
1052
+ var imageDir = (ctx) => join2(cacheOf(ctx), "images");
1051
1053
  var PHOTO_TRIES = 4;
1052
1054
  var feedItem = t.object({
1053
1055
  name: t.string({ label: { en: "Name", es: "Nombre" }, 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." } }),
@@ -1087,8 +1089,8 @@ var deck = defineSource({
1087
1089
  titleFilter: (ai ? AI_TITLE_FILTER : f.titleFilter.trim()) || void 0,
1088
1090
  maxAgeMs: f.maxAgeMs || (ai ? AI_MAX_AGE_MS : void 0)
1089
1091
  }));
1090
- const file = join2(ctx.dataDir, DECK_FILE);
1091
- pruneImageCache(join2(ctx.dataDir, "images"), IMAGE_MAX_AGE_HOURS, ctx.now);
1092
+ const file = join2(cacheOf(ctx), DECK_FILE);
1093
+ pruneImageCache(imageDir(ctx), IMAGE_MAX_AGE_HOURS, ctx.now);
1092
1094
  const timeoutMs = Math.max(1e3, Math.round(ctx.timeoutMs * 0.6));
1093
1095
  const harvest = await fetchAllFeeds(feeds, { timeoutMs, log: ctx.log, rejectFilter: o.rejectFilter.trim(), maxAgeMs: o.maxAgeMs, now: ctx.now, signal: ctx.signal });
1094
1096
  if (harvest.items.length) {
@@ -1146,7 +1148,7 @@ var storiesOf = (sources, o) => storiesFor(deckOf(sources)?.stories ?? [], o.out
1146
1148
  async function pickShot(ctx) {
1147
1149
  const stories = storiesOf(ctx.sources, ctx.options);
1148
1150
  if (!stories.length) return void 0;
1149
- const dir = join2(ctx.dataDir, "images");
1151
+ const dir = imageDir(ctx);
1150
1152
  const io = { canvas: ctx.canvas, timeoutMs: 15e3, signal: ctx.signal, log: ctx.log };
1151
1153
  let first;
1152
1154
  for (let i = 0; i < Math.min(PHOTO_TRIES, stories.length); i++) {
@@ -1246,7 +1248,7 @@ var column = defineWidget({
1246
1248
  var index_default = definePlugin({
1247
1249
  id: "news",
1248
1250
  name: { en: "News", es: "Noticias" },
1249
- version: "0.1.0",
1251
+ version: "0.2.1",
1250
1252
  description: {
1251
1253
  en: "Press headlines from RSS feeds with their photos. No keys and no AI: consensus across outlets measured with plain set overlap.",
1252
1254
  es: "Titulares de prensa de los RSS con su foto. Sin claves ni IA: el consenso entre cabeceras se mide con solapamiento de t\xE9rminos."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiosko-plugin-news",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
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",
@@ -45,8 +45,8 @@
45
45
  "prepublishOnly": "npm run build"
46
46
  },
47
47
  "devDependencies": {
48
- "@kiosko/sdk": "^0.1.0",
49
- "@loksly/weather-astro": "^0.1.0",
48
+ "@kiosko/sdk": "^0.2.0",
49
+ "@loksly/weather-astro": "^0.2.0",
50
50
  "@types/node": "^24.0.0",
51
51
  "esbuild": "^0.25.0",
52
52
  "typescript": "^5.9.3"