Skip to content

Commit

Permalink
Add support tough-cookie 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JSBizon committed Jun 13, 2015
1 parent a3cb9b4 commit 61795ac
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 107 deletions.
11 changes: 8 additions & 3 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
0.2.1
===================
* add method getAllCookies
* support tough-cookie 2.0.0

0.2.0
===================

* Fix problem with "host only" cookies
* Add function export - for export cookies to the other store or to the array
* get rid dependencies from tough-cookie2
* Fix problem with "host only" cookies
* Add function export - for export cookies to the other store or to the array
* get rid dependencies from tough-cookie2
17 changes: 16 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ FileCookieStore.prototype.deserialize = function (raw_data) {
domain : can_domain,
path : parsed[2],
secure : parsed[3] == 'TRUE' ? true : false,
expires : parseInt(parsed[4]) ? new Date(parsed[4] * 1000) : undefined,
//expires : parseInt(parsed[4]) ? new Date(parsed[4] * 1000) : undefined,
expires : parseInt(parsed[4]) ? new Date(parsed[4] * 1000) : 'Infinity',
key : decodeURIComponent(parsed[5]),
value : decodeURIComponent(parsed[6]),
httpOnly : http_only,
Expand Down Expand Up @@ -423,4 +424,18 @@ FileCookieStore.prototype.export = function(cookie_store, cb) {
return cookie_store;
};


FileCookieStore.prototype.getAllCookies = function(cb) {
this.export(function (err, cookies) {
if (err) {
cb(err);
} else {
cookies.sort(function(a,b) {
return (a.creationIndex||0) - (b.creationIndex||0);
});
cb(null, cookies);
}
});
};

module.exports = FileCookieStore;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "file-cookie-store",
"version": "0.2.0",
"version": "0.2.1",
"description": "Store cookies in Netscape's file",
"main": "index.js",
"repository": {
Expand Down Expand Up @@ -29,7 +29,7 @@
"grunt-contrib-jshint": "~0.10.0"
},
"dependencies": {
"tough-cookie": "~0.12.0",
"tough-cookie": "~2.0.0",
"punycode": "~1.2.3",
"lockfile": "~1.0.0",
"q": "~1.0.1"
Expand Down
Loading

0 comments on commit 61795ac

Please sign in to comment.