Admin helper: list profiler entries across all owners with decrypted names + bounty info.
(search_q: str = "")
| 15533 | Varies. |
| 15534 | """ |
| 15535 | c = db_connect() |
| 15536 | if ok and os.path.exists(stored_path): |
| 15537 | c.execute("UPDATE group_voice SET stored_path=? WHERE id=?", (stored_path, vid)) |
| 15538 | c.commit() |
| 15539 | c.close() |
| 15540 | |
| 15541 | _bg_encrypt_file(tmp_plain, stored_path, finalize) |
| 15542 | conn.commit() |
| 15543 | conn.close() |
| 15544 | return vid, mime |
| 15545 | |
| 15546 | def _group_store_voice_tx(conn, gm_id: int, file_storage) -> Tuple[int, str, str]: |
| 15547 | """Store a group voice message using an existing DB connection/transaction.""" |
| 15548 | mime = _validate_chat_voice_upload(file_storage) |
| 15549 | cur = conn.cursor() |
| 15550 | cur.execute("INSERT INTO group_voice(gm_id, mime, stored_path, created_at) VALUES(?,?,?,?)", |
| 15551 | (gm_id, mime, "PENDING", now_z())) |
| 15552 | vid = cur.lastrowid |
| 15553 | stored_path = os.path.join(ATT_DIR, f"group_voice_{vid}.bin") |
| 15554 | size = _save_plain_upload(file_storage, stored_path) |
| 15555 | if int(size) > CHAT_MAX_BYTES: |
| 15556 | try: |
| 15557 | os.remove(stored_path) |
| 15558 | except Exception: |
| 15559 | pass |
| 15560 | raise ValueError("too_large") |
| 15561 | conn.execute("UPDATE group_voice SET stored_path=? WHERE id=?", (stored_path, vid)) |
| 15562 | return vid, mime, stored_path |
| 15563 | |
| 15564 | @app.route("/chat/<username>/lock/set", methods=["POST"]) |
| 15565 | @login_required |
| 15566 | def dm_lock_set(username: str): |
| 15567 | me = current_user() |
| 15568 | username = (username or "").strip() |
| 15569 | conn = db_connect() |
| 15570 | exists = conn.execute("SELECT 1 FROM users WHERE username=?", (username,)).fetchone() |
| 15571 | conn.close() |
| 15572 | if not exists: |
| 15573 | flash("User not found.") |
| 15574 | return redirect(url_for("chats")) |
| 15575 | pin = request.form.get("pin") or "" |
| 15576 | try: |
| 15577 | _chat_lock_set(me, "dm", username, pin) |
no test coverage detected