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

Function api_dm_delete

Scripts/ButSystem.py:13971–14017  ·  view source on GitHub ↗

api_dm_delete. Chat/group feature helper or route handler. This docstring was expanded to make future maintenance easier. Args: mid: Parameter. Returns: Varies.

(mid: int)

Source from the content-addressed store, hash-verified

13969def discussion_voice_stream(vid: int):
13970 """Stream a Discussion voice message."""
13971 _feature_tables_init()
13972 conn = db_connect()
13973 row = conn.execute("""
13974 SELECT id, mime, stored_path
13975 FROM discussion_voice
13976 WHERE id=?
13977 """, (vid,)).fetchone()
13978 conn.close()
13979 if not row:
13980 abort(404)
13981
13982 sp = row["stored_path"]
13983 if not sp or not os.path.exists(sp):
13984 abort(404)
13985
13986 mime = row["mime"] or "audio/webm"
13987 try:
13988 if is_encrypted_file(sp):
13989 gen = aesgcm_decrypt_generator(sp)
13990 resp = Response(gen, mimetype=mime)
13991 else:
13992 from flask import send_file
13993 resp = send_file(sp, mimetype=mime, as_attachment=False, conditional=True, max_age=0)
13994 except Exception:
13995 abort(404)
13996
13997 resp.headers["Cache-Control"] = "no-store"
13998 return resp
13999
14000@app.route("/chats")
14001@login_required
14002def chats():
14003 """chats.
14004
14005Route handler or application helper.
14006
14007This docstring was expanded to make future maintenance easier.
14008
14009Returns:
14010 Varies.
14011"""
14012 me = current_user()
14013 # Mark any pending incoming DMs as delivered when the user opens the Chats list.
14014 # This enables 'delivered' ticks even before a chat is opened (seen).
14015 try:
14016 conn0 = db_connect()
14017 conn0.execute(
14018 "UPDATE dm_messages SET delivered_at=? WHERE recipient=? AND delivered_at IS NULL",
14019 (now_z(), me),
14020 )

Callers

nothing calls this directly

Calls 4

current_userFunction · 0.70
db_connectFunction · 0.70
aesgcm_encrypt_textFunction · 0.70
now_zFunction · 0.70

Tested by

no test coverage detected