Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -208,11 +208,13 @@ def search_files():
|
|
208 |
try:
|
209 |
files = db.search_files(keyword)
|
210 |
return jsonify([{
|
211 |
-
'
|
212 |
'path': f['file_path'],
|
213 |
-
'
|
214 |
-
'size':
|
215 |
-
'
|
|
|
|
|
216 |
} for f in files])
|
217 |
except Exception as e:
|
218 |
return jsonify({'error': str(e)}), 500
|
@@ -292,4 +294,4 @@ def create_folder():
|
|
292 |
return jsonify({'error': str(e)}), 500
|
293 |
|
294 |
if __name__ == '__main__':
|
295 |
-
app.run(host='0.0.0.0', port=
|
|
|
208 |
try:
|
209 |
files = db.search_files(keyword)
|
210 |
return jsonify([{
|
211 |
+
'type': 'file',
|
212 |
'path': f['file_path'],
|
213 |
+
'file_type': get_file_type(f['file_path']),
|
214 |
+
'size': f['file_size'],
|
215 |
+
'size_formatted': format_file_size(f['file_size']),
|
216 |
+
'preview_url': f'/api/files/preview/{f["file_path"]}',
|
217 |
+
'download_url': f'/api/files/download/{f["file_path"]}'
|
218 |
} for f in files])
|
219 |
except Exception as e:
|
220 |
return jsonify({'error': str(e)}), 500
|
|
|
294 |
return jsonify({'error': str(e)}), 500
|
295 |
|
296 |
if __name__ == '__main__':
|
297 |
+
app.run(host='0.0.0.0', port=5000, debug=True)
|