Merge upstream main and address desktop Joiner review

Resolve startup argument conflict while preserving Blink, VK reliability,
and login-link/QR handling from upstream.

Use shared platform validation, limit VP8 batch to 1-256, and prevent
failed spawns from entering the reconnect loop or emitting stopped twice.
Restore in-memory settings when reopening the window while continuing
to omit the SOCKS password from disk persistence.

Remove the extra GUI notes and build-dependent test files as requested.

Validation: TypeScript build and 12 local regression checks passed;
lifecycle and login-link tests used mocked processes/Electron/QR generation.
This commit is contained in:
evgenykei committed 2026-11-02 10:17:57 -06:00
commit 0109ed573b
53 files changed
+1313 -439

No files matched your search

+61 -5
View File
@@ -45,7 +45,7 @@ func (statusEmitter) EmitStatus(status string) {
// CAPTCHA:url is fired by the VK auth path when an interactive
// captcha is required. The Electron wrapper watches stdout for
// this exact prefix and opens a BrowserWindow at the URL.
if strings.HasPrefix(status, "CAPTCHA:") {
if strings.HasPrefix(status, "CAPTCHA:") || strings.HasPrefix(status, common.StatusLoginLink+":") {
fmt.Printf("STATUS:%s\n", status)
}
if status == common.StatusTunnelLost && !selfHealReconnect {
@@ -96,7 +96,7 @@ const (
)
func main() {
platform := flag.String("platform", "", "wbstream | telemost | vk | dion | bitrix (required)")
platform := flag.String("platform", "", "wbstream | telemost | vk | dion | bitrix | blink (required)")
link := flag.String("link", "", "WB Stream room link, Telemost join URI, VK call link, or DION event link (required)")
displayName := flag.String("name", "Joiner", "display name in the room")
socksHost := flag.String("socks-host", common.SocksLocalhostIP, "SOCKS5 listen address (use 0.0.0.0 to expose on LAN; tun2socks always connects via loopback)")
@@ -329,13 +329,16 @@ func main() {
onConnected, addCandidate)
case "vk":
selfHealReconnect = true
runVK(*link, *displayName, *tunnelMode, *vp8FPS, *vp8Batch, *dualTrack,
runVK(*link, *displayName, *tunnelMode, *vp8FPS, *vp8Batch, *dualTrack, *reliable,
onConnected, addCandidate)
case "dion", "dn":
runDion(*link, *displayName, onConnected, addCandidate)
case "bitrix", "bx":
runBitrix(*link, *displayName, *tunnelMode, *vp8FPS, *vp8Batch, *dualTrack, *reliable,
onConnected, addCandidate, bypassIP)
case "blink", "bl":
runBlink(*link, *tunnelMode, *vp8FPS, *vp8Batch, *dualTrack, *reliable,
onConnected, addCandidate, bypassIP)
default:
log.Fatalf("[config] unknown --platform %q", *platform)
}
@@ -380,7 +383,7 @@ func signalingHosts(platform, link string) []string {
}
return hosts
case "vk":
hosts := []string{"vk.ru", "login.vk.ru", "api.vk.ru", "ok.ru", "cloud-api.yandex.ru"}
hosts := []string{"vk.ru", "login.vk.ru", "api.vk.ru", "web.api.vk.ru", "ok.ru", "cloud-api.yandex.ru"}
if u, err := url.Parse(strings.TrimSpace(link)); err == nil && u.Host != "" {
hosts = append(hosts, u.Host)
}
@@ -462,7 +465,7 @@ func runTelemost(link, name string, fps, batch int, dualTrack, reliable bool,
go inner.RunWithParams(string(params))
}
func runVK(link, name, mode string, fps, batch int, dualTrack bool,
func runVK(link, name, mode string, fps, batch int, dualTrack, reliable bool,
onConnected func(tunnel.DataTunnel),
onCandidate func(int, string),
) {
@@ -483,6 +486,7 @@ func runVK(link, name, mode string, fps, batch int, dualTrack bool,
authParams["vp8Fps"] = fps
authParams["vp8Batch"] = batch
authParams["dualTrack"] = dualTrack
authParams["reliable"] = reliable
patched, err := json.Marshal(authParams)
if err != nil {
log.Fatalf("[vk] auth marshal: %v", err)
@@ -587,6 +591,58 @@ func runBitrix(link, name, mode string, fps, batch int, dualTrack, reliable bool
go inner.RunWithParams(string(params))
}
func runBlink(link, mode string, fps, batch int, dualTrack, reliable bool,
onConnected func(tunnel.DataTunnel),
onCandidate func(int, string),
bypassIP func(string),
) {
configDir, err := os.UserConfigDir()
if err != nil {
log.Fatalf("[blink] config dir: %v", err)
}
cookiesDir := filepath.Join(configDir, "whitelist-bypass")
if err := os.MkdirAll(cookiesDir, 0700); err != nil {
log.Fatalf("[blink] config dir: %v", err)
}
resolve := func(host string) (string, error) {
ip, err := resolveHostname(host)
if err == nil {
bypassIP(ip)
}
return ip, err
}
inner := joinerCommon.NewBlinkHeadlessJoiner(
log.Printf,
resolve,
statusEmitter{},
nil,
)
joinerConfigAck = inner.MarkConfigAcked
inner.OnConnected = onConnected
inner.OnRemoteCandidate = onCandidate
params, _ := json.Marshal(struct {
JoinLink string `json:"joinLink"`
CookiesPath string `json:"cookiesPath"`
TunnelMode string `json:"tunnelMode"`
VP8FPS int `json:"vp8Fps"`
VP8Batch int `json:"vp8Batch"`
DualTrack bool `json:"dualTrack"`
Reliable bool `json:"reliable"`
}{
JoinLink: strings.TrimSpace(link),
CookiesPath: filepath.Join(cookiesDir, "cookies-blink.json"),
TunnelMode: mode,
VP8FPS: fps,
VP8Batch: batch,
DualTrack: dualTrack,
Reliable: reliable,
})
go inner.RunWithParams(string(params))
}
func resolveHostname(hostname string) (string, error) {
if ip := net.ParseIP(hostname); ip != nil {
return hostname, nil
+11 -2
View File
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:" />
<title>WhitelistBypass Joiner</title>
<link rel="stylesheet" href="styles/app.css" />
</head>
@@ -66,7 +66,7 @@
</label>
<label>
VP8 batch
<input id="vp8Batch" type="number" value="30" min="1" max="3000" />
<input id="vp8Batch" type="number" value="30" min="1" max="256" />
</label>
</div>
<label class="check">
@@ -87,6 +87,15 @@
</div>
</section>
<section class="log-wrap">
<div class="login-card" id="loginCard" hidden>
<h2>Blink login</h2>
<span class="hint">Scan the QR with the Blink app on your phone, or copy the link and send it to whoever has Blink.</span>
<img id="loginQr" alt="Blink login QR" />
<div class="login-link-row">
<code id="loginLink"></code>
<button id="copyLoginLink">Copy</button>
</div>
</div>
<h2>Log <img class="log-download-btn" id="downloadLogs" src="resources/icons8-download-64.png" title="Download logs"></h2>
<pre id="log"></pre>
</section>
+214 -13
View File
@@ -1,14 +1,18 @@
{
"name": "whitelist-bypass-joiner",
"version": "0.4.4",
"version": "0.5.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "whitelist-bypass-joiner",
"version": "0.4.4",
"version": "0.5.0",
"dependencies": {
"qrcode": "^1.5.4"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@types/qrcode": "^1.5.6",
"electron": "^33.0.0",
"electron-builder": "^25.0.0",
"typescript": "^5.6.0"
@@ -756,6 +760,16 @@
"xmlbuilder": ">=11.0.1"
}
},
"node_modules/@types/qrcode": {
"version": "1.5.6",
"resolved": "https://registry.npmjs.org/@types/qrcode/-/qrcode-1.5.6.tgz",
"integrity": "sha512-te7NQcV2BOvdj2b1hCAHzAoMNuj65kNBMz0KBaxM6c3VGBOhU0dURQKOtH8CFNI/dsKkwlv32p26qYQTWoB5bw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/responselike": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz",
@@ -877,7 +891,6 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@@ -887,7 +900,6 @@
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
@@ -1504,6 +1516,15 @@
"node": ">= 0.4"
}
},
"node_modules/camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -1650,7 +1671,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
@@ -1663,7 +1683,6 @@
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"license": "MIT"
},
"node_modules/color-support": {
@@ -1896,6 +1915,15 @@
}
}
},
"node_modules/decamelize": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/decompress-response": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
@@ -2021,6 +2049,12 @@
"license": "MIT",
"optional": true
},
"node_modules/dijkstrajs": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",
"integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",
"license": "MIT"
},
"node_modules/dir-compare": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-4.2.0.tgz",
@@ -2419,7 +2453,6 @@
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true,
"license": "MIT"
},
"node_modules/encoding": {
@@ -2644,6 +2677,19 @@
"node": ">=10"
}
},
"node_modules/find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"license": "MIT",
"dependencies": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/foreground-child": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
@@ -2769,7 +2815,6 @@
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true,
"license": "ISC",
"engines": {
"node": "6.* || 8.* || >= 10.*"
@@ -3250,7 +3295,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
@@ -3473,6 +3517,18 @@
"safe-buffer": "~5.1.0"
}
},
"node_modules/locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"license": "MIT",
"dependencies": {
"p-locate": "^4.1.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/lodash": {
"version": "4.18.1",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
@@ -4113,6 +4169,33 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-locate": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"license": "MIT",
"dependencies": {
"p-limit": "^2.2.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/p-locate/node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
"integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",
"license": "MIT",
"dependencies": {
"p-try": "^2.0.0"
},
"engines": {
"node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-map": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",
@@ -4129,6 +4212,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-try": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",
"integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/package-json-from-dist": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
@@ -4136,6 +4228,15 @@
"dev": true,
"license": "BlueOak-1.0.0"
},
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
@@ -4234,6 +4335,15 @@
"node": ">=10.4.0"
}
},
"node_modules/pngjs": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
"integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",
"license": "MIT",
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -4294,6 +4404,89 @@
"node": ">=6"
}
},
"node_modules/qrcode": {
"version": "1.5.4",
"resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",
"integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",
"license": "MIT",
"dependencies": {
"dijkstrajs": "^1.0.1",
"pngjs": "^5.0.0",
"yargs": "^15.3.1"
},
"bin": {
"qrcode": "bin/qrcode"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/qrcode/node_modules/cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"license": "ISC",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^6.2.0"
}
},
"node_modules/qrcode/node_modules/wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/qrcode/node_modules/y18n": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",
"integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",
"license": "ISC"
},
"node_modules/qrcode/node_modules/yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"license": "MIT",
"dependencies": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^18.1.2"
},
"engines": {
"node": ">=8"
}
},
"node_modules/qrcode/node_modules/yargs-parser": {
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"license": "ISC",
"dependencies": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
},
"engines": {
"node": ">=6"
}
},
"node_modules/quick-lru": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
@@ -4383,12 +4576,17 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"license": "ISC"
},
"node_modules/resedit": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/resedit/-/resedit-1.7.2.tgz",
@@ -4574,7 +4772,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",
"dev": true,
"license": "ISC"
},
"node_modules/shebang-command": {
@@ -4769,7 +4966,6 @@
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
@@ -4800,7 +4996,6 @@
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
@@ -5112,6 +5307,12 @@
"node": ">= 8"
}
},
"node_modules/which-module": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",
"integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",
"license": "ISC"
},
"node_modules/wide-align": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
+5 -1
View File
@@ -1,14 +1,18 @@
{
"name": "whitelist-bypass-joiner",
"version": "0.4.4",
"version": "0.5.0",
"main": "dist/main/index.js",
"scripts": {
"build": "tsc",
"start": "tsc && electron .",
"start:dev": "electron ."
},
"dependencies": {
"qrcode": "^1.5.4"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@types/qrcode": "^1.5.6",
"electron": "^33.0.0",
"electron-builder": "^25.0.0",
"typescript": "^5.6.0"
+8 -1
View File
@@ -5,9 +5,16 @@ export const IPC = {
LOG: 'joiner:log',
STATUS: 'joiner:status',
RUNNING: 'joiner:running',
LOGIN_LINK: 'joiner:login-link',
} as const;
export type JoinerPlatform = 'wbstream' | 'telemost' | 'vk' | 'dion' | 'bitrix';
export const JOINER_PLATFORMS = ['wbstream', 'telemost', 'vk', 'dion', 'bitrix', 'blink'] as const;
export type JoinerPlatform = typeof JOINER_PLATFORMS[number];
export interface LoginLink {
link: string;
qr: string;
}
export interface JoinerSettings {
platform: JoinerPlatform;
+28 -5
View File
@@ -2,6 +2,7 @@ import { app, BrowserWindow, ipcMain } from 'electron';
import { spawn, ChildProcess } from 'node:child_process';
import { existsSync, readFileSync, writeFileSync, mkdirSync, renameSync } from 'node:fs';
import { join } from 'node:path';
import * as QRCode from 'qrcode';
import { IPC, JoinerSettings } from '../constants';
import { DEFAULT_SETTINGS, buildJoinerArgs, redactLog, validateSettings } from './settings';
import { portIsAvailable } from './port';
@@ -73,6 +74,17 @@ function closeCaptchaWindow() {
captchaWindow = null;
}
async function showLoginLink(link: string) {
send(IPC.STATUS, 'waiting for login');
try {
const qr = await QRCode.toDataURL(link, { errorCorrectionLevel: 'M', margin: 1, scale: 6 });
send(IPC.LOGIN_LINK, { link, qr });
} catch (err) {
send(IPC.LOG, `[main] login QR failed: ${(err as Error).message}\n`);
send(IPC.LOGIN_LINK, { link, qr: '' });
}
}
function resolveJoinerExe(): string {
// When packaged, electron-builder copies the backend binary into
// resources/ under the OS-appropriate name. In dev, fall back to
@@ -174,11 +186,12 @@ async function spawnJoiner(settings: JoinerSettings): Promise<{ ok: boolean; err
send(IPC.RUNNING, true);
send(IPC.STATUS, 'starting');
let spawned = false;
joinerProcess.once('spawn', () => { spawned = true; });
joinerProcess.on('error', (err) => {
send(IPC.LOG, `[main] spawn error: ${err.message}\n`);
send(IPC.STATUS, 'stopped');
send(IPC.RUNNING, false);
// Keep ownership until close so an old child cannot clear a newer start.
// close also follows a failed spawn. Keep ownership until then and
// emit the terminal state only once, from the close handler.
});
const handleOutput = (text: string) => {
send(IPC.LOG, text);
@@ -193,17 +206,25 @@ async function spawnJoiner(settings: JoinerSettings): Promise<{ ok: boolean; err
} else if (captchaWindow && /captcha solved|Auth complete|TUNNEL/i.test(text)) {
closeCaptchaWindow();
}
const loginMatch = text.match(/STATUS:LOGIN_LINK:(\S+)/);
if (loginMatch) {
showLoginLink(loginMatch[1]);
} else if (text.includes('[login] approved')) {
send(IPC.LOGIN_LINK, null);
send(IPC.STATUS, 'starting');
}
};
joinerProcess.stdout?.on('data', (b: Buffer) => handleOutput(b.toString()));
joinerProcess.stderr?.on('data', (b: Buffer) => handleOutput(b.toString()));
joinerProcess.on('close', (code, signal) => {
closeCaptchaWindow();
send(IPC.LOGIN_LINK, null);
send(IPC.LOG, `\n[main] joiner exited code=${code} signal=${signal}\n`);
send(IPC.STATUS, 'stopped');
send(IPC.RUNNING, false);
joinerProcess = null;
if (userRequestedStop || !lastSettings) return;
if (!spawned || userRequestedStop || !lastSettings) return;
if (retryCount >= MAX_RETRIES) {
send(IPC.LOG, `[main] auto-reconnect: giving up after ${MAX_RETRIES} attempts\n`);
return;
@@ -245,7 +266,9 @@ ipcMain.handle(IPC.START, async (_e, settings: JoinerSettings) => {
});
ipcMain.handle(IPC.STATE, async () => {
const settings = readSettings();
// Reopening a window must retain the current in-memory password. Only
// disk persistence omits it; a fresh application still starts without it.
const settings = lastSettings ?? readSettings();
const occupied = !running && !startInProgress && !(await portIsAvailable(settings.socksPort));
return { settings, running, status: occupied ? 'port in use' : currentStatus, log: logBuffer };
});
+5 -5
View File
@@ -1,4 +1,4 @@
import { JoinerSettings } from '../constants';
import { JOINER_PLATFORMS, JoinerSettings } from '../constants';
export const DEFAULT_SETTINGS: JoinerSettings = {
platform: 'telemost', link: '', displayName: 'Joiner', socksPort: 1080,
@@ -13,10 +13,10 @@ export function validateSettings(value: JoinerSettings): void {
if (typeof value[key] !== 'string') throw new Error(`Invalid ${key}`);
}
if (!value.link.trim()) throw new Error('Join link is required');
if (!['telemost', 'wbstream', 'vk', 'dion', 'bitrix'].includes(value.platform)) throw new Error('Invalid platform');
if (!JOINER_PLATFORMS.includes(value.platform)) throw new Error('Invalid platform');
if (!['video', 'dc'].includes(value.tunnelMode)) throw new Error('Invalid tunnel mode');
if (!['moderate', 'default', 'unlimited'].includes(value.resources)) throw new Error('Invalid resources');
for (const [key, min, max] of [['socksPort', 1, 65535], ['vp8Fps', 1, 60], ['vp8Batch', 1, 3000]] as const) {
for (const [key, min, max] of [['socksPort', 1, 65535], ['vp8Fps', 1, 60], ['vp8Batch', 1, 256]] as const) {
if (!Number.isInteger(value[key]) || value[key] < min || value[key] > max) throw new Error(`Invalid ${key}`);
}
for (const key of ['noTun', 'dualTrack', 'reliable'] as const) {
@@ -36,8 +36,8 @@ export function buildJoinerArgs(settings: JoinerSettings): string[] {
if (settings.socksUser) args.push('--socks-user', settings.socksUser);
if (settings.socksPass) args.push('--socks-pass', settings.socksPass);
if (settings.noTun) args.push('--no-tun');
if (settings.dualTrack && ['vk', 'wbstream', 'bitrix'].includes(settings.platform)) args.push('--dual-track');
if (settings.reliable && ['telemost', 'wbstream', 'bitrix'].includes(settings.platform)) args.push('--reliable');
if (settings.dualTrack && ['vk', 'wbstream', 'bitrix', 'blink'].includes(settings.platform)) args.push('--dual-track');
if (settings.reliable && ['vk', 'telemost', 'wbstream', 'bitrix', 'blink'].includes(settings.platform)) args.push('--reliable');
return args;
}
+4 -1
View File
@@ -1,5 +1,5 @@
import { contextBridge, ipcRenderer } from 'electron';
import { IPC, JoinerSettings } from '../constants';
import { IPC, JoinerSettings, LoginLink } from '../constants';
contextBridge.exposeInMainWorld('bridge', {
state: () => ipcRenderer.invoke(IPC.STATE),
@@ -14,4 +14,7 @@ contextBridge.exposeInMainWorld('bridge', {
onRunning(cb: (running: boolean) => void) {
ipcRenderer.on(IPC.RUNNING, (_e, v) => cb(v));
},
onLoginLink(cb: (login: LoginLink | null) => void) {
ipcRenderer.on(IPC.LOGIN_LINK, (_e, login) => cb(login));
},
});
+20 -1
View File
@@ -1,4 +1,5 @@
type JoinerPlatform = 'wbstream' | 'telemost' | 'vk' | 'dion' | 'bitrix';
type JoinerPlatform = import('../constants').JoinerPlatform;
type LoginLink = import('../constants').LoginLink;
function detectPlatform(url: string): JoinerPlatform | null {
const u = url.toLowerCase();
@@ -7,6 +8,7 @@ function detectPlatform(url: string): JoinerPlatform | null {
if (u.includes('telemost.yandex')) return 'telemost';
if (u.includes('dion://') || u.includes('dion.vc')) return 'dion';
if (u.includes('bitrix24') && u.includes('/video/')) return 'bitrix';
if (u.includes('blink://') || (u.includes('blinkmap.com') && u.includes('/join/'))) return 'blink';
return 'vk';
}
@@ -17,6 +19,7 @@ function platformLabel(p: JoinerPlatform | null): string {
case 'vk': return 'VK';
case 'dion': return 'DION';
case 'bitrix': return 'Bitrix';
case 'blink': return 'Blink';
default: return '-';
}
}
@@ -28,6 +31,7 @@ interface Bridge {
onLog(cb: (text: string) => void): void;
onStatus(cb: (status: string) => void): void;
onRunning(cb: (running: boolean) => void): void;
onLoginLink(cb: (login: LoginLink | null) => void): void;
}
declare const bridge: Bridge;
@@ -42,6 +46,10 @@ const stopBtn = $('stop') as HTMLButtonElement;
const downloadLogsBtn = $('downloadLogs') as HTMLImageElement;
const platformHint = $('platformHint');
const linkInput = input('link');
const loginCard = $('loginCard');
const loginQr = $('loginQr') as HTMLImageElement;
const loginLinkEl = $('loginLink');
const copyLoginLinkBtn = $('copyLoginLink') as HTMLButtonElement;
stopBtn.disabled = true;
startBtn.disabled = true;
@@ -110,6 +118,17 @@ bridge.state().then((state) => {
appendLog('[ui] Could not load saved settings.\n');
startBtn.disabled = false;
});
bridge.onLoginLink((login) => {
loginCard.hidden = !login;
if (!login) return;
loginQr.src = login.qr;
loginQr.hidden = !login.qr;
loginLinkEl.textContent = login.link;
});
copyLoginLinkBtn.addEventListener('click', () => {
navigator.clipboard.writeText(loginLinkEl.textContent || '');
});
startBtn.addEventListener('click', async () => {
appendLog('\n[ui] starting joiner...\n');
+10
View File
@@ -30,6 +30,16 @@ main { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; paddin
section.form { overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 10px; }
section.log-wrap { display: flex; flex-direction: column; min-height: 0; }
section.log-wrap h2 { font-size: 12px; margin: 0 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; }
.login-card {
display: flex; flex-direction: column; align-items: center; gap: 8px;
margin-bottom: 12px; padding: 12px; background: var(--bg-elev);
border: 1px solid #2c2e35; border-radius: 6px;
}
.login-card[hidden] { display: none; }
#loginQr { width: 200px; height: 200px; padding: 6px; background: #fff; border-radius: 4px; image-rendering: pixelated; }
.login-link-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.login-link-row code { flex: 1; font: 11px/1.4 "SF Mono", Menlo, Consolas, monospace; color: #c5c8cf; word-break: break-all; }
.login-link-row button { flex: 0 0 auto; }
.log-download-btn { width: 14px; height: 14px; margin-left: auto; cursor: pointer; filter: invert(0.55); }
.log-download-btn:hover { filter: invert(0.88); }
pre#log {
@@ -1,75 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const vm = require('node:vm');
const fs = require('node:fs');
const path = require('node:path');
const { EventEmitter } = require('node:events');
const { DEFAULT_SETTINGS } = require('../dist/main/settings');
function harness(portCheck = async () => true) {
const app = new EventEmitter();
app.getPath = () => '/mock-profile';
app.requestSingleInstanceLock = () => true;
app.whenReady = () => Promise.resolve();
app.quit = () => {};
const handlers = new Map(), sent = [], children = [], timers = [], writes = [];
class Window {
constructor() { this.webContents = { send: (...args) => sent.push(args) }; }
isDestroyed() { return false; }
setMenuBarVisibility() {}
loadFile() {}
}
const sandbox = {
exports: {}, __dirname: path.resolve(__dirname, '../dist/main'),
process: { platform: 'win32', arch: 'x64', resourcesPath: '/mock-bin' },
setTimeout: callback => { timers.push(callback); return callback; },
clearTimeout: callback => { const i = timers.indexOf(callback); if (i >= 0) timers.splice(i, 1); },
require: name => {
if (name === 'electron') return { app, BrowserWindow: Window, ipcMain: { handle: (key, fn) => handlers.set(key, fn) } };
if (name === 'node:fs') return {
existsSync: () => true, mkdirSync() {}, renameSync() {},
readFileSync: () => { throw new Error('No saved settings'); },
writeFileSync: (_p, value) => writes.push(value),
};
if (name === './port') return { portIsAvailable: portCheck };
if (name === 'node:child_process') return { spawn: () => {
const child = new EventEmitter();
child.stdout = new EventEmitter(); child.stderr = new EventEmitter();
child.stdin = { write() {}, end() {} }; child.kill = () => {};
children.push(child); return child;
} };
if (name.startsWith('.')) return require(path.resolve(__dirname, '../dist/main', name));
return require(name);
},
};
vm.runInNewContext(fs.readFileSync(path.resolve(__dirname, '../dist/main/index.js'), 'utf8'), sandbox);
return { app, sent, children, timers, writes, call: (key, settings) => handlers.get('joiner:' + key)(null, settings) };
}
const settings = { ...DEFAULT_SETTINGS, link: 'https://telemost.yandex.ru/j/example', socksPass: 'private-test-password' };
test('busy port refuses startup without spawning or persisting settings', async () => {
const h = harness(async () => false);
assert.equal((await h.call('start', settings)).ok, false);
assert.equal(h.children.length, 0);
assert.equal(h.writes.length, 0);
});
test('Stop during asynchronous port check cancels pending startup', async () => {
let resolve;
const h = harness(() => new Promise(r => { resolve = r; }));
const pending = h.call('start', settings);
await h.call('stop'); resolve(true);
assert.equal((await pending).ok, false);
assert.equal(h.children.length, 0);
});
test('connected status recognizes underscore, persists no password and closing cancels reconnect', async () => {
const h = harness();
assert.equal((await h.call('start', settings)).ok, true);
assert.equal(JSON.parse(h.writes[0]).socksPass, '');
h.children[0].stdout.emit('data', Buffer.from('TUNNEL_CONNECTED\n'));
assert.ok(h.sent.some(([channel, value]) => channel === 'joiner:status' && value === 'connected'));
assert.ok(!h.sent.filter(([channel]) => channel === 'joiner:log').some(([, value]) => value.includes(settings.link) || value.includes(settings.socksPass)));
h.children[0].emit('close', 1, null);
assert.equal(h.timers.length, 1);
h.app.emit('window-all-closed');
assert.equal(h.timers.length, 0);
});
-50
View File
@@ -1,50 +0,0 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const net = require('node:net');
const { DEFAULT_SETTINGS, buildJoinerArgs, redactLog } = require('../dist/main/settings');
const { portIsAvailable } = require('../dist/main/port');
const base = { ...DEFAULT_SETTINGS, socksPort: 10809, vp8Batch: 300, dns: '1.1.1.1', noTun: true, reliable: true, link: 'https://telemost.yandex.ru/j/test-placeholder' };
test('Telemost GUI launches the agreed SOCKS-only reliable video configuration', () => {
const args = buildJoinerArgs(base);
for (const [key, value] of Object.entries({
'--platform': 'telemost', '--socks-port': '10809', '--vp8-fps': '24',
'--vp8-batch': '300', '--tunnel-mode': 'video', '--dns': '1.1.1.1',
})) assert.equal(args[args.indexOf(key) + 1], value);
assert.ok(args.includes('--reliable'));
assert.ok(args.includes('--no-tun'));
assert.ok(!args.includes('--debug'));
});
test('KCP checkbox controls the Telemost flag and WB Stream keeps its flag', () => {
assert.ok(!buildJoinerArgs({ ...base, reliable: false }).includes('--reliable'));
assert.ok(buildJoinerArgs({ ...base, platform: 'wbstream' }).includes('--reliable'));
const bitrix = buildJoinerArgs({ ...base, platform: 'bitrix', dualTrack: true });
assert.ok(bitrix.includes('--reliable'));
assert.ok(bitrix.includes('--dual-track'));
});
test('invalid ports and malformed settings fail before spawning a child', () => {
for (const socksPort of [0, 65536, 10809.5, NaN]) assert.throws(() => buildJoinerArgs({ ...base, socksPort }));
assert.throws(() => buildJoinerArgs({ ...base, noTun: 'true' }));
assert.throws(() => buildJoinerArgs({ ...base, link: '' }));
});
test('log output does not expose the conference link or SOCKS password', () => {
const settings = { ...base, socksPass: 'test-secret' };
const result = redactLog('run --link ' + settings.link + ' --socks-pass test-secret', settings);
assert.ok(!result.includes(settings.link));
assert.ok(!result.includes('test-secret'));
});
test('a live listener is rejected without interrupting it, then the released port is usable', async () => {
const server = net.createServer((socket) => socket.end('still-alive'));
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
const port = server.address().port;
try {
assert.equal(await portIsAvailable(port), false);
const data = await new Promise((resolve, reject) => {
const socket = net.connect(port, '127.0.0.1');
socket.on('data', (chunk) => resolve(chunk.toString()));
socket.on('error', reject);
});
assert.equal(data, 'still-alive');
} finally { await new Promise((resolve) => server.close(resolve)); }
assert.equal(await portIsAvailable(port), true);
});