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

Function api_location_update

Scripts/ButSystem.py:14217–14252  ·  view source on GitHub ↗

api_location_update. Route handler or application helper. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

14215def _dm_build_message_dict(conn, r, me: str) -> Dict[str, Any]:
14216 """Build a DM message view dict (same logic as chat_with) for one dm_messages row."""
14217 if r["has_voice"]:
14218 v = conn.execute("SELECT id, mime FROM dm_voice WHERE dm_id=? ORDER BY id DESC LIMIT 1", (r["id"],)).fetchone()
14219 else:
14220 v = None
14221 if r["has_file"]:
14222 f = conn.execute("SELECT id, filename, mime, size FROM dm_files WHERE dm_id=? ORDER BY id DESC LIMIT 1", (r["id"],)).fetchone()
14223 else:
14224 f = None
14225 try:
14226 body = aesgcm_decrypt_text(r["body_enc"])
14227 except Exception:
14228 body = "[decrypt failed]"
14229 msg = {
14230 "id": r["id"],
14231 "sender": r["sender"],
14232 "kind": ("deleted" if r["deleted_at"] else ("voice" if r["has_voice"] else ("file" if r["has_file"] else "text"))),
14233 "deleted": True if r["deleted_at"] else False,
14234 "body": ("[deleted]" if r["deleted_at"] else (body if (not r["has_voice"] and not r["has_file"]) else "")),
14235 "created_at_local": _local_time_str(r["created_at"]),
14236 "created_at_utc": r["created_at"],
14237 "read_at_local": _local_time_str(r["read_at"]) if r["sender"] == me else None,
14238 "read_at_utc": r["read_at"] if r["sender"] == me else None,
14239 "edited_at_local": _local_time_str(r["edited_at"]) if r["edited_at"] else None,
14240 "voice_id": v["id"] if v else None,
14241 "voice_mime": v["mime"] if v else "audio/webm",
14242 "file_id": f["id"] if f else None,
14243 "file_name": f["filename"] if f else None,
14244 "file_mime": f["mime"] if f else None,
14245 "file_size_h": human_size(int(f["size"])) if (f and f["size"] is not None) else "",
14246 "file_is_image": True if (f and (f["mime"] or "").startswith("image/")) else False,
14247 "file_is_video": True if (f and (f["mime"] or "").startswith("video/")) else False,
14248 "file_is_audio": True if (f and (f["mime"] or "").startswith("audio/")) else False
14249 }
14250 return msg
14251
14252
14253
14254_DM_ROW_TEMPLATE = r"""
14255<div class="msg-row {{ 'me' if m.sender==me else 'them' }}">

Callers

nothing calls this directly

Calls 3

current_userFunction · 0.70
db_connectFunction · 0.70
now_zFunction · 0.70

Tested by

no test coverage detected