diff --git a/code/app.py b/code/app.py index df4867a..b7752db 100644 --- a/code/app.py +++ b/code/app.py @@ -14,7 +14,7 @@ from utils.utils import * from utils.crypt import * -__FLEES_VERSION__ = "20180310.0" +__FLEES_VERSION__ = "20180416.0" app = Flask(__name__) app.config.from_object(__name__) # Read config from json ! diff --git a/code/flees-manager.py b/code/flees-manager.py index ad0dbdd..330485c 100755 --- a/code/flees-manager.py +++ b/code/flees-manager.py @@ -357,14 +357,15 @@ def print_rest_api(shares, config, opts): sys.exit(0) else: sys.exit(1) + if opts.type == "login": print_rest_api_login(config,share,token) elif opts.type == "upload": print_rest_api_upload(config,share,token) elif opts.type == "download": - print_rest_api_download(config, share, token) + print_rest_api_download(config, share, token, opts.filename) elif opts.type == "direct": - print_rest_api_direct(config, share, token) + print_rest_api_direct(config, share, token, opts.filename) elif opts.type == "zip": print_rest_api_zip(config, share, token) @@ -410,7 +411,7 @@ def print_rest_api_upload(config, share, token): )) -def print_rest_api_download(config, share, token): +def print_rest_api_download(config, share, token, show_filename): print("Links to download files:") share_path = os.path.join( config['__root_path__'], @@ -421,6 +422,9 @@ def print_rest_api_download(config, share, token): print("no files") sys.exit(0) for filename in iter_folder_files(share_path): + if show_filename: + if filename != show_filename: + continue print("%s/download/%s/%s/%s"%( config['public_url'], share['name'], @@ -435,7 +439,7 @@ def print_rest_api_download(config, share, token): -def print_rest_api_direct(config, share, token): +def print_rest_api_direct(config, share, token, show_filename): if 'direct_links' not in share or not share['direct_links']: print("Direct downloading not allowed in this share") sys.exit(0) @@ -449,6 +453,9 @@ def print_rest_api_direct(config, share, token): print("no files") sys.exit(0) for filename in iter_folder_files(share_path): + if show_filename: + if filename != show_filename: + continue print("%s/direct/%s/%s/%s"%( config['public_url'], share['name'], @@ -598,6 +605,10 @@ def parse_options(): parser_rest.add_argument(dest="type", help = "Type of command", choices = ['list','login','upload','download','direct','zip'] ) + parser_rest.add_argument(dest="filename", help = "File name for download/direct queries", + nargs = '?', + default = None + ) parser_rest.add_argument('-t','--token', action="store", dest="token", default = None, help= "If share has multiple tokens, select one to print REST API for." )