|
|
|
@ -38,7 +38,7 @@ app.config["BOOK_UPLOAD_DEWATERMARK"] = "/var/www/TacticalApp/app/static/dewater
|
|
|
|
|
app.config["BOOK_UPLOAD_REPUBLISH"] = "/var/www/TacticalApp/app/static/republish"
|
|
|
|
|
app.config["BOOK_REQUEST"] = "/var/www/TacticalApp/app/static/request"
|
|
|
|
|
app.config["ALLOWED_BOOK_EXTENSIONS"] = ["PDF", "EPUB"]
|
|
|
|
|
app.config["MAX_BOOK_FILESIZE"] = 40 * 1024 * 1024
|
|
|
|
|
#app.config["MAX_BOOK_FILESIZE"] = 4000 * 1024 * 1024
|
|
|
|
|
|
|
|
|
|
def allowed_book(filename):
|
|
|
|
|
if not "." in filename:
|
|
|
|
@ -51,11 +51,11 @@ def allowed_book(filename):
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
def allowed_book_filesize(filesize):
|
|
|
|
|
if int(filesize) <= app.config["MAX_BOOK_FILESIZE"]:
|
|
|
|
|
return True
|
|
|
|
|
else:
|
|
|
|
|
return False
|
|
|
|
|
#def allowed_book_filesize(filesize):
|
|
|
|
|
# if int(filesize) <= app.config["MAX_BOOK_FILESIZE"]:
|
|
|
|
|
# return True
|
|
|
|
|
# else:
|
|
|
|
|
# return False
|
|
|
|
|
|
|
|
|
|
#Request a book
|
|
|
|
|
#REQUEST IN DEWATERMARK
|
|
|
|
@ -121,9 +121,9 @@ def uploadbook():
|
|
|
|
|
if request.files:
|
|
|
|
|
|
|
|
|
|
#request filesize
|
|
|
|
|
if not allowed_book_filesize(request.cookies.get("filesize")):
|
|
|
|
|
print("File exceeded maximum size")
|
|
|
|
|
return redirect(request.url)
|
|
|
|
|
#if not allowed_book_filesize(request.cookies.get("filesize")):
|
|
|
|
|
# print("File exceeded maximum size")
|
|
|
|
|
# return redirect(request.url)
|
|
|
|
|
|
|
|
|
|
#demand checkbox
|
|
|
|
|
if not request.form.get('match-with-pairs'):
|
|
|
|
@ -188,9 +188,9 @@ def republish():
|
|
|
|
|
if request.files:
|
|
|
|
|
|
|
|
|
|
#request filesize
|
|
|
|
|
if not allowed_book_filesize(request.cookies.get("filesize")):
|
|
|
|
|
print("File exceeded maximum size")
|
|
|
|
|
return redirect(request.url)
|
|
|
|
|
#if not allowed_book_filesize(request.cookies.get("filesize")):
|
|
|
|
|
# print("File exceeded maximum size")
|
|
|
|
|
# return redirect(request.url)
|
|
|
|
|
|
|
|
|
|
#demand checkbox
|
|
|
|
|
if not request.form.get('match-with-pairs'):
|
|
|
|
|