mirror of
https://github.com/fcwu/docker-ubuntu-vnc-desktop
synced 2026-08-05 16:12:41 +02:00
feat: add resize endpoint to resize screen size (fix #115)
This commit is contained in:
@@ -9,7 +9,6 @@ from flask import (
|
||||
Response,
|
||||
jsonify,
|
||||
abort,
|
||||
url_for,
|
||||
)
|
||||
from gevent import subprocess as gsp, spawn, sleep
|
||||
from geventwebsocket.exceptions import WebSocketError
|
||||
@@ -28,7 +27,6 @@ app.config.from_object(os.environ.get('CONFIG') or 'config.Development')
|
||||
@app.route('/api/state')
|
||||
@httperror
|
||||
def apistate():
|
||||
print(url_for("apistate"))
|
||||
state.wait(int(request.args.get('id', -1)), 30)
|
||||
state.switch_video(request.args.get('video', 'false') == 'true')
|
||||
mystate = state.to_dict()
|
||||
@@ -40,7 +38,6 @@ def apistate():
|
||||
|
||||
@app.route('/api/health')
|
||||
def apihealth():
|
||||
print(url_for("apihealth"))
|
||||
if state.health:
|
||||
return 'success'
|
||||
abort(503, 'unhealthy')
|
||||
@@ -71,6 +68,13 @@ def reset():
|
||||
return jsonify({'code': 200})
|
||||
|
||||
|
||||
@app.route('/resize')
|
||||
@httperror
|
||||
def apiresize():
|
||||
state.reset_size()
|
||||
return '<html><head><script type = "text/javascript">var h=window.location.href;window.location.href=h.substring(0,h.length-6);</script></head></html>'
|
||||
|
||||
|
||||
@app.route('/api/live.flv')
|
||||
@httperror
|
||||
def liveflv():
|
||||
|
||||
@@ -113,6 +113,9 @@ class State(object):
|
||||
except gsp.CalledProcessError as e:
|
||||
log.warn('failed to get dispaly size: ' + str(e))
|
||||
|
||||
def reset_size(self):
|
||||
self.size_changed_count = 0
|
||||
|
||||
@property
|
||||
def w(self):
|
||||
return self._w
|
||||
|
||||
Reference in New Issue
Block a user