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