clay-server 2.20.1-beta.2 → 2.20.1-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 -9
- package/lib/daemon.js +34 -25
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1998,6 +1998,7 @@ function showMainMenu(config, ip, setupCode) {
|
|
|
1998
1998
|
parts.push(a.reset + a.yellow + a.bold + totalAwaiting + a.reset + a.yellow + " awaiting" + a.reset + a.dim);
|
|
1999
1999
|
}
|
|
2000
2000
|
log(" " + a.dim + parts.join(a.reset + a.dim + " · ") + a.reset);
|
|
2001
|
+
log(" " + a.dim + "~/.clay → " + path.join(REAL_HOME, ".clay") + a.reset);
|
|
2001
2002
|
log(" Press " + a.bold + "o" + a.reset + " to open in browser");
|
|
2002
2003
|
log("");
|
|
2003
2004
|
|
|
@@ -2374,8 +2375,7 @@ function showSettingsMenu(config, ip) {
|
|
|
2374
2375
|
} else {
|
|
2375
2376
|
items.push({ label: "Enable multi-user mode", value: "multi_user" });
|
|
2376
2377
|
}
|
|
2377
|
-
|
|
2378
|
-
if (muEnabled && pendingSetupCode) {
|
|
2378
|
+
if (muEnabled) {
|
|
2379
2379
|
items.push({ label: "Show setup code", value: "show_setup_code" });
|
|
2380
2380
|
}
|
|
2381
2381
|
if (muEnabled && hasAdmin()) {
|
|
@@ -2534,6 +2534,10 @@ function showSettingsMenu(config, ip) {
|
|
|
2534
2534
|
log(sym.bar);
|
|
2535
2535
|
log(sym.bar + " " + a.dim + "Then try enabling OS user isolation again." + a.reset);
|
|
2536
2536
|
log(sym.bar);
|
|
2537
|
+
} else if (res.error) {
|
|
2538
|
+
log(sym.bar);
|
|
2539
|
+
log(sym.bar + " " + a.red + sym.warn + " Failed to enable OS users: " + res.error + a.reset);
|
|
2540
|
+
log(sym.bar);
|
|
2537
2541
|
} else if (res.ok) {
|
|
2538
2542
|
config.osUsers = true;
|
|
2539
2543
|
log(sym.bar);
|
|
@@ -2558,10 +2562,19 @@ function showSettingsMenu(config, ip) {
|
|
|
2558
2562
|
}
|
|
2559
2563
|
}
|
|
2560
2564
|
}
|
|
2561
|
-
log(sym.bar
|
|
2565
|
+
log(sym.bar);
|
|
2566
|
+
} else {
|
|
2567
|
+
log(sym.bar);
|
|
2568
|
+
log(sym.bar + " " + a.red + sym.warn + " Unexpected response from daemon." + a.reset);
|
|
2569
|
+
log(sym.bar + " " + a.dim + JSON.stringify(res) + a.reset);
|
|
2562
2570
|
log(sym.bar);
|
|
2563
2571
|
}
|
|
2564
2572
|
showSettingsMenu(config, ip);
|
|
2573
|
+
}).catch(function (err) {
|
|
2574
|
+
log(sym.bar);
|
|
2575
|
+
log(sym.bar + " " + a.red + sym.warn + " IPC error: " + (err.message || err) + a.reset);
|
|
2576
|
+
log(sym.bar);
|
|
2577
|
+
showSettingsMenu(config, ip);
|
|
2565
2578
|
});
|
|
2566
2579
|
} else {
|
|
2567
2580
|
showSettingsMenu(config, ip);
|
|
@@ -2688,17 +2701,20 @@ function showSettingsMenu(config, ip) {
|
|
|
2688
2701
|
break;
|
|
2689
2702
|
|
|
2690
2703
|
case "show_setup_code":
|
|
2704
|
+
// getSetupCode() auto-generates if multi-user is on and no code exists
|
|
2691
2705
|
var currentCode = getSetupCode();
|
|
2706
|
+
log(sym.bar);
|
|
2692
2707
|
if (currentCode) {
|
|
2693
|
-
log(sym.bar);
|
|
2694
2708
|
log(sym.bar + " " + a.yellow + sym.warn + " Setup code: " + a.bold + currentCode + a.reset);
|
|
2695
|
-
|
|
2696
|
-
|
|
2709
|
+
if (hasAdmin()) {
|
|
2710
|
+
log(sym.bar + " " + a.dim + "Admin account exists. This code is for adding the next admin." + a.reset);
|
|
2711
|
+
} else {
|
|
2712
|
+
log(sym.bar + " " + a.dim + "Enter this code in the browser to create the admin account." + a.reset);
|
|
2713
|
+
}
|
|
2697
2714
|
} else {
|
|
2698
|
-
log(sym.bar);
|
|
2699
|
-
log(sym.bar + " " + a.dim + "No pending setup code (admin already exists)." + a.reset);
|
|
2700
|
-
log(sym.bar);
|
|
2715
|
+
log(sym.bar + " " + a.dim + "Multi-user mode is not enabled." + a.reset);
|
|
2701
2716
|
}
|
|
2717
|
+
log(sym.bar);
|
|
2702
2718
|
promptSelect("Back?", [{ label: "Back", value: "back" }], function () {
|
|
2703
2719
|
showSettingsMenu(config, ip);
|
|
2704
2720
|
});
|
package/lib/daemon.js
CHANGED
|
@@ -1140,36 +1140,45 @@ var ipc = createIPCServer(socketPath(), function (msg) {
|
|
|
1140
1140
|
console.error("[daemon] Failed to create projects dir:", e.message);
|
|
1141
1141
|
}
|
|
1142
1142
|
// Auto-provision Linux accounts for all existing users
|
|
1143
|
-
var provisionResult =
|
|
1144
|
-
|
|
1145
|
-
provisionResult
|
|
1146
|
-
|
|
1147
|
-
|
|
1143
|
+
var provisionResult = { provisioned: [], skipped: [], errors: [] };
|
|
1144
|
+
try {
|
|
1145
|
+
provisionResult = provisionAllUsers(usersModule);
|
|
1146
|
+
console.log("[daemon] Provisioning result: " +
|
|
1147
|
+
provisionResult.provisioned.length + " provisioned, " +
|
|
1148
|
+
provisionResult.skipped.length + " skipped, " +
|
|
1149
|
+
provisionResult.errors.length + " errors");
|
|
1150
|
+
} catch (provErr) {
|
|
1151
|
+
console.error("[daemon] Provisioning threw:", provErr.message);
|
|
1152
|
+
}
|
|
1148
1153
|
// Set up ACLs for all existing projects
|
|
1149
|
-
|
|
1150
|
-
var
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1154
|
+
try {
|
|
1155
|
+
for (var pi = 0; pi < config.projects.length; pi++) {
|
|
1156
|
+
var proj = config.projects[pi];
|
|
1157
|
+
var projPath = proj.path;
|
|
1158
|
+
var projVisibility = proj.visibility || "public";
|
|
1159
|
+
// Grant ACL to project owner
|
|
1160
|
+
if (proj.ownerId) {
|
|
1161
|
+
var ownerUser = usersModule.findUserById(proj.ownerId);
|
|
1162
|
+
if (ownerUser && ownerUser.linuxUser) {
|
|
1163
|
+
grantProjectAccess(projPath, ownerUser.linuxUser);
|
|
1164
|
+
}
|
|
1158
1165
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1166
|
+
// Public projects: grant ACL to all users
|
|
1167
|
+
if (projVisibility === "public") {
|
|
1168
|
+
grantAllUsersAccess(projPath, usersModule);
|
|
1169
|
+
} else {
|
|
1170
|
+
// Private projects: grant ACL to allowedUsers
|
|
1171
|
+
var projAllowed = proj.allowedUsers || [];
|
|
1172
|
+
for (var ai = 0; ai < projAllowed.length; ai++) {
|
|
1173
|
+
var allowedUser = usersModule.findUserById(projAllowed[ai]);
|
|
1174
|
+
if (allowedUser && allowedUser.linuxUser) {
|
|
1175
|
+
grantProjectAccess(projPath, allowedUser.linuxUser);
|
|
1176
|
+
}
|
|
1170
1177
|
}
|
|
1171
1178
|
}
|
|
1172
1179
|
}
|
|
1180
|
+
} catch (aclErr) {
|
|
1181
|
+
console.error("[daemon] ACL setup threw:", aclErr.message);
|
|
1173
1182
|
}
|
|
1174
1183
|
return { ok: true, provisioning: provisionResult };
|
|
1175
1184
|
}
|