Skip to content

Commit

Permalink
Fix for cookie not being cleared on invalid session
Browse files Browse the repository at this point in the history
  • Loading branch information
INSANITY\Inrix authored and INSANITY\Inrix committed Dec 28, 2017
1 parent 441f07c commit 23077a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v3.0.3
- Fix for cookie not being cleared on invalid session

v3.0.2
- Proper fix for check invalid session key
- Commented all new code from 3.0
Expand Down
7 changes: 4 additions & 3 deletions scrape.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ checkAuth().then(constructCookie).then(parseKey).then(logEpisodeCount).then(find
function checkAuth(forced) { // Check if the user is authenticated
return new Promise((resolve, reject) => {
// Check if a proper method of authentication exists if not get the users login details
if (forced || !settings.cookies.ips4_IPSSessionFront && (!settings.user || !settings.password)) {
if (forced || !settings.cookies.ips4_IPSSessionFront && (!settings.user || !settings.password)) {
console.log('> Please enter your login details:');
prompt.start();
prompt.get([{name: "Email/Username", required: true}, {name: "Password", required: true, hidden: true, replace: '*'}], function (err, result) {
Expand All @@ -61,7 +61,7 @@ function checkAuth(forced) { // Check if the user is authenticated
getSession().then(doLogin).then(resolve) // After getting the users details get their session and log them in. Then finish.
});
// If they have no session but do have login details then just get their session log them in and finish.
} else if((!settings.cookies.ips4_IPSSessionFront && (settings.user || settings.password))) {
} else if((!settings.cookies.ips4_IPSSessionFront && (settings.user || settings.password))) {
getSession().then(doLogin).then(resolve)
} else {
// They are already logged in with suficcent auth, just continue.
Expand All @@ -73,6 +73,7 @@ function checkAuth(forced) { // Check if the user is authenticated

function constructCookie() { // Generate a array of cookies from the json object used to store them
return new Promise((resolve, reject) => {
settings.cookie = []
for (k in settings.cookies) {
settings.cookie.push(settings.cookies[k])
}
Expand Down Expand Up @@ -134,7 +135,7 @@ function saveSettings() { // Saves all the settings from the current settings ob
function parseKey() { // Get the key used to download videos
return new Promise((resolve, reject) => {
console.log("> Fetching video key")
req.get({
req.get({
url: 'https://linustechtips.com/main/applications/floatplane/interface/video_url.php?video_guid=a&video_quality=1080&download=1',
headers: {
Cookie: settings.cookie
Expand Down

0 comments on commit 23077a9

Please sign in to comment.