mirror of
https://github.com/snobu/destreamer.git
synced 2026-02-12 09:39:42 +00:00
Fixes and clean up (#51)
* Simplify main * Fix init * Cleaner output for the end user * Fix extractVideoGuid after sync with dev * TokenCache: Make variable private nit: switch to import * Add option to disable video thumbnails * Create a unique file name to avoid overwrite * Remove os dependency * Reimplement simulate * Update README Co-authored-by: @kylon Co-authored-by: @snobu
This commit is contained in:
@@ -1,21 +1,19 @@
|
||||
import * as fs from 'fs';
|
||||
import { Session } from './Types';
|
||||
import { bgGreen, bgYellow, green } from 'colors';
|
||||
const jwtDecode = require('jwt-decode');
|
||||
|
||||
|
||||
const tokenCacheFile = '.token_cache';
|
||||
import jwtDecode from 'jwt-decode';
|
||||
|
||||
export class TokenCache {
|
||||
private tokenCacheFile: string = '.token_cache';
|
||||
|
||||
public Read(): Session | null {
|
||||
let j = null;
|
||||
if(!fs.existsSync(tokenCacheFile)) {
|
||||
console.warn(bgYellow.black(`${tokenCacheFile} not found.\n`));
|
||||
if(!fs.existsSync(this.tokenCacheFile)) {
|
||||
console.warn(bgYellow.black(`${this.tokenCacheFile} not found.\n`));
|
||||
|
||||
return null;
|
||||
}
|
||||
let f = fs.readFileSync(tokenCacheFile, 'utf8');
|
||||
let f = fs.readFileSync(this.tokenCacheFile, 'utf8');
|
||||
j = JSON.parse(f);
|
||||
|
||||
interface Jwt {
|
||||
|
||||
Reference in New Issue
Block a user