mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 07:31:51 +09:00
- Removed old llm_login and session scripts, replacing them with a new structure for handling SSO login and session management. - Introduced a new prompt system for collecting SSO redirect URLs, ensuring compliance with security protocols. - Implemented a robust backend notification system for tracking scan initiation. - Enhanced browser profile configuration and resource management for improved session handling. - Added utility functions for environment variable checks and logging. - Updated the overall architecture to improve maintainability and readability.
25 lines
978 B
Python
25 lines
978 B
Python
from pathlib import Path
|
|
|
|
async def clean_resources(agent=None, session=None):
|
|
"""리소스를 정리하는 함수"""
|
|
storage_state_temp_path = Path("./data/storage_state_temp.json").resolve()
|
|
if storage_state_temp_path.exists():
|
|
try:
|
|
# remove file
|
|
print(f"🗑️ 임시 스토리지 상태 파일 삭제 중: {storage_state_temp_path}")
|
|
# unlink removes the file
|
|
storage_state_temp_path.unlink()
|
|
print("🗑️ 임시 스토리지 상태 파일 삭제 완료.")
|
|
except Exception as e:
|
|
print(f"⚠️ 임시 스토리지 상태 파일 삭제 실패: {e}")
|
|
|
|
if agent:
|
|
try:
|
|
await agent.close()
|
|
except Exception as e:
|
|
print(f"⚠️ 에이전트 리소스 정리 실패: {e}")
|
|
if session:
|
|
try:
|
|
await session.close()
|
|
except Exception as e:
|
|
print(f"⚠️ 세션 리소스 정리 실패: {e}")
|