mirror of
https://github.com/snobu/destreamer.git
synced 2026-01-17 05:22:18 +00:00
fixed stupid session refreshing typo
This commit is contained in:
@@ -52,7 +52,7 @@ export class TokenCache {
|
|||||||
public isExpiring(session: Session): [boolean, number] {
|
public isExpiring(session: Session): [boolean, number] {
|
||||||
const decodedJwt: Jwt = jwtDecode(session.AccessToken);
|
const decodedJwt: Jwt = jwtDecode(session.AccessToken);
|
||||||
|
|
||||||
const timeLeft: number = decodedJwt['exp']; - Math.floor(Date.now() / 1000);
|
const timeLeft: number = decodedJwt['exp'] - Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
if (timeLeft < (5 * 60)) {
|
if (timeLeft < (5 * 60)) {
|
||||||
return [true, 0];
|
return [true, 0];
|
||||||
|
|||||||
@@ -195,7 +195,8 @@ async function downloadVideo(videoGUIDs: Array<string>,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv.keepLoginCookies && tokenCache.isExpiring(session)) {
|
const [isSessionExpiring] = tokenCache.isExpiring(session);
|
||||||
|
if (argv.keepLoginCookies && isSessionExpiring) {
|
||||||
logger.info('Trying to refresh access token...');
|
logger.info('Trying to refresh access token...');
|
||||||
session = await refreshSession('https://web.microsoftstream.com/');
|
session = await refreshSession('https://web.microsoftstream.com/');
|
||||||
apiClient.setSession(session);
|
apiClient.setSession(session);
|
||||||
|
|||||||
Reference in New Issue
Block a user