new route to list files in a share. TODO: use for split upload to check existing splits
This commit is contained in:
17
code/app.py
17
code/app.py
@@ -8,6 +8,7 @@ from flask import Flask, render_template, jsonify, current_app, Response, \
|
||||
redirect, url_for, request, g, session, send_file, send_from_directory
|
||||
from werkzeug.utils import secure_filename
|
||||
import zipfile
|
||||
import urllib
|
||||
from multiprocessing import Process
|
||||
from revprox import ReverseProxied
|
||||
from utils.utils import *
|
||||
@@ -169,6 +170,22 @@ def send(name):
|
||||
return share
|
||||
return render_template('send.html',name=name)
|
||||
|
||||
@app.route('/files/<name>/<token>', methods=['GET'])
|
||||
def list_files(name, token):
|
||||
(ok,share) = get_share(name, token = token)
|
||||
if not ok:
|
||||
return share
|
||||
files = []
|
||||
for file in sorted(os.listdir(share['path'])):
|
||||
fp = os.path.join(share['path'],file)
|
||||
if os.path.isdir(fp):
|
||||
continue
|
||||
if file.startswith("."):
|
||||
continue
|
||||
files.append(urllib.parse.quote_plus(file))
|
||||
files.append("")
|
||||
return "\n".join(files), 200
|
||||
|
||||
@app.route('/list/<name>/<token>', methods=['GET'])
|
||||
@app.route('/list/<name>', methods=['GET'])
|
||||
def list_view(name, token = None):
|
||||
|
||||
Reference in New Issue
Block a user