hacker-lobby 1.1.1 → 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.
package/README.md CHANGED
@@ -63,21 +63,28 @@ Once the installation is complete, restart your terminal application (PowerShell
63
63
 
64
64
  ## 🚀 How to Access Hacker Lobby
65
65
 
66
- You can connect to the global chat room instantly using `npx`. There is no need to clone the repository or set up a local server.
66
+ You can connect to the global chat room instantly using `npx`. There is no need to clone the repository, download files, or configure local databases.
67
67
 
68
- Run one of the following commands in your terminal, which configures the `API_URL` environment variable to point to the global server and launches the client:
68
+ Simply open your terminal and run:
69
+ ```bash
70
+ npx hacker-lobby
71
+ ```
72
+ *This command runs the client and automatically connects to the global production server.*
73
+
74
+ ### Using a Custom Server URL (Optional)
75
+ If you wish to connect to a custom/different backend, you can specify the `API_URL` environment variable:
69
76
 
70
77
  * **PowerShell (Windows)**:
71
78
  ```powershell
72
- $env:API_URL="https://hacker-lobby-backend.spidozx.workers.dev"; npx hacker-lobby
79
+ $env:API_URL="https://your-custom-backend.workers.dev"; npx hacker-lobby
73
80
  ```
74
81
  * **Command Prompt (Windows)**:
75
82
  ```cmd
76
- set API_URL=https://hacker-lobby-backend.spidozx.workers.dev && npx hacker-lobby
83
+ set API_URL=https://your-custom-backend.workers.dev && npx hacker-lobby
77
84
  ```
78
85
  * **macOS / Linux / Git Bash**:
79
86
  ```bash
80
- API_URL="https://hacker-lobby-backend.spidozx.workers.dev" npx hacker-lobby
87
+ API_URL="https://your-custom-backend.workers.dev" npx hacker-lobby
81
88
  ```
82
89
 
83
90
  ---
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.1",
3
+ "version": "1.1.3",
4
4
  "description": "Multiplayer terminal chat application",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/api.js CHANGED
@@ -1,11 +1,7 @@
1
1
  import { getToken } from './config.js';
2
2
 
3
3
  function getApiUrl() {
4
- const url = process.env.API_URL;
5
- if (!url) {
6
- throw new Error('API_URL environment variable is missing. Please make sure you have a .env file configured locally.');
7
- }
8
- return url;
4
+ return process.env.API_URL || 'https://hacker-lobby-backend.spidozx.workers.dev';
9
5
  }
10
6
 
11
7
  /**