Compare commits
2 Commits
f3b44d1d5a
...
dbe938af1c
| Author | SHA1 | Date | |
|---|---|---|---|
| dbe938af1c | |||
| 3c86456a58 |
17
analytics.py
17
analytics.py
@ -645,17 +645,16 @@ def file_access():
|
||||
'''
|
||||
with log_db:
|
||||
cursor = log_db.execute(query, params_for_filter)
|
||||
rows = cursor.fetchall()
|
||||
db_rows = cursor.fetchall()
|
||||
|
||||
# Convert rows to a list of dictionaries and add category
|
||||
rows = [
|
||||
{
|
||||
'rel_path': rel_path,
|
||||
'access_count': access_count,
|
||||
'category': hf.extract_structure_from_string(rel_path)[0]
|
||||
}
|
||||
for rel_path, access_count in rows
|
||||
]
|
||||
rows = []
|
||||
for rel_path, access_count in db_rows:
|
||||
rows.append({
|
||||
'rel_path': rel_path,
|
||||
'access_count': access_count,
|
||||
'category': hf.extract_structure_from_string(rel_path)[0]
|
||||
})
|
||||
|
||||
# Get possible categories from the rows
|
||||
categories = sorted({r['category'] for r in rows if r['category'] is not None})
|
||||
|
||||
10
auth.py
10
auth.py
@ -150,6 +150,16 @@ def require_secret(f):
|
||||
# this is required to track the devices connecting over the same ip address
|
||||
if 'device_id' not in session:
|
||||
session['device_id'] = os.urandom(32).hex()
|
||||
|
||||
# AUTO-JUMP FOR TOKENS
|
||||
try:
|
||||
if args_token and is_valid_token(args_token):
|
||||
token_item = decode_token(args_token)
|
||||
target_foldername = token_item['folders'][0]['foldername']
|
||||
return redirect(f"path/{target_foldername}")
|
||||
except Exception as e:
|
||||
print(f"Error during auto-jump: {e}")
|
||||
|
||||
return f(*args, **kwargs)
|
||||
else:
|
||||
title_short = app_config.get('TITLE_SHORT', 'Default Title')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user