Skip to content

Commit 09debec

Browse files
committed
readPassword now waits until db is ready
1 parent b2e5c41 commit 09debec

4 files changed

Lines changed: 12 additions & 5 deletions

File tree

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ dist
77
dist/*
88
dist/**
99

10+
releases
11+
releases/*
12+
releases/**
1013

1114
misc
1215

@@ -32,7 +35,7 @@ phonea.txt
3235

3336
testing.js
3437

35-
38+
releases
3639

3740
.vscode
3841

build/build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ catch {
99
}
1010
tsc
1111
try {
12-
pkg --out-path releases/latest/x64 -t 'node16-linux-x64,node16-win-x64,node16-macos-x64' -C Gzip -c ./package.json ./dist/Tortilla.js
12+
pkg --out-path releases/latest/x64 -t 'node16-linux-x64,node16-win-x64,node16-macos-x64' -C Gzip -c ./package.json ./dist/src/Tortilla.js
1313
Write-Output 'Finished x64'
14-
pkg --out-path releases/latest/latest -t 'node16-linux,node16-win,node16-macos' -C Gzip -c ./package.json ./dist/Tortilla.js
14+
pkg --out-path releases/latest/latest -t 'node16-linux,node16-win,node16-macos' -C Gzip -c ./package.json ./dist/src/Tortilla.js
1515
Write-Output 'Finished latest'
1616
# pkg --out-path releases/latest/arm -t 'node16-linux-arm64,node16-macos-arm64' ./dist/src/Tortilla.js
1717
Write-Output 'UNABLE TO CREATE ARM Binaries PLEASE RUN pkg --out-path releases/latest/arm -t "node16-linux-arm64,node16-macos-arm64" -C Gzip ./dist/Tortilla.js'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"scripts": {
5858
"test": "mocha -r ts-node/register --timeout 10000 test/**/*.spec.ts",
5959
"test_integration": "mocha -r ts-node/register --timeout 30000 --exit tests/**/*.spec.ts ",
60-
"start": "tsc && cross-env DEV=true node --inspect --trace-warnings ./dist/Tortilla.js",
60+
"start": "tsc && cross-env DEV=true node --inspect --trace-warnings ./dist/src/Tortilla.js",
6161
"start_linux": "tsc && cross-env DEV=true node --inspect --trace-warnings ./dist/Tortilla.js",
6262
"build_linux": "export SALT=$(node -e \"const crypto = require('crypto'); console.log(crypto.randomBytes(256).toString('hex'));\") && export SALT_2=$(node -e \"const crypto = require('crypto'); console.log(crypto.randomBytes(256).toString('hex'));\") && node ./build/prebuild.js $SALT $SALT_2 && tsc && pkg --out-path releases/latest/arm -t \"node16-linux-arm64,node16-win-arm64,node16-macos-arm64\" -C Gzip -c package.json ./dist/Tortilla.js && node ./build/postbuild.js $SALT $SALT_2 && echo 'Binaries are located in releases/latest' ",
6363
"build-win": "powershell ./build/build.ps1",

src/db/db.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,11 @@ class DataBase {
557557
*
558558
* @returns {Promise<string | false>} A promise that resolves to the master password.
559559
*/
560-
async readPassword() {
560+
async readPassword(): Promise<string | false> {
561+
if (!this.ready) {
562+
await delay(1000);
563+
return await this.readPassword();
564+
}
561565
try {
562566
return this.encrypt.decrypt(await this.configs.get("master_hash").catch(() => ""), this._getPKey(""));
563567
} catch (error) {

0 commit comments

Comments
 (0)