mirror of
https://github.com/jackeilles/xygt.git
synced 2025-02-16 22:58:16 +01:00
parent
e7a6acd9f3
commit
f1a6a59db2
1 changed files with 2 additions and 44 deletions
|
@ -117,51 +117,9 @@ def idInfo(id):
|
||||||
elif Config.url.find_one({"id": id}) is not None:
|
elif Config.url.find_one({"id": id}) is not None:
|
||||||
check = Config.url.find_one({"id": id}, {'_id': False, "ip": False})
|
check = Config.url.find_one({"id": id}, {'_id': False, "ip": False})
|
||||||
|
|
||||||
else:
|
# Return the mongodb info about the file, removing IP if its present
|
||||||
check = {"Error": "File Not Found"}
|
|
||||||
|
|
||||||
# Return the mongodb info about the file
|
|
||||||
return check
|
return check
|
||||||
|
|
||||||
def userInfo(id):
|
|
||||||
# Grab user entry from userID
|
|
||||||
user = Config.users.find_one({"userid": id})
|
|
||||||
|
|
||||||
username = user['username']
|
|
||||||
userid = id
|
|
||||||
|
|
||||||
# Search for all files from that userID
|
|
||||||
files = Config.files.find({"userid": userid}, {"_id": False, "ip": False})
|
|
||||||
list = {}
|
|
||||||
|
|
||||||
# Create file listing
|
|
||||||
for file in files:
|
|
||||||
list.update({
|
|
||||||
file["id"]: {
|
|
||||||
"filename": file["filename"],
|
|
||||||
"mimetype": file["mimetype"],
|
|
||||||
"filesize": file["filesize"],
|
|
||||||
"retention": file["retention"],
|
|
||||||
"creation": file["date"],
|
|
||||||
"expiry": file["expiry"]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
# Search for all URL's from that userID
|
|
||||||
url = Config.url.find({"userid": userid})
|
|
||||||
|
|
||||||
# Format all into one JSON
|
|
||||||
return {
|
|
||||||
"user": {
|
|
||||||
"username": username,
|
|
||||||
"userid": userid
|
|
||||||
},
|
|
||||||
"files": {
|
|
||||||
"count": len(files),
|
|
||||||
"list": list
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def randomHex():
|
def randomHex():
|
||||||
hexRand = ''.join(secrets.choice('0123456789abcdef') for _ in range(6))
|
hexRand = ''.join(secrets.choice('0123456789abcdef') for _ in range(6))
|
||||||
return hexRand
|
return hexRand
|
||||||
|
@ -194,4 +152,4 @@ def resetIDPass(userid):
|
||||||
Config.users.update_one({"userid": userid}, {"$set": {"idpass": hashedPass}})
|
Config.users.update_one({"userid": userid}, {"$set": {"idpass": hashedPass}})
|
||||||
return idpass
|
return idpass
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
Loading…
Add table
Reference in a new issue