clay-server 2.17.0-beta.3 → 2.17.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +25 -13
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -53,6 +53,7 @@ var args = process.argv.slice(2);
|
|
|
53
53
|
var port = _isDev ? 2635 : 2633;
|
|
54
54
|
var useHttps = true;
|
|
55
55
|
var forceMkcert = false;
|
|
56
|
+
var forceBuiltin = false;
|
|
56
57
|
var skipUpdate = false;
|
|
57
58
|
var debugMode = false;
|
|
58
59
|
var autoYes = false;
|
|
@@ -84,6 +85,8 @@ for (var i = 0; i < args.length; i++) {
|
|
|
84
85
|
useHttps = false;
|
|
85
86
|
} else if (args[i] === "--local-cert") {
|
|
86
87
|
forceMkcert = true;
|
|
88
|
+
} else if (args[i] === "--builtin-cert") {
|
|
89
|
+
forceBuiltin = true;
|
|
87
90
|
} else if (args[i] === "--no-update" || args[i] === "--skip-update") {
|
|
88
91
|
skipUpdate = true;
|
|
89
92
|
} else if (args[i] === "--dev") {
|
|
@@ -128,7 +131,8 @@ for (var i = 0; i < args.length; i++) {
|
|
|
128
131
|
console.log(" -p, --port <port> Port to listen on (default: 2633)");
|
|
129
132
|
console.log(" --host <address> Address to bind to (default: 0.0.0.0)");
|
|
130
133
|
console.log(" --no-https Disable HTTPS (enabled by default)");
|
|
131
|
-
console.log(" --local-cert Use local certificate (mkcert)
|
|
134
|
+
console.log(" --local-cert Use local certificate (mkcert), suppress migration notice");
|
|
135
|
+
console.log(" --builtin-cert Use builtin certificate even if mkcert is installed");
|
|
132
136
|
console.log(" --no-update Skip auto-update check on startup");
|
|
133
137
|
console.log(" --debug Enable debug panel in the web UI");
|
|
134
138
|
console.log(" -y, --yes Skip interactive prompts (accept defaults)");
|
|
@@ -599,6 +603,13 @@ function toClayStudioUrl(ip, port, protocol) {
|
|
|
599
603
|
}
|
|
600
604
|
|
|
601
605
|
function ensureCerts(ip) {
|
|
606
|
+
// --builtin-cert: skip mkcert entirely, go straight to builtin
|
|
607
|
+
if (forceBuiltin) {
|
|
608
|
+
var builtin = getBuiltinCert();
|
|
609
|
+
if (builtin) return builtin;
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
|
|
602
613
|
var homeDir = os.homedir();
|
|
603
614
|
var certDir = path.join(process.env.CLAY_HOME || path.join(homeDir, ".clay"), "certs");
|
|
604
615
|
var keyPath = path.join(certDir, "key.pem");
|
|
@@ -631,10 +642,12 @@ function ensureCerts(ip) {
|
|
|
631
642
|
|
|
632
643
|
if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
|
|
633
644
|
var needRegen = false;
|
|
645
|
+
var isMkcertCert = false;
|
|
634
646
|
try {
|
|
635
647
|
var certText = execFileSync("openssl", ["x509", "-in", certPath, "-text", "-noout"], { encoding: "utf8" });
|
|
636
648
|
// If cert is from an external CA (e.g. Tailscale/Let's Encrypt), never regenerate
|
|
637
649
|
if (certText.indexOf("mkcert") === -1) return { key: keyPath, cert: certPath, caRoot: caRoot };
|
|
650
|
+
isMkcertCert = true;
|
|
638
651
|
for (var i = 0; i < allIPs.length; i++) {
|
|
639
652
|
if (certText.indexOf(allIPs[i]) === -1) {
|
|
640
653
|
needRegen = true;
|
|
@@ -642,6 +655,8 @@ function ensureCerts(ip) {
|
|
|
642
655
|
}
|
|
643
656
|
}
|
|
644
657
|
} catch (e) { needRegen = true; }
|
|
658
|
+
// mkcert cert but mkcert uninstalled: CA is gone, cert is untrusted. Skip it.
|
|
659
|
+
if (isMkcertCert && !mkcertInstalled) needRegen = true;
|
|
645
660
|
if (!needRegen) {
|
|
646
661
|
return { key: keyPath, cert: certPath, caRoot: caRoot, mkcertDetected: mkcertInstalled && !forceMkcert };
|
|
647
662
|
}
|
|
@@ -1611,8 +1626,8 @@ async function forkDaemon(mode, keepAwake, extraProjects, addCwd, wantOsUsers) {
|
|
|
1611
1626
|
: protocol + "://" + ip + ":" + config.port;
|
|
1612
1627
|
console.log(" " + sym.done + " Daemon started (PID " + config.pid + ")");
|
|
1613
1628
|
console.log(" " + sym.done + " " + url);
|
|
1614
|
-
if (config.builtinCert) console.log(" " + sym.done + " d.clay.studio
|
|
1615
|
-
if (config.mkcertDetected) console.log(" " + sym.warn + "
|
|
1629
|
+
if (config.builtinCert) console.log(" " + sym.done + " d.clay.studio provides HTTPS certificates only. Your traffic never leaves your network.");
|
|
1630
|
+
if (config.mkcertDetected) console.log(" " + sym.warn + " Clay now ships with a builtin HTTPS certificate. To use it, pass --builtin-cert or uninstall mkcert.");
|
|
1616
1631
|
console.log(" " + sym.done + " Headless mode — exiting CLI");
|
|
1617
1632
|
process.exit(0);
|
|
1618
1633
|
return;
|
|
@@ -1974,7 +1989,7 @@ function showMainMenu(config, ip) {
|
|
|
1974
1989
|
function afterQr() {
|
|
1975
1990
|
// Status line
|
|
1976
1991
|
log(" " + a.dim + "clay" + a.reset + " " + a.dim + "v" + currentVersion + a.reset + a.dim + " — " + url + a.reset);
|
|
1977
|
-
if (config.builtinCert) log(" " + a.dim + "d.clay.studio
|
|
1992
|
+
if (config.builtinCert) log(" " + a.dim + "d.clay.studio provides HTTPS certificates only. Your traffic never leaves your network." + a.reset);
|
|
1978
1993
|
var parts = [];
|
|
1979
1994
|
parts.push(a.bold + projs.length + a.reset + a.dim + (projs.length === 1 ? " project" : " projects"));
|
|
1980
1995
|
parts.push(a.reset + a.bold + totalSessions + a.reset + a.dim + (totalSessions === 1 ? " session" : " sessions"));
|
|
@@ -1986,11 +2001,9 @@ function showMainMenu(config, ip) {
|
|
|
1986
2001
|
log("");
|
|
1987
2002
|
|
|
1988
2003
|
if (config.mkcertDetected) {
|
|
1989
|
-
log(" " + sym.warn + " " + a.yellow + "
|
|
1990
|
-
log(" " + a.dim + "
|
|
1991
|
-
log(" " + a.dim + "
|
|
1992
|
-
log(" " + a.dim + " sudo apt remove mkcert (Linux)" + a.reset);
|
|
1993
|
-
log(" " + a.dim + "Or pass --local-cert to keep using mkcert without this warning." + a.reset);
|
|
2004
|
+
log(" " + sym.warn + " " + a.yellow + "Clay now ships with a builtin HTTPS certificate." + a.reset);
|
|
2005
|
+
log(" " + a.dim + "No more CA setup on each device." + a.reset);
|
|
2006
|
+
log(" " + a.dim + "To use it, pass --builtin-cert or uninstall mkcert." + a.reset);
|
|
1994
2007
|
log("");
|
|
1995
2008
|
}
|
|
1996
2009
|
|
|
@@ -2063,9 +2076,8 @@ function showMainMenu(config, ip) {
|
|
|
2063
2076
|
}
|
|
2064
2077
|
}, {
|
|
2065
2078
|
hint: [
|
|
2066
|
-
"claude-relay has been renamed to clay-server · npx clay-server",
|
|
2067
2079
|
"Run npx clay-server in other directories to add more projects.",
|
|
2068
|
-
"★ github.com/chadbyte/
|
|
2080
|
+
"★ github.com/chadbyte/clay — Press s to star the repo",
|
|
2069
2081
|
],
|
|
2070
2082
|
keys: [
|
|
2071
2083
|
{ key: "o", onKey: function () {
|
|
@@ -2073,7 +2085,7 @@ function showMainMenu(config, ip) {
|
|
|
2073
2085
|
showMainMenu(config, ip);
|
|
2074
2086
|
}},
|
|
2075
2087
|
{ key: "s", onKey: function () {
|
|
2076
|
-
openUrl("https://github.com/chadbyte/
|
|
2088
|
+
openUrl("https://github.com/chadbyte/clay");
|
|
2077
2089
|
showMainMenu(config, ip);
|
|
2078
2090
|
}},
|
|
2079
2091
|
],
|
|
@@ -2758,7 +2770,7 @@ var currentVersion = require("../package.json").version;
|
|
|
2758
2770
|
: protocol + "://" + ip + ":" + config.port;
|
|
2759
2771
|
console.log(" " + sym.done + " Daemon already running (PID " + config.pid + ")");
|
|
2760
2772
|
console.log(" " + sym.done + " " + url);
|
|
2761
|
-
if (config.builtinCert) console.log(" " + sym.done + " d.clay.studio
|
|
2773
|
+
if (config.builtinCert) console.log(" " + sym.done + " d.clay.studio provides HTTPS certificates only. Your traffic never leaves your network.");
|
|
2762
2774
|
process.exit(0);
|
|
2763
2775
|
return;
|
|
2764
2776
|
}
|