Changeset bb82e7f in Klonkt for src/services/StatsService.js
- Timestamp:
- 06/20/2026 12:29:15 PM (3 months ago)
- Branches:
- main
- Children:
- bc83cc8
- Parents:
- 92bad27
- File:
-
- 1 edited
-
src/services/StatsService.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/StatsService.js
r92bad27 rbb82e7f 45 45 } 46 46 47 // Bekende bots/crawlers + link-preview-fetchers + scripts overslaan, zodat ze de 48 // weergaven/bezoeker-dagen niet opblazen. Geen UA = vrijwel altijd geautomatiseerd. 49 const BOT_RE = /bot|crawl|spider|slurp|mediapartners|bingpreview|facebookexternalhit|whatsapp|telegram|discord|twitter|linkedin|embedly|pinterest|redditbot|applebot|petalbot|yandex|baidu|duckduckbot|semrush|ahrefs|mj12|dotbot|uptimerobot|pingdom|statuscake|headless|lighthouse|gptbot|claude|ccbot|perplexity|bytespider|amazonbot|googleother|google-read-aloud|python-requests|scrapy|curl|wget|axios|node-fetch|go-http|java\/|okhttp|libwww|httpclient/i; 50 function isBot(req) { 51 const ua = (req && req.headers && req.headers['user-agent']) || ''; 52 if (!ua) return true; // lege UA = script/bot 53 return BOT_RE.test(ua); 54 } 55 47 56 // Lazy prepares — tabellen bestaan pas ná initializeDatabase(); dit module wordt 48 57 // geïmporteerd vóór die call. … … 81 90 82 91 export function recordPageview(siteId, req) { 83 if (!siteId || isOperator(req) ) return;92 if (!siteId || isOperator(req) || isBot(req)) return; 84 93 try { 85 94 const d = today(); … … 91 100 92 101 export function recordPostView(post, req) { 93 if (!post || !post.id || isOperator(req) ) return;102 if (!post || !post.id || isOperator(req) || isBot(req)) return; 94 103 try { 95 104 stmts().bumpPost.run(post.id);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)