Skip to content

Commit

Permalink
invert hideQRCode showQRCode logic (homebridge#1913)
Browse files Browse the repository at this point in the history
* invert hideQRCode showQRCode logic

* invert _hideQRCode logic
  • Loading branch information
NebzHB authored and KhaosT committed Jun 25, 2018
1 parent 161f92a commit 0d77bb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ var log = require("./logger")._system;
module.exports = function() {

var insecureAccess = false;
var showQRCode = true;
var hideQRCode = false;

program
.version(version)
.option('-P, --plugin-path [path]', 'look for plugins installed at [path] as well as the default locations ([path] can also point to a single plugin)', function(p) { Plugin.addPluginPath(p); })
.option('-U, --user-storage-path [path]', 'look for homebridge user files at [path] instead of the default location (~/.homebridge)', function(p) { User.setStoragePath(p); })
.option('-D, --debug', 'turn on debug level logging', function() { require('./logger').setDebugEnabled(true) })
.option('-T, --no-timestamp', 'do not issue timestamps in logging', function() { require('./logger').setTimestampEnabled(false) })
.option('-Q, --no-qrcode', 'do not issue QRcode in logging', function() { showQRCode = false })
.option('-Q, --no-qrcode', 'do not issue QRcode in logging', function() { hideQRCode = true })
.option('-C, --color', 'force color in logging', function() { require('./logger').forceColor() })
.option('-I, --insecure', 'allow unauthenticated requests (for easier hacking)', function() { insecureAccess = true })
.parse(process.argv);

// Initialize HAP-NodeJS with a custom persist directory
hap.init(User.persistPath());

var server = new Server({insecureAccess:insecureAccess,showQRCode:showQRCode});
var server = new Server({insecureAccess:insecureAccess,hideQRCode:hideQRCode});

var signals = { 'SIGINT': 2, 'SIGTERM': 15 };
Object.keys(signals).forEach(function (signal) {
Expand Down
6 changes: 3 additions & 3 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function Server(opts) {
this._plugins = this._loadPlugins(); // plugins[name] = Plugin instance
this._cachedPlatformAccessories = this._loadCachedPlatformAccessories();
this._bridge = this._createBridge();
this._showQRCode = opts.showQRCode || true;
this._hideQRCode = opts.hideQRCode || false;

this._activeDynamicPlugins = {};
this._configurablePlatformPlugins = {};
Expand Down Expand Up @@ -628,7 +628,7 @@ Server.prototype._handleNewConfig = function(type, name, replace, config) {
}

Server.prototype._printPin = function(pin) {
if(this._showQRCode)
if(!this._hideQRCode)
console.log("Or enter this code with your HomeKit app on your iOS device to pair with Homebridge:");
else
console.log("Enter this code with your HomeKit app on your iOS device to pair with Homebridge:");
Expand All @@ -643,7 +643,7 @@ Server.prototype._printSetupInfo = function() {
console.log("Setup Payload:");
console.log(this._bridge.setupURI());

if(this._showQRCode) {
if(!this._hideQRCode) {
console.log("Scan this code with your HomeKit app on your iOS device to pair with Homebridge:");
qrcode.generate(this._bridge.setupURI());
}
Expand Down

0 comments on commit 0d77bb9

Please sign in to comment.