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

Function admin_promote

Scripts/ButSystem.py:12131–12166  ·  view source on GitHub ↗

admin_promote. Admin-only route handler. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

12129 flash("Remove failed.")
12130 return redirect(url_for("profile"))
12131
12132@app.route("/profile/pic/<username>")
12133@login_required
12134def profile_pic(username: str):
12135 """Serve a user&#x27;s profile picture.
12136
12137 New uploads are stored plaintext. If an older encrypted blob exists, we
12138 decrypt it on the fly for backwards compatibility.
12139 """
12140 ensure_profile_row(username)
12141 conn = db_connect()
12142 row = conn.execute("SELECT pic_path, pic_mime FROM profiles WHERE username=?", (username,)).fetchone()
12143 conn.close()
12144 if not row or not row["pic_path"] or not os.path.exists(row["pic_path"]):
12145 abort(404)
12146
12147 mime = row["pic_mime"] or "image/jpeg"
12148 sp = row["pic_path"]
12149
12150 try:
12151 if is_encrypted_file(sp):
12152 gen = aesgcm_decrypt_generator(sp)
12153 resp = Response(gen, mimetype=mime)
12154 else:
12155 from flask import send_file
12156 resp = send_file(sp, mimetype=mime, as_attachment=False, conditional=True, max_age=0)
12157 except Exception:
12158 abort(404)
12159
12160 resp.headers["Cache-Control"] = "no-store"
12161 return resp
12162
12163
12164# ---------------------------
12165# Files (advanced private per-user vault; stored plaintext)
12166# ---------------------------
12167
12168FILE_CATEGORIES = (
12169 ("all", "All"), ("folders", "Folders"), ("documents", "Documents"),

Callers

nothing calls this directly

Calls 3

require_adminFunction · 0.70
current_userFunction · 0.70
db_connectFunction · 0.70

Tested by

no test coverage detected