Skip to content

Commit efcffcd

Browse files
committed
Added warning message for QR code
1 parent af5e576 commit efcffcd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

bin/http-server

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ var colors = require('colors/safe'),
77
httpServer = require('../lib/http-server'),
88
portfinder = require('portfinder'),
99
opener = require('opener'),
10-
fs = require('fs');
10+
fs = require('fs'),
11+
qrcode = require('qrcode-terminal');
1112
var argv = require('minimist')(process.argv.slice(2), {
1213
alias: {
1314
tls: 'ssl'
1415
}
1516
});
1617
var ifaces = os.networkInterfaces();
17-
var plainIp;
1818

1919
process.title = 'http-server';
2020
if (argv.h || argv.help) {
@@ -53,7 +53,7 @@ if (argv.h || argv.help) {
5353
' -S --ssl Enable https.',
5454
' -C --cert Path to ssl cert file (default: cert.pem).',
5555
' -K --key Path to ssl key file (default: key.pem).',
56-
' --qr-code Show QR code for public IP',
56+
' --qr-code (Experimental) Show QR code for public IP',
5757
'',
5858
' -r --robots Respond to /robots.txt [User-agent: *\\nDisallow: /]',
5959
' --no-dotfiles Do not show dotfiles',
@@ -72,6 +72,7 @@ var port = argv.p || argv.port || parseInt(process.env.PORT, 10),
7272
utc = argv.U || argv.utc,
7373
version = argv.v || argv.version,
7474
logger;
75+
var plainIp = host;
7576

7677
var proxyOptionsBooleanProps = [
7778
'ws', 'xfwd', 'secure', 'toProxy', 'prependPath', 'ignorePath', 'changeOrigin',
@@ -231,6 +232,7 @@ function listen(port) {
231232
}
232233
}
233234
if (options.showQR) {
235+
logger.info(colors.yellow("WARNING: ") + "This is an experimental feature and is not guaranteed to work properly in all terminals or fonts.")
234236
qrcode.generate(plainIp, { small: true }, function (qr) {
235237
console.log(qr);
236238
})

doc/http-server.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ If not specified, uses key.pem.
117117

118118
.TP
119119
.BI \-\-qr\-code
120-
Show QR code for public IP.
120+
(Experimental) Show QR code for public IP.
121121

122122
.TP
123123
.BI \-r ", " \-\-robots " " [\fIUSER\-AGENT\fR]

0 commit comments

Comments
 (0)