From a2746737ce48a97591f9cf559045a3dd954e0aca Mon Sep 17 00:00:00 2001 From: C <0xicl33n@gmail.com> Date: Sun, 4 Jan 2026 13:34:51 -0800 Subject: [PATCH] NO LOCATION AAAAH --- config/gunicorn.conf.py | 11 +++++++++++ src/asquare.py | 12 ++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/config/gunicorn.conf.py b/config/gunicorn.conf.py index c0aeab9..a50527a 100644 --- a/config/gunicorn.conf.py +++ b/config/gunicorn.conf.py @@ -52,6 +52,17 @@ def on_starting(server): """Called just before the master process is initialized.""" print("Studspider WEB starting...") + # Load .env file before workers start + import dotenv + from pathlib import Path + + env_path = Path(__file__).parent.parent / ".env" + if env_path.exists(): + dotenv.load_dotenv(env_path) + print(f"✓ Loaded environment from {env_path}") + else: + print(f"⚠ No .env file found at {env_path}") + def on_reload(server): """Called to recycle workers during a reload via SIGHUP.""" diff --git a/src/asquare.py b/src/asquare.py index e9e4dec..797f5ad 100644 --- a/src/asquare.py +++ b/src/asquare.py @@ -306,12 +306,12 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): if variation_version is not None: variation_obj["version"] = variation_version - # Build item object matching variation's location settings + # Build item object - DO NOT modify location settings + # Square will preserve existing present_at_all_locations configuration item_obj = { "type": "ITEM", "id": item_id, "version": current_version, - "present_at_all_locations": present_at_all_locations, "item_data": { "name": pw_name, "description": f"{set_name} - {set_theme}", @@ -319,14 +319,6 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None): "variations": [variation_obj], }, } - - # Only include present_at_location_ids if not at all locations - if not present_at_all_locations and present_at_location_ids: - item_obj["present_at_location_ids"] = present_at_location_ids - - upsert_body = { - "idempotency_key": str(uuid.uuid4()), - "object": item_obj, } # Remove None values