introduce debugging.. but dont actually use it anywhere
This commit is contained in:
@@ -17,6 +17,7 @@ app.config['UPLOAD_FOLDER'] = 'data/'
|
|||||||
app.config['SHARES_FILE'] = 'data/shares.json'
|
app.config['SHARES_FILE'] = 'data/shares.json'
|
||||||
app.config['DATE_FORMAT'] = "%Y-%m-%d %H:%M"
|
app.config['DATE_FORMAT'] = "%Y-%m-%d %H:%M"
|
||||||
app.config['UID'] = 1000
|
app.config['UID'] = 1000
|
||||||
|
app.config['DEBUG'] = False
|
||||||
|
|
||||||
app.secret_key = 'Cz2dw5NiRt3PSMFBSLTAJJi7U2CdW7iPQqEeOaU6'
|
app.secret_key = 'Cz2dw5NiRt3PSMFBSLTAJJi7U2CdW7iPQqEeOaU6'
|
||||||
app.wsgi_app = ReverseProxied(app.wsgi_app)
|
app.wsgi_app = ReverseProxied(app.wsgi_app)
|
||||||
@@ -27,7 +28,6 @@ def before_request():
|
|||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
printerr(g.shares)
|
|
||||||
public_shares = []
|
public_shares = []
|
||||||
for share in g.shares:
|
for share in g.shares:
|
||||||
public = get_or_none(share,'public')
|
public = get_or_none(share,'public')
|
||||||
@@ -70,6 +70,7 @@ def upload(name = None, password = None):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
if get_or_none(share, 'overwrite') == False:
|
if get_or_none(share, 'overwrite') == False:
|
||||||
|
if os.path.exists(filename):
|
||||||
return "Overwrite forbidden", 403
|
return "Overwrite forbidden", 403
|
||||||
file.save(filename)
|
file.save(filename)
|
||||||
os.chown(filename, app.config['UID'], -1)
|
os.chown(filename, app.config['UID'], -1)
|
||||||
@@ -198,7 +199,8 @@ def is_expired(share):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def printerr(s):
|
def print_debug(s):
|
||||||
|
if app.config['DEBUG']:
|
||||||
sys.stderr.write(str(s)+"\n")
|
sys.stderr.write(str(s)+"\n")
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user