fix 401 in windows telemost (I hope so)

This commit is contained in:
kulikov0 committed 2026-05-07 17:39:24 +02:00
1 parent 77d4ffe098
commit d703fd96ea
5 files changed
+18 -19

No files matched your search

Binary file not shown.
+16 -17
View File
@@ -220,22 +220,23 @@ export class TabManager {
const isTelemost = platform === Platform.Telemost;
tab.tunnelMode = isTelemost ? TunnelMode.HeadlessTelemost : TunnelMode.HeadlessVK;
tab.platform = platform;
const cookieStr = isTelemost
? await this.getYandexCookieString()
: await this.getVKCookieString();
if (!cookieStr) {
const cookies = isTelemost
? await this.getYandexCookies()
: await this.getVKCookies();
if (cookies.length === 0) {
const name = isTelemost ? 'Yandex' : 'VK';
this.sendLog(tabId, `No ${name} cookies found. Please log into ${name} first.`);
return;
}
this.killRelay(tabId, tab);
const cookiesPath = path.join(app.getPath('userData'), `cookies-${platform}.json`);
await fs.writeFile(cookiesPath, JSON.stringify(cookies));
const binaryPath = isTelemost ? this.headlessTelemostPath : this.headlessVKPath;
const proc = spawn(binaryPath, ['--resources', 'default'], {
stdio: ['pipe', 'pipe', 'pipe'],
const proc = spawn(binaryPath, ['--resources', 'default', '--cookies', cookiesPath], {
stdio: ['ignore', 'pipe', 'pipe'],
});
tab.relay = proc;
this.attachProcessOutput(proc, tabId);
proc.stdin?.write(cookieStr + '\n');
proc.on('close', (code) => {
this.sendLog(tabId, `Headless exited with code ${code}`);
});
@@ -276,22 +277,20 @@ export class TabManager {
setTimeout(() => this.startRelay(tabId, tab), RELAY_RESTART_DELAY_MS);
}
async getVKCookieString(): Promise<string> {
async getVKCookies(): Promise<{ name: string; value: string }[]> {
const ses = session.fromPartition(SESSION_PARTITION);
const all = await ses.cookies.get({});
const vkCookies = all.filter((cookie) => {
return cookie.domain != null && VK_COOKIE_DOMAINS.some((d) => cookie.domain!.includes(d));
});
return vkCookies.map((cookie) => `${cookie.name}=${cookie.value}`).join('; ');
return all
.filter((c) => c.domain != null && VK_COOKIE_DOMAINS.some((d) => c.domain!.includes(d)))
.map((c) => ({ name: c.name, value: c.value }));
}
async getYandexCookieString(): Promise<string> {
async getYandexCookies(): Promise<{ name: string; value: string }[]> {
const ses = session.fromPartition(SESSION_PARTITION);
const all = await ses.cookies.get({});
const yaCookies = all.filter((cookie) => {
return cookie.domain != null && YANDEX_COOKIE_DOMAINS.some((d) => cookie.domain!.includes(d));
});
return yaCookies.map((cookie) => `${cookie.name}=${cookie.value}`).join('; ');
return all
.filter((c) => c.domain != null && YANDEX_COOKIE_DOMAINS.some((d) => c.domain!.includes(d)))
.map((c) => ({ name: c.name, value: c.value }));
}
}
+2 -2
View File
@@ -21,8 +21,8 @@ const (
HandshakeBuf = 258
UDPBufSize = 4096
RTPBufSize = 65536
// VP8BufSize fits one RTP packet: 1200 MTU - 1 VP8 descriptor - 5 tunnel header - 9 protocol frame
VP8BufSize = 1185
// VP8BufSize fits one RTP packet: 1200 MTU - 1 VP8 descriptor - 22 tunnel header - 9 protocol frame
VP8BufSize = 1168
DCBufSize = 32768
)