2026-05-12 23:50:49 +00:00
|
|
|
from typing import Dict, List, Set
|
|
|
|
|
|
|
|
|
|
# In-Memory Data Stores
|
|
|
|
|
# Since this app is ephemeral, we use global dictionaries instead of a database.
|
|
|
|
|
user_sessions: Dict[str, dict] = {} # {username: {'key': str, 'last_active': str}}
|
|
|
|
|
messages: Dict[str, List[dict]] = {} # {room_name: [{'username': str, 'text': str, 'timestamp': str}]}
|
|
|
|
|
room_users: Dict[str, Dict[str, str]] = {} # {room_name: {username: last_active_timestamp}}
|
|
|
|
|
banned_ips: Set[str] = set()
|
|
|
|
|
banned_usernames: Set[str] = set()
|
|
|
|
|
user_ips: Dict[str, str] = {} # {username: ip_address}
|
|
|
|
|
kicked_users: Dict[str, Set[str]] = {} # {room_name: {kicked_username}}
|
|
|
|
|
room_owners: Dict[str, str] = {} # {room_name: owner_username}
|
|
|
|
|
public_chat_rooms: List[str] = [] # List of user-created public room names
|
|
|
|
|
video_state: Dict[str, dict] = {} # {room_name: {'url': str, 'started_at': str}}
|
|
|
|
|
nuked_rooms: Dict[str, float] = {} # {room_name: expiry_timestamp_epoch}
|
|
|
|
|
|
|
|
|
|
regional_chat_rooms = [
|
|
|
|
|
"Alabama",
|
|
|
|
|
"Alaska",
|
|
|
|
|
"Arizona",
|
|
|
|
|
"Arkansas",
|
|
|
|
|
"California",
|
|
|
|
|
"Colorado",
|
|
|
|
|
"Connecticut",
|
|
|
|
|
"Delaware",
|
|
|
|
|
"Florida",
|
|
|
|
|
"Georgia",
|
|
|
|
|
"Hawaii",
|
|
|
|
|
"Idaho",
|
|
|
|
|
"Illinois",
|
|
|
|
|
"Indiana",
|
|
|
|
|
"Iowa",
|
|
|
|
|
"Kansas",
|
|
|
|
|
"Kentucky",
|
|
|
|
|
"Louisiana",
|
|
|
|
|
"Maine",
|
|
|
|
|
"Maryland",
|
|
|
|
|
"Massachusetts",
|
|
|
|
|
"Michigan",
|
|
|
|
|
"Minnesota",
|
|
|
|
|
"Mississippi",
|
|
|
|
|
"Missouri",
|
|
|
|
|
"Montana",
|
|
|
|
|
"Nebraska",
|
|
|
|
|
"Nevada",
|
|
|
|
|
"New Hampshire",
|
|
|
|
|
"New Jersey",
|
|
|
|
|
"New Mexico",
|
|
|
|
|
"New York",
|
|
|
|
|
"North Carolina",
|
|
|
|
|
"North Dakota",
|
|
|
|
|
"Ohio",
|
|
|
|
|
"Oklahoma",
|
|
|
|
|
"Oregon",
|
|
|
|
|
"Pennsylvania",
|
|
|
|
|
"Rhode Island",
|
|
|
|
|
"South Carolina",
|
|
|
|
|
"South Dakota",
|
|
|
|
|
"Tennessee",
|
|
|
|
|
"Texas",
|
|
|
|
|
"Utah",
|
|
|
|
|
"Vermont",
|
|
|
|
|
"Virginia",
|
|
|
|
|
"Washington",
|
|
|
|
|
"West Virginia",
|
|
|
|
|
"Wisconsin",
|
|
|
|
|
"Wyoming",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
topical_chat_rooms = [
|
|
|
|
|
"Tech",
|
|
|
|
|
"Science",
|
|
|
|
|
"Gaming",
|
|
|
|
|
"Movies",
|
|
|
|
|
"Music",
|
|
|
|
|
"Books",
|
|
|
|
|
"Current Events",
|
|
|
|
|
"Sports",
|
|
|
|
|
"Travel",
|
|
|
|
|
"Food & Cooking",
|
|
|
|
|
"Health & Fitness",
|
|
|
|
|
"History",
|
|
|
|
|
"Programming",
|
|
|
|
|
"Investing",
|
|
|
|
|
"Cryptocurrency",
|
|
|
|
|
"Parenting",
|
|
|
|
|
"DIY & Home Improvement",
|
|
|
|
|
"Photography",
|
|
|
|
|
"Fashion",
|
|
|
|
|
"Automotive",
|
|
|
|
|
"Theater & Performing Arts",
|
|
|
|
|
"Pets & Animals",
|
|
|
|
|
"Space Exploration",
|
|
|
|
|
"Climate Change",
|
|
|
|
|
"Entrepreneurship",
|
|
|
|
|
"Relationships",
|
|
|
|
|
"Comics & Manga",
|
|
|
|
|
"Anime",
|
|
|
|
|
"Board Games",
|
|
|
|
|
"Card Games",
|
|
|
|
|
"Tabletop RPGs",
|
|
|
|
|
"Language Learning",
|
|
|
|
|
"Economics",
|
|
|
|
|
"Politics",
|
|
|
|
|
"Fan Theories",
|
|
|
|
|
"Science Fiction",
|
|
|
|
|
"Fantasy",
|
|
|
|
|
"Artificial Intelligence",
|
|
|
|
|
"Web Development",
|
|
|
|
|
"Mobile Apps",
|
|
|
|
|
"Cybersecurity",
|
|
|
|
|
"3D Printing",
|
|
|
|
|
"Virtual Reality",
|
|
|
|
|
"Augmented Reality",
|
|
|
|
|
"Home Automation",
|
|
|
|
|
"Sustainable Living",
|
|
|
|
|
]
|
2026-06-23 16:43:52 +00:00
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
from models.database import load_persisted_state
|
|
|
|
|
load_persisted_state(sys.modules[__name__])
|