Skip to content

Commit

Permalink
remove the unused json import and revert the response of type applica…
Browse files Browse the repository at this point in the history
…tion/octet-stream back to json.dumps, change a log message argument to display failing reason
  • Loading branch information
xx12345798 committed Jan 5, 2025
1 parent f937db9 commit 4efa440
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion application/routes/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# furnished to do so, subject to the following conditions:
#
#
import json

from flask import request, abort, jsonify

Expand Down
1 change: 0 additions & 1 deletion application/routes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

import json
import threading

from flask import request, abort, jsonify
Expand Down
4 changes: 2 additions & 2 deletions application/routes/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import json

from flask import request, abort, stream_with_context, jsonify
from flask import request, abort, stream_with_context

from .common import create_connection
from .. import api, app
Expand Down Expand Up @@ -59,7 +59,7 @@ def generate():
'port': TERMINAL_PORT,
'term_id': term.id
}
yield jsonify(result)
yield json.dumps(result)

return app.response_class(stream_with_context(generate()), mimetype='application/octet-stream')

Expand Down
6 changes: 3 additions & 3 deletions application/routes/vnc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import json
import logging

from flask import request, abort, stream_with_context, jsonify
from flask import request, abort, stream_with_context

from .common import create_connection
from .. import api, app, profiles
Expand Down Expand Up @@ -93,7 +93,7 @@ def generate():
'port': ws_port,
'credentials': credentials
}
yield jsonify(result)
yield json.dumps(result)

return app.response_class(stream_with_context(generate()), mimetype='application/octet-stream')

Expand All @@ -104,7 +104,7 @@ def change_vncpasswd():

vnc, reason = create_connection(session_id, ConnectionType.VNC)
if reason != '':
logger.error("create_connection() failed with status=", status)
logger.error("create_connection() failed with status=", reason)
abort(403, description=reason)

passwd = request.json.get('passwd')
Expand Down

0 comments on commit 4efa440

Please sign in to comment.