Consolidated call and removed method
This commit is contained in:
parent
b2f53b5917
commit
62c678ff68
|
@ -24,49 +24,12 @@ def home():
|
||||||
message='Must use GET request type...')
|
message='Must use GET request type...')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/sound-manager')
|
|
||||||
def soundManager():
|
|
||||||
if request.method == 'GET':
|
|
||||||
# command = 'runuser -l abaddon bash -c "pacmd list-sink-inputs"'
|
|
||||||
command = 'sudo -u abaddon bash -c "pacmd list-sink-inputs"'
|
|
||||||
# command = 'sudo -u abaddon bash <<EOF pacmd list-sink-inputs EOF'
|
|
||||||
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
|
||||||
result = process.wait()
|
|
||||||
print(process.stdout.read())
|
|
||||||
_apps = []
|
|
||||||
return render_template('sound-manager.html',
|
|
||||||
apps=_apps)
|
|
||||||
|
|
||||||
return render_template('error.html',
|
|
||||||
title='Error!',
|
|
||||||
message='Must use GET request type...')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/update-coords/xy/<x>/<y>')
|
|
||||||
def updateCoords2(x, y):
|
|
||||||
try:
|
|
||||||
# print(x + "," + y)
|
|
||||||
pyautogui.moveRel(float(x), float(y));
|
|
||||||
return "{}"
|
|
||||||
except Exception as e:
|
|
||||||
print( repr(e) )
|
|
||||||
return render_template('error.html',
|
|
||||||
title='Error!',
|
|
||||||
message='Key is not a valid input...')
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/send-keys', methods=['GET', 'POST'])
|
@app.route('/send-keys', methods=['GET', 'POST'])
|
||||||
def sendKeys():
|
def sendKeys():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
try:
|
try:
|
||||||
text = str(request.values['text']).strip()
|
text = str(request.values['text']).strip()
|
||||||
pyautogui.typewrite(text);
|
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.
|
|
||||||
# pyautogui.keyDown('shift') # Press the Shift key down and hold it.
|
|
||||||
# pyautogui.keyUp('shift') # Let go of the Shift key.
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print( repr(e) )
|
print( repr(e) )
|
||||||
return render_template('error.html',
|
return render_template('error.html',
|
||||||
|
|
|
@ -16,62 +16,66 @@ msgHandler = MessageHandler()
|
||||||
|
|
||||||
|
|
||||||
@app.route('/mouse-down')
|
@app.route('/mouse-down')
|
||||||
@socketio.on('mouse_down')
|
@socketio.on('mouse_down', namespace='/socket.io')
|
||||||
def mouseDown(eve = None):
|
def mouseDown(eve = None):
|
||||||
pyautogui.mouseDown()
|
pyautogui.mouseDown()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/mouse-up')
|
@app.route('/mouse-up')
|
||||||
@socketio.on('mouse_up')
|
@socketio.on('mouse_up', namespace='/socket.io')
|
||||||
def mouseUp(eve = None):
|
def mouseUp(eve = None):
|
||||||
pyautogui.mouseUp()
|
pyautogui.mouseUp()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@app.route('/left-click')
|
@app.route('/left-click')
|
||||||
@socketio.on('left_click')
|
@socketio.on('left_click', namespace='/socket.io')
|
||||||
def leftClick(eve = None):
|
def leftClick(eve = None):
|
||||||
pyautogui.click()
|
pyautogui.click()
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/right-click')
|
@app.route('/right-click')
|
||||||
@socketio.on('right_click')
|
@socketio.on('right_click', namespace='/socket.io')
|
||||||
def rightClick(eve = None):
|
def rightClick(eve = None):
|
||||||
pyautogui.click(button='right')
|
pyautogui.click(button='right')
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/scroll-up')
|
@app.route('/scroll-up')
|
||||||
@socketio.on('scroll_up')
|
@socketio.on('scroll_up', namespace='/socket.io')
|
||||||
def scrollUp(eve = None):
|
def scrollUp(eve = None):
|
||||||
pyautogui.scroll(1)
|
pyautogui.scroll(1)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/scroll-down')
|
@app.route('/scroll-down')
|
||||||
@socketio.on('scroll_down')
|
@socketio.on('scroll_down', namespace='/socket.io')
|
||||||
def scrollDown(eve = None):
|
def scrollDown(eve = None):
|
||||||
pyautogui.scroll(-1)
|
pyautogui.scroll(-1)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/press-enter')
|
@app.route('/press-enter')
|
||||||
@socketio.on('press_enter')
|
@socketio.on('press_enter', namespace='/socket.io')
|
||||||
def pressEnter(eve = None):
|
def pressEnter(eve = None):
|
||||||
pyautogui.press("enter")
|
pyautogui.press("enter")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@app.route('/press-back')
|
@app.route('/press-back')
|
||||||
@socketio.on('press_back')
|
@socketio.on('press_back', namespace='/socket.io')
|
||||||
def pressBack(eve = None):
|
def pressBack(eve = None):
|
||||||
pyautogui.press("backspace")
|
pyautogui.press("backspace")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
@socketio.on('update_coords')
|
@app.route('/update-coords/xy/<message>/<message2>')
|
||||||
def updateCoords(message):
|
@socketio.on('update_coords', namespace='/socket.io')
|
||||||
|
def updateCoords(message = None, message2 = None):
|
||||||
try:
|
try:
|
||||||
parts = message.split(",")
|
parts = message.split(",")
|
||||||
x = float( parts[0] )
|
x = float( parts[0] )
|
||||||
y = float( parts[1] )
|
y = float( parts[1] )
|
||||||
# print(str(x) + "," + str(y))
|
# print(str(x) + "," + str(y))
|
||||||
pyautogui.moveRel(x, y);
|
pyautogui.moveRel(x, y);
|
||||||
|
return ""
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
return ""
|
||||||
|
|
Loading…
Reference in New Issue