Fixed typing

This commit is contained in:
Maxim Stewart 2020-07-01 21:55:56 -05:00
parent c1279211bb
commit f7e0ec9ff6
8 changed files with 132 additions and 11 deletions

View File

@ -43,14 +43,12 @@ def updateCoords2(x, y):
message='Key is not a valid input...')
@app.route('/send-key', methods=['GET', 'POST'])
def sendKey():
pyautogui.doubleClick()
@app.route('/send-keys', methods=['GET', 'POST'])
def sendKeys():
if request.method == 'POST':
try:
text = str(request.values['text']).strip()
pyautogui.typewrite(text);
# print("\nX: {} Y: {}".format(str(x), str(y)))
# pyautogui.typewrite('Hello world!\n', interval=secs_between_keys) # useful for entering text, newline is Enter
# pyautogui.press(['left', 'left', 'left', 'left']) # Press the left arrow key 4 times.

View File

@ -57,6 +57,12 @@ def scrollDown(eve = None):
pyautogui.scroll(-1)
return ""
@app.route('/press-enter')
@socketio.on('press_enter')
def pressEnter(eve = None):
pyautogui.press("enter")
return ""
@socketio.on('update_coords')
def updateCoords(message):

View File

@ -63,9 +63,10 @@ input {
cursor: pointer;
}
#sendKeysBtn,
#pressEnterBtn,
#scrollToggle,
#mouseHoldToggle,
#sendKeysBtn {
#mouseHoldToggle {
display: inline-block;
font-size: 280%;
width: 100%;

View File

@ -114,6 +114,15 @@ function rightClick() {
socket.emit('right_click', "");
}
function sendKeys() {
const text = document.getElementById("sendKeysField").value.trim();
doAjax("/send-keys", "text=" + text, "send-keys");
}
function pressEnter() {
socket.emit('press_enter', "");
}
function scrollToggle() {
if (isScrolling) {
isScrolling = false;
@ -160,6 +169,8 @@ document.addEventListener("touchend", touchHandler, true);
document.addEventListener("touchcancel", touchHandler, true);
document.getElementById("rightClickBtn").addEventListener("mouseup", rightClick, true);
document.getElementById("sendKeysBtn").addEventListener("mouseup", sendKeys, true);
document.getElementById("pressEnterBtn").addEventListener("mouseup", pressEnter, true);
document.getElementById("scrollToggle").addEventListener("mouseup", scrollToggle, true);
document.getElementById("mouseHoldToggle").addEventListener("mouseup", holdToggle, true);

View File

@ -0,0 +1,99 @@
/* Elms */
ul, li {
list-style: none;
}
body {
touch-action: manipulation;
overflow: hidden; /* Used to prevent touch scroll down reloading page. Ref: https://stackoverflow.com/questions/29008194/disabling-androids-chrome-pull-down-to-refresh-feature */
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Opera and Firefox */
}
input {
width: 100% !important;
margin: 0 auto !important;
background-color: #00000000 !important;
}
/* IDs */
#bg {
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
z-index: -999;
}
#bg img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: -999;
}
#canvas {
position: relative;
width: 98%;
min-height: 1000px;
border: 2px solid #c3c3c3;
}
#rightClickBtn {
display: none; /* Hide button unless screen bigger than media query says it is */
border-style: dashed;
border-width: 2px;
overflow: auto;
font-size: 280%;
}
#rightClickBtn:hover {
background-color: rgba(0, 232, 255, 0.5);
cursor: pointer;
}
#sendKeysBtn,
#pressEnterBtn,
#scrollToggle,
#mouseHoldToggle {
display: inline-block;
font-size: 280%;
width: 100%;
}
@media only screen and (max-device-width: 800px) {
#sendKeysField {
font-size: 300% !important;
}
}
/* nothing with screen size smaller than 8000px */
@media only screen and (min-device-width: 801px) {
body {
width: 800px;
margin: 0 auto;
}
#rightClickBtn {
display: inline-block;
}
}
/* Classes */
/* Other message text colors */
.errorTxt { color: rgb(170, 18, 18); }
.warningTxt { color: rgb(255, 168, 0); }
.successTxt { color: rgb(136, 204, 39); }

View File

@ -15,8 +15,15 @@
</div>
<br/><br/>
<div class="row">
<div class="col justify-content-center text-center">
<button id="sendKeysBtn" class="btn btn-success btn-lg">Send</button>
<div class="col">
<div class="col justify-content-center text-center">
<button id="sendKeysBtn" class="btn btn-success btn-lg">Send</button>
</div>
</div>
<div class="col">
<div class="col justify-content-center text-center">
<button id="pressEnterBtn" class="btn btn-success btn-lg">Enter</button>
</div>
</div>
</div>
<br/><br/>

View File

@ -6,7 +6,7 @@
function main() {
source "/home/abaddon/Portable_Apps/py-venvs/remotemouse-venv/bin/activate"
source "../venv/bin/activate"
# Note can replace 127.0.0.1 with 0.0.0.0 to make it 'network/internet' accessable...
# Note: NEED -k eventlet for this to work! I spent too many hours on this...
gunicorn wsgi:app -b 127.0.0.1:8088 -k eventlet # <module>:<app> IE <file>:<flask app variable>

View File

@ -10,7 +10,6 @@ function main() {
cd "${SCRIPTPATH}"
echo "Working Dir: " $(pwd)
mkdir /tmp/apps
/home/abaddon/Portable_Apps/py-venvs/remotemouse-venv/bin/gunicorn \
--bind unix:/tmp/apps/remoteconn.sock wsgi:app
../venv/bin/gunicorn --bind unix:/tmp/apps/remoteconn.sock wsgi:app
}
main $@;