admin_user_files. Admin-only route handler. This docstring was expanded to make future maintenance easier. Args: username: Parameter. Returns: Varies.
(username: str)
| 16478 | return {"kind": "attachment", "aid": int(a["id"]), "mime": mime, "path": sp, "owner": row["owner"]} |
| 16479 | |
| 16480 | # Fallback to the owner's profile picture when available. |
| 16481 | conn = db_connect() |
| 16482 | prow = conn.execute("SELECT pic_path, pic_mime FROM profiles WHERE username=?", (row["owner"],)).fetchone() |
| 16483 | conn.close() |
| 16484 | if prow and prow["pic_path"] and os.path.exists(prow["pic_path"]): |
| 16485 | return { |
| 16486 | "kind": "profile_pic", |
| 16487 | "username": row["owner"], |
| 16488 | "mime": (prow["pic_mime"] or "image/jpeg"), |
| 16489 | "path": prow["pic_path"], |
| 16490 | "owner": row["owner"], |
| 16491 | } |
| 16492 | return None |
| 16493 | |
| 16494 | |
| 16495 | def _face_detector_bounty_refs(limit: int = 120) -> List[Dict[str, Any]]: |
| 16496 | """Admin-only list of bounty entries that have a previewable image.""" |
| 16497 | out: List[Dict[str, Any]] = [] |
| 16498 | for item in profiler_all_entries_for_bounty(""): |
| 16499 | if item.get("bounty_price") is None: |
| 16500 | continue |
| 16501 | src = _face_detector_bounty_preview_source(int(item["id"])) |
| 16502 | if not src: |
| 16503 | continue |
| 16504 | item = dict(item) |
| 16505 | item["preview_url"] = url_for("face_detector_bounty_preview", eid=int(item["id"])) |
| 16506 | out.append(item) |
| 16507 | if len(out) >= int(limit): |
| 16508 | break |
| 16509 | return out |
| 16510 | |
| 16511 | def _face_detector_i18n() -> Dict[str, str]: |
| 16512 | return { |
| 16513 | "ready": _("Ready."), |
| 16514 | "readyTapStart": _("Ready. Tap Start camera."), |
| 16515 | "startingCamera": _("Starting camera..."), |
| 16516 | "liveCamera": _("Live camera ready."), |
| 16517 | "cameraError": _("Failed to acquire camera feed."), |
| 16518 | "cameraBusyTip": _("Tip: On phones, if the camera is busy in another app, close that app first and then tap Start camera again."), |
| 16519 | "analyzingUpload": _("Analyzing uploaded media..."), |
| 16520 | "uploadFailed": _("Could not analyze the uploaded media."), |
| 16521 | "unsupportedFile": _("Please choose a photo or video file."), |
| 16522 | "nothingToSave": _("Nothing to save yet."), |
| 16523 | "saveFailed": _("Could not save the result."), |
| 16524 | "savedTo": _("Saved to"), |
| 16525 | "serverStandby": _("SERVER: STANDBY"), |
| 16526 | "serverUploading": _("SERVER: UPLOADING..."), |
| 16527 | "serverSaved": _("SERVER: SAVED"), |
| 16528 | "serverDisconnected": _("SERVER: DISCONNECTED"), |
nothing calls this directly
no test coverage detected