Repository navigation
feat: share rate limits and bot prefs via optional Redis; hash IPs in logs - #7
Merged
Adeolu05 merged 1 commit intoSep 28, 2026
Conversation
… logs - REDIS_URL (optional): extract/convert/events quotas are counted once across all Gunicorn workers and the Telegram bot instead of per process; Telegram format/timestamp preferences survive restarts (90-day TTL). Unset or unreachable Redis falls back to in-memory with a throttled warning. - Docker Compose runs a small Redis; render.yaml takes REDIS_URL and generates LOG_HASH_SECRET. - hash_identifier is now HMAC-keyed (plain SHA-256 of an IPv4 or Telegram ID is reversible by enumeration); rate-limit block logs no longer contain the raw client IP. - Failure logs record the public video ID + host instead of a partially stripped URL (which lost the ID for watch?v= links and kept share tokens in youtu.be paths). - Privacy page / bot copy: document IP-based limits, hashed log IDs, and Telegram preferences; caption cache lasts days (72h default), not hours. - CI: Redis service container for real-server integration tests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #6 (which is stacked on #5). Merge in order: #5, then #6, then this. GitHub retargets each one as its base merges.
Summary
Shared state (optional
REDIS_URL)RATE_LIMIT_REQUESTS. Now one fixed-window counter is shared (SET NX EX+INCRin a single transaction).TELEGRAM_PREFS_TTL_DAYS). Invalid stored values fall back to the defaults.REDIS_URLis unset, or Redis errors or times out (0.5s socket timeout), everything falls back to the old in-memory behaviour and logs a warning at most once a minute. Nothing changes until you provision Redis.redis:7-alpine.render.yamltakesREDIS_URLas a secret, e.g. from a Render Key Value instance.Log privacy
hash_identifieris now an HMAC keyed byLOG_HASH_SECRET(generated on Render; a random per-process key if unset). A plain SHA-256 of an IPv4 address or Telegram ID can be reversed by enumeration.video_id+hostinstead of a partly stripped URL. The old version kept nothing useful forwatch?v=links, but kept share-token paths on others.Note: telemetry
session_ids for Telegram users change with this PR because the hash is now keyed. Analytics sessions from before the deploy won't line up with sessions after it.Test plan
TEST_REDIS_URL)MULTI/SET NX EX/INCR, hash + TTL) run on every pushConnectionErrortsc --noEmitpasses. The privacy page lints clean.REDIS_URL, then confirm there's no "Redis unavailable" warning in the logs