adding simple list
This commit is contained in:
10
code/app.py
10
code/app.py
@@ -159,6 +159,16 @@ def ls():
|
|||||||
return "Error", 401
|
return "Error", 401
|
||||||
return "\n".join(file_list()), 200
|
return "\n".join(file_list()), 200
|
||||||
|
|
||||||
|
@app.route("/ls-simple", methods=["GET"])
|
||||||
|
def ls_simple():
|
||||||
|
"""
|
||||||
|
Lists token/names
|
||||||
|
"""
|
||||||
|
secret = request.headers.get("Secret", "")
|
||||||
|
if secret != app.config["ACCESS_TOKEN"]:
|
||||||
|
return "Error", 401
|
||||||
|
return "\n".join(file_list_simple()), 200
|
||||||
|
|
||||||
|
|
||||||
@app.route("/maintenance", methods=["GET"])
|
@app.route("/maintenance", methods=["GET"])
|
||||||
def maintenance():
|
def maintenance():
|
||||||
|
|||||||
@@ -142,6 +142,12 @@ _details() { # name
|
|||||||
"$MFL_ROOTURL"/details/"$1"
|
"$MFL_ROOTURL"/details/"$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_simple_list() {
|
||||||
|
curl -fL -w "\n" \
|
||||||
|
-H "Secret: $MFL_TOKEN" \
|
||||||
|
"$MFL_ROOTURL"/ls-simple
|
||||||
|
}
|
||||||
|
|
||||||
_maintain() {
|
_maintain() {
|
||||||
curl -fL -w "\n" \
|
curl -fL -w "\n" \
|
||||||
-H "Secret: $MFL_TOKEN" \
|
-H "Secret: $MFL_TOKEN" \
|
||||||
|
|||||||
@@ -183,14 +183,17 @@ def file_full_url(token, name):
|
|||||||
|
|
||||||
|
|
||||||
def file_list():
|
def file_list():
|
||||||
files = list(db_get_files())
|
|
||||||
details = []
|
details = []
|
||||||
details.append(" Added/Expiry DL/MaxDL URL")
|
details.append(" Added/Expiry DL/MaxDL URL")
|
||||||
details.append("=" * 75)
|
details.append("=" * 75)
|
||||||
for file in files:
|
for file in db_get_files():
|
||||||
url = file_full_url(file[0], file[1])
|
url = file_full_url(file[0], file[1])
|
||||||
added = file_date_human(file[2])
|
added = file_date_human(file[2])
|
||||||
expiry = file_date_human(file[3])
|
expiry = file_date_human(file[3])
|
||||||
details.append(f"{added}/{expiry} {file[4]:4d}/{file[5]:4d} {url}")
|
details.append(f"{added}/{expiry} {file[4]:4d}/{file[5]:4d} {url}")
|
||||||
|
|
||||||
return details
|
return details
|
||||||
|
|
||||||
|
|
||||||
|
def file_list_simple():
|
||||||
|
return [f"{r[0]}/{r[1]}" for r in db_get_files()]
|
||||||
|
|||||||
Reference in New Issue
Block a user