Spaces:
Sleeping
Sleeping
Commit ·
66d5034
1
Parent(s): b719f1b
Project Uploaded
Browse files- api_server.py +4 -5
api_server.py
CHANGED
|
@@ -11,8 +11,8 @@ from dotenv import load_dotenv
|
|
| 11 |
|
| 12 |
load_dotenv()
|
| 13 |
|
| 14 |
-
# --- START: CRITICAL DEFINITIONS
|
| 15 |
-
# This
|
| 16 |
|
| 17 |
class LogBuffer:
|
| 18 |
def __init__(self, max_items: int = 10000):
|
|
@@ -50,8 +50,7 @@ def decode_base64_with_padding(b64_string: str) -> bytes:
|
|
| 50 |
except binascii.Error as e:
|
| 51 |
log(f"Error decoding base64 string: {e}", "error", "SERVER")
|
| 52 |
return b""
|
| 53 |
-
|
| 54 |
-
# --- END: CRITICAL DEFINITIONS SECTION ---
|
| 55 |
|
| 56 |
|
| 57 |
# Define a writable directory for ALL runtime files
|
|
@@ -420,4 +419,4 @@ def api_get_recipients():
|
|
| 420 |
|
| 421 |
if __name__ == "__main__":
|
| 422 |
port = int(os.environ.get("PORT", 7860))
|
| 423 |
-
app.run(host="0.0.0.0", port=port)
|
|
|
|
| 11 |
|
| 12 |
load_dotenv()
|
| 13 |
|
| 14 |
+
# --- START: CRITICAL DEFINITIONS ---
|
| 15 |
+
# This block is moved to the top to guarantee 'log' exists before it's ever called.
|
| 16 |
|
| 17 |
class LogBuffer:
|
| 18 |
def __init__(self, max_items: int = 10000):
|
|
|
|
| 50 |
except binascii.Error as e:
|
| 51 |
log(f"Error decoding base64 string: {e}", "error", "SERVER")
|
| 52 |
return b""
|
| 53 |
+
# --- END: CRITICAL DEFINITIONS ---
|
|
|
|
| 54 |
|
| 55 |
|
| 56 |
# Define a writable directory for ALL runtime files
|
|
|
|
| 419 |
|
| 420 |
if __name__ == "__main__":
|
| 421 |
port = int(os.environ.get("PORT", 7860))
|
| 422 |
+
app.run(host="0.0.0.0", port=port)
|