Store RemoteAuth ZIP files inside dataPath (#3375)
* Use `/tmp` when running inside AWS Lambda * Revert unintended change accidentally committed * Revert "Use `/tmp` when running inside AWS Lambda" This reverts commit 8e5324786e5b0067498717d3827937dac0f1edb6. * Store RemoteAuth ZIP files inside dataPath * Discard changes to src/webCache/WebCache.js ---------
This commit is contained in:
parent
58990a8159
commit
e6fd112559
1 changed files with 4 additions and 4 deletions
|
|
@ -106,8 +106,8 @@ class RemoteAuth extends BaseAuthStrategy {
|
|||
const pathExists = await this.isValidPath(this.userDataDir);
|
||||
if (pathExists) {
|
||||
await this.compressSession();
|
||||
await this.store.save({session: this.sessionName});
|
||||
await fs.promises.unlink(`${this.sessionName}.zip`);
|
||||
await this.store.save({session: path.join(this.dataPath, this.sessionName)});
|
||||
await fs.promises.unlink(path.join(this.dataPath, `${this.sessionName}.zip`));
|
||||
await fs.promises.rm(`${this.tempDir}`, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
|
|
@ -119,7 +119,7 @@ class RemoteAuth extends BaseAuthStrategy {
|
|||
|
||||
async extractRemoteSession() {
|
||||
const pathExists = await this.isValidPath(this.userDataDir);
|
||||
const compressedSessionPath = `${this.sessionName}.zip`;
|
||||
const compressedSessionPath = path.join(this.dataPath, `${this.sessionName}.zip`);
|
||||
const sessionExists = await this.store.sessionExists({session: this.sessionName});
|
||||
if (pathExists) {
|
||||
await fs.promises.rm(this.userDataDir, {
|
||||
|
|
@ -143,7 +143,7 @@ class RemoteAuth extends BaseAuthStrategy {
|
|||
|
||||
async compressSession() {
|
||||
const archive = archiver('zip');
|
||||
const stream = fs.createWriteStream(`${this.sessionName}.zip`);
|
||||
const stream = fs.createWriteStream(path.join(this.dataPath, `${this.sessionName}.zip`));
|
||||
|
||||
await fs.copy(this.userDataDir, this.tempDir).catch(() => {});
|
||||
await this.deleteMetadata();
|
||||
|
|
|
|||
Loading…
Reference in a new issue