@mherod/get-cookie 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +27 -3
  2. package/package.json +4 -5
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  const crypto = require('crypto');
2
4
  const {exec} = require("child_process");
3
5
  const fs = require("fs");
@@ -27,6 +29,10 @@ async function getChromePassword() {
27
29
  });
28
30
  }
29
31
 
32
+ async function getCookie() {
33
+ throw new Error('Not implemented');
34
+ }
35
+
30
36
  /**
31
37
  *
32
38
  * @param name
@@ -269,7 +275,9 @@ function printStringValue(r) {
269
275
  // noinspection JSUnusedGlobalSymbols
270
276
  module.exports = {
271
277
  getDecryptedCookie: getChromeCookie,
272
- getChromeCookie
278
+ getChromeCookie,
279
+ getFirefoxCookie,
280
+ getCookie
273
281
  };
274
282
 
275
283
  if (process.argv) {
@@ -290,12 +298,22 @@ if (process.argv) {
290
298
  process.env.IGNORE_EXPIRED = "true";
291
299
  }
292
300
 
301
+ if (process.env.VERBOSE) {
302
+ console.log("Verbose mode", process.argv);
303
+ }
304
+
293
305
  if (process.env.CHROME_ONLY) {
294
306
  if (process.env.VERBOSE) {
295
307
  console.log('chrome only');
296
308
  }
297
309
  getChromeCookie({name, domain})
298
- .then(printStringValue)
310
+ .then(cookie => {
311
+ if (cookie && cookie.length > 0) {
312
+ printStringValue(cookie);
313
+ } else {
314
+ console.log('No cookie found');
315
+ }
316
+ })
299
317
  .catch(err => {
300
318
  if (process.env.VERBOSE) {
301
319
  console.error(err);
@@ -306,7 +324,13 @@ if (process.argv) {
306
324
  console.log('firefox only');
307
325
  }
308
326
  getFirefoxCookie({name, domain})
309
- .then(printStringValue)
327
+ .then(cookie => {
328
+ if (cookie && cookie.length > 0) {
329
+ printStringValue(cookie);
330
+ } else {
331
+ console.log('No cookie found');
332
+ }
333
+ })
310
334
  .catch(err => {
311
335
  if (process.env.VERBOSE) {
312
336
  console.error("Error getting Firefox cookie", err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mherod/get-cookie",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "description": "Node.js module for querying a local user's Chrome cookie",
5
5
  "main": "index.js",
6
6
  "bin": "index.js",
@@ -9,10 +9,9 @@
9
9
  },
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
- "install": "pkg . --target node17-macos-x64 --out-path $HOMEBREW_FORMULA_PREFIX/bin/ --debug",
13
- "install2": "pkg . --target host --out-path $HOMEBREW_FORMULA_PREFIX/bin/ --debug",
14
- "install3": "pkg . --target node17-macos-x64 --out-path /usr/local/bin/ --debug",
15
- "install4": "pkg . --target host --out-path /usr/local/bin/ --debug"
12
+ "installForHomebrew": "pkg . --target host --out-path $HOMEBREW_FORMULA_PREFIX/bin/ --debug",
13
+ "installForMac": "pkg . --target node17-macos-x64 --out-path /usr/local/bin/ --debug",
14
+ "installForHost": "pkg . --target host --out-path /usr/local/bin/ --debug"
16
15
  },
17
16
  "keywords": [],
18
17
  "author": "Matthew Herod",