details with mimetype

This commit is contained in:
2018-08-21 11:03:23 +03:00
parent 9da02ed65b
commit e93668828c
5 changed files with 35 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ from utils.utils import *
from utils.crypt import *
__FLEES_VERSION__ = "20180820.0"
__FLEES_VERSION__ = "20180821.0"
app = Flask(__name__)
app.config.from_object(__name__)
# Read config from json !
@@ -382,16 +382,32 @@ def file_ls(name, token):
if not ok:
return share
files = []
maxlen = 0
for file in iter_folder_files(share['path'], version_folder = app.config['VERSION_FOLDER']):
status = file_stat(share['path'],file)
files.append(
"%s %8s %s"%(
status['mtime'],
status['size'],
status['name'],
files.append(file)
maxlen = max(maxlen, len(file))
details = []
details.append(
"%%16s %%8s %%-%ds %%s"%( maxlen, )%(
'Modified',
'Size',
'Name',
'Type',
)
)
return "\n".join(files), 200
details.append("="*80)
for file in files:
status = file_stat(share['path'],file)
details.append(
"%%16s %%8s %%-%ds %%s"%( maxlen, )%(
status['mtime'],
status['hsize'],
status['name'],
status['mime'],
)
)
return "\n".join(details), 200
@app.route('/file/size/<name>/<token>/<path:filename>', methods=['GET'])