MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / report_edit

Function report_edit

Scripts/ButSystem.py:17566–17601  ·  view source on GitHub ↗
(rid: int)

Source from the content-addressed store, hash-verified

17564 try:
17565 conn = db_connect()
17566 rows = conn.execute("SELECT username FROM pending_users WHERE status='pending' ORDER BY id ASC").fetchall()
17567 conn.close()
17568 for r in rows:
17569 try:
17570 PENDING_QUEUE.put_nowait(r["username"])
17571 except Exception:
17572 pass
17573 except Exception:
17574 pass
17575
17576def approval_prompt(username: str):
17577 """Run an interactive approve/deny prompt in the *main thread*.
17578
17579 Termux/Android terminals can fail to show `input()` prompts reliably when they
17580 happen inside background threads. This function is meant to be called from
17581 the main loop so the prompt always appears.
17582 """
17583 if not username:
17584 return
17585 try:
17586 conn = db_connect()
17587 row = conn.execute("""SELECT username, requested_ip, requested_at, status, pw_hash
17588 FROM pending_users WHERE username=?""", (username,)).fetchone()
17589 if not row or row["status"] != "pending":
17590 conn.close()
17591 return
17592
17593 sys.stdout.write("\n")
17594 sys.stdout.flush()
17595 prompt = (f"[ButSystem] Signup request: '{row['username']}' from {row['requested_ip']} "
17596 f"at {row['requested_at']} Approve? (y/N): ")
17597 try:
17598 ans = input(prompt).strip().lower()
17599 except EOFError:
17600 # No TTY / stdin closed.
17601 ans = ""
17602
17603 if ans == "y":
17604 conn.execute("INSERT OR IGNORE INTO users(username, pw_hash, is_admin, created_at) VALUES(?,?,0,?)",

Callers

nothing calls this directly

Calls 7

_feature_tables_initFunction · 0.70
current_userFunction · 0.70
db_connectFunction · 0.70
user_is_adminFunction · 0.70
aesgcm_encrypt_textFunction · 0.70
now_zFunction · 0.70
_report_store_attachmentFunction · 0.70

Tested by

no test coverage detected