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

Function approval_prompt

Scripts/ButSystem.py:16706–16757  ·  view source on GitHub ↗

Run an interactive approve/deny prompt in the *main thread*. Termux/Android terminals can fail to show `input()` prompts reliably when they happen inside background threads. This function is meant to be called from the main loop so the prompt always appears.

(username: str)

Source from the content-addressed store, hash-verified

16704 price_raw = (request.form.get("price") or "").strip()
16705 reason = (request.form.get("reason") or "").strip()
16706 if not eid:
16707 flash(_("Select a profile first."))
16708 return redirect(url_for("bounty"))
16709 if not reason:
16710 flash(_("Bounty reason is required."))
16711 return redirect(url_for("bounty", eid=eid))
16712 if len(reason) > 333:
16713 flash(_("Bounty reason must be 333 characters or less."))
16714 return redirect(url_for("bounty", eid=eid))
16715 try:
16716 price = float(price_raw.replace(",", ""))
16717 if price < 0:
16718 raise ValueError
16719 except Exception:
16720 flash(_("Invalid bounty price."))
16721 return redirect(url_for("bounty", eid=eid))
16722
16723 conn = db_connect()
16724 exists = conn.execute("SELECT id FROM profiler_entries WHERE id=?", (eid,)).fetchone()
16725 if not exists:
16726 conn.close()
16727 flash(_("Profile not found."))
16728 return redirect(url_for("bounty"))
16729
16730 conn.execute(
16731 "UPDATE profiler_entries SET bounty_price=?, bounty_set_by=?, bounty_updated_at=?, bounty_reason=? WHERE id=?",
16732 (price, current_user(), now_z(), reason, eid)
16733 )
16734 conn.commit()
16735 conn.close()
16736 flash(_("Bounty saved for profile") + f" #{eid}.")
16737 return redirect(url_for("bounty", eid=eid))
16738
16739@app.route("/bounty/remove", methods=["POST"])
16740@login_required
16741def bounty_remove():
16742 """Remove a bounty from a profiler entry (admin only)."""
16743 require_admin()
16744 eid = request.form.get("eid", type=int)
16745 if not eid:
16746 flash(_("Select a profile first."))
16747 return redirect(url_for("bounty"))
16748
16749 conn = db_connect()
16750 exists = conn.execute("SELECT id FROM profiler_entries WHERE id=?", (eid,)).fetchone()
16751 if not exists:
16752 conn.close()
16753 flash(_("Profile not found."))
16754 return redirect(url_for("bounty"))
16755
16756 conn.execute(
16757 "UPDATE profiler_entries SET bounty_price=NULL, bounty_set_by=NULL, bounty_updated_at=?, bounty_reason=NULL WHERE id=?",
16758 (now_z(), eid)
16759 )
16760 conn.commit()

Callers 2

approval_workerFunction · 0.70
mainFunction · 0.70

Calls 8

inputFunction · 0.85
db_connectFunction · 0.70
now_zFunction · 0.70
user_rootFunction · 0.70
ensure_profile_rowFunction · 0.70
set_profileFunction · 0.70
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected