From 0a72db77719e8f99a4027566bc86217c85c1bab3 Mon Sep 17 00:00:00 2001 From: xion Date: Wed, 2 Apr 2025 09:54:53 +0800 Subject: [PATCH] set default for expire to 7 days --- src/oauth/oauth.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/oauth/oauth.ts b/src/oauth/oauth.ts index c3e05d5..68d5816 100644 --- a/src/oauth/oauth.ts +++ b/src/oauth/oauth.ts @@ -58,7 +58,7 @@ export type UserExpand = { } & StoreSetOpts; type StoreSetOpts = { - loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year' | 'week'; // 登陆类型 'default' | 'plugin' | 'month' | 'season' | 'year' + loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year' | 'week' | 'day'; // 登陆类型 'default' | 'plugin' | 'month' | 'season' | 'year' expire?: number; // 过期时间,单位为秒 hasRefreshToken?: boolean; [key: string]: any; @@ -137,6 +137,9 @@ export class RedisTokenStore implements Store { let expire = opts?.expire; if (!expire) { switch (opts.loginType) { + case 'day': + expire = 24 * 60 * 60; + break; case 'week': expire = 7 * 24 * 60 * 60; break; @@ -147,7 +150,7 @@ export class RedisTokenStore implements Store { expire = 90 * 24 * 60 * 60; break; default: - expire = 25 * 60 * 60; // 默认过期时间为25小时 + expire = 7 * 24 * 60 * 60; // 默认过期时间为7天 } } else { expire = Math.min(expire, 60 * 60 * 24 * 30, 60 * 60 * 24 * 90); // 默认的过期时间最大为90天