Skip to main content

WebDeployToolkit

A simple toolkit for initializing React projects and deploying web. This toolkit provides core functionality to:
  • Initialize new React projects
  • Build React applications
  • Deploy HTML content to local server
  • Serve static websites locally

init

Initialize the WebDeployToolkit. Parameters:
  • timeout (Optional[float]): Command timeout in seconds. (default: :obj:None)
  • add_branding_tag (bool): Whether to add brand tag to deployed pages. (default: :obj:True)
  • logo_path (str): Path to custom logo file (SVG, PNG, JPG, ICO). (default: :obj:../camel/misc/favicon.png)
  • tag_text (str): Text to display in the tag. (default: :obj:Created by CAMEL)
  • tag_url (str): URL to open when tag is clicked. (default: :obj:https://github.com/camel-ai/camel)
  • remote_server_ip (Optional[str]): Remote server IP for deployment. (default: :obj:None - use local deployment)
  • remote_server_port (int): Remote server port. (default: :obj:8080)

_validate_ip_or_domain

Validate IP address or domain name format.

_validate_port

Validate port number.

_sanitize_text

Sanitize text to prevent XSS.

_validate_url

Validate URL format.

_validate_subdirectory

Validate subdirectory to prevent path traversal.

_is_port_available

Check if a port is available for binding.

_load_server_registry

Load server registry from persistent storage.

_save_server_registry

Save server registry to persistent storage.

_is_process_running

Check if a process with given PID is still running.

_build_custom_url

Build custom URL with optional subdirectory. Parameters:
  • domain (str): Custom domain
  • subdirectory (Optional[str]): Subdirectory path
Returns: str: Complete custom URL

_load_logo_as_data_uri

Load a local logo file and convert it to data URI. Parameters:
  • logo_path (str): Path to the logo file
Returns: str: Data URI of the logo file
Returns: str: Default logo data URI

deploy_html_content

Deploy HTML content to a local server or remote server. Parameters:
  • html_content (Optional[str]): HTML content to deploy. Either this or html_file_path must be provided.
  • html_file_path (Optional[str]): Path to HTML file to deploy. Either this or html_content must be provided.
  • file_name (str): Name for the HTML file when using html_content. (default: :obj:index.html)
  • port (int): Port to serve on. (default: :obj:8000) (default: 8000)
  • domain (Optional[str]): Custom domain to access the content. (e.g., :obj:example.com)
  • subdirectory (Optional[str]): Subdirectory path for multi-user deployment. (e.g., :obj:user123)
Returns: Dict[str, Any]: Deployment result with server URL and custom domain info.

_deploy_to_remote_server

Deploy HTML content to remote server via API. Parameters:
  • html_content (str): HTML content to deploy
  • subdirectory (Optional[str]): Subdirectory path for deployment
  • domain (Optional[str]): Custom domain
Returns: Dict[str, Any]: Deployment result

_deploy_to_local_server

Deploy HTML content to local server (original functionality). Parameters:
  • html_content (str): HTML content to deploy
  • file_name (str): Name for the HTML file
  • port (int): Port to serve on (default: 8000) (default: 8000)
  • domain (Optional[str]): Custom domain
  • subdirectory (Optional[str]): Subdirectory path
Returns: Dict[str, Any]: Deployment result

_serve_static_files

Serve static files from a directory using a local HTTP server (as a background process). Parameters:
  • directory (str): Directory to serve files from
  • port (int): Port to serve on (default: 8000) (default: 8000)
Returns: Dict[str, Any]: Server information

deploy_folder

Deploy a folder containing web files. Parameters:
  • folder_path (str): Path to the folder to deploy.
  • port (int): Port to serve on. (default: :obj:8000) (default: 8000)
  • domain (Optional[str]): Custom domain to access the content. (e.g., :obj:example.com)
  • subdirectory (Optional[str]): Subdirectory path for multi-user deployment. (e.g., :obj:user123)
Returns: Dict[str, Any]: Deployment result with custom domain info.

_deploy_folder_to_local_server

Deploy folder to local server (original functionality). Parameters:
  • folder_path (str): Path to the folder to deploy
  • port (int): Port to serve on
  • domain (Optional[str]): Custom domain
  • subdirectory (Optional[str]): Subdirectory path
Returns: Dict[str, Any]: Deployment result

_deploy_folder_to_remote_server

Deploy folder to remote server via API. Parameters:
  • folder_path (str): Path to the folder to deploy
  • subdirectory (Optional[str]): Subdirectory path for deployment
  • domain (Optional[str]): Custom domain
Returns: Dict[str, Any]: Deployment result

stop_server

Stop a running server on the specified port. Parameters:
  • port (int): Port of the server to stop.
Returns: Dict[str, Any]: Result of stopping the server.

list_running_servers

Returns: Dict[str, Any]: Information about running servers

get_tools

Get all available tools from the WebDeployToolkit.