get_profile. Internal helper function. This docstring was added automatically to improve maintainability. Args: username: Parameter. Returns: Varies.
(username: str)
| 3227 | wrapper.__name__ = fn.__name__ |
| 3228 | return wrapper |
| 3229 | |
| 3230 | |
| 3231 | |
| 3232 | def privacy_panic_active() -> bool: |
| 3233 | try: |
| 3234 | return float(session.get("privacy_panic_until") or 0) > time.time() |
| 3235 | except Exception: |
| 3236 | return False |
| 3237 | |
| 3238 | |
| 3239 | @app.route("/privacy/panic", methods=["POST"]) |
| 3240 | @login_required |
| 3241 | def privacy_panic(): |
| 3242 | session.pop("privacy_panic_until", None) |
| 3243 | session.modified = True |
| 3244 | try: |
| 3245 | log_user_action("privacy_panic", detail="blur_sensitive_content", username=current_user()) |
| 3246 | except Exception: |
| 3247 | pass |
| 3248 | if request.headers.get("X-Requested-With") == "XMLHttpRequest" or request.is_json: |
| 3249 | return jsonify({"ok": True, "reload": True}) |
| 3250 | return redirect(request.referrer or url_for("chats")) |
| 3251 | |
| 3252 | |
| 3253 | @app.route("/privacy/resume", methods=["POST"]) |
| 3254 | @login_required |
| 3255 | def privacy_resume(): |
| 3256 | session.pop("privacy_panic_until", None) |
| 3257 | session.modified = True |
| 3258 | try: |
| 3259 | log_user_action("privacy_resume", detail="show_sensitive_content", username=current_user()) |
| 3260 | except Exception: |
| 3261 | pass |
| 3262 | if request.headers.get("X-Requested-With") == "XMLHttpRequest" or request.is_json: |
| 3263 | return jsonify({"ok": True, "reload": True}) |
| 3264 | return redirect(request.referrer or url_for("chats")) |
| 3265 | |
| 3266 | def guess_mime(filename: str) -> str: |
| 3267 | """guess_mime. |
| 3268 | |
| 3269 | Internal helper function. |
| 3270 | |
| 3271 | This docstring was added automatically to improve maintainability. |
| 3272 | |
| 3273 | Args: |
| 3274 | filename: Parameter. |
| 3275 | |
| 3276 | Returns: |
| 3277 | Varies. |
| 3278 | """ |
| 3279 | mt, _ = mimetypes.guess_type(filename) |
| 3280 | return mt or "application/octet-stream" |
| 3281 | |
| 3282 | # MIME / inline-preview safety helpers |
| 3283 | _DANGEROUS_INLINE_MIMES = { |
| 3284 | "text/html", |
| 3285 | "application/xhtml+xml", |
| 3286 | "text/xml", |
no test coverage detected