Skip to content

Commit

Permalink
Added verbosity to output, fixed IP vs. hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
adn77 committed Nov 12, 2023
1 parent 54938a4 commit b093677
Showing 1 changed file with 28 additions and 11 deletions.
39 changes: 28 additions & 11 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,38 @@ const program = new commander.Command();

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

alexaCookie.generateAlexaCookie( program.opts(), (err, result) => {
const config = program.opts();
config.setupProxy = true;
config.proxyOnly = true;

if ( config.debug ) {
config.proxyLogLevel = 'warn';
config.logger = console.log;
}

alexaCookie.generateAlexaCookie( config, (err, result) => {
if (result && result.refreshToken) {
console.log(result.refreshToken);
console.log("=======================================================================");
console.log("Some of this data might be useful to you for additional token retrieval");
console.log(" Please store in a safe place ...");
console.log("=======================================================================");
console.log(" macDms: " + JSON.stringify(result.macDms));
console.log(" ----------------------------------------------------------------------");
console.log(" deviceSerial: " + result.deviceSerial);
console.log("=======================================================================");
console.log(" refreshToken: " + result.refreshToken);
console.log("=======================================================================");
if (! program.opts().quiet) {
while(true);
}
Expand Down

0 comments on commit b093677

Please sign in to comment.