cloud: hide ingest plumbing (proxy/download/cookies) from client logs

Cloud users don't need the YouTube downloader internals, proxy usage or
cookie handling in the System Logs panel — just analysis + rendering
progress. Drop lines matching those keywords from the client view even when
emoji-prefixed. DEBUG_LOGS (local dev) still shows everything.
This commit is contained in:
juancarlos.cavero 2026-07-18 00:34:24 +02:00
parent afe320ca04
commit 29fed21495

18
app.py
View file

@ -541,13 +541,25 @@ def _scrub_secrets(line: str) -> str:
return _CREDENTIAL_URL_RE.sub(r'\1***:***@', line) return _CREDENTIAL_URL_RE.sub(r'\1***:***@', line)
# Cloud users don't need (and shouldn't see) the ingest plumbing: proxy usage,
# the YouTube downloader internals, cookies, etc. These are dropped from the
# client view even when the line is emoji-prefixed. Never applied under
# DEBUG_LOGS (local dev sees everything).
_SENSITIVE_LOG_RE = re.compile(
r'proxy|yt[-_ ]?dlp|youtube-?dl|cookie|residential|po[_ ]?token'
r'|player_client|extractor|\bdownload|descarg',
re.IGNORECASE,
)
def _visible_logs(logs): def _visible_logs(logs):
"""Logs to surface to the client. """Logs to surface to the client.
Self-host (BILLING off) shows the full pipeline output so people running Self-host (BILLING off) shows the full pipeline output so people running
their own instance can debug. Cloud shows only the pipeline's own friendly their own instance can debug. Cloud shows only the pipeline's own friendly
progress lines (emoji-prefixed, plus the worker's start/finish markers) and progress lines (emoji-prefixed, plus the worker's start/finish markers),
hides the raw yt-dlp / ffmpeg / debug spew from paying users. minus any ingest plumbing (proxy / downloader / cookies) — paying users
just want to see analysis and rendering progress.
DEBUG_LOGS=true forces the full output even under billing — for local dev DEBUG_LOGS=true forces the full output even under billing — for local dev
where you run in paid mode but still want the raw logs. where you run in paid mode but still want the raw logs.
@ -559,6 +571,8 @@ def _visible_logs(logs):
s = ln.lstrip() s = ln.lstrip()
if not s: if not s:
continue continue
if _SENSITIVE_LOG_RE.search(ln):
continue
if s.startswith(("Job started", "Process finished")) or ord(s[0]) > 0x2000: if s.startswith(("Job started", "Process finished")) or ord(s[0]) > 0x2000:
visible.append(ln) visible.append(ln)
return visible return visible