- Replace GotifyNotifier with NtfyNotifier for push notifications - Add support for sending email image attachments to ntfy - Add NTFY_URL, NTFY_TOKEN, NTFY_TOPIC environment variables - Add get_mailpit_image() and get_mailpit_image_thumb() helpers - Sanitize message content for HTTP headers (remove newlines) - Remove all gotify references 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
69 lines
2.0 KiB
Markdown
69 lines
2.0 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project Overview
|
|
|
|
Sneaky Mon is an email-to-notification bridge that receives webhooks from Mailpit (local email service) and forwards emails as push notifications to Gotify or Ntfy. Designed for monitoring system-generated emails (e.g., IoT camera motion alerts) on secure internal networks.
|
|
|
|
## Commands
|
|
|
|
### Development
|
|
```bash
|
|
# Setup virtual environment
|
|
python3 -m venv venv
|
|
source venv/bin/activate
|
|
pip install -r requirements.txt
|
|
|
|
# Run Flask server (listens on 0.0.0.0:8088)
|
|
python app/main.py
|
|
|
|
# Test with hardcoded message ID
|
|
python app/dev_main.py
|
|
```
|
|
|
|
### Docker
|
|
```bash
|
|
# Start services (Mailpit + webhook handler)
|
|
docker-compose up -d
|
|
|
|
# View logs
|
|
docker-compose logs -f sneaky_mon_webhook
|
|
|
|
# Build and push image
|
|
./build_push_image.sh
|
|
```
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Email Sources → Mailpit (SMTP:1025, API:8025) → Sneaky Mon (POST /hook) → Ntfy/Gotify
|
|
```
|
|
|
|
**Data Flow:**
|
|
1. Email arrives at Mailpit SMTP
|
|
2. Mailpit triggers webhook to `/hook` endpoint
|
|
3. Flask app fetches full message from Mailpit API
|
|
4. Extracts subject/content, creates notification
|
|
5. Sends to Ntfy or Gotify
|
|
|
|
## Key Files
|
|
|
|
- `app/main.py` - Flask app with `/hook` webhook endpoint and core logic
|
|
- `app/utils/gotify_api.py` - GotifyNotifier class for Gotify integration
|
|
- `app/utils/ntfy_api.py` - NtfyNotifier class for Ntfy integration
|
|
- `docker-compose.yaml` - Orchestrates Mailpit and webhook services
|
|
|
|
## Configuration
|
|
|
|
All configuration via environment variables (see `.env.example`):
|
|
- `MAILPIT_API` / `MAILPIT_TOKEN` - Mailpit REST API access
|
|
- `NTFY_URL` / `NTFY_TOKEN` / `NTFY_TOPIC` - Ntfy notification service (primary)
|
|
- `GOTIFY_URL` / `GOTIFY_TOKEN` - Gotify notification service (legacy, optional)
|
|
- `LOG_LEVEL` - Logging verbosity
|
|
|
|
## Current State Notes
|
|
|
|
- Project uses Ntfy for push notifications with image attachment support
|
|
- Application intentionally lacks TLS/auth - designed for isolated internal VLANs
|