Skip to content
Snippets Groups Projects
Commit f57035bd authored by Chris Hines's avatar Chris Hines
Browse files

add commands for a local backend executing vnclaunch

parent d1a6d399
No related branches found
No related tags found
4 merge requests!77Revert "disable agressive kill and restart",!35Dev,!30Test,!29Dev
from tes import app def main():
import logging from tes import app
logging.basicConfig(filename="tes.log",format="%(asctime)s %(levelname)s:%(process)s: %(message)s") import logging
logger=logging.getLogger() logging.basicConfig(filename="tes.log",format="%(asctime)s %(levelname)s:%(process)s: %(message)s")
logger.setLevel(logging.DEBUG) logger=logging.getLogger()
app.config['ENABLELAUNCH'] = True logger.setLevel(logging.DEBUG)
app.config['ENABLELAUNCH'] = True
from flask_cors import CORS, cross_origin
app.run(host='localhost',debug=True,port=8080)
CORS(app, supports_credentials=True, origin="*")
app.run(host='localhost',debug=True,port=8080)
if __name__ == "__main__":
main()
...@@ -88,7 +88,7 @@ setup( ...@@ -88,7 +88,7 @@ setup(
# "scripts" keyword. Entry points provide cross-platform support and allow # "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform. # pip to create the appropriate form of executable for the target platform.
entry_points={ entry_points={
'console_scripts': [ 'wsgi_app=tes:tes_wsgi'], 'console_scripts': [ 'wsgi_app=tes:tes_wsgi', 'vnclaunch=vnclaunch.__main__:main','runserver=runserver:main'],
'gui_scripts': [ ] 'gui_scripts': [ ]
}, },
) )
...@@ -11,7 +11,7 @@ app.config['MESSAGES'] = '/messages' ...@@ -11,7 +11,7 @@ app.config['MESSAGES'] = '/messages'
app.config['DEBUG'] = True app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'asdasfdfj' app.config['SECRET_KEY'] = 'asdasfdfj'
import datetime import datetime
app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(seconds=3600) app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(seconds=30)
app.config['SESSION_REFRESH_EACH_REQUEST'] = True app.config['SESSION_REFRESH_EACH_REQUEST'] = True
app.config['SESSION_COOKIE_NAME'] = 'tessession' app.config['SESSION_COOKIE_NAME'] = 'tessession'
app.config['SESSION_COOKIE_SECURE'] = True app.config['SESSION_COOKIE_SECURE'] = True
......
...@@ -454,10 +454,10 @@ class AppLaunch(Resource): ...@@ -454,10 +454,10 @@ class AppLaunch(Resource):
if stderr != "": if stderr != "":
msg = stderr msg = stderr
else: else:
msg = "Unable to start the vncviewer" msg = "Unable to start the program {}".format(appdef['client']['cmd'])
return apiabort(500,message=msg) return apiabort(500,message=msg)
except FileNotFoundError: except FileNotFoundError:
return apiabort(500,message="Unable to find a vncviewer") return apiabort(500,message="Unable to find the program {}".format(appdef['client']['cmd']))
pass pass
return None return None
......
import sys
port = sys.argv[1]
passwd = sys.argv[2]
import subprocess
p = subprocess.Popen(['vncpasswd','-f'],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
(encpass,stderr) = p.communicate(passwd)
p = subprocess.Popen(['vncviewer','-autopass','localhost::{}'.format(port)],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p.communicate(passwd)
def main():
import sys
port = sys.argv[1]
passwd = sys.argv[2]
import subprocess
p = subprocess.Popen(['vncpasswd','-f'],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
(encpass,stderr) = p.communicate(passwd)
p = subprocess.Popen(['vncviewer','-autopass','localhost::{}'.format(port)],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
p.communicate(passwd)
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment