clay-server 2.20.1-beta.1 → 2.20.1-beta.2
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 +5 -11
- package/lib/daemon.js +5 -0
- package/lib/users.js +9 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -2008,12 +2008,8 @@ function showMainMenu(config, ip, setupCode) {
|
|
|
2008
2008
|
log("");
|
|
2009
2009
|
}
|
|
2010
2010
|
|
|
2011
|
-
// Always
|
|
2012
|
-
var displayCode = setupCode;
|
|
2013
|
-
if (!displayCode && isMultiUser() && !hasAdmin()) {
|
|
2014
|
-
var pendingCode = getSetupCode();
|
|
2015
|
-
if (pendingCode) displayCode = pendingCode;
|
|
2016
|
-
}
|
|
2011
|
+
// Always show setup code if one exists (persists until admin is created)
|
|
2012
|
+
var displayCode = setupCode || getSetupCode();
|
|
2017
2013
|
if (displayCode) {
|
|
2018
2014
|
log(" " + a.yellow + sym.warn + " Setup code: " + a.bold + displayCode + a.reset);
|
|
2019
2015
|
log(" " + a.dim + "Open Clay in your browser and enter this code to create the admin account." + a.reset);
|
|
@@ -2378,11 +2374,9 @@ function showSettingsMenu(config, ip) {
|
|
|
2378
2374
|
} else {
|
|
2379
2375
|
items.push({ label: "Enable multi-user mode", value: "multi_user" });
|
|
2380
2376
|
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
items.push({ label: "Show setup code", value: "show_setup_code" });
|
|
2385
|
-
}
|
|
2377
|
+
var pendingSetupCode = getSetupCode();
|
|
2378
|
+
if (muEnabled && pendingSetupCode) {
|
|
2379
|
+
items.push({ label: "Show setup code", value: "show_setup_code" });
|
|
2386
2380
|
}
|
|
2387
2381
|
if (muEnabled && hasAdmin()) {
|
|
2388
2382
|
items.push({ label: "Recover admin password", value: "recover_admin" });
|
package/lib/daemon.js
CHANGED
|
@@ -43,6 +43,11 @@ try {
|
|
|
43
43
|
process.exit(1);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
console.log("[daemon] Config: " + configFile);
|
|
47
|
+
console.log("[daemon] Users: " + usersModule.USERS_FILE);
|
|
48
|
+
if (process.env.SUDO_USER) console.log("[daemon] SUDO_USER: " + process.env.SUDO_USER);
|
|
49
|
+
console.log("[daemon] UID: " + (typeof process.getuid === "function" ? process.getuid() : "N/A"));
|
|
50
|
+
|
|
46
51
|
// --- OS users mode: check required system dependencies ---
|
|
47
52
|
if (config.osUsers) {
|
|
48
53
|
var { execSync: checkExec } = require("child_process");
|
package/lib/users.js
CHANGED
|
@@ -115,7 +115,15 @@ function generateSetupCode() {
|
|
|
115
115
|
|
|
116
116
|
function getSetupCode() {
|
|
117
117
|
var data = loadUsers();
|
|
118
|
-
|
|
118
|
+
if (data.setupCode) return data.setupCode;
|
|
119
|
+
// Defensive: if multi-user is on, no admin, and no code, auto-generate one
|
|
120
|
+
if (data.multiUser && !findAdmin(data)) {
|
|
121
|
+
var code = generateSetupCode();
|
|
122
|
+
data.setupCode = code;
|
|
123
|
+
saveUsers(data);
|
|
124
|
+
return code;
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
function clearSetupCode() {
|