Skip to content

Commit 90c45f5

Browse files
committed
✨ feat: license can be set via -l/--license-key even with custom code #2482
1 parent e62186f commit 90c45f5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/controllers/initializer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ export async function create(config: ConfigObject = {}): Promise<Client> {
375375
if(config?.deleteSessionDataOnLogout || config?.killClientOnLogout) config.eventMode = true;
376376
const client = new Client(waPage, config, debugInfo);
377377
const { me } = await client.getMe();
378+
const licIndex = process.argv.findIndex(arg=>arg==="--license-key" || arg==="-l");
379+
config.licenseKey = config.licenseKey || licIndex !== -1 && process.argv[licIndex+1];
378380
if (config?.licenseKey || me._serialized!==earlyWid) {
379381
await getAndInjectLicense(waPage, config, me, debugInfo, spinner, me._serialized!==earlyWid ? false : await licensePromise)
380382
}

0 commit comments

Comments
 (0)