Skip to content

Commit 68d680d

Browse files
authored
Merge pull request #35 from saifyxpro/develop
Develop
2 parents 5590150 + 3c70c7d commit 68d680d

52 files changed

Lines changed: 3896 additions & 2936 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ PORT=8000
1414
HOST=0.0.0.0
1515
NODE_ENV=development
1616

17+
# ------------------------------
18+
# 2A. SECURITY (REQUIRED)
19+
# ------------------------------
20+
# Used by the Next.js dashboard server to authenticate against the API.
21+
DASHBOARD_INTERNAL_API_KEY=replace-with-a-long-random-string
22+
23+
# Used to encrypt stored proxy and profile passwords at rest.
24+
CREDENTIAL_ENCRYPTION_KEY=replace-with-a-different-long-random-string
25+
1726
# ------------------------------
1827
# 3. PROFILE STORAGE
1928
# ------------------------------
@@ -42,6 +51,9 @@ LOG_DIR=./logs
4251
# ------------------------------
4352
# 5. FRONTEND (Next.js)
4453
# ------------------------------
54+
# Frontend dashboard port (used by apps/web dev/start scripts)
55+
WEB_PORT=3000
56+
4557
NEXT_PUBLIC_API_URL=http://localhost:8000
4658

4759
# CORS: Add your frontend URL for custom deployments
-32 KB
Binary file not shown.
-101 KB
Binary file not shown.

.nx/workspace-data/d/server-process.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 0 additions & 62 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,24 @@ cp .env.example .env
224224
# REQUIRED: Your PostgreSQL connection string
225225
DATABASE_URL="postgresql://user:password@host:5432/database"
226226
227+
# REQUIRED: Internal dashboard/API secret
228+
DASHBOARD_INTERNAL_API_KEY="replace-with-a-long-random-string"
229+
230+
# REQUIRED: Encryption key for stored proxy/profile passwords
231+
CREDENTIAL_ENCRYPTION_KEY="replace-with-a-different-long-random-string"
232+
227233
# Optional: Server configuration
228234
PORT=8000
229235
NODE_ENV=development
230236
```
231237

238+
Generate secure values before starting the app:
239+
240+
```bash
241+
openssl rand -hex 32 # DASHBOARD_INTERNAL_API_KEY
242+
openssl rand -hex 32 # CREDENTIAL_ENCRYPTION_KEY
243+
```
244+
232245
### 2️⃣ Install Dependencies & Setup
233246

234247
Using Mise (Recommended):
@@ -266,6 +279,8 @@ HeadlessX can be easily deployed using Docker Compose. See the [Docker Setup Gui
266279
docker compose -f infra/docker/docker-compose.yml up -d
267280
```
268281

282+
The Docker stack now requires `DASHBOARD_INTERNAL_API_KEY` and `CREDENTIAL_ENCRYPTION_KEY` in `.env`. The API will refuse to boot without them.
283+
269284
### 6️⃣ Access the Application
270285

271286
| Service | URL | Notes |
@@ -282,7 +297,7 @@ You can customize ports via environment variables:
282297
PORT=8000 pnpm --filter api dev
283298

284299
# Frontend
285-
PORT=3000 pnpm --filter web dev
300+
WEB_PORT=3000 pnpm --filter web dev
286301
```
287302

288303
---
@@ -376,11 +391,16 @@ curl -X POST http://localhost:8000/api/website/html \
376391
377392
Only the following core variables are required in `.env`:
378393

379-
| Variable | Default | Description |
380-
| --------------------- | ----------------------- | ----------------------------------------------- |
381-
| `PORT` | `8000` | Backend API port |
382-
| `DATABASE_URL` | - | PostgreSQL connection (Supabase or self-hosted) |
383-
| `NEXT_PUBLIC_API_URL` | `http://localhost:8000` | Frontend API URL |
394+
| Variable | Default | Description |
395+
| ---------------------------- | ----------------------- | --------------------------------------------------------- |
396+
| `PORT` | `8000` | Backend API port |
397+
| `WEB_PORT` | `3000` | Frontend dashboard port |
398+
| `DATABASE_URL` | - | PostgreSQL connection (Supabase or self-hosted) |
399+
| `NEXT_PUBLIC_API_URL` | `http://localhost:8000` | Frontend API URL |
400+
| `DASHBOARD_INTERNAL_API_KEY` | - | Required server-side secret for dashboard to API traffic |
401+
| `CREDENTIAL_ENCRYPTION_KEY` | - | Required key for encrypting stored proxy/profile passwords |
402+
403+
The dashboard now proxies `/api/*` requests server-side. Do not expose `DASHBOARD_INTERNAL_API_KEY` to browser code or public env vars.
384404

