From e6d087f148fa8ae3ab57628293e8c1990c29b8c5 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 1 Mar 2024 22:56:49 +0100 Subject: [PATCH] Terminal --- app.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app.py b/app.py index 69dc529..1adfc78 100644 --- a/app.py +++ b/app.py @@ -216,6 +216,27 @@ def consolelxc(): flash('Error starting Terminal :'+str(e), category='danger') return redirect(url_for('state')) +@app.route('/ter',methods=['GET','POST',"DELETE"]) +@login_required +def ter_connect(): + if request.method=='GET': + resp = requests.get('http://localhost:5008/') + excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection'] + headers = [(name, value) for (name, value) in resp.raw.headers.items() if name.lower() not in excluded_headers] + response = Response(resp.content, resp.status_code, headers) + return response + elif request.method=='POST': + resp = requests.post('http://localhost:5008/',json=request.get_json()) + excluded_headers = ['content-encoding', 'content-length', 'transfer-encoding', 'connection'] + headers = [(name, value) for (name, value) in resp.raw.headers.items() if name.lower() not in excluded_headers] + response = Response(resp.content, resp.status_code, headers) + return response + elif request.method=='DELETE': + resp = requests.delete('http://localhost:5008/').content + response = Response(resp.content, resp.status_code, headers) + return response + + @app.route('/console_vm',methods=['POST']) @login_required def consolevm():