Browser Farm: grid of 8 isolated Neko browsers with per-browser identity, single login, and sync control
This commit is contained in:
commit
32ac658c70
11 files changed
+2564
No files matched your search
@@ -0,0 +1,3 @@
|
||||
node_modules/
|
||||
*.log
|
||||
.DS_Store
|
||||
@@ -0,0 +1,258 @@
|
||||
# Browser Farm
|
||||
|
||||
Grid web berisi **8 browser Chromium terisolasi** (satu container Neko per
|
||||
browser), masing-masing punya identitas berbeda (profil/cookie, User-Agent,
|
||||
dan proxy sendiri). Semua browser dikontrol dari satu halaman web — mirip
|
||||
phone farm, tapi isinya browser sandbox, bukan HP.
|
||||
|
||||
- Grid: `http://49.128.191.144/` (nginx → manager di 127.0.0.1:18080)
|
||||
- Tiap browser: Neko (WebRTC) di `http://49.128.191.144:18081/` … `:18088/`
|
||||
(port langsung, fallback) dan juga same-origin di
|
||||
`http://49.128.191.144/b1/` … `/b8/` (dipakai grid, untuk Sync)
|
||||
- Manager API: `GET /api/browsers`, `POST /api/browsers/:id/start|stop|restart`,
|
||||
`POST /api/browsers/:id/wipe`, `POST /api/browsers/:id/config`,
|
||||
`POST /api/browsers/start-all|stop-all`, `GET /health`, `GET /api/ua-presets`,
|
||||
`POST /api/login` (satu login farm), `GET /api/me` (status login)
|
||||
|
||||
## Cara kerja
|
||||
|
||||
- Satu browser = satu container Docker `farm-b1` … `farm-b8`
|
||||
(image `m1k1o/neko:chromium`, `--restart unless-stopped`, `--shm-size=2gb`).
|
||||
- Isolasi per browser:
|
||||
- **Profil** — `/opt/farm/<id>/profile` di-bind-mount ke
|
||||
`/home/neko/.config/chromium` di container. Cookie/login/history tersimpan
|
||||
di disk host, jadi survive restart dan recreate container.
|
||||
- **User-Agent** — di-inject lewat `chromium.conf` yang di-bind-mount ke
|
||||
`/etc/neko/supervisord/chromium.conf` (Neko tidak punya env var untuk
|
||||
flag Chromium tambahan). Semua flag asli dipertahankan, hanya ditambah
|
||||
`--user-agent="..."` dan (kalau proxy diisi) `--proxy-server="..."`.
|
||||
- **Proxy** — `--proxy-server` di Chromium. HTTP dan SOCKS5 didukung.
|
||||
- **Kebijakan browser** — `policies.json` di-bind-mount ke
|
||||
`/etc/chromium/policies/managed/policies.json`: download diizinkan
|
||||
(`DownloadRestrictions 0`), dialog file diizinkan, tab lama di-restore
|
||||
otomatis (`RestoreOnStartup 1`), password manager aktif.
|
||||
- Manager (`manager/server.js`, Node + Express) menjalankan docker
|
||||
(`start`/`stop`/`restart`/`inspect`) dan menulis ulang `chromium.conf` +
|
||||
`meta.json` tiap kali identitas diubah, lalu me-restart container itu.
|
||||
- Grid UI (`manager/public/index.html`) menampilkan 8 cell. Tiap cell berisi
|
||||
client Neko (iframe), status, baris identitas, dan tombol
|
||||
Start / Stop / Restart / Wipe / Fullscreen / Settings.
|
||||
|
||||
## Deploy (di VPS 49.128.191.144)
|
||||
|
||||
```bash
|
||||
# 1. Dari VM ini, kirim foldernya ke VPS:
|
||||
scp -r ~/workspace/browser-farm root@49.128.191.144:/root/browser-farm
|
||||
|
||||
# 2. Di VPS, jalankan installer (sebagai root):
|
||||
bash /root/browser-farm/scripts/install.sh
|
||||
```
|
||||
|
||||
Installer itu idempotent (aman dijalankan dua kali): memasang docker/node/
|
||||
nginx kalau belum ada, menghapus container `farm-b*` lama, membuat
|
||||
`/opt/farm/b1..b8/` (profile, policies.json, chromium.conf, meta.json),
|
||||
menarik image Neko, membuat 8 container, memasang manager sebagai service
|
||||
`farm-manager`, memasang vhost nginx `farm.conf`, lalu memverifikasi
|
||||
(container up, manager `/health` OK, tiap port Neko HTTP 200) dan mencetak
|
||||
URL grid.
|
||||
|
||||
Buka `http://49.128.191.144/` — login sekali dengan password farm, lalu
|
||||
semua 8 browser langsung terhubung otomatis (tanpa login per cell).
|
||||
|
||||
## Login: satu password untuk seluruh farm
|
||||
|
||||
- **Satu login, bukan 8.** Grid dikunci satu password (defaultnya sama
|
||||
dengan password Neko: `FarmBrowser2026`). Setelah login, sesi berlaku
|
||||
7 hari (cookie `farm_auth`, httpOnly).
|
||||
- **Cell auto-connect.** Manager login sendiri ke tiap instance Neko
|
||||
(`POST /api/login` dengan user `pend`) dan menyisipkan token sesi ke
|
||||
URL iframe (`?token=...`). Client Neko membaca token itu dan langsung
|
||||
connect — form "nama tampilan + kata sandi" Neko tidak pernah muncul.
|
||||
Token di-cache 55 menit per browser dan di-refresh otomatis; kalau
|
||||
browser restart, token lama dibuang dan token baru diambil (token lama
|
||||
tidak berlaku setelah container restart).
|
||||
- Kalau token gagal diambil (misalnya Neko belum siap), cell memakai URL
|
||||
biasa sebagai fallback — cell itu akan menampilkan form login Neko,
|
||||
bukan cell rusak. Begitu token tersedia, iframe di-upgrade otomatis.
|
||||
- Poll grid tiap 10 detik **tidak pernah** me-reload iframe — hanya
|
||||
status dan baris identitas yang di-update — jadi refresh token tidak
|
||||
pernah menendang user keluar dari browser yang sedang dipakai.
|
||||
- Password lives in one place: `FARM_PASSWORD` di `scripts/install.sh`.
|
||||
Installer meneruskannya ke container Neko **dan** ke service manager
|
||||
(env `FARM_PASSWORD`), jadi keduanya selalu sama.
|
||||
|
||||
## Sinkronisasi kontrol (Sync)
|
||||
|
||||
Satu kendali untuk semua browser — nyalakan tombol **Sinkron** di bar atas
|
||||
grid (default MATI), lalu kendalikan satu browser dan semua browser lain
|
||||
ikut melakukan hal yang sama: gerakan mouse, klik, scroll, dan ketikan.
|
||||
|
||||
- **Master = browser terakhir yang kamu sentuh.** Klik atau ketik di satu
|
||||
cell, cell itu jadi Master (badge kuning + garis tepi kuning). Pindah
|
||||
ke cell lain, Master ikut pindah. Matikan Sync, badge Master hilang.
|
||||
- **Yang di-mirror:** `mousemove`, `mousedown`, `mouseup`, `wheel`,
|
||||
`keydown`, `keyup`. Navigasi ikut karena klik/scroll/ketik adalah
|
||||
input yang sama — buka link di Master, link yang sama terbuka di semua
|
||||
follower. `mousemove` di-throttle ~60fps supaya tidak membanjiri.
|
||||
- **Koordinat relatif.** Posisi mouse dihitung sebagai pecahan dari ukuran
|
||||
area video Master, lalu diterapkan ke ukuran area video tiap follower —
|
||||
jadi tetap akurat meski cell tampil dengan ukuran sedikit berbeda.
|
||||
- **Tanpa loop.** Event yang di-mirror adalah event sintetis
|
||||
(`isTrusted=false`); grid hanya merespons event asli dari user
|
||||
(`isTrusted=true`), jadi follower tidak pernah jadi Master dan tidak
|
||||
pernah me-mirror balik ke Master.
|
||||
- **Cara kerja teknis.**
|
||||
- Iframe tiap cell memakai path same-origin `/b1/` … `/b8/` (bukan port
|
||||
langsung), karena halaman grid hanya bisa mengakses isi iframe kalau
|
||||
same-origin. nginx mem-proxy `/bN/` ke Neko (`127.0.0.1:1808N`,
|
||||
prefix di-strip oleh trailing slash di `proxy_pass`), termasuk
|
||||
WebSocket `/bN/api/ws` (header Upgrade + `Host` asli diteruskan, jadi
|
||||
cek same-origin WebSocket di server Neko lolos). Port langsung
|
||||
`18081..18088` tetap bisa dipakai sebagai fallback (tapi tanpa Sync,
|
||||
karena cross-origin).
|
||||
- Elemen input Neko adalah `<textarea>` transparan milik Overlay
|
||||
(`client/core/src/overlay.ts` di repo m1k1o/neko) — semua listener
|
||||
mouse/wheel/keyboard Neko menempel di situ. Grid menemukannya dari
|
||||
struktur DOM (textarea yang parent-nya juga berisi `<canvas>`),
|
||||
bukan dari nama class. Grid menunggu iframe load lalu mem-poll tiap
|
||||
500ms (maks ~10 detik); cell yang input-nya tidak ketemu dibiarkan
|
||||
tidak di-mirror tanpa merusak grid.
|
||||
- Listener grid menempel di textarea yang sama dengan listener Overlay
|
||||
(Overlay memakai `stopPropagation`, bukan `stopImmediatePropagation`,
|
||||
jadi listener grid tetap jalan). Keyboard di-mirror sebagai
|
||||
`KeyboardEvent` dengan `key`/`code` plus `keyCode`/`which` yang
|
||||
di-shadow via `Object.defineProperty` — keyboard Guacamole Neko
|
||||
memetakan tombol dari `keyCode`/`which` (dan `key`), dan constructor
|
||||
`KeyboardEvent` tidak bisa mengisi `keyCode`/`which` sendiri.
|
||||
- Pilihan ON/OFF disimpan di `localStorage` browser (`farm_sync`),
|
||||
bukan di server — tidak ada endpoint baru. Matikan Sync, tiap browser
|
||||
kembali independen.
|
||||
- **Batasan yang diketahui.**
|
||||
- Follower hanya menerima input kalau sesinya sudah jadi "host" di
|
||||
room Neko-nya (Overlay hanya meneruskan input saat `controlling`).
|
||||
Tiap room hanya berisi satu member (`pend`, admin), dan klik pertama
|
||||
yang di-mirror meminta kontrol otomatis (implicit hosting) — jadi
|
||||
setelah klik pertama, semua follower ikut. Hover murni sebelum klik
|
||||
pertama bisa belum ter-mirror di follower.
|
||||
- `Ctrl+V` (paste) tidak di-mirror sebagai ketikan: Overlay Neko
|
||||
menangani paste lewat clipboard lokal, bukan lewat key event.
|
||||
- Kalau WebSocket lewat proxy `/bN/` gagal (misalnya cek Origin di
|
||||
server Neko menolak), cell tidak akan connect — pakai port langsung
|
||||
`:1808N` sebagai fallback untuk pemakaian satu browser, dan laporkan
|
||||
ke Muse untuk diperiksa.
|
||||
|
||||
## Identitas default (8 browser)
|
||||
|
||||
| ID | Nama | User-Agent | HTTP | UDP |
|
||||
|----|------|------------|------|-----|
|
||||
| b1 | Browser 1 · Chrome Windows | Chrome · Windows | 18081 | 52000–52099 |
|
||||
| b2 | Browser 2 · Chrome macOS | Chrome · macOS | 18082 | 52100–52199 |
|
||||
| b3 | Browser 3 · Edge Windows | Edge · Windows | 18083 | 52200–52299 |
|
||||
| b4 | Browser 4 · Firefox Windows | Firefox · Windows | 18084 | 52300–52399 |
|
||||
| b5 | Browser 5 · Chrome Linux | Chrome · Linux | 18085 | 52400–52499 |
|
||||
| b6 | Browser 6 · Safari macOS | Safari · macOS | 18086 | 52500–52599 |
|
||||
| b7 | Browser 7 · Chrome Android | Chrome · Android | 18087 | 52600–52699 |
|
||||
| b8 | Browser 8 · Firefox macOS | Firefox · macOS | 18088 | 52700–52799 |
|
||||
|
||||
Daftar lengkap UA ada di `manager/config.json` (`uaPresets`). Mengubah
|
||||
identitas: buka Settings di cell → pilih UA + isi proxy → Simpan & Restart.
|
||||
Browser itu restart otomatis dan identitas baru langsung aktif.
|
||||
|
||||
## Menambah browser ke-9
|
||||
|
||||
1. Tambah satu entri ke `manager/config.json` (`browsers`):
|
||||
`{"id":"b9","name":"Browser 9 · ...","uaKey":"chrome-win","httpPort":18089,"udpStart":52800,"udpEnd":52899}`
|
||||
(id harus `b<angka>`, port HTTP dan range UDP harus unik dan belum dipakai).
|
||||
2. Kalau mau UA baru, tambah juga ke `uaPresets` di file yang sama.
|
||||
3. Di VPS, jalankan lagi `bash /root/browser-farm/scripts/install.sh`
|
||||
— tapi installer ini hanya membuat b1..b8. Untuk b9, jalankan manual:
|
||||
```bash
|
||||
FARM_ROOT=/opt/farm node /root/browser-farm/scripts/generate.js b9
|
||||
cp /root/browser-farm/templates/policies.json /opt/farm/b9/policies.json
|
||||
docker run -d --name farm-b9 --restart unless-stopped --stop-timeout 60 \
|
||||
--shm-size=2gb -p 18089:8080 -p 52800-52899:52800-52899/udp \
|
||||
-v /opt/farm/b9/profile:/home/neko/.config/chromium \
|
||||
-v /opt/farm/b9/policies.json:/etc/chromium/policies/managed/policies.json:ro \
|
||||
-v /opt/farm/b9/chromium.conf:/etc/neko/supervisord/chromium.conf:ro \
|
||||
-e NEKO_SCREEN=1280x720@30 -e NEKO_PASSWORD="<password farm>" \
|
||||
-e NEKO_PASSWORD_ADMIN="<password farm>" -e NEKO_NAT1TO1=49.128.191.144 \
|
||||
-e NEKO_EPR=52800-52899 -e NEKO_BIND=:8080 -e NEKO_SERVER_BIND=:8080 \
|
||||
m1k1o/neko:chromium
|
||||
systemctl restart farm-manager
|
||||
```
|
||||
Catatan: validasi id di `manager/server.js` saat ini `^b[1-8]$` — ubah
|
||||
menjadi `^b[1-9]$` (atau `^b\d+$`) kalau sudah ada b9, lalu restart
|
||||
`farm-manager`.
|
||||
|
||||
## Mengganti password farm
|
||||
|
||||
1. Ubah `FARM_PASSWORD` di `scripts/install.sh`.
|
||||
2. Jalankan lagi installer (`bash /root/browser-farm/scripts/install.sh`) —
|
||||
semua container dibuat ulang dengan password baru, dan service manager
|
||||
ikut memakai password baru itu (env `FARM_PASSWORD`).
|
||||
3. Login ulang sekali di grid (password lama tidak berlaku lagi). Tidak
|
||||
perlu login per cell — satu login membuka seluruh farm.
|
||||
|
||||
## Catatan resource
|
||||
|
||||
- Tiap browser (Neko + Chromium + X + PulseAudio) memakai sekitar
|
||||
**700 MB–1 GB RAM** saat jalan. VPS 6 vCPU / 14 GB RAM muat 8 browser
|
||||
dengan nyaman (sekitar 6–8 GB terpakai, sisanya untuk sistem + manager).
|
||||
Jangan menambah browser melebihi RAM yang tersedia — Chromium akan
|
||||
melambat / crash kalau RAM habis.
|
||||
- Disk: tiap profil mulai kecil (puluhan MB) dan membesar seiring pemakaian
|
||||
(cache, history). `/opt/farm` sebaiknya dipantau kalau dipakai lama.
|
||||
- Satu browser = satu container; me-restart satu browser tidak mengganggu
|
||||
yang lain.
|
||||
|
||||
## Catatan keamanan & batasan
|
||||
|
||||
- **Password proxy**: kalau proxy memakai username/password, kredensial itu
|
||||
ditulis ke `chromium.conf` (sebagai bagian URL `--proxy-server`) dan ke
|
||||
`meta.json`. Kedua file itu `chmod 600` dan hanya root yang bisa baca,
|
||||
tapi kredensial tetap terlihat di daftar proses container (`ps`).
|
||||
Sebaiknya pakai proxy tanpa auth kalau bisa.
|
||||
- **Login Neko**: grid memakai satu login farm; manager mengambil token
|
||||
sesi Neko per browser dan menyisipkannya ke URL iframe (`?token=...`),
|
||||
jadi form login Neko tidak pernah muncul. Token hanya dibagikan ke
|
||||
browser yang sudah login ke grid (endpoint `/api/browsers` juga
|
||||
terkunci password farm).
|
||||
- **Satu Chrome per container**: membuka cell yang sama dari dua tab akan
|
||||
berbagi sesi Neko yang sama (bukan dua browser terpisah).
|
||||
- Grid diakses via HTTP (tanpa TLS) karena VPS dipakai lewat IP langsung.
|
||||
Jangan buka grid dari jaringan yang tidak kamu percaya — siapa pun yang
|
||||
bisa membuka URL-nya bisa memakai browser farm ini.
|
||||
- **Wipe** menghapus seluruh profil satu browser (cookie, history, login).
|
||||
Tombolnya meminta konfirmasi, dan hanya profil browser itu yang dihapus.
|
||||
|
||||
## File-file
|
||||
|
||||
```
|
||||
browser-farm/
|
||||
manager/
|
||||
server.js # API + static server (Express, :18080)
|
||||
config.json # 8 browser + 8 preset User-Agent
|
||||
package.json # express ^4.19.2
|
||||
public/index.html # grid UI (4x2, dark, Bahasa Indonesia)
|
||||
scripts/
|
||||
generate.js # satu-satunya generator chromium.conf + meta.json
|
||||
install.sh # installer idempotent untuk VPS
|
||||
templates/
|
||||
chromium.conf.template # supervisord program, flag asli + __UA__/__PROXY__
|
||||
policies.json # managed policy Chromium (download diizinkan, dll)
|
||||
README.md
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Cell menampilkan error koneksi**: browser itu sedang berhenti — klik
|
||||
Start di cell itu, tunggu beberapa detik, iframe akan reconnect sendiri.
|
||||
- **Manager tidak bisa dihubungi**: cek `systemctl status farm-manager`
|
||||
dan `curl http://127.0.0.1:18080/health` di VPS.
|
||||
- **Container restart terus**: cek `docker logs farm-b<N>` — biasanya
|
||||
`chromium.conf` tidak valid. Regenerasi dengan
|
||||
`node /opt/browser-farm/scripts/generate.js b<N>` lalu
|
||||
`docker restart farm-b<N>`.
|
||||
- **Login hilang setelah restart**: profil tersimpan di
|
||||
`/opt/farm/<id>/profile` (bind-mount). Kalau container dihapus tanpa
|
||||
bind-mount itu, profil ikut hilang. Jangan hapus `/opt/farm`.
|
||||
@@ -0,0 +1 @@
|
||||
{"browsers":[{"httpPort":18081,"id":"b1","name":"Browser 1 · Chrome Windows","uaKey":"chrome-win","udpEnd":52099,"udpStart":52000},{"httpPort":18082,"id":"b2","name":"Browser 2 · Chrome macOS","uaKey":"chrome-mac","udpEnd":52199,"udpStart":52100},{"httpPort":18083,"id":"b3","name":"Browser 3 · Edge Windows","uaKey":"edge-win","udpEnd":52299,"udpStart":52200},{"httpPort":18084,"id":"b4","name":"Browser 4 · Firefox Windows","uaKey":"firefox-win","udpEnd":52399,"udpStart":52300},{"httpPort":18085,"id":"b5","name":"Browser 5 · Chrome Linux","uaKey":"chrome-linux","udpEnd":52499,"udpStart":52400},{"httpPort":18086,"id":"b6","name":"Browser 6 · Safari macOS","uaKey":"safari-mac","udpEnd":52599,"udpStart":52500},{"httpPort":18087,"id":"b7","name":"Browser 7 · Chrome Android","uaKey":"chrome-android","udpEnd":52699,"udpStart":52600},{"httpPort":18088,"id":"b8","name":"Browser 8 · Firefox macOS","uaKey":"firefox-mac","udpEnd":52799,"udpStart":52700}],"farmName":"Browser Farm","managerPort":18080,"uaPresets":{"chrome-android":{"label":"Chrome · Android","ua":"Mozilla/5.0 (Linux; Android 14; Pixel 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36"},"chrome-linux":{"label":"Chrome · Linux","ua":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"},"chrome-mac":{"label":"Chrome · macOS","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"},"chrome-win":{"label":"Chrome · Windows","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"},"edge-win":{"label":"Edge · Windows","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"},"firefox-mac":{"label":"Firefox · macOS","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7; rv:133.0) Gecko/20100101 Firefox/133.0"},"firefox-win":{"label":"Firefox · Windows","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0"},"safari-mac":{"label":"Safari · macOS","ua":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1 Safari/605.1.15"}},"vpsIp":"49.128.191.144"}
|
||||
Generated
+840
@@ -0,0 +1,840 @@
|
||||
{
|
||||
"name": "browser-farm-manager",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "browser-farm-manager",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"express": "^4.19.2"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-types": "~2.1.34",
|
||||
"negotiator": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.20.9",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.9.tgz",
|
||||
"integrity": "sha512-FISIQxV5u91Y9gvuFq3q/tA/qTqLJn3AhRcEvyozyhJTh5OBFFtv827AdHU7Rbyct4r+Ba1/99oFa1Y3yuFsdw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"content-type": "~1.0.5",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "~1.2.0",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.4.24",
|
||||
"on-finished": "~2.4.1",
|
||||
"qs": "~6.16.0",
|
||||
"raw-body": "~2.5.3",
|
||||
"type-is": "~1.6.18",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/bytes": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bound": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"get-intrinsic": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/content-type": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "0.7.2",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie-signature": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
||||
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/depd": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/destroy": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
||||
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8",
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/encodeurl": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.3.tgz",
|
||||
"integrity": "sha512-mIteYONiEfc4xWf2F1WXovh1c8npzS00vNeiUPdwFF+QlVJni+gNvpQltLMQhob8rew/bWWc/bGTuUr0EUGt0w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
|
||||
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/express": {
|
||||
"version": "4.22.3",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",
|
||||
"integrity": "sha512-Bdcs4+3qlpVlx2NRn6fgX2Ue2/gGRaPeawebgclM0ERSCqDpA+owF1fdPwjJUTAJWMTuAaxjDf+hzb0/4eKvvw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"accepts": "~1.3.8",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "~1.20.5",
|
||||
"content-disposition": "~0.5.4",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "~0.7.1",
|
||||
"cookie-signature": "~1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "~1.3.1",
|
||||
"fresh": "~0.5.2",
|
||||
"http-errors": "~2.0.0",
|
||||
"merge-descriptors": "1.0.3",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "~2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"path-to-regexp": "~0.1.13",
|
||||
"proxy-addr": "~2.0.7",
|
||||
"qs": "~6.16.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"safe-buffer": "5.2.1",
|
||||
"send": "~0.19.0",
|
||||
"serve-static": "~1.16.2",
|
||||
"setprototypeof": "1.2.0",
|
||||
"statuses": "~2.0.1",
|
||||
"type-is": "~1.6.18",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/finalhandler": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
||||
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.4.1",
|
||||
"parseurl": "~1.3.3",
|
||||
"statuses": "~2.0.2",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/http-errors": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
||||
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"depd": "~2.0.0",
|
||||
"inherits": "~2.0.4",
|
||||
"setprototypeof": "~1.2.0",
|
||||
"statuses": "~2.0.2",
|
||||
"toidentifier": "~1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
||||
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/negotiator": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.14.0",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.14.0.tgz",
|
||||
"integrity": "sha512-IVgHNlp/jwQX271+Xzoq9LZNTWXxZK+cEOrGBOBxXNbn7fapnZ+Ts6TVMgNOuAezwG2wdtnMX97tTPK6VEnuOQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/on-finished": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz",
|
||||
"integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/path-to-regexp": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
||||
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/proxy-addr": {
|
||||
"version": "2.0.8",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
|
||||
"integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"forwarded": "0.2.0",
|
||||
"ipaddr.js": "1.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/qs": {
|
||||
"version": "6.16.2",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.2.tgz",
|
||||
"integrity": "sha512-VYdnB5S7/0IeXzBacUtwNAaM6d7Y/PgYnNC7bJCI6meqA/OgnsQbZMtVW8Dt2D1PHgbHGtYmhSoEIgvt7xZ2ZA==",
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"es-define-property": "^1.0.1",
|
||||
"side-channel": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/raw-body": {
|
||||
"version": "2.5.3",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
|
||||
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bytes": "~3.1.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"iconv-lite": "~0.4.24",
|
||||
"unpipe": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/send": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
|
||||
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "2.0.0",
|
||||
"destroy": "1.2.0",
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "~0.5.2",
|
||||
"http-errors": "~2.0.1",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.3",
|
||||
"on-finished": "~2.4.1",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "~2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/send/node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/serve-static": {
|
||||
"version": "1.16.3",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
|
||||
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"encodeurl": "~2.0.0",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "~0.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
|
||||
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4",
|
||||
"side-channel-list": "^1.0.1",
|
||||
"side-channel-map": "^1.0.1",
|
||||
"side-channel-weakmap": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-list": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"object-inspect": "^1.13.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-map": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel-weakmap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bound": "^1.0.2",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.5",
|
||||
"object-inspect": "^1.13.3",
|
||||
"side-channel-map": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/statuses": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/toidentifier": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"dependencies":{"express":"^4.19.2"},"description":"Browser Farm manager — grid UI + API for 8 isolated Neko browsers","main":"server.js","name":"browser-farm-manager","private":true,"scripts":{"start":"node server.js"},"version":"1.0.0"}
|
||||
@@ -0,0 +1,705 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Browser Farm</title>
|
||||
<style>
|
||||
:root{
|
||||
--bg:#0b1220; --panel:#111c2e; --panel2:#0e1726; --border:#1e2c44;
|
||||
--text:#e6edf7; --muted:#8fa3bf; --accent:#34d399; --accent-dark:#0f3d2e;
|
||||
--danger:#f87171; --warn:#fbbf24;
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
html,body{margin:0;padding:0}
|
||||
body{background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif}
|
||||
.topbar{display:flex;align-items:center;gap:12px;padding:10px 16px;background:var(--panel);border-bottom:1px solid var(--border);position:sticky;top:0;z-index:20;flex-wrap:wrap}
|
||||
.topbar h1{font-size:18px;margin:0;letter-spacing:.3px}
|
||||
.topbar h1 span{color:var(--accent)}
|
||||
.topbar .sub{color:var(--muted);font-size:13px}
|
||||
.spacer{flex:1}
|
||||
.note{margin:0;padding:8px 16px;color:var(--muted);font-size:13px;background:var(--panel2);border-bottom:1px solid var(--border)}
|
||||
.note b{color:var(--text)}
|
||||
button{cursor:pointer;border:1px solid var(--border);background:var(--panel2);color:var(--text);border-radius:7px;padding:6px 11px;font-size:13px}
|
||||
button:hover{border-color:var(--accent)}
|
||||
button.primary{background:var(--accent);border-color:var(--accent);color:#06281c;font-weight:600}
|
||||
button.danger{border-color:#5b2323;color:var(--danger)}
|
||||
button.danger:hover{border-color:var(--danger)}
|
||||
button:disabled{opacity:.45;cursor:default}
|
||||
.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;padding:12px}
|
||||
@media (max-width:1500px){.grid{grid-template-columns:repeat(2,1fr)}}
|
||||
@media (max-width:820px){.grid{grid-template-columns:1fr}}
|
||||
.cell{background:var(--panel);border:1px solid var(--border);border-radius:10px;overflow:hidden;display:flex;flex-direction:column;min-height:430px}
|
||||
.cell.expanded{position:fixed;inset:0;z-index:60;border-radius:0;min-height:0}
|
||||
.cell-head{padding:9px 12px;border-bottom:1px solid var(--border)}
|
||||
.cell-title{display:flex;align-items:center;gap:8px;font-size:14px}
|
||||
.cell-title strong{font-weight:650}
|
||||
.badge{font-size:11px;font-weight:700;padding:2px 8px;border-radius:20px;letter-spacing:.3px}
|
||||
.badge.running{background:var(--accent-dark);color:var(--accent)}
|
||||
.badge.stopped{background:#3d1a1a;color:var(--danger)}
|
||||
.badge.master{background:#3b2f0b;color:var(--warn)}
|
||||
.cell.is-master{border-color:var(--warn)}
|
||||
button.sync-on{background:var(--accent);border-color:var(--accent);color:#06281c;font-weight:600}
|
||||
.identity{margin-top:4px;color:var(--muted);font-size:12px;word-break:break-word}
|
||||
.cell-view{position:relative;flex:1;min-height:330px;background:#000}
|
||||
.cell-view iframe{position:absolute;inset:0;width:100%;height:100%;border:0;display:block;background:#000}
|
||||
.overlay{position:absolute;inset:0;background:rgba(4,9,18,.93);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;color:var(--muted);font-size:14px;text-align:center;padding:16px}
|
||||
.overlay strong{color:var(--text);font-size:16px}
|
||||
.toolbar{display:flex;gap:6px;padding:8px 10px;border-top:1px solid var(--border);flex-wrap:wrap}
|
||||
.settings{display:none;padding:10px 12px;border-top:1px solid var(--border);background:var(--panel2)}
|
||||
.settings.open{display:block}
|
||||
.settings label{display:block;font-size:12px;color:var(--muted);margin:8px 0 3px}
|
||||
.settings input,.settings select{width:100%;padding:7px 9px;border-radius:7px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:13px}
|
||||
.settings .row{display:grid;grid-template-columns:1fr 1fr;gap:8px}
|
||||
.settings .actions{display:flex;gap:8px;margin-top:12px}
|
||||
.settings .msg{margin-top:8px;font-size:12px;color:var(--muted)}
|
||||
.settings .msg.err{color:var(--danger)}
|
||||
.banner{display:none;margin:10px 12px 0;padding:10px 12px;border:1px solid #5b2323;background:#2a1212;color:#fca5a5;border-radius:8px;font-size:13px}
|
||||
.banner.show{display:block}
|
||||
.login-overlay{position:fixed;inset:0;z-index:100;background:rgba(4,9,18,.97);display:flex;align-items:center;justify-content:center;padding:16px}
|
||||
.login-overlay.hidden{display:none}
|
||||
.login-card{width:100%;max-width:360px;background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:26px 24px}
|
||||
.login-card h2{margin:0 0 4px;font-size:20px}
|
||||
.login-card h2 span{color:var(--accent)}
|
||||
.login-card p{margin:0 0 16px;color:var(--muted);font-size:13px}
|
||||
.login-card label{display:block;font-size:12px;color:var(--muted);margin:0 0 4px}
|
||||
.login-card input{width:100%;padding:10px 12px;border-radius:7px;border:1px solid var(--border);background:var(--bg);color:var(--text);font-size:15px}
|
||||
.login-card button{width:100%;margin-top:14px;padding:10px;font-size:15px}
|
||||
.login-card .err{margin-top:10px;font-size:13px;color:var(--danger);min-height:18px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<h1>Browser <span>Farm</span></h1>
|
||||
<span class="sub">8 browser terisolasi · tiap browser identitas berbeda</span>
|
||||
<div class="spacer"></div>
|
||||
<button id="refreshBtn" type="button">Refresh</button>
|
||||
<button id="startAllBtn" type="button" class="primary">Start semua</button>
|
||||
<button id="stopAllBtn" type="button">Stop semua</button>
|
||||
<button id="syncBtn" type="button" title="Saat ON, kendalikan 1 browser dan semua browser lain ikut (klik, scroll, ketik).">Sinkron: OFF</button>
|
||||
</header>
|
||||
<p class="note"><b>Cara pakai:</b> login sekali dengan password farm — semua browser langsung terhubung otomatis. Tiap cell adalah browser Chromium sendiri (profil, cookie, dan IP terpisah). Settings mengubah User-Agent & proxy, lalu browser restart otomatis. <b>Sinkron:</b> nyalakan tombol di atas, lalu klik/ketik di satu browser — semua browser lain ikut melakukan hal yang sama. Browser yang terakhir kamu sentuh jadi Master (badge kuning).</p>
|
||||
<div class="banner" id="banner"></div>
|
||||
<main class="grid" id="grid"></main>
|
||||
|
||||
<div class="login-overlay hidden" id="loginOverlay">
|
||||
<form class="login-card" id="loginForm">
|
||||
<h2>Browser <span>Farm</span></h2>
|
||||
<p>Masukkan password farm untuk membuka grid.</p>
|
||||
<label for="loginPass">Password</label>
|
||||
<input id="loginPass" type="password" autocomplete="current-password" placeholder="Password farm">
|
||||
<button type="submit" class="primary">Masuk</button>
|
||||
<div class="err" id="loginErr"></div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var grid = document.getElementById('grid');
|
||||
var banner = document.getElementById('banner');
|
||||
var loginOverlay = document.getElementById('loginOverlay');
|
||||
var loginForm = document.getElementById('loginForm');
|
||||
var loginPass = document.getElementById('loginPass');
|
||||
var loginErr = document.getElementById('loginErr');
|
||||
var cells = {}; // id -> { el, iframe, overlay, badge, identity, settingsForm, prevStatus, iframeLoaded, tokenLoaded, masterBadge, inputEl, inputPoll }
|
||||
var presets = {}; // uaKey -> { label, ua }
|
||||
var busy = {};
|
||||
var gridStarted = false;
|
||||
var pollTimer = null;
|
||||
|
||||
// ---- Sync control: one master drives all browsers ----
|
||||
// Toggle state lives in localStorage only (per browser, not shared
|
||||
// across devices). Default OFF.
|
||||
var SYNC_KEY = 'farm_sync';
|
||||
var syncOn = false;
|
||||
try { syncOn = window.localStorage.getItem(SYNC_KEY) === 'on'; } catch (e) { syncOn = false; }
|
||||
var masterId = null; // id of the cell the user last interacted with
|
||||
var lastMoveMirror = 0;
|
||||
var MOVE_MIRROR_MIN_MS = 16; // throttle mousemove mirroring (~60fps)
|
||||
|
||||
function showBanner(msg) {
|
||||
banner.textContent = msg;
|
||||
banner.classList.add('show');
|
||||
}
|
||||
function hideBanner() {
|
||||
banner.classList.remove('show');
|
||||
}
|
||||
|
||||
function showLogin(msg) {
|
||||
if (msg) loginErr.textContent = msg;
|
||||
loginOverlay.classList.remove('hidden');
|
||||
setTimeout(function () { loginPass.focus(); }, 50);
|
||||
}
|
||||
function hideLogin() {
|
||||
loginOverlay.classList.add('hidden');
|
||||
loginErr.textContent = '';
|
||||
loginPass.value = '';
|
||||
}
|
||||
|
||||
// One farm login, then the grid starts. Called on page load and after
|
||||
// every successful login (e.g. after the session expired mid-use).
|
||||
function startGrid() {
|
||||
if (!gridStarted) {
|
||||
gridStarted = true;
|
||||
loadPresets().then(function () { return refresh(); });
|
||||
pollTimer = setInterval(refresh, 10000);
|
||||
} else {
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
function checkAuth() {
|
||||
fetch('/api/me')
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (j) {
|
||||
if (j && j.authenticated) {
|
||||
hideLogin();
|
||||
startGrid();
|
||||
} else {
|
||||
showLogin();
|
||||
}
|
||||
})
|
||||
.catch(function () { showLogin('Manager tidak bisa dihubungi.'); });
|
||||
}
|
||||
|
||||
loginForm.addEventListener('submit', function (ev) {
|
||||
ev.preventDefault();
|
||||
var pw = loginPass.value;
|
||||
if (!pw) return;
|
||||
loginErr.textContent = '';
|
||||
fetch('/api/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ password: pw }),
|
||||
})
|
||||
.then(function (r) {
|
||||
if (!r.ok) throw new Error('salah');
|
||||
return r.json();
|
||||
})
|
||||
.then(function (j) {
|
||||
if (!j.ok) throw new Error('salah');
|
||||
hideLogin();
|
||||
startGrid();
|
||||
})
|
||||
.catch(function () {
|
||||
loginErr.textContent = 'Password salah, coba lagi.';
|
||||
loginPass.select();
|
||||
});
|
||||
});
|
||||
|
||||
function iframeUrl(b) {
|
||||
// Same-origin path through the nginx /bN/ proxy (see install.sh):
|
||||
// the grid must script into the Neko iframes for Sync, which needs
|
||||
// same-origin. A relative path always matches the grid's origin
|
||||
// (IP or domain). The token mechanism is unchanged.
|
||||
var base = '/' + b.id + '/';
|
||||
// The manager hands us a fresh Neko session token per browser; the
|
||||
// Neko client auto-connects with ?token=... and never shows its
|
||||
// login form. Without a token we fall back to the plain URL (that
|
||||
// cell will show Neko's login form instead of a broken cell).
|
||||
if (b.token) return base + '?token=' + encodeURIComponent(b.token);
|
||||
return base;
|
||||
}
|
||||
|
||||
function identityLine(b) {
|
||||
var p = b.proxy || { type: 'direct' };
|
||||
var proxyText = 'Direct';
|
||||
if (p.type && p.type !== 'direct') {
|
||||
proxyText = (p.type === 'socks5' ? 'SOCKS5 ' : 'HTTP ') + (p.host || '') + ':' + (p.port || '');
|
||||
}
|
||||
return (b.uaLabel || b.uaKey || '-') + ' · ' + proxyText;
|
||||
}
|
||||
|
||||
function el(tag, cls, text) {
|
||||
var n = document.createElement(tag);
|
||||
if (cls) n.className = cls;
|
||||
if (text !== undefined && text !== null) n.textContent = text;
|
||||
return n;
|
||||
}
|
||||
|
||||
function buildCell(b) {
|
||||
var cell = el('section', 'cell');
|
||||
cell.id = 'cell-' + b.id;
|
||||
|
||||
var head = el('div', 'cell-head');
|
||||
var title = el('div', 'cell-title');
|
||||
title.appendChild(el('strong', null, b.name));
|
||||
var badge = el('span', 'badge stopped', 'Stopped');
|
||||
title.appendChild(badge);
|
||||
var masterBadge = el('span', 'badge master', 'Master');
|
||||
masterBadge.style.display = 'none';
|
||||
title.appendChild(masterBadge);
|
||||
head.appendChild(title);
|
||||
var identity = el('div', 'identity', identityLine(b));
|
||||
head.appendChild(identity);
|
||||
cell.appendChild(head);
|
||||
|
||||
var view = el('div', 'cell-view');
|
||||
var frame = document.createElement('iframe');
|
||||
frame.setAttribute('title', b.name);
|
||||
frame.setAttribute('allow', 'autoplay; clipboard-read; clipboard-write; fullscreen');
|
||||
frame.addEventListener('load', function () { pollForInput(b.id); });
|
||||
view.appendChild(frame);
|
||||
var overlay = el('div', 'overlay');
|
||||
overlay.appendChild(el('strong', null, 'Browser berhenti'));
|
||||
overlay.appendChild(el('span', null, 'Klik Start untuk menyalakan browser ini.'));
|
||||
var ovStart = el('button', 'primary', 'Start');
|
||||
ovStart.type = 'button';
|
||||
ovStart.addEventListener('click', function () { doAction(b.id, 'start'); });
|
||||
overlay.appendChild(ovStart);
|
||||
view.appendChild(overlay);
|
||||
cell.appendChild(view);
|
||||
|
||||
var toolbar = el('div', 'toolbar');
|
||||
var acts = [
|
||||
['start', 'Start', ''],
|
||||
['stop', 'Stop', ''],
|
||||
['restart', 'Restart', ''],
|
||||
['wipe', 'Wipe', 'danger'],
|
||||
['fullscreen', 'Fullscreen', ''],
|
||||
['settings', 'Settings', ''],
|
||||
];
|
||||
acts.forEach(function (a) {
|
||||
var btn = el('button', a[2], a[1]);
|
||||
btn.type = 'button';
|
||||
btn.dataset.act = a[0];
|
||||
btn.addEventListener('click', function () { onToolbar(b.id, a[0]); });
|
||||
toolbar.appendChild(btn);
|
||||
});
|
||||
cell.appendChild(toolbar);
|
||||
|
||||
var form = document.createElement('form');
|
||||
form.className = 'settings';
|
||||
form.addEventListener('submit', function (ev) {
|
||||
ev.preventDefault();
|
||||
saveSettings(b.id);
|
||||
});
|
||||
form.innerHTML =
|
||||
'<label>User-Agent</label>' +
|
||||
'<select name="ua"></select>' +
|
||||
'<label>Proxy</label>' +
|
||||
'<select name="proxyType">' +
|
||||
'<option value="direct">Direct (tanpa proxy)</option>' +
|
||||
'<option value="http">HTTP</option>' +
|
||||
'<option value="socks5">SOCKS5</option>' +
|
||||
'</select>' +
|
||||
'<div class="row">' +
|
||||
'<div><label>Host proxy</label><input name="host" type="text" placeholder="1.2.3.4" autocomplete="off"></div>' +
|
||||
'<div><label>Port proxy</label><input name="port" type="number" min="1" max="65535" placeholder="8080"></div>' +
|
||||
'</div>' +
|
||||
'<div class="row">' +
|
||||
'<div><label>Username (opsional)</label><input name="user" type="text" autocomplete="off"></div>' +
|
||||
'<div><label>Password (opsional)</label><input name="pass" type="password" autocomplete="off"></div>' +
|
||||
'</div>' +
|
||||
'<div class="actions">' +
|
||||
'<button type="submit" class="primary">Simpan & Restart</button>' +
|
||||
'<button type="button" class="cancelBtn">Batal</button>' +
|
||||
'</div>' +
|
||||
'<div class="msg"></div>';
|
||||
form.querySelector('.cancelBtn').addEventListener('click', function () {
|
||||
form.classList.remove('open');
|
||||
});
|
||||
cell.appendChild(form);
|
||||
|
||||
grid.appendChild(cell);
|
||||
cells[b.id] = {
|
||||
el: cell, iframe: frame, overlay: overlay, badge: badge,
|
||||
identity: identity, form: form, prevStatus: null, iframeLoaded: false,
|
||||
tokenLoaded: false, masterBadge: masterBadge, inputEl: null, inputPoll: null,
|
||||
};
|
||||
}
|
||||
|
||||
// ---- Sync control: find + watch the Neko input element ----
|
||||
// The Neko Overlay (client/core/src/overlay.ts) is a wrap div holding
|
||||
// a <canvas> (cursor layer) and a transparent <textarea> (the input
|
||||
// layer). Every mouse/wheel/keyboard listener lives on that textarea.
|
||||
// We find it by structure — a textarea whose parent also holds a
|
||||
// canvas — not by class name: the Overlay sets no class names.
|
||||
function findNekoInput(doc) {
|
||||
try {
|
||||
if (!doc) return null;
|
||||
var tas = doc.querySelectorAll('textarea');
|
||||
for (var i = 0; i < tas.length; i++) {
|
||||
var p = tas[i].parentElement;
|
||||
if (p && p.querySelector('canvas')) return tas[i];
|
||||
}
|
||||
return null;
|
||||
} catch (e) {
|
||||
return null; // cross-origin or not ready yet
|
||||
}
|
||||
}
|
||||
|
||||
// Poll for the Neko input element after an iframe (re)loads. The Neko
|
||||
// client renders its overlay asynchronously, so we wait up to ~10s.
|
||||
// A cell whose input never appears is simply left unmirrored.
|
||||
function pollForInput(id) {
|
||||
var c = cells[id];
|
||||
if (!c) return;
|
||||
if (c.inputPoll) { clearInterval(c.inputPoll); c.inputPoll = null; }
|
||||
c.inputEl = null;
|
||||
var tries = 0;
|
||||
c.inputPoll = setInterval(function () {
|
||||
tries++;
|
||||
var input = null;
|
||||
try {
|
||||
if (c.iframe && c.iframe.contentDocument) input = findNekoInput(c.iframe.contentDocument);
|
||||
} catch (e) { input = null; }
|
||||
if (input) {
|
||||
clearInterval(c.inputPoll); c.inputPoll = null;
|
||||
attachSyncListeners(id, input);
|
||||
return;
|
||||
}
|
||||
if (tries >= 20) { clearInterval(c.inputPoll); c.inputPoll = null; }
|
||||
}, 500);
|
||||
}
|
||||
|
||||
// Attach the Sync capture listeners to one cell's Neko input element.
|
||||
// Listeners go on the textarea itself (same target as the Overlay's
|
||||
// own listeners): the Overlay calls stopPropagation(), which blocks
|
||||
// ancestors but never other listeners on the same element.
|
||||
function attachSyncListeners(id, input) {
|
||||
var c = cells[id];
|
||||
if (!c || c.inputEl === input) return;
|
||||
c.inputEl = input;
|
||||
var win = input.ownerDocument.defaultView;
|
||||
|
||||
function handler(e) { onCellInput(id, e); }
|
||||
|
||||
// Mouse + wheel + keyboard: exactly the events the Overlay listens
|
||||
// to. (The Overlay uses mouse events, not pointer events, so we
|
||||
// mirror mouse events — a PointerEvent would be ignored by it.)
|
||||
['mousemove', 'mousedown', 'wheel', 'keydown', 'keyup'].forEach(function (type) {
|
||||
input.addEventListener(type, handler, false);
|
||||
});
|
||||
// mouseup can happen outside the textarea (the Overlay itself
|
||||
// listens on window, capture). Catch every mouseup via the iframe
|
||||
// window so a press that started on the video is always released.
|
||||
// (Only window, not the textarea too — otherwise one release would
|
||||
// mirror twice.)
|
||||
if (win) win.addEventListener('mouseup', handler, true);
|
||||
}
|
||||
|
||||
function setMaster(id) {
|
||||
if (masterId === id) return;
|
||||
masterId = id;
|
||||
Object.keys(cells).forEach(function (k) {
|
||||
var c = cells[k];
|
||||
if (c.masterBadge) c.masterBadge.style.display = (k === id) ? '' : 'none';
|
||||
if (c.el) c.el.classList.toggle('is-master', k === id);
|
||||
});
|
||||
}
|
||||
|
||||
function clearMaster() {
|
||||
masterId = null;
|
||||
Object.keys(cells).forEach(function (k) {
|
||||
var c = cells[k];
|
||||
if (c.masterBadge) c.masterBadge.style.display = 'none';
|
||||
if (c.el) c.el.classList.remove('is-master');
|
||||
});
|
||||
}
|
||||
|
||||
// One real user interaction on a cell makes it the master and mirrors
|
||||
// that input to every other cell.
|
||||
function onCellInput(id, e) {
|
||||
if (!syncOn) return;
|
||||
// Only real user input drives Sync. Synthetic events dispatched into
|
||||
// followers have isTrusted=false — ignoring them prevents feedback
|
||||
// loops and stops a follower from becoming the master. (Neither the
|
||||
// Neko Overlay nor its Guacamole keyboard checks isTrusted, so the
|
||||
// synthetic events still reach the remote desktop.)
|
||||
if (!e.isTrusted) return;
|
||||
setMaster(id);
|
||||
mirrorInput(id, e);
|
||||
}
|
||||
|
||||
function mirrorInput(masterId, e) {
|
||||
var master = cells[masterId];
|
||||
if (!master || !master.inputEl) return;
|
||||
var type = e.type;
|
||||
if (type !== 'mousemove' && type !== 'mousedown' && type !== 'mouseup' &&
|
||||
type !== 'wheel' && type !== 'keydown' && type !== 'keyup') return;
|
||||
|
||||
// Throttle mousemove mirroring (~60fps) so a fast drag does not
|
||||
// flood the followers with synthetic events. Clicks, wheel and keys
|
||||
// are never throttled.
|
||||
if (type === 'mousemove') {
|
||||
var now = Date.now();
|
||||
if (now - lastMoveMirror < MOVE_MIRROR_MIN_MS) return;
|
||||
lastMoveMirror = now;
|
||||
}
|
||||
|
||||
// Relative position inside the master's input area. The Overlay maps
|
||||
// clientX/clientY against its canvas rect, which equals the textarea
|
||||
// rect (both fill the same box), so fractions of the textarea map
|
||||
// exactly onto each follower's remote screen — even if cells render
|
||||
// at slightly different sizes.
|
||||
var r;
|
||||
try { r = master.inputEl.getBoundingClientRect(); } catch (err) { return; }
|
||||
var fx = r.width ? (e.clientX - r.left) / r.width : 0;
|
||||
var fy = r.height ? (e.clientY - r.top) / r.height : 0;
|
||||
fx = Math.max(0, Math.min(1, fx));
|
||||
fy = Math.max(0, Math.min(1, fy));
|
||||
|
||||
Object.keys(cells).forEach(function (fid) {
|
||||
if (fid === masterId) return;
|
||||
var f = cells[fid];
|
||||
if (!f || !f.inputEl) return;
|
||||
if (!f._browser || f._browser.status !== 'running') return;
|
||||
try {
|
||||
var fwin = f.inputEl.ownerDocument.defaultView;
|
||||
if (!fwin) return;
|
||||
var fr = f.inputEl.getBoundingClientRect();
|
||||
var cx = fr.left + fx * fr.width;
|
||||
var cy = fr.top + fy * fr.height;
|
||||
var mods = {
|
||||
ctrlKey: !!e.ctrlKey, shiftKey: !!e.shiftKey,
|
||||
altKey: !!e.altKey, metaKey: !!e.metaKey,
|
||||
};
|
||||
var ev = null;
|
||||
if (type === 'wheel') {
|
||||
ev = new fwin.WheelEvent('wheel', {
|
||||
bubbles: true, cancelable: true,
|
||||
clientX: cx, clientY: cy,
|
||||
deltaX: e.deltaX || 0, deltaY: e.deltaY || 0, deltaMode: e.deltaMode || 0,
|
||||
ctrlKey: mods.ctrlKey, shiftKey: mods.shiftKey,
|
||||
altKey: mods.altKey, metaKey: mods.metaKey,
|
||||
});
|
||||
} else if (type === 'keydown' || type === 'keyup') {
|
||||
ev = new fwin.KeyboardEvent(type, {
|
||||
bubbles: true, cancelable: true,
|
||||
key: e.key, code: e.code, location: e.location || 0,
|
||||
ctrlKey: mods.ctrlKey, shiftKey: mods.shiftKey,
|
||||
altKey: mods.altKey, metaKey: mods.metaKey,
|
||||
repeat: !!e.repeat,
|
||||
});
|
||||
// The Neko Guacamole keyboard resolves keys from keyCode/which
|
||||
// (and from key). The KeyboardEvent constructor cannot set
|
||||
// keyCode/which, so shadow them so the follower maps the
|
||||
// same key.
|
||||
try {
|
||||
Object.defineProperty(ev, 'keyCode', { value: e.keyCode || 0 });
|
||||
Object.defineProperty(ev, 'which', { value: e.which || e.keyCode || 0 });
|
||||
} catch (err) { /* ignore */ }
|
||||
} else {
|
||||
// mousemove / mousedown / mouseup
|
||||
ev = new fwin.MouseEvent(type, {
|
||||
bubbles: true, cancelable: true,
|
||||
clientX: cx, clientY: cy,
|
||||
button: (typeof e.button === 'number') ? e.button : 0,
|
||||
buttons: (typeof e.buttons === 'number') ? e.buttons : 0,
|
||||
ctrlKey: mods.ctrlKey, shiftKey: mods.shiftKey,
|
||||
altKey: mods.altKey, metaKey: mods.metaKey,
|
||||
});
|
||||
}
|
||||
if (ev) f.inputEl.dispatchEvent(ev);
|
||||
} catch (err) {
|
||||
// A follower that is not ready must never break the grid.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Sync toggle: on/off, remembered in localStorage (per browser).
|
||||
var syncBtn = document.getElementById('syncBtn');
|
||||
function renderSyncBtn() {
|
||||
syncBtn.textContent = syncOn ? 'Sinkron: ON' : 'Sinkron: OFF';
|
||||
syncBtn.classList.toggle('sync-on', syncOn);
|
||||
}
|
||||
function setSync(on) {
|
||||
syncOn = !!on;
|
||||
try { window.localStorage.setItem(SYNC_KEY, syncOn ? 'on' : 'off'); } catch (e) {}
|
||||
renderSyncBtn();
|
||||
if (!syncOn) clearMaster();
|
||||
}
|
||||
syncBtn.addEventListener('click', function () { setSync(!syncOn); });
|
||||
renderSyncBtn();
|
||||
|
||||
function fillUaOptions() {
|
||||
Object.keys(cells).forEach(function (id) {
|
||||
var sel = cells[id].form.querySelector('select[name="ua"]');
|
||||
sel.innerHTML = '';
|
||||
Object.keys(presets).forEach(function (key) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = key;
|
||||
opt.textContent = presets[key].label || key;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function openSettings(id, b) {
|
||||
var c = cells[id];
|
||||
var sel = c.form.querySelector('select[name="ua"]');
|
||||
sel.value = b.uaKey || '';
|
||||
var p = b.proxy || { type: 'direct' };
|
||||
c.form.querySelector('select[name="proxyType"]').value = p.type || 'direct';
|
||||
c.form.querySelector('input[name="host"]').value = p.host || '';
|
||||
c.form.querySelector('input[name="port"]').value = p.port || '';
|
||||
c.form.querySelector('input[name="user"]').value = p.user || '';
|
||||
c.form.querySelector('input[name="pass"]').value = p.pass || '';
|
||||
c.form.querySelector('.msg').textContent = '';
|
||||
c.form.classList.add('open');
|
||||
}
|
||||
|
||||
function setMsg(id, text, isErr) {
|
||||
var m = cells[id].form.querySelector('.msg');
|
||||
m.textContent = text;
|
||||
m.classList.toggle('err', !!isErr);
|
||||
}
|
||||
|
||||
function onToolbar(id, act) {
|
||||
if (act === 'fullscreen') {
|
||||
var c = cells[id];
|
||||
var willExpand = !c.el.classList.contains('expanded');
|
||||
Object.keys(cells).forEach(function (k) { cells[k].el.classList.remove('expanded'); });
|
||||
if (willExpand) c.el.classList.add('expanded');
|
||||
return;
|
||||
}
|
||||
if (act === 'settings') {
|
||||
var b = cells[id]._browser;
|
||||
if (b) openSettings(id, b);
|
||||
return;
|
||||
}
|
||||
if (act === 'wipe') {
|
||||
var name = (cells[id]._browser && cells[id]._browser.name) || id;
|
||||
if (!window.confirm('Hapus semua data ' + name + ' (cookies, history, login)?\nHanya browser ini yang dihapus, browser lain tidak disentuh.')) return;
|
||||
}
|
||||
doAction(id, act);
|
||||
}
|
||||
|
||||
function doAction(id, action) {
|
||||
if (busy[id]) return;
|
||||
busy[id] = true;
|
||||
fetch('/api/browsers/' + encodeURIComponent(id) + '/' + encodeURIComponent(action), { method: 'POST' })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (j) {
|
||||
busy[id] = false;
|
||||
if (!j.ok) throw new Error(j.error || 'gagal');
|
||||
return refresh();
|
||||
})
|
||||
.catch(function (e) {
|
||||
busy[id] = false;
|
||||
showBanner('Gagal ' + action + ' ' + id + ': ' + e.message);
|
||||
});
|
||||
}
|
||||
|
||||
function saveSettings(id) {
|
||||
var c = cells[id];
|
||||
var f = c.form;
|
||||
var proxyType = f.querySelector('select[name="proxyType"]').value;
|
||||
var proxy = { type: proxyType };
|
||||
if (proxyType !== 'direct') {
|
||||
proxy.host = f.querySelector('input[name="host"]').value.trim();
|
||||
proxy.port = Number(f.querySelector('input[name="port"]').value);
|
||||
proxy.user = f.querySelector('input[name="user"]').value;
|
||||
proxy.pass = f.querySelector('input[name="pass"]').value;
|
||||
}
|
||||
var body = {
|
||||
ua: f.querySelector('select[name="ua"]').value,
|
||||
proxy: proxy,
|
||||
};
|
||||
setMsg(id, 'Menyimpan & restart browser...', false);
|
||||
fetch('/api/browsers/' + encodeURIComponent(id) + '/config', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
})
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (j) {
|
||||
if (!j.ok) throw new Error(j.error || 'gagal menyimpan');
|
||||
setMsg(id, 'Tersimpan. Identitas baru: ' + (j.uaLabel || '') + ' · ' + ((j.proxy && j.proxy.type) || ''), false);
|
||||
return refresh();
|
||||
})
|
||||
.catch(function (e) {
|
||||
setMsg(id, 'Gagal: ' + e.message, true);
|
||||
});
|
||||
}
|
||||
|
||||
function updateCell(b) {
|
||||
var c = cells[b.id];
|
||||
if (!c) return;
|
||||
c._browser = b;
|
||||
var running = b.status === 'running';
|
||||
c.badge.textContent = running ? 'Running' : 'Stopped';
|
||||
c.badge.className = 'badge ' + (running ? 'running' : 'stopped');
|
||||
c.identity.textContent = identityLine(b);
|
||||
c.overlay.style.display = running ? 'none' : 'flex';
|
||||
if (running) {
|
||||
if (!c.iframeLoaded || c.prevStatus === 'stopped') {
|
||||
// First load, or the browser came back after a stop/restart:
|
||||
// (re)set the src, with the fresh token when we have one.
|
||||
c.iframe.src = iframeUrl(b);
|
||||
c.iframeLoaded = true;
|
||||
c.tokenLoaded = !!b.token;
|
||||
c.inputEl = null; // new page — the old textarea is gone; the iframe load handler re-polls for the new one
|
||||
} else if (!c.tokenLoaded && b.token) {
|
||||
// The token arrived after the iframe was first loaded (Neko was
|
||||
// still starting). Upgrade the src once so the cell auto-connects.
|
||||
// Normal polls never touch src, so a token refresh never kicks
|
||||
// the user out of a running browser.
|
||||
c.iframe.src = iframeUrl(b);
|
||||
c.tokenLoaded = true;
|
||||
c.inputEl = null;
|
||||
}
|
||||
}
|
||||
c.prevStatus = b.status;
|
||||
}
|
||||
|
||||
function refresh() {
|
||||
return fetch('/api/browsers')
|
||||
.then(function (r) {
|
||||
if (r.status === 401) {
|
||||
// Session expired — ask for the farm password again.
|
||||
showLogin('Sesi habis, login lagi.');
|
||||
throw new Error('unauthorized');
|
||||
}
|
||||
return r.json();
|
||||
})
|
||||
.then(function (j) {
|
||||
hideBanner();
|
||||
var list = j.browsers || [];
|
||||
list.forEach(function (b) {
|
||||
if (!cells[b.id]) buildCell(b);
|
||||
updateCell(b);
|
||||
});
|
||||
})
|
||||
.catch(function (e) {
|
||||
if (e.message !== 'unauthorized') {
|
||||
showBanner('Manager tidak bisa dihubungi: ' + e.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function loadPresets() {
|
||||
return fetch('/api/ua-presets')
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (j) {
|
||||
presets = j.presets || {};
|
||||
fillUaOptions();
|
||||
})
|
||||
.catch(function () { /* presets stay empty; settings still works with server validation */ });
|
||||
}
|
||||
|
||||
document.getElementById('refreshBtn').addEventListener('click', function () { refresh(); });
|
||||
document.getElementById('startAllBtn').addEventListener('click', function () {
|
||||
fetch('/api/browsers/start-all', { method: 'POST' })
|
||||
.then(function () { return refresh(); })
|
||||
.catch(function (e) { showBanner('Gagal start semua: ' + e.message); });
|
||||
});
|
||||
document.getElementById('stopAllBtn').addEventListener('click', function () {
|
||||
fetch('/api/browsers/stop-all', { method: 'POST' })
|
||||
.then(function () { return refresh(); })
|
||||
.catch(function (e) { showBanner('Gagal stop semua: ' + e.message); });
|
||||
});
|
||||
document.addEventListener('keydown', function (e) {
|
||||
if (e.key === 'Escape') {
|
||||
Object.keys(cells).forEach(function (k) { cells[k].el.classList.remove('expanded'); });
|
||||
}
|
||||
});
|
||||
|
||||
checkAuth();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,401 @@
|
||||
// Browser Farm manager — serves the grid UI and controls 8 isolated Neko
|
||||
// browsers (farm-b1..farm-b8) via docker. Listens on 127.0.0.1:18080;
|
||||
// nginx proxies port 80 to it. No database: per-browser runtime state lives
|
||||
// in /opt/farm/<id>/meta.json, static identity in manager/config.json.
|
||||
// Security: browser ids are validated strictly (^b[1-8]$) and every docker
|
||||
// call uses execFile with an argument array — no user input ever reaches a
|
||||
// shell. One password (FARM_PASSWORD) gates the whole grid (httpOnly
|
||||
// farm_auth cookie, 7 days); the manager logs in to each Neko instance
|
||||
// itself and hands the grid a ?token= URL per cell, so the user never sees
|
||||
// a per-cell Neko login form.
|
||||
'use strict';
|
||||
|
||||
const express = require('express');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
const { execFile } = require('child_process');
|
||||
const { promisify } = require('util');
|
||||
|
||||
const execFileAsync = promisify(execFile);
|
||||
const app = express();
|
||||
|
||||
const PORT = Number(process.env.PORT || 18080);
|
||||
const HOST = process.env.HOST || '127.0.0.1';
|
||||
const FARM_ROOT = process.env.FARM_ROOT || '/opt/farm';
|
||||
const CONFIG_PATH = path.join(__dirname, 'config.json');
|
||||
const GENERATE_SCRIPT = path.join(__dirname, '..', 'scripts', 'generate.js');
|
||||
// Single password for the whole farm: the grid login AND every Neko
|
||||
// instance's password. Must match FARM_PASSWORD in scripts/install.sh.
|
||||
const FARM_PASSWORD = process.env.FARM_PASSWORD || 'FarmBrowser2026';
|
||||
const NEKO_LOGIN_USER = 'pend';
|
||||
const TOKEN_TTL_MS = 55 * 60 * 1000; // Neko tokens are re-fetched every 55 min
|
||||
const SESSION_TTL_MS = 7 * 24 * 60 * 60 * 1000; // farm login lasts 7 days
|
||||
|
||||
// In-memory farm sessions: sessionId -> expiresAt (ms). No DB.
|
||||
const sessions = new Map();
|
||||
// In-memory Neko tokens: browserId -> { token, expiresAt, startedAt }.
|
||||
const tokenCache = new Map();
|
||||
|
||||
app.use(express.json({ limit: '64kb' }));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
function parseCookies(req) {
|
||||
const out = {};
|
||||
const header = req.headers && req.headers.cookie;
|
||||
if (!header) return out;
|
||||
header.split(';').forEach(function (part) {
|
||||
const idx = part.indexOf('=');
|
||||
if (idx > 0) {
|
||||
try {
|
||||
out[part.slice(0, idx).trim()] = decodeURIComponent(part.slice(idx + 1).trim());
|
||||
} catch (e) {
|
||||
out[part.slice(0, idx).trim()] = part.slice(idx + 1).trim();
|
||||
}
|
||||
}
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
function isAuthenticated(req) {
|
||||
const sid = parseCookies(req).farm_auth;
|
||||
if (!sid) return false;
|
||||
const exp = sessions.get(sid);
|
||||
if (!exp) return false;
|
||||
if (exp < Date.now()) {
|
||||
sessions.delete(sid);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Grid-level password gate for /api/*. Public: POST /api/login, GET /api/me.
|
||||
// GET /health is not under /api, so it is never gated. The grid page itself
|
||||
// (/) is served without auth; it calls /api/me and shows a login overlay
|
||||
// when the session is missing or expired.
|
||||
function requireFarmAuth(req, res, next) {
|
||||
if (req.method === 'POST' && req.path === '/login') return next();
|
||||
if (req.method === 'GET' && req.path === '/me') return next();
|
||||
if (isAuthenticated(req)) return next();
|
||||
return res.status(401).json({ ok: false, error: 'unauthorized' });
|
||||
}
|
||||
|
||||
app.use('/api', requireFarmAuth);
|
||||
|
||||
function loadConfig() {
|
||||
return JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
||||
}
|
||||
|
||||
// Merge config defaults with the runtime meta.json (if it exists).
|
||||
function loadBrowser(id) {
|
||||
const cfg = loadConfig();
|
||||
const base = (cfg.browsers || []).find((b) => b.id === id);
|
||||
if (!base) return null;
|
||||
let meta = {};
|
||||
try {
|
||||
meta = JSON.parse(fs.readFileSync(path.join(FARM_ROOT, id, 'meta.json'), 'utf8'));
|
||||
} catch (e) {
|
||||
// No meta yet (fresh install) — fall back to config defaults.
|
||||
}
|
||||
const uaKey = meta.uaKey || base.uaKey;
|
||||
const preset = (cfg.uaPresets || {})[uaKey] || (cfg.uaPresets || {})[base.uaKey] || {};
|
||||
return {
|
||||
id: base.id,
|
||||
name: meta.name || base.name,
|
||||
uaKey: uaKey,
|
||||
uaLabel: preset.label || uaKey,
|
||||
proxy: meta.proxy || { type: 'direct' },
|
||||
httpPort: base.httpPort,
|
||||
udpStart: base.udpStart,
|
||||
udpEnd: base.udpEnd,
|
||||
};
|
||||
}
|
||||
|
||||
function validateId(id) {
|
||||
return /^b[1-8]$/.test(id || '');
|
||||
}
|
||||
|
||||
async function dockerStatus(id) {
|
||||
const name = 'farm-' + id;
|
||||
try {
|
||||
const { stdout } = await execFileAsync('docker', [
|
||||
'inspect',
|
||||
'-f',
|
||||
'{{.State.Status}}|{{.State.StartedAt}}',
|
||||
name,
|
||||
]);
|
||||
const parts = stdout.trim().split('|');
|
||||
const status = parts[0] || 'stopped';
|
||||
let uptime = null;
|
||||
if (status === 'running' && parts[1]) {
|
||||
const started = new Date(parts[1]).getTime();
|
||||
if (!Number.isNaN(started)) {
|
||||
uptime = Math.max(0, Math.floor((Date.now() - started) / 1000));
|
||||
}
|
||||
}
|
||||
return { status: status, uptime: uptime, startedAt: parts[1] || null };
|
||||
} catch (e) {
|
||||
// Container missing, or docker unavailable — treat as stopped.
|
||||
return { status: 'stopped', uptime: null, startedAt: null };
|
||||
}
|
||||
}
|
||||
|
||||
// Log in to one Neko instance and return its session token (or null).
|
||||
// The Neko web client accepts ?token=... in the iframe URL and then
|
||||
// auto-connects, so the user never sees a per-cell login form.
|
||||
async function fetchNekoToken(httpPort) {
|
||||
try {
|
||||
const res = await fetch('http://127.0.0.1:' + httpPort + '/api/login', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ username: NEKO_LOGIN_USER, password: FARM_PASSWORD }),
|
||||
signal: AbortSignal.timeout(5000),
|
||||
});
|
||||
if (!res.ok) return null;
|
||||
const j = await res.json();
|
||||
return j && typeof j.token === 'string' && j.token ? j.token : null;
|
||||
} catch (e) {
|
||||
console.error(
|
||||
'neko login failed (port ' + httpPort + '): ' + (e && e.message ? e.message : e)
|
||||
);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Cached Neko token for one browser. Re-fetched when missing, expired, or
|
||||
// when the container restarted (startedAt changed — a restart invalidates
|
||||
// the old token). Returns null when Neko is not reachable yet.
|
||||
async function getBrowserToken(id, httpPort, startedAt) {
|
||||
const now = Date.now();
|
||||
const cached = tokenCache.get(id);
|
||||
if (
|
||||
cached &&
|
||||
cached.token &&
|
||||
cached.expiresAt > now &&
|
||||
cached.startedAt === startedAt
|
||||
) {
|
||||
return cached.token;
|
||||
}
|
||||
const token = await fetchNekoToken(httpPort);
|
||||
if (token) {
|
||||
tokenCache.set(id, { token: token, expiresAt: now + TOKEN_TTL_MS, startedAt: startedAt });
|
||||
} else {
|
||||
tokenCache.delete(id);
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
async function dockerAction(action, id) {
|
||||
await execFileAsync('docker', [action, 'farm-' + id]);
|
||||
}
|
||||
|
||||
function validateProxy(p) {
|
||||
const proxy = p || { type: 'direct' };
|
||||
if (!['direct', 'http', 'socks5'].includes(proxy.type)) {
|
||||
return { error: 'invalid proxy type (want direct|http|socks5)' };
|
||||
}
|
||||
if (proxy.type === 'direct') return { proxy: { type: 'direct' } };
|
||||
const host = typeof proxy.host === 'string' ? proxy.host.trim() : '';
|
||||
const port = Number(proxy.port);
|
||||
if (!host) return { error: 'proxy host required' };
|
||||
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
||||
return { error: 'proxy port invalid (want 1-65535)' };
|
||||
}
|
||||
return {
|
||||
proxy: {
|
||||
type: proxy.type,
|
||||
host: host,
|
||||
port: port,
|
||||
user: typeof proxy.user === 'string' ? proxy.user : '',
|
||||
pass: typeof proxy.pass === 'string' ? proxy.pass : '',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
app.get('/health', (req, res) => {
|
||||
res.json({ ok: true });
|
||||
});
|
||||
|
||||
// Single grid-level login. On success sets an httpOnly farm_auth cookie
|
||||
// (7 days). One password for the whole farm — no per-cell login.
|
||||
app.post('/api/login', (req, res) => {
|
||||
const pw = req.body && typeof req.body.password === 'string' ? req.body.password : '';
|
||||
const expected = Buffer.from(FARM_PASSWORD, 'utf8');
|
||||
const given = Buffer.from(pw, 'utf8');
|
||||
const ok = given.length === expected.length && crypto.timingSafeEqual(given, expected);
|
||||
if (!ok) {
|
||||
return res.status(401).json({ ok: false, error: 'password salah' });
|
||||
}
|
||||
const sid = crypto.randomBytes(32).toString('hex');
|
||||
sessions.set(sid, Date.now() + SESSION_TTL_MS);
|
||||
res.setHeader(
|
||||
'Set-Cookie',
|
||||
'farm_auth=' + sid + '; HttpOnly; Path=/; Max-Age=' + Math.floor(SESSION_TTL_MS / 1000) + '; SameSite=Lax'
|
||||
);
|
||||
res.json({ ok: true });
|
||||
});
|
||||
|
||||
app.get('/api/me', (req, res) => {
|
||||
res.json({ authenticated: isAuthenticated(req) });
|
||||
});
|
||||
|
||||
// UA preset list, used by the Settings dropdown in the grid UI.
|
||||
app.get('/api/ua-presets', (req, res) => {
|
||||
try {
|
||||
const cfg = loadConfig();
|
||||
res.json({ presets: cfg.uaPresets || {} });
|
||||
} catch (e) {
|
||||
res.status(500).json({ ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
});
|
||||
|
||||
app.get('/api/browsers', async (req, res) => {
|
||||
try {
|
||||
const cfg = loadConfig();
|
||||
const list = await Promise.all(
|
||||
(cfg.browsers || []).map(async (b) => {
|
||||
const info = loadBrowser(b.id);
|
||||
const st = await dockerStatus(b.id);
|
||||
// Token is only fetched when the cache is stale (missing, expired,
|
||||
// or the container restarted) — never on every 10s poll.
|
||||
let token = null;
|
||||
if (st.status === 'running') {
|
||||
token = await getBrowserToken(b.id, info.httpPort, st.startedAt);
|
||||
}
|
||||
return Object.assign({}, info, { status: st.status, uptime: st.uptime, token: token });
|
||||
})
|
||||
);
|
||||
res.json({ browsers: list });
|
||||
} catch (e) {
|
||||
res.status(500).json({ ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
});
|
||||
|
||||
// Start all / stop all (defined before the :id routes).
|
||||
app.post('/api/browsers/start-all', async (req, res) => {
|
||||
const cfg = loadConfig();
|
||||
const results = [];
|
||||
for (const b of cfg.browsers || []) {
|
||||
try {
|
||||
await dockerAction('start', b.id);
|
||||
results.push({ id: b.id, ok: true });
|
||||
} catch (e) {
|
||||
results.push({ id: b.id, ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
}
|
||||
res.json({ ok: true, results: results });
|
||||
});
|
||||
|
||||
app.post('/api/browsers/stop-all', async (req, res) => {
|
||||
const cfg = loadConfig();
|
||||
const results = [];
|
||||
for (const b of cfg.browsers || []) {
|
||||
try {
|
||||
await dockerAction('stop', b.id);
|
||||
results.push({ id: b.id, ok: true });
|
||||
} catch (e) {
|
||||
results.push({ id: b.id, ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
}
|
||||
res.json({ ok: true, results: results });
|
||||
});
|
||||
|
||||
// Wipe one browser's profile (cookies, history, logins). Scope is exactly
|
||||
// that browser's bind-mounted profile dir — nothing else is touched.
|
||||
app.post('/api/browsers/:id/wipe', async (req, res) => {
|
||||
const id = req.params.id;
|
||||
if (!validateId(id)) {
|
||||
return res.status(400).json({ ok: false, error: 'invalid browser id' });
|
||||
}
|
||||
const profileDir = path.resolve(path.join(FARM_ROOT, id, 'profile'));
|
||||
const root = path.resolve(FARM_ROOT) + path.sep;
|
||||
if (!profileDir.startsWith(root)) {
|
||||
return res.status(400).json({ ok: false, error: 'invalid profile path' });
|
||||
}
|
||||
try {
|
||||
try {
|
||||
await dockerAction('stop', id);
|
||||
} catch (e) {
|
||||
// Already stopped or missing — wiping the profile is still safe.
|
||||
}
|
||||
await execFileAsync('rm', ['-rf', profileDir]);
|
||||
await execFileAsync('mkdir', ['-p', profileDir]);
|
||||
await dockerAction('start', id);
|
||||
const st = await dockerStatus(id);
|
||||
res.json({
|
||||
ok: true,
|
||||
id: id,
|
||||
wiped: 'profile of farm-' + id + ' only',
|
||||
scope:
|
||||
'Only this browser (farm-' + id + ') profile was deleted. ' +
|
||||
'Other browsers were not touched.',
|
||||
status: st.status,
|
||||
});
|
||||
} catch (e) {
|
||||
res.status(500).json({ ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
});
|
||||
|
||||
// Change one browser's identity (UA preset + proxy), then restart it so the
|
||||
// new Chromium flags take effect.
|
||||
app.post('/api/browsers/:id/config', async (req, res) => {
|
||||
const id = req.params.id;
|
||||
if (!validateId(id)) {
|
||||
return res.status(400).json({ ok: false, error: 'invalid browser id' });
|
||||
}
|
||||
const body = req.body || {};
|
||||
const cfg = loadConfig();
|
||||
if (!body.ua || !(cfg.uaPresets || {})[body.ua]) {
|
||||
return res.status(400).json({ ok: false, error: 'invalid ua preset' });
|
||||
}
|
||||
const checked = validateProxy(body.proxy);
|
||||
if (checked.error) {
|
||||
return res.status(400).json({ ok: false, error: checked.error });
|
||||
}
|
||||
try {
|
||||
// Regenerate chromium.conf + meta.json with the shared generator.
|
||||
await execFileAsync(
|
||||
process.execPath,
|
||||
[GENERATE_SCRIPT, id, body.ua, JSON.stringify(checked.proxy)],
|
||||
{ env: Object.assign({}, process.env, { FARM_ROOT: FARM_ROOT }) }
|
||||
);
|
||||
await dockerAction('restart', id);
|
||||
const info = loadBrowser(id);
|
||||
const st = await dockerStatus(id);
|
||||
res.json({
|
||||
ok: true,
|
||||
id: id,
|
||||
name: info.name,
|
||||
uaKey: info.uaKey,
|
||||
uaLabel: info.uaLabel,
|
||||
proxy: info.proxy,
|
||||
status: st.status,
|
||||
});
|
||||
} catch (e) {
|
||||
res.status(500).json({ ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
});
|
||||
|
||||
// Generic start/stop/restart. Defined AFTER the specific :id routes
|
||||
// (/wipe and /config) so Express does not swallow those paths as an "action".
|
||||
app.post('/api/browsers/:id/:action', async (req, res) => {
|
||||
const id = req.params.id;
|
||||
const action = req.params.action;
|
||||
if (!validateId(id)) {
|
||||
return res.status(400).json({ ok: false, error: 'invalid browser id' });
|
||||
}
|
||||
if (action !== 'start' && action !== 'stop' && action !== 'restart') {
|
||||
return res.status(400).json({ ok: false, error: 'invalid action' });
|
||||
}
|
||||
try {
|
||||
await dockerAction(action, id);
|
||||
const st = await dockerStatus(id);
|
||||
res.json({ ok: true, id: id, action: action, status: st.status });
|
||||
} catch (e) {
|
||||
res.status(500).json({ ok: false, error: String((e && e.message) || e) });
|
||||
}
|
||||
});
|
||||
|
||||
app.listen(PORT, HOST, () => {
|
||||
console.log('browser-farm manager listening on ' + HOST + ':' + PORT);
|
||||
});
|
||||
Executable
+119
@@ -0,0 +1,119 @@
|
||||
#!/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)
|
||||
// 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
|
||||
// '{"type":"http","host":"1.2.3.4","port":8080,"user":"","pass":""}'
|
||||
// (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
|
||||
// the preset list, proxy validated by the caller). Never passes user input
|
||||
// to a shell.
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const FARM_ROOT = process.env.FARM_ROOT || '/opt/farm';
|
||||
const BASE = path.join(__dirname, '..'); // repo root: browser-farm/
|
||||
const CONFIG_PATH = path.join(BASE, 'manager', 'config.json');
|
||||
const TEMPLATE_PATH = path.join(BASE, 'templates', 'chromium.conf.template');
|
||||
|
||||
function fail(msg) {
|
||||
console.error('generate.js: ' + msg);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function main() {
|
||||
const id = process.argv[2];
|
||||
const uaKeyArg = process.argv[3] || '';
|
||||
const proxyJson = process.argv[4] || '';
|
||||
|
||||
if (!/^b[1-8]$/.test(id || '')) fail('invalid browser id (want b1..b8)');
|
||||
|
||||
let cfg;
|
||||
try {
|
||||
cfg = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
||||
} catch (e) {
|
||||
fail('cannot read config.json: ' + e.message);
|
||||
}
|
||||
|
||||
const browser = (cfg.browsers || []).find((b) => b.id === id);
|
||||
if (!browser) fail('browser ' + id + ' not in config.json');
|
||||
|
||||
const uaKey = uaKeyArg || browser.uaKey;
|
||||
const preset = (cfg.uaPresets || {})[uaKey];
|
||||
if (!preset) fail('invalid ua preset: ' + uaKey);
|
||||
|
||||
let proxy = { type: 'direct' };
|
||||
if (proxyJson) {
|
||||
try {
|
||||
proxy = JSON.parse(proxyJson);
|
||||
} catch (e) {
|
||||
fail('invalid proxy JSON');
|
||||
}
|
||||
}
|
||||
if (!proxy || !['direct', 'http', 'socks5'].includes(proxy.type)) {
|
||||
fail('invalid proxy type (want direct|http|socks5)');
|
||||
}
|
||||
|
||||
// Build the --proxy-server flag. Direct = no flag at all.
|
||||
// With user/pass the credentials are embedded in the URL (Chromium uses
|
||||
// them for proxy auth); they are visible in the container's process list,
|
||||
// so prefer proxies without auth when possible.
|
||||
let proxyFlag = '';
|
||||
let proxyMeta = { type: 'direct' };
|
||||
if (proxy.type !== 'direct') {
|
||||
const host = typeof proxy.host === 'string' ? proxy.host.trim() : '';
|
||||
const port = Number(proxy.port);
|
||||
if (!host || !Number.isInteger(port) || port < 1 || port > 65535) {
|
||||
fail('invalid proxy host/port');
|
||||
}
|
||||
const user = typeof proxy.user === 'string' ? proxy.user : '';
|
||||
const pass = typeof proxy.pass === 'string' ? proxy.pass : '';
|
||||
const auth =
|
||||
user && pass
|
||||
? encodeURIComponent(user) + ':' + encodeURIComponent(pass) + '@'
|
||||
: '';
|
||||
proxyFlag = ' --proxy-server="' + proxy.type + '://' + auth + host + ':' + port + '"';
|
||||
proxyMeta = { type: proxy.type, host: host, port: port, user: user, pass: pass };
|
||||
}
|
||||
|
||||
let tpl;
|
||||
try {
|
||||
tpl = fs.readFileSync(TEMPLATE_PATH, 'utf8');
|
||||
} catch (e) {
|
||||
fail('cannot read chromium.conf.template: ' + e.message);
|
||||
}
|
||||
// Function replacers: replacement strings are used literally (no $ handling).
|
||||
const out = tpl
|
||||
.replace('__UA__', () => preset.ua)
|
||||
.replace('__PROXY__', () => proxyFlag);
|
||||
|
||||
const dir = path.join(FARM_ROOT, id);
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
const confPath = path.join(dir, 'chromium.conf');
|
||||
fs.writeFileSync(confPath, out);
|
||||
fs.chmodSync(confPath, 0o600);
|
||||
|
||||
const meta = {
|
||||
id: browser.id,
|
||||
name: browser.name,
|
||||
uaKey: uaKey,
|
||||
uaLabel: preset.label,
|
||||
proxy: proxyMeta,
|
||||
httpPort: browser.httpPort,
|
||||
udpStart: browser.udpStart,
|
||||
udpEnd: browser.udpEnd,
|
||||
};
|
||||
const metaPath = path.join(dir, 'meta.json');
|
||||
fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2) + '\n');
|
||||
fs.chmodSync(metaPath, 0o600);
|
||||
|
||||
console.log('wrote ' + confPath + ' and ' + metaPath);
|
||||
}
|
||||
|
||||
main();
|
||||
Executable
+227
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env bash
|
||||
# Browser Farm installer — run as root on the target VPS (Ubuntu 24.04).
|
||||
# Usage: copy the whole browser-farm folder to the VPS, then:
|
||||
# bash scripts/install.sh
|
||||
# Idempotent: safe to run twice — it stops/removes the old farm-b* containers,
|
||||
# regenerates every per-browser file, reinstalls the manager + nginx vhost,
|
||||
# and recreates the containers.
|
||||
set -euo pipefail
|
||||
|
||||
# ---- settings (change FARM_PASSWORD before first run if you want) ----
|
||||
FARM_ROOT="/opt/farm"
|
||||
APP_DIR="/opt/browser-farm"
|
||||
FARM_PASSWORD="FarmBrowser2026"
|
||||
NEKO_IMAGE="m1k1o/neko:chromium"
|
||||
VPS_IP="49.128.191.144"
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
|
||||
# Guard: the installer deletes $APP_DIR and copies the repo into it.
|
||||
# If the repo IS $APP_DIR, that would delete the source first.
|
||||
# In that case, copy the repo to a temp dir and re-run from there.
|
||||
if [ "$REPO_DIR" = "$APP_DIR" ]; then
|
||||
TMP_SRC="$(mktemp -d)/browser-farm"
|
||||
cp -r "$REPO_DIR" "$TMP_SRC"
|
||||
echo "==> Repo is inside $APP_DIR — re-running from $TMP_SRC ..."
|
||||
exec bash "$TMP_SRC/scripts/install.sh"
|
||||
fi
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "ERROR: jalankan sebagai root (sudo bash scripts/install.sh)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "==> Browser Farm installer (repo: $REPO_DIR)"
|
||||
|
||||
# ---- dependencies: docker, node, npm, nginx ----
|
||||
NEED_APT=0
|
||||
command -v docker >/dev/null 2>&1 || NEED_APT=1
|
||||
command -v node >/dev/null 2>&1 || NEED_APT=1
|
||||
command -v npm >/dev/null 2>&1 || NEED_APT=1
|
||||
command -v nginx >/dev/null 2>&1 || NEED_APT=1
|
||||
if [ "$NEED_APT" -eq 1 ]; then
|
||||
echo "==> Installing missing packages (docker/node/nginx)..."
|
||||
apt-get update -qq
|
||||
command -v docker >/dev/null 2>&1 || apt-get install -y -qq docker.io
|
||||
command -v node >/dev/null 2>&1 || apt-get install -y -qq nodejs npm
|
||||
command -v nginx >/dev/null 2>&1 || apt-get install -y -qq nginx
|
||||
fi
|
||||
systemctl enable --now docker >/dev/null 2>&1 || true
|
||||
NODE_BIN="$(command -v node)"
|
||||
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
|
||||
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
|
||||
id="b$n"
|
||||
mkdir -p "$FARM_ROOT/$id/profile"
|
||||
cp "$REPO_DIR/templates/policies.json" "$FARM_ROOT/$id/policies.json"
|
||||
# generate.js defaults: uaKey from config.json, proxy direct.
|
||||
FARM_ROOT="$FARM_ROOT" "$NODE_BIN" "$REPO_DIR/scripts/generate.js" "$id"
|
||||
done
|
||||
|
||||
# ---- pull Neko image ----
|
||||
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
|
||||
id="b$n"
|
||||
http_port=$((18080 + n))
|
||||
udp_start=$((52000 + (n - 1) * 100))
|
||||
udp_end=$((udp_start + 99))
|
||||
docker run -d --name "farm-$id" \
|
||||
--restart unless-stopped --stop-timeout 60 --shm-size=2gb \
|
||||
-p "$http_port:8080" \
|
||||
-p "$udp_start-$udp_end:$udp_start-$udp_end/udp" \
|
||||
-v "$FARM_ROOT/$id/profile:/home/neko/.config/chromium" \
|
||||
-v "$FARM_ROOT/$id/policies.json:/etc/chromium/policies/managed/policies.json:ro" \
|
||||
-v "$FARM_ROOT/$id/chromium.conf:/etc/neko/supervisord/chromium.conf:ro" \
|
||||
-e NEKO_SCREEN=1280x720@30 \
|
||||
-e "NEKO_PASSWORD=$FARM_PASSWORD" \
|
||||
-e "NEKO_PASSWORD_ADMIN=$FARM_PASSWORD" \
|
||||
-e "NEKO_NAT1TO1=$VPS_IP" \
|
||||
-e "NEKO_EPR=$udp_start-$udp_end" \
|
||||
-e NEKO_BIND=:8080 \
|
||||
-e NEKO_SERVER_BIND=:8080 \
|
||||
"$NEKO_IMAGE" >/dev/null
|
||||
echo " farm-$id -> http :$http_port, udp $udp_start-$udp_end"
|
||||
done
|
||||
|
||||
# ---- install the manager (server + UI + generator + templates) ----
|
||||
echo "==> Installing manager to $APP_DIR ..."
|
||||
systemctl stop farm-manager >/dev/null 2>&1 || true
|
||||
rm -rf "$APP_DIR"
|
||||
mkdir -p "$APP_DIR"
|
||||
cp -r "$REPO_DIR/manager" "$REPO_DIR/scripts" "$REPO_DIR/templates" "$APP_DIR/"
|
||||
rm -rf "$APP_DIR/manager/node_modules"
|
||||
cd "$APP_DIR/manager"
|
||||
npm install --production --no-audit --no-fund 2>&1 | tail -2
|
||||
|
||||
cat > /etc/systemd/system/farm-manager.service <<EOF
|
||||
[Unit]
|
||||
Description=Browser Farm manager
|
||||
After=network.target docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=$APP_DIR/manager
|
||||
Environment=FARM_ROOT=$FARM_ROOT
|
||||
Environment=PORT=18080
|
||||
Environment=HOST=127.0.0.1
|
||||
Environment=FARM_PASSWORD=$FARM_PASSWORD
|
||||
ExecStart=$NODE_BIN $APP_DIR/manager/server.js
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl daemon-reload
|
||||
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
|
||||
# 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
|
||||
# server's same-origin WebSocket check (Origin host == Host) passes.
|
||||
# Direct ports 18081..18088 keep working as a fallback.
|
||||
echo "==> Installing nginx vhost ..."
|
||||
cat > /etc/nginx/sites-available/farm.conf <<'EOF'
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:18080;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
EOF
|
||||
for n in 1 2 3 4 5 6 7 8; do
|
||||
http_port=$((18080 + n))
|
||||
cat >> /etc/nginx/sites-available/farm.conf <<EOF
|
||||
location /b$n/ {
|
||||
proxy_pass http://127.0.0.1:$http_port/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade \$http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \$scheme;
|
||||
proxy_read_timeout 600s;
|
||||
proxy_send_timeout 600s;
|
||||
}
|
||||
EOF
|
||||
done
|
||||
cat >> /etc/nginx/sites-available/farm.conf <<'EOF'
|
||||
}
|
||||
EOF
|
||||
ln -sf /etc/nginx/sites-available/farm.conf /etc/nginx/sites-enabled/farm.conf
|
||||
# The stock nginx default site would win over farm.conf for unmatched
|
||||
# hosts (it is the default_server); remove it so the grid is served.
|
||||
rm -f /etc/nginx/sites-enabled/default
|
||||
nginx -t
|
||||
systemctl reload nginx
|
||||
|
||||
# ---- firewall (only if UFW is active) ----
|
||||
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
|
||||
fi
|
||||
|
||||
# ---- verify ----
|
||||
echo "==> Verifying..."
|
||||
sleep 8
|
||||
echo "--- containers ---"
|
||||
docker ps --filter "name=farm-b" --format "{{.Names}} {{.Status}}"
|
||||
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
|
||||
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"
|
||||
done
|
||||
|
||||
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/
|
||||
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
|
||||
[ ] Login tiap cell sekali dengan password farm
|
||||
[ ] Buka https://www.whatismybrowser.com di tiap cell —
|
||||
User-Agent harus berbeda-beda sesuai label identitas
|
||||
[ ] Coba Start/Stop/Restart/Wipe/Settings di satu cell
|
||||
[ ] Kalau pakai proxy, isi di Settings cell lalu cek IP-nya
|
||||
===============================================================
|
||||
EOF
|
||||
@@ -0,0 +1,8 @@
|
||||
[program:chromium]
|
||||
command=/usr/bin/chromium-unlock /usr/bin/chromium --no-sandbox --window-position=0,0 --display=%(ENV_DISPLAY)s --user-data-dir=/home/neko/.config/chromium --no-first-run --start-maximized --bwsi --force-dark-mode --disable-file-system --disable-gpu --disable-software-rasterizer --disable-dev-shm-usage --user-agent="__UA__"__PROXY__
|
||||
autorestart=true
|
||||
priority=10
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@@ -0,0 +1 @@
|
||||
{"AllowFileSelectionDialogs":true,"AutofillAddressEnabled":false,"AutofillCreditCardEnabled":false,"AutoplayAllowed":true,"BookmarkBarEnabled":false,"BrowserAddPersonEnabled":false,"BrowserGuestModeEnabled":false,"BrowserLabsEnabled":false,"BrowserSignin":0,"CommandLineFlagSecurityWarningsEnabled":false,"DefaultNotificationsSetting":2,"DefaultPopupsSetting":2,"DeveloperToolsAvailability":2,"DownloadRestrictions":0,"EditBookmarksEnabled":false,"ExtensionInstallAllowlist":["ddkjiahejlhfcafbddmgiahcphecmpfh","mnjggcdmjocbbbhaepdhchncahnbgone"],"ExtensionInstallBlocklist":["*"],"ExtensionInstallForcelist":["ddkjiahejlhfcafbddmgiahcphecmpfh;https://clients2.google.com/service/update2/crx","mnjggcdmjocbbbhaepdhchncahnbgone;https://clients2.google.com/service/update2/crx"],"FullscreenAllowed":true,"IncognitoModeAvailability":1,"PasswordManagerEnabled":true,"PromptForDownloadLocation":false,"RestoreOnStartup":1,"SyncDisabled":true,"URLAllowlist":["file:///home/neko/Downloads"],"URLBlocklist":["file://*"],"VideoCaptureAllowed":true}
|
||||
Reference in new issue
Block a user