385405
### Dashboard Settings
386406

SECURITY.md

Lines changed: 0 additions & 19 deletions
This file was deleted.

apps/api/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,34 @@
3131
"author": "SaifyXPRO",
3232
"license": "MIT",
3333
"dependencies": {
34-
"@prisma/adapter-pg": "^7.3.0",
35-
"@prisma/client": "^7.3.0",
34+
"@prisma/adapter-pg": "^7.4.1",
35+
"@prisma/client": "^7.4.1",
3636
"@xenova/transformers": "^2.17.2",
3737
"axios": "^1.13.5",
38-
"camoufox-js": "^0.8.5",
38+
"camoufox-js": "^0.9.1",
3939
"cors": "^2.8.6",
40-
"dotenv": "^17.2.3",
40+
"dotenv": "^17.3.1",
4141
"express": "^5.2.1",
4242
"https-proxy-agent": "^7.0.6",
43-
"onnxruntime-web": "^1.23.2",
44-
"playwright-core": "^1.58.0",
45-
"prisma": "^7.3.0",
43+
"onnxruntime-web": "^1.24.2",
44+
"playwright-core": "^1.58.2",
45+
"prisma": "^7.4.1",
4646
"proxy-chain": "^2.7.1",
4747
"socks-proxy-agent": "^8.0.5",
4848
"turndown": "^7.2.2",
4949
"wavefile": "^11.0.0",
5050
"zod": "^4.3.6",
51-
"sharp": "^0.32.6"
51+
"sharp": "^0.34.5"
5252
},
5353
"devDependencies": {
5454
"@types/cors": "^2.8.19",
5555
"@types/express": "^5.0.6",
56-
"@types/node": "^25.0.10",
56+
"@types/node": "^25.3.0",
5757
"@types/turndown": "^5.0.6",
58-
"dotenv-cli": "^8.0.0",
58+
"dotenv-cli": "^11.0.0",
5959
"only-allow": "^1.2.1",
6060
"ts-node": "^10.9.2",
6161
"tsx": "^4.21.0",
6262
"typescript": "^5.9.3"
6363
}
64-
}
64+
}

apps/api/src/controllers/ProfileController.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,23 @@ function toSnakeCase(profile: Profile) {
1818
proxy_id: profile.proxyId,
1919
proxy_url: profile.proxyUrl,
2020
proxy_username: profile.proxyUsername,
21-
proxy_password: profile.proxyPassword,
21+
proxy_password_configured: Boolean(profile.proxyPassword),
2222
is_active: profile.isActive,
2323
is_running: profile.isRunning,
2424
cookies_count: profile.cookiesCount,
2525
storage_size_mb: profile.storageSizeMb,
2626
created_at: profile.createdAt,
2727
updated_at: profile.updatedAt,
2828
last_used_at: profile.lastUsedAt,
29-
proxy: profile.proxy,
29+
proxy: profile.proxy ? {
30+
id: profile.proxy.id,
31+
name: profile.proxy.name,
32+
protocol: profile.proxy.protocol,
33+
host: profile.proxy.host,
34+
port: profile.proxy.port,
35+
username: profile.proxy.username,
36+
has_password: Boolean(profile.proxy.password),
37+
} : null,
3038
};
3139
}
3240

0 commit comments

Comments
 (0)