diff --git a/drivesend_setup_node.py b/drivesend_setup_node.py index 82ef854..0a2054a 100644 --- a/drivesend_setup_node.py +++ b/drivesend_setup_node.py @@ -203,15 +203,32 @@ class DriveSendSetupNode: print("="*60) print("\nCopy these values to your Environment Variables:\n") + # Print FULL values (not truncated) for key, value in env_vars.items(): - # Truncate long values for display - display_value = value if len(value) < 50 else value[:47] + "..." - print(f"{key}={display_value}") + print(f"{key}={value}") print("\n" + "="*60) - print("See console output above for full values to copy") + print("Copy the values above to your RunPod Secrets") print("="*60 + "\n") + # Save token.json for local use + if auth_method == 'oauth' and 'GOOGLE_REFRESH_TOKEN' in env_vars: + token_file = NODE_DIR / 'token.json' + try: + token_data = { + "token": None, + "refresh_token": env_vars['GOOGLE_REFRESH_TOKEN'], + "token_uri": "https://oauth2.googleapis.com/token", + "client_id": env_vars['GOOGLE_CLIENT_ID'], + "client_secret": env_vars['GOOGLE_CLIENT_SECRET'], + "scopes": ["https://www.googleapis.com/auth/drive.file"] + } + with open(token_file, 'w') as f: + json.dump(token_data, f, indent=2) + results.append(f"✓ Saved token.json for local use") + except Exception as e: + results.append(f"⚠️ Could not save token.json: {e}") + # Save to .env file if requested if storage_method == 'env_file': env_file = NODE_DIR / '.env' diff --git a/drivesend_uploader_node.py b/drivesend_uploader_node.py index f1e9f0e..f4fc91b 100644 --- a/drivesend_uploader_node.py +++ b/drivesend_uploader_node.py @@ -34,16 +34,11 @@ class DriveSendAutoUploaderNode: "multiline": False, "tooltip": "Folder to monitor (leave blank for ComfyUI output folder)" }), - "folder_id": ("STRING", { - "default": "", - "multiline": False, - "tooltip": "Google Drive folder ID (uses env var if blank)" - }), } } def run(self, auth_method, run_process, enable_encryption, Subfolder_Monitor, - Post_Delete_Enc, watch_folder="", folder_id=""): + Post_Delete_Enc, watch_folder=""): """ Start or stop the Google Drive upload monitor. @@ -54,7 +49,6 @@ class DriveSendAutoUploaderNode: Subfolder_Monitor: Monitor subfolders recursively Post_Delete_Enc: Delete .enc files after upload watch_folder: Folder to monitor (default: ComfyUI output) - folder_id: Google Drive folder ID (default: from env var) """ # Stop if requested @@ -90,15 +84,14 @@ class DriveSendAutoUploaderNode: if not watch_path.exists(): return (f"❌ Error: Watch folder does not exist: {watch_path}",) - # Get folder ID from parameter or environment - effective_folder_id = folder_id or os.environ.get('GOOGLE_DRIVE_FOLDER_ID') + # Get folder ID from environment + effective_folder_id = os.environ.get('GOOGLE_DRIVE_FOLDER_ID') if not effective_folder_id: return ( - "❌ Error: No folder_id provided.\n\n" - "Either:\n" - "1. Set the folder_id parameter in this node\n" - "2. Set GOOGLE_DRIVE_FOLDER_ID environment variable\n" - "3. Run the DriveSend Setup node first", + "❌ Error: GOOGLE_DRIVE_FOLDER_ID not set.\n\n" + "Run the DriveSend Setup node first, then:\n" + "1. Copy credentials to RunPod Secrets\n" + "2. Restart pod with environment variables loaded", ) # Check for encryption key if encryption is enabled