diff --git a/client/ayon_core/tools/tray/__init__.py b/client/ayon_core/tools/tray/__init__.py new file mode 100644 index 0000000000..b57461b88f --- /dev/null +++ b/client/ayon_core/tools/tray/__init__.py @@ -0,0 +1,49 @@ +import os +from typing import Optional, Dict, Any + +import ayon_api + + +def _get_default_server_url() -> str: + return os.getenv("AYON_SERVER_URL") + + +def _get_default_variant() -> str: + return ayon_api.get_default_settings_variant() + + +def get_tray_store_dir() -> str: + pass + + +def get_tray_information( + sever_url: str, variant: str +) -> Optional[Dict[str, Any]]: + pass + + +def validate_tray_server(server_url: str) -> bool: + tray_info = get_tray_information(server_url) + if tray_info is None: + return False + return True + + +def get_tray_server_url( + server_url: Optional[str] = None, + variant: Optional[str] = None +) -> Optional[str]: + if not server_url: + server_url = _get_default_server_url() + if not variant: + variant = _get_default_variant() + + +def is_tray_running( + server_url: Optional[str] = None, + variant: Optional[str] = None +) -> bool: + server_url = get_tray_server_url(server_url, variant) + if server_url and validate_tray_server(server_url): + return True + return False diff --git a/client/ayon_core/modules/webserver/__init__.py b/client/ayon_core/tools/tray/webserver/__init__.py similarity index 100% rename from client/ayon_core/modules/webserver/__init__.py rename to client/ayon_core/tools/tray/webserver/__init__.py diff --git a/client/ayon_core/modules/webserver/base_routes.py b/client/ayon_core/tools/tray/webserver/base_routes.py similarity index 100% rename from client/ayon_core/modules/webserver/base_routes.py rename to client/ayon_core/tools/tray/webserver/base_routes.py diff --git a/client/ayon_core/modules/webserver/cors_middleware.py b/client/ayon_core/tools/tray/webserver/cors_middleware.py similarity index 100% rename from client/ayon_core/modules/webserver/cors_middleware.py rename to client/ayon_core/tools/tray/webserver/cors_middleware.py diff --git a/client/ayon_core/modules/webserver/host_console_listener.py b/client/ayon_core/tools/tray/webserver/host_console_listener.py similarity index 100% rename from client/ayon_core/modules/webserver/host_console_listener.py rename to client/ayon_core/tools/tray/webserver/host_console_listener.py diff --git a/client/ayon_core/modules/webserver/server.py b/client/ayon_core/tools/tray/webserver/server.py similarity index 100% rename from client/ayon_core/modules/webserver/server.py rename to client/ayon_core/tools/tray/webserver/server.py diff --git a/client/ayon_core/modules/webserver/structures.py b/client/ayon_core/tools/tray/webserver/structures.py similarity index 100% rename from client/ayon_core/modules/webserver/structures.py rename to client/ayon_core/tools/tray/webserver/structures.py diff --git a/client/ayon_core/modules/webserver/version.py b/client/ayon_core/tools/tray/webserver/version.py similarity index 100% rename from client/ayon_core/modules/webserver/version.py rename to client/ayon_core/tools/tray/webserver/version.py diff --git a/client/ayon_core/modules/webserver/webserver_module.py b/client/ayon_core/tools/tray/webserver/webserver_module.py similarity index 100% rename from client/ayon_core/modules/webserver/webserver_module.py rename to client/ayon_core/tools/tray/webserver/webserver_module.py