0e19c84a6d
The bot is now public: anyone connects it to their own Telegram Business account and gets antidelete for their own private chats. On connection (business_connection enabled) and on /start it sends a colorful welcome describing features, how to connect, and limitations. - connections.js: resolve a connection's owner from business_connection_id (memo -> DB -> getBusinessConnection). Business messages have no outgoing flag, so the owner's own messages are filtered by comparing from.id; if the owner can't be resolved the message is not cached. - Strict per-owner isolation: captures scoped by owner_id; the panel shows each user only their own feed; notifications go to the owner's chat. - db.js: multi-tenant schema (connections table; messages keyed by (conn_id, chat_id, msg_id); captures/counts scoped by owner_id). - media.js: key cached-media filenames by (connId, chatId, msgId) to prevent one tenant overwriting another's encrypted media. - panel.js: drop the owner-only barrier; /start sends welcome + own feed. - config.js: OWNER_ID is now optional (service logs only, grants no access). - Docs: README/.env.example rewritten for the multi-tenant model and the shared-key privacy caveat. - Stop tracking .claude/settings.local.json; restore the Hcrgram/ ignore. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
24 lines
1.7 KiB
Bash
24 lines
1.7 KiB
Bash
# === Бот (единственный интерфейс + приёмник бизнес-апдейтов) ===
|
|
# Токен от @BotFather. Обязательно включите боту режим бизнеса:
|
|
# @BotFather → /mybots → выбрать бота → Bot Settings → Business Mode → Enable.
|
|
# Бот доступен всем: любой может подключить его к СВОЕМУ бизнес-аккаунту
|
|
# (Настройки → Telegram для бизнеса → Чат-боты). Сессия НЕ нужна.
|
|
BOT_TOKEN=
|
|
# (Необязательно) Telegram id «оператора» бота — только для служебных логов.
|
|
# Доступа к чужим данным НЕ даёт: каждый видит лишь свои перехваты (строгая
|
|
# изоляция по владельцу). Можно оставить пустым.
|
|
OWNER_ID=
|
|
|
|
# === Локальное хранилище ===
|
|
# Ключ шифрования: 64 hex-символа ИЛИ длинная парольная фраза (≥32 байт).
|
|
# Одним ключом шифруются данные ВСЕХ подключившихся — храните его в секрете.
|
|
# Сгенерировать hex: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
|
ENCRYPTION_KEY=
|
|
# Сколько дней хранить перехваченное (0 — бессрочно)
|
|
RETENTION_DAYS=30
|
|
# Качать медиа входящих сразу, чтобы восстанавливать удалённые картинки (0 — выключить)
|
|
CACHE_MEDIA=1
|
|
|
|
# debug | info | warn | error
|
|
LOG_LEVEL=info
|