From 23044e535169492a73bfb5775eefb83c38d400fe Mon Sep 17 00:00:00 2001 From: adamhaley Date: Tue, 19 Aug 2025 16:38:57 -0700 Subject: [PATCH] fix for os scoping issue --- RUNPOD_SETUP.md | 9 ++------- oauth_handler.py | 8 ++++++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/RUNPOD_SETUP.md b/RUNPOD_SETUP.md index 07afcdc..50ae18c 100644 --- a/RUNPOD_SETUP.md +++ b/RUNPOD_SETUP.md @@ -1,6 +1,6 @@ # RunPod OAuth Setup Guide -## 🚀 Quick Setup for RunPod +## Quick Setup for RunPod The DropSend node now automatically detects RunPod environments, but for OAuth to work properly, you may need to configure your public URL. @@ -26,11 +26,6 @@ export PUBLIC_URL="https://your-runpod-id.runpod.net:8188" export COMFYUI_PUBLIC_URL="https://your-runpod-id.runpod.net:8188" ``` -#### Method C: Set RUNPOD_PUBLIC_IP (if available) -```bash -export RUNPOD_PUBLIC_IP="your-runpod-id.runpod.net" -``` - ### How to Find Your RunPod URL 1. **From RunPod Dashboard**: Look for your pod's public URL @@ -70,4 +65,4 @@ export RUNPOD_PUBLIC_IP="your-runpod-id.runpod.net" - The enhanced keyring backend now works on RunPod with encrypted file storage - Use `display_only` for maximum flexibility in cloud environments -- Set environment variables in your RunPod template for automatic configuration \ No newline at end of file +- Set environment variables in your RunPod template for automatic configuration diff --git a/oauth_handler.py b/oauth_handler.py index c1b4831..b3aa436 100644 --- a/oauth_handler.py +++ b/oauth_handler.py @@ -373,6 +373,9 @@ def create_display_only_success_page(session_id, app_key, app_secret, refresh_to def get_server_base_url(request=None): """Dynamically detect the server base URL for OAuth callbacks""" + import os + import socket + try: if request: # Try to get from the incoming request @@ -389,13 +392,12 @@ def get_server_base_url(request=None): port = getattr(PromptServer.instance, 'port', 8188) # Try to detect if we're on RunPod or similar cloud service - import socket hostname = socket.gethostname() + print(f"[OAuthHandler] Detected hostname: {hostname}") # Check for RunPod-specific hostname patterns if 'runpod' in hostname.lower() or hostname.endswith('.runpod.net'): # For RunPod, try to get the public URL - import os runpod_public_ip = os.getenv('RUNPOD_PUBLIC_IP') if runpod_public_ip: base_url = f"https://{runpod_public_ip}:{port}" @@ -416,6 +418,8 @@ def get_server_base_url(request=None): except Exception as e: print(f"[OAuthHandler] Error detecting server URL: {e}") + import traceback + traceback.print_exc() # Final fallback base_url = "http://localhost:8188"