fix 401 in windows telemost (I hope so)
This commit is contained in:
1 parent
77d4ffe098
commit
d703fd96ea
5 files changed
+18
-19
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -220,22 +220,23 @@ export class TabManager {
|
|||||||
const isTelemost = platform === Platform.Telemost;
|
const isTelemost = platform === Platform.Telemost;
|
||||||
tab.tunnelMode = isTelemost ? TunnelMode.HeadlessTelemost : TunnelMode.HeadlessVK;
|
tab.tunnelMode = isTelemost ? TunnelMode.HeadlessTelemost : TunnelMode.HeadlessVK;
|
||||||
tab.platform = platform;
|
tab.platform = platform;
|
||||||
const cookieStr = isTelemost
|
const cookies = isTelemost
|
||||||
? await this.getYandexCookieString()
|
? await this.getYandexCookies()
|
||||||
: await this.getVKCookieString();
|
: await this.getVKCookies();
|
||||||
if (!cookieStr) {
|
if (cookies.length === 0) {
|
||||||
const name = isTelemost ? 'Yandex' : 'VK';
|
const name = isTelemost ? 'Yandex' : 'VK';
|
||||||
this.sendLog(tabId, `No ${name} cookies found. Please log into ${name} first.`);
|
this.sendLog(tabId, `No ${name} cookies found. Please log into ${name} first.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.killRelay(tabId, tab);
|
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 binaryPath = isTelemost ? this.headlessTelemostPath : this.headlessVKPath;
|
||||||
const proc = spawn(binaryPath, ['--resources', 'default'], {
|
const proc = spawn(binaryPath, ['--resources', 'default', '--cookies', cookiesPath], {
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
});
|
});
|
||||||
tab.relay = proc;
|
tab.relay = proc;
|
||||||
this.attachProcessOutput(proc, tabId);
|
this.attachProcessOutput(proc, tabId);
|
||||||
proc.stdin?.write(cookieStr + '\n');
|
|
||||||
proc.on('close', (code) => {
|
proc.on('close', (code) => {
|
||||||
this.sendLog(tabId, `Headless exited with code ${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);
|
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 ses = session.fromPartition(SESSION_PARTITION);
|
||||||
const all = await ses.cookies.get({});
|
const all = await ses.cookies.get({});
|
||||||
const vkCookies = all.filter((cookie) => {
|
return all
|
||||||
return cookie.domain != null && VK_COOKIE_DOMAINS.some((d) => cookie.domain!.includes(d));
|
.filter((c) => c.domain != null && VK_COOKIE_DOMAINS.some((d) => c.domain!.includes(d)))
|
||||||
});
|
.map((c) => ({ name: c.name, value: c.value }));
|
||||||
return vkCookies.map((cookie) => `${cookie.name}=${cookie.value}`).join('; ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getYandexCookieString(): Promise<string> {
|
async getYandexCookies(): Promise<{ name: string; value: string }[]> {
|
||||||
const ses = session.fromPartition(SESSION_PARTITION);
|
const ses = session.fromPartition(SESSION_PARTITION);
|
||||||
const all = await ses.cookies.get({});
|
const all = await ses.cookies.get({});
|
||||||
const yaCookies = all.filter((cookie) => {
|
return all
|
||||||
return cookie.domain != null && YANDEX_COOKIE_DOMAINS.some((d) => cookie.domain!.includes(d));
|
.filter((c) => c.domain != null && YANDEX_COOKIE_DOMAINS.some((d) => c.domain!.includes(d)))
|
||||||
});
|
.map((c) => ({ name: c.name, value: c.value }));
|
||||||
return yaCookies.map((cookie) => `${cookie.name}=${cookie.value}`).join('; ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,8 +21,8 @@ const (
|
|||||||
HandshakeBuf = 258
|
HandshakeBuf = 258
|
||||||
UDPBufSize = 4096
|
UDPBufSize = 4096
|
||||||
RTPBufSize = 65536
|
RTPBufSize = 65536
|
||||||
// VP8BufSize fits one RTP packet: 1200 MTU - 1 VP8 descriptor - 5 tunnel header - 9 protocol frame
|
// VP8BufSize fits one RTP packet: 1200 MTU - 1 VP8 descriptor - 22 tunnel header - 9 protocol frame
|
||||||
VP8BufSize = 1185
|
VP8BufSize = 1168
|
||||||
DCBufSize = 32768
|
DCBufSize = 32768
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user