mirror of
https://github.com/jackeilles/xygt.git
synced 2024-11-21 06:12:41 +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
|
||||
def delete(id):
|
||||
if Config.files.find_one({"id": id}) is not None:
|
||||
if Config.files.find_one({"id": id}) is None:
|
||||
return Errors.file404
|
||||
else:
|
||||
data = Config.files.find_one({"id": id})
|
||||
|
||||
data = Config.files.find_one({"id": id})
|
||||
|
||||
if data["userid"] == current_user.userid:
|
||||
Config.files.delete_one({"id": id})
|
||||
|
@ -184,6 +182,24 @@ def delete(id):
|
|||
else:
|
||||
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')
|
||||
def teapot():
|
||||
return 'I\'m a teapot. 418.', 418
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
|
||||
<th>Filename</th>
|
||||
<th>Size</th>
|
||||
<th>Retention</th>
|
||||
|
|
|
@ -40,9 +40,9 @@ def main():
|
|||
os.remove(os.path.join(Config.fileDir, file["filename"]))
|
||||
|
||||
# Delete all expired URL's
|
||||
for url in expiredURLs:
|
||||
print(f"Deleting URL {url['id']}")
|
||||
Config.url.delete_one({"id": url["id"]})
|
||||
for urls in expiredURLs:
|
||||
print(f"Deleting URL {urls['id']}")
|
||||
Config.url.delete_one({"id": urls["id"]})
|
||||
|
||||
print("Cleanup complete.")
|
||||
time.sleep(60)
|
||||
|
|
Loading…
Reference in a new issue