Dashboard VPN: per-browser VPN toggle with country picker
- manager/vpn-pool.js: free proxy pool from ProxyScrape JSON (no key), live-checked via curl, cached 30 min, grouped by country - server.js: GET /api/vpn/pool, POST /api/vpn/refresh, POST /api/browsers/:id/vpn; vpn state stored in meta.json - generate.js: 5th arg vpnJson, stored in meta.json - index.html: VPN section in Settings (toggle + country + refresh), VPN badge on cells, manual proxy disabled while VPN is on - README: VPN section + file list Verified live on 49.128.189.254: 24 working proxies in 11 countries, b1 VPN on (PH 180.232.127.250) showed the proxy IP, off restored direct
This commit is contained in:
1 parent
df4ae5a17a
commit
26427401db
5 files changed
+426
-13
No files matched your search
+20
-1
@@ -1,12 +1,17 @@
|
||||
#!/usr/bin/env node
|
||||
// generate.js — single source of truth for per-browser Neko files.
|
||||
// Usage: node generate.js <browserId> [uaKey] [proxyJson]
|
||||
// Usage: node generate.js <browserId> [uaKey] [proxyJson] [vpnJson]
|
||||
// browserId: b1..b10 (required)
|
||||
// uaKey: one of the keys in manager/config.json uaPresets (optional,
|
||||
// defaults to the browser's configured uaKey)
|
||||
// proxyJson: JSON string, e.g. '{"type":"direct"}' or
|
||||
// '{"type":"http","host":"1.2.3.4","port":8080,"user":"","pass":""}'
|
||||
// (optional, defaults to {"type":"direct"})
|
||||
// vpnJson: JSON string describing the dashboard VPN state, e.g.
|
||||
// '{"on":true,"country":"Netherlands","countryCode":"NL",
|
||||
// "type":"socks5","host":"1.2.3.4","port":1080}'
|
||||
// (optional, defaults to {"on":false}). Stored in meta.json
|
||||
// only — it does not change chromium.conf beyond the proxy.
|
||||
// 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(10|[1-9])$, ua key from
|
||||
@@ -31,6 +36,7 @@ function main() {
|
||||
const id = process.argv[2];
|
||||
const uaKeyArg = process.argv[3] || '';
|
||||
const proxyJson = process.argv[4] || '';
|
||||
const vpnJson = process.argv[5] || '';
|
||||
|
||||
if (!/^b(10|[1-9])$/.test(id || '')) fail('invalid browser id (want b1..b10)');
|
||||
|
||||
@@ -60,6 +66,18 @@ function main() {
|
||||
fail('invalid proxy type (want direct|http|socks5)');
|
||||
}
|
||||
|
||||
// Dashboard VPN state (stored in meta.json only; the proxy above is what
|
||||
// actually routes the traffic). Kept as given, default off.
|
||||
let vpn = { on: false };
|
||||
if (vpnJson) {
|
||||
try {
|
||||
vpn = JSON.parse(vpnJson);
|
||||
} catch (e) {
|
||||
fail('invalid vpn JSON');
|
||||
}
|
||||
if (!vpn || typeof vpn.on !== 'boolean') fail('invalid vpn state (want {on:boolean,...})');
|
||||
}
|
||||
|
||||
// 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,
|
||||
@@ -105,6 +123,7 @@ function main() {
|
||||
uaKey: uaKey,
|
||||
uaLabel: preset.label,
|
||||
proxy: proxyMeta,
|
||||
vpn: vpn,
|
||||
httpPort: browser.httpPort,
|
||||
udpStart: browser.udpStart,
|
||||
udpEnd: browser.udpEnd,
|
||||
|
||||
Reference in new issue
Block a user