A minimalist HTTPS API server designed to work with Your Pure AI. This lightweight server enables remote execution of scenarios and automation tasks on your computer from any mobile device on your local network.
This Python-based HTTPS server creates a secure endpoint that can receive JSON commands from the Your Pure AI app. When a valid request is received, the server saves the request data to a file which can then trigger various automated workflows on your computer.
- Secure HTTPS Communication: All traffic between your mobile device and computer is encrypted
- API Key Authentication: Requests are validated using a configurable API key
- Cross-Platform Compatibility: Works on Windows, macOS, and Linux
- Automation Integration: Compatible with popular automation tools including:
- UI.Vision RPA
- AutoHotKey
- Bash scripts
- PowerShell commands
- Other automation platforms
- Python 3.6 or higher
- OpenSSL (for generating SSL certificates)
git clone https://github.com/YourPureAI/YourPureAI-Remote-Computer-Control.git
cd yourpureai-computer-controlFor secure HTTPS communication, you need to create an SSL certificate:
openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodesWhen prompted, you can use the default values or customize as needed.
Run the server once to generate the default configuration file:
python https_server.pyThis will create a config.json file with default settings. Edit this file to:
- Change the default API key (
your_secure_api_key) to a secure value - Optionally modify the port (default: 8443)
{
"api_key": "your_secure_api_key",
"port": 8443,
"cert_file": "server.crt",
"key_file": "server.key"
}Run the server with:
python https_server.pyThe server will output its local address and port, for example:
Server running on https://localhost:8443 and is available from local network
https://localhost:8443/manage - used to manage the scenarios
https://localhost:8443/api - used to manage the API requests to run scenarios
- Run Your Pure AI Computer Control APP scenario_execution.py. Available on https://github.com/YourPureAI/YourPureAI-Computer-Control-app/tree/main or use direct implementation of automation platforms lik UI.Vision end others (info below)
- Test the connection
The server expects POST requests with JSON data including:
{
"compControlAPIKey": "your_secure_api_key",
"commandType": "runScript",
"scriptName": "example_script",
"parameters": {
"param1": "value1",
"param2": "value2"
}
}When a valid request is received, the server:
- Validates the API key
- Saves the request data (excluding the API key) to
actualRequest.json - Returns a success response
Create a script that monitors the actualRequest.json file and triggers macros based on the content:
// Example UI.Vision script
var fs = require('fs');
var requestData = JSON.parse(fs.readFileSync('actualRequest.json', 'utf8'));
if (requestData.commandType === 'runUiVisionMacro') {
runMacro(requestData.scriptName);
}; Example AutoHotKey script
Loop {
FileReadLine, fileContent, actualRequest.json, 1
parsedJson := JSON.parse(fileContent)
if (parsedJson.commandType = "runAhkScript") {
Run % parsedJson.scriptPath
}
Sleep, 5000
}#!/bin/bash
# Example bash monitor script
while true; do
if [[ -f "actualRequest.json" ]]; then
COMMAND_TYPE=$(jq -r '.commandType' actualRequest.json)
if [[ "$COMMAND_TYPE" == "runBashCommand" ]]; then
COMMAND=$(jq -r '.command' actualRequest.json)
eval "$COMMAND"
fi
fi
sleep 5
done# Example PowerShell monitor script
while ($true) {
if (Test-Path "actualRequest.json") {
$requestData = Get-Content "actualRequest.json" | ConvertFrom-Json
if ($requestData.commandType -eq "runPowershellCommand") {
Invoke-Expression $requestData.command
}
}
Start-Sleep -Seconds 5
}When accessing the server from a browser or app, you may see certificate warnings because the certificate is self-signed.
For testing purposes, these warnings can be bypassed:
- In browsers: Click "Advanced" and then "Proceed to [IP] (unsafe)"
- In apps: There may be a setting to ignore SSL certificate errors
For more secure usage, you can:
- Create a proper certificate from a trusted authority
- Create your own Certificate Authority (CA) and import it into all devices
If you can't connect to the server from other devices:
- Ensure your firewall allows incoming connections on the configured port
- Verify you're using the correct IP address and port
- Check that the server is running and listening on all interfaces (0.0.0.0)
- Confirm your mobile device is on the same network as your computer
- This server uses API key authentication but has minimal security features.
- It's recommended to use this only on trusted local networks.
- Update your API key regularly.
- The server should not be exposed to the public internet.
- Consider implementing additional security measures for sensitive environments.
[Specify your license here]
Contributions are welcome! Please feel free to submit a Pull Request.