mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 17:49:58 +00:00
Add warning on daemon startup if non-local host is set and secure connections not enabled
This commit is contained in:
@@ -3,6 +3,7 @@ import https from "https";
|
||||
import { ChildProcess, spawn } from "child_process";
|
||||
import { Readable } from "stream";
|
||||
|
||||
import chalk from "chalk";
|
||||
import WebSocket from "ws";
|
||||
|
||||
import { DecodeTransform, EncodeTransform } from "./transforms.js";
|
||||
@@ -131,6 +132,18 @@ export function init(opts: DaemonOpts) {
|
||||
res.end();
|
||||
});
|
||||
|
||||
if (
|
||||
opts.host !== "localhost" &&
|
||||
opts.host !== "127.0.0.1" &&
|
||||
!opts.secure
|
||||
) {
|
||||
process.stdout.write(
|
||||
chalk.red(
|
||||
"WARNING: A non-local host is set, but secure connections are not enabled!\n"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
process.stdout.write(
|
||||
`Starting WebSocket server at ${opts.secure ? "wss" : "ws"}://${
|
||||
opts.host.includes(":") ? `[${opts.host}]` : opts.host
|
||||
|
||||
Reference in New Issue
Block a user