Skip to content

Commit b093677

Browse files
committed
Added verbosity to output, fixed IP vs. hostname
1 parent 54938a4 commit b093677

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

cli.js

+28-11
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,38 @@ const program = new commander.Command();
44

55
program
66
.option('-q, --quiet', 'Non-interactive, output refresh_token on StdOut and exit')
7-
.option('-l, --logger <log target>', 'Where to log to', console.error)
8-
.option('-p, --amazonPage <page>', 'optional: possible to use with different countries, default is "amazon.de"')
9-
.option('-b, --baseAmazonPage <amazon.com|amazon.co.jp>', 'optional: Change the Proxy Amazon Page - all "western countries" directly use amazon.com! Change to amazon.co.jp for Japan')
10-
.option('-a, --amazonPageProxyLanguage <lang>', 'optional: language to be used for the Amazon Sign-in page the proxy calls. default is "de_DE"')
11-
.option('-L, --acceptLanguage <lang>', 'optional: webpage language, should match to amazon-Page, default is "de-DE"')
12-
.option('-u, --userAgent <Browser>', 'optional: own userAgent to use for all request, overwrites default one, should not be needed')
13-
.option('-H, --proxyOwnIp <hostname>', 'provide own IP or hostname to later access the proxy. needed to setup all rewriting and proxy stuff internally', 'localhost')
7+
.option('-d, --debug')
8+
.option('-A, --deviceAppName <AppName>', 'optional: Name of the Device registered with the Alexa app', 'alexa_cookie_cli')
9+
.option('-p, --amazonPage <page>', 'optional: possible to use with different countries, default is "amazon.de"', 'amazon.de')
10+
.option('-b, --baseAmazonPage <amazon.com|amazon.co.jp>', 'optional: Change the Proxy Amazon Page - all "western countries" directly use amazon.com! Change to amazon.co.jp for Japan', 'amazon.com')
11+
.option('-a, --amazonPageProxyLanguage <lang>', 'optional: language to be used for the Amazon Sign-in page the proxy calls. default is "de_DE"', 'de_DE')
12+
.option('-L, --acceptLanguage <lang>', 'optional: webpage language, should match to amazon-Page, default is "de-DE"', 'de-DE')
13+
.option('-H, --proxyOwnIp <IP of localhost>', 'provide own IP(!) to later access the proxy. needed to setup all rewriting and proxy stuff internally', '127.0.0.1')
1414
.option('-P, --proxyPort <port>', 'optional: use this port for the proxy, default is 8080', 8080)
15-
.option('-B, --proxyListenBind <IP>', 'optional: set this to bind the proxy to a special IP, default is "0.0.0.0"')
16-
.option('-V, --proxyLogLevel <error|warn|info|debug>', 'optional: Loglevel of Proxy, default "warn"');
15+
.option('-B, --proxyListenBind <IP>', 'optional: set this to bind the proxy to a special IP, default is "0.0.0.0"', '0.0.0.0')
1716
program.parse();
1817

19-
alexaCookie.generateAlexaCookie( program.opts(), (err, result) => {
18+
const config = program.opts();
19+
config.setupProxy = true;
20+
config.proxyOnly = true;
21+
22+
if ( config.debug ) {
23+
config.proxyLogLevel = 'warn';
24+
config.logger = console.log;
25+
}
26+
27+
alexaCookie.generateAlexaCookie( config, (err, result) => {
2028
if (result && result.refreshToken) {
21-
console.log(result.refreshToken);
29+
console.log("=======================================================================");
30+
console.log("Some of this data might be useful to you for additional token retrieval");
31+
console.log(" Please store in a safe place ...");
32+
console.log("=======================================================================");
33+
console.log(" macDms: " + JSON.stringify(result.macDms));
34+
console.log(" ----------------------------------------------------------------------");
35+
console.log(" deviceSerial: " + result.deviceSerial);
36+
console.log("=======================================================================");
37+
console.log(" refreshToken: " + result.refreshToken);
38+
console.log("=======================================================================");
2239
if (! program.opts().quiet) {
2340
while(true);
2441
}

0 commit comments

Comments
 (0)