mirror of
https://github.com/jackeilles/xygt.git
synced 2024-11-08 07:52:38 +01:00
bug fixes
This commit is contained in:
parent
f037e8b62c
commit
a7c5b3a9bc
3 changed files with 24 additions and 7 deletions
|
@ -166,10 +166,8 @@ def getInfo(id):
|
||||||
@login_required
|
@login_required
|
||||||
def delete(id):
|
def delete(id):
|
||||||
if Config.files.find_one({"id": id}) is not None:
|
if Config.files.find_one({"id": id}) is not None:
|
||||||
if Config.files.find_one({"id": id}) is None:
|
|
||||||
return Errors.file404
|
data = Config.files.find_one({"id": id})
|
||||||
else:
|
|
||||||
data = Config.files.find_one({"id": id})
|
|
||||||
|
|
||||||
if data["userid"] == current_user.userid:
|
if data["userid"] == current_user.userid:
|
||||||
Config.files.delete_one({"id": id})
|
Config.files.delete_one({"id": id})
|
||||||
|
@ -184,6 +182,24 @@ def delete(id):
|
||||||
else:
|
else:
|
||||||
return "You are not the owner of this file."
|
return "You are not the owner of this file."
|
||||||
|
|
||||||
|
elif Config.url.find_one({"id": id}) is not None:
|
||||||
|
|
||||||
|
data = Config.url.find_one({"id": id})
|
||||||
|
|
||||||
|
if data["userid"] == current_user.userid:
|
||||||
|
Config.files.delete_one({"id": id})
|
||||||
|
return "URL deleted."
|
||||||
|
|
||||||
|
elif data["userid"] == request.form.get("userid") and bcrypt.check_password_hash(Config.user.find_one({"userid": data["userid"]})["idpass"], request.form.get("idpass")):
|
||||||
|
Config.files.delete_one({"id": id})
|
||||||
|
return "URL deleted."
|
||||||
|
|
||||||
|
else:
|
||||||
|
return "You are not the owner of this link."
|
||||||
|
|
||||||
|
else:
|
||||||
|
return "This ID does not exist."
|
||||||
|
|
||||||
@app.route('/teapot')
|
@app.route('/teapot')
|
||||||
def teapot():
|
def teapot():
|
||||||
return 'I\'m a teapot. 418.', 418
|
return 'I\'m a teapot. 418.', 418
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
|
|
||||||
<th>Filename</th>
|
<th>Filename</th>
|
||||||
<th>Size</th>
|
<th>Size</th>
|
||||||
<th>Retention</th>
|
<th>Retention</th>
|
||||||
|
|
|
@ -40,9 +40,9 @@ def main():
|
||||||
os.remove(os.path.join(Config.fileDir, file["filename"]))
|
os.remove(os.path.join(Config.fileDir, file["filename"]))
|
||||||
|
|
||||||
# Delete all expired URL's
|
# Delete all expired URL's
|
||||||
for url in expiredURLs:
|
for urls in expiredURLs:
|
||||||
print(f"Deleting URL {url['id']}")
|
print(f"Deleting URL {urls['id']}")
|
||||||
Config.url.delete_one({"id": url["id"]})
|
Config.url.delete_one({"id": urls["id"]})
|
||||||
|
|
||||||
print("Cleanup complete.")
|
print("Cleanup complete.")
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
|
|
Loading…
Reference in a new issue