Changeset e3a5aed in Klonkt for src/routes/admin-stats.js
- Timestamp:
- 06/30/2026 10:11:03 PM (2 months ago)
- Branches:
- main
- Children:
- d9c5eb8
- Parents:
- 65a0697
- File:
-
- 1 edited
-
src/routes/admin-stats.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-stats.js
r65a0697 re3a5aed 14 14 import { requireGod } from '../middleware/auth.js'; 15 15 import { premiumUnlocked } from '../services/PatreonService.js'; 16 import { getStats } from '../services/StatsService.js';16 import { getStats, currentIp, getExcludedIps, setExcludedIps } from '../services/StatsService.js'; 17 17 18 18 const router = express.Router(); … … 32 32 } 33 33 const days = [7, 14, 30, 90].includes(parseInt(req.query.days, 10)) ? parseInt(req.query.days, 10) : 14; 34 const myIp = currentIp(req); 34 35 renderPage(req, res, 'pages/admin-stats', { 35 36 pageTitleKey: 'admin.t_stats', … … 37 38 stats: getStats(days), 38 39 linkClicks, 40 myIp, 41 ipExcluded: !!myIp && getExcludedIps().includes(myIp), 39 42 }); 40 43 }); 41 44 45 // Toggle whether the admin's current IP is counted in statistics. 46 router.post('/exclude-ip', requireGod, (req, res) => { 47 const ip = currentIp(req); 48 if (ip) { 49 const list = getExcludedIps(); 50 const i = list.indexOf(ip); 51 if (i >= 0) list.splice(i, 1); else list.push(ip); 52 setExcludedIps(list); 53 } 54 res.redirect('/admin/stats'); 55 }); 56 42 57 export default router;
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)