Add @ssttevee method of authentication (from pull request #43)

This commit is contained in:
Godzil
2018-08-01 02:07:21 +01:00
parent b48877b786
commit ab35bb4439
2 changed files with 25 additions and 0 deletions

View File

@@ -16,6 +16,8 @@ const cookieStore = require('tough-cookie-file-store');
// tslint:disable-next-line:no-var-requires
const cloudscraper = require('cloudscraper');
const CR_COOKIE_DOMAIN = 'http://crunchyroll.com';
let isAuthenticated = false;
let isPremium = false;
@@ -265,6 +267,25 @@ function authenticate(config: IConfig, done: (err: Error) => void)
});
});
}
else if (config.logUsingCookie)
{
j.setCookie(request.cookie('c_userid=' + config.crUserId + '; Domain=crunchyroll.com; HttpOnly; hostOnly=false;'),
CR_COOKIE_DOMAIN);
j.setCookie(request.cookie('c_userkey=' + config.crUserKey + '; Domain=crunchyroll.com; HttpOnly; hostOnly=false;'),
CR_COOKIE_DOMAIN);
checkIfUserIsAuth(config, (errCheckAuth2) =>
{
if (isAuthenticated)
{
return done(null);
}
else
{
return done(errCheckAuth2);
}
});
}
else
{
log.error('This method of login is currently unsupported...\n');