Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up wifi using credentials from a JSON file #405

Merged
merged 3 commits into from
Mar 21, 2018

Conversation

monkbroc
Copy link
Member

Fixes #404

@monkbroc monkbroc requested a review from stefan-moraru March 21, 2018 16:06
Copy link

@stefan-moraru stefan-moraru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
},
examples: {
'$0 $command': 'Prompt for Wi-Fi credentials and send them to device connected over serial',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to the device that's*

},
examples: {
'$0 $command': 'Prompt for Wi-Fi credentials and send them to device connected over serial',
'$0 $command --file credentials.json': 'Read Wi-Fi credentials from credentials.json and send them to device connected over serial'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^

let security = 3;
if (securityType.indexOf('WPA2') >= 0 && securityType.indexOf('802.1x') >= 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code looks good and works, this is just a random idea.

Not sure 100% if it works, but it looks kinda cool

if (opts.security) {
  const s = opts.security.reduce((acc, current) => { return Object.assign({}, acc, { [current]: true })}, {});

  security = security || (s['WPA2'] && s['802.1x'] && 5);
  isEnterprise = security || isEnterprise;

  security = security || (s['WPA'] && s['802.1x'] && 4);
  isEnterprise = security || isEnterprise;

  security = security || (s['WEP'] && 3);
  isEnterprise = security || isEnterprise;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not my code. It doesn't have any tests so I'd rather leave it alone.

@monkbroc monkbroc merged commit a2d15a7 into master Mar 21, 2018
@monkbroc monkbroc deleted the feature/serial-wifi-from-file branch March 21, 2018 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants