1
0
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:
Luca Armaroli
2020-10-11 22:19:55 +02:00
parent 85f3beae71
commit 41206a97f0
2 changed files with 3 additions and 2 deletions

View File

@@ -52,7 +52,7 @@ export class TokenCache {
public isExpiring(session: Session): [boolean, number] {
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)) {
return [true, 0];

View File

@@ -195,7 +195,8 @@ async function downloadVideo(videoGUIDs: Array<string>,
continue;
}
if (argv.keepLoginCookies && tokenCache.isExpiring(session)) {
const [isSessionExpiring] = tokenCache.isExpiring(session);
if (argv.keepLoginCookies && isSessionExpiring) {
logger.info('Trying to refresh access token...');
session = await refreshSession('https://web.microsoftstream.com/');
apiClient.setSession(session);