leedab 0.1.4 → 0.1.6
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/leedab.js +28 -1
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +4 -0
- package/package.json +1 -1
package/bin/leedab.js
CHANGED
|
@@ -114,7 +114,19 @@ program
|
|
|
114
114
|
console.log(` Key: ${license.key.slice(0, 16)}...`);
|
|
115
115
|
console.log(` Tier: ${license.tier}`);
|
|
116
116
|
console.log(` Status: ${license.valid ? chalk.green(license.status) : chalk.red(license.status)}`);
|
|
117
|
-
|
|
117
|
+
// Count local allowlist users as seats
|
|
118
|
+
let localSeats = 0;
|
|
119
|
+
try {
|
|
120
|
+
const { readFile } = await import("node:fs/promises");
|
|
121
|
+
const { resolve } = await import("node:path");
|
|
122
|
+
const ocConfig = JSON.parse(await readFile(resolve(STATE_DIR, "openclaw.json"), "utf-8"));
|
|
123
|
+
const allUsers = new Set();
|
|
124
|
+
for (const ch of Object.values(ocConfig.channels || {})) {
|
|
125
|
+
for (const u of ch.allowFrom || []) allUsers.add(u);
|
|
126
|
+
}
|
|
127
|
+
localSeats = allUsers.size;
|
|
128
|
+
} catch {}
|
|
129
|
+
console.log(` Seats: ${localSeats} / ${license.maxSeats}`);
|
|
118
130
|
console.log(` Checked: ${new Date(license.validatedAt).toLocaleDateString()}`);
|
|
119
131
|
console.log("");
|
|
120
132
|
});
|
|
@@ -296,6 +308,21 @@ pairing
|
|
|
296
308
|
return;
|
|
297
309
|
}
|
|
298
310
|
|
|
311
|
+
// Check seat limit
|
|
312
|
+
const { ensureLicense } = await import("../dist/license.js");
|
|
313
|
+
const license = await ensureLicense();
|
|
314
|
+
if (license && license.maxSeats > 0) {
|
|
315
|
+
// Count total unique users across all channel allowlists
|
|
316
|
+
const allUsers = new Set();
|
|
317
|
+
for (const ch of Object.values(config.channels || {})) {
|
|
318
|
+
for (const u of ch.allowFrom || []) allUsers.add(u);
|
|
319
|
+
}
|
|
320
|
+
if (allUsers.size >= license.maxSeats) {
|
|
321
|
+
console.error(chalk.red(`Seat limit reached (${allUsers.size}/${license.maxSeats}). Upgrade your plan to add more users.`));
|
|
322
|
+
process.exit(1);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
299
326
|
config.channels[channel].allowFrom.push(userId);
|
|
300
327
|
config.channels[channel].dmPolicy = "allowlist";
|
|
301
328
|
await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
|
package/dist/paths.d.ts
ADDED
package/dist/paths.js
ADDED