hacker-lobby 1.1.0 → 1.1.2
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 +52 -41
- package/package.json +2 -2
- package/src/api.js +1 -5
package/README.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
# 📟 Hacker Lobby
|
|
2
2
|
|
|
3
|
-
A secure, real-time, multiplayer terminal chat application
|
|
3
|
+
A secure, real-time, multiplayer terminal chat application that connects hackers globally. The application runs entirely within your terminal, utilizing a serverless Cloudflare Workers and D1 database backend on the edge to deliver real-time messaging without latency.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 🌍 Global Access & Connecting Globally
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Hacker Lobby is designed to connect people globally. When you run the application, it connects to a production server deployed on Cloudflare's serverless edge network. This allows you to chat in real-time with developers and terminal enthusiasts from all around the world.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
* **Global API Backend URL**: `https://hacker-lobby-backend.spidozx.workers.dev`
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 📥 Prerequisites: Downloading Node.js and npm
|
|
16
|
+
|
|
17
|
+
To run the Hacker Lobby client, you need **Node.js** installed on your system.
|
|
18
|
+
|
|
19
|
+
When you install Node.js, it automatically installs:
|
|
20
|
+
1. **npm (Node Package Manager)**: Used for installing and managing Node.js packages.
|
|
21
|
+
2. **npx (Node Package Runner)**: Used to execute Node.js CLI packages directly without manual global installation.
|
|
22
|
+
|
|
23
|
+
### How to Download and Install
|
|
12
24
|
|
|
13
25
|
#### 🪟 Windows
|
|
14
|
-
* **Direct Installer**: Download the recommended LTS installer from the [official Node.js website](https://nodejs.org/). Run the `.msi` file and follow the
|
|
26
|
+
* **Direct Installer**: Download the recommended LTS installer from the [official Node.js website](https://nodejs.org/). Run the downloaded `.msi` file and follow the installer prompts.
|
|
15
27
|
* **Terminal (Winget)**: Open PowerShell or Command Prompt as administrator and run:
|
|
16
28
|
```powershell
|
|
17
29
|
winget install OpenJS.NodeJS
|
|
@@ -25,75 +37,74 @@ To run the Hacker Lobby client and server, you need **Node.js** installed on you
|
|
|
25
37
|
```
|
|
26
38
|
|
|
27
39
|
#### 🐧 Linux (Ubuntu/Debian)
|
|
28
|
-
Open Terminal and run the following
|
|
40
|
+
Open Terminal and run the following commands to install Node.js and npm:
|
|
29
41
|
```bash
|
|
30
42
|
sudo apt update
|
|
31
43
|
sudo apt install nodejs npm -y
|
|
32
44
|
```
|
|
33
45
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### 💻 2. Accessing and Verifying via Terminal
|
|
37
|
-
|
|
38
|
-
Once installed, restart your terminal application (PowerShell, Command Prompt, or bash) and verify the installation:
|
|
46
|
+
### Verifying Your Installation
|
|
47
|
+
Once the installation is complete, restart your terminal application (PowerShell, Command Prompt, or bash) and verify the setup:
|
|
39
48
|
|
|
40
|
-
1. **Verify Node.js
|
|
49
|
+
1. **Verify Node.js**:
|
|
41
50
|
```bash
|
|
42
51
|
node -v
|
|
43
52
|
```
|
|
44
|
-
2. **Verify npm
|
|
53
|
+
2. **Verify npm**:
|
|
45
54
|
```bash
|
|
46
55
|
npm -v
|
|
47
56
|
```
|
|
48
|
-
3. **Verify npx
|
|
57
|
+
3. **Verify npx**:
|
|
49
58
|
```bash
|
|
50
59
|
npx -v
|
|
51
60
|
```
|
|
52
61
|
|
|
53
62
|
---
|
|
54
63
|
|
|
55
|
-
##
|
|
64
|
+
## 🚀 How to Access Hacker Lobby
|
|
56
65
|
|
|
57
|
-
|
|
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.
|
|
58
67
|
|
|
59
|
-
|
|
60
|
-
Clone the repository, navigate to the folder, and run:
|
|
68
|
+
Simply open your terminal and run:
|
|
61
69
|
```bash
|
|
62
|
-
|
|
70
|
+
npx hacker-lobby
|
|
63
71
|
```
|
|
72
|
+
*This command runs the client and automatically connects to the global production server.*
|
|
64
73
|
|
|
65
|
-
###
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
npx wrangler d1 execute chat-db --local --file=schema.sql
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 3. Run the Backend Server
|
|
72
|
-
Start the local serverless backend with Wrangler:
|
|
73
|
-
```bash
|
|
74
|
-
npx wrangler dev
|
|
75
|
-
```
|
|
76
|
-
The server will start listening at `http://127.0.0.1:8787`.
|
|
77
|
-
|
|
78
|
-
### 4. Connect with CLI Chat Client
|
|
79
|
-
Configure the client to connect to your local backend server using environment variables:
|
|
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:
|
|
80
76
|
|
|
81
77
|
* **PowerShell (Windows)**:
|
|
82
78
|
```powershell
|
|
83
|
-
$env:API_URL="
|
|
79
|
+
$env:API_URL="https://your-custom-backend.workers.dev"; npx hacker-lobby
|
|
80
|
+
```
|
|
81
|
+
* **Command Prompt (Windows)**:
|
|
82
|
+
```cmd
|
|
83
|
+
set API_URL=https://your-custom-backend.workers.dev && npx hacker-lobby
|
|
84
84
|
```
|
|
85
85
|
* **macOS / Linux / Git Bash**:
|
|
86
86
|
```bash
|
|
87
|
-
API_URL="
|
|
87
|
+
API_URL="https://your-custom-backend.workers.dev" npx hacker-lobby
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
92
|
+
## 💬 How to Use
|
|
93
|
+
|
|
94
|
+
Once inside the lobby, you can interact with the global room:
|
|
95
|
+
|
|
96
|
+
1. **Choose an Alias**: Type your nickname and press **Enter**.
|
|
97
|
+
2. **Lock Your Alias (Optional)**: If you choose to lock your alias, you will be prompted to create a password. For security, characters are hidden as you type.
|
|
98
|
+
3. **Chatting**: Type your message and press **Enter** to broadcast it.
|
|
99
|
+
4. **Commands**:
|
|
100
|
+
* Type `/exit` or `/quit` to close the application.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
92
104
|
## ✨ Features
|
|
93
105
|
|
|
94
106
|
- **Real-Time Messaging**: Built on Server-Sent Events (SSE) for zero-latency multiplayer updates.
|
|
95
|
-
- **Secure Alias Locking**:
|
|
96
|
-
- **Input Masking**: Passwords and confirmation queries are
|
|
97
|
-
- **Anti-Spam Rate Limiting**:
|
|
98
|
-
- **
|
|
99
|
-
- **Terminal XSS Protection**: Strip ANSI escape sequences from incoming user payloads to prevent control character injection attacks.
|
|
107
|
+
- **Secure Alias Locking**: Register your nickname with a password. Passwords are salted and hashed using SHA-256 for secure database verification.
|
|
108
|
+
- **Input Masking**: Passwords and confirmation queries are hidden on the terminal screen during entry.
|
|
109
|
+
- **Anti-Spam Rate Limiting**: Token-bucket rate limiting prevents message spamming.
|
|
110
|
+
- **Terminal XSS Protection**: Filters ANSI escape sequences to prevent control character injection attacks.
|
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { getToken } from './config.js';
|
|
2
2
|
|
|
3
3
|
function getApiUrl() {
|
|
4
|
-
|
|
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
|
/**
|