discovery-media-player 0.1.37 → 0.1.38

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/package.json +1 -1
  2. package/server/handler.js +16 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "discovery-media-player",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "Self-hosted document viewer: per-recipient tracked links, reading analytics, live presentation. The core knows nothing about the application hosting it — everything it borrows arrives through an injected context.",
5
5
  "keywords": [
6
6
  "pdf-viewer",
package/server/handler.js CHANGED
@@ -2577,7 +2577,22 @@ async function handler(req, res) {
2577
2577
  try {
2578
2578
  if (!body.slug || !visitor || !visitor.email) return;
2579
2579
  await PLAYER.db.request("xp_visitor_unlocks", { method: "POST", headers: { Prefer: "return=minimal" }, body: [{ doc_slug: String(body.slug), email: visitor.email, name: visitor.name || null, method }] });
2580
- } catch { /* best-effort */ }
2580
+ } catch (e) {
2581
+ // ⚠️ TROUVÉ EN VÉRIFIANT LE TARBALL DE 0.1.37, PAS PAR LA GARDE QUI VENAIT DE NAÎTRE.
2582
+ //
2583
+ // Celle-ci filtrait sur une LISTE DE NOMS de fonctions d'écriture. `recordUnlock` écrit
2584
+ // directement par `PLAYER.db.request`, donc elle ne l'a pas vu — exactement le défaut que
2585
+ // l'audit reprochait à la garde des prototypes, reproduit dans une garde écrite le même jour
2586
+ // pour éviter ce genre de chose.
2587
+ //
2588
+ // La garde vise désormais la FORME (toute écriture en base rattrapée en silence), pas des
2589
+ // noms. Une liste ne voit que ce qu'on y a mis ; une forme voit aussi le prochain.
2590
+ try {
2591
+ if (await PLAYER.limits.allow("unlock:echec", 1, 3600)) {
2592
+ PLAYER.errors.capture(new Error(`déverrouillage visiteur non journalisé : ${e && e.message ? e.message : "cause inconnue"}`), { route: "visitor-unlock" });
2593
+ }
2594
+ } catch { /* un journal ne doit jamais empêcher une lecture */ }
2595
+ }
2581
2596
  };
2582
2597
  if (body.action === "visitor-google") {
2583
2598
  const r = await V.verifyGoogle(body.credential);