File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,13 +51,13 @@ async function getToken(code: string): Promise<boolean> {
5151}
5252
5353/**
54- * 检查Token是否即将过期(提前5分钟刷新 )
54+ * 检查Token是否即将过期(提前 120 分钟刷新 )
5555 * @param expireTime Token过期时间戳(毫秒)
5656 * @returns 是否即将过期
5757 */
5858function isTokenExpiringSoon ( expireTime : number ) : boolean {
59- const fiveMinutesInMs = 5 * 60 * 1000 ; // 5分钟
60- return ( expireTime - Date . now ( ) ) < fiveMinutesInMs ;
59+ const timeLeft = 120 * 60 * 1000 ; // 120分钟
60+ return ( expireTime - Date . now ( ) ) < timeLeft ;
6161}
6262
6363/**
Original file line number Diff line number Diff line change @@ -51,13 +51,13 @@ async function getToken(code: string): Promise<boolean> {
5151}
5252
5353/**
54- * 检查Token是否即将过期(提前5分钟刷新 )
54+ * 检查Token是否即将过期(提前 120 分钟刷新 )
5555 * @param expireTime Token过期时间戳(毫秒)
5656 * @returns 是否即将过期
5757 */
5858function isTokenExpiringSoon ( expireTime : number ) : boolean {
59- const fiveMinutesInMs = 5 * 60 * 1000 ; // 5分钟
60- return ( expireTime - Date . now ( ) ) < fiveMinutesInMs ;
59+ const timeLeft = 120 * 60 * 1000 ; // 120分钟
60+ return ( expireTime - Date . now ( ) ) < timeLeft ;
6161}
6262
6363/**
@@ -79,6 +79,8 @@ async function checkLogin(checkExpiringSoon: boolean = false): Promise<boolean>
7979 if ( ! plugin_access_token || ! plugin_access_token_expire_time || ! user_access_token || ! user_access_token_expire_time ) {
8080 return false ;
8181 }
82+ console . log ( pluginLocalAuth )
83+
8284
8385 // 检查是否已过期(expire_time 已经是毫秒级时间戳)
8486 const pluginTokenExpired = plugin_access_token_expire_time <= Date . now ( ) ;
@@ -93,6 +95,7 @@ async function checkLogin(checkExpiringSoon: boolean = false): Promise<boolean>
9395 const userTokenExpiringSoon = isTokenExpiringSoon ( user_access_token_expire_time ) ;
9496
9597 if ( pluginTokenExpiringSoon || userTokenExpiringSoon ) {
98+ console . log ( 'checkExpiringSoon' , checkExpiringSoon )
9699 return false ;
97100 }
98101 }
You can’t perform that action at this time.
0 commit comments