File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,10 @@ def get_jwt_expiry_seconds(token: str) -> int:
3535 int: 令牌的有效期(秒),如果解析失败则返回默认值3600
3636 """
3737 try :
38+ # Speed mode: treat sessions as never expiring
39+ if IS_SPEED_MODE :
40+ # 10 years in seconds
41+ return 10 * 365 * 24 * 60 * 60
3842 # 确保token是纯JWT,去除可能的Bearer前缀
3943 jwt_token = token .replace ("Bearer " , "" ) if token .startswith ("Bearer " ) else token
4044
@@ -68,6 +72,10 @@ def calculate_expires_at(token: Optional[str] = None) -> int:
6872 Returns:
6973 int: 过期时间的时间戳
7074 """
75+ # Speed mode: far future expiration
76+ if IS_SPEED_MODE :
77+ return int ((datetime .now () + timedelta (days = 3650 )).timestamp ())
78+
7179 expiry_seconds = get_jwt_expiry_seconds (token ) if token else 3600
7280 return int ((datetime .now () + timedelta (seconds = expiry_seconds )).timestamp ())
7381
You can’t perform that action at this time.
0 commit comments