From 0c097e52e12df4ebe746c9a623cd9b53c446b553 Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 20 Aug 2023 11:47:11 +0300 Subject: [PATCH] autocompl and details with accureate time --- code/app.py | 1 + code/templates/mfl | 4 ++-- code/utils/files.py | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/code/app.py b/code/app.py index d9dccff..d9335e4 100644 --- a/code/app.py +++ b/code/app.py @@ -160,6 +160,7 @@ def ls(): return "Error", 401 return "\n".join(file_list()), 200 + @app.route("/ls-simple", methods=["GET"]) def ls_simple(): """ diff --git a/code/templates/mfl b/code/templates/mfl index 332f8b8..4a64aab 100755 --- a/code/templates/mfl +++ b/code/templates/mfl @@ -162,11 +162,11 @@ _get_completer() { local curr_arg curr_arg=${COMP_WORDS[COMP_CWORD]} if [[ $COMP_CWORD -eq 1 ]]; then - COMPREPLY=( $(compgen -W "help autocomplete list write delete update" -- $curr_arg ) ); + COMPREPLY=( $(compgen -W "help autocomplete list write delete show update" -- $curr_arg ) ); fi if [[ $COMP_CWORD -eq 2 ]]; then case ${COMP_WORDS[$(( $COMP_CWORD - 1 ))]} in - delete) + delete|show) local remotelist=$( eval MFL_EXEC simplelist ) COMPREPLY=( $(compgen -W "$remotelist" -- $curr_arg ) ); ;; diff --git a/code/utils/files.py b/code/utils/files.py index f44dfe8..f775279 100644 --- a/code/utils/files.py +++ b/code/utils/files.py @@ -4,7 +4,7 @@ from flask import current_app as app import time import sqlite3 import shutil -from .misc import file_size_MB, file_size_human, file_date_human +from .misc import file_size_human, file_date_human, file_time_human def get_db(): @@ -161,12 +161,12 @@ def file_details(token, name): else: return {} return { - "size": file_size_MB(s.st_size), + "size": s.st_size, "hsize": file_size_human(s.st_size, HTML=False), - "added": file_date_human(added), + "added": file_time_human(added), "name": name, "url": file_full_url(token, name), - "expires": file_date_human(expires), + "expires": file_time_human(expires), "downloaded": downloads, "max-dl": max_dl, }