containerized userdb

This commit is contained in:
randogoth 2025-09-27 13:40:41 +03:00
parent 3296b9aa95
commit 41045fdf3a
4 changed files with 56 additions and 3 deletions

View file

@ -24,8 +24,8 @@ def track():
ua = str(request.args.get('ua'))
url = str(request.values.get("url") or request.headers.get("Referer"))
if os.path.exists('db.json'):
with open('db.json', 'r') as db:
if os.path.exists('db/db.json'):
with open('db/db.json', 'r') as db:
db = json.loads(db.read())
else:
db = {}
@ -45,7 +45,7 @@ def track():
send_msg(f'User <{hash}> visited { url } on { ua } ({ str(len(db[hash][cat])) })')
with open('db.json', 'w+') as dbw:
with open('db/db.json', 'w+') as dbw:
dbw.write(json.dumps(db, indent=4))
return str(len(db[hash][cat]))