main
root 2024-03-01 22:56:49 +01:00
parent 8f39dc4768
commit e6d087f148
1 changed files with 21 additions and 0 deletions

21
app.py
View File

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