diff --git a/route/dashboard.py b/route/dashboard.py index e500ed58c..9b9a6056c 100644 --- a/route/dashboard.py +++ b/route/dashboard.py @@ -4,8 +4,7 @@ import psutil import time import os import sys -sys.path.append(os.getcwd() + "/class/core/") -import public + from flask import Flask, session from flask import Blueprint, render_template @@ -14,6 +13,8 @@ from flask import request from flask import make_response from flask import Response +sys.path.append(os.getcwd() + "/class/core/") +import public dashboard = Blueprint('dashboard', __name__, template_folder='templates') diff --git a/route/files.py b/route/files.py index 649d2da9b..71df4d060 100644 --- a/route/files.py +++ b/route/files.py @@ -8,6 +8,7 @@ from flask import Flask from flask import Blueprint, render_template from flask import jsonify from flask import request +from flask import app sys.path.append("class/core") @@ -22,13 +23,13 @@ def index(): return render_template('default/files.html') -@files.route('get_body', methods=['POST']) +@files.route('/get_body', methods=['POST']) def getBody(): path = request.form.get('path', '').encode('utf-8') return file_api.file_api().getBody(path) -@files.route('save_body', methods=['POST']) +@files.route('/save_body', methods=['POST']) def saveBody(): path = request.form.get('path', '').encode('utf-8') data = request.form.get('data', '').encode('utf-8') @@ -36,6 +37,14 @@ def saveBody(): return file_api.file_api().saveBody(path, data, encoding) +@files.route('/download', methods=['GET']) +def download(): + file = request.args.get('filename', '').encode('utf-8') + return app.send_static_file(file) + # return '' + # return public.readFile(file) + + @files.route('/get_dir', methods=['POST']) def getDir(): path = request.form.get('path', '').encode('utf-8') @@ -46,6 +55,5 @@ def getDir(): page = request.args.get('p', '1').strip().lower() row = request.args.get('showRow', '10') - print path, int(page), int(row), search - + # print path, int(page), int(row), search return file_api.file_api().getDir(path, int(page), int(row), search)