add bitrix support

This commit is contained in:
kulikov0 committed 2026-09-07 21:14:11 +02:00
1 parent 747f8f2312
commit 5690cf58a9
62 files changed
+4098 -1053

No files matched your search

+11
View File
@@ -56,6 +56,7 @@ export function renderContent(tm: RendererTabManager): void {
if (activeTab.platform === Platform.Telemost) title = 'Telemost';
else if (activeTab.platform === Platform.WBStream) title = 'WBStream';
else if (activeTab.platform === Platform.Dion) title = 'DION';
else if (activeTab.platform === Platform.Bitrix) title = 'Bitrix';
document.getElementById('headlessTitle')!.textContent = title;
const startEl = document.getElementById('headlessStart')!;
const statusEl = document.getElementById('headlessStatus')!;
@@ -70,12 +71,17 @@ export function renderContent(tm: RendererTabManager): void {
errorEl.textContent = '';
const dionAccountCard = document.getElementById('headlessDionAccountCard')!;
dionAccountCard.style.display = activeTab.platform === Platform.Dion ? '' : 'none';
const bitrixAccountCard = document.getElementById('headlessBitrixAccountCard')!;
bitrixAccountCard.style.display = activeTab.platform === Platform.Bitrix ? '' : 'none';
if (activeTab.platform === Platform.WBStream) {
targetLabel.textContent = 'Paste a room id or stream.wb.ru/room/<id> link.';
targetInput.placeholder = 'https://stream.wb.ru/room/<id>';
} else if (activeTab.platform === Platform.Dion) {
targetLabel.textContent = 'Paste a room id or dion.vc event link.';
targetInput.placeholder = 'abc-def-ghi';
} else if (activeTab.platform === Platform.Bitrix) {
targetLabel.textContent = 'Paste a portal /video/ link, or leave empty to create a new room.';
targetInput.placeholder = 'https://your-portal.bitrix24.ru/video/CODE';
} else if (activeTab.platform === Platform.Telemost) {
targetLabel.textContent = 'Paste a Telemost conference link.';
targetInput.placeholder = 'https://telemost.yandex.ru/j/...';
@@ -93,10 +99,12 @@ export function renderContent(tm: RendererTabManager): void {
const callInfoTM = document.getElementById('headlessCallInfoTM')!;
const callInfoWB = document.getElementById('headlessCallInfoWB')!;
const callInfoDion = document.getElementById('headlessCallInfoDion')!;
const callInfoBitrix = document.getElementById('headlessCallInfoBitrix')!;
callInfoVK.style.display = 'none';
callInfoTM.style.display = 'none';
callInfoWB.style.display = 'none';
callInfoDion.style.display = 'none';
callInfoBitrix.style.display = 'none';
if (callInfo) {
if (activeTab.platform === Platform.WBStream) {
callInfoWB.style.display = 'block';
@@ -108,6 +116,9 @@ export function renderContent(tm: RendererTabManager): void {
} else if (activeTab.platform === Platform.Dion) {
callInfoDion.style.display = 'block';
document.getElementById('headlessDionJoinLink')!.textContent = callInfo.joinLink || '';
} else if (activeTab.platform === Platform.Bitrix) {
callInfoBitrix.style.display = 'block';
document.getElementById('headlessBitrixJoinLink')!.textContent = callInfo.joinLink || '';
} else {
callInfoVK.style.display = 'block';
document.getElementById('headlessJoinLink')!.textContent = callInfo.joinLink || '';
+56 -29
View File
@@ -60,6 +60,7 @@ function bindToolbarEvents(): void {
document.getElementById('btnHeadlessTM')!.addEventListener('click', () => tm.switchToHeadless(Platform.Telemost));
document.getElementById('btnHeadlessWB')!.addEventListener('click', () => tm.switchToHeadless(Platform.WBStream));
document.getElementById('btnHeadlessDion')!.addEventListener('click', () => tm.switchToHeadless(Platform.Dion));
document.getElementById('btnHeadlessBitrix')!.addEventListener('click', () => tm.switchToHeadless(Platform.Bitrix));
document.getElementById('modeSelect')!.addEventListener('change', (event) => {
tm.setTunnelMode((event.target as HTMLSelectElement).value);
});
@@ -108,41 +109,52 @@ function bindSettingsEvents(): void {
});
}
function bindDionAccountEvents(): void {
document.getElementById('btnDionAccount')!.addEventListener('click', openDionAccount);
document.getElementById('dionAccountPopup')!.addEventListener('click', closeDionAccount);
document.querySelector('#dionAccountPopup .popup')!.addEventListener('click', (event) => event.stopPropagation());
document.getElementById('btnDionAccountCancel')!.addEventListener('click', closeDionAccount);
document.getElementById('btnDionAccountSave')!.addEventListener('click', async () => {
const email = (document.getElementById('dionEmail') as HTMLInputElement).value.trim();
const password = (document.getElementById('dionPassword') as HTMLInputElement).value;
const status = document.getElementById('dionAccountStatus')!;
interface AccountPopupConfig {
name: string;
fields: string[];
load: () => Promise<Record<string, string>>;
save: (values: Record<string, string>) => Promise<void>;
readError: string;
}
function bindAccountPopup(cfg: AccountPopupConfig): void {
const lc = cfg.name.toLowerCase();
const popup = document.getElementById(`${lc}AccountPopup`)!;
const status = document.getElementById(`${lc}AccountStatus`)!;
const field = (key: string) =>
document.getElementById(`${lc}${key[0].toUpperCase()}${key.slice(1)}`) as HTMLInputElement;
const close = (): void => popup.classList.remove('visible');
const open = async (): Promise<void> => {
status.textContent = '';
popup.classList.add('visible');
try {
await window.bridge.setDionCredentials(email, password);
closeDionAccount();
const values = await cfg.load();
for (const key of cfg.fields) field(key).value = values[key] ?? '';
} catch {
status.textContent = cfg.readError;
}
};
document.getElementById(`btn${cfg.name}Account`)!.addEventListener('click', open);
popup.addEventListener('click', close);
popup.querySelector('.popup')!.addEventListener('click', (event) => event.stopPropagation());
document.getElementById(`btn${cfg.name}AccountCancel`)!.addEventListener('click', close);
document.getElementById(`btn${cfg.name}AccountSave`)!.addEventListener('click', async () => {
const values: Record<string, string> = {};
for (const key of cfg.fields) {
const raw = field(key).value;
values[key] = key === 'password' ? raw : raw.trim();
}
try {
await cfg.save(values);
close();
} catch {
status.textContent = 'Failed to save the credentials.';
}
});
}
async function openDionAccount(): Promise<void> {
const status = document.getElementById('dionAccountStatus')!;
status.textContent = '';
document.getElementById('dionAccountPopup')!.classList.add('visible');
try {
const credentials = await window.bridge.getDionCredentials();
(document.getElementById('dionEmail') as HTMLInputElement).value = credentials.email;
(document.getElementById('dionPassword') as HTMLInputElement).value = credentials.password;
} catch {
status.textContent = 'Failed to read the session file.';
}
}
function closeDionAccount(): void {
document.getElementById('dionAccountPopup')!.classList.remove('visible');
}
function bindErrorPopup(): void {
document.getElementById('errorPopup')!.addEventListener('click', closeError);
document.querySelector('#errorPopup .popup')!.addEventListener('click', (event) => event.stopPropagation());
@@ -224,7 +236,20 @@ function init(): void {
bindToolbarEvents();
bindActionBarEvents();
bindSettingsEvents();
bindDionAccountEvents();
bindAccountPopup({
name: 'Dion',
fields: ['email', 'password'],
load: async () => ({ ...(await window.bridge.getDionCredentials()) }),
save: (v) => window.bridge.setDionCredentials(v.email, v.password),
readError: 'Failed to read the session file.',
});
bindAccountPopup({
name: 'Bitrix',
fields: ['portal', 'email', 'password'],
load: async () => ({ ...(await window.bridge.getBitrixCredentials()) }),
save: (v) => window.bridge.setBitrixCredentials(v.portal, v.email, v.password),
readError: 'Failed to read the account file.',
});
bindErrorPopup();
bindLogEvents();
bindHeadlessEvents();
@@ -253,6 +278,8 @@ function init(): void {
tm.switchToHeadless(Platform.WBStream, data.joinTarget);
} else if (data.mode === TunnelMode.HeadlessDion) {
tm.switchToHeadless(Platform.Dion, data.joinTarget);
} else if (data.mode === TunnelMode.HeadlessBitrix) {
tm.switchToHeadless(Platform.Bitrix, data.joinTarget);
} else {
const url = data.platform === Platform.Telemost ? TELEMOST_URL : VK_IM_URL;
loadURL(tm, url);
+7 -1
View File
@@ -70,6 +70,10 @@ export class RendererTabManager {
tab.mode = TunnelMode.HeadlessDion;
if (!tab.isBot) tab.name = 'DION';
break;
case Platform.Bitrix:
tab.mode = TunnelMode.HeadlessBitrix;
if (!tab.isBot) tab.name = 'Bitrix';
break;
default:
tab.mode = TunnelMode.HeadlessVK;
if (!tab.isBot) tab.name = 'VK';
@@ -109,11 +113,13 @@ export class RendererTabManager {
data.mode === TunnelMode.HeadlessVK ||
data.mode === TunnelMode.HeadlessTelemost ||
data.mode === TunnelMode.HeadlessWBStream ||
data.mode === TunnelMode.HeadlessDion;
data.mode === TunnelMode.HeadlessDion ||
data.mode === TunnelMode.HeadlessBitrix;
let platformName = 'VK';
if (data.platform === Platform.Telemost) platformName = 'Telemost';
else if (data.platform === Platform.WBStream) platformName = 'WBStream';
else if (data.platform === Platform.Dion) platformName = 'DION';
else if (data.platform === Platform.Bitrix) platformName = 'Bitrix';
const botName = isHeadless ? `Bot-${platformName}` : `Bot-${platformName} (legacy)`;
this.tabs[data.tabId] = {
wv: null,