nook: per-license device caps + grant CLI for free licenses

This commit is contained in:
2026-08-27 09:16:31 -04:00
parent 0031055315
commit 082e503d4f
3 changed files with 83 additions and 15 deletions

View File

@@ -0,0 +1,28 @@
import { nookSchemaBootstrap, grantLicense } from "~/server/nook";
// Mint a free The Nook license (gifting / comps). Defaults to 1 device.
//
// bun --env-file=.env scripts/grant-nook-license.ts \
// --email friend@example.com [--devices 1]
const arg = (name: string) => {
const i = process.argv.indexOf(`--${name}`);
return i === -1 ? undefined : process.argv[i + 1];
};
const email = arg("email");
const devices = Number(arg("devices") ?? "1");
if (!email || !/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) {
console.error(
"Usage: bun --env-file=.env scripts/grant-nook-license.ts --email you@example.com [--devices 1]"
);
process.exit(1);
}
await nookSchemaBootstrap;
const { key } = await grantLicense(email, devices);
console.log(`Granted The Nook license for ${email} (${devices} device(s)):`);
console.log(key);
console.log("Send it to them; they enter it in Settings > License.");