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():