Additional Bug fixes

This commit is contained in:
unknown
2026-05-22 11:50:59 +02:00
parent 10bfdfb914
commit a0f7efcd34
12 changed files with 372 additions and 135 deletions

View File

@@ -1,6 +1,6 @@
# cg.cx
> End-to-end encrypted content sharing via Telegram with a modern web frontend.
> End-to-end encrypted content sharing via Telegram - with a modern web frontend.
**cg.cx** is a privacy-first file and text sharing platform built as a Telegram bot and Axum web service. Users upload content through a Telegram bot; the service encrypts every file with unique per-content keys, stores them securely, and shares them via short 12-character IDs. Recipients view or download content through a lightweight Svelte 5 web interface with automatic decryption on the fly.
@@ -63,8 +63,8 @@ cg.cx is organized as a **Rust workspace** with 10 focused crates. This modular
| `cgcx-content-typing` | MIME type detection (`infer` + `mime_guess`) and render-flag computation for safe UI handling of dangerous files. |
| `cgcx-file-pipeline` | High-level upload orchestration: ingests raw bytes, detects type, encrypts via `cgcx-crypto`, stores via `cgcx-storage`, and records metadata via `cgcx-db`. |
| `cgcx-moderation` | Runtime moderation lists (blacklist / whitelist) loaded from JSON, with configurable share modes (`b` = blocklist, `w` = allowlist) and auto-reload. |
| `cgcx-bot` | **Binary crate** Telegram bot built on `teloxide`. Handles dialogue flows, uploads, terms acceptance, reporting, and admin commands. |
| `cgcx-server` | **Binary crate** Axum HTTP server. Serves the Svelte frontend, streams decrypted files, enforces view limits, and validates password cookies. |
| `cgcx-bot` | **Binary crate** - Telegram bot built on `teloxide`. Handles dialogue flows, uploads, terms acceptance, reporting, and admin commands. |
| `cgcx-server` | **Binary crate** - Axum HTTP server. Serves the Svelte frontend, streams decrypted files, enforces view limits, and validates password cookies. |
### Why a Modular Crate Structure?
@@ -178,9 +178,9 @@ The static assets are emitted to `frontend/dist/` and served by `cgcx-server` at
cg.cx uses a layered configuration system:
1. `config/default.toml` committed defaults
2. `config/default.example.toml` local overrides (gitignored)
3. `CGCX_*` environment variables runtime overrides
1. `config/default.toml` - committed defaults
2. `config/default.example.toml` - local overrides (gitignored)
3. `CGCX_*` environment variables - runtime overrides
Environment variables use double-underscore as a separator, e.g.:
@@ -228,12 +228,12 @@ cargo run -p cgcx-server
The server binds to `127.0.0.1:8080` by default and serves:
- `/` Svelte frontend
- `/api/health` health check
- `/api/content/:cxid` metadata JSON
- `/api/content/:cxid/verify-password` password verification
- `/api/content/:cxid/file/:file_idx` streamed decrypted file
- `/assets/*` static frontend assets
- `/` - Svelte frontend
- `/api/health` - health check
- `/api/content/:cxid` - metadata JSON
- `/api/content/:cxid/verify-password` - password verification
- `/api/content/:cxid/file/:file_idx` - streamed decrypted file
- `/assets/*` - static frontend assets
### Run the Telegram Bot
@@ -263,8 +263,8 @@ Ensure both processes point to the same database path and storage directories vi
Migrations are managed by `rusqlite_migration` and embedded into the `cgcx-db` crate at compile time.
- `migrations/001_init.sql` Creates `users`, `contents`, `content_files`, `reports`, and `admin_actions` tables.
- `migrations/002_indexes.sql` Adds performance indexes on foreign keys, status columns, and report state.
- `migrations/001_init.sql` - Creates `users`, `contents`, `content_files`, `reports`, and `admin_actions` tables.
- `migrations/002_indexes.sql` - Adds performance indexes on foreign keys, status columns, and report state.
On startup, both the bot and server call `db.run_migrations()`, which applies any pending migrations automatically. The database is opened with:
@@ -369,9 +369,9 @@ Admin commands are restricted to users in configured `admin_group_ids` who also
Reports submitted by users are forwarded to all configured `review_group_ids` with an inline keyboard:
- **🗑 Delete** Sets content status to `deleted`.
- **⛔ Blacklist User** Blacklists the uploader and bans them.
- **📝 Ignore** Dismisses the report.
- **🗑 Delete** - Sets content status to `deleted`.
- **⛔ Blacklist User** - Blacklists the uploader and bans them.
- **📝 Ignore** - Dismisses the report.
### Moderation Modes
@@ -436,7 +436,7 @@ cargo test -p cgcx-content-typing
## License
MIT License see [LICENSE](LICENSE) for details.
MIT License - see [LICENSE](LICENSE) for details.
---