From c81fd6db246dd7c0d8e0fdf08ce204a7bf0966a6 Mon Sep 17 00:00:00 2001 From: dv Date: Wed, 15 Apr 2026 11:20:01 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=206?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.js b/server.js index ea8e6e1..2905131 100644 --- a/server.js +++ b/server.js @@ -540,6 +540,16 @@ app.get('/api/client-users', auth, (req, res) => { res.json(result); }); +app.post('/api/admin/sync-client-users', auth, (req, res) => { + if (!req.user?.is_admin) return res.status(403).json({ error: 'forbidden' }); + refreshService.syncClientUsers() + .then(() => { + const count = db.prepare('SELECT COUNT(*) as c FROM client_users').get(); + res.json({ ok: true, count: count.c }); + }) + .catch((e) => res.status(500).json({ error: e.message })); +}); + app.get('/api/tasks', auth, (req, res) => { const cache = db.prepare('SELECT * FROM tasks_cache WHERE id=1').get(); const sync = refreshService.getStatusSnapshot();