10 browsers: add b9 (Edge macOS) + b10 (Chrome Android Samsung)
- config.json: 10 browsers, 10 UA presets, vpsIp 49.128.189.254 - generate.js / server.js: id validation ^b(10|[1-9])$ - install.sh: loops seq 1..10, VPS_IP auto-detected via ifconfig.me, UFW ranges 18081:18090 / 52000:52999 - index.html: grid 5x2, subtitle 10 browser - paste-sync-test: 10 cells, 17/17 pass - README: 10-browser docs, manual add section now covers b11+
This commit is contained in:
1 parent
b600b92d76
commit
df4ae5a17a
7 files changed
+89
-74
No files matched your search
+3
-3
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env node
|
||||
// generate.js — single source of truth for per-browser Neko files.
|
||||
// Usage: node generate.js <browserId> [uaKey] [proxyJson]
|
||||
// browserId: b1..b8 (required)
|
||||
// browserId: b1..b10 (required)
|
||||
// uaKey: one of the keys in manager/config.json uaPresets (optional,
|
||||
// defaults to the browser's configured uaKey)
|
||||
// proxyJson: JSON string, e.g. '{"type":"direct"}' or
|
||||
@@ -9,7 +9,7 @@
|
||||
// (optional, defaults to {"type":"direct"})
|
||||
// Writes: <FARM_ROOT>/<id>/chromium.conf and <FARM_ROOT>/<id>/meta.json
|
||||
// FARM_ROOT env var overrides the output root (default /opt/farm).
|
||||
// Only ever called with validated arguments (browser id ^b[1-8]$, ua key from
|
||||
// Only ever called with validated arguments (browser id ^b(10|[1-9])$, ua key from
|
||||
// the preset list, proxy validated by the caller). Never passes user input
|
||||
// to a shell.
|
||||
'use strict';
|
||||
@@ -32,7 +32,7 @@ function main() {
|
||||
const uaKeyArg = process.argv[3] || '';
|
||||
const proxyJson = process.argv[4] || '';
|
||||
|
||||
if (!/^b[1-8]$/.test(id || '')) fail('invalid browser id (want b1..b8)');
|
||||
if (!/^b(10|[1-9])$/.test(id || '')) fail('invalid browser id (want b1..b10)');
|
||||
|
||||
let cfg;
|
||||
try {
|
||||
|
||||
+24
-13
@@ -12,7 +12,18 @@ FARM_ROOT="/opt/farm"
|
||||
APP_DIR="/opt/browser-farm"
|
||||
FARM_PASSWORD="1722"
|
||||
NEKO_IMAGE="m1k1o/neko:chromium"
|
||||
VPS_IP="49.128.191.144"
|
||||
# Public IP of this VPS (used for NEKO_NAT1TO1 so WebRTC reaches it).
|
||||
# Auto-detected from ifconfig.me; override with VPS_IP=... when running
|
||||
# the installer if the detection is wrong.
|
||||
VPS_IP="${VPS_IP:-}"
|
||||
if [ -z "$VPS_IP" ]; then
|
||||
VPS_IP="$(curl -s --max-time 10 https://ifconfig.me 2>/dev/null || wget -qO- --timeout=10 https://ifconfig.me 2>/dev/null || true)"
|
||||
fi
|
||||
if [ -z "$VPS_IP" ]; then
|
||||
echo "ERROR: tidak bisa mendeteksi IP publik VPS (ifconfig.me tidak terjangkau)." >&2
|
||||
echo "Jalankan dengan: VPS_IP=<ip-publik> bash scripts/install.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
@@ -53,14 +64,14 @@ echo "==> node: $NODE_BIN ($("$NODE_BIN" --version)), docker: $(docker --version
|
||||
|
||||
# ---- stop / remove any existing farm containers (idempotency) ----
|
||||
echo "==> Removing old farm-b* containers (if any)..."
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
for n in $(seq 1 10); do
|
||||
docker rm -f "farm-b$n" >/dev/null 2>&1 || true
|
||||
done
|
||||
|
||||
# ---- per-browser files: profile dir, policies.json, chromium.conf, meta.json ----
|
||||
echo "==> Generating per-browser files under $FARM_ROOT ..."
|
||||
mkdir -p "$FARM_ROOT"
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
for n in $(seq 1 10); do
|
||||
id="b$n"
|
||||
mkdir -p "$FARM_ROOT/$id/profile"
|
||||
cp "$REPO_DIR/templates/policies.json" "$FARM_ROOT/$id/policies.json"
|
||||
@@ -72,9 +83,9 @@ done
|
||||
echo "==> Pulling $NEKO_IMAGE ..."
|
||||
docker pull "$NEKO_IMAGE" >/dev/null
|
||||
|
||||
# ---- create the 8 browser containers ----
|
||||
echo "==> Creating farm-b1..farm-b8 ..."
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
# ---- create the 10 browser containers ----
|
||||
echo "==> Creating farm-b1..farm-b10 ..."
|
||||
for n in $(seq 1 10); do
|
||||
id="b$n"
|
||||
http_port=$((18080 + n))
|
||||
udp_start=$((52000 + (n - 1) * 100))
|
||||
@@ -134,7 +145,7 @@ systemctl enable --now farm-manager
|
||||
|
||||
# ---- nginx vhost (grid on port 80) ----
|
||||
# The grid (manager) is at /. Each Neko instance is ALSO reachable
|
||||
# same-origin under /b1/ .. /b8/ so the grid page can script into the
|
||||
# same-origin under /b1/ .. /b10/ so the grid page can script into the
|
||||
# Neko iframes (Sync control needs same-origin access). The trailing
|
||||
# slash on proxy_pass strips the /bN/ prefix, so /b1/api/ws reaches the
|
||||
# Neko server as /api/ws. Host is forwarded unchanged so the Neko
|
||||
@@ -157,7 +168,7 @@ server {
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
EOF
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
for n in $(seq 1 10); do
|
||||
http_port=$((18080 + n))
|
||||
cat >> /etc/nginx/sites-available/farm.conf <<EOF
|
||||
location /b$n/ {
|
||||
@@ -188,8 +199,8 @@ systemctl reload nginx
|
||||
if command -v ufw >/dev/null 2>&1 && ufw status 2>/dev/null | grep -q "Status: active"; then
|
||||
echo "==> UFW aktif — membuka port farm..."
|
||||
ufw allow 80/tcp >/dev/null
|
||||
ufw allow 18081:18088/tcp >/dev/null
|
||||
ufw allow 52000:52799/udp >/dev/null
|
||||
ufw allow 18081:18090/tcp >/dev/null
|
||||
ufw allow 52000:52999/udp >/dev/null
|
||||
fi
|
||||
|
||||
# ---- verify ----
|
||||
@@ -201,7 +212,7 @@ echo "--- manager ---"
|
||||
systemctl is-active farm-manager
|
||||
curl -s --max-time 10 http://127.0.0.1:18080/health; echo
|
||||
echo "--- neko http ports ---"
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
for n in $(seq 1 10); do
|
||||
http_port=$((18080 + n))
|
||||
code="$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "http://127.0.0.1:$http_port/" || echo FAIL)"
|
||||
echo " farm-b$n :$http_port -> $code"
|
||||
@@ -213,12 +224,12 @@ cat <<EOF
|
||||
Browser Farm LIVE
|
||||
Grid URL : http://$VPS_IP/
|
||||
Manager : http://127.0.0.1:18080/health (di VPS)
|
||||
Browsers : http://$VPS_IP:18081/ .. :18088/
|
||||
Browsers : http://$VPS_IP:18081/ .. :18090/
|
||||
Password : password farm yang di FARM_PASSWORD (login sekali
|
||||
per cell, Neko mengingatnya di browser kamu)
|
||||
===============================================================
|
||||
Checklist verifikasi:
|
||||
[ ] Buka grid URL — 8 cell tampil, status Running
|
||||
[ ] Buka grid URL — 10 cell tampil, status Running
|
||||
[ ] Login tiap cell sekali dengan password farm
|
||||
[ ] Buka https://www.whatismybrowser.com di tiap cell —
|
||||
User-Agent harus berbeda-beda sesuai label identitas
|
||||
|
||||
Reference in new issue
Block a user