fix(LocalAuth): only throw user-supplied userDataDir error if path is different
fix #1261
This commit is contained in:
parent
cc78e9863d
commit
1b75d0d243
1 changed files with 3 additions and 4 deletions
|
|
@ -25,14 +25,13 @@ class LocalAuth extends BaseAuthStrategy {
|
|||
|
||||
async beforeBrowserInitialized() {
|
||||
const puppeteerOpts = this.client.options.puppeteer;
|
||||
|
||||
if(puppeteerOpts.userDataDir) {
|
||||
throw new Error('LocalAuth is not compatible with a user-supplied userDataDir.');
|
||||
}
|
||||
|
||||
const sessionDirName = this.clientId ? `session-${this.clientId}` : 'session';
|
||||
const dirPath = path.join(this.dataPath, sessionDirName);
|
||||
|
||||
if(puppeteerOpts.userDataDir && puppeteerOpts.userDataDir !== dirPath) {
|
||||
throw new Error('LocalAuth is not compatible with a user-supplied userDataDir.');
|
||||
}
|
||||
|
||||
fs.mkdirSync(dirPath, { recursive: true });
|
||||
|
||||
this.client.options.puppeteer = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue