hacker-lobby 1.1.2 → 1.1.3

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.
Files changed (2) hide show
  1. package/index.js +15 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -117,6 +117,9 @@ function promptAlias() {
117
117
  }
118
118
 
119
119
  function promptPassword(alias) {
120
+ rl.line = '';
121
+ rl.cursor = 0;
122
+ process.stdout.write('\r\x1B[K');
120
123
  process.stdout.write(`${COLORS.YELLOW}${COLORS.BOLD}This alias is locked. Enter password: ${COLORS.RESET}`);
121
124
 
122
125
  muteInput = true;
@@ -149,21 +152,29 @@ function promptPassword(alias) {
149
152
  }
150
153
 
151
154
  function promptLockOption(alias) {
155
+ rl.line = '';
156
+ rl.cursor = 0;
157
+ process.stdout.write('\r\x1B[K');
152
158
  process.stdout.write(`${COLORS.YELLOW}${COLORS.BOLD}Would you like to lock @${alias} with a password? (y/n): ${COLORS.RESET}`);
153
159
 
154
160
  rl.question('', (ans) => {
155
161
  const response = ans.trim().toLowerCase();
156
162
  if (response === 'y' || response === 'yes') {
157
163
  promptCreatePassword(alias);
158
- } else {
164
+ } else if (response === 'n' || response === 'no') {
159
165
  setAlias(alias);
160
166
  setToken('');
161
167
  initChat();
168
+ } else {
169
+ promptLockOption(alias);
162
170
  }
163
171
  });
164
172
  }
165
173
 
166
174
  function promptCreatePassword(alias) {
175
+ rl.line = '';
176
+ rl.cursor = 0;
177
+ process.stdout.write('\r\x1B[K');
167
178
  process.stdout.write(`${COLORS.YELLOW}${COLORS.BOLD}Create password: ${COLORS.RESET}`);
168
179
 
169
180
  muteInput = true;
@@ -177,7 +188,10 @@ function promptCreatePassword(alias) {
177
188
  return;
178
189
  }
179
190
 
191
+ process.stdout.write('\r\x1B[K');
180
192
  process.stdout.write(`${COLORS.YELLOW}${COLORS.BOLD}Confirm password: ${COLORS.RESET}`);
193
+ rl.line = '';
194
+ rl.cursor = 0;
181
195
  muteInput = true;
182
196
  rl.question('', async (pw2) => {
183
197
  muteInput = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hacker-lobby",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Multiplayer terminal chat application",
5
5
  "main": "index.js",
6
6
  "type": "module",