add blink to desktop joiner
This commit is contained in:
1 parent
3eb46f6ebf
commit
558bb4438f
11 files changed
+366
-26
No files matched your search
@@ -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)")
|
||||
@@ -336,6 +336,9 @@ func main() {
|
||||
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)
|
||||
}
|
||||
@@ -587,6 +590,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
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
Generated
+212
-11
@@ -7,8 +7,12 @@
|
||||
"": {
|
||||
"name": "whitelist-bypass-joiner",
|
||||
"version": "0.4.4",
|
||||
"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",
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
"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"
|
||||
|
||||
@@ -4,9 +4,15 @@ 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 type JoinerPlatform = 'wbstream' | 'telemost' | 'vk' | 'dion' | 'bitrix' | 'blink';
|
||||
|
||||
export interface LoginLink {
|
||||
link: string;
|
||||
qr: string;
|
||||
}
|
||||
|
||||
export interface JoinerSettings {
|
||||
platform: JoinerPlatform;
|
||||
|
||||
@@ -2,6 +2,7 @@ import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
import { spawn, ChildProcess } from 'node:child_process';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import * as QRCode from 'qrcode';
|
||||
import { IPC, JoinerSettings } from '../constants';
|
||||
|
||||
// Single global joiner process. We never run two tunnels at once: the
|
||||
@@ -40,6 +41,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
|
||||
@@ -119,10 +131,10 @@ function spawnJoiner(settings: JoinerSettings): { ok: boolean; error?: string }
|
||||
if (settings.socksUser) args.push('--socks-user', settings.socksUser);
|
||||
if (settings.socksPass) args.push('--socks-pass', settings.socksPass);
|
||||
if (noTun) args.push('--no-tun');
|
||||
if (settings.dualTrack && (settings.platform === 'vk' || settings.platform === 'wbstream' || settings.platform === 'bitrix')) {
|
||||
if (settings.dualTrack && (settings.platform === 'vk' || settings.platform === 'wbstream' || settings.platform === 'bitrix' || settings.platform === 'blink')) {
|
||||
args.push('--dual-track');
|
||||
}
|
||||
if (settings.reliable && (settings.platform === 'wbstream' || settings.platform === 'bitrix' || settings.platform === 'telemost')) {
|
||||
if (settings.reliable && (settings.platform === 'wbstream' || settings.platform === 'bitrix' || settings.platform === 'telemost' || settings.platform === 'blink')) {
|
||||
args.push('--reliable');
|
||||
}
|
||||
|
||||
@@ -160,11 +172,19 @@ function spawnJoiner(settings: JoinerSettings): { ok: boolean; error?: string }
|
||||
} 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('exit', (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);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron';
|
||||
import { IPC, JoinerSettings } from '../constants';
|
||||
import { IPC, JoinerSettings, LoginLink } from '../constants';
|
||||
|
||||
contextBridge.exposeInMainWorld('bridge', {
|
||||
start: (settings: JoinerSettings) => ipcRenderer.invoke(IPC.START, settings),
|
||||
@@ -13,4 +13,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));
|
||||
},
|
||||
});
|
||||
@@ -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 '-';
|
||||
}
|
||||
}
|
||||
@@ -27,6 +30,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;
|
||||
|
||||
@@ -41,6 +45,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;
|
||||
|
||||
@@ -85,6 +93,17 @@ bridge.onRunning((running) => {
|
||||
startBtn.disabled = running;
|
||||
stopBtn.disabled = !running;
|
||||
});
|
||||
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');
|
||||
|
||||
@@ -30,6 +30,16 @@ main { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; paddin
|
||||
section.form { 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 {
|
||||
|
||||
+13
-2
@@ -64,8 +64,9 @@ type Session struct {
|
||||
configAcked chan struct{}
|
||||
configAckedOnce sync.Once
|
||||
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
OnPeerRestart func()
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
OnPeerRestart func()
|
||||
OnRemoteCandidate func(target int, candidateOrSDP string)
|
||||
}
|
||||
|
||||
func NewSession(cfg SessionConfig) *Session {
|
||||
@@ -108,6 +109,16 @@ func (s *Session) Start() error {
|
||||
s.lk.OnTrack = s.onRemoteTrack
|
||||
s.lk.OnDataChannel = s.onRemoteDataChannel
|
||||
s.lk.OnPubConnected = s.startTunnel
|
||||
s.lk.OnRemoteCandidate = func(target int, ic webrtc.ICECandidateInit) {
|
||||
if s.OnRemoteCandidate != nil {
|
||||
s.OnRemoteCandidate(target, ic.Candidate)
|
||||
}
|
||||
}
|
||||
s.lk.OnRemoteSDP = func(target int, _, sdp string) {
|
||||
if s.OnRemoteCandidate != nil {
|
||||
s.OnRemoteCandidate(-1, sdp)
|
||||
}
|
||||
}
|
||||
|
||||
if err := s.lk.Connect(); err != nil {
|
||||
return err
|
||||
|
||||
@@ -15,11 +15,12 @@ import (
|
||||
)
|
||||
|
||||
type BlinkHeadlessJoiner struct {
|
||||
logFn func(string, ...any)
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
ResolveFn ResolveFunc
|
||||
Status StatusEmitter
|
||||
PCConfig PeerConnectionConfigurer
|
||||
logFn func(string, ...any)
|
||||
OnConnected func(tunnel.DataTunnel)
|
||||
OnRemoteCandidate func(target int, candidateOrSDP string)
|
||||
ResolveFn ResolveFunc
|
||||
Status StatusEmitter
|
||||
PCConfig PeerConnectionConfigurer
|
||||
|
||||
httpClient *http.Client
|
||||
cookiesPath string
|
||||
@@ -181,6 +182,7 @@ func (j *BlinkHeadlessJoiner) runOnce(credentials *blink.Credentials, chatID int
|
||||
j.OnConnected(tun)
|
||||
}
|
||||
}
|
||||
sess.OnRemoteCandidate = j.OnRemoteCandidate
|
||||
|
||||
j.mu.Lock()
|
||||
if j.closed {
|
||||
|
||||
Reference in new issue
Block a user