Download a profiler attachment.
(aid: int)
| 16388 | session.clear() |
| 16389 | except Exception: |
| 16390 | pass |
| 16391 | session["u"] = username |
| 16392 | session.permanent = True |
| 16393 | session["login_at"] = now_z() |
| 16394 | session["_csrf"] = secrets.token_urlsafe(32) |
| 16395 | ensure_profile_row(username) |
| 16396 | try: |
| 16397 | prof = get_profile(username) |
| 16398 | if prof.get("nickname") == username and not prof.get("bio") and not prof.get("links"): |
| 16399 | set_profile(username, username, "", []) |
| 16400 | except Exception: |
| 16401 | pass |
| 16402 | resp = redirect(url_for("loading")) |
| 16403 | try: |
| 16404 | # Auto-login on this device (trusted-device cookie) |
| 16405 | fp = (request.cookies.get(DEVICE_FP_COOKIE) or "").strip() |
| 16406 | if not fp: |
| 16407 | fp = secrets.token_urlsafe(24) |
| 16408 | resp.set_cookie(DEVICE_FP_COOKIE, fp, max_age=180*24*3600, httponly=True, samesite="Lax", secure=request.is_secure) |
| 16409 | token = _issue_trusted_device(username, fp, approved_by=(username if is_admin else None)) |
| 16410 | _set_device_token_cookie(resp, token) |
| 16411 | except Exception: |
| 16412 | pass |
| 16413 | return resp |
| 16414 | |
| 16415 | def profiler_all_entries_for_bounty(search_q: str = "") -> List[Dict[str, Any]]: |
| 16416 | """Admin helper: list profiler entries across all owners with decrypted names + bounty info.""" |
| 16417 | conn = db_connect() |
| 16418 | rows = conn.execute(""" |
| 16419 | SELECT id, owner, first_enc, last_enc, bounty_price, bounty_set_by, bounty_updated_at, bounty_reason |
| 16420 | FROM profiler_entries |
| 16421 | ORDER BY id DESC |
| 16422 | LIMIT 5000 |
| 16423 | """).fetchall() |
| 16424 | conn.close() |
| 16425 | |
| 16426 | q = (search_q or "").strip().lower() |
| 16427 | out: List[Dict[str, Any]] = [] |
| 16428 | for r in rows: |
| 16429 | try: |
| 16430 | first = aesgcm_decrypt_text(r["first_enc"]) |
| 16431 | except Exception: |
| 16432 | first = "[decrypt failed]" |
| 16433 | try: |
| 16434 | last = aesgcm_decrypt_text(r["last_enc"]) |
| 16435 | except Exception: |
| 16436 | last = "[decrypt failed]" |
| 16437 | item = { |
| 16438 | "id": r["id"], |
nothing calls this directly
no test coverage detected