diff --git a/src/libpoketube/init/pages-api.js b/src/libpoketube/init/pages-api.js index 6a4fe7c3..6f46fd00 100644 --- a/src/libpoketube/init/pages-api.js +++ b/src/libpoketube/init/pages-api.js @@ -100,6 +100,130 @@ if (!data.users) data.users = {} fs.writeFileSync(statsFile, JSON.stringify(data, null, 2)) res.json({ ok: true }) }) +app.get("/api/stats/optout", (req, res) => { + res.send(` + + + + Poke – Opt out of stats + + + + + +
+

Stats opt-out

+

+ This page lets you turn off anonymous usage stats for this browser. + Poke will remember this choice using localStorage only (no cookies). +

+ +

+ Anonymous stats help us understand which videos are popular and which platforms people use — + without collecting personal data. You can read the full details here: + /policies/privacy#stats. +

+ + Opt out of anonymous stats +
+ +

+ • To see the stats UI (if enabled on this instance), visit + /api/stats?view=human.
+ • For raw JSON, use /api/stats?view=json. +

+
+ + + +`) +}) + app.get("/api/stats", (req, res) => { const view = (req.query.view || "").toString()