Skip to content

Commit

Permalink
improving the docs and some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bandinopla committed Apr 28, 2022
1 parent f130935 commit 6c90bd5
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 49 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

PC-Remote is a python desktop app that runs on the PC you want to control, it will open a console window showing a QR code and a url, you must access that url from your phone to start controlling the mouse and keyboard.

<img src="img/cover.jpg" width="45%" height="50%">|
<img src="img/A.jpg" width="15%" height="30%">|
<img src="img/B.jpg" width="15%" height="30%">|
<img src="img/C.jpg" width="15%" height="30%">


# How it's made
The server is written in Python and it uses [pyautogui](https://pyautogui.readthedocs.io/) to control the mouse and keyboard. It creates a WebSocket server and a simple HTTPServer used to deliver the front end app which is done in [React](https://reactjs.org/)

Expand Down
Binary file added img/A.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/B.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/C.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/cover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 1 addition & 46 deletions py-src/app.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@

from email.mime import image
import http.server
import socketserver # Establish the TCP Socket connections
import os
import socket
import pyautogui
import sys
import asyncio
from websockets import serve

import threading
from threading import Thread
from PIL import Image
import qrcode
import io


from utils import resource_path, get_ip
from server.httpserver import startHTTPServer
from server.websocketserver import startWebSocketServer



if __name__ == "__main__":
print('''
-------------------------------------------------------
Expand All @@ -34,29 +14,4 @@
a = threading.Thread(target=startHTTPServer)
b = threading.Thread(target=startWebSocketServer)
a.start()
b.start()




#//asyncio.run(main())

#//-----------------------------------------------
# def thishost( _thishost ):
# """Return the IP addresses of the current host."""

# if _thishost is None:
# try:
# _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2])
# except socket.gaierror:
# _thishost = tuple(socket.gethostbyname_ex('localhost')[2])
# return _thishost

# def resolve_host(host):
# data = socket.gethostbyname_ex(host)
# return data[2][0]


# hostname = socket.getfqdn()
# print("IP Address:", get_ip() )

b.start()
3 changes: 2 additions & 1 deletion py-src/server/httpserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from utils import resource_path, get_ip
import qrcode
import io
import http.server

PORT = 9000


class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
if( self.path == "/"):
Expand Down
6 changes: 4 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var server;
const HOST = "ws://" + (document.location.hostname || "localhost") + ":8000";

function App() {
const [tab, setTab] = useState(1);
const [tab, setTab] = useState(0);
const [error, setError] = useState();
const [connected, setConnected] = useState(false);

Expand All @@ -41,7 +41,7 @@ function App() {


const onServerError = ev => {
setError("Connection with the server app lost. Check your connection and see if the server app is open, then try refreshing the page.")
setError("Oops! Something went wrong.")
}

const onServerConnected = ev => {
Expand Down Expand Up @@ -105,6 +105,8 @@ function App() {
if( error )
{
return <div className="error" onClick={()=>window.location.reload()}>

<svg style={{ display:"block", marginBottom:20, fill:"red"}} xmlns="http://www.w3.org/2000/svg" height="48" width="80%"><path d="M28.3 8H39.8V11H33.25L34 11.7Q37 14.5 38.5 17.7Q40 20.9 40 23.85Q40 29.15 36.9 33.4Q33.8 37.65 28.7 39.25V36.1Q32.5 34.65 34.75 31.275Q37 27.9 37 23.85Q37 21.45 35.825 18.975Q34.65 16.5 32.75 14.6L31.3 13.3V19.5H28.3ZM19.85 40H8.35V37H14.85L14.1 36.4Q10.9 33.85 9.45 30.85Q8 27.85 8 24.15Q8 18.85 11.125 14.625Q14.25 10.4 19.35 8.8V11.9Q15.6 13.35 13.3 16.725Q11 20.1 11 24.15Q11 27.3 12.175 29.625Q13.35 31.95 15.35 33.65L16.85 34.7V28.5H19.85Z"/></svg>
{error}
<div style={{fontSize:"0.7em", marginTop:20}}>click to refresh the page</div>
</div>
Expand Down

0 comments on commit 6c90bd5

Please sign in to comment.