# Playground **Repository Path**: bystretskiymikhail/playground ## Basic Information - **Project Name**: Playground - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 5 - **Created**: 2026-03-18 - **Last Updated**: 2026-04-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Previewer Web Service A web service for running HarmonyOS applications. ## Prerequisites ### Python 3.9+ - Ensure Python 3.9 or higher is installed ### Node.js and npm - Node.js and npm are required for frontend compilation ## Installation ### 1. Clone the repository ```bash git clone https://gitee.com/rri_opensource/playground.git cd playground ``` ### 2. Install Python dependencies ```bash pip install fastapi websockets python-multipart uvicorn pillow aiohttp aiofiles aiosqlite ``` ### 3. Install Node.js dependencies and build frontend ```bash npm install npm run compile ``` ## Configuration Modify the configuration file located at `config.json` according to your environment. Below is a simplified example based on the actual configuration structure: ```json { "configs": [ { "id": "master_20260216", "date": "Feb 16, 2026", "branch": "master branch", "compile_cmd": "RUN_DIR=$(pwd)/../tools ./arkcompiler.sh master {in_file} {out_file} {language}", "compile_dir": ".", "run_cmd": "RUN_DIR=$(pwd)/../../.. PREV_DIR=$RUN_DIR/previewer/common/bin PANDA_HOME=$PREV_DIR/module/panda LD_LIBRARY_PATH=.:$PREV_DIR:$PREV_DIR/module:$PREV_DIR/module/panda/linux_host_tools/lib ./Previewer {need_debug} -hap {hap} -lws {port} -sid {sid} -s {pipe} -refresh region -cpm false -device {device_type} -shape rect -sd {density} -or {width} {height} -cr {width} {height} -n entry -av ACE_2_0 -pm Stage -l zh_CN -cm {theme} -o {orientation}", "run_dir": "../tools/previewer/common/bin", "web_port": 5054, "support_languages": ["static", "dynamic"] } ], "web_host": "0.0.0.0", "web_port": 5000, "session_timeout": 600, "sessions_root": "/tmp/web_runner_sessions", "devices": { "phone": { "width": 1080, "height": 2340, "density": 480, "defaultOrientation": "portrait" }, "tablet": { "width": 1600, "height": 2560, "density": 400, "defaultOrientation": "landscape" }, "wearable": { "width": 466, "height": 466, "density": 320, "defaultOrientation": "portrait" }, "car": { "width": 1080, "height": 1920, "density": 320, "defaultOrientation": "landscape" }, "tv": { "width": 1080, "height": 1920, "density": 320, "defaultOrientation": "landscape" }, "2in1": { "width": 1600, "height": 2560, "density": 240, "defaultOrientation": "landscape" } } } ``` **Key configuration options:** - `configs`: List of run configurations (each with its own compiler and runner settings) - `web_host`: Host address for the web interface - `web_port`: Default port for the web interface (individual configs may override with their own `web_port`) - `session_timeout`: Timeout for closing Previewer sessions (in seconds) - `sessions_root`: Temporary folder for storing received files - `devices`: Device profile definitions (screen dimensions, density, default orientation) **Note:** The service uses a SQLite database (`playground.db`) to store session information. The database is automatically created in the project root if it does not exist. ## Running the Service Follow these steps to run the service: 1. **Install Node.js dependencies and build frontend:** ```bash npm install npm run compile ``` 2. **Start the frontend web service:** ```bash ./run_service_local.sh ``` Once running, access the web interface at [http://localhost:5000](http://localhost:5000). 3. **Start workers:** ```bash ./run_service_local.sh ``` Replace `` with the configuration identifier (e.g., `master_20260216`). Multiple workers can be started with different configurations. ### Usage 1. Select a `.hap` file or write your own code 2. Click "Run" to start the Previewer session ## Development ### Type Checking ```bash npm run type-check ``` ### Linting ```bash npm run lint ``` ### Code Formatting ```bash npm run format ``` ### Building Frontend ```bash npm run compile # or npm run build ``` ### Installing New Dependencies ```bash npm install ``` ## Configuration Files - `tsconfig.json`: TypeScript configuration - `.eslintrc.json`: ESLint rules - `.prettierrc`: Code formatting rules - `.eslintignore` / `.prettierignore`: Ignored files ## License See [LICENSE](LICENSE) file for details.