fix password&resolution (#251)
* fix chrome * fix: fix proxy setup * feat&fix: add proxy support in setup and remove hardcoded proxy from example * fix tasks * fix chrome finished * fix * clean chrome_fix code * clean chrome_fix code * fix chrome 2888b4e6-5b47-4b57-8bf5-c73827890774 * fix multiapps * fix chrome 2888b4e6-5b47-4b57-8bf5-c73827890774 * fix some multi_apps tasks * fix some multi_apps tasks * fix password&resolution * fix password&resolution --------- Co-authored-by: adlsdztony <zzl0712@connect.hku.hk>
This commit is contained in:
@@ -27,7 +27,13 @@ import dotenv
|
||||
# Load environment variables from .env file
|
||||
dotenv.load_dotenv()
|
||||
|
||||
CLIENT_PASSWORD = os.getenv("CLIENT_PASSWORD", "osworld-public-evaluation") # Default password for sudo operations
|
||||
if os.environ.get("PROVIDER_NAME") == "aws":
|
||||
os.environ["CLIENT_PASSWORD"] = os.environ.get("CLIENT_PASSWORD_AWS", "osworld-public-evaluation")
|
||||
else:
|
||||
os.environ["CLIENT_PASSWORD"] = os.environ.get("CLIENT_PASSWORD", "password")
|
||||
|
||||
CLIENT_PASSWORD = os.environ["CLIENT_PASSWORD"]
|
||||
|
||||
PROXY_CONFIG_FILE = os.getenv("PROXY_CONFIG_FILE", "evaluation_examples/settings/proxy/dataimpulse.json") # Default proxy config file
|
||||
|
||||
logger = logging.getLogger("desktopenv.setup")
|
||||
@@ -298,6 +304,22 @@ class SetupController:
|
||||
terminates: bool = False
|
||||
nb_failings = 0
|
||||
|
||||
def replace_screen_env_in_command(command_list):
|
||||
width = int(os.environ.get("SCREEN_WIDTH", 1920))
|
||||
height = int(os.environ.get("SCREEN_HEIGHT", 1080))
|
||||
width_half = str(width // 2)
|
||||
height_half = str(height // 2)
|
||||
new_command_list = []
|
||||
for item in command_list:
|
||||
if isinstance(item, str):
|
||||
item = item.replace("{SCREEN_WIDTH_HALF}", width_half)
|
||||
item = item.replace("{SCREEN_HEIGHT_HALF}", height_half)
|
||||
item = item.replace("{SCREEN_WIDTH}", str(width))
|
||||
item = item.replace("{SCREEN_HEIGHT}", str(height))
|
||||
new_command_list.append(item)
|
||||
return new_command_list
|
||||
if isinstance(command, list):
|
||||
command = replace_screen_env_in_command(command)
|
||||
payload = json.dumps({"command": command, "shell": shell})
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user