mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-08-05 05:47:23 +02:00
Add --host option npx gulp server
Using `0.0.0.0` instead of `localhost` allows connecting from other devices, significantly simplifying testing on mobile devices. This is controlled by the `--host` CLI flag and not enabled by default, since allowing external connections comes with security implications (e.g. when on a public network without a properly configured firewall). There might be reasons to want to listen on custom hostnames, but as the most common usage will probably be `--host 0.0.0.0`, there is a shorter alias `--host 0` for it.
This commit is contained in:
parent
3eca60735b
commit
384f1af067
11
gulpfile.mjs
11
gulpfile.mjs
@ -2210,8 +2210,17 @@ gulp.task(
|
||||
}
|
||||
}
|
||||
|
||||
let host;
|
||||
const j = process.argv.indexOf("--host");
|
||||
if (j >= 0 && j + 1 < process.argv.length) {
|
||||
host = process.argv[j + 1];
|
||||
if (host === "0") {
|
||||
host = "0.0.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
const { WebServer } = await import("./test/webserver.mjs");
|
||||
const server = new WebServer({ port });
|
||||
const server = new WebServer({ host, port });
|
||||
server.start();
|
||||
}
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user