Go to file
Your Name d811fc1b4e FIXED: timeoutError with gif seach and sending 2026-07-22 12:41:11 +03:00
config FIXED: timeoutError with gif seach and sending 2026-07-22 12:41:11 +03:00
controllers FIXED: timeoutError with gif seach and sending 2026-07-22 12:41:11 +03:00
models FIXED: timeoutError with gif seach and sending 2026-07-22 12:41:11 +03:00
views MVC rewrite: config TUI, MariaDB support, Tenor GIFs, clean structure 2026-07-22 02:27:27 +03:00
LICENSE Initial commit 2026-07-21 19:24:23 +03:00
README.md MVC rewrite: config TUI, MariaDB support, Tenor GIFs, clean structure 2026-07-22 02:27:27 +03:00
app.py MVC rewrite: config TUI, MariaDB support, Tenor GIFs, clean structure 2026-07-22 02:27:27 +03:00
chat.db FIXED: timeoutError with gif seach and sending 2026-07-22 12:41:11 +03:00
index.html Fix renderGifs: correct path for Klipy file.hd/md/sm/xs nested structure 2026-07-22 04:48:41 +03:00

README.md

FuckingChat 🔒

Encrypted chat with multi-channel support and Tenor GIFs. Messages encrypted at rest (Fernet + PBKDF2/SHA256).

Quick start

pip install bottle cryptography sqlalchemy

# First run — configure everything interactively
python app.py -c

# Then start the server
python app.py

Project structure (MVC)

├── app.py                  # Entry point
├── index.html              # Frontend (single-page)
├── config/
│   ├── __init__.py
│   ├── schema.py           # Dataclass definitions
│   └── config.py           # JSON serializer / loader
├── models/
│   ├── __init__.py
│   ├── base.py             # SQLAlchemy ORM + engine factory
│   └── db.py               # DBfrontend (encrypted CRUD)
├── controllers/
│   ├── __init__.py
│   ├── chat.py             # Chat API endpoints
│   └── tenor.py            # Tenor GIF proxy
├── views/
│   ├── __init__.py
│   └── config_tui.py       # curses TUI configuration wizard
├── Anime/README.md
├── Games/README.md
├── Politics/README.md
└── README.md

Configuration

Run python app.py -c to open the curses TUI:

  • Server — host, port, debug mode
  • Security — encryption secret, salt, admin token, rate limits
  • Database — SQLite (default) or MariaDB
  • Tenor API — API key for GIF search

Config is saved as chat_config.json in the project root. Override path: python app.py --config /path/to/config.json

Environment overrides

Variable Overrides config field
CHAT_CONFIG Config file path
CHAT_SECRET Encryption secret
CHAT_SALT Encryption salt
CHAT_ADMIN_TOKEN Admin token
CHAT_RATE_LIMIT Rate limit
CHAT_RATE_WINDOW Rate window (sec)
CHAT_MAX_MSG Max message length
CHAT_DB_PATH SQLite path
CHAT_HOST Listen address
CHAT_PORT Listen port
CHAT_DEBUG Debug mode (1/0)
TENOR_API_KEY Tenor API key

MariaDB setup

  1. Choose mariadb as engine in config TUI.
  2. Fill in host, port, user, password, database name.
  3. Install driver: pip install pymysql
  4. Start the server.

Security

  • Messages encrypted at rest (AES via Fernet)
  • Rate limiting (configurable)
  • IP hashing (privacy)
  • XSS protection (HTML tag stripping, inline-gif whitelist)
  • Admin token required for DELETE
  • No debug mode in production
  • API keys stored server-side only (Tenor proxy)

API

  • GET /api/channels — list channels
  • GET /api/messages?channel=X — get messages
  • POST /api/messages — send message {"channel":"X","message":"..."}
  • DELETE /api/messages/:id — delete (requires Authorization: Bearer <admin_token>)
  • GET /api/gifs/trending — trending GIFs
  • GET /api/gifs/search?q=... — search GIFs