jump into token links when clicking
This commit is contained in:
parent
d2952c3ac0
commit
a0ec67f22a
27
auth.py
27
auth.py
@ -171,16 +171,23 @@ def require_secret(f):
|
|||||||
if 'device_id' not in session:
|
if 'device_id' not in session:
|
||||||
session['device_id'] = os.urandom(32).hex()
|
session['device_id'] = os.urandom(32).hex()
|
||||||
|
|
||||||
# AUTO-JUMP FOR TOKENS - Disabled for now to debug
|
# For token links, immediately open the single folder they grant access to.
|
||||||
# try:
|
if (
|
||||||
# if args_token and is_valid_token(args_token):
|
args_token
|
||||||
# token_item = decode_token(args_token)
|
and request.method == 'GET'
|
||||||
# target_foldername = token_item['folders'][0]['foldername']
|
and request.endpoint == 'index'
|
||||||
# # Mark session as modified to ensure it's saved before redirect
|
and is_valid_token(args_token)
|
||||||
# session.modified = True
|
):
|
||||||
# return redirect(f"/path/{target_foldername}")
|
try:
|
||||||
# except Exception as e:
|
token_item = decode_token(args_token)
|
||||||
# print(f"Error during auto-jump: {e}")
|
folders = token_item.get('folders', [])
|
||||||
|
if len(folders) == 1:
|
||||||
|
target_foldername = folders[0].get('foldername')
|
||||||
|
if target_foldername:
|
||||||
|
session.modified = True # ensure session persists before redirect
|
||||||
|
return redirect(f"/path/{target_foldername}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error during token auto-open: {e}")
|
||||||
|
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user