https://github.com/explor4268/wsctrl
Web Socket Cursor and Controller
https://github.com/explor4268/wsctrl
Last synced: 24 days ago
JSON representation
Web Socket Cursor and Controller
- Host: GitHub
- URL: https://github.com/explor4268/wsctrl
- Owner: explor4268
- License: mit
- Created: 2024-04-09T11:03:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-09T12:09:28.000Z (about 1 year ago)
- Last Synced: 2024-04-09T15:39:21.025Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wsctrl
Control your PC (and maybe Dolphin Emulator with DSU protocol) with your phone by moving your phone like a Wiimote from just a web interface!
## Running the server
### You may create a Python virtual environment first:
```bash
python3 -m venv venv # Replace the last venv and all other venv below with your desired path of your virtual environment
. venv/bin/activate # you may adjust this depending of your shell
```### Running the WebSocket server with Python:
```bash
pip install -r requirements.txt
cd py/
python3 main.py
```### Running the front-end HTTP server:
Use whatever static HTTP server as you wish **to serve the `js/` folder.** (e.g. `cd js/ && python3 -m http.server PORT`)
However, to make this work the page must be run with [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts). **Visiting the server by directly using your local IP Address (e.g. `http://192.168.x.x/`) does not work.**
- You have to tunnel the server with SSH forwarding on the client (e.g. with [Termux](https://github.com/termux/termux-app) and running `ssh USERNAME@YOUR_HOST_IP_OR_NAME -L THIS_DEVICE_PORT:localhost:YOUR_HTTP_SERVER_PORT -L 8081:localhost:8081`) then visiting `http://localhost:THIS_DEVICE_PORT/`.
- Alternatively, you can use reverse tunnel to expose the server to the public **with HTTPS** (e.g. ngrok, Cloudflare Tunneling) and visiting it from there (you may change the port configuration in `js/client.js` and `py/main.py` to the correct host and port)Currently, there is no npm dependencies for the JavaScript front-end, so it is completely vanilla.
## TODO
- [ ] More controls
- [ ] Fix moving while phone is tiled (so the cursor movement is not tilted too)
- [ ] DSU
- [ ] Not to hard-code the Websocket port 8001 and make it as a command-line options.
- [ ] Built-in HTTP server
- [ ] Fix other bugs