turtb 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/turtb.js +17 -11
- package/package.json +1 -1
package/bin/turtb.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFileSync } from 'fs'
|
|
|
4
4
|
import { start } from 'repl'
|
|
5
5
|
import { Option, program } from 'commander'
|
|
6
6
|
import { keyInSelect, keyInYN, question, questionNewPassword } from 'readline-sync'
|
|
7
|
-
import { LOG_LEVELS, logDebug, logError, logInfo,
|
|
7
|
+
import { LOG_LEVELS, logDebug, logError, logInfo, setLogLevel } from '../lib/utils/logger.js'
|
|
8
8
|
import { Signer } from '../lib/turtle/Signer.js'
|
|
9
9
|
import { TurtleDB } from '../lib/turtle/connections/TurtleDB.js'
|
|
10
10
|
import { Recaller } from '../lib/utils/Recaller.js'
|
|
@@ -22,6 +22,7 @@ import { proxyFolder } from '../src/proxyFolder.js'
|
|
|
22
22
|
import { fileURLToPath } from 'url'
|
|
23
23
|
import { dirname, join } from 'path'
|
|
24
24
|
|
|
25
|
+
const startTime = new Date()
|
|
25
26
|
const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url)))
|
|
26
27
|
|
|
27
28
|
const defaultWebPort = 8080
|
|
@@ -209,22 +210,27 @@ if (options.envFile) {
|
|
|
209
210
|
Object.assign(options, program.opts()) // update options with new env vars
|
|
210
211
|
}
|
|
211
212
|
setLogLevel(options.verbose)
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
logInfo(() => console.log())
|
|
214
|
+
logInfo(() => console.log(`\x1b[32mturtb v${version}\x1b[0m`))
|
|
215
|
+
logInfo(() => console.log(`\x1b[34m${startTime.toLocaleString()} \x1b[2m(${startTime.toISOString()})\x1b[0m`))
|
|
216
|
+
logInfo(() => console.log())
|
|
217
|
+
options.turtlename ||= question('Turtlename: ')
|
|
218
|
+
options.username ||= question('Username: ')
|
|
214
219
|
const turtlename = options.turtlename
|
|
215
220
|
const username = options.username
|
|
216
|
-
const signer = new Signer(username, options.password || questionNewPassword('
|
|
221
|
+
const signer = new Signer(username, options.password || questionNewPassword('Password [ATTENTION!: Backspace won\'t work here]: ', { min: 4, max: 999 }))
|
|
217
222
|
const publicKey = (await signer.makeKeysFor(turtlename)).publicKey
|
|
218
223
|
logInfo(() => {
|
|
219
224
|
const maxLength = Math.max(turtlename.length, username.length, publicKey.length)
|
|
220
225
|
console.log(`\x1b[35m
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
╭─────────────────────────${'─'.repeat(maxLength)}──╮
|
|
227
|
+
╞══════════════════════╤══${'═'.repeat(maxLength)}══╡
|
|
228
|
+
│ TURTLENAME: │ \x1b[0m${turtlename}${' '.repeat(maxLength - turtlename.length)}\x1b[35m │
|
|
229
|
+
├──────────────────────┼──${'─'.repeat(maxLength)}──┤
|
|
230
|
+
│ USERNAME: │ \x1b[0m${username}${' '.repeat(maxLength - username.length)}\x1b[35m │
|
|
231
|
+
├──────────────────────┼──${'─'.repeat(maxLength)}──┤
|
|
232
|
+
│ COMPACT PUBLIC KEY: │ \x1b[0m${publicKey}${' '.repeat(maxLength - publicKey.length)}\x1b[35m │
|
|
233
|
+
╰━━━━━━━━━━━━━━━━━━━━━━┷━━${'━'.repeat(maxLength)}━━╯\x1b[0m`)
|
|
228
234
|
})
|
|
229
235
|
|
|
230
236
|
let initOption = -1
|