Added H. easter egg, temp
This commit is contained in:
@@ -4,6 +4,10 @@ from pathlib import Path
|
||||
# Setup paths
|
||||
base_path = Path(__file__).parent
|
||||
req_path = base_path / "requests"
|
||||
user_path = base_path / "users"
|
||||
chat_path = base_path / "single_chats"
|
||||
|
||||
|
||||
req_path.mkdir(exist_ok=True)
|
||||
|
||||
print("Server online. Monitoring requests...")
|
||||
@@ -25,7 +29,8 @@ while True:
|
||||
|
||||
# FAILSAFE 2: Check if the file is empty or missing colons
|
||||
if not content or ":" not in content:
|
||||
print(f"Malformed request in {file_path.name}. Deleting.")
|
||||
print(f"Invalid or empty data in {file_path.name}, Deleting.")
|
||||
# make failed request file
|
||||
file_path.unlink()
|
||||
continue
|
||||
|
||||
@@ -35,16 +40,33 @@ while True:
|
||||
|
||||
# FAILSAFE 3: Check if we have enough parts (Command:User:Pass)
|
||||
if len(parts) < 3:
|
||||
print(f"Incomplete data in {file_path.name}. Deleting.")
|
||||
print(f"Incomplete data in {file_path.name}, Deleting.")
|
||||
# TODO Make failed request file
|
||||
file_path.unlink()
|
||||
continue
|
||||
|
||||
command, user, data = parts
|
||||
if not command.isalnum() or not user.isalnum() or not data.isalnum():
|
||||
print(f"Invalid parameters in {file_path.name}, Deleting.")
|
||||
# TODO Make failed request file
|
||||
continue
|
||||
print(f"Processing {command} for {user}...")
|
||||
|
||||
# --- YOUR LOGIC GOES HERE ---
|
||||
# if command == "LOGIN": ...
|
||||
# if command == "CREATEUSER": ...
|
||||
if command == "LOGIN":
|
||||
# TODO
|
||||
#1. check if user exists as a folder
|
||||
#2. hash password and check against user hash.txt if exist
|
||||
#3. Make success request file
|
||||
#4. Fail file as try/except
|
||||
pass
|
||||
if command == "CREATEUSER":
|
||||
# TODO
|
||||
#1. Make a new folder with the name
|
||||
#2. Hash password and store in hash.txt
|
||||
#3. Init basic files
|
||||
#4. Make success request file
|
||||
#5. Fail file as try/except
|
||||
pass
|
||||
|
||||
# 4. Clean up: Delete the request after successful processing
|
||||
file_path.unlink()
|
||||
|
||||
Reference in New Issue
Block a user