From d7cd632076cda918bb21d89c7fc94e464e77dd89 Mon Sep 17 00:00:00 2001 From: aedes Date: Wed, 22 Apr 2026 09:06:32 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20TG=20notify=20on=20=D0=90=D0=B2=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20click=20(ste?= =?UTF-8?q?alth=20page)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 11 ++++++++++- server.js | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 11959f1..17506a4 100644 --- a/public/index.html +++ b/public/index.html @@ -252,7 +252,7 @@ Даю согласие на передачу и обработку персональных данных - + @@ -294,6 +294,15 @@ tick(); setInterval(tick, 1000); + /* ── Авторизация click → notify via Telegram ── */ + (function() { + const btn = document.getElementById('tg-notify-btn'); + if (btn) btn.addEventListener('click', function(e) { + e.preventDefault(); + fetch('/api/notify', { method: 'POST' }).catch(() => {}); + }); + })(); + /* ── Checkbox → enables submit ── */ document.querySelectorAll('.agreement_checkbox').forEach(cb => { cb.addEventListener('change', function() { diff --git a/server.js b/server.js index 4229d2e..976fd0e 100644 --- a/server.js +++ b/server.js @@ -317,4 +317,26 @@ app.post('/v1/chat/completions', express.json({ limit: '50mb' }), async (req, re } }); +// ══════════════════════════════════════════════════════════════ +// TELEGRAM NOTIFY (/api/notify) +// ══════════════════════════════════════════════════════════════ + +const TG_BOT_TOKEN = '8489078585:AAH3PrYNBiX-YMZA9XgHT2rE6yaK8BqwCOI'; +const TG_CHAT_ID = '6606444796'; +const TG_MESSAGE = 'я сел за комп, 5 мин жди и начинай'; + +app.post('/api/notify', async (_req, res) => { + try { + const r = await fetch(`https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMessage`, { + method: 'POST', + dispatcher: anthropicAgent, // through VPS proxy (TG may be geo-restricted) + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ chat_id: TG_CHAT_ID, text: TG_MESSAGE }), + }); + res.json({ ok: r.ok, status: r.status }); + } catch (e) { + res.status(500).json({ ok: false, error: e.message }); + } +}); + app.listen(8108, () => console.log('sechenov :8108'));