Compare commits
No commits in common. "7f6c199ce3a1c7d0cd922af861dd70d297ac0fae" and "95bb5e18b06f1f67b36d190652760af59c54be86" have entirely different histories.
7f6c199ce3
...
95bb5e18b0
|
@ -7,4 +7,4 @@ D: IMMEDIATELY INSTALL GENTOO.
|
|||
E: SEEK OUT THE DWELLING OF RICHARD M. STALLMAN (RICHARD GNU/MARX STALLMAN (RMS)) AND SECRETELY PISS IN HIS BEARD.
|
||||
F: IF YOU ARE SNOOP DOGG YOU ARE EXEMPT FROM THE ABOVE TERMS.
|
||||
|
||||
REDISTRIBUTION, COPYING, MODIFYING, REVERSE-ENGINEERING, LOOKING, GLANCING, PEEKING, SMELLING, AND OTHERWISE INTERACTING WITH THE FOLLOWING CODE IS PROHIBITED AND IS PUNISHABLE BY YOUR MOTHER, WHO I FUCKED LAST NIGHT.
|
||||
REDISTRIBUTION, COPYING, MODIFYING, REVERSE-ENGINEERING, LOOKING, GLANCING, PEEKING, SMELLING, AND OTHERWISE INTERACTING WITH THE FOLLOWING CODE IS PROHIBITED AND IS PUNISHABLE BY YOUR MOTHER, WHOM I FUCKED LAST NIGHT.
|
|
@ -13,10 +13,10 @@ config["HOST"] = "127.0.0.1"
|
|||
config["DOMAIN"] = "http://example.com"
|
||||
config["PORT"] = 8282
|
||||
|
||||
# Will output more logging data from QuadFile's logger
|
||||
# Disable this for production use
|
||||
config["DEBUG"] = False
|
||||
|
||||
# Extended Debug will enable flask debugging. Keep this off for production use
|
||||
# Extended debug will add extra debug output that's not normally provided by flask
|
||||
config["EXTENDED_DEBUG"] = False
|
||||
|
||||
# Single user authentication, leave blank to disable authentication
|
||||
|
@ -39,5 +39,5 @@ config["CLEAN_INTERVAL"] = 120
|
|||
# Site info displayed to the user
|
||||
config["SITE_DATA"] = {
|
||||
"title": "QuadFile",
|
||||
"size": "100 MiB" # This is only for display, please limit filesize using your web server
|
||||
"size": "100 MiB" # This is only for display, please limit filesizes using your web server
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
flask==0.12.2
|
||||
flask==0.10.1
|
11
run.py
11
run.py
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env python3
|
||||
from flask import Flask, request, redirect, url_for, send_from_directory, abort, render_template
|
||||
from werkzeug.utils import secure_filename
|
||||
from werkzeug import secure_filename
|
||||
from threading import Thread, Timer
|
||||
import logging
|
||||
import os
|
||||
|
@ -45,7 +45,7 @@ def cleaner_thread():
|
|||
cleaner = Timer(config["CLEAN_INTERVAL"], cleaner_thread)
|
||||
cleaner.daemon = True # Daemons will attempt to exit cleanly along with the main process, which we want
|
||||
cleaner.start()
|
||||
print_log('Thread', 'Cleaner prepared', print_debug)
|
||||
|
||||
# Actual function
|
||||
delete_old()
|
||||
|
||||
|
@ -69,7 +69,6 @@ def error_page(error, code):
|
|||
|
||||
def allowed_file(filename):
|
||||
if config["ALLOW_ALL_FILES"]:
|
||||
print_log('Main', 'All files permitted, no check done', print_debug)
|
||||
return True
|
||||
else:
|
||||
if config["BLACKLIST"]:
|
||||
|
@ -91,7 +90,6 @@ def upload_file():
|
|||
if file and allowed_file(file.filename):
|
||||
filename = secure_filename(file.filename)
|
||||
while os.path.exists(os.path.join(config["UPLOAD_FOLDER"], filename)):
|
||||
print_log('Main', 'File exists, generating new name', print_debug)
|
||||
filename = str(randint(1000,8999)) + '-' + secure_filename(filename)
|
||||
|
||||
thread1 = Thread(target = db.add_file, args = (filename,))
|
||||
|
@ -106,10 +104,8 @@ def upload_file():
|
|||
|
||||
try:
|
||||
if request.form["source"] == "web":
|
||||
print_log('Web', 'Returned link page for "' + filename + '"', print_debug)
|
||||
return render_template('link.html', data=data, page=config["SITE_DATA"])
|
||||
except Exception:
|
||||
print_log('Web', 'No web reported in form, returned JSON', print_debug)
|
||||
return json.dumps(data)
|
||||
else:
|
||||
print_log('Notice', 'Forbidden file received')
|
||||
|
@ -185,10 +181,9 @@ def nginx_error(error):
|
|||
if config["DELETE_FILES"]:
|
||||
cleaner_thread()
|
||||
|
||||
print_log('Main', 'Launching flask', print_debug)
|
||||
if __name__ == '__main__':
|
||||
app.run(
|
||||
port=config["PORT"],
|
||||
host=config["HOST"],
|
||||
debug=config["EXTENDED_DEBUG"]
|
||||
debug=config["DEBUG"]
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue