From ba2e42db2d0eea57141bba903cfa4b0f0ebedecb Mon Sep 17 00:00:00 2001 From: Michael Woods Date: Sun, 21 Dec 2025 21:34:21 -0500 Subject: [PATCH] updated the dump. --- packetserver/runners/http_user_manager.py | 42 ++++++++++++++--------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/packetserver/runners/http_user_manager.py b/packetserver/runners/http_user_manager.py index 97337ad..b073ba7 100644 --- a/packetserver/runners/http_user_manager.py +++ b/packetserver/runners/http_user_manager.py @@ -229,11 +229,11 @@ def main(): elif args.command == "dump": import json - from packetserver.server.users import User # for type hint/reference callsign = upper_callsign(args.callsign) - if callsign not in users_mapping: - print(f"Error: No HTTP user {callsign} found (dump only works for existing HTTP users)") + http_user = users_mapping.get(callsign) + if not http_user: + print(f"Error: No HTTP user {callsign} found") sys.exit(1) main_users = root.get('users', {}) @@ -242,22 +242,30 @@ def main(): print(f"Error: No corresponding BBS user {callsign} found") sys.exit(1) - # Build dict with key fields (extend as needed) dump_data = { - "username": bbs_user.username, - "uuid": str(bbs_user.uuid) if bbs_user.uuid else None, - "hidden": bbs_user.hidden, - "enabled": bbs_user.enabled, - "created_at": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(bbs_user.created_at.timestamp())) if hasattr( - bbs_user.created_at, "timestamp") else str(bbs_user.created_at), - "last_seen": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(bbs_user.last_seen.timestamp())) if hasattr( - bbs_user.last_seen, "timestamp") else str(bbs_user.last_seen), - "bio": bbs_user.bio.strip() or None, - "status": bbs_user.status.strip() or None, - "email": bbs_user.email.strip() if bbs_user.email != " " else None, - "location": bbs_user.location.strip() if bbs_user.location != " " else None, - "socials": bbs_user.socials, + "http_user": { + "username": http_user.username, + "http_enabled": http_user.http_enabled, + "rf_enabled": http_user.is_rf_enabled(connection), + "blacklisted": not http_user.is_rf_enabled(connection), # explicit inverse + "created_at": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(http_user.created_at)), + "failed_attempts": http_user.failed_attempts, + }, + "bbs_user": { + "username": bbs_user.username, + "uuid": str(bbs_user.uuid) if hasattr(bbs_user, 'uuid') and bbs_user.uuid else None, + "hidden": bbs_user.hidden, + "enabled": bbs_user.enabled, # BBS enabled flag + "created_at": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(bbs_user.created_at.timestamp())) if hasattr(bbs_user.created_at, "timestamp") else str(bbs_user.created_at), + "last_seen": time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(bbs_user.last_seen.timestamp())) if hasattr(bbs_user.last_seen, "timestamp") else str(bbs_user.last_seen), + "bio": bbs_user.bio.strip() or None, + "status": bbs_user.status.strip() or None, + "email": bbs_user.email.strip() if bbs_user.email != " " else None, + "location": bbs_user.location.strip() if bbs_user.location != " " else None, + "socials": bbs_user.socials, + } } + print(json.dumps(dump_data, indent=4)) finally